# Consent 3rd party API

**Summary:** Let an external system register or withdraw a member's consent in Subrite through the consents API, using an M2M token and the integration ID of the consent.

- Space: [Developers](https://www.subrite.no/developers)
- Source: https://www.subrite.no/developers/consent-api
- Updated: 2026-09-23
- Markdown index: https://www.subrite.no/developers/llms.txt

<a id="step-1-create-a-consent"></a>
## Step 1: Create a consent

Create a consent with 3rd party integration and collect the **Integration Id** from the UI.

![Create a consent](https://cdn.sanity.io/images/1x2xswq6/production/0f789e78b4f44779e8e364d79040c8cc06ae662a-936x1152.png?w=1600&fit=max&auto=format)

<a id="step-2-create-an-m2m-token"></a>
## Step 2: Create an M2M token

Create an M2M token granting Consent permissions. You will receive the token once you click save.

![Create an M2M token](https://cdn.sanity.io/images/1x2xswq6/production/ca4e8317595b6e05838fcd6e40cdce103a4ec58a-936x634.png?w=1600&fit=max&auto=format)

<a id="step-3-call-the-api"></a>
## Step 3: Call the API

- **Method:** `POST`
- **Route:** `{baseUrl}/api/v1/consents/{integrationId}`
- **Authorization:** Bearer token (use the M2M token from step 2)
- **Body:** see the examples below

<a id="example-body-1"></a>
### Example body 1

```json
{
  "email": "test1@subrite.no",
  "status": "accepted"
}
```

<a id="example-body-2"></a>
### Example body 2

```json
{
  "email": "test2@subrite.no",
  "status": "withdrawn"
}
```

<a id="example-body-3-with-reference"></a>
### Example body 3 (with reference)

```json
{
  "email": "test3@subrite.no",
  "status": "accepted",
  "reference": "external-reference"
}
```

<a id="request-body-fields"></a>
### Request body fields

| Field | Required | Description |
| --- | --- | --- |
| `email` | Yes | Email address of the subscriber |
| `status` | Yes | Consent status: `accepted` or `withdrawn` |
| `reference` | No | Custom reference string for tracking purposes, for example an external system ID, campaign reference, URL or any custom identifier |

> [!WARNING]
> **Status deprecation notice**
>
> **Current status support:**
>
> - `accepted` / `subscribed`: both statuses are currently supported
> - `withdrawn` / `unsubscribed`: both statuses are currently supported
>
> **Upcoming changes:**
>
> - The `subscribed` and `unsubscribed` statuses will be deprecated in a future release
> - Only `accepted` and `withdrawn` will be supported going forward
> - We recommend updating your integrations to use the new status values as soon as possible
