# Runs and reports API

Start Attack Agent and Defense Agent runs from a script, stream their events, answer questions and download reports and traces with the AgentProof API.

These routes start and follow agent runs, manage repeating schedules, read the Calendar, and download reports and traces. They all accept [API tokens](/docs/api/), and any member of the workspace can call them. Each route below names the token scope it needs. Tokens, errors, paging and idempotency keys are explained on the [AgentProof API](/docs/api/) page.

## Agent routes

| Method | Path | What it does |
|---|---|---|
| GET | `/api/agents` | Lists the workspace's agents. |
| GET | `/api/agents/{id}` | Reads one agent. |
| GET | `/api/agents/{id}/sessions` | Lists the agent's recent conversation IDs. |
| POST | `/api/agents/{id}/attachments` | Uploads a file for a run or a message. |
| POST | `/api/agents/{id}/target-artifact` | Uploads an application file for an app audit. |

### List the agents

`GET /api/agents` needs the `agents:read` scope. Any member can call it.

Every workspace has two agents that AgentProof makes for you: the **Attack Agent** (`"team": "red"`) and the **Defense Agent** (`"team": "blue"`). You cannot add, rename or delete agents. AgentProof creates each agent the first time one of its runs starts from the dashboard, the Calendar or the [MCP server](/docs/install-mcp-server/). Until then this list can be empty or hold only one agent. If an agent is missing, start one of its runs from the dashboard first, for example with **Run now** for the Attack Agent.

```bash
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": "running", "lastActiveAt": "2026-11-25T14:05:12.118Z" },
      "activeRunId": "run_5lxxwkalu2u7uqtli25vggoy",
      "createdAt": "2026-11-12T09:41:07.552Z"
    },
    {
      "id": "agt_jl66v3hpt2udu7aa7xjs6ptt",
      "name": "Defense Agent",
      "team": "blue",
      "variant": 0,
      "computer": { "state": "none", "lastActiveAt": null },
      "activeRunId": null,
      "createdAt": "2026-11-12T09:41:07.913Z"
    }
  ]
}
```

- `variant` picks the agent's look in the dashboard.
- `computer.state` is the state of the agent's computer, such as `none`, `provisioning`, `running` or `stopped`. Each run gets a fresh computer that is deleted when the run ends.
- `activeRunId` is the run the agent is working on, or `null`.

### One agent by ID

`GET /api/agents/{id}` returns the same agent object. It needs `agents:read`. An ID that is not one of your workspace's agents answers `404 not_found`.

### Conversation IDs of an agent

`GET /api/agents/{id}/sessions` needs `runs:read`. Each run records the ID of the agent's conversation as `sessionId`. This route lists the 50 newest conversation IDs of the agent, each with the last run that used it.

```json
{
  "sessions": [
    { "id": "…", "lastRunId": "run_5lxxwkalu2u7uqtli25vggoy", "updatedAt": "2026-11-25T14:58:40.006Z" }
  ]
}
```

### Attach a file for the agent

`POST /api/agents/{id}/attachments` needs `runs:write`. Send one file as `multipart/form-data` in a field named `file`, up to 20 MB. Use the returned ID in `attachments` when you start a website run or send a message.

```bash
curl https://isagentproof.com/api/agents/agt_rqwgvdrg5x4lqxu37li6jmdi/attachments \
  -H "Authorization: Bearer $AGENTPROOF_TOKEN" \
  -F "file=@checkout-bug.png"
```

```json
{ "id": "att_nvu4tajde7p5gtp3gtzs33mc", "name": "checkout-bug.png", "size": 184302, "mimeType": "image/png" }
```

- Photos (PNG, JPEG, WebP and GIF) up to 8 MB reach the agent as images it can see. Other files are copied to its computer.
- Files count toward your workspace's storage. A file no run uses within 7 days is deleted.
- Errors: `400 bad_upload` and `413 too_large` ("Choose one file up to 20 MB."), and `409 storage_full` ("Storage allowance is full.").

### Upload an application file

`POST /api/agents/{id}/target-artifact` needs `runs:write`. It stores one application file for an app audit, which is a run that reads the file without running it (see [code and app audits](/docs/code-and-app-audits/)). The dashboard's **+ App** uses the same upload.

Send exactly one part, named `file`, as `multipart/form-data`, up to 200 MB. AgentProof reads the file's content to decide its kind, and the file name's ending must agree. The accepted kinds (`class`) are `android-apk`, `android-aab`, `ios-ipa`, `zip-bundle` (a ZIP with at least one native program inside), `elf`, `pe` and `mach-o`. Nothing runs, installs or unpacks the file.

```bash
curl https://isagentproof.com/api/agents/agt_rqwgvdrg5x4lqxu37li6jmdi/target-artifact \
  -H "Authorization: Bearer $AGENTPROOF_TOKEN" \
  -F "file=@shop-release.apk"
```

