# Organization routes: update, delete

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

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

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

### Organization.update
Changes the given properties of an Organization. [Verb page](/business/nouns/organization/update?interface=api).

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

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

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Organization. |
| `name` | `string` | No | The name it trades under. |
| `hostname` | `string` | No | The web domain that keys it. |

**Returns**

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

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

```json
{
  "api": "https://api.sb/leaseline.app",
  "organization": {
    "$id": "https://api.sb/leaseline.app/organizations/organization_v0SkRLrXCN",
    "$type": "Organization",
    "name": "Leaseline"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Organization.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

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

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

Path: `id`. Emits `Organization.deleted`.

**Inputs**

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

**Returns**

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

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

```json
{
  "api": "https://api.sb/leaseline.app",
  "organization": {
    "$id": "https://api.sb/leaseline.app/organizations/organization_v0SkRLrXCN",
    "$type": "Organization",
    "name": "Riverside Property"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Organization.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```