API referenceAgentProof API

API

Use the AgentProof API to start agent runs, read reports and manage alerts from scripts. Create a token, send requests and handle errors.

The AgentProof API lets your own scripts, CI jobs and tools work with your workspace without the dashboard. You can start an Attack Agent or Defense Agent run, follow it while it works, answer its questions, and download its report and files. You can also manage schedules and the places AgentProof sends alerts. It is a JSON API at https://isagentproof.com/api/. Any member of a workspace can create a token for it.

The website, domain verification, test accounts, connected code, memory, billing and the Calendar's planned runs are set up in the dashboard, not through the API.

Create an API token

A token is a long secret that starts with apt_. Your script sends it with every request.

  1. Open the token form

    Open Settings > Security in the dashboard. Under API tokens, press Create token.

  2. Name the token and pick its scopes

    Type a Token name of up to 60 characters, such as "Nightly CI". Tick only the Scopes your script needs. Choose how long it lasts under Expires after: 7, 30 or 90 days.

  3. Copy the token

    Press Create token. The token appears once. Press Copy and save it in a safe place, such as your CI system's secret store. Press Hide when you are done. AgentProof cannot show it again.

Creating a token needs a recent sign-in: you must have signed in within the last 10 minutes. If you signed in earlier, the form says "Check your email for a sign-in link, then try again." AgentProof emails you a sign-in link. Open it, and it brings you back to Settings > Security. Then create the token again. If AgentProof emailed you less than a minute ago, you see "We sent an email to this address less than a minute ago. Try again in N seconds." instead.

A token belongs to you, not to the workspace. It acts as you, with your role in your workspace. Each person can have 20 tokens at a time. At 20, the form says "Revoke a token before creating another."

Send your first request

Put the token in the Authorization header as Bearer <token>. This request lists your workspace's agents:

bash
export AGENTPROOF_TOKEN="apt_..."

curl https://isagentproof.com/api/agents \
  -H "Authorization: Bearer $AGENTPROOF_TOKEN"
json
{
  "agents": [
    {
      "id": "agt_rqwgvdrg5x4lqxu37li6jmdi",
      "name": "Attack Agent",
      "team": "red",
      "variant": 0,
      "computer": { "state": "none", "lastActiveAt": null },
      "activeRunId": null,
      "createdAt": "2026-11-12T09:41:07.552Z"
    }
  ]
}

A wrong, expired or revoked token gets 401 with the code unauthenticated. Next, see the runs and reports API to start a run.

Revoke a token

In Settings > Security, find the token under API tokens and press Revoke. Each row shows the token's name and its first 10 characters (for example Nightly CI / apt_xwrlob), then its scopes and when it expires. A revoked token stops working at once.

Tokens also stop working when they expire and when you delete your account. If you leave the workspace or someone removes you, your tokens can no longer reach it: most routes answer 403 no_workspace.

If a token leaks, revoke it right away and create a new one. Anyone who has it can start runs that use your agent hours.

Scopes a token can have

A scope is one permission. A request that needs a scope the token does not have gets 403 insufficient_scope: "This token cannot perform that action."

Scopes a token can have
ScopeWhat it allows
agents:readList the agents and read one agent.
agents:writeOffered in the form; no route needs it today.
runs:readList and read runs, follow their events, download their files, list an agent's conversations, read the Calendar, read your usage.
runs:writeStart runs, send messages, answer questions, cancel runs, upload files for runs.
schedules:readList and read schedules and their past occurrences.
schedules:writeCreate, change, pause, resume and delete schedules.
reports:readList and read reports, export them and download run traces.
notifications:readList alert destinations and recent deliveries.
notifications:writeAdd, test, turn on, turn off and remove alert destinations, and make new signing secrets.

Workspace roles and the API

Your role in the workspace still applies when you use a token. The roles are owner, admin and member.

  • Every run, schedule, Calendar and report route works for any member.
  • Adding, testing or removing alert destinations needs an owner or admin.
  • A route your role does not allow answers 403 forbidden: "Your workspace role does not allow this."

Each route on the runs and reports and account and workspace pages names the scope and the lowest role it needs.

