Quickstart Guide
Get started with ForecastAPI in just 5 minutes. This guide will walk you through making your first forecast request.
Prerequisites
You'll need an API key to get started. Sign up for a free account to get your key and 1,000 free API calls per month.
Step 1: Get Your API Key
-
1
Sign up for a free account at /register
-
2
Navigate to your Dashboard and click "API Keys"
-
3
Click "Generate New Key" and copy your API key
Step 2: Prepare Your Data
ForecastAPI works with time series data in a simple JSON format. Your data should include:
- date: The time period (YYYY-MM-DD) in UTC
- value: The numeric value for that period
Example Data Format
{
"data": [
{"date": "2024-01-01", "value": 120},
{"date": "2024-02-27", "value": 135},
{"date": "2024-03-31", "value": 155},
{"date": "2024-04-01", "value": 142},
{"date": "2024-05-01", "value": 168}
],
"periods": 6,
"frequency": "M",
"data_type": "sales"
}
Step 3: Make Your First Request
api.forecastapi.com
curl -X POST https://forecastapi.com/v2/forecast \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"data": [
{"date": "2024-01", "value": 120},
{"date": "2024-02", "value": 135},
{"date": "2024-03", "value": 155}
],
"periods": 6,
"frequency": "M"
}'
# Response in 287ms
{
"forecast": [
{"date": "2024-04", "value": 168.5, "lower": 162.3, "upper": 174.7},
{"date": "2024-05", "value": 175.2, "lower": 168.1, "upper": 182.3},
...
],
"method": "exponential_smoothing",
"confidence": 0.95
}
Understanding the Response
ForecastAPI returns a comprehensive response with your forecast and additional insights:
{
"forecast": [
{
"date": "2024-06",
"value": 175.2,
"lower": 168.1,
"upper": 182.3
},
{
"date": "2024-07",
"value": 181.5,
"lower": 173.8,
"upper": 189.2
}
],
"method": "exponential_smoothing",
"confidence": 0.95,
"analysis": {
"pattern_type": "regular",
"trend": "increasing",
"seasonality": "none_detected"
}
}
Response Fields
Field | Description |
---|---|
forecast | Array of forecast periods with predicted values and confidence intervals |
method | The forecasting algorithm that was automatically selected |
confidence | Confidence level for the prediction intervals (typically 0.95) |
analysis | Additional insights about your data patterns and trends |
Common Parameters
Data Type
Specify your data type for optimized model selection:
"sales"
- Sales data (uses intermittent demand methods for sparse data)"demand"
- Demand forecasting"inventory"
- Inventory levels"web_traffic"
- Website analyticsCustom values
- Any string for custom data types
Frequency
Specify your data frequency:
"D"
- Daily"W"
- Weekly"M"
- Monthly
"Q"
- Quarterly"Y"
- Yearly"H"
- Hourly