Create Opt-Out Request
On this page
GraphQL endpoint: /company
Create an opt-out request to record a user's request to stop receiving communications. This is typically used when processing opt-out keywords (e.g., "STOP") received via SMS.
Required fields:
source: The source/sender of the opt-out request (e.g., phone number)destination: The destination (e.g., company's phone number that received the request)type: The communication type (SMS, VOICE, EMAIL)timestamp: When the opt-out request was received
Optional fields:
externalId: External identifier for referencemessageBody: The content of the opt-out messagemetadata: Additional metadata as key-value pairs (flat structure only)
The request is created with status RECEIVED, and moves through NOTIFIED, REMINDER_SENT, ACCEPTED, REJECTED, REVOKED or EXPIRED as it is processed. Processing the opt-out may trigger removal of the user from relevant subscriptions.
Query
mutation (
$source: String!
$destination: String!
$externalId: String
$messageBody: String
$type: OptOutRequestType!
$timestamp: NaiveDateTime!
$metadata: JSON
) {
createOptOutRequest (
source: $source
destination: $destination
externalId: $externalId
messageBody: $messageBody
type: $type
timestamp: $timestamp
metadata: $metadata
) {
id
source
destination
externalId
messageBody
type
status
createdAt
updatedAt
timestamp
metadata
company {
id
}
}
}
Variables
{
"destination": "1234130",
"externalId": "1230",
"messageBody": "message content",
"metadata": {
"test": "value"
},
"source": "2132130",
"timestamp": "2024-10-04 02:52:00",
"type": "SMS"
}
Response
{
"data": {
"createOptOutRequest": {
"company": {
"id": "00000000-0000-4000-8000-000000000001"
},
"createdAt": null,
"destination": "1234130",
"externalId": "1230",
"id": "00000000-0000-4000-8000-000000000002",
"messageBody": "message content",
"metadata": {
"test": "value"
},
"source": "2132130",
"status": "RECEIVED",
"timestamp": "2026-01-15T09:00:00.000000",
"type": "SMS",
"updatedAt": "2026-01-15T09:00:01.000000"
}
}
}