REST API Reference
Use DATFID directly via HTTP endpoints. All requests use multipart/form-data and accept Excel (.xlsx, .xls) or CSV (.csv) files.
Base URL
https://datfid-org-datfid-master.hf.space
Authentication
Include your API token as the session_id parameter in each request. See Get Your API Key to obtain a token.
POST/modelfit-file-demo/
Trains an interpretable model on your panel data. Returns a ZIP archive with analysis results, a trained model file, and a visualization.
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
file | File | Yes | Excel or CSV file with panel data |
session_id | String | Yes | Your API token / session identifier |
id_col | String | Yes | Entity column name |
time_col | String | Yes | Time column name |
y | String | Yes | Target variable column name |
current_features | String | No | "all" or comma-separated feature names |
lag_y | String | No | Lag range for target, e.g. "1:3" |
lagged_features | JSON String | No | JSON object mapping feature names to lag ranges, e.g. {"Income Level":"1:3"} |
Response
A ZIP archive containing:
analysis_results.csv— model coefficients and statisticsmodel.pkl— trained model file (used for forecasting)quicklook.png— visualization of model fit vs actual data
cURL Example
Terminal
curl -X POST "https://datfid-org-datfid-master.hf.space/modelfit-file-demo/" \
-F "file=@data.xlsx" \
-F "session_id=your_token" \
-F "id_col=Product" \
-F "time_col=Time" \
-F "y=Revenue" \
-F "current_features=all" \
-o results.zipPOST/modelforecast-file-demo/
Generates forecasts using a previously fitted model. Accepts a forecast data file and returns predictions as a ZIP archive.
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
session_id | String | Yes | Your API token (same as used for model fit) |
df_forecast | File | Yes | Excel or CSV file defining entities/periods to predict |
model_file | File | No | Custom model file (uses last fitted model if omitted) |
Response
A ZIP archive containing:
forecast.csv— predicted values for each entity/time pointquicklook.png— visualization of forecast predictions
cURL Example
Terminal
curl -X POST "https://datfid-org-datfid-master.hf.space/modelforecast-file-demo/" \
-F "session_id=your_token" \
-F "df_forecast=@forecast_data.xlsx" \
-o forecast.zip