Safe CRM Public APIGuideReference

Add an Event to the Customer

Attach a custom event to the customer

POST {{baseUrl}}/customers/{id}/events

Adds a custom event (such as a form submission, phone call, webhook, or integration action) to an existing customer record.

Headers:

X-Api-Key: your_secret_api_key  
Content-Type: application/json

Path parameters:

  • id (GUID): The unique identifier of the customer to whom the event should be attached.

Request Body

The request must include:

{
  "event": "some_event", // A unique identifier for the event. Use lowercase_snake_case formatting.
  "data": "any data you want", // A string containing any relevant event data. You may use a JSON-encoded string to store structured data (objects, arrays, etc.).
  "utmData": {
    "source": null,    // Corresponds to the utm_source parameter (e.g., "google", "facebook").
    "medium": null,    // Corresponds to the utm_medium parameter (e.g., "cpc", "email").
    "campaign": null,  // Corresponds to the utm_campaign parameter (e.g., "spring_sale").
    "term": null,      // Corresponds to the utm_term parameter (used for paid keyword tracking).
    "content": null    // Corresponds to the utm_content parameter (used to differentiate ads or links).
  },
  "eventDateTime": "2025-06-15T21:28:22.734Z" // (Optional) Timestamp of the event in UTC (ISO 8601 format). If omitted, the server will use the current time.
}

Refer to the Reference section for complete request and response models.

Best PracticesCopied!

  • Always use UTC for eventDateTime values to maintain consistency across distributed systems and proper report functionality.

  • If you want to send an event for the customer that wasn’t created yet - store all the events that has to be sent with date and time in local storage or in-memory variable. Send them right after obtaining a customer ID from Create a Customer request.

  • Use lowercase_snake_case format for the event names. Don’t use camelCase or any other variation.