# Action routes: cancel, evaluate, pause, redirect

URL: /code/api/action/verbs-cancel · Id: `page:code/api/action/verbs-cancel`

> The Action Verbs cancel, evaluate, pause, redirect as api.sb routes, with inputs, result, refusals and an example.

Reference for [Action](/business/nouns/action), one group of [Action routes](/code/api/action).

### Action.cancel
Cancel stops a pending Action, sets its status to `canceled`, and runs its compensation. [Verb page](/business/nouns/action/cancel?interface=api).

```text
POST /{namespace}/actions/{action}/cancel
```

Path: `action`. Body, as JSON: the other inputs. Emits [`Action.canceled`](/business/events/Action.canceled).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `action` | [Action](/business/nouns/action) | Yes | The pending Action. |
| `reason` | `text` | No | Why it stops. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `action` | [Action](/business/nouns/action) | Yes | The canceled Action. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
| The record is not in a state that allows this Verb, so the call is refused. | [`refused`](/code/api/errors/refused) | Read the record, run the Verb that moves it to an allowed state, then retry. | None. |

**Example**

```bash
curl -X POST https://api.sb/leaseline.app/actions/act_br07HsG8MG/cancel \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "$type": "Action",
    "status": "done",
    "mode": "try",
    "operation": "Action.cancel"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### Action.evaluate
Evaluate grades an Action’s output against a rubric and records the verdict as an Event. [Verb page](/business/nouns/action/evaluate?interface=api).

```text
POST /{namespace}/actions/{action}/evaluate
```

Path: `action`. Body, as JSON: the other inputs. Emits [`Action.evaluated`](/business/events/Action.evaluated).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `action` | [Action](/business/nouns/action) | Yes | The Action whose output is graded. |
| `evaluator` | `string` | Yes | The Evaluator to run. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `verdict` | `json` | Yes | The score and the reasons for it. |
| `action` | [Action](/business/nouns/action) | Yes | The Action graded, with the verdict attached. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The input does not match the schema of the operation. | [`invalid-input`](/code/api/errors/invalid-input) | Read the schema of the operation, then send every required field with the right type. | None. |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```bash
curl -X POST https://api.sb/leaseline.app/actions/act_br07HsG8MG/evaluate \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"evaluator":"Example evaluator"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "verdict": {},
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "$type": "Action",
    "status": "done",
    "mode": "try",
    "operation": "Action.evaluate"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### Action.pause
Pause holds a pending Action past the close of its delay window until a watcher resumes, redirects, or cancels it. [Verb page](/business/nouns/action/pause?interface=api).

```text
POST /{namespace}/actions/{action}/pause
```

Path: `action`. Body, as JSON: the other inputs. Emits [`Action.paused`](/business/events/Action.paused).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `action` | [Action](/business/nouns/action) | Yes | The pending Action. |
| `reason` | `text` | Yes | Why it must wait. |
| `until` | `datetime` | No | When the pause escalates to the Role above if nobody resolves it; defaults to one business day. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `action` | [Action](/business/nouns/action) | Yes | The paused Action, still `pending`. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```bash
curl -X POST https://api.sb/leaseline.app/actions/act_br07HsG8MG/pause \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"reason":"Example reason"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "$type": "Action",
    "status": "done",
    "mode": "try",
    "operation": "Action.pause"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### Action.redirect
Redirect changes a pending Action’s inputs or target inside its delay window, before it runs. [Verb page](/business/nouns/action/redirect?interface=api).

```text
POST /{namespace}/actions/{action}/redirect
```

Path: `action`. Body, as JSON: the other inputs. Emits [`Action.redirected`](/business/events/Action.redirected).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `action` | [Action](/business/nouns/action) | Yes | The pending Action. |
| `changes` | `json` | Yes | The inputs to replace. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `action` | [Action](/business/nouns/action) | Yes | The redirected Action. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The input does not match the schema of the operation. | [`invalid-input`](/code/api/errors/invalid-input) | Read the schema of the operation, then send every required field with the right type. | None. |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
| The record is not in a state that allows this Verb, so the call is refused. | [`refused`](/code/api/errors/refused) | Read the record, run the Verb that moves it to an allowed state, then retry. | None. |

**Example**

```bash
curl -X POST https://api.sb/leaseline.app/actions/act_br07HsG8MG/redirect \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"changes":{}}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "$type": "Action",
    "status": "done",
    "mode": "try",
    "operation": "Action.redirect"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```