Skip to content
Console
Menu

Getting Started

Authentication

KV Store

Batch an analytics event

Records a batch of events.

Records a batch of events. Each event is judged alone: a bad event is reported in results and the rest are stored. A duplicate event_id (in this or an earlier batch) is counted once. The response is sent only after the store holds the accepted events.

Not available yet. Sylphx Analytics is declared in the registry but no backend serves it: every call answers 501 with the problem code UNIMPLEMENTED.

  • Path POST https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/analytics_events:batch
  • Scope analytics:ingest
  • Effect write — a successful call changes state.
  • Collection analytics_events
  • Publishable key callable

#Request

FieldTypeWhat it is
parentstringThe parent the method acts in. Required.
eventsEventInput[]The events, 1 to 500. Required.
sent_timetimestampWhen the sender built the batch, on its clock. When it differs from the receive time by more than 10 minutes, every event time is shifted by the difference.
consentAnalyticsConsentThe app's current analytics consent; events are stored only when GRANTED. A publishable-key batch that is not GRANTED has every event rejected consent_not_granted (still 200, nothing stored). A secret-key batch with UNSPECIFIED counts as granted (the tenant's server attests); DENIED is always refused. One of granted, denied.

#EventInput

FieldTypeWhat it is
event_idstringA UUID made by the sender when the event happens (UUIDv7 recommended). It is the deduplication key: a resend, in any batch, is counted once. Required.
namestringThe event name: 1 to 128 characters of A-Za-z0-9_.:/-; a leading $ is reserved for the platform. Required.
timestamptimestampWhen it happened, on the sender's clock. Older than 31 days is refused too_old; more than 10 minutes ahead is stored as the receive time. Required.
anon_idstringThe device- or install-scoped id; required. Required.
user_idstringThe signed-in end user, when known. When present it, not anon_id, is the subject that stats and retention count.
session_idstringThe SDK session, when there is one.
propertiesstructFree properties, at most 8 KiB encoded, nesting depth 4.
contextEventContextThe sender's context.

#EventContext

FieldTypeWhat it is
sdk_namestringThe SDK, for example @sylphx/sdk.
sdk_versionstringThe SDK version.
platformstringweb, ios, android, unity, server,...
app_versionstringThe app's own version.
localestringA BCP 47 locale, for example zh-HK.
experimentsmap<string, string>The experiments the subject is in when the event happens: experiment key to variant key, at most 20 entries.

#Response

FieldTypeWhat it is
resultsEventResult[]One result per event, in the order sent.
accepted_countint32Events stored by this call.
duplicate_countint32Events already held.
rejected_countint32Events refused.

#EventResult

FieldTypeWhat it is
event_idstringThe event id as sent (empty when it was missing).
statusEventStatusWhat became of it. One of accepted, duplicate, rejected.
reasonstringFor a rejection: invalid:<field> (the JSON name of the field that is wrong, for example invalid:anon_id), too_old, too_large, name_reserved, or consent_not_granted.

#Errors

Every error arrives in the body Errors describes.

#Examples

curl -X POST "https://api.sylphx.com/v1/orgs/acme/projects/shop/envs/production/analytics_events:batch" \
  -H "Authorization: Bearer $SYLPHX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"events":[{"anon_id":"…","event_id":"…","name":"…","timestamp":{}}]}'