Batch Events

POST https://api.oursprivacy.com/api/v1/batch is the public batch companion to POST /track.

Use POST /track when you are sending one event at a time. Use POST /batch when you need fewer network round-trips for server-side backfills, replays, or high-volume event sends.

Availability posture: /batch is designed mainly for replay, backfill, and other higher-volume sends, so it may have different operational characteristics than single-event POST /track.

When you send a batch, review the response results array row by row.

  • 200 means every row was accepted, and results will contain one successful entry per input row.
  • 207 means some rows succeeded and some did not. Retry only the rows where results[index].success is false, after fixing validation issues or isolating the rows that hit queue transport errors.
  • 400, 401, 413, and 415 are request-level failures. No rows were accepted, so fix the request and resend it.
  • 500 means the request hit a transient failure before any row was confirmed accepted, or every accepted row failed queue transport. If results is present, retry only those failed rows using the same distinctId values. If results is absent, retry the full request with the same distinctId values.
POST
/batch
*object
array<object>

Request Body

application/json

A token plus an array of /track-compatible events.

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 "https://api.oursprivacy.com/api/v1/batch" \  -H "Content-Type: application/json" \  -d '{    "token": "string",    "events": [      {        "event": "string",        "distinctId": "string"      }    ]  }'
{
  "success": true,
  "accepted": 0,
  "failed": 0,
  "results": [
    {
      "index": 0,
      "success": true
    }
  ]
}
{
  "success": true,
  "accepted": 0,
  "failed": 0,
  "results": [
    {
      "index": 0,
      "success": true
    }
  ]
}
{
  "success": false,
  "error": "string"
}
{
  "success": false,
  "error": "string"
}
{
  "success": false,
  "error": "string",
  "limit": 0
}
{
  "success": false,
  "error": "string"
}
{
  "success": false,
  "error": "string",
  "retryable": true,
  "results": [
    {
      "index": 0,
      "success": false,
      "code": "invalid_event",
      "message": "string"
    }
  ]
}

How is this guide?