API reference
Every route the Trell API exposes, in one place. Browsers talk to the ingestion routes with a publishable key; your servers talk to the management routes with a secret key.
Base URL
All routes below live at https://trepi.relake.co. The tracking SDK is served from https://trepi.relake.co/sdk/trell.js and the health probe at GET /health returns { ok: true }.
Authentication
Publishable key (pk_…) — ships in public pages. Send it as Authorization: Bearer pk_…. For navigator.sendBeacon, which cannot set headers, append ?key=pk_… instead. Requests are checked against the project domain allowlist.
Secret key (sk_…) — server-to-server only, header-only, and never accepted from the browser. Use it for analytics, funnels, views and server-side ingestion. It skips the origin check because servers send no Origin.
Admin key — a single server secret (TRELL_ADMIN_KEY) used only to bootstrap projects via POST /v1/projects.
The secret shows only once
Conventions
Success responses return JSON directly — ingestion answers 202 with { inserted, duplicates }. Failures share one envelope:
missing_api_key401No Authorization header was sent.
invalid_api_key401The key is unknown or revoked.
origin_not_allowed403The page origin is not in the project domain allowlist.
limit_reached403The workspace event quota is exhausted (Free 5,000 / Pro 50,000).
invalid_event400An event payload failed validation.
batch_too_large413The batch exceeds the maximum event count.
payload_too_large413The request body exceeds the size limit.
rate_limited429Too many requests — honor the Retry-After header.
Ingestion is rate-limited per project and IP, and workspaces are metered at 5,000 events on Free and 50,000 on Pro. Exceeding either returns 429 or 403 limit_reached respectively.
Ingestion
Accepts a single event object or an array (batch). Each event carries event_id, type, ts, visitor/session ids, page context, device context and optional form data. The seven types are documented in Events.
POST/v1/ingestpk or skIngest one event or a batch. Answers 202 with inserted and duplicate counts; duplicates are deduped by event_id.
POST/v1/eventspk or skAlias of /v1/ingest — same payload, same auth, same response.
Projects
POST/v1/projectsadminBootstrap a project: body { name, slug?, organizationName?, domains? }. Answers 201 with the project and its { pk, sk } pair — the sk is shown exactly once.
Analytics
All analytics routes take the project id in the path and accept the standard filters — from, to, type, form, page, device, browser, os and UTM filters — plus an optional segment. The stats route also accepts compareFrom / compareTo for period-over-period deltas.
GET/v1/projects/:id/statsskKPI metrics for the range, with optional comparison metrics for the compare range.
GET/v1/projects/:id/seriesskTime series buckets. Query interval=hour|day|week|month (default day).
GET/v1/projects/:id/breakdownskTop-N breakdown by dimension=page|utm_source|device|browser|os (default page). Query limit caps rows (default 25).
GET/v1/projects/:id/formsskPer-form rollups backing the dashboard form table.
GET/v1/projects/:id/eventsskPaginated raw event log with the standard filters — the same data the dashboard exports to CSV.
GET/v1/projects/:id/funnel-liveskLive view→start→submit→success funnel for the selected range.
GET/v1/projects/:id/realtimeskMost recent activity snapshot for realtime panels.
Funnels
Funnels are built from ordered event-type steps. Create and edit them with CRUD, then run funnel-compute over any range to get step-to-step conversion and drop-off.
GET/v1/projects/:id/funnelsskList saved funnels.
POST/v1/projects/:id/funnelsskCreate a funnel from an ordered step list.
GET/v1/projects/:id/funnels/:fidskFetch one funnel definition.
PATCH/v1/projects/:id/funnels/:fidskUpdate a funnel definition.
DELETE/v1/projects/:id/funnels/:fidskDelete a funnel.
POST/v1/projects/:id/funnel-computeskCompute conversion over a range for ad-hoc or saved step lists.
Saved views
GET/v1/projects/:id/viewsskList saved dashboard views.
POST/v1/projects/:id/viewsskSave the current filter set as a named view.
DELETE/v1/projects/:id/views/:vidskDelete a saved view.
Prefer clicking over curl? Every route above is exercised by the dashboard relay documented in Routes.
MCP server
AI assistants talk to Trell through a separate host: https://mcp.relake.co — not https://trepi.relake.co, which serves only the REST API above. It speaks Streamable HTTP, authenticates with a Bearer service key or OAuth, and exposes 28 tools for reading stats, managing funnels, webhooks, domains and keys.
Full endpoint, auth, scope and tool reference lives on its own page: MCP server.