SendlySendly
API ReferenceEvents

Track a custom event for a contact

POST
/api/track

Record a custom event, creating or updating the contact by email as a side effect. Requires a FULL (sk_*) key — SENDING_ONLY (pk_*) keys answer 403, since recording events is not sending mail. Reserved system event names (email.*, contact.subscribed/unsubscribed, segment.*.entry/.exit) are rejected.

Requires the events:write scope — Record custom events for your contacts.

Authorization

AuthorizationBearer <token>

API key authentication. Use a sk_* (FULL) or pk_* (SENDING_ONLY) key as the bearer token. Public keys (pk_*) are restricted to the email-send endpoints and the self-serve list subscribe/unsubscribe pair; every other endpoint — event tracking included — answers 403 for them. In scope terms (used by /api/v1/* operations): FULL keys hold every scope; SENDING_ONLY keys hold only emails:send.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Body for POST /api/track — record a custom event for a contact.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/track" \  -H "Content-Type: application/json" \  -d '{    "event": "string",    "email": "user@example.com"  }'
{
  "success": true,
  "data": {
    "contact": "ad596931-5d7c-4d2b-907e-5b64c9432eb4",
    "event": "1a4a8620-0119-4336-af71-a3b3e24f5ebc",
    "timestamp": "2019-08-24T14:15:22Z"
  }
}
{
  "success": false,
  "error": {
    "message": "string",
    "code": "string",
    "details": {
      "errors": [
        null
      ]
    }
  }
}
{
  "success": false,
  "error": {
    "message": "string",
    "code": "string",
    "details": {
      "errors": [
        null
      ]
    }
  }
}
{
  "success": false,
  "error": {
    "message": "string",
    "code": "string",
    "details": {
      "errors": [
        null
      ]
    }
  }
}
{
  "success": false,
  "error": {
    "message": "string",
    "code": "string",
    "details": {
      "errors": [
        null
      ]
    }
  }
}
{
  "success": false,
  "error": {
    "message": "string",
    "code": "string",
    "details": {
      "errors": [
        null
      ]
    }
  }
}