Create a prediction

Draw one or more sampled futures from a data profile. Requires a card on file.

POST/v1/predict

Request body

You name a data profile and the shape of the sample you want.

data_profilestringRequired

The name of one of your profiles, or a public profile such as temporis/polymarket.

countintegerRequired

The number of independent future trajectories to draw. Must be at least 1.

temperaturenumberRequired

Sampling temperature, greater than 0. Higher spreads the samples out; lower keeps them near the most-likely path.

top_pnumberRequired

Nucleus-sampling cutoff, in the range 0 to 1. Lower trims the unlikely tail; 1.0 keeps the full distribution.

count, temperature, and top_p are explained in depth in Predictions.

Example request

This draws five trajectories from the hourly_orders profile at neutral temperature:

curl https://api.temporis.co/v1/predict \
  -H "Authorization: Bearer $TEMPORIS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "data_profile": "hourly_orders",
    "count": 5,
    "temperature": 1.0,
    "top_p": 0.9
  }'
import os, requests

resp = requests.post(
    "https://api.temporis.co/v1/predict",
    headers={"Authorization": f"Bearer {os.environ['TEMPORIS_TOKEN']}"},
    json={
        "data_profile": "hourly_orders",
        "count": 5,
        "temperature": 1.0,
        "top_p": 0.9,
    },
)
resp.raise_for_status()
result = resp.json()
const resp = await fetch("https://api.temporis.co/v1/predict", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.TEMPORIS_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    data_profile: "hourly_orders",
    count: 5,
    temperature: 1.0,
    top_p: 0.9,
  }),
});
const result = await resp.json();

Response fields

A successful request returns HTTP 200 with this body.

request_idstring

A unique identifier for this prediction request.

data_profilestring

Echoes the profile name you requested.

predict_frominteger

Unix seconds: the last observed timestamp the forecast continues from. Every trajectory steps forward from here.

predictionsarray

The sampled trajectories. Length equals the count you requested.

Prediction object

lossnumber

Lower means the model considered this trajectory more typical. Use it to rank or pick a representative sample.

dataarray

The forecast rows. Each row has a timestamp plus one field per series name in the profile.

Example response

For the single-series orders profile above, with predict_from at the last observed hour and rows stepping forward one hour at a time:

{
  "request_id": "a3f9c1d7e84b2065",
  "data_profile": "hourly_orders",
  "predict_from": 1718852400,
  "predictions": [
    {
      "loss": 1.84,
      "data": [
        { "timestamp": 1718856000, "orders": 58 },
        { "timestamp": 1718859600, "orders": 61 },
        { "timestamp": 1718863200, "orders": 55 }
      ]
    },
    {
      "loss": 2.07,
      "data": [
        { "timestamp": 1718856000, "orders": 49 },
        { "timestamp": 1718859600, "orders": 66 },
        { "timestamp": 1718863200, "orders": 72 }
      ]
    }
    // remaining samples omitted
  ]
}

Public data profiles

You can forecast a shared dataset with no setup of your own by passing a public profile name as data_profile. These are maintained by Temporis and ready to serve:

{ "data_profile": "temporis/polymarket", "count": 3, "temperature": 1.0, "top_p": 0.9 }

Errors

Errors return the HTTP status plus a JSON body of the form { "detail": "..." }.

Statusdetail messageMeaning
400Invalid prediction parameters.A parameter is out of range, such as count below 1 or temperature not greater than 0.
402Add a credit card before using the API. / There is a payment issue. Add a new credit card.No active billing. Add or fix a card in the dashboard.
404Data profile not found.No profile by that name exists.
404Data profile is not ready to serve.The profile exists but has not finished preparing.
409Not enough data for this data profile.The profile has fewer than its minimum required history. Ingest more, then retry.
502Prediction failed.A transient server-side failure. Safe to retry with backoff.

See Errors & status codes for the complete reference.

Related