Skip to main content
POST
Answer

Authorizations

Authorization
string
header
required

An API key, shaped spk_<key_id>_<secret><checksum>, sent as Authorization: Bearer spk_.... Each key belongs to one project and reaches only that project: an id from another project answers 404.

  • A service account's key runs your product. It acts as the service account, with the role the service account holds in the project, and keeps working when people leave. It reaches the project's public agents, never a private one. Only this key may send X-SP-End-User.
  • A personal key acts as the person who created it, with their role in the project. It is for building and testing: every response carries X-SP-Warning: personal API key, not for production, and X-SP-End-User is refused with 400.

Keys are created and revoked on the API keys page of the Priors application. No API endpoint creates or revokes a service account's key. A personal key lasts 30, 90, or 365 days (90 by default), and a person can hold 10 live personal keys in an organization. A service account's key lasts 90 or 365 days (365 by default), and a service account can hold 5 live keys. The secret is shown once, at creation, and cannot be recovered.

A personal key made before projects (spu_...) keeps working until it expires, in its organization's Default project.

Keep keys on your server: a request with a Sec-Fetch-Site header is refused with 400, and Priors sends no CORS headers.

Headers

Idempotency-Key
string | null

A key you choose so a retry is safe: a retry with the same key and body gets the first response back instead of running again. Reusing a key for a different request, or while the first is still running, returns 409 conflict, with details idempotency_key_reused (use a new key) or idempotency_key_in_flight (wait, then retry).

Required string length: 1 - 255

Path Parameters

agent_id
string
required

The agent's identifier.

Pattern: ^agent_[0-9A-HJKMNP-TV-Z]{26}$
thread_id
string
required

The thread's identifier, scoped to the agent.

Pattern: ^thread_[0-9A-HJKMNP-TV-Z]{26}$

Body

application/json

One message for the agent to answer, with up to 10 images.

content
string
required

The message for the agent to answer.

Required string length: 1 - 2000000
speaker_id
string | null

Your own id for the speaker. Kept on the turn and returned with it.

Required string length: 1 - 200
timestamp
string<date-time> | null

When the message was said, used to date its memories. Defaults to when the server receives it.

metadata
TurnMetadata · object | null

Where the message came from, kept on the turn and returned with it.

files
ImageFile · object[] | null

Images for the agent to look at while it answers.

Required array length: 1 - 10 elements
speaker
string | null

Who said the message, such as a person's name. Required with an API key.

Required string length: 1 - 200
detail
enum<string>
default:standard

How long the answer should be: brief (a few sentences), standard, or detailed (every relevant fact, date, number and quote). It guides the agent; the answer is never truncated.

Available options:
brief,
standard,
detailed
stream
boolean
default:false

True to receive the answer as server-sent events (see the 200 response).

include_memories
boolean
default:false

True to return the memories the answer used, in memories.

Response

The answer as JSON or, with stream: true, as server-sent events: delta events with the answer's text as it is written, then one complete event with the JSON body or one error event.

The agent's answer to one message.

answer
string
required

The agent's answer.

citations
Citation · object[]
required

The files the answer drew on.

observation_id
string | null
required

Server-generated observation identifier.

Pattern: ^obs_[0-9A-HJKMNP-TV-Z]{26}$
memories
RecalledMemory · object[]

The memories the answer used, as recall returns them. Sent only when the request set include_memories.