API Reference
The Forecasting API provides endpoints for managing forecast scenarios, external events, accuracy metrics, and channel projections.
Scope: Workspace-scoped — requires authenticated organization context and valid credentials for that workspace.
All requests require authentication. Include your API key in the Authorization header:
1Authorization: Bearer YOUR_API_KEYSee Authentication for details.
1https://app.betterdata.co/api/forecastAll requests must include:
1Content-Type: application/json2Authorization: Bearer YOUR_API_KEY| Method | Path | Summary | Auth | Stability | Permissions |
| ------ | ---- | ------- | ---- | --------- | ----------- |
| GET | /api/forecast | Generate demand forecasts | session | stable | forecast.read |
| GET | /api/forecast/change-history | Get forecast change history | session | stable | forecast.read |
| GET | /api/forecast/channel-projection | Get channel-level projections | session | stable | forecast.read |
| GET | /api/forecast/events | List external events | session | stable | forecast.read |
| POST | /api/forecast/events | Create an external event | session | stable | forecast.write |
| GET | /api/forecast/events/[id] | Get a specific event | session | stable | forecast.read |
| PUT | /api/forecast/events/[id] | Update an event | session | stable | forecast.write |
| DELETE | /api/forecast/events/[id] | Delete an event | session | stable | forecast.write |
| GET | /api/forecast/long-term | Get long-term forecast | session | stable | forecast.read |
| GET | /api/forecast/scenarios | List forecast scenarios | session | stable | forecast.read |
| POST | /api/forecast/scenarios | Create a new forecast scenario | session | stable | forecast.write |
| GET | /api/forecast/scenarios/[id] | Get a specific scenario | session | stable | forecast.read |
| PUT | /api/forecast/scenarios/[id] | Update a scenario | session | stable | forecast.write |
| DELETE | /api/forecast/scenarios/[id] | Archive a scenario | session | stable | forecast.write |
| POST | /api/forecast/scenarios/[id]/generate | Generate forecasts for a scenario | session | stable | forecast.write |
| POST | /api/forecast/scenarios/[id]/publish | Publish a scenario | session | stable | forecast.write |
| POST | /api/forecast/scenarios/compare | Compare multiple scenarios | session | stable | forecast.read |
1curl -X GET "https://app.betterdata.co/api/forecast/scenarios?status=PUBLISHED&type=BASELINE" \2 -H "Authorization: Bearer YOUR_API_KEY" \3 -H "Content-Type: application/json"Response:
1{2 "scenarios": [3 {4 "id": "scenario_123",5 "name": "Q1 2024 Baseline",6 "description": "Baseline forecast for Q1 2024",7 "type": "BASELINE",8 "status": "PUBLISHED",9 "createdAt": "2024-01-01T00:00:00Z",10 "updatedAt": "2024-01-15T00:00:00Z"11 }12 ]13}1curl -X POST "https://app.betterdata.co/api/forecast/scenarios" \2 -H "Authorization: Bearer YOUR_API_KEY" \3 -H "Content-Type: application/json" \4 -d '{5 "name": "Q2 2024 Promotional",6 "description": "Forecast with promotional events",7 "type": "PROMOTIONAL",8 "assumptions": {9 "narrative": "Q2 includes major promotional campaign",10 "globalLiftPct": 0.15,11 "includedEventIds": ["event_123", "event_456"]12 }13 }'Response:
1{2 "scenario": {3 "id": "scenario_456",4 "name": "Q2 2024 Promotional",5 "description": "Forecast with promotional events",6 "type": "PROMOTIONAL",7 "status": "DRAFT",8 "createdAt": "2024-03-01T00:00:00Z"9 }10}1curl -X POST "https://app.betterdata.co/api/forecast/events" \2 -H "Authorization: Bearer YOUR_API_KEY" \3 -H "Content-Type: application/json" \4 -d '{5 "name": "Summer Sale 2024",6 "type": "PROMOTION",7 "startsAt": "2024-06-01T00:00:00Z",8 "endsAt": "2024-06-30T23:59:59Z",9 "value": {10 "liftPct": 0.25,11 "stackingMode": "MULTIPLICATIVE",12 "description": "25% lift during summer sale"13 },14 "productMasterId": "prod_123"15 }'Response:
1{2 "id": "event_789",3 "name": "Summer Sale 2024",4 "type": "PROMOTION",5 "startsAt": "2024-06-01T00:00:00Z",6 "endsAt": "2024-06-30T23:59:59Z",7 "value": {8 "liftPct": 0.25,9 "stackingMode": "MULTIPLICATIVE"10 },11 "isGlobal": false,12 "isOrgWide": true,13 "productMaster": {14 "id": "prod_123",15 "name": "Product Name",16 "sku": "SKU-123"17 },18 "createdAt": "2024-03-15T00:00:00Z"19}1{2 "error": "Unauthorized"3}Cause: Missing or invalid API key.
Solution: Include a valid API key in the Authorization header.
1{2 "error": "Feature not enabled",3 "code": "FEATURE_NOT_ENABLED",4 "feature": "Demand Forecasting",5 "planCapability": "ai.forecasting.demand"6}Example error shape; exact field names may vary by API version.
Cause: Forecasting feature not enabled for your organization.
Solution: Contact your organization administrator to enable the forecasting feature.
1{2 "error": "Validation error",3 "details": {4 "name": ["Required"],5 "type": ["Invalid enum value"]6 }7}Cause: Invalid request parameters.
Solution: Review the request body and ensure all required fields are provided with valid values.
1{2 "error": "Scenario not found"3}Cause: The requested scenario or event doesn't exist or isn't accessible.
Solution: Verify the ID and ensure you have access to the resource.
status: Filter by status (DRAFT, PUBLISHED, ARCHIVED)type: Filter by type (BASELINE, PROMOTIONAL, CONSERVATIVE, OPTIMISTIC, CHANNEL_LAUNCH, CUSTOM)includeArchived: Include archived scenarios (boolean)from: Start date (ISO string, default: today)to: End date (ISO string, default: +90 days)productMasterId: Filter by productlocationId: Filter by locationtype: Filter by event typeincludeGlobal: Include global events (boolean, default: true)includeOrgWide: Include org-wide events (boolean, default: true)1{2 id: string;3 name: string;4 description?: string;5 type: "BASELINE" | "PROMOTIONAL" | "CONSERVATIVE" | "OPTIMISTIC" | "CHANNEL_LAUNCH" | "CUSTOM";6 status: "DRAFT" | "PUBLISHED" | "ARCHIVED";7 assumptions?: {8 narrative?: string;9 globalLiftPct?: number; "cmt">// -1 to 510 categoryAdjustments?: Array<{11 categoryId: string;12 liftPct: number;13 }>;14 channelAdjustments?: Array<{15 channelId: string;16 liftPct: number;17 }>;18 includedEventIds?: string[];19 };20 createdAt: string; "cmt">// ISO datetime21 updatedAt: string; "cmt">// ISO datetime22}1{2 id: string;3 name: string;4 type: "PROMOTION" | "PRICE_CHANGE" | "HOLIDAY" | "WEATHER" | "BOOKING" | "MACRO" | "OTHER";5 startsAt: string; "cmt">// ISO datetime6 endsAt: string; "cmt">// ISO datetime7 value?: {8 liftPct?: number; "cmt">// -0.99 to 59 stackingMode?: "MULTIPLICATIVE" | "ADDITIVE";10 description?: string;11 };12 isGlobal: boolean;13 isOrgWide: boolean;14 productMaster?: {15 id: string;16 name: string;17 sku: string;18 };19 location?: {20 id: string;21 name: string;22 code?: string;23 };24 createdAt: string; "cmt">// ISO datetime25}Forecasting API access requires the ai.forecasting.demand plan capability. Contact your organization administrator to enable forecasting features.
Scope: Workspace-scoped — requires authenticated organization context and valid credentials for that workspace.
GET /api/forecast/scenarios
See the OpenAPI bundle for endpoint-level details.
POST /api/forecast/scenarios
See the OpenAPI bundle for endpoint-level details.
GET /api/forecast/scenarios/{id}
See the OpenAPI bundle for endpoint-level details.
PATCH /api/forecast/scenarios/{id}
See the OpenAPI bundle for endpoint-level details.
POST /api/forecast/scenarios/{id}/generate
See the OpenAPI bundle for endpoint-level details.
POST /api/forecast/scenarios/{id}/publish
See the OpenAPI bundle for endpoint-level details.
Creating and publishing scenarios requires planning permissions. Viewing scenarios requires standard user permissions.
Scope: Workspace-scoped — requires authenticated organization context and valid credentials for that workspace.
GET /api/forecast/events
See the OpenAPI bundle for endpoint-level details.
POST /api/forecast/events
See the OpenAPI bundle for endpoint-level details.
GET /api/forecast/events/{id}
See the OpenAPI bundle for endpoint-level details.
PATCH /api/forecast/events/{id}
See the OpenAPI bundle for endpoint-level details.
DELETE /api/forecast/events/{id}
See the OpenAPI bundle for endpoint-level details.
Creating and managing events requires planning permissions. Viewing events requires standard user permissions.
Scope: Workspace-scoped — requires authenticated organization context and valid credentials for that workspace.
GET /api/forecast/accuracy
See the OpenAPI bundle for endpoint-level details.
GET /api/forecast/change-history
See the OpenAPI bundle for endpoint-level details.
Viewing forecast accuracy requires standard user permissions. All accuracy metrics are scoped to your organization.
Scope: Workspace-scoped — requires authenticated organization context and valid credentials for that workspace.
GET /api/forecast/channel-projection
See the OpenAPI bundle for endpoint-level details.
GET /api/forecast/long-term
See the OpenAPI bundle for endpoint-level details.
Viewing projections requires standard user permissions. All projections are scoped to your organization.
