Skip to Content

Record a contact event

Records a custom contact event. Identify the contact by exactly one ID, external ID, or email.

POST
/v1/events

Records a custom contact event. Identify the contact by exactly one ID, external ID, or email. A missing email or external ID creates a contact; an unknown contact ID returns 404. An organization-scoped idempotency key replays the original event. Event names use letters, digits, underscores, hyphens, and dots, up to 255 characters; contact. and samva. prefixes are reserved. Properties allow at most 50 keys and 32 KiB of UTF-8 JSON. Events are retained for 90 days.

Authorization

apiKey
headerx-api-key<token>

Header Parameters

idempotency-key?string
Length1 <= length <= 255

Request Body

application/json
  1. body
contact*||
name*string
Length1 <= length <= 255
properties?|null
occurredAt?string|null

Response Body

ContactEvent

application/json
  1. response
id*string
contactId*ContactId
Match^contact_[0-9a-hjkmnp-tv-z]{16,24}$
name*string
source*string
Value in"api""samva"
properties*
occurredAt*string
recordedAt*string
Example Request
import { createClient } from "samva";

const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });

const result = await samva.events.create({
  "contact": {
    "id": "example"
  },
  "name": "example"
});
Example Response
{
  "id": "string",
  "contactId": "string",
  "name": "string",
  "source": "api",
  "properties": {
    "property1": "string",
    "property2": "string"
  },
  "occurredAt": "string",
  "recordedAt": "string"
}

Related documentation