# Role routes: update, delete

URL: /code/api/role/records-update · Id: `page:code/api/role/records-update`

> The Role Verbs update, delete as api.sb routes, with inputs, result, refusals and an example.

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

### Role.update
Changes the given properties of a Role. [Verb page](/business/nouns/role/update?interface=api).

```text
PATCH /{namespace}/roles/{id}
```

Path: `id`. Body, as JSON: the other inputs. Emits `Role.updated`.

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Role. |
| `name` | `string` | No | The title of the seat. |
| `responsibilities` | `text` | No | The work the seat owns. |
| `approvals` | `json` | No | What waits for the founder: rules by action class (`spend`, `sign`, `publish`, `price`, `send`), each optionally above an amount in USD. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `role` | [Role](/business/nouns/role) | Yes | The Role. |

**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 PATCH https://api.sb/leaseline.app/roles/role_oloMFMUeCH \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Leaseline"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "role": {
    "$id": "https://api.sb/leaseline.app/roles/role_oloMFMUeCH",
    "$type": "Role",
    "name": "Leaseline",
    "status": "filled"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Role.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### Role.delete
Deletes a Role: a soft delete that keeps its history, undone by `Thing.restore`. [Verb page](/business/nouns/role/delete?interface=api).

```text
DELETE /{namespace}/roles/{id}
```

Path: `id`. Emits `Role.deleted`.

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Role. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `role` | [Role](/business/nouns/role) | Yes | The Role. |

**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 DELETE https://api.sb/leaseline.app/roles/role_oloMFMUeCH \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "role": {
    "$id": "https://api.sb/leaseline.app/roles/role_oloMFMUeCH",
    "$type": "Role",
    "name": "Success Manager",
    "status": "filled"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Role.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```