Collect an optout
POST
/client-optout/collect
const url = 'https://collect.optoutsystem.com/client-optout/collect';const options = { method: 'POST', headers: {api_key: '<api_key>', 'Content-Type': 'application/json'}, body: '{"optoutListId":"901fad4c46a1e723","email":"an@example.com"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://collect.optoutsystem.com/client-optout/collect \ --header 'Content-Type: application/json' \ --header 'api_key: <api_key>' \ --data '{ "optoutListId": "901fad4c46a1e723", "email": "an@example.com" }'Collects an optout to be processed and stored directly into an Opt-Out List.
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”Details of what should be included in the list collect optout request.
Media typeapplication/json
One of:
object
optoutListId
required
The Opt-Out list id, which can be found on the Opt-Out list page under Opt-Out List Details
string
Example
901fad4c46a1e723email
required
An email to collect as an optout into an email list.
string
Example
an@example.comobject
optoutListId
required
The Opt-Out list id, which can be found on the Opt-Out list page under Opt-Out List Details
string
Example
901fad4c46a1e723sms
required
A phone number to collect as an optout into an SMS list.
string
Example
12345678900Responses
Section titled “Responses”Optout has been collected and will be processed shortly.
Invalid request payload sent. Further details will be available in the response payload.
This could mean any of the following:
- Authorization token was not sent or was invalid
- The Opt-Out List id is invalid
- The Opt-Out List is disabled or deleted
- The Opt-Out List is a Grouped list
- The Opt-Out List is a Linked List
- User does not have access to the Opt-Out List
