# Component routes: update, delete

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

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

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

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

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

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

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Component. |
| `name` | `string` | No | The name a Template places it by, such as `Pricing`. |
| `props` | `json` | No | The schema of the props it accepts. |
| `region` | `string` | No | Where it sits: `header`, `section`, `footer`, or `notice`. |
| `interactive` | `boolean` | No | True when it runs code in the browser; it still renders a static still without it. |

**Returns**

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

**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/components/component_1qALyfTlfx \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Leaseline"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "component": {
    "$id": "https://api.sb/leaseline.app/components/component_1qALyfTlfx",
    "$type": "Component",
    "name": "Leaseline",
    "props": {}
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Component.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

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

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

Path: `id`. Emits `Component.deleted`.

**Inputs**

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

**Returns**

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

**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/components/component_1qALyfTlfx \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "component": {
    "$id": "https://api.sb/leaseline.app/components/component_1qALyfTlfx",
    "$type": "Component",
    "name": "Leaseline",
    "props": {}
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Component.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```