Submit outcomes
POST /v1/models/{id}/outcomes
apiKeyX-Spavik-Api-Key<token>Spavik integration API key (sk-spv-api-...), sent in X-Spavik-Api-Key.
id*stringModel identifier or slug
Idempotency-Key?stringSame 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?stringInformation 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.
length <= 1024X-Spavik-Client-Name?stringHTTP 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.
length <= 128X-Spavik-Client-Version?stringVersion 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.
length <= 64application/json- body
outcomes*array<>1 <= items <= 1000Success
application/json- response
accepted?integerpending_outcomes?integerunresolved?array<string>DeprecatedDeprecated: 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.
items <= 0refresh_triggered?booleanModel on auto_update: this batch started an integration.
refresh_suggested?booleanTrue 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