API reference
API overview
The REST API serves both models. The Python library and the command line are built on it, and any language can call it directly.
https://api.yhatlabs.comAuthentication
Section titled “Authentication”Send your key in the Authorization header. This reads the API’s request limits, a quick way to check the key works:
curl -s https://api.yhatlabs.com/v1/limits -H "Authorization: Bearer $YHAT_API_KEY" | python3 -m json.tool{ "forecast": { "max_series": 256, "max_points_per_series": 32768, "max_total_points": 8000000, "max_horizon": 2048, "max_columns": 256, "native_quantile_levels": [ 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9 ] }, "tabular": { "max_rows": 200000, "max_bytes": 67108864, "presets": [ "fast", "medium", "full" ], "max_quantiles": 32, "fit_ttl_hours": { "default": 24, "max": 168 }, "max_upload_bytes": 1073741824, "max_table_storage_bytes": 10737418240, "max_tables": 200 }, "pricing": { "forecast": { "unit": "series", "counts": "one per target column of each series" }, "tabular": { "unit": "credits", "fit_cells_per_credit": 1000000, "preset_multiplier": { "fast": 1, "medium": 3, "full": 8 }, "predict_rows_per_credit": 10000, "importance_rows_per_credit": 10000, "min_credits": 1 } }, "rate": { "requests_per_minute": 120, "concurrent": { "forecast": 8, "tabular": 2, "upload": 4 } }, "capabilities": { "idempotency_keys": true, "gzip_requests": true, "forecast_quantile_levels": true, "forecast_samples": true, "forecast_history": true, "tabular_distribution": true, "tabular_prediction_sets": true, "fit_groups": true, "table_uploads": true }}Endpoints
Section titled “Endpoints”| Method | Path | What it does |
|---|---|---|
POST |
/v1/series/forecast | forecasts a batch of series |
POST |
/v1/table/predict | fits on a table and predicts rows, in one call |
POST |
/v1/table/fits | fits a table once and keeps the fit |
POST |
/v1/table/fits/{id}/predict | predicts rows from a stored fit |
POST |
/v1/table/fits/{id}/importance | column importance of a stored fit |
GET |
/v1/table/fits, /v1/table/fits/{id} |
lists fits, reads one |
DELETE |
/v1/table/fits/{id} |
deletes a fit |
GET |
/v1/models, /v1/usage, /v1/limits | the key’s models, its quota, and the request caps |
POST |
/v1/uploads | uploads a large table once, to use by reference |
GET |
/v1/openapi.json | the OpenAPI 3.1 description of every endpoint and field, for client generators and tools |
Conventions
Section titled “Conventions”- Requests and responses are JSON (
Content-Type: application/json). - Every response has an
X-Request-Idheader. Quote it when you contact us. - Errors have one shape:
{"error": {"type": ..., "message": ..., "request_id": ...}}; see Errors. - Retries without duplicates:
POST /v1/table/fitsandPOST /v1/table/predictaccept anIdempotency-Keyheader (8 to 128 letters, digits,-or_). Send the same key when you retry: a call that already succeeded returns its first reply, markedIdempotent-Replayed: true, with no second fit and no second charge; a retry that arrives while the first call still runs gets409 request_in_progresswithRetry-After. Failed calls are not kept, so their retry runs again. Keys are kept for 24 hours, per API key.
BODY='{"train": [{"x": 1, "y": 0}, {"x": 2, "y": 0}, {"x": 3, "y": 1}, {"x": 4, "y": 1}, {"x": 5, "y": 1}, {"x": 6, "y": 0}], "target": "y", "test": [{"x": 2.5}]}'KEY="retry-$(date +%s)"for attempt in 1 2; do # the second call is what a retry after a dropped connection sends curl -s -D - -o /dev/null https://api.yhatlabs.com/v1/table/predict \ -H "Authorization: Bearer $YHAT_API_KEY" -H "Idempotency-Key: $KEY" -H "Content-Type: application/json" -d "$BODY" \ | grep -iE "^HTTP|^idempotent-replayed" | tr -d '\r'doneHTTP/2 200HTTP/2 409- Capabilities:
GET /v1/limitslists, undercapabilities, the features this API has switched on (idempotency_keys,gzip_requests, …). A missing flag means off. - Long calls: a call that runs longer than 30 seconds (a large tabular fit, for example) switches to a
200response that sends a space every 20 seconds and then the JSON body. Leading spaces are valid JSON, so ordinary clients parse it unchanged, and the connection never idles long enough for a proxy to drop it. An error after the switch arrives in the body as{"error": ...}with status200, so check for anerrorkey.