What a token cannot do

  • Account, team and token routes. Reading or changing your account, signed-in browsers, tokens, the workspace, members and invitations needs a signed-in browser. A token gets 403 insufficient_scope. These routes are listed on the account and workspace API page.
  • Sensitive actions. Deleting your account, deleting the workspace, transferring ownership and creating tokens also need a sign-in within the last 10 minutes.
  • Dashboard-only settings. There are no API routes for billing and plans, the website and its domain, test accounts, code and repositories, memory, or planning runs on the Calendar.
  • The MCP server. AI assistants connect to https://isagentproof.com/mcp with their own sign-in. API tokens do not work there, and the assistants' tokens do not work on /api/. See Install the MCP server.
  • Calls from other websites. The API sends no CORS headers (the rules that let a web page on another site read a reply), except on the public /api/protected lookup. Call the API from a server, a script or a CI job, not from a browser page on your own site.

Browser sessions and CSRF

The dashboard uses the same API with your browser's sign-in. Routes marked "browser session only" need it.

  • Signing in sets a cookie named __Host-ap_session. The session lasts 7 days after your last request. Requests that send the header X-AP-Background: 1 do not extend it.
  • Every POST, PATCH or DELETE made with the cookie must send the header X-CSRF-Token, and must come from a page on https://isagentproof.com. CSRF (cross-site request forgery) protection stops another website from acting as you. Without the header, or from another site, the answer is 403 csrf: "Refresh the page and try again."
  • GET requests need no CSRF token. Requests with an API token skip the CSRF check.

Get the CSRF token from GET /api/auth/session. For example, from a page on isagentproof.com where you are signed in:

javascript
const session = await (await fetch("/api/auth/session")).json();

const reply = await fetch("/api/account", {
  method: "PATCH",
  headers: { "Content-Type": "application/json", "X-CSRF-Token": session.csrfToken },
  body: JSON.stringify({ timezone: "Europe/Berlin" }),
});

When you are signed in, GET /api/auth/session answers:

json
{
  "authenticated": true,
  "csrfToken": "9b2f1c...",
  "account": { "id": "usr_rv3mxfrog4oeikhug7ur4542", "email": "sam@example.com" },
  "idleExpiresAt": "2026-12-02T14:03:07.418Z",
  "expiresAt": "2026-12-02T14:03:07.418Z"
}

The account object is shortened here; the full object is on the account and workspace API page.

Requests and responses

JSON bodies

  • Send bodies as JSON with Content-Type: application/json. Any other type gets 415 unsupported_media_type: "Use JSON." The two file upload routes take multipart/form-data instead.
  • Send exactly one JSON object. A field the route does not know gets 400 field_not_editable: "Request contains a field that cannot be set." Broken JSON gets 400 bad_json: "Enter a valid request."
  • A body that is too long gets 413 too_large: "Request is too long." Starting a run or sending a message allows 64 KiB. Other routes allow less.
  • Replies are JSON with Cache-Control: no-store. Field names use camelCase. A value that is not known is null.
  • 202 Accepted means AgentProof took the work and finishes it in the background, such as a new run. Deletes answer 204 with no body.

IDs and times

  • IDs are strings that start with their type, then 24 lowercase letters and digits: agt_ agents, run_ runs, sch_ schedules, att_ uploaded files, tok_ tokens, usr_ people, wks_ workspaces, inv_ invitations, ntf_ alert destinations. Files a run saves start with art_. Treat every ID as an opaque string.
  • Times are RFC 3339 strings in UTC, such as 2026-11-25T14:03:07.418Z. The from and to filters take the same format. The Calendar takes plain dates such as 2026-11-25.

Pages of results

Lists of runs, reports and schedule occurrences come in pages.

  • limit sets the page size: 50 by default, 100 at most.
  • Each reply has nextCursor. Pass it back as cursor to get the next page. It is null on the last page.
  • A cursor AgentProof cannot read gets 400 bad_cursor: "Invalid cursor."

The Calendar pages by 500 entries; its nextCursor works the same way.

Idempotency keys

