Skip to content

Ingest API

The Swift and Android SDKs and the web tracker speak this API for you. Use it directly to write an SDK for another platform, or to send events from a server.

Base URL: https://e.millimetry.app.

For native apps: a batch of events from one device.

Header Required Notes
Content-Type: application/json yes
Content-Encoding: gzip recommended Uncompressed bodies are accepted too
X-App-Key yes The app’s public key, ak_…
X-Batch-Id yes A UUID you create when you form the batch, reused on every retry of it
{
"sdk": "kotlin@0.1.0",
"system": {
"os_name": "Android",
"os_version": "16",
"device_model": "Pixel 10",
"locale": "en-CA",
"app_version": "1.5.0",
"app_build": "42",
"is_debug": false
},
"events": [
{
"name": "screen_view",
"ts": "2026-10-05T17:03:12.345Z",
"session_id": "0199b3c2-5f1e-7a10-9c3d-2b8e4f6a1d22",
"props": { "screen": "home", "items": 3, "premium": true }
}
]
}
  • system describes the device once per batch. Start a new batch when any of it changes, for example after an app update.
  • session_id is a UUID (version 7 preferred) you create at the start of a session and keep in memory only. End a session after 30 minutes in the background or without events.
  • Never send an identifier for the device or the person. The server derives the daily visitor ID itself.
Response Meaning What your SDK does
200 {"accepted": n, "dropped": m} Stored, or this batch ID was already stored Delete the batch
200 {"accepted": 0, "dropped": n, "reason": "over_quota"} The organization’s monthly limit is used up Delete the batch
200 {"accepted": 0, "dropped": n, "reason": "paused"} The app is paused in the dashboard Delete the batch
400 Malformed body or invalid system Delete the batch; it will never succeed
401 Unknown key Delete the batch
413 Body too large Split the batch and retry
429 with Retry-After Rate limited Keep the batch; retry after the delay
503, possibly with Retry-After Temporarily unavailable, or this batch ID is still being stored Keep the batch; retry with exponential backoff

Because the batch ID is reused across retries, a batch is stored once however many times it arrives.

For websites: one event per request, sent as JSON with Content-Type: text/plain. That keeps it a simple CORS request, with no preflight, and lets navigator.sendBeacon send it.

{ "k": "wk_…", "n": "pageview", "u": "https://example.com/pricing?utm_source=newsletter", "r": "https://www.google.com/", "w": 1440, "p": { "plan": "pro" } }
Field Meaning
k The site’s key, wk_…
n Event name (pageview for page views)
u The page URL
r document.referrer (optional)
w screen.width (optional)
p Properties (optional)
a 1 when navigator.webdriver is true (optional). The event is recorded as an automated browser under AI agents, never as a visitor

A request whose user-agent names an AI agent, or that carries a: 1, is stored as an agent request rather than a visitor’s event. Other bots are answered 202 and dropped.

The request’s Origin must be one of the site’s origins. The answer is 202 with an empty body, 400 for a malformed event, 403 for an unknown key or origin, and 429 when rate limited. Trackers do not retry.

AI agents’ requests, reported server to server by the edge Worker or the middleware. They are stored apart from events, so they never count as visitors.

Header Required Notes
Content-Type: application/json yes
Content-Encoding: gzip no Uncompressed bodies are accepted too
X-Forwarding-Secret yes The app’s or site’s fs_… secret. Never send it from a browser or an app
{
"k": "wk_…",
"debug": false,
"skip": ["crawler"],
"events": [
{
"ts": "2026-10-08T17:03:12.345Z",
"via": "server",
"agent": "ChatGPT",
"verified": true,
"channel": "mcp",
"protocol": "mcp",
"action": "search_products",
"status": 200,
"scope": "read",
"principal": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8",
"ms": 84
}
]
}
Field Meaning
k The app’s or site’s key, ak_… or wk_…
debug Send to the Debug view (optional)
skip Kinds not to keep: crawler, automation (optional)
events[].ts ISO 8601; now when absent. The same 7-day and 10-minute rules as events
events[].via server (your API or MCP server, the default) or edge (a Worker that sees every request; only requests Millimetry recognises as AI agents are kept)
events[].agent The agent’s name as your server knows it: an OAuth client, an MCP client. Well-known names are folded together, and a known OAuth Client ID Metadata Document URL names its client (Claude, Claude Code, ChatGPT). Any other URL, and a value shaped like an identifier, is not a name
events[].ua, events[].signature_agent The agent’s user-agent and Signature-Agent header, read to name it and dropped
events[].verified Your server verified the agent (it signed in), or Cloudflare verified the bot
events[].channel web, api, mcp or agent (your own agent). Defaults to api from a server and web from the edge
events[].protocol pap, mcp, oauth, a2a, …: at most 16 lowercase characters
events[].url A page or endpoint URL; only the host and path are kept
events[].action What was done when there is no URL: a tool name, orders.create, GET /orders/:id. At most 256 characters
events[].status The HTTP status the agent got
events[].outcome ok, error, denied, or missing (the agent asked for a tool, endpoint or page you don’t offer: listed apart, never a failure); from status when absent (2xx and 3xx ok, 401 and 403 denied, other 4xx and 5xx errors)
events[].scope read or write: the access the person granted
events[].principal Who the agent acts for, opaque (send a hash, never an email address). Hashed again with the day’s salt and dropped
events[].ms How long the request took

