Reference
API reference
Every public endpoint. All of them take your API key as a bearer token.
Base URL: https://api.lancelot.watch
Authorization: Bearer lc_live_...Keys are made in Settings → Integrations → API keys. Each key belongs to one product. A product's test environment gets lc_test_ keys, and its data stays separate. A missing or wrong key returns 401 {"error": "invalid_api_key"}.
Send usage
POST /api/v1/events
Up to 500 events and 1 MB per request. Returns 202 {"accepted": n, "unpriced_models": [...]}. Fields and examples are on the HTTP API page.
| Status | Error |
|---|---|
| 400 | invalid_json, or invalid_events with an issues list |
| 413 | payload_too_large |
| 429 | rate_limited |
Get flags
GET /api/v1/flags?customer_id=cus_123
The fixes in force for one customer. The SDK calls this for you.
{
"customer_id": "cus_123",
"throttled": true,
"paused": false,
"throttle_cpm": 10,
"downgrade": { "from_model": "claude-sonnet-5-5", "to_model": "claude-haiku-5-5" }
}Without customer_id, it returns every customer with a fix in force, as {"flags": [...], "policy": {...}}. policy carries your emergency stop limits and budgets. Responses can be cached for 30 seconds. Without an active plan or trial, every customer gets empty flags.
Report a stop
POST /api/v1/signals
The SDK reports here when its emergency stop trips or a customer hits a budget, so Lancelot can notify you. You rarely call it yourself.
{ "signals": [{ "kind": "runaway", "customer_id": "cus_123", "at": "2026-11-25T14:02:11Z", "detail": { "calls": 812 } }] }1 to 20 signals; kind is runaway or budget; detail holds up to 20 short values. Returns 202 {"recorded": n, "skipped": n}. A repeat while the same problem is still open is skipped.
Erase a customer
DELETE /api/v1/customers/{customer_id}
Replaces one customer's ID, email and name with a pseudonym, for example from your own account-deletion flow. Costs and revenue stay, so your totals don't change. Calls that arrive later under the same ID start a new customer.
{ "erased": true, "pseudonym": "..." }404 unknown_customer if there's no such customer. Up to 300 erasures an hour per key.
Connect Stripe
GET /api/v1/stripe/connection returns {"connected": true, "connection": {...}}. It never returns the key.
POST /api/v1/stripe/connection with {"restricted_key": "rk_live_..."} makes the first connection. Replacing or removing a connection needs an owner signed in to the dashboard, so a leaked API key can't redirect your revenue.
Sync Stripe
POST /api/v1/stripe/sync
Syncs now instead of waiting for the nightly run, and returns the sync summary. At most once every five minutes: sooner returns 429 too_soon. 404 stripe_not_connected if Stripe isn't connected.
Import traces
POST https://app.lancelot.watch/api/v1/otlp/v1/traces
OpenTelemetry traces over HTTP, JSON encoding. See OpenRouter and OpenTelemetry.