# Check an email's consent history

> POST /api/v0/subscribe/check with your access token tells you whether an email address has ever been subscribed or unsubscribed in your shop. Request, curl, Releva.checkSubscribed, response, errors and the 30-per-15-minutes limit.

`POST https://releva.ai/api/v0/subscribe/check` answers one question: has this email address ever been subscribed or unsubscribed in your shop?

## When to use it

Call it from your site before you show an offer meant only for new subscribers, such as “subscribe and get 10% off”. It uses the same test as `rejectAlreadySubscribed` on the subscribe calls, so you can hide the offer up front instead of having the subscribe answer `409` afterwards.

It does not tell you whether the customer is subscribed **now**: an address that unsubscribed also answers `true`. To see the current status, open the profile (see [Check a customer’s subscription status](https://releva.ai/documentation/guides/consent/check-a-customers-subscription-status/)).

With the JavaScript SDK, call `Releva.checkSubscribed('maria@example.com')`. It returns a promise that resolves to `true` or `false`, and rejects with an error that carries `status` and `body` on any other answer.

## Authentication

Send your shop’s **access token** as a bearer token:

```plaintext
authorization: Bearer $RELEVA_ACCESS_TOKEN
```

Find it under **Settings › Shop & Integration**; see [Find your Access Token and Secret Key](https://releva.ai/documentation/guides/shop-settings/find-your-api-keys/).

Authentication failures answer `400`, not `401`:

| Problem                                                                | Message                                                                                                              |
| ---------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| No `authorization` header                                              | `Authorization header is missing, and accessToken url parameters is also missing. At least one of them is required.` |
| The header is not `Bearer` followed by a token                         | ``Authorization header is malformed. It should look like `Bearer <string>`.``                                        |
| The token is not a UUID                                                | `The access token you provided is invalid.`                                                                          |
| No shop has this access token (also when you send the secret key here) | `Domain with the provided access token cannot be found.`                                                             |

A shop that is switched off answers `402` with `Domain is disabled. Please reach out to support@releva.ai to enable it.`

## Request

`POST /api/v0/subscribe/check` with `content-type: application/json`.

| Field   | Type   | Required | Notes                       |
| ------- | ------ | -------- | --------------------------- |
| `email` | string | Yes      | The email address to check. |

```plaintext
curl -X POST 'https://releva.ai/api/v0/subscribe/check' \
  -H "authorization: Bearer $RELEVA_ACCESS_TOKEN" \
  -H 'content-type: application/json' \
  -d '{ "email": "maria@example.com" }'
```

## Response

`200` with:

```plaintext
{ "subscribed": true }
```

`true` means the address has been subscribed or unsubscribed at some point in your shop. `false` means it has neither, including when Releva does not know the address at all. The call changes nothing.

## Errors

| Status | When                                                    | Message                                     |
| ------ | ------------------------------------------------------- | ------------------------------------------- |
| `400`  | Authentication failed                                   | See [Authentication](https://releva.ai/documentation/reference/consent/check-consent-history/#authentication)       |
| `400`  | No `email`                                              | `The 'email' field is required.`            |
| `400`  | `"email": "not-an-email"`                               | `The 'email' field must be a valid e-mail.` |
| `402`  | The shop is switched off                                | See [Authentication](https://releva.ai/documentation/reference/consent/check-consent-history/#authentication)       |
| `429`  | More than 30 requests in 15 minutes from one IP address |                                             |

## Limits

* HTTPS only. Body size: 800 KB.
* Rate limit: 30 requests per 15 minutes per IP address. Every request counts, successful or not. Responses carry the standard `RateLimit` and `RateLimit-Policy` headers.
* Email addresses only. There is no phone number check.

## Next steps

* [Subscribe a customer from the browser](https://releva.ai/documentation/reference/consent/subscribe-from-the-browser/): Send the sign-up, with `rejectAlreadySubscribed` as a second guard.
* [Choose a consent call](https://releva.ai/documentation/reference/consent/choose-a-consent-call/): See every consent call and when each one fits.