Skip to main content
Unsubscribing a contact sets unsubscribed: true and creates an audit record. Resubscribing removes that record and re-enables email delivery.

Authentication

All endpoints require:
  • Authorization: Bearer YOUR_API_KEY
  • X-Project-ID: YOUR_PROJECT_ID (or encoded in the API key)

Endpoints

MethodPathDescription
POST/api/v1/contacts/:id/unsubscribesUnsubscribe a contact
GET/api/v1/contacts/:id/unsubscribesGet unsubscribe records
DELETE/api/v1/contacts/:id/unsubscribesResubscribe a contact

Unsubscribe a Contact

POST https://api.usegately.com/api/v1/contacts/CONTACT_ID/unsubscribes
Body (all optional)
{
  "reason": "Too many emails",
  "source": "user_request"
}
SDK
await crm.unsubscribeContact('CONTACT_ID', {
  reason: 'Too many emails',
  source: 'user_request',
})
Response
{
  "id": "unsub-uuid",
  "contact_id": "contact-uuid",
  "project_id": "proj-uuid",
  "type": "all",
  "reason": "Too many emails",
  "source": "user_request",
  "unsubscribed_at": "2025-06-15T10:00:00.000Z"
}

Get Unsubscribe Records

GET https://api.usegately.com/api/v1/contacts/CONTACT_ID/unsubscribes
SDK
const records = await crm.getUnsubscribes('CONTACT_ID')

Resubscribe a Contact

Removes all unsubscribe records and sets unsubscribed: false.
DELETE https://api.usegately.com/api/v1/contacts/CONTACT_ID/unsubscribes
SDK
await crm.resubscribeContact('CONTACT_ID')
Response
{ "message": "Contact resubscribed successfully" }

TypeScript Type

interface UnsubscribeRecord {
  id: string
  contact_id: string
  project_id: string
  type: string
  reason?: string | null
  source?: string | null
  unsubscribed_at: string
}