Create Events Batch
const url = 'https://example.com/users/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/events/batch';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"events":[{"boolean_value":true,"category_id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","category_name":"example","category_slug":"example","client_id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","duration":"example","local_date":"2026-04-15","metadata":{},"notes":"example","occurred_at":"2026-04-15T12:00:00Z","scalar_value":1,"tags":["example"]}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/users/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/events/batch \ --header 'Content-Type: application/json' \ --data '{ "events": [ { "boolean_value": true, "category_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "category_name": "example", "category_slug": "example", "client_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "duration": "example", "local_date": "2026-04-15", "metadata": {}, "notes": "example", "occurred_at": "2026-04-15T12:00:00Z", "scalar_value": 1, "tags": [ "example" ] } ] }'Bulk-create events in one request (capped at MAX_BATCH_EVENTS). Each item targets a
category by category_id (owned) or by category_slug (auto-created as a freeform system
category, like the Home Assistant ingest does). Idempotent on client_id — items whose key
already exists, in the DB or earlier in the same batch, are skipped rather than duplicated.
This is the general path that lets push integrations / scripts submit many events without a
request per event or pre-provisioned categories — no integration-scoped endpoint required.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
One event in a batch create. Identify the category by category_id (must exist and be owned)
OR by category_slug (auto-created as a freeform system category if it doesn’t exist yet — so a
push integration can send events without pre-provisioning categories). Exactly one of the two is
required. Sealed-content fields (saved_meal_id, encrypted_payload) are intentionally left
out — batch create targets ordinary/integration events, not the interactive meal/e2e flows.
object
object
Examplegenerated
{ "events": [ { "boolean_value": true, "category_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "category_name": "example", "category_slug": "example", "client_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "duration": "example", "local_date": "2026-04-15", "metadata": {}, "notes": "example", "occurred_at": "2026-04-15T12:00:00Z", "scalar_value": 1, "tags": [ "example" ] } ]}Responses
Section titled “Responses”Successful Response
Created = newly inserted events; skipped = items whose client_id already existed (idempotent replay), deduped both within the batch and against stored rows.
object
object
object
Example
{ "created": [ { "source": "user" } ]}Validation Error
object
object
Examplegenerated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ]}