# Contact routes: subscribe, suppress, unsubscribe

URL: /code/api/contact/verbs-subscribe · Id: `page:code/api/contact/verbs-subscribe`

> The Contact Verbs subscribe, suppress, unsubscribe as api.sb routes, with inputs, result, refusals and an example.

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

### Contact.subscribe
Subscribe records a Contact’s chosen topics and frequency from the hosted preference page, with Consent for each topic. [Verb page](/business/nouns/contact/subscribe?interface=api).

```text
POST /{namespace}/contacts/{contact}/subscribe
```

Path: `contact`. Body, as JSON: the other inputs. Emits [`Contact.subscribed`](/business/events/Contact.subscribed).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `contact` | [Contact](/business/nouns/contact) | Yes | The Contact. |
| `topics` | `string[]` | Yes | The topics the Contact chose. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `contact` | [Contact](/business/nouns/contact) | Yes | The Contact, with their topics. |

**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 POST https://api.sb/leaseline.app/contacts/contact_WsrosCQi6J/subscribe \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"topics":["Example topics"]}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "contact": {
    "$id": "https://api.sb/leaseline.app/contacts/contact_WsrosCQi6J",
    "$type": "Contact",
    "email": "marcus@riversideproperty.com",
    "phone": "Example phone"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Contact.subscribe",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### Contact.suppress
Suppress records a Suppression for a Contact’s address, which every Startup honors forever. [Verb page](/business/nouns/contact/suppress?interface=api).

```text
POST /{namespace}/contacts/{contact}/suppress
```

Path: `contact`. Emits [`Contact.suppressed`](/business/events/Contact.suppressed).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `contact` | [Contact](/business/nouns/contact) | Yes | The Contact who opts out. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `contact` | [Contact](/business/nouns/contact) | Yes | The suppressed Contact. |

**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 POST https://api.sb/leaseline.app/contacts/contact_WsrosCQi6J/suppress \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "contact": {
    "$id": "https://api.sb/leaseline.app/contacts/contact_WsrosCQi6J",
    "$type": "Contact",
    "email": "marcus@riversideproperty.com",
    "phone": "Example phone"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Contact.suppress",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### Contact.unsubscribe
Unsubscribe stops commercial Messages to a Contact in one click, for one topic or all, honored at once. [Verb page](/business/nouns/contact/unsubscribe?interface=api).

```text
POST /{namespace}/contacts/{contact}/unsubscribe
```

Path: `contact`. Body, as JSON: the other inputs. Emits [`Contact.unsubscribed`](/business/events/Contact.unsubscribed).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `contact` | [Contact](/business/nouns/contact) | Yes | The Contact. |
| `topic` | `string` | No | One topic; omitted, every commercial topic. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `contact` | [Contact](/business/nouns/contact) | Yes | The Contact, unsubscribed. |

**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 POST https://api.sb/leaseline.app/contacts/contact_WsrosCQi6J/unsubscribe \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "contact": {
    "$id": "https://api.sb/leaseline.app/contacts/contact_WsrosCQi6J",
    "$type": "Contact",
    "email": "marcus@riversideproperty.com",
    "phone": "Example phone"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Contact.unsubscribe",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```