HTTP API
Base URL: https://app.erised.run. Every endpoint takes and returns JSON.
Authentication
Send the key as a bearer token: Authorization: Bearer <key>.
| Key | Use | Allowed |
|---|---|---|
Publishable pk_live_… |
Browsers | page, track, unverified identify. Every event needs an anonymousId. Responses carry CORS headers. |
Secret sk_live_… |
Your servers only | Everything, including verified identify and alias. No CORS headers: a browser cannot read the response. |
A browser that cannot set headers (sendBeacon) may put the publishable key in the body as writeKey.
Endpoints
| Endpoint | Body |
|---|---|
POST /v1/batch |
{ "batch": [event, …] } or a JSON array of events, each with its type |
POST /v1/track |
One event; type is track |
POST /v1/page |
One event; type is page |
POST /v1/identify |
One event; type is identify |
POST /v1/alias |
One event; type is alias (secret key only) |
POST /v1/error |
One error; type is error. See Error reporting. |
/v1/consent and /v1/consent/config are used by the browser SDK's consent banner; you do not call them yourself.
The event
| Field | Required | Notes |
|---|---|---|
type |
on /v1/batch |
page, track, identify, alias or error |
name (or event) |
for track |
The event name. Event names are at most 200 characters. |
anonymousId |
with pk_ keys |
The browser's id, from the erised_anonymous_id cookie on the server |
userId |
at least one of the two ids | Your stable user id |
messageId |
recommended on servers | Makes a retry safe: a messageId already stored for the site is skipped. Without one, Erised generates one, so a retried request is stored twice. |
timestamp |
no | ISO 8601. Defaults to when Erised received the event; never later than that. |
sentAt |
no | ISO 8601. When the client sent it; Erised corrects timestamp for the client's clock. |
sessionId |
no | |
properties |
no | A JSON object; properties up to 32 KB per event |
context |
no | A JSON object; context up to 32 KB per event. See below. |
Ids (anonymousId, userId, messageId, sessionId) are at most 256 characters.
Context fields Erised reads on server events
| Field | Used for |
|---|---|
context.ip |
The visitor's country. Used for the lookup only: removed before the event is stored. |
context.userAgent |
Browser, OS and device class |
context.os.name, context.device.type |
OS and device class when there is no user agent, e.g. apps |
context.app.version, context.app.build |
App versions on the person's profile |
context.page.url, .path, .referrer |
Pages, referrers and UTM parameters |
Everything else in context is stored as sent and visible in the live feed.
POST /v1/identify
From your server, with the secret key, at signup and every login:
{
"userId": "u_123",
"anonymousId": "0b6f…",
"properties": {
"email": "ada@example.com",
"traits": { "plan": "growth", "company": "Acme" }
}
}
properties.email becomes the person's verified email; properties.traits are merged onto the profile (latest value wins per key). See Identity for exactly when two histories are joined.
POST /v1/alias
Links two anonymous ids of the same browser, for example after a move between two domains. Secret key only. anonymousId is the current id and userId carries the previous anonymous id; neither creates a known user.
Limits
- At most 100 events per request, and 500 KB per request.
- Requests are rate-limited per key and per site; a limited request stores nothing.
- Each plan has a monthly event limit (with a grace margin); past it, requests are refused with
quota_exceeded.
Responses
A request Erised accepts is answered 202:
{ "received": 2, "duplicates": 1, "rejected": [{ "index": 3, "issues": [{ "path": "name", "code": "missing_name", "message": "…" }] }] }
On /v1/batch each event is checked on its own: valid events are stored, invalid ones are listed in rejected and nothing else is lost. received + duplicates + rejected.length equals the number of events sent. On the single-event endpoints an invalid event is a 400 (validation_failed) and nothing is stored.
Errors
Errors look like { "error": { "code": "…", "message": "…" } }.
| Status | code |
Meaning |
|---|---|---|
| 400 | invalid_json, invalid_body, invalid_batch, empty_batch, batch_too_large |
The request is malformed |
| 400 | validation_failed |
A single-event request whose event is invalid (details in errors) |
| 401 | unauthorized |
Missing, unknown or revoked key |
| 403 | account_suspended, account_deleted |
The organization cannot send events |
| 413 | payload_too_large |
Over 500 KB per request |
| 429 | rate_limited |
Too many requests; wait for Retry-After seconds |
| 429 | quota_exceeded |
The plan's monthly limit is reached; retrying will not help (no Retry-After) |
Per-event issue codes include missing_anonymous_id (a pk_ event without one), missing_id (no id at all), missing_name (a track without a name), forbidden_for_key (alias with a pk_ key), unverified_claim (a pk_ identify claiming verified) and type_mismatch (a type that contradicts the endpoint), missing_error (an error without message or stack), invalid_error_field (an error field of the wrong type), and rate_limited on an error event past the site's error burst.