Skip to main content
GET
Get file

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.

Path Parameters

agent_id
string
required

The agent's identifier.

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

The file's id.

Pattern: ^(?:src_|img_)[0-9a-f]{32}$

Response

Successful Response

A file uploaded to an agent, and how far the agent has got with learning it.

file_id
string
required

The file's id.

thread_id
string | null
required

The thread the file was uploaded into; null when it is not known or the caller may not open that thread.

filename
string
required

The file's name as uploaded.

media_type
string
required

The file's media type.

size_bytes
integer
required

The file's size in bytes.

Required range: x >= 0
created_at
string<date-time>
required

When the file was uploaded.

memory_state
enum<string>
required

learned when the agent has learned from the file; available when it is kept but not yet learned from.

Available options:
learned,
available
upload_state
enum<string> | null
required

Where an unfinished upload stands: learning, resuming (by itself, after a restart), partial (stopped partway) or failed. null when nothing is unfinished.

Available options:
learning,
resuming,
partial,
failed
turns_done
integer | null
required

Turns learned so far, or before a partial upload stopped; null when nothing is unfinished.

turns_total
integer | null
required

Turns the upload has to learn; null when nothing is unfinished.

stop_reason
enum<string> | null
required

Why a partial or failed upload ended: cancelled (it was stopped), learning_stopped (a section could not be learned; resume to try again) or unreadable (try another copy or format). null otherwise.

Available options:
cancelled,
learning_stopped,
unreadable
figures_unread
integer | null
required

Pictures in the document that could not be read, even when its text was learned whole.

figures_retry
enum<string> | null
required

running: the unread pictures are being read again. available: resume with only: "pictures" to read them again. null when reading them again cannot help.

Available options:
running,
available
can_finish
boolean | null
required

For a partial or failed upload: true when the caller may resume it in its upload thread, charged only for what is left. When false, resume it in another thread, charged in full.

finish_blocked
enum<string> | null
required

Why can_finish is false: not_yours (the caller may not open the upload thread) or conversation_gone (that thread no longer exists). null otherwise.

Available options:
not_yours,
conversation_gone
parent_file_id
string | null
required

The document a picture was cut from; null for a file uploaded on its own.

href
string
required

Where to download the file, with the same credentials.