Authorization: Bearer <key>. Every key belongs to one project and acts with one role there. Use a service-account key for production and a personal key to build and test.
Both kinds look the same. The key’s record, not its prefix, says whose key it is. Every response to a personal key carries
X-SP-Warning: personal API key, not for production.
Both headers are literal strings. There is no signing, no timestamp, and no nonce, so there is nothing for a client library to compute and no clock skew to handle.
Get a key
You create a key in the Priors app, on the project’s API keys page. No endpoint creates or revokes a key, and no key can create another key. A key that could create keys would turn one leak into an unbounded supply.- A service-account key: choose Create key, tick Mark as service account key, and pick the service account’s role. Only Project admins and Org admins can. See Service accounts.
- A personal key: choose Create key, leave the box unticked, and confirm For building and testing, not production.
Keys expire
Every key has a deadline that you choose when you create it and cannot change later. A key stops working the moment the deadline passes, and nothing reaches your code to say so. An expired key returns the same401 as an unknown one, so the first sign of a missed rotation is your own traffic failing.
The API keys page shows the expiry date of every key. Read the date when you store the secret, and put the rotation in your calendar then. To rotate without downtime, create the new key, deploy it, then revoke the old one.
Name one of your customers
This section is for service-account keys. Every other key refusesX-SP-End-User with 400.
X-SP-End-User is your own identifier for the person a request acts for: an account number, a row id, anything stable on your side. Priors does not store the value. It hashes the value together with your organization id, so two organizations that send the same string are still two different people.
Learned memory is shared across an agent either way. Only the thread list narrows. To keep two customers’ facts apart, give them two agents.
Send the header on every call for that person, not only when you create the thread. It also decides which rate-limit window the call spends from. See Limits.
Use a personal key
A personal key is you, calling from code instead of from the Priors app. It acts with your role in its project and reaches what you reach there, and nothing more. See Roles and permissions.- An agent you create with it lives in the key’s project. If you are a Contributor, the agent is private.
- A thread you create belongs to you.
- Your calls spend from your own rate-limit windows, the same windows as your own use of the Priors app.
503 service_unavailable. Wait, then try again.
See Use Priors with a personal key for the steps from creating a key to a first answer.
Keep the key on your server
A key belongs on your server or your own machine. It must never reach a browser or a mobile app. A key in front-end code is in your bundle, and anyone who loads the page can read it, whether or not the request itself succeeds. Two things stop that happening by accident:- Priors sends no CORS headers, so a browser blocks the call before it leaves the page.
- A request that carries a key and a
Sec-Fetch-Siteheader is refused with400. Only a browser sets that header, and page JavaScript can neither remove it nor forge it.
Origin or Referer. If your own infrastructure adds either header, nothing here minds.
Ownership
Every agent, thread, observation, and file belongs to the project and organization it was created in. No other organization can see it, and a key never reaches another project. When a caller asks for an id it does not reach, Priors returns404, not 403. An id never reveals that something exists.
X-SP-End-User only ever narrows what a key reaches. It never widens it.
Keys from before projects
spu_personal keys still work. Each one acts as you in your organization’s Default project, so it reaches only what your role there allows. New personal keys arespk_.sp_app keys no longer reach agents: their calls return403. Replace each one with a service-account key in the project your product uses.
Errors
Check what your key resolves to
GET/v2/me confirms who your key acts as and which organization it belongs to. Call it once when your client starts.
With a service-account key:
api_key names the key, the one project it works in, and who it acts as: acts_as.type is service_account or user. With a personal key, user is you: your own user_id, email, and display_name, as the Priors app shows them.