Skip to main content
The Naive Managed Agents API authenticates with organization-scoped API keys. Every key belongs to a single organization and can act only on that org’s resources and credit balance.

The Bearer scheme

Send your key in the Authorization header on every request:
A missing or invalid key returns 401 unauthorized. A valid key acting outside its scopes returns 403 forbidden.
Live keys are prefixed sk_live_ and are shown once at creation. Store them in a secret manager — they cannot be retrieved again, only rotated.

Scopes

Keys carry scopes that limit what they can do. Scopes follow a resource:action grammar (e.g. agents:write, sessions:read). Every key names at least one; grant admin for full access to the organization. The last three rows are newer grants. A key’s scopes field lists only the original scopes, so older clients keep parsing it; the full list, including grants, is in grants. Keys can also be made from a preset (tools, tools_resources, read, full) with an expiry and a budget — see Keys.
proxy:write is deliberately narrow. The proxy routes accept it or sessions:write, so a key that reaches them today keeps working — but a credential that holds only proxy:write can make model calls and cannot start, cancel or read sessions. That is what makes it safe to hand to a sandbox: a harness that runs as a process inside a micro-VM needs a credential to reach the door, and one that leaked should not be able to run sessions for your organization.webhooks:* is one scope, spelled with the star: it is the only webhook scope, and it covers both reading and managing endpoints. billing:write gates the card-charging top-up endpoint and is deliberately separate from read-only billing:read.

Who is this credential?

GET /v1/me answers from the credential alone — no scope, no organization id in the request. It is the first call any client should make, and it is how the CLI and the dashboard learn which organization a key belongs to instead of asking you to paste an org_ id you have no way to look up.
Response
organization is null only for a signed-in person who does not belong to one yet; user is null whenever the caller is an API key rather than a person. GET /v1/organizations is the list form. An API key reaches exactly the one organization it is bound to — a one-row page, never another tenant’s row. A signed-in person reaches every organization they are a member of. Cursor-paginated, see Pagination.

Signing a person in

A person authenticates with an email address and the 6-digit code mailed to it (or, for an account that set one, a password) and receives a short-lived bearer session token prefixed vt_. It is accepted anywhere an sk_ key is, on the same Authorization: Bearer header, and its scopes are derived from the member’s role.
string
The account’s email address. Required with code or password when signing in fresh; omitted when re-scoping an existing vt_ token.
string
The 6-digit code mailed to email at sign-up, or by Resend. Single use. Typing it proves the address.
string
The account’s password, if it set one through Naive. Paired with email. A password set anywhere else signs nobody in.
string
The access token an external provider sign-in came back with. Verified against the provider on every call, and then refused unless it came from an external sign-in (Google), not a password. Used instead of email/code.
string
The organization to scope the session to. With an existing vt_ token this re-scopes the session — the org switcher. Must be an organization the person belongs to.
Request
Response
Presenting an existing vt_ token to the same route with an organization_id re-scopes the session to another organization you belong to — that is what an organization switcher is. Passing an organization_id you are not a member of returns 404 not_found. The new token keeps the presented token’s expires_at: re-scoping never extends a session. Sign in again to start a new 30 days.

Signing in with Google

The dashboard offers “Continue with Google” wherever the deployment has the provider turned on. It is the same route and the same session at the end of it: the provider hands back an access token, and that token is exchanged for a vt_.
Request
The token is verified against the provider on every call — it is never decoded or taken at face value, so a forged, expired or revoked one is 401 unauthorized, phrased exactly as a wrong code is. Two things are worth knowing before you build against it:
  • The address must be one your provider has verified. You are matched to your organizations by email address, so an unverified address is refused rather than signed in. Google verifies the addresses it asserts, so this is invisible in practice.
  • It signs you in; it does not enrol you. Signing in with Google as somebody who belongs to no organization gives you the same session a code sign-in would: organization_id: null, no scopes, and the choice of joining one or creating one. Your role and scopes always come from your membership — never from how you signed in, and never from anything the caller asks for.
