# Approval routes: approve, refuse

URL: /code/api/approval/verbs · Id: `page:code/api/approval/verbs`

> The Approval Verbs approve, refuse as api.sb routes, with inputs, result, refusals and an example.

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

### Approval.approve
Approve allows the pending Action an Approval holds, and that Action runs. [Verb page](/business/nouns/approval/approve?interface=api).

```text
POST /{namespace}/approvals/{approval}/approve
```

Path: `approval`. Body, as JSON: the other inputs. Emits [`Approval.approved`](/business/events/Approval.approved).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `approval` | [Approval](/business/nouns/approval) | Yes | The open Approval. |
| `note` | `text` | No | Why it is approved. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `approval` | [Approval](/business/nouns/approval) | Yes | The approved Approval. |

**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/approvals/approval_TlxQeWh9uX/approve \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "approval": {
    "$id": "https://api.sb/leaseline.app/approvals/approval_TlxQeWh9uX",
    "$type": "Approval",
    "status": "pending",
    "mode": "try"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Approval.approve",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### Approval.refuse
Refuse declines an Approval, which sets the Action it holds to `refused` with the reason given. [Verb page](/business/nouns/approval/refuse?interface=api).

```text
POST /{namespace}/approvals/{approval}/refuse
```

Path: `approval`. Body, as JSON: the other inputs. Emits [`Approval.refused`](/business/events/Approval.refused).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `approval` | [Approval](/business/nouns/approval) | Yes | The open Approval. |
| `reason` | `text` | Yes | Why it is refused. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `approval` | [Approval](/business/nouns/approval) | Yes | The refused Approval. |

**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/approvals/approval_TlxQeWh9uX/refuse \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"reason":"Example reason"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "approval": {
    "$id": "https://api.sb/leaseline.app/approvals/approval_TlxQeWh9uX",
    "$type": "Approval",
    "status": "refused",
    "mode": "try"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Approval.refuse",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```