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

# Batch Events

> Ingest up to 100 events in a single request.

## POST /api/v1/events/batch

Submit an array of events for batch ingestion. All events are processed asynchronously. Maximum **100 events** per request.

### Request Body

<ParamField body="events" type="array" required>
  Array of event objects. Each object follows the same schema as the [single event endpoint](/api-reference/ingest-event).
</ParamField>

### Response

Returns `202 Accepted`:

```json theme={null}
{
  "events": [
    { "id": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d", "status": "queued" },
    { "id": "a2c3d4e5-6f7a-8b9c-0d1e-2f3a4b5c6d7e", "status": "queued" },
    { "id": "b3d4e5f6-7a8b-9c0d-1e2f-3a4b5c6d7e8f", "status": "duplicate" }
  ]
}
```

Each event in the response includes its pre-generated `id` and a `status` of either `queued` or `duplicate`.

### Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://getimmutable.dev/api/v1/events/batch \
    -H "Authorization: Bearer imk_your_api_key_here" \
    -H "Content-Type: application/json" \
    -d '{
      "events": [
        {
          "actor_id": "user_2hG9kLm",
          "actor_name": "Sarah Chen",
          "action": "document.created",
          "resource_id": "doc_8nXpQr3",
          "resource_name": "Q4 Financial Report"
        },
        {
          "actor_id": "user_2hG9kLm",
          "actor_name": "Sarah Chen",
          "action": "document.shared",
          "resource_id": "doc_8nXpQr3",
          "resource_name": "Q4 Financial Report",
          "targets": [
            { "type": "team", "id": "team_5bR7cNx", "name": "Engineering" }
          ]
        },
        {
          "actor_id": "user_9pK3mNq",
          "actor_name": "James Rivera",
          "action": "comment.added",
          "resource_id": "doc_8nXpQr3",
          "metadata": {
            "comment_id": "cmt_7xL2bRw",
            "body": "Looks good, approved."
          }
        }
      ]
    }'
  ```

  ```typescript JavaScript theme={null}
  const results = await client.trackBatch([
    {
      actor_id: "user_2hG9kLm",
      actor_name: "Sarah Chen",
      action: "document.created",
      resource_id: "doc_8nXpQr3",
      resource_name: "Q4 Financial Report",
    },
    {
      actor_id: "user_2hG9kLm",
      actor_name: "Sarah Chen",
      action: "document.shared",
      resource_id: "doc_8nXpQr3",
      targets: [{ type: "team", id: "team_5bR7cNx", name: "Engineering" }],
    },
  ]);
  ```

  ```php Laravel theme={null}
  use GetImmutable\AuditLog;

  AuditLog::trackBatch([
      [
          'actor_id' => 'user_2hG9kLm',
          'actor_name' => 'Sarah Chen',
          'action' => 'document.created',
          'resource_id' => 'doc_8nXpQr3',
          'resource_name' => 'Q4 Financial Report',
      ],
      [
          'actor_id' => 'user_2hG9kLm',
          'actor_name' => 'Sarah Chen',
          'action' => 'document.shared',
          'resource_id' => 'doc_8nXpQr3',
          'targets' => [
              ['type' => 'team', 'id' => 'team_5bR7cNx', 'name' => 'Engineering'],
          ],
      ],
  ]);
  ```
</CodeGroup>

### Limits

* Maximum **100 events** per batch request.
* Each event counts toward your workspace's monthly event quota.
* Validation errors for individual events do not prevent other events in the batch from being processed.

<Note>
  Batch events are assigned `created_at` timestamps offset by 1 microsecond per event to preserve insertion order within the [hash chain](/guides/hash-chain). This ensures correct chain verification.
</Note>