POST /v1/auth/users registers a person. It takes an email and nothing else: no password exists until the address is proved, so nobody can set one on an address they do not own.
string
required
The address to register. A new dashboard account is mailed nothing yet; a taken address, or an app’s new account, is mailed a 6-digit code.
string
Which app the account was made in: creator or doomscroll. Omitted, it is the dashboard.
Request
Response
A new dashboard account is in at once: session is a vt_ that can set up a company but cannot pay or act outward until the code is typed. Those routes answer 403 email_unconfirmed until then. Sign in with { "email", "code" } on POST /v1/auth/session, presenting that vt_ as the bearer, and the company it started is proved with it. A code typed on another device signs that device in and leaves this session alone: it keeps only its own company, still cannot spend, and is proved when a code is typed beside it. A taken address gets no session, only a code to sign in with. An app that names return_to gets no session either: its person signs in with the code. More than five registrations of one address in a minute, or 20 an hour from one caller, answer 429 rate_limited. A new dashboard account gets its code at the first spend, from POST /v1/auth/confirmations, so it is fresh when typed. A registration that mails a code counts against the code limits below.
Session tokens are for interactive clients. Machine-to-machine callers should hold a scoped API key: a token expires and a key does not.

Codes and passwords

POST /v1/auth/confirmations mails a new 6-digit sign-in code (Resend, and “Email me a code”). It works for every account, with or without a password.
string
required
The address to mail the code to.
It answers 202 with the same body, at the same speed, whether or not that address has an account, and refuses alike at the limits. An endpoint that answered differently would be a way to discover who your users are. Do not branch on it; there is nothing to branch on.
Response
Limits on codes:
  • At most 5 codes an hour for one address from one caller, 20 an hour for one address from everyone, and 10 an hour from one caller.
  • One budget of codes an hour for the whole deployment, set below the mail provider’s own limit. Only a mail that went counts. Past it, every send answers 429 with “Too many sign-ins right now. Try again in a few minutes.”
  • A code is checked at most 5 times. After that it is dead, even the right one; mail a new code.
  • Checks are also capped at 5 a minute, 20 an hour and 50 a day per address and caller, at 100 an hour and 200 a day per address from everyone, and at 60 an hour per caller.
  • Password sign-ins are capped at 5 a minute and 20 an hour per address and caller.
There is no password reset by mailed link. A person who forgot a password signs in with a code, then sets a new one. POST /v1/auth/password sets a password for the signed-in person (the bearer). A session whose address is not proved yet is refused with 403 email_unconfirmed.
string
required
The new password. At least 8 characters.
Request
It answers 200 with { "object": "auth_password", "updated": true }. Any other field is 400.

Create an API key

POST /v1/api_keys → 201 Created. Creates a new key for the caller’s organization. The plaintext secret is returned only in this response.
string
required
Human-readable label for the key.
string[]
Scopes to grant. At least one; admin for full org access. Required unless you send a preset instead (see Keys); a request with only name and scopes behaves exactly as before.
string
The key id (e.g. key_01H...).
string
The label you supplied.
string
The plaintext key. Returned only once.
string[]
Granted scopes.
string
The non-secret prefix, shown in listings for identification.
object
The principal that created this key — { "type": "user" | "key" | "system", "id": "..." }, the same shape the audit log records.
string | null
When the key was last used to authenticate a request, to within about a minute; null until first use.
string
Creation timestamp.
string
The organization this key opens. Returned only at create and rotate.
string
live or test — the tier the key spends on. Returned only at create and rotate.

List API keys

GET /v1/api_keys returns key metadata (never the secret). Cursor-paginated — see Pagination.
Response

Rotate & revoke

Rotation issues a new secret and invalidates the old one. Revocation deletes the key immediately.
Rotate on a schedule and on any suspected exposure. Because keys are org-scoped, revoking one never affects another org’s access.
Key creation, rotation, and revocation are recorded in the audit log as api_key.created, api_key.rotated, and api_key.revoked, attributed to the acting principal.