In paths and actions, long numbers, UUIDs, hex strings, tokens and email addresses become :id. Unknown fields are ignored.

Response Meaning
200 {"accepted": n, "dropped": m} Stored; dropped counts malformed events, events too old, and edge requests that were not AI agents
200 {"accepted": 0, "dropped": n, "reason": "over_quota"} or "paused" As for batches
400 Malformed body, or not 1–100 events
401 Unknown key, or a missing or wrong forwarding secret
413 Body over 256 KB after decompression
429 with Retry-After Rate limited
503 Temporarily unavailable

Reports are not deduplicated, so clients should not retry: the middleware and the Worker send each report once. Every stored agent request counts as one event toward the plan.

The runs of a loops entry (the agents, routines and scripts you run; see Add it to your loops). Runs are stored like an app’s events: the run is the session, the loop the user, the runtime the platform, the step the screen.

Header Required Notes
Content-Type: application/json yes
Content-Encoding: gzip no Uncompressed bodies are accepted too
{
"k": "lk_…",
"loop": "nightly-review",
"runtime": "claude-code",
"version": "3",
"batch": "0199b3c2-5f1e-7a10-9c3d-2b8e4f6a1d22",
"events": [
{ "name": "run_started", "run": "0199b3c2-5f1e-7a10-9c3d-2b8e4f6a1d33", "trigger": "schedule", "model": "claude-opus-5-5" },
{ "name": "step", "run": "0199b3c2-5f1e-7a10-9c3d-2b8e4f6a1d33", "step": "read-prs", "ms": 1200, "props": { "prs": 3 } },
{ "name": "run_finished", "run": "0199b3c2-5f1e-7a10-9c3d-2b8e4f6a1d33", "outcome": "ok", "ms": 90000 }
]
}
Field Meaning
k The loops entry’s key, lk_…
loop The loop’s name, 1 to 64 characters, nothing personal in it; stored as the loop property of every event
runtime claude-code, codex, cursor, openclaw, n8n, zapier, workers, cron or other (the default); an unknown one refuses the batch
version, sdk, debug The loop’s version; what reported it; the Debug view (optional)
batch A UUID (optional): the same id sent again answers the stored counts and inserts nothing, so a retry is safe
events[].name run_started, step, run_finished, or any event name (not pageview)
events[].run The run’s UUID: the session
events[].ts ISO 8601; now when absent. The same 7-day and 10-minute rules as batches
events[].step At most 64 characters; stored as the screen property
events[].outcome ok, failed, skipped, needs_action; another value drops the event
events[].trigger schedule, event, manual; another value drops the event
events[].model At most 64 characters
events[].ms A duration; stored as the duration_ms number property
events[].props Your own properties, as for batches (the keys loop, screen, outcome, trigger, model and duration_ms are the endpoint’s)

No address is read beyond the rate limit: the user id is the loop’s name under the day’s salt, and country, region and every device column stay empty.

Response Meaning
200 {"accepted": n, "dropped": m} Stored; dropped counts events outside the rules
200 {"accepted": 0, "dropped": n, "reason": "over_quota"} or "paused" As for batches
400 Malformed body, not 1–100 events, a bad loop name, an unknown runtime, or a batch that is not a UUID
401 Not a loops key
413 Body over 512 KB after decompression
429 with Retry-After Rate limited
503 with Retry-After Temporarily unavailable, or this batch is being stored right now: send it again
Item Rule
Events per batch 1–100
Body at most 512 KB after decompression
Event name 1–64 characters, no control characters; names starting with $ are reserved
Event time ISO 8601 in UTC. Up to 10 minutes in the future is treated as now; anything later, or older than 7 days, is dropped
Properties at most 25; keys 1–64 characters; strings cut at 256 characters; finite numbers; Booleans; null, arrays and objects are dropped
Personal data properties named like personal data, and values that look like an email, a phone number or a UUID, are dropped
  • Per client address: 10 batch requests a second (bursts of 20), or 30 web events a second (bursts of 60).
  • Per key: in proportion to your plan, averaged over a minute, and at least 50 events a second.

GET /healthz answers 200 while the service is up.