/batch/Accepts an application/json object with a non-empty batch array.
Browser requests from allowed origins can omit api_key. Backend or
no-origin requests require a valid api_key from PUBLIC_API_KEYS.
Unknown top-level and event-level fields are accepted but ignored
unless they are inside properties. Events missing event or a
distinct ID are dropped and counted in the response instead of failing
the whole request. A distinct ID may be sent as distinct_id,
properties.distinct_id, or properties.$distinct_id.
Request compression is supported only with Content-Encoding: gzip.
Other encodings and the compression query parameter are rejected.
Header Parameters
Browser origin. When present, it must exactly match ALLOWED_ORIGINS.
uriOptional gzip request compression. Omit the header for uncompressed JSON.
"gzip"Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://127.0.0.1:8080/batch/" \ -H "Content-Type: application/json" \ -d '{ "api_key": "local_dev_key", "batch": [ { "event": "backend_job_completed", "distinct_id": "user_123", "properties": { "job_id": "job_456", "duration_ms": 481 } } ] }'{
"status": "ok",
"ingested": 1,
"dropped": 0
}{
"status": "error",
"error": "Payload must be a JSON object with a non-empty batch array"
}{
"status": "error",
"error": "Invalid api_key"
}{
"status": "error",
"error": "Origin is not allowed"
}{
"status": "error",
"error": "Batch has 10001 events, maximum is 10000"
}{
"status": "error",
"error": "Unsupported content type. Use application/json."
}{
"status": "error",
"error": "string"
}