Skip to main content
One endpoint, POST /v0/events, takes website (web), game (app) and server (server) events. A batch is either all server events or has no server events.

Browser events

The Web SDK calls this endpoint for you. A batch has 1 to 50 events. For game builds with channel: 'app' and context.app, see app events.

Event fields

Checks

  • X-Publishable-Key must be the publishable key of a project. A secret key or an API key in this header gets 401.
  • Send no Authorization header.
  • A browser Origin must be the project domain or one of its subdomains. A request with no Origin (for example from a server proxy) is allowed; the page URL check still applies.
  • Unknown fields are rejected.

The session ID contract

Reports count sessions from the session_id of each event. So a website or game event must follow three rules:
  • An event with an anonymous_id has a session_id.
  • The session_id is not the anonymous_id. Make a new ID for each session: start a new session after 30 minutes without events, and when the session is 24 hours old.
  • An event before consent has no anonymous_id and no session_id. It is accepted and stored, and it is in no session.
A batch with an event that breaks a rule gets 400 INVALID_EVENT, and no event of the batch is accepted. The response lists each refused event (at most 50) with its position in the batch, its message_id and a reason code:
Do not send a refused batch again without a change: it is refused again. The SDKs drop it and log the reason. The contract does not apply to server events: a server event with no session_id is valid.

Responses

Server events

Send the secret key from your backend only. A batch has 1 to 100 events, and the body is at most 256 KB. See server events for setup and examples.

Server event fields

Unknown fields are rejected. The collector does not use the request IP or the request user agent for server events.

Server event checks

  • Authorization: Bearer must be the secret key of a project. Send no X-Publishable-Key header.
  • The request must not have an Origin header.
  • Every event in the batch has channel: 'server'.

Server event responses

Example

See errors for every code, and idempotency for safe retries.