```json
{
  "id": "att_dx2fm46467hzs64wqoxfgnpt",
  "name": "shop-release.apk",
  "size": 48213904,
  "class": "android-apk",
  "sha256": "ddfeceac5507cfa15901f0915ede997b21d5f58be943b5195d3e326126a1eb9b",
  "facts": { "format": "apk", "abis": ["arm64-v8a", "armeabi-v7a"] }
}
```

`facts` holds what the file's headers say, such as CPU types (`machines`), Android ABIs (`abis`) or an iOS app's folder name (`bundle`). Use the ID as the one attachment of a `binary` run on the same agent. Each file can be used by one run only.

| Status | Code | Message |
|---|---|---|
| 400 | `bad_upload` | Send exactly one file in the field named file. |
| 409 | `storage_full` | Storage allowance is full. |
| 413 | `too_large` | Choose one file up to 200 MB. |
| 415 | `unsupported_media_type` | Send one file as multipart/form-data. |
| 415 | `unsupported_artifact` | Upload one Android APK or AAB, iOS IPA, ZIP bundle with a native executable, ELF, PE or Mach-O file. |

## Run routes

| Method | Path | What it does |
|---|---|---|
| POST | `/api/harness/runs` | Starts a run. |
| GET | `/api/harness/runs` | Lists runs, newest first. |
| GET | `/api/harness/runs/{id}` | Reads one run. |
| GET | `/api/harness/runs/{id}/events` | Returns or streams the run's events. |
| POST | `/api/harness/runs/{id}/messages` | Sends a message to a running agent. |
| POST | `/api/harness/runs/{id}/questions/{questionId}/answer` | Answers a question the agent asked. |
| POST | `/api/harness/runs/{id}/cancel` | Stops a run. |
| GET | `/api/harness/runs/{id}/artifacts/{artifactId}` | Downloads a file the run saved. |

### Start a run

`POST /api/harness/runs` needs `runs:write` and an `Idempotency-Key` header. Any member can start a run. It answers `202` with the new run, which starts as `queued`.

A run tests one kind of target:

- **Website** (the default). The agent tests the website saved in **Settings > Website**. Its domain must be verified and you must have confirmed you may test it (see [website and domain](/docs/website-and-domain/)). You cannot name another website.
- **Codebase.** The agent audits a public Git repository, or the GitHub repository connected to your website. No website is needed.
- **Binary.** The agent reads an application file you uploaded, without running it.

The dashboard's **+ Code** and **+ App** start codebase and binary runs on the Attack Agent with the same rules. See [code and app audits](/docs/code-and-app-audits/) for what these runs do.

A website run:

```bash
curl https://isagentproof.com/api/harness/runs \
  -H "Authorization: Bearer $AGENTPROOF_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: nightly-2026-11-25" \
  -d '{
    "agentId": "agt_rqwgvdrg5x4lqxu37li6jmdi",
    "prompt": "Test the sign-up form and the password reset flow."
  }'
```

```json
{
  "id": "run_5lxxwkalu2u7uqtli25vggoy",
  "agentId": "agt_rqwgvdrg5x4lqxu37li6jmdi",
  "agent": { "name": "Attack Agent", "team": "red", "variant": 0 },
  "origin": "manual",
  "mode": "task",
  "target": "https://example.com/",
  "targetKind": "website",
  "scheduleId": null,
  "scheduleRevision": null,
  "status": "queued",
  "prompt": "Test the sign-up form and the password reset flow.",
  "sessionId": null,
  "resumedSessionId": null,
  "createdAt": "2026-11-25T14:03:07.418Z",
  "startedAt": null,
  "endedAt": null,
  "deadlineAt": null,
  "finalResponse": null,
  "usage": null,
  "error": null,
  "eventCursor": 1,
  "pendingQuestion": null,
  "report": { "availability": "none" },
  "contentAvailable": true
}
```

A codebase run of a public repository:

```json
{
  "agentId": "agt_rqwgvdrg5x4lqxu37li6jmdi",
  "targetKind": "codebase",
  "repoUrl": "https://github.com/example/shop.git",
  "repoBranch": "main",
  "prompt": "Can a signed-in customer read another customer's orders?"
}
```

To audit the repository connected to your website in **Settings > Code** instead, send `"repoSource": "connected"` and leave out `repoUrl` and `repoBranch`. The run uses the repository's linked branch. Its reply carries `targetSource` with `repoUrl`, `repository` (`owner/name`) and `repoBranch`, and later the pinned `ref` and `commit`.

