> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sendrealm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Event Ingest

> Submit customer events and understand reserved system event rules.

## Endpoint

`POST /events`

## Request body

```json theme={null}
{
  "event": "order.completed",
  "contact_id": "c671f89b-3ec1-4c58-9ad2-4ef8c2917cda",
  "payload": {
    "order_id": "ord_123",
    "total": 4900
  },
  "correlation": {
    "key": "order_id",
    "value": "ord_123"
  },
  "occurred_at": "2026-06-08T14:15:00.000Z",
  "idempotency_key": "evt_order_completed_ord_123"
}
```

You can also identify a contact with `external_id` or `email`.

Use `correlation` when an identity can have more than one active business flow.
For checkout recovery, send the same `checkout_id` with both `checkout.started`
and `checkout.completed`; a correlated wait resumes only its matching checkout.

To create or merge an email contact while ingesting an event, opt in explicitly:

```json theme={null}
{
  "event": "checkout.started",
  "email": "olivia@example.com",
  "contact": {
    "mode": "upsert",
    "fields": {
      "first_name": "Olivia"
    }
  }
}
```

Without `contact.mode: "upsert"`, event ingestion resolves existing contacts only.

Identity resolution order is:

1. `contact_id`
2. `external_id`
3. normalized `email`

## Successful response

```json theme={null}
{
  "data": {
    "id": "4d978da0-4504-42e3-9d71-e9b9a2f9082d",
    "event": "order.completed",
    "resolved_identity_type": "contact_id",
    "resolved_identity_value": "c671f89b-3ec1-4c58-9ad2-4ef8c2917cda",
    "occurred_at": "2026-06-08T14:15:00.000Z"
  }
}
```

New customer events currently return `202 Accepted`.

## Idempotent replay response

If you reuse the same `idempotency_key`, Sendrealm returns the existing event instead of creating a new one:

```json theme={null}
{
  "data": {
    "id": "4d978da0-4504-42e3-9d71-e9b9a2f9082d",
    "event": "order.completed",
    "deduplicated": true,
    "occurred_at": "2026-06-08T14:15:00.000Z"
  }
}
```

## Reserved namespace

Customer-submitted events must not start with `sendrealm.`.

Examples of Sendrealm system events:

* `sendrealm.mail.delivery`
* `sendrealm.push.open`
* `sendrealm.contact.updated`
* `sendrealm.topic.subscribed`

## Guarantees and limits

* Event ingest is at-least-once.
* Idempotency is enforced by `project_id + idempotency_key`.
* Payload size is capped by the project's configured event payload limit.
* Processing retries use exponential backoff before a dead-letter handoff.
* Ordering across separate events is not guaranteed.

## Retention

* Default event retention is 90 days.
* Retention windows can be adjusted through backoffice-managed project automation settings.


## OpenAPI

````yaml api-reference/openapi.json POST /events
openapi: 3.0.1
info:
  title: Sendrealm API
  description: >-
    API for email, push, audience resources, domains, campaign drafts,
    templates, events, topics, and automations
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.sendrealm.com
security:
  - bearerAuth: []
paths:
  /events:
    post:
      summary: Ingest an event
      description: Submit a customer event to start or resume automations.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - event
              properties:
                event:
                  type: string
                  example: order.completed
                contact_id:
                  type: string
                  format: uuid
                email:
                  type: string
                  format: email
                external_id:
                  type: string
                payload:
                  type: object
                  additionalProperties:
                    $ref: '#/components/schemas/JsonValue'
                correlation:
                  $ref: '#/components/schemas/Correlation'
                contact:
                  type: object
                  properties:
                    mode:
                      type: string
                      enum:
                        - existing
                        - upsert
                    fields:
                      type: object
                      additionalProperties:
                        $ref: '#/components/schemas/JsonValue'
                occurred_at:
                  type: string
                  format: date-time
                idempotency_key:
                  type: string
      responses:
        '200':
          description: Event replay deduplicated
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                      event:
                        type: string
                      deduplicated:
                        type: boolean
                      occurred_at:
                        type: string
                        format: date-time
        '202':
          description: Event accepted
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                      event:
                        type: string
                      resolved_identity_type:
                        type: string
                        enum:
                          - contact_id
                          - external_id
                          - email
                      resolved_identity_value:
                        type: string
                      occurred_at:
                        type: string
                        format: date-time
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    JsonValue:
      oneOf:
        - type: string
          nullable: true
        - type: number
        - type: boolean
        - type: object
          additionalProperties:
            $ref: '#/components/schemas/JsonValue'
        - type: array
          items:
            $ref: '#/components/schemas/JsonValue'
    Correlation:
      type: object
      required:
        - key
        - value
      properties:
        key:
          type: string
          maxLength: 100
        value:
          type: string
          maxLength: 255
    Error:
      type: object
      required:
        - status
        - error
      properties:
        status:
          type: integer
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            details:
              $ref: '#/components/schemas/JsonValue'
            issues:
              type: array
              items:
                $ref: '#/components/schemas/ValidationIssue'
    ValidationIssue:
      type: object
      required:
        - code
        - path
        - message
      properties:
        code:
          type: string
        path:
          type: string
          nullable: true
        message:
          type: string
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````