Documentation › The endpoint

Outcomes

Report what happened after a call: to the outcome address returned with the answer (no API key), to the outcome API with your key, or to a node's signed webhook. Optional.

Optional#

Outcomes are optional. A call has its passport and its figures without them. Report an outcome when your own system knows something about the result of a call that OSPP cannot know: the answer was accepted, the ticket was solved, the customer gave a rating. See outcomes for the idea.

Metrics#

Every node takes two metrics without any setup:

MetricValue
scoreA whole number
countA whole number

They are created on the node's first outcome. You can define your own metrics per node on the Platform. A value for a metric the node does not have, or a value that is not a whole number, is refused with status 400.

Way 1: the outcome address#

Every answer carries the outcome address of that call: the X-OSPP-Outcome-URL response header, and ospp.outcome_url in the body. It has the form:

https://www.ospp.it.com/api/v1/o/<run_id>/<token>

POST JSON to it:

curl -X POST "$OUTCOME_URL" \
  -H "Content-Type: application/json" \
  -d '{"values": {"score": 1}}'

No API key is needed. That makes it usable from places where you do not want your key, such as a feedback button's backend or a webhook of another system. It also means the URL is a secret: whoever holds it can report an outcome for that one call. Do not log it publicly or send it to a browser.

The body#

FieldMeaning
valuesAn object of metric name and whole number, for example {"score": 1, "count": 3}
observed_atOptional. When it happened, in UTC, like 2026-11-17T10:00:00Z. Without it, the time of the report
idempotency_keyOptional. The same key with the same report is answered with the first report again ("recorded": false, "replayed": true) instead of recording a second one; with another report, or for another passport, it is refused with status 409 and the code IDEMPOTENCY_CONFLICT

A flat object of whole numbers is taken as the values, so {"score": 1} works as well as {"values": {"score": 1}}.

A recorded outcome is answered with status 200 and "recorded": true.

Reading the address#

GET on the same URL describes it: the passport id once there is one, the passport's status, and the body it takes. It says nothing about the call itself.

When the address refuses#

StatusCodeMeaning
409PASSPORT_PENDINGThe passport of this call is not issued yet. Send the outcome again in a moment
409NO_PASSPORTThe call failed; there is no passport to report on
429TOO_MANYMore than 30 updates in one minute for this passport
400OUTCOME_VALUESA metric the node does not have, a value that is not a whole number, no values, or an observed_at that is not a UTC time
404NOT_FOUNDThe address is not a valid outcome address

The address is returned with every answer, also while the passport is pending and on an answer-first stream. It accepts an outcome only once the passport is issued, so a report sent straight after a pending answer has to be tried again.

These errors are not in OpenAI's error shape: the body is {"detail": {"code": "...", "message": "..."}}.

In Python:

import httpx

raw = client.chat.completions.with_raw_response.create(model="provider/model-name", messages=messages)
outcome_url = raw.headers["x-ospp-outcome-url"]

# later, when you know how it went
httpx.post(outcome_url, json={"values": {"score": 1}})

Way 2: the outcome API#

With your API key, name the passport:

curl -X POST https://www.ospp.it.com/api/v1/outcomes \
  -H "Authorization: Bearer $OSPP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"passport_id": "<passport id>", "values": {"score": 4, "count": 1}}'

Use this when you kept the passport id but not the outcome URL. observed_at and idempotency_key work as above.

Instead of passport_id you can send reference: the value you gave the call with X-OSPP-Reference. If several passports carry that reference the report is refused with status 409 and the code REFERENCE_AMBIGUOUS; add node with the node's name, or report by passport id.

Way 3: the node's signed webhook#

A node can have one webhook address of its own, for a system that reports outcomes for many calls of that node and should hold neither your API key nor an outcome address per call: a helpdesk, a scheduler, an automation platform. Each delivery is signed with a secret that belongs to that node only.

OSPP does not call your system. Your system calls this address.

Switching it on#

The webhook is off until you switch it on for the node. An owner does that on the Platform: open the node from Passports, and under Outcomes choose "Connect outcomes". Three steps follow: who reports (choose "Another system"), what they report, and the address and secret to give that system. With the API it is the node's outcome settings, where delivery lists the ways the node accepts:

curl -X PUT "https://www.ospp.it.com/api/v1/procedures/<version id>/outcome-spec" \
  -H "Authorization: Bearer $OSPP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"metrics": [{"name": "score", "kind": "score"}, {"name": "count", "kind": "count"}],
       "delivery": ["address", "api", "webhook"], "min_interval_s": 0}'

