Spavik
API referenceModels

Submit outcomes

POST /v1/models/{id}/outcomes

Download OpenAPI
POST
/v1/models/{id}/outcomes

Authorization

apiKey
headerX-Spavik-Api-Key<token>

Spavik integration API key (sk-spv-api-...), sent in X-Spavik-Api-Key.

Path Parameters

id*string

Model identifier or slug

Header Parameters

Idempotency-Key?string

Same workspace, method, path, key and payload prevent another execution or charge, subject to current model access. Successful responses are replayed for every data policy from a technical idempotency store (default retention 24 hours from operation creation). The data policy only controls the archiving of inference inputs and outputs; it never changes replay behavior. A different key or an expired completed key starts a new operation and may be charged again. REQUEST_IN_PROGRESS: wait Retry-After. REQUEST_INTERRUPTED: outcome uncertain; contact support. IDEMPOTENCY_RESPONSE_UNAVAILABLE: a completed response is missing; do not retry with a new key. Completed keys expire; unresolved keys remain protected. Reusing a key with different input returns 422. A key is required on the original call for safe retries.

User-Agent?string

Information about the agent originating the request, when known. Browsers supply their own value. Optional diagnostic metadata, declared by the caller and never used for authorization. Omit unknown values. Values are trimmed and truncated to the documented length.

Lengthlength <= 1024
X-Spavik-Client-Name?string

HTTP caller: SDK, MCP server or direct application (for example spavik-sdk-python, spavik-sdk-javascript or spavik-mcp). Optional diagnostic metadata, declared by the caller and never used for authorization. Omit unknown values. Values are trimmed and truncated to the documented length.

Lengthlength <= 128
X-Spavik-Client-Version?string

Version of that SDK, MCP server or direct application. Optional diagnostic metadata, declared by the caller and never used for authorization. Omit unknown values. Values are trimmed and truncated to the documented length.

Lengthlength <= 64

Request Body

application/json
  1. body
outcomes*array<>
Items1 <= items <= 1000

Response Body

Success

application/json
  1. response
accepted?integer
pending_outcomes?integer
unresolved?array<string>Deprecated

Deprecated: always an empty array, kept so existing clients do not break. Do not read it. Every outcome carries its own features, so no outcome is ever left unresolved.

Itemsitems <= 0
refresh_triggered?boolean

Model on auto_update: this batch started an integration.

refresh_suggested?boolean

True when no integration was triggered by this batch and pending outcomes reached the suggestion threshold (50 by default). Call POST /v1/models/{id}/refresh to fold them in. Without auto_update, the model.stale webhook is also sent each time the pending count crosses a multiple of that threshold.

import requestsurl = "https://api.spavik.co/v1/models/string/outcomes"body = """{  "outcomes": [    {      "request_id": "req_4Nx7Bm2VtQd9Lp3Kwr",      "features": {        "plan": "pro",        "seats": 12,        "tickets_90d": 3      },      "actual": 1    },    {      "features": {        "plan": "free",        "seats": 2,        "tickets_90d": 10      },      "actual": 0    }  ]}"""response = requests.request("POST", url, data = body, headers = {  "Content-Type": "application/json"})print(response.text)
{  "accepted": 0,  "pending_outcomes": 0,  "unresolved": [],  "refresh_triggered": true,  "refresh_suggested": true}

How is this guide?

Last updated on