Skip to main content
POST
Learn messages or files

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

One message as a string in content, or a list of up to 100 messages. With a list, set speaker, speaker_id, timestamp and metadata on each message, not beside content.

content
required

One message as a string, or a list of up to 100 messages, each with its own speaker.

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.

speaker
string | null

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

Required string length: 1 - 200

Response

Accepted for learning. A message call's Location points at its status; a file call names each file's observation in files instead.

What an observe call accepted. Learning runs in the background.

observation_id
string | null
required

A message call's background learning: poll GET .../observe/{observation_id} for its progress. Null for a file call, whose files name one each.

files
ObservedFile · object[] | null
required

A file call's files, every one in the order sent, each with its own observation. The agent reads them in the background one at a time, after any file it is already reading. Null for a message call.