Authentication
The Runtype API uses API keys for authentication. Include your API key in the Authorization header of every request.
Getting an API Key
- Log in to your Runtype Dashboard
- Go to Settings > API
- Click Create New Key
- Give your key a descriptive name
- Select the permissions you need
- Copy your key - it won’t be shown again!
Keep your API keys secure. Never expose them in client-side code or commit them to version control.
Using Your API Key
Include the API key in the Authorization header with the Bearer scheme:
API Key Formats
Permissions
API keys can be scoped to specific permissions. Common scopes include:
When you create or edit a key on the dashboard’s API Keys page (see Managing API keys), you’ll see the complete list of available scopes along with pre-built permission groups for common use cases.
Agent self-registration (anonymous start)
An AI agent can obtain a scoped Runtype API key on its own, without a human creating one first, and later bind that key to a real user. This follows the auth.md anonymous-start pattern, so agents that understand the standard can discover and complete the flow automatically. Agents that already carry an identity assertion from a trusted identity provider can skip the claim ceremony entirely — see Agent registration with an identity assertion.
Prefer the CLI
The Runtype CLI wraps this whole protocol in three non-interactive commands (no TTY, no browser) and stores the resulting credential for every other CLI command:
Every command prints JSON with a next field naming the exact follow-up step. Use the raw HTTP protocol below when you cannot install @runtypelabs/cli.
Discovery
An agent finds the flow in two ways:
- A
WWW-Authenticateheader on401responses points to the discovery document. - The
agent_authblock inGET /.well-known/oauth-authorization-serverdescribes the endpoints, andruntype.com/auth.mddocuments them in prose.
Step 1 — register
POST /agent/auth returns a pre-claim API key plus a claim token. No human is involved.
The pre-claim key is an rt_* key that expires after 24 hours. It grants broad platform access for building and running — dispatch, flows, agents, records, reading and executing tools, and products — but excludes sensitive and destructive operations: no secrets, API keys, integrations, schedules, webhooks, messaging, or A2A scopes, and no delete permissions.
Step 2 — claim (bind to a user)
To upgrade the key to full access, claim it against a real email address:
This emails a one-time code to the address. Complete the claim with that code:
On success, Runtype revokes the pre-claim key and issues a fresh, full-access key bound to the user. Issuing a new key rather than upgrading in place prevents any copy of the old key from silently gaining full privileges.
One-time codes expire after 10 minutes. After 5 failed attempts the claim locks out and the pre-claim key is revoked. Registration is rate-limited to 5 attempts per hour per IP.
Agent registration with an identity assertion (ID-JAG)
Agents whose runtime holds an ID-JAG (Identity Assertion JWT Authorization Grant, assertion type urn:ietf:params:oauth:token-type:id-jag) from a trusted agent identity provider can register in a single request — no pre-claim key, no email one-time code. The assertion is a short-lived JWT carrying a verified email; Runtype validates it and issues a full-access key bound to a new account for that email.
Requirements for the assertion:
- Issued by a trusted agent identity provider. Currently
https://auth.workos.bot(WorkOS). - Audience set to
https://api.runtype.com/agent/auth(orhttps://api.runtype.com). - A verified email claim (
emailplusemail_verified: true). - A
jticlaim — each assertion is single-use, and assertions older than 10 minutes are rejected.
On success the response includes status: "claimed" and a full-access rt_* key. If the asserted email already belongs to a Runtype account, the request is rejected with email_already_registered; sign in at use.runtype.com and create a key directly instead. The identity_assertion and anonymous identity types are both advertised in the agent_auth block of GET /.well-known/oauth-authorization-server.
Rate limits
Execution limits are based on your plan tier. The Launch tier includes 50 full-speed executions per day, after which slow mode activates. Paid plans have higher burst limits and monthly execution pools.
For full details on plan-specific limits, see Rate limits and usage.
Rate limit and quota headers are included in responses:
Error Responses
401 Unauthorized
403 Forbidden
429 Too Many Requests
Best Practices
Use environment variables
Store API keys in environment variables, not in code:
Use scoped permissions
Create API keys with only the permissions they need. A key that only reads data shouldn’t have write permissions.
Rotate keys regularly
Regenerate API keys periodically and update them in your applications.
Monitor usage
Check the API Keys section in your dashboard to monitor usage and detect unusual activity.