API Documentation

Integrate AI-powered time series forecasting into your application.

Authentication

All API requests require an X-API-Key header. Find your API key on the Dashboard after subscribing.

X-API-Key: sk_your_api_key_here

Base URL

https://www.agentforecast.ai/api

Sign up to get your API key.

POST /tasks

Submit a new forecasting task. Returns a task ID for tracking. Usage is metered on this endpoint only (counted on 201 response).

Request Body

Field Type Required Description
payload object Yes Forecast configuration and data
payload.parameters array Yes Forecast parameters (e.g. forecasting_length)
parameter string Yes Parameter name
value any Yes Parameter value
payload.data array Yes Time series datasets
dataset_type string Yes "feature"
values array Yes Array of {"datetime", "value"} objects

Common Parameters

Parameter Type Description
forecasting_length integer Duration to forecast ahead, in minutes.
Output intervals match the time granularity of the input data.
latitude float Latitude for location-aware weather data
longitude float Longitude for location-aware weather data
region string Represented as an IANA timezone (e.g. Europe/London)
webhook_url string URL to receive a notification when the forecast completes

Example Request

POST /api/tasks
curl -X POST https://www.agentforecast.ai/api/tasks \
  -H "X-API-Key: sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "payload": {
      "parameters": [
        {"parameter": "forecasting_length", "value": 2880}
      ],
      "data": [
        {
          "dataset_type": "feature",
          "values": [
            {"datetime": "2026-03-07T00:00:00+00:00", "value": 142.5},
            {"datetime": "2026-03-08T00:00:00+00:00", "value": 135.2},
            {"datetime": "2026-03-09T00:00:00+00:00", "value": 147.8},
            {"datetime": "2026-03-10T00:00:00+00:00", "value": 130.1},
            {"datetime": "2026-03-11T00:00:00+00:00", "value": 132.0},
            {"datetime": "2026-03-12T00:00:00+00:00", "value": 125.8},
            {"datetime": "2026-03-13T00:00:00+00:00", "value": 138.9}
          ]
        }
      ]
    }
  }'

Response (201 Created)

{
  "data": {
    "task_id": "abc123-def456-ghi789",
    "status": "pending"
  }
}

GET /tasks/{task_id}

Check the status of a forecast task. Poll this endpoint until status is done, or use a webhook.

Example Request

GET /api/tasks/{task_id}
curl https://www.agentforecast.ai/api/tasks/abc123-def456-ghi789 \
  -H "X-API-Key: sk_your_api_key"

Response (200 OK)

{
  "data": {
    "task_id": "abc123-def456-ghi789",
    "status": "done"
  }
}

Task Statuses

pending processing done failed

GET /tasks/{task_id}/result

Retrieve the forecast results once the task status is done.

Example Request

GET /api/tasks/{task_id}/result
curl https://www.agentforecast.ai/api/tasks/abc123-def456-ghi789/result \
  -H "X-API-Key: sk_your_api_key"

Response (200 OK)

{
  "data": [
    {"datetime": "2026-03-14T00:00:00+00:00", "value": 118.4},
    {"datetime": "2026-03-15T00:00:00+00:00", "value": 124.4}
  ]
}

Errors

Status Meaning When
401 Unauthorised Missing or invalid API key
403 Forbidden Subscription not active
429 Too Many Requests Monthly usage limit exceeded

Support

Need help? Contact us at support@agentforecast.ai