Skip to content

HTTP API ​

The browser SDK uses this endpoint, and you can call it directly from your server. See Sending from your server for a complete example.

Request ​

  • URL: https://<ingest-host>/v1/batch
  • Body: JSON, sent as Content-Type: text/plain from browsers (avoids a CORS preflight; the server parses JSON either way). Max 64 KB.
  • Auth:
    • Browser: public site key in the body (key). The request's Origin must be on the key's allowlist. sendBeacon can't set headers, which is why the key is in the body.
    • Server-to-server: Authorization: Bearer <secret key>; key omitted; no origin check.
json
{
  "key": "pk_live_abc123",
  "sdk": { "name": "vectelle-js", "version": "0.1.0" },
  "sent_at": "2026-12-04T15:30:05.120Z",
  "context": {
    "anonymous_id": "a_7f3k9x2m4q1z8w0e",
    "user_id": null,
    "session_id": "s_q81mz0r5t2y7u4i9",
    "page": {
      "url": "https://client.com/watch/88",
      "path": "/watch/88",
      "title": "Episode 3",
      "referrer": "https://google.com/"
    },
    "utm": { "source": "newsletter" },
    "screen": { "w": 1440, "h": 900 },
    "locale": "en-US",
    "timezone": "America/Chicago",
    "consent": "granted"
  },
  "super": { "exp.checkout_v2": "B" },
  "events": [
    {
      "event_id": "01JEX4MP7EQ2V3K4M5N6P7R8ST",
      "name": "item_viewed",
      "ts": "2026-12-04T15:30:01.004Z",
      "properties": { "item_id": "vid_88", "item_type": "video" }
    }
  ]
}
FieldNotes
contextSent once per batch; copied onto every stored event. The SDK only batches events whose context and super properties are identical.
event_idClient-generated ULID (Crockford base32, 26 chars). Retries reuse it; storage deduplicates on it.
ts / sent_atServer corrects clock skew: stored_ts = ts + (received_at − sent_at).
User agent, IPTaken from the request, never the body. The IP is not stored.

Limits ​

ItemLimit
Body64 KB
Events per batch1–100
Event name^[a-z][a-z0-9_]{0,63}$
Properties8 KB serialized, 100 keys, nesting depth 3
Event ageCorrected ts older than 7 days is rejected; more than 60 s in the future is clamped to receive time
Super properties50 keys, scalar values

Responses ​

StatusBodyClient should
202{"accepted": n, "rejected": [{"index": i, "reason": "..."}]}Remove the batch (rejected events won't succeed on retry)
400{"error": "invalid_json" | "invalid_batch" | "empty_body", "issues"?: [...]}Drop
401{"error": "invalid_site_key" | "invalid_secret_key"}Drop, stop sending
403{"error": "origin_not_allowed"}Drop, stop sending
413{"error": "body_too_large"}Split the batch and resend
429{"error": "rate_limited"} + Retry-AfterRetry after the delay
503{"error": "buffer_full" | "buffer_unavailable"} + Retry-AfterRetry with backoff

Rejection reasons: invalid_event, invalid_name, invalid_event_id, invalid_ts, too_old, properties_too_large, properties_too_many_keys, properties_too_deep, duplicate_in_batch.