Getting started with Forecasts API
Overview
The Forecasts API delivers fast, accurate, and scalable demand forecasts, and the real-world events that impact your business power them. Whether you’re starting from scratch or augmenting an existing model, our event-driven forecasting approach improves accuracy, unlocking significant ROI and cutting development time by months.
This API provides ready-to-use, event-optimized forecasts for your business, embedding the impact of sports, concerts, school holidays, and more directly into the forecast output. There’s no need to source or model event effects separately—we handle it for you.
Why use it:
Event-aware by default: we build real-world events into every forecast
Industry-specific performance—designed for demand planners, revenue managers, and ops teams
Faster and more affordable than building your own system
PredictHQ’s Forecasts API is the only event-driven, fully automated forecasting solution available—built to get you to accurate forecasts without the complexity.
SageMaker demo
Forecasts API can be used anywhere you can run code (SageMaker, Snowflake, Databricks etc). The demo here is running in AWS SageMaker.
Requirements
Before you start, you need the following:
An API Token.
To run an example yourself and adapt it to your needs, use our Notebook.
All code snippets in this guide assume the appropriate config has already been set:
Forecasting workflow
The workflow has these stages:
Prepare your data
To generate a forecast, you need to provide a daily time series with two columns:
date
The date of the observation, in YYYY-MM-DD format (ISO 8601).
demand
The actual demand value for that date (e.g. units sold, bookings).
Requirements:
The data must be daily level
Provide at least 18 months of history for best results
The API rejects demand data that contains duplicated dates, missing values in the demand column, or non-numeric demand values
Example:
Create a model
The API ties each forecast model to a Saved Location, so you can define the location once and create multiple models for it. For this example we're going to look at a theoretical restaurant located by the O2 Arena in London.
Create a Saved Location using Predicted Impact Area
Predicted Impact Area calculates the optimal boundary around your business to capture the events that drive demand. To use it, create a Saved Location with origin_geojson—the API calculates the Predicted Impact Area automatically and stores it against the location, as this code shows:
After creating the Saved Location, we can re-use it across as many forecast models as we need.
Create a model
To create the model, run this code:
Upload demand data
To upload your demand data, run this code:
Train the model
During the training process, Beam analyzes the demand to determine what types of events impact your demand. This includes correlation and Feature Importance testing. The API uses the important features (from Features API) when training your model and when forecasting. To train the model, run this code:
Training usually takes a few minutes.
Evaluate the forecast model
To compare the model performance to other models, benchmarks, etc., use evaluation metrics such as MAPE. In this example, the benchmark model had a MAPE of 8.96%, as this code shows:
Lower values indicate better accuracy. See the Understanding forecast accuracy metrics guide for help interpreting MAPE, MAE, and RMSE.
Retrieve the forecast
To get the forecast, run this code:
Visualize the actual demand we uploaded as well as the forecasted demand we just retrieved:

Ongoing forecasting
After you have trained a model you can keep using that model in your ongoing workflow:
Explainability
Every date in the forecast response includes a forecast value—that’s the core output you’ll use. Optionally, you can request explainability to get additional context on why the model predicted that value for a given day. This includes a list of impactful real-world events (e.g. school holidays, concerts) that the model considered significant for that date. The API can provide two key pieces of explainability:
phq_explainability- Top events the model has determined are impacting your demand on this date.phq_features- List of features (from Features API) that Beam's Feature Importance process identified as relevant to your demand, as well as their values. This field is only available if you also purchase our Features product.
Here's an example truncated response for a single date showing phq_explainability:
Tips for better forecasts
To get the most accurate results from the Forecasts API, your input data needs to reflect meaningful demand patterns over time. Here are key tips to improve forecast performance and reliability:
Include enough history: At least 18 months of daily demand helps the model learn seasonal and event-driven patterns.
Keep it consistent: Submit clean, continuous daily data—no smoothing, gaps, or placeholder values.
Avoid over-segmentation: Low-volume or highly granular series often perform worse. Aggregate where possible.
Watch out for tiny values: Very small but non-zero demand can distort percentage-based metrics like MAPE.
Exclude outliers if needed: Remove early COVID-19 disruptions or other non-repeating anomalies if they don’t reflect current demand.
For more detailed recommendations, see the Troubleshooting Guide.
Troubleshooting
If your forecasts aren’t meeting expectations, don’t worry—there are several common reasons why accuracy might be lower than expected. We’ve put together a dedicated Troubleshooting Guide to help you identify and resolve these issues.
The guide covers topics like:
What to do if your forecast accuracy is poor (e.g. noisy or low-volume data)
Why not enough history can reduce model performance
How overly fine-grained series can lead to weak signals
When to remove early COVID-19 disruptions from your dataset
We also have a guide on understanding forecast accuracy metrics (MAPE, MAE, RMSE) meaningfully.
Next steps
To continue:
Forecasts API Reference - Full schema, endpoints, and parameters
Understanding forecast accuracy metrics - Guide to interpreting MAPE, MAE, and RMSE
Troubleshooting guide for Forecasts API - Common causes of low accuracy and how to fix them
Last updated
Was this helpful?