The version id of a node is in the list of calls (GET /v1/calls, the field version_id). The settings apply to every version of the node. State every setting you want: delivery replaces the earlier list, and min_interval_s, the minimum time between two updates of one passport, is 3600 when you leave it out.

The answer carries the webhook:

FieldMeaning
webhook.urlThe address, of the form https://www.ospp.it.com/api/v1/outcomes/webhook/<webhook id>. It stays the same for the node
webhook.secretThe signing secret, starting with whsec_. It is shown once, when the webhook is created. Keep it in your system's secret store

Send "rotate_secret": true with the settings to get a new secret; the old one stops working at once. Leaving webhook out of delivery switches the webhook off: a delivery is then refused with status 403 and the code OUTCOME_DELIVERY.

Signing a delivery#

Send two headers with the JSON body:

HeaderValue
X-OSPP-TimestampThe time of sending, in Unix seconds
X-OSPP-Signaturesha256= followed by the hex HMAC-SHA256, with the secret as key, of the timestamp, a full stop and the body exactly as sent

A delivery is accepted when its timestamp is within five minutes of OSPP's clock. Sign the bytes you send: a body that is formatted again after signing does not verify.

BODY='{"passport_id": "<passport id>", "values": {"score": 1}}'
TS=$(date +%s)
SIG=$(printf '%s.%s' "$TS" "$BODY" | openssl dgst -sha256 -hmac "$OSPP_WEBHOOK_SECRET" | sed 's/^.* //')
curl -X POST "$OSPP_WEBHOOK_URL" \
  -H "Content-Type: application/json" \
  -H "X-OSPP-Timestamp: $TS" -H "X-OSPP-Signature: sha256=$SIG" \
  -d "$BODY"

In Python:

import hashlib, hmac, json, os, time, httpx

body = json.dumps({"passport_id": passport_id, "values": {"score": 1}}).encode()
ts = str(int(time.time()))
sig = hmac.new(os.environ["OSPP_WEBHOOK_SECRET"].encode(), ts.encode() + b"." + body, hashlib.sha256).hexdigest()
httpx.post(os.environ["OSPP_WEBHOOK_URL"], content=body,
           headers={"Content-Type": "application/json", "X-OSPP-Timestamp": ts, "X-OSPP-Signature": "sha256=" + sig})

The body#

The body is that of the outcome API: passport_id or reference, values, and optionally observed_at and idempotency_key. values has to be named here; a flat object is not taken. The webhook only accepts passports of its own node, so a reference is looked up among that node's calls.

A recorded outcome is answered with status 200 and "recorded": true.

When the webhook refuses#

StatusCodeMeaning
401BAD_SIGNATUREThe signature does not verify, the timestamp is not a number, or it is more than five minutes off
403OUTCOME_DELIVERYThe node does not accept outcomes by webhook (any more)
404NOT_FOUNDUnknown webhook address, or the passport is not of this webhook's node
400OUTCOME_SUBJECTNeither passport_id nor reference
400OUTCOME_VALUESThe body is not JSON, has no values, names a metric the node does not have, or a value is not a whole number
409IDEMPOTENCY_CONFLICTThe idempotency key was used for another report

The error body is {"detail": {"code": "...", "message": "..."}}.

The same settings can switch the other two ways off: a node whose delivery leaves out address or api refuses those with 403 OUTCOME_DELIVERY as well.

Several outcomes for one passport#

A passport can take any number of outcome updates, unless its node has outcome settings of its own: a node can set a minimum time between updates, a period in which outcomes are accepted, or close outcomes. Such a node refuses a report with 429 TOO_SOON, 409 OUTCOME_WINDOW or 409 OUTCOME_CLOSED. The latest value of each metric is the one the figures use: a first report of {"score": 1} and a later one of {"count": 3} give score 1 and count 3.

What happens with an outcome#

The outcome is appended to the passport's history as a witnessed event, labelled with how it arrived: address for the outcome address, api for the outcome API, webhook for the node's webhook. The original record of the call does not change. It then shows in the figures of the call's node and model on the Platform, and in Model Arena comparisons.

OSPP records what you report. It does not check that an outcome is true.

Choosing values#

  • Use score for a judgement of one call, on a scale you fix yourself, for example 1 for accepted and 0 for rejected, or 1 to 5.
  • Use count for something you count, for example the number of follow-up questions.
  • Keep the scale the same for all calls of a node, or its totals and averages mean nothing.
  • Values are whole numbers. Report a rating of 4.5 as 45 on a scale of 50, not as a decimal.