Score behaviors with Span-01

Use Span-01 to check a conversation for behaviors you describe in plain language. The endpoint returns probabilities showing whether each behavior is present, absent, or cannot be judged from the conversation. In the example, a customer complains that their order is late, and the assistant apologizes: - `span.input` contains the customer's message. - `span.output` contains the assistant's reply. - `behaviors` defines two checks: `frustrated` checks whether the user expresses frustration, and `apology` checks whether the assistant apologizes. Each result uses the same `id` as its check. In the captured response, `p_present` is **0.4459707 (about 45%)** for `frustrated` and **0.9433637 (about 94%)** for `apology`. For each check: - `p_present` is the probability that the behavior is present. - `p_absent` is the probability that it is absent. - `p_not_observable` is the probability that there is not enough evidence to judge. These three probabilities sum to approximately 1. The example response was captured from a live call using `span-01-free`.

Authentication

AuthorizationBearer
Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer <RESPAN_API_KEY>. For /api/responses, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -> Providers or respan_params.credential_override in the request body, not in this authentication field.

Request

This endpoint expects an object.
spanobjectRequired
The conversation content to score: preceding messages in input and the turn being judged in output.
behaviorslist of objectsRequired
The rubric: one ID and plain-language definition per behavior. There is no per-request behavior-count cap. Definitions count toward usage.input_tokens.
modelstringOptionalDefaults to span-01-free
Use span-01-free or span-01-pro. Omit for span-01-free.
respan_paramsobjectOptional
Optional Respan gateway parameters for logging and attribution. These are removed before the request reaches the scorer. See the Respan gateway parameters guide for other supported fields.

Response headers

X-Respan-Log-IdstringOptional
ID of the Respan request log. Use it to find the scoring call in your organization's logs. It may be absent when a request is rejected before a log is created.

Response

Behavior probabilities for the submitted span. The example is the captured response to the request shown.
modelenum
The model that scored the span.
Allowed values:
resultslist of objects
One result per behavior, in the same order as the request. Match each result using its id.
usageobjectOptional
Token usage, when reported by the scorer. May be omitted if the scorer does not report token counts.

Errors

400
Bad Request Error
402
Payment Required Error
403
Forbidden Error
413
Content Too Large Error
422
Unprocessable Entity Error
424
Failed Dependency Error
429
Too Many Requests Error
503
Service Unavailable Error
504
Gateway Timeout Error