Starting a run and sending a message to a run need an Idempotency-Key header. It is a value you choose, 8 to 128 visible ASCII characters with no spaces, such as nightly-2026-11-25. It makes a retry safe: if the network drops, send the same request with the same key, and AgentProof will not start a second run.

  • Without the header, the answer is 400 idempotency_key_required: "Send an Idempotency-Key header."
  • Starting a run. The same key with the same body returns the first reply, with the header Idempotent-Replayed: true. The same key with a different body gets 409 idempotency_mismatch: "This request key was already used for a different request." While the first request is still being handled, a repeat gets 409 in_progress: "This request is still being processed." Keys are kept per person for 7 days.
  • Sending a message. The key names one message in that run. Sending the same key again returns the same messageId. If the first delivery failed, AgentProof sends the stored message again and ignores the new body.

Error format

Every error is JSON with a sentence for people and a code for programs:

json
{
  "error": "Check the highlighted fields.",
  "code": "invalid",
  "fields": { "prompt": "Enter a task." }
}

fields appears only when a field is wrong. It maps each field name to what is wrong with it. Match on code in your code; the sentences can change.

Common error codes

Common error codes
StatusCodeMessageWhat to do
400invalidCheck the highlighted fields.Fix the fields named in fields.
400bad_jsonEnter a valid request.Send one valid JSON object.
400field_not_editableRequest contains a field that cannot be set.Remove fields the route does not take.
400idempotency_key_requiredSend an Idempotency-Key header.Add the header.
401unauthenticatedSign in again.Check the token; create a new one if it expired.
402plan_requiredChoose a plan to start runs.Choose a plan in Settings > Billing.
402hours_exhaustedNo agent hours left this month.Wait for the monthly reset or raise the spending cap.
403insufficient_scopeThis token cannot perform that action.Use a token with the right scope, or a browser session.
403forbiddenYour workspace role does not allow this.Ask an owner or admin.
403no_workspaceJoin or create a workspace first.Join a workspace again.
403csrfRefresh the page and try again.Send X-CSRF-Token from the same site.
403reauth_requiredCheck your email for a sign-in link, then try again.Open the emailed link, then repeat the action.
404not_foundNot found.Check the ID. Items in other workspaces also answer this.
409idempotency_mismatchThis request key was already used for a different request.Use a new key for a new request.
413too_largeRequest is too long.Send a smaller body or file.
415unsupported_media_typeUse JSON.Set Content-Type: application/json.
429rate_limitedToo many attempts. Try again later.Wait the seconds in Retry-After.
429capacityFinish your active run first.Wait for your run to end, then start the next.
500internalSomething went wrong. Try again.Retry after a short wait.
503shutting_downAgentProof is restarting. Try again shortly.Retry after a few seconds.

Each route's own errors are listed with the route. A missing item and an item in another workspace give the same 404, so the API never shows what other workspaces hold.

Rate limits and capacity

There is no overall limit on how many requests a token can send. A few actions have their own limits. When you pass one, the answer is 429 with a Retry-After header that says how many seconds to wait.

Limits on single actions

Limits on single actions
ActionLimit
Creating a token or deleting your account10 tries per 15 minutes, per person
Sending invitations20 per hour, per workspace
Accepting invitations20 per hour, per person
Any email AgentProof sends because you asked (sign-in links, invitations)1 per address every 60 seconds (429 email_too_soon)
Starting deploy tests from the GitHub Action60 per hour per network address, 30 per hour per repository

Runs have their own capacity rules: each agent runs one run at a time, each person can have a set number of their own runs going at once, and AgentProof has a limit on agent computers in use. See refusals when starting a run.

While AgentProof restarts for an update, /api/ routes can answer 503 with the plain text "AgentProof is starting. Try again in a few seconds." and Retry-After: 5. Wait and retry. Runs that are already going keep running.

Routes that are not part of the API

Some /api/ routes exist only for AgentProof's own pages and partners: the sign-in routes under /api/auth/ (except GET /api/auth/session, described above), the free website test, the Proof page counters, and the webhooks Stripe and GitHub send to AgentProof. Do not build on them. An unknown /api/ path answers 404 not_found.

Last updated