# Record a contact event

```http
POST https://trydimmi.com/api/v1/contact-events
```

## Authorization

Send an API token as `Authorization: Bearer <token>`.
The token needs: `contacts:write`.

## Body

- `contact_id` (string): The person by contact id (ctc_...); or give external_id or email instead.
- `email` (string): An email address, such as ana@example.com.
- `events` (object[] | null): Up to 100 events with the same fields, instead of one at the top level.
  - `contact_id` (string): Id of the contact who did it, starting with ctc_, such as ctc_01jx2m8k4t. Name the person by exactly one of contact_id, external_id and email.
  - `email` (string): Email address of the contact who did it, such as ana@example.com. Name the person by exactly one of contact_id, external_id and email.
  - `external_id` (string): Your own system's id of the contact who did it, such as user_8421. Name the person by exactly one of contact_id, external_id and email.
  - `idempotency_key` (string): A unique text you make up for this event, at most 128 characters, so sending it again within 48 hours does not record it twice, such as order-1042-paid.
  - `metadata` (object): Details of the event, as a flat object of at most 20 keys whose values are text, numbers or true/false, 2 KB in all, such as {"plan": "pro", "amount": 49}.
  - `name` (string): The event's name: 1 to 64 lowercase letters, digits, underscores, dots, colons or hyphens, such as order_placed.
  - `occurred_at` (string): When it happened, as an ISO 8601 time, such as 2026-11-20T14:30:00Z. Left out, it is now. Times over 30 days back or over an hour ahead are moved into that range.
- `external_id` (string): Your own system's id of this record, such as user_8421.
- `idempotency_key` (string): A key to send the same event again safely; repeats within 48 hours count once.
- `metadata` (object): An object of details kept with the person's last event of this name.
- `name` (string): The event's name, 64 characters at most, such as signed_up.
- `occurred_at` (string): RFC 3339 time, up to 30 days ago; earlier or future times are clamped.

## Response 200 (OK)

- `data` (object, required)
  - `accepted` (integer, required): How many of the events sent were accepted.
  - `events` (object[] | null, required): The result of each event sent, in the order sent.
    - `contact_id` (string | null, required): Id of the contact the event was recorded for, such as ctc_.... Null when no contact was matched.
    - `occurred_at_clamped` (boolean): True when the event's time was outside the allowed range and was moved into it. Left out otherwise.
    - `status` (string, required): What became of the event: accepted, duplicate, contact_not_found, archived, event_limit_reached or not_allowed.
  - `object` (string, required): The kind of record this is, the same for every record of its kind, such as article.

## Response default (Error)

- `code` (string, required): Stable code for programs to tell errors apart, such as validation_failed or internal_error.
- `errors` (object): Each rejected field mapped to its messages. Only present when the input was invalid.
- `message` (string, required): What went wrong, in words safe to show a person.

## Example request

```bash
curl --request POST \
  --url 'https://trydimmi.com/api/v1/contact-events' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "contact_id": "<string>",
  "email": "<string>",
  "events": [
    {
      "contact_id": "<string>",
      "email": "<string>",
      "external_id": "<string>",
      "idempotency_key": "<string>",
      "metadata": {
        "<key>": null
      },
      "name": "<string>",
      "occurred_at": "2026-11-01T09:30:00Z"
    }
  ],
  "external_id": "<string>",
  "idempotency_key": "<string>",
  "metadata": {
    "<key>": null
  },
  "name": "<string>",
  "occurred_at": "2026-11-01T09:30:00Z"
}'
```

## Example response

```json
{
  "data": {
    "accepted": 123,
    "events": [
      {
        "contact_id": "<string>",
        "occurred_at_clamped": true,
        "status": "<string>"
      }
    ],
    "object": "<string>"
  }
}
```

---

Index of all dimmi docs: https://trydimmi.com/llms.txt (full text: https://trydimmi.com/llms-full.txt)