A binary run, after you [upload the application file](#upload-an-application-file):

```json
{
  "agentId": "agt_rqwgvdrg5x4lqxu37li6jmdi",
  "targetKind": "binary",
  "attachments": ["att_dx2fm46467hzs64wqoxfgnpt"],
  "prompt": "Does the app store any API keys or passwords in its code?"
}
```

How a new run uses your plan:

- A run uses agent hours like any run in the dashboard. While it is queued or running it holds one hour. When it ends, it counts the time it really ran, rounded up to the minute. See [plans](/docs/plans/).
- A run lasts at most 60 minutes.
- If your Calendar has more planned runs this month than your hours can pay for, the new run takes the place of the latest planned run of the month, starting with the same agent's.

### Fields for a new run

| Field | Type | Meaning |
|---|---|---|
| `agentId` | string | Required. The agent that does the run. |
| `prompt` | string | Required. The task, 1 to 20,000 characters. Codebase and binary runs need a question of at least five words. |
| `targetKind` | string | `website` (default), `codebase` or `binary`. |
| `target` | string | Website runs only. It can only repeat the website in Settings; AgentProof fills it in for you. |
| `repoUrl` | string | Codebase runs. A public `https://` Git address ending in `.git`, with no user name or password, query, IP address or port other than 443. |
| `repoBranch` | string | Codebase runs, optional. The branch to audit. Without it, the repository's default branch is used. |
| `repoSource` | string | Codebase runs. `public` (default) or `connected`. |
| `attachments` | array of IDs | Up to 10 uploaded files. A binary run takes exactly one application file. A codebase run takes none. |
| `mode` | string | Optional. Only `task` is accepted. |

A wrong field gets `400 invalid` with the field and one of these messages:

- `prompt`: "Enter a task.", "Use 20,000 characters or fewer." or "Ask a question the run can answer, in at least five words."
- `targetKind`: "Choose website, codebase or binary."
- `target`: "The website is set in Settings." or "Only a website run takes a target."
- `repoUrl`: "Enter a public https:// Git repository address.", "Enter a public https:// Git repository address ending in .git.", "Only a codebase run takes a repository." or "A connected repository takes no address."
- `repoBranch`: "Enter a valid branch name." or "A connected repository uses its linked branch."
- `repoSource`: "Choose public or connected."
- `attachments`: "Attach up to 10 files.", "A codebase run takes no attachments." or "Choose exactly one uploaded application file."
- `mode`: "Choose Task."

### Refusals when starting a run

| Status | Code | Message | What to do |
|---|---|---|---|
| 402 | `plan_required` | Choose a plan to start runs. | Choose a plan in **Settings > Billing**. |
| 402 | `hours_exhausted` | No agent hours left this month. | Wait for the monthly reset, or have an owner or admin raise the spending cap. |
| 403 | `email_unverified` | Confirm your email to start runs. | Sign in with the emailed link once. |
| 403 | `workspace_inactive` | This workspace cannot start runs. | The workspace is being deleted. |
| 404 | `not_found` | Not found. | Check `agentId` and the attachment IDs. |
| 409 | `agent_busy` | This agent is already running. | Wait for the agent's current run to end. |
| 409 | `storage_full` | Workspace storage is full. | Uploaded files and files runs saved have filled the workspace's storage (`limits.storageBytes`). |
| 409 | `artifact_used` | That application file was already used by a run. Upload it again. | Upload the file again for a new run. |
| 422 | `website_required` | Add your website in Settings. | Save your website in **Settings > Website**. |
| 422 | `website_required` | Verify example.com in Settings first. | Verify the domain. |
| 422 | `website_required` | Confirm you may test example.com in Settings. | Confirm you own the website or may test it. |
| 422 | `repository_required` | Connect a GitHub repository for your website in Settings. | Connect one in **Settings > Code**, or use `repoUrl`. |
| 429 | `capacity` | Finish your active run first. | You already have as many runs going as you may. Wait for one to end. |
| 429 | `capacity` | All agent computers are busy. Try again shortly. | Retry in a few minutes. |
| 503 | `execution_unavailable` | Agent runs are not available yet. | Retry later. |
| 503 | `shutting_down` | AgentProof is restarting. Try again shortly. | Retry with the same `Idempotency-Key`. |

`example.com` stands for your own website's host. The number of runs each person can have going at once is `limits.activeRuns` from [your usage](/docs/api-workspace/#usage-limits-and-hours). Runs started by schedules do not count toward it.

### Get runs in the workspace

`GET /api/harness/runs` needs `runs:read`. It returns `{"runs": [...], "nextCursor": ...}`, newest first, with every member's runs.

Filters, all optional: `agentId`, `status`, `from` and `to` (RFC 3339 times, compared with when the run was created), plus `limit` and `cursor`.

```bash
curl "https://isagentproof.com/api/harness/runs?status=completed&limit=20" \
  -H "Authorization: Bearer $AGENTPROOF_TOKEN"
```

### Read one run

`GET /api/harness/runs/{id}` needs `runs:read` and returns the run. Poll it, or [stream its events](#stream-a-run-s-events), to see when it ends.

### Status and fields of a run

| Field | Meaning |
|---|---|
| `status` | `queued`, `provisioning` (its computer is starting), `running`, then one end state: `completed`, `failed`, `cancelled`, `interrupted` or `blocked`. The run page shows the end states as Finished, Failed, Stopped, Interrupted and Blocked. |
| `origin` | `manual` for runs started by a person, the API, a repair hand-off, a retest or a deploy; `scheduled` for runs started by a schedule or a planned Calendar run. |
| `target`, `targetKind`, `targetSource` | What the run tests. `targetSource` appears only on codebase and binary runs: the repository address, branch, pinned `ref` and `commit`, or the file's ID, name, `class`, `sha256`, size and `facts`. |
| `prompt` | The task. |
| `sessionId` | The agent's conversation ID, once the run starts. `resumedSessionId` names an earlier conversation the run continued, if any. |
| `createdAt`, `startedAt`, `endedAt`, `deadlineAt` | When the run was created, started and ended, and when its time runs out. |
| `finalResponse` | The agent's last reply, when it finished on its own. |
| `usage` | Model tokens so far: `inputTokens`, `outputTokens` and, when known, `cachedInputTokens`. |
| `error` | Why the run did not finish: `{"code", "message"}`, such as `deadline_exceeded` with "The run reached its time limit." |
| `eventCursor` | The number of the run's newest event. |
| `pendingQuestion` | A question waiting for an answer, or `null`. |
| `report.availability` | `none` while the run is going, then `pending`, `available` or `failed`. |
| `scheduleId`, `scheduleRevision` | The schedule or planned run that started it, if any. |

### Stream a run's events

`GET /api/harness/runs/{id}/events` needs `runs:read`. Every run keeps an ordered record of events, each with a number (`seq`). You can read it in two ways.

**As JSON.** Pass `after` with the last `seq` you have (0 at the start). You get up to 500 events. `nextCursor` is the number to send as `after` next time. `done` is `true` once the run has ended and you have every event.

```bash
curl "https://isagentproof.com/api/harness/runs/run_5lxxwkalu2u7uqtli25vggoy/events?after=0" \
  -H "Authorization: Bearer $AGENTPROOF_TOKEN"
```

```json
{
  "events": [
    { "seq": 1, "type": "run.status", "time": "2026-11-25T14:03:07.418Z", "data": { "status": "queued" } },
    { "seq": 2, "type": "run.status", "time": "2026-11-25T14:03:09.031Z", "data": { "status": "provisioning" } }
  ],
  "nextCursor": 2,
  "done": false
}
```

**As a stream.** Send the header `Accept: text/event-stream` (exactly that value). AgentProof sends each event as a server-sent event, with `id` set to its `seq`, `event` set to its type, and `data` holding the event as JSON. It sends a `: heartbeat` comment every 15 seconds and closes the stream after `run.completed`. To reconnect, send the last `id` you got in the `Last-Event-ID` header (or as `after`); events are never sent twice and the run is not touched. If your token is revoked or you lose access to the workspace, the stream sends `event: auth.expired` and closes. The run keeps going.

```bash
curl -N "https://isagentproof.com/api/harness/runs/run_5lxxwkalu2u7uqtli25vggoy/events" \
  -H "Authorization: Bearer $AGENTPROOF_TOKEN" \
  -H "Accept: text/event-stream"
```

```text
id: 7
event: tool.completed
data: {"seq":7,"type":"tool.completed","time":"2026-11-25T14:04:51.270Z","data":{"callId":"call_1","name":"bash","isError":false,"output":"HTTP/2 200","exitCode":0}}
```

### Events a run records

| Type | `data` |
|---|---|
| `run.status` | `{"status"}`: `queued`, `provisioning` or `running`. |
| `message.accepted` | The task or a message reached the agent: `messageId`, `text`, `attachments` (file names) and `images` (how many photos). |
| `assistant.message` | The agent wrote a reply: `text`, `interrupted`. |
| `tool.started` | The agent began an action: `callId`, `name`, `arguments`. |
| `tool.completed` | The action ended: `callId`, `name`, `isError`, `output`, and when known `exitCode`, `fileChanges` and `errorCode`. |
| `question.asked` | The agent asked a question. `data` is the question (see below). |
| `question.resolved` | `id` and `outcome`: `answered`, `dismissed`, `expired` or `cancelled`. |
| `artifact.available` | The run saved a file: `id`, `name`, `mimeType`, `size`. |
| `usage` | Running token totals: `inputTokens`, `outputTokens`, `cachedInputTokens`. |
| `error` | Something went wrong: `code`, `message`. |
| `run.completed` | Always the last event: `status`, and `finalResponse` when there is one. |

Other event types can appear. Skip the ones you do not use. AgentProof removes secret-looking text, and the passwords and keys of your test accounts, from events before it stores them.

### Send a follow-up message

`POST /api/harness/runs/{id}/messages` needs `runs:write` and an `Idempotency-Key` header. It sends text to the agent while the run's status is `running`. The agent reads it as a follow-up to its task.

```bash
curl https://isagentproof.com/api/harness/runs/run_5lxxwkalu2u7uqtli25vggoy/messages \
  -H "Authorization: Bearer $AGENTPROOF_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: msg-2026-11-25-1" \
  -d '{"text": "Also check the coupon field on the cart page."}'
```

```json
{ "messageId": "msg_dxdgficzdrtajoroib7xrum6" }
```

- `text` is 1 to 20,000 characters. `attachments` can list files from [Attach a file for the agent](#attach-a-file-for-the-agent).
- A run that is not running gets `409 run_not_active`: "This run is not accepting messages."
- `502 delivery_uncertain` ("Message delivery is uncertain. Resend with the same key.") means AgentProof could not tell whether the agent got it. Send the same request again with the same key; the agent will not get it twice.

### Answer the agent's question

`POST /api/harness/runs/{id}/questions/{questionId}/answer` needs `runs:write`.

A question never stops a run. When the agent asks one, it appears in the run's `pendingQuestion`, in a `question.asked` event, on the run page and in the [run chat](/docs/run-chat/). On a run you started yourself, anyone on the team can answer it within 5 minutes, or before the run ends if that comes first. Runs started by a schedule, a planned run or AgentProof itself wait only while the run has a chat; otherwise the agent decides at once. With no answer, the agent chooses what it judges best, notes the assumption in its report and carries on.

A waiting question looks like this:

```json
{
  "id": "q_6d1f0a9c2b7e4f8a1c3d5e7b",
  "generation": 1,
  "expiresAt": "2026-11-25T14:12:44.590Z",
  "questions": [
    {
      "id": "checkout",
      "question": "May I place a test order with the test card from your notes?",
      "header": null,
      "detail": null,
      "multiSelect": false,
      "options": [
        { "label": "Yes", "description": null },
        { "label": "No", "description": null }
      ]
    }
  ]
}
```

Answer every question in it once. `selected` lists option labels; `custom` is optional free text. Send the question's `generation` back unchanged.

```bash
curl https://isagentproof.com/api/harness/runs/run_5lxxwkalu2u7uqtli25vggoy/questions/q_6d1f0a9c2b7e4f8a1c3d5e7b/answer \
  -H "Authorization: Bearer $AGENTPROOF_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"generation": 1, "answers": [{"id": "checkout", "selected": ["No"], "custom": "Stop at the payment page."}]}'
```

The reply is `{"ok": true}`. To dismiss the question without an answer, send `{"generation": 1, "dismiss": true}` instead.

- `409 question_stale`: "This question is no longer waiting." or "This question expired." Someone already answered, the time ran out, or the run ended.
- `400 invalid` with `answers`: "Choose an answer." or "Answer every question."
- `502 delivery_uncertain`: "Answer delivery is uncertain. Try again."

### Cancel a run

`POST /api/harness/runs/{id}/cancel` needs `runs:write`. Any member can stop any run in the workspace. The reply is `202` with the run. It ends as `cancelled` a moment later; its report and the time it used are kept. Cancelling a run that already ended changes nothing.

```bash
curl -X POST https://isagentproof.com/api/harness/runs/run_5lxxwkalu2u7uqtli25vggoy/cancel \
  -H "Authorization: Bearer $AGENTPROOF_TOKEN"
```

### Download a file the run saved

`GET /api/harness/runs/{id}/artifacts/{artifactId}` needs `runs:read`. It returns the file with its own type, as a download. File IDs come from `artifact.available` events and from the report's `artifacts`, whose `url` is this route.

- `404 not_found` when the file is not part of that run.
- `410 artifact_deleted`: "This file was deleted."

## Schedule routes

A schedule starts a run of one agent again and again: on a cron pattern or every so many minutes. Schedules are made through the API; their future runs show on the Calendar.

| Method | Path | What it does |
|---|---|---|
| GET | `/api/harness/schedules` | Lists the workspace's schedules. |
| POST | `/api/harness/schedules` | Creates a schedule. |
| GET | `/api/harness/schedules/{id}` | Reads one schedule. |
| PATCH | `/api/harness/schedules/{id}` | Changes a schedule. |
| DELETE | `/api/harness/schedules/{id}` | Deletes a schedule. |
| POST | `/api/harness/schedules/{id}/pause` | Pauses a schedule. |
| POST | `/api/harness/schedules/{id}/resume` | Resumes a schedule. |
| GET | `/api/harness/schedules/{id}/runs` | Lists the schedule's past times and their runs. |

Reading needs `schedules:read`; every change needs `schedules:write`. Any member can do both.

### Create a schedule

```bash
curl https://isagentproof.com/api/harness/schedules \
  -H "Authorization: Bearer $AGENTPROOF_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "agentId": "agt_rqwgvdrg5x4lqxu37li6jmdi",
    "prompt": "Test the checkout and the account pages.",
    "kind": "cron",
    "cron": "0 9 * * 1",
    "timezone": "America/New_York"
  }'
```

```json
{
  "id": "sch_2tzryj3yjsfescnk6pj76zl5",
  "agentId": "agt_rqwgvdrg5x4lqxu37li6jmdi",
  "prompt": "Test the checkout and the account pages.",
  "kind": "cron",
  "cron": "0 9 * * 1",
  "intervalMinutes": null,
  "timezone": "America/New_York",
  "enabled": true,
  "revision": 1,
  "anchorAt": "2026-11-25T14:20:31.904Z",
  "nextRunAt": "2026-11-30T14:00:00Z",
  "createdAt": "2026-11-25T14:20:31.904Z",
  "updatedAt": "2026-11-25T14:20:31.904Z",
  "createdBy": "usr_rv3mxfrog4oeikhug7ur4542"
}
```

The reply is `201` with the schedule. A workspace can have `limits.schedules` schedules (see [usage](/docs/api-workspace/#usage-limits-and-hours)). Past that, the answer is `409 limit_reached`: "Schedule limit reached."

### What a schedule holds

| Field | Meaning |
|---|---|
| `agentId` | Required. One of your agents ("Choose one of your agents."). |
| `prompt` | Required. The task for every run, 1 to 20,000 characters. |
| `kind` | `cron` or `interval` ("Choose cron or interval."). |
| `cron` | For `cron`: five fields, minute, hour, day of month, month and day of week. Lists (`1,15`), ranges (`1-5`), steps (`*/30`) and names (`mon`, `jan`) work. |
| `intervalMinutes` | For `interval`: 1 minute to 31 days (44,640 minutes), counted from `anchorAt`. |
| `timezone` | A time zone name such as `Europe/Berlin`. It defaults to your account's time zone. |
| `enabled` | `true` (default) or `false`. |
| `revision`, `anchorAt`, `nextRunAt` | Read only. The edit number, the start of interval counting, and the next run time (`null` when paused). |

How schedules run:

- Each due time starts a run of the agent on the website in **Settings > Website**, with the same plan, hour and domain rules as any website run.
- A schedule belongs to the workspace. It keeps running if the person who made it leaves.
- If AgentProof was not running at a due time and gets to it more than 2 minutes late, that time is recorded as `missed`. Only the newest due time still runs, so there is never a burst of catch-up runs.
- When a time is skipped for another reason, the Calendar shows why and destinations subscribed to **Scheduled run skipped** get an alert (see [notifications](/docs/notifications/)).

### Change, pause or delete a schedule

- `PATCH /api/harness/schedules/{id}` takes any of the fields above and answers with the schedule. Each change makes a new `revision`. Changes affect future times only; past runs keep the revision they ran with.
- `POST .../pause` and `POST .../resume` turn `enabled` off and on. Time spent paused is not made up. Resuming, or changing `intervalMinutes`, restarts interval counting from that moment.
- `DELETE /api/harness/schedules/{id}` answers `204`. Runs it already started stay in your reports.

### Past occurrences of a schedule

`GET /api/harness/schedules/{id}/runs` lists the schedule's past times, newest first, as Calendar entries (see below): a run that started, or a skip with its reason. It pages with `limit` and `cursor`.

```json
{ "occurrences": [ { "id": "occ_ehe4d3kd5kytomsmlaxynvmo", "kind": "skip", "status": "skipped", "skipReason": "hours" } ], "nextCursor": null }
```

The entry above is shortened; every entry has the fields in [Calendar route](#calendar-route).

## Calendar route

`GET /api/calendar` needs `runs:read`. It lists everything on the Calendar for a range of days: runs, skipped times, future schedule times and runs planned in the dashboard.

| Method | Path | What it does |
|---|---|---|
| GET | `/api/calendar` | Lists Calendar entries for up to 42 days. |

Query parameters:

- `from` and `to`: required dates such as `2026-11-01`. Both days are included. The range can cover 42 days at most ("Choose 42 days or fewer."). A bad range gets "Choose a valid date range."
- `timezone`: the time zone the days are counted in. It defaults to your account's.
- `agentId`: only one agent's entries.
- `cursor`: the next page; pages hold 500 entries.

```bash
curl "https://isagentproof.com/api/calendar?from=2026-11-01&to=2026-11-30&timezone=America/New_York" \
  -H "Authorization: Bearer $AGENTPROOF_TOKEN"
```

```json
{
  "timezone": "America/New_York",
  "from": "2026-11-01",
  "to": "2026-11-30",
  "nextCursor": null,
  "entries": [
    {
      "id": "run_4abgj5maozc4nzfngv575wwy",
      "kind": "run",
      "date": "2026-11-12",
      "startAt": "2026-11-12T14:00:03.21Z",
      "localTime": "09:00",
      "utcOffset": "-05:00",
      "agentId": "agt_rqwgvdrg5x4lqxu37li6jmdi",
      "agent": { "name": "Attack Agent", "team": "red", "variant": 0 },
      "origin": "manual",
      "status": "completed",
      "runId": "run_4abgj5maozc4nzfngv575wwy",
      "scheduleId": null,
      "scheduleRevision": null,
      "skipReason": null,
      "reportAvailability": "available"
    },
    {
      "id": "pln_476762qzq2qxxcc47boazojp",
      "kind": "planned",
      "date": "2026-11-27",
      "startAt": "2026-11-27T15:00:00Z",
      "localTime": "10:00",
      "utcOffset": "-05:00",
      "agentId": "agt_jl66v3hpt2udu7aa7xjs6ptt",
      "agent": { "name": "Defense Agent", "team": "blue", "variant": 0 },
      "origin": "planned",
      "status": "planned",
      "runId": null,
      "scheduleId": null,
      "scheduleRevision": null,
      "skipReason": null,
      "reportAvailability": null,
      "planId": "pln_476762qzq2qxxcc47boazojp",
      "copies": 1
    }
  ]
}
```

### Kinds of Calendar entry

| `kind` | What it is | `status` |
|---|---|---|
| `run` | A run that started: by hand, through the API, from a schedule or from a planned run. | The run's status. |
| `skip` | A schedule time or planned run that did not start. `skipReason` says why. | `skipped` |
| `projection` | A future time of an enabled schedule. It is not a run yet. Its `id` is `prj_` followed by the schedule ID, revision and time. | `scheduled` |
| `planned` | A run planned on the Calendar that has not started. `planId` names it; `copies` is how many computers it uses (more than 1 for a swarm). | `planned` |

Entries can also carry `trigger` (`handoff` for a Defense repair run, `retest` or `deploy`), `errorCode` (why a failed run ended) and `targetKind` (`codebase` or `binary`).

Common `skipReason` values: `missed` (AgentProof was not running at the planned time), `no_plan`, `no_website` ("Add and verify your website in Settings."), `domain_unverified`, `hours`, `agent_busy`, `global_capacity`, `storage_full`, `workspace_inactive`, `agent_unavailable` and `execution_unavailable`. Skipped entries are kept for 90 days.

## Report routes

Every run gets a report when it ends. Reports are kept for as long as the workspace exists.

| Method | Path | What it does |
|---|---|---|
| GET | `/api/reports` | Lists reports, newest first. |
| GET | `/api/reports/{runId}` | Reads one report. |
| GET | `/api/reports/{runId}/export` | Downloads a report as Markdown or JSON. |
| GET | `/api/reports/{runId}/trace` | Downloads the run's full trace. |

All four need `reports:read`. Any member can call them.

### Find reports

`GET /api/reports` returns `{"reports": [...], "nextCursor": ...}`. A swarm (one Attack Agent cloned onto several computers) is one row, named like "Attack Agent ×3".

Filters, all optional: `agentId`, `scheduleId`, `outcome` (a run status such as `failed`), `from` and `to` (RFC 3339 times), `limit` and `cursor`.

```json
{
  "reports": [
    {
      "runId": "run_5lxxwkalu2u7uqtli25vggoy",
      "agentId": "agt_rqwgvdrg5x4lqxu37li6jmdi",
      "agent": { "name": "Attack Agent", "team": "red", "variant": 0 },
      "origin": "manual",
      "scheduleId": null,
      "status": "completed",
      "startedAt": "2026-11-25T14:03:41.877Z",
      "endedAt": "2026-11-25T14:52:19.302Z",
      "availability": "available"
    }
  ],
  "nextCursor": null
}
```

`availability` is `pending` while the report is being built, then `available`, or `failed` if it could not be built. `trigger` and `targetKind` appear on repair, retest, deploy, codebase and binary runs.

### Full report for one run

`GET /api/reports/{runId}` returns the summary above plus the run's record:

```json
{
  "runId": "run_5lxxwkalu2u7uqtli25vggoy",
  "status": "completed",
  "availability": "available",
  "generatedAt": "2026-11-25T14:53:02.114Z",
  "contentExpiresAt": null,
  "task": "Test the sign-up form and the password reset flow.",
  "finalResponse": "Summary: 2 problems found …",
  "usage": { "inputTokens": 41250000, "outputTokens": 182000, "cachedInputTokens": 39800000 },
  "metrics": {
    "steps": 84, "actions": 61,
    "inputTokens": 41250000, "outputTokens": 182000, "reasoningTokens": 95000, "cachedTokens": 39800000,
    "modelMs": 1420000, "failedCalls": 0, "rateLimited": 0, "failedMs": 0, "wallMs": 2917425,
    "priceInputPerMTok": null, "priceOutputPerMTok": null, "priceCachedPerMTok": null, "priceUsd": null
  },
  "tools": [
    { "callId": "call_1", "name": "bash", "arguments": "{\"command\":\"curl -sI https://example.com/\"}", "isError": false, "exitCode": 0,
      "startedAt": "2026-11-25T14:04:50.981Z", "completedAt": "2026-11-25T14:04:51.270Z", "output": "HTTP/2 200" }
  ],
  "fileChanges": [],
  "errors": [],
  "artifacts": [
    { "id": "art_orBv2EmTv2Ju", "name": "report.md", "mimeType": "text/markdown", "size": 18234,
      "url": "/api/harness/runs/run_5lxxwkalu2u7uqtli25vggoy/artifacts/art_orBv2EmTv2Ju" }
  ],
  "messages": [
    { "role": "user", "text": "Test the sign-up form and the password reset flow.", "time": "2026-11-25T14:03:44.502Z" },
    { "role": "assistant", "text": "Summary: 2 problems found …", "time": "2026-11-25T14:52:10.660Z" }
  ]
}
```

Some summary fields are left out above. The record holds:

- `task` and `finalResponse`: the prompt and the agent's last reply.
- `metrics`: steps (model calls), actions (tool calls), tokens, model time, failed and rate-limited model calls, and the run's length in milliseconds. Prices are `null` unless AgentProof has set model prices.
- `tools`: every action, with its output cut to 20,000 bytes and its arguments to 4,000 bytes.
- `fileChanges`, `errors`, `artifacts` (files the run saved, with download links) and `messages` (the task, your messages and the agent's replies).

Report bodies hold no findings list. Findings show on the run page in the dashboard and through the MCP server's `list_findings` tool.

### Export a report

`GET /api/reports/{runId}/export?format=markdown` downloads the report as `agentproof-report-<runId>.md`; `format=json` downloads `agentproof-report-<runId>.json`. `format` is required ("Choose markdown or json.").

```bash
curl -OJ "https://isagentproof.com/api/reports/run_5lxxwkalu2u7uqtli25vggoy/export?format=markdown" \
  -H "Authorization: Bearer $AGENTPROOF_TOKEN"
```

- `409 report_pending`: "This report is not ready." Try again after the run ends.
- `410 report_deleted`: "This report was deleted."

### Trace file of a run

`GET /api/reports/{runId}/trace` downloads the run's full trace: the run's details and totals, then every model call (its tokens, time, reasoning and output) and every event, in order. It works while the run is still going. Secret-looking text is removed.

- With no `format`, or `format=jsonl`, you get `<runId>-trace.jsonl`: one JSON object per line. The first line has `"type": "run"`; the rest have `"type": "model.call"` or `"type": "event"`.
- `format=markdown` gives `<runId>-trace.md`.

## Deploy test routes

`POST /api/github/deploy` and `GET /api/github/deploy/{deployId}` are called by the AgentProof GitHub Action after your production deploy. They do not take API tokens. The Action signs in with the job's GitHub Actions ID token (the workflow needs `permissions: id-token: write`), and the repository must be connected to your website in **Settings > Code**. The first route records the deploy, queues an Attack Agent run on your website and answers with `deployId`, `state`, `runId`, `runUrl` and `runStatus`. The second reports progress and, when the test is done, `result` with `conclusion`, `failOn` and the number of `findings` at each risk. See [GitHub Action](/docs/github-action/) for setup and refusals.

## Protected lookup route

`GET /api/protected?domain=example.com` is public: it needs no token and any website can call it from the browser. It answers `{"domain": "example.com", "protected": true}` or `false`. Missing or bad input gets `400 domain_required` ("Add ?domain= with the domain to check.") or `400 domain_invalid` ("Enter a domain name."). See [Protected by AgentProof](/docs/protected-by-agentproof/) for when a domain counts as protected.

## Related pages

- [AgentProof API](/docs/api/) Tokens, scopes, errors, paging and limits.
- [Account and workspace API](/docs/api-workspace/) Usage, team, invitations and alert destinations.
- [Runs and reports](/docs/runs-and-reports/) What a run page and a report show in the dashboard.
- [Code and app audits](/docs/code-and-app-audits/) What codebase and binary runs check.
