---
title: "Ingest events to Togai in batch"
method: POST
path: "/ingestBatch"
tags: ["Event Ingestion"]
---

# Ingest events to Togai in batch

`POST /ingestBatch`

This API let’s you to ingest events in batch upto 500 events.
Ingest large amounts of events up to 500 in batches in an array using this API.

## Request body

- IngestBatchEventRequest — Payload for ingesting batch events
  - `events` Event[], required
    - `schemaName` string, required — Name of the Event Schema. Know more about [event schema](https://docs.togai.com/docs/event-schemas)
    - `id` string — Togai restricts users to ingest events with same id within a period of *45 days*. This restriction is common for [/entitled API](/api-reference/entitlements/ingest-event-if-a-user-is-entitled-to-a-feature), [/ingest API](/api-reference/event-ingestion/ingest-events-to-togai) and [/ingestBatch API](/api-reference/event-ingestion/ingest-events-to-togai-in-batch). i.e, an id used on /ingest API will not be allowed on /ingestBatch or /entitled APIs
    - `timestamp` string, date-time, required — Source time stamp of the event. This timestamp must be in ISO 8601 format.
    - `accountId` string, required — The event will be associated with the provided account
    - `attributes` Attribute[], required — Attributes are numeric values. It can be usage metric which you push to Togai
      - `name` string, required — Name of the event attribute
      - `value` string, required — Value of the event attribute
      - `unit` string — Unit with which the attribute value was measured. Natively supported units - "Meters, Miles, Kilometers, Grams, Kilograms, ounces, Pounds, Minutes, Hours, Seconds, Milliseconds, Microseconds, None". Clients are free to add any other custom units.
    - `dimensions` Dimensions, required — Dimensions are tags/labels associated with the events.

## Response `202`

Successfully accepted to process all the events from payload.

- IngestEventResponse
  - `success` boolean
  - `statusCode` integer
  - `name` string
  - `message` string
  - `code` string
  - `details` object

## Other responses

- `207` — Partial failure. Few events from request were not accepted
- `400` — Bad request. Please check the response message for failure details.
- `401` — Credential "x-api-key" is not valid. Please check the response message for failure details.
- `422` — Unable to process the events as the size of the event payload is above the supported limit. Please check our docs for the api limits - https://togai.com/docs/limits.
- `429` — Request throttled. Please check the response message on the failure details.
- `503` — Service is currently unavailable to process the request.
- `default` — Error response

## Changes

- **2024-05-14** `d078d3562056` — 1 info
  - the `events/items/dimensions/additionalProperties/` request property's maxLength was increased from `50` to `200`
- **2024-03-01** `6fb940b0dad9` — 5 warning, 2 info
  - removed the optional property `code` from the response with the `400` status
  - removed the optional property `details` from the response with the `400` status
  - removed the optional property `name` from the response with the `400` status
  - removed the optional property `statusCode` from the response with the `400` status
  - …3 more
- **2023-09-25** `ae3b70608528` — 1 breaking
  - the `events/items/attributes` request property type/format changed from ``/`` to `array`/``
- **2023-09-02** `6b13f6f47735` — 4 breaking, 5 info
  - the request property `events/items/id` became required
  - the `events/items/dimensions/additionalProperties/` request property's maxLength was decreased to `50`
  - the `events/items/attributes` request property type/format changed from `array`/`` to ``/``
  - the response property `message` became optional for the status `400`
  - …5 more

[Change history](https://skmtc.dev/togaihq/apis/togai-apis/changes/ingestBatch/post.md)

---

[API](https://skmtc.dev/togaihq/apis/togai-apis.md) · [All operations](https://skmtc.dev/togaihq/apis/togai-apis/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/togaihq/togai-apis/revisions/442f5d8f4aa0/schema)
