# Space Weather Data — Kp Index, Solar Flares & Alerts (`plaindata/space-weather-data`) Actor

Get space weather data as clean rows: alerts & warnings, planetary Kp index (observed + forecast), storm scales, X-ray solar flares, sunspot regions and solar wind. Data: NOAA SWPC (public domain), not affiliated.

- **URL**: https://apify.com/plaindata/space-weather-data.md
- **Developed by:** [plaindata](https://apify.com/plaindata) (community)
- **Categories:** Developer tools, AI, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 result returneds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Space Weather Data — Kp Index, Solar Flares & Alerts

Get **space weather data** as one clean table: **alerts, watches and warnings**, the **planetary Kp index** (observed and 3-day forecast), **R/S/G storm scales** with 3-day probabilities, **X-ray solar flares**, **sunspot regions** with flare probabilities and the latest **solar wind**. Built on the public JSON services of the NOAA Space Weather Prediction Center. Useful for aurora alert apps, HF radio and GNSS operators, satellite and power-grid monitoring, dashboards and AI agents.

### Input examples

```json
{ "datasets": ["alerts", "kpIndex", "scales"], "sinceHours": 72 }
{ "datasets": ["solarFlares"], "minFlareClass": "M", "sinceHours": 0 }
{ "datasets": ["alerts"], "alertKeyword": "Geomagnetic", "sinceHours": 168 }
{ "datasets": ["sunspotRegions", "solarWind"] }
```

### Output (one row per alert / value)

| Field | Meaning |
|---|---|
| dataset | alerts · kpIndex · scales · solarFlares · sunspotRegions · solarWind |
| time | UTC time of the alert, value or observation |
| label | Headline (e.g. "WARNING: Geomagnetic K-index of 4 expected", "M1.2 flare", "Kp predicted") |
| value | Numeric value (Kp, scale number, peak X-ray flux W/m², region area, km/s, nT) |
| level | NOAA scale (G1…G5, R1…, S1…), flare class letter or magnetic class |
| summary | Short text (alert type, flare class, scale text) |
| message, messageCode, serialNumber, productId | Alerts: full original message text and identifiers |
| kpType | observed / estimated / predicted |
| period, scale, probabilityMinorPct, probabilityMajorPct | Scales: current, past 24h or day 1–3 forecast |
| beginTime, peakTime, endTime, peakClass, satellite | Flares |
| region, location, area, numberSpots, spotClass, magneticClass, c/m/xFlareProbabilityPct, protonProbabilityPct | Sunspot regions (latest day) |
| sourceUrl, source | Product page and source statement |

### Data source & licence

NOAA Space Weather Prediction Center (a National Weather Service center), services.swpc.noaa.gov. NWS disclaimer: "The information on National Weather Service (NWS) Web pages are in the public domain, unless specifically noted otherwise, and may be used without charge for any lawful purpose" — provided it is not claimed as your own, no endorsement or affiliation is implied, and modified content is not presented as official government material. Values and alert text are passed through unmodified.

### Notes

This is an unofficial copy for convenience. For official forecasts and alerts use www.swpc.noaa.gov. One request per dataset per run. Not affiliated with or endorsed by NOAA or the National Weather Service.

# Actor input Schema

## `datasets` (type: `array`):

Which data to return. alerts = alerts, watches & warnings; kpIndex = planetary K-index, observed and 3-day forecast; scales = current R/S/G storm scales and 3-day probabilities; solarFlares = X-ray flares of the last 7 days; sunspotRegions = active sunspot regions with flare probabilities; solarWind = latest solar wind speed and magnetic field.

## `sinceHours` (type: `integer`):

Only alerts, Kp values and flares from the last N hours. 0 = everything available (alerts about 30 days, flares 7 days). Kp forecast rows are always kept.

## `alertKeyword` (type: `string`):

Keep only alerts whose text contains this word, e.g. Geomagnetic, Radio Blackout, Proton, CME.

## `minFlareClass` (type: `string`):

Smallest flare to return (by peak class).

## `maxItems` (type: `integer`):

Up to 10,000 per run.

## Actor input object example

```json
{
  "datasets": [
    "alerts",
    "kpIndex",
    "scales"
  ],
  "sinceHours": 72,
  "minFlareClass": "C",
  "maxItems": 1000
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "datasets": [
        "alerts",
        "kpIndex",
        "scales"
    ],
    "sinceHours": 72,
    "maxItems": 1000
};

// Run the Actor and wait for it to finish
const run = await client.actor("plaindata/space-weather-data").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "datasets": [
        "alerts",
        "kpIndex",
        "scales",
    ],
    "sinceHours": 72,
    "maxItems": 1000,
}

# Run the Actor and wait for it to finish
run = client.actor("plaindata/space-weather-data").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "datasets": [
    "alerts",
    "kpIndex",
    "scales"
  ],
  "sinceHours": 72,
  "maxItems": 1000
}' |
apify call plaindata/space-weather-data --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,plaindata/space-weather-data"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/9QePueJMkcGguvZLh/builds/emcUJ9JOSFFCtcKtH/openapi.json
