# Newsletter routes: update, delete

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

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

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

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

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

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

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Newsletter. |
| `name` | `string` | No | What subscribers see it called. |
| `from` | [Mailbox](/business/nouns/mailbox) | No | The broadcast Mailbox each issue sends from. |
| `topic` | `string` | No | The topic a Contact subscribes to, recorded with their Consent. |
| `offer` | [Offer](/business/nouns/offer) | No | The Offer whose Subscription unlocks paid issues and the archive. |

**Returns**

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

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

```json
{
  "api": "https://api.sb/leaseline.app",
  "newsletter": {
    "$id": "https://api.sb/leaseline.app/newsletters/newsletter_FLjN3aQujc",
    "$type": "Newsletter",
    "name": "Leaseline notes",
    "from": "mailbox_93HvOnR17L"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Newsletter.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

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

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

Path: `id`. Emits `Newsletter.deleted`.

**Inputs**

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

**Returns**

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

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

```json
{
  "api": "https://api.sb/leaseline.app",
  "newsletter": {
    "$id": "https://api.sb/leaseline.app/newsletters/newsletter_FLjN3aQujc",
    "$type": "Newsletter",
    "name": "Leaseline notes",
    "from": "mailbox_93HvOnR17L"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Newsletter.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```