Get started with Synthefy’s Cloud Forecasting API in minutes. This guide shows you the simplest way to make your first forecast request.
Prerequisites
Install the Client
API Key Setup
Get your API key from the Synthefy Console.
API Key Images: Detailed instructions with screenshots on how to obtain your API key from the console will be added here.
Simple Example
Here’s the simplest way to use the Synthefy Cloud API:
import pandas as pd
from synthefy import SynthefyAPIClient
# Constants
HISTORY_PERIODS = 5
HISTORY_SALES = [100, 105, 98, 110, 102]
TARGET_PERIODS = 7
# Prepare your data
history_df = pd.DataFrame({
'date': pd.date_range('2024-01-01', periods=HISTORY_PERIODS, freq='D'),
'sales': HISTORY_SALES
})
target_df = pd.DataFrame({
'date': pd.date_range('2024-01-06', periods=TARGET_PERIODS, freq='D'),
'sales': [None] * TARGET_PERIODS # What we want to predict
})
# Make the forecast
api_key = "your_api_key_here" # Get from https://console.synthefy.com/
with SynthefyAPIClient(
api_key=api_key,
base_url="https://forecast.synthefy.com",
endpoint="/v2/forecast"
) as client:
print("\nSending request...")
forecast_dfs = client.forecast_dfs(
history_dfs=[history_df],
target_dfs=[target_df],
target_col='sales',
timestamp_col='date',
metadata_cols=[],
leak_cols=[],
model='Migas-1.0'
)
# Get your predictions
forecast_df = forecast_dfs[0]
print(forecast_df)
That’s it! The forecast_dfs method handles all the complexity for you.
Next Steps