---
title: "Approve or reject a step"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.cloudraker.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Approve or reject a step

Path: CloudRaker Paperwork API › Agents

`POST /v1/agent-runs/{id}/approvals/{approvalId}`

Answers a sign-off an agent run is waiting on, and lets the run carry on.

Read the outstanding ones from `approvals[]` on [the run](https://docs.cloudraker.com/paperwork/api/agents/get-agent-run) — each carries the step's name, the files it touches and, for a `before` gate, the `params` it proposes.

```json
{ "decision": "approve" }
```

**Rejecting needs a reason.** `{ "decision": "reject", "note": "Wrong signer." }` — a rejection without a `note` is a `400`.

**Editing before you approve.** Send `params` to replace the proposed inputs, `files` to replace the files the step works on (ids from [POST /v1/files](https://docs.cloudraker.com/paperwork/api/files/create-file) or the run's own inputs). The two together must stay under 1 MiB.

The response carries the decision plus `run.status`, so you know whether the run moved on, finished, or is blocked on the next thing. `?wait=` holds the request while the run picks the work back up, releasing early the moment it finishes or blocks again.

Deciding the same sign-off twice is a `409` — the first answer stands.

> **Note:** An API key has no person behind it, so the run records your organization's key as the actor rather than a named individual.

**Learn more:** [Agents guide](https://docs.cloudraker.com/paperwork/capabilities/agents)

## Authentication

- `bearerAuth`, http, header `Authorization`

## Path parameters

- `id` (`decideAgentRunApproval.path.id`; string, required)
  - minLength 1
- `approvalId` (`decideAgentRunApproval.path.approvalId`; string, required)
  - minLength 1

## Query parameters

- `wait` (`decideAgentRunApproval.query.wait`; integer, optional) — How many seconds to hold the request open. Releases early the moment the run finishes **or** blocks on a person. Maximum 120; `0` returns immediately.
  - min 0; max 120; default `60`

## Header parameters

- `idempotency-key` (`decideAgentRunApproval.header.idempotency-key`; string, optional) — Retries with the same key replay the first applied mutation.
  - minLength 1; maxLength 255

## Request body

_Required._

- `decision` (`decideAgentRunApproval.decision`; string, required) — Approve to let the step run (or its result stand), reject to refuse it. A rejection needs a `note`.
  - one of `"approve"`, `"reject"`
- `note` (`decideAgentRunApproval.note`; string, optional) — Why. Required on a rejection, recorded on the run either way.
  - maxLength 4000
- `params` (`decideAgentRunApproval.params`; map<unknown>, optional) — Replace the inputs proposed for the step before it runs.
- `files` (`decideAgentRunApproval.files`; array<string>, optional) — Replace the files the step works on, by file id.
  - minLength 1; maxLength 128

## Example request

```json
{
  "decision": "approve",
  "note": "string",
  "params": {
    "property1": null,
    "property2": null
  },
  "files": [
    "string"
  ]
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.cloudraker.com/v1/agent-runs/<id>/approvals/<approvalId>' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "decision": "approve",
  "note": "string",
  "params": {
    "property1": null,
    "property2": null
  },
  "files": [
    "string"
  ]
}
'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/v1/agent-runs/<id>/approvals/<approvalId>';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    decision: 'approve',
    note: 'string',
    params: {property1: null, property2: null},
    files: ['string']
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.cloudraker.com/v1/agent-runs/<id>/approvals/<approvalId>"

payload = {
    "decision": "approve",
    "note": "string",
    "params": {
        "property1": None,
        "property2": None
    },
    "files": ["string"]
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

The decision, and where the run stands after it.

#### Example

```json
{
  "object": "agent_run_approval",
  "id": "string",
  "kind": "before",
  "action": "string",
  "status": "pending",
  "requestedAt": "string",
  "decidedAt": "string",
  "note": "string",
  "run": {
    "id": "string",
    "status": "queued",
    "statusUrl": "string"
  }
}
```

- `object` (`decideAgentRunApproval.response.200.object`; string, required)
- `id` (`decideAgentRunApproval.response.200.id`; string, required)
- `kind` (`decideAgentRunApproval.response.200.kind`; string, required)
  - one of `"before"`, `"output"`
- `action` (`decideAgentRunApproval.response.200.action`; string, required)
- `status` (`decideAgentRunApproval.response.200.status`; string, required)
  - one of `"pending"`, `"approved"`, `"rejected"`, `"void"`
- `requestedAt` (`decideAgentRunApproval.response.200.requestedAt`; string, required)
- `decidedAt` (`decideAgentRunApproval.response.200.decidedAt`; string | null, required)
- `note` (`decideAgentRunApproval.response.200.note`; string | null, required)
- `run` (`decideAgentRunApproval.response.200.run`; object, required)
  - `id` (`decideAgentRunApproval.response.200.run.id`; string, required)
  - `status` (`decideAgentRunApproval.response.200.run.status`; string, required) — Where the agent run is in its life. | Status | Meaning | | --- | --- | | `queued` | Accepted; its files are still being prepared | | `processing` | The agent is working | | `waiting` | Blocked on a person — see `waiting`, `approvals` and `tasks[]` | | `paused` | Stopped short of finishing and resumable; not a failure | | `completed` | Finished; `result` and `output` are populated | | `failed` | Finished without producing a result | | `cancelled` | Stopped on request | | `expired` | Reached its `expiresAt` without finishing | `completed`, `failed`, `cancelled` and `expired` are terminal. A `completed` run that still had outstanding work also carries `incomplete: true`.
    - one of `"queued"`, `"processing"`, `"waiting"`, `"paused"`, `"completed"`, `"failed"`, `"cancelled"`, `"expired"`
  - `statusUrl` (`decideAgentRunApproval.response.200.run.statusUrl`; string, required)

### 400

A rejection with no reason, or edits over 1 MiB (`invalid_request`).

### 401

Missing or invalid credentials.

#### Example

```json
{
  "code": "string",
  "message": "string",
  "retryable": true,
  "requestId": "string",
  "docUrl": "string"
}
```

- `code` (`decideAgentRunApproval.response.401.code`; string, required)
- `message` (`decideAgentRunApproval.response.401.message`; string, required)
- `retryable` (`decideAgentRunApproval.response.401.retryable`; boolean, required)
- `requestId` (`decideAgentRunApproval.response.401.requestId`; string, required)
- `docUrl` (`decideAgentRunApproval.response.401.docUrl`; string, optional)

### 403

The credential is valid but cannot administer this organization.

#### Example

```json
{
  "code": "string",
  "message": "string",
  "retryable": true,
  "requestId": "string",
  "docUrl": "string"
}
```

- `code` (`decideAgentRunApproval.response.403.code`; string, required)
- `message` (`decideAgentRunApproval.response.403.message`; string, required)
- `retryable` (`decideAgentRunApproval.response.403.retryable`; boolean, required)
- `requestId` (`decideAgentRunApproval.response.403.requestId`; string, required)
- `docUrl` (`decideAgentRunApproval.response.403.docUrl`; string, optional)

### 404

Unknown run id (`not_found`), unknown sign-off (`approval_not_found`), or a file id that is not yours (`not_found`).

### 409

Already decided (`approval_decided`), the run has not started yet (`run_not_started`), or it is no longer running (`run_not_running`).

### 429

Rate limited. The `/v1` API allows at least **67 requests per minute per organization** (about 1,000 requests per 15 minutes) — a guaranteed floor, enforced per edge location, so a geographically spread caller may get more. Wait for the `Retry-After` interval and retry — the error is `retryable`.

#### Example

```json
{
  "code": "rate_limited",
  "message": "string",
  "retryable": true,
  "requestId": "string",
  "docUrl": "string"
}
```

- `code` (`decideAgentRunApproval.response.429.code`; string, required)
  - one of `"rate_limited"`
- `message` (`decideAgentRunApproval.response.429.message`; string, required)
- `retryable` (`decideAgentRunApproval.response.429.retryable`; boolean, required)
  - one of `true`
- `requestId` (`decideAgentRunApproval.response.429.requestId`; string, required)
- `docUrl` (`decideAgentRunApproval.response.429.docUrl`; string, optional)


Source: https://docs.cloudraker.com/paperwork/api/agents/decide-agent-run-approval/index.md
