Skip to content

Area: Developers

Check an email's consent history

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

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).

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.

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

authorization: Bearer $RELEVA_ACCESS_TOKEN

Find it under Settings › Shop & Integration; see Find your Access Token and Secret Key.

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.

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

Field Type Required Notes
email string Yes The email address to check.
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" }'

200 with:

{ "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.

Status When Message
400 Authentication failed See 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
429 More than 30 requests in 15 minutes from one IP address
  • 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.