{"openapi":"3.0.3","info":{"title":"Route11 Control Plane API","version":"1.0.0","description":"Complete Route11 HTTP surface: ingest, targets, logs, replay, DLQ, organizations, API keys, transforms dry-run, target health probes, metrics, and live events. Organization API keys (`r11_live_...`) are scoped to `organization_id`. Platform admins may send `X-Route11-Org-Id`."},"servers":[{"url":"http://route11.dev","description":"Route11 API"}],"tags":[{"name":"System","description":"Health, readiness, OpenAPI"},{"name":"Ingestion","description":"Public webhook ingest (signature-verified per target)"},{"name":"Messages","description":"Send your own events to your destinations"},{"name":"Targets","description":"Destinations, health probes, retry configuration"},{"name":"Transforms","description":"Sandboxed JavaScript dry-run"},{"name":"Logs","description":"Delivery history, export, and replay"},{"name":"DLQ","description":"Dead letter queue list, replay, and purge"},{"name":"Organizations","description":"Tenants, API keys, alerts"},{"name":"Observability","description":"Metrics, SSE, tunnels"}],"paths":{"/health":{"get":{"tags":["System"],"summary":"Liveness","security":[],"responses":{"200":{"description":"Process is up"}}}},"/metrics":{"get":{"tags":["Observability"],"summary":"Prometheus metrics","description":"Text exposition of per-process ingress, dispatch, queue depth, and dispatch latency. Scrape each replica; counters reset with the process. When ROUTE11_MULTI_TENANT=true this route requires the platform admin key.","security":[],"responses":{"200":{"description":"Prometheus text format"},"401":{"description":"Platform admin key required in hosted mode"}}}},"/ready":{"get":{"tags":["System"],"summary":"Readiness","security":[],"responses":{"200":{"description":"Supabase, Redis, and queues are ready"},"503":{"description":"A dependency is down"}}}},"/openapi.json":{"get":{"tags":["System"],"summary":"OpenAPI 3.0.3 specification","security":[],"responses":{"200":{"description":"This document"}}}},"/dashboard":{"get":{"tags":["System"],"summary":"Control plane UI","security":[],"responses":{"200":{"description":"HTML dashboard"}}}},"/api/v1/ingest/{targetId}":{"post":{"tags":["Ingestion"],"summary":"Ingest a webhook for a target","security":[],"parameters":[{"name":"targetId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Target UUID"},{"name":"stripe-signature","in":"header","schema":{"type":"string"}},{"name":"x-hub-signature-256","in":"header","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"responses":{"202":{"description":"Queued or filtered"},"401":{"description":"Invalid inbound signature"},"404":{"description":"Target not found"},"429":{"description":"Ingest rate limited"}}}},"/api/webhooks/{targetId}":{"post":{"tags":["Ingestion"],"summary":"Legacy ingest alias","security":[],"parameters":[{"name":"targetId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Target UUID"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"202":{"description":"Queued"}}}},"/webhook/{targetId}":{"post":{"tags":["Ingestion"],"summary":"Short ingest alias","security":[],"parameters":[{"name":"targetId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Target UUID"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"202":{"description":"Queued"}}}},"/api/v1/billing/checkout":{"get":{"tags":["Organizations"],"summary":"How this organization pays","description":"Card checkout is not connected. Returns available: false and method invoice_email until a processor is wired.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"responses":{"200":{"description":"{ available, provider, method }"}}}},"/api/v1/messages":{"post":{"tags":["Messages"],"summary":"Send an event to your destinations","description":"Stores a log row then delivers JSON `{ type, event_type, data, message_id }` to each enabled destination, signed the Standard Webhooks way. Pass Idempotency-Key to retry the same HTTP call without a second delivery. Optional target_ids limits the fan-out. Same 202-after-store path as ingest.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event_type","payload"],"properties":{"event_type":{"type":"string","example":"invoice.paid"},"payload":{"type":"object"},"target_ids":{"type":"array","items":{"type":"string","format":"uuid"}}}}}}},"responses":{"202":{"description":"Queued: message_id, destinations, results[]"},"400":{"description":"Missing event_type or payload"},"403":{"description":"Write permission required"},"404":{"description":"A named destination is not in this organization"}}}},"/api/v1/egress-ips":{"get":{"tags":["System"],"summary":"Public egress addresses","description":"IP addresses Route11 uses for outbound deliveries. Allow these on the shop firewall. Empty when ROUTE11_EGRESS_IPS is unset.","responses":{"200":{"description":"{ ips: string[] }","content":{"application/json":{"schema":{"type":"object","properties":{"ips":{"type":"array","items":{"type":"string"}}}}}}}}}},"/api/v1/targets":{"get":{"tags":["Targets"],"summary":"List targets","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"responses":{"200":{"description":"Target list","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"url":{"type":"string","format":"uri"},"verification_preset":{"type":"string","enum":["none","stripe","github","shopify","razorpay","cashfree","phonepe","payu","juspay","easebuzz","paytm","generic_hmac"]},"max_retries":{"type":"integer"},"max_requests_per_minute":{"type":"integer","description":"Per-target token bucket. Omit or 0 for unlimited."},"retry_strategy":{"type":"string","enum":["exponential","linear","fixed"]},"base_delay_ms":{"type":"integer"},"has_signing_secret":{"type":"boolean"},"disabled":{"type":"boolean","description":"When true, signed ingest returns 409 target_disabled."},"event_allowlist":{"type":"array","items":{"type":"string"},"description":"Named provider events to forward. Empty means all events."},"dedupe_field":{"type":"string","nullable":true,"maxLength":200,"description":"Dot path of a payload field. A repeat of its value inside the window is answered 202 duplicate and not delivered. Empty means no field dedupe."},"dedupe_window_hours":{"type":"integer","nullable":true,"minimum":1,"maximum":72,"description":"How long a dedupe_field value is remembered. Default 24."},"health_score":{"type":"integer","minimum":0,"maximum":100},"health_label":{"type":"string","enum":["healthy","watch","sick","paused","quiet"]},"created_at":{"type":"string","format":"date-time"}}}}}}}}},"post":{"tags":["Targets"],"summary":"Create a target","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","url"],"properties":{"name":{"type":"string"},"url":{"type":"string","format":"uri"},"verificationType":{"type":"string"},"verification_preset":{"type":"string"},"signingSecret":{"type":"string"},"signing_secret":{"type":"string"},"outbound_secret":{"type":"string","description":"Leave out to have Route11 generate one (whsec_...), returned once in the answer"},"retryConfig":{"type":"object"}}}}}},"responses":{"200":{"description":"Created target. Includes outbound_secret and outbound_secret_generated: true only when Route11 generated the secret; it is never shown again."}}}},"/api/v1/targets/{id}":{"put":{"tags":["Targets"],"summary":"Update a target","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Target id"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"Updated"},"404":{"description":"Not found"}}},"delete":{"tags":["Targets"],"summary":"Delete a destination","description":"Admin only. Refuses with 409 while a delivery is pending, retrying, dispatching, or paused, unless force=true. Removes the cached target config, closes tunnels, and publishes the delete so both API colors drop their copy. Webhook logs and receipts stay. Organization delete still erases logs and receipts.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Target id"},{"name":"force","in":"query","schema":{"type":"boolean"},"description":"Delete even when deliveries are still pending"}],"responses":{"200":{"description":"Deleted"},"403":{"description":"Not an admin"},"404":{"description":"Not found"},"409":{"description":"Deliveries are still pending"}}}},"/api/v1/targets/{id}/outbound-secret":{"post":{"tags":["Targets"],"summary":"Replace the outbound secret","description":"Generates a new outbound secret (whsec_...) and returns it once. X-Route11-Signature uses the new secret immediately. webhook-signature is signed with both the new and previous secrets (space-separated Standard Webhooks v1 parts) so the shop can rotate without dropping payments.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Target id"}],"responses":{"200":{"description":"{ id, outbound_secret }"},"404":{"description":"Target not found"}}}},"/api/v1/targets/{id}/replay-window":{"post":{"tags":["Logs"],"summary":"Replay deliveries in a time window","description":"Replays up to 200 events for this destination whose ingest time falls in [since, until]. Default window is the last 24 hours. The window cannot be longer than 72 hours. Each replay keeps the original webhook-id.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Target id"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"since":{"type":"string","format":"date-time"},"until":{"type":"string","format":"date-time"}}}}}},"responses":{"200":{"description":"{ since, until, scanned, replayed, duplicates, errors, items }"},"400":{"description":"Window invalid or longer than 72 hours"},"404":{"description":"Target not found"}}}},"/api/v1/targets/{id}/health":{"post":{"tags":["Targets"],"summary":"Probe downstream target health","description":"POSTs a small Route11 health probe to the stored destination URL only (not a caller-supplied URL).","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Target id"}],"responses":{"200":{"description":"Probe result including latency and diagnosis"},"404":{"description":"Target not found"}}}},"/api/v1/targets/{id}/test-event":{"post":{"tags":["Targets"],"summary":"Send a test payment","description":"Sends a realistic test payment for Razorpay or Cashfree, marked route11_test and signed as that provider would sign it with the destination secret, to the destination's own Route11 address. It takes the full path (signature check, durable store, delivery, receipt). Test payments are not counted as usage. Up to 6 a minute per destination.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Target id"}],"responses":{"202":{"description":"Accepted by Route11: event, payment_id, log_id"},"400":{"description":"Not a Razorpay or Cashfree destination, or no webhook secret"},"404":{"description":"Target not found"},"429":{"description":"Too many test payments for this destination"}}}},"/api/v1/targets/{id}/fulfilment":{"get":{"tags":["Targets"],"summary":"Read the fulfilment check for a destination","description":"The saved check address and settings, counts of check results for the last 30 days by state (waiting, redelivered, fulfilled, fulfilled_after_redelivery, not_fulfilled, unreachable), and the 20 newest problems.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Target id"}],"responses":{"200":{"description":"{ setting, last_30_days, problems }"},"404":{"description":"Destination not found"}}},"put":{"tags":["Targets"],"summary":"Turn on or change the fulfilment check","description":"After each delivered successful Razorpay or Cashfree payment, Route11 waits grace_seconds, then GETs url with {payment_id} (and {order_id}) filled in, signed with X-Route11-Signature over \"GET <path and query>\". The app answers 200 {\"status\":\"fulfilled\"} or {\"status\":\"pending\"}. A no delivers the webhook again (unless redeliver is false), two more checks follow, then an alert.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Target id"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"url":{"type":"string","description":"Public https address containing {payment_id}"},"grace_seconds":{"type":"integer","minimum":60,"maximum":86400,"default":600},"redeliver":{"type":"boolean","default":true},"enabled":{"type":"boolean","default":true}}}}}},"responses":{"200":{"description":"{ setting }"},"400":{"description":"Invalid address or settings"},"404":{"description":"Destination not found"}}},"delete":{"tags":["Targets"],"summary":"Turn off the fulfilment check","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Target id"}],"responses":{"200":{"description":"{ removed: true }"},"404":{"description":"Destination not found"}}}},"/api/v1/targets/{id}/fulfilment/test":{"post":{"tags":["Targets"],"summary":"Ask the fulfilment check once, now","description":"Body { payment_id, url? }. Sends one signed GET and returns what the app answered and what Route11 would do with that answer.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Target id"}],"responses":{"200":{"description":"{ url, signed, signed_string, result, status, answer, meaning }"},"400":{"description":"Missing payment_id or address"}}}},"/api/v1/me/two-factor":{"get":{"tags":["Organizations"],"summary":"Two-factor sign-in status for the signed-in person","description":"Needs an email sign-in key (it belongs to a person). { enabled, enabled_at, recovery_codes_left, org_requires, setup_only }.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"responses":{"200":{"description":"Status"},"400":{"description":"The key does not belong to a person"}}}},"/api/v1/me/two-factor/setup":{"post":{"tags":["Organizations"],"summary":"Start two-factor setup: returns the setup key and an otpauth:// link","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"responses":{"200":{"description":"{ secret_display, otpauth_uri }"},"409":{"description":"Already on"},"503":{"description":"Not available on this server"}}}},"/api/v1/me/two-factor/enable":{"post":{"tags":["Organizations"],"summary":"Turn two-factor sign-in on with a code from the app; returns 10 recovery codes once","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"responses":{"200":{"description":"{ recovery_codes } (+ key after a setup-only session)"},"400":{"description":"Wrong or expired code"}}}},"/api/v1/me/two-factor/disable":{"post":{"tags":["Organizations"],"summary":"Turn two-factor sign-in off (needs a current code)","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"responses":{"200":{"description":"{ enabled: false }"},"409":{"description":"An organization requires it"}}}},"/api/v1/me/two-factor/recovery-codes":{"post":{"tags":["Organizations"],"summary":"Replace the recovery codes (needs a current code)","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"responses":{"200":{"description":"{ recovery_codes }"}}}},"/api/v1/auth/two-factor":{"post":{"tags":["Organizations"],"summary":"Finish an email sign-in with a 6-digit code or a recovery code","description":"Body { challenge, code }. The challenge comes from /api/v1/auth/verify when two_factor_required is true. Five tries, ten minutes.","responses":{"200":{"description":"The dashboard key"},"401":{"description":"Wrong code"},"410":{"description":"Expired, used, or too many tries"}}}},"/api/v1/org/two-factor":{"put":{"tags":["Organizations"],"summary":"Require two-factor sign-in for everyone in the organization (owners and admins)","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"responses":{"200":{"description":"{ required }"},"409":{"description":"Turn it on for yourself first"}}}},"/api/v1/money-report":{"get":{"tags":["Organizations"],"summary":"Money Route11 saved in one month, in paise","description":"month=YYYY-MM (India time; default this month). saved, rescued (delivered after a retry), recovered (found at the provider and sent), caught_after_ok (recorded only after the fulfilment check redelivered), found_not_sent, not_fulfilled and duplicates_held. Only successful payments count.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"responses":{"200":{"description":"The money report"},"400":{"description":"Bad or future month"}}}},"/api/v1/targets/{id}/reconcile":{"get":{"tags":["Targets"],"summary":"Read Razorpay and Cashfree reconciliation for a destination","description":"Returns the masked key id for each linked provider, whether reconciliation is switched on, and the last 20 runs. source is the Razorpay row. sources lists every provider. Amounts are in paise.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Target id"}],"responses":{"200":{"description":"{ available, source, runs }"},"404":{"description":"Destination not found"}}},"put":{"tags":["Targets"],"summary":"Save a Razorpay or Cashfree key for reconciliation","description":"provider defaults to razorpay. auto_send, enabled, and sandbox must be JSON booleans. The secret is stored encrypted and is never returned. Cashfree sandbox selects the sandbox host.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Target id"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string","enum":["razorpay","cashfree"]},"key_id":{"type":"string"},"key_secret":{"type":"string"},"auto_send":{"type":"boolean"},"enabled":{"type":"boolean"},"sandbox":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Saved source, with the key id masked"},"400":{"description":"Key or boolean field rejected"},"404":{"description":"Destination not found"}}},"delete":{"tags":["Targets"],"summary":"Remove one reconciliation key from a destination","description":"Query provider defaults to razorpay. Pass provider=cashfree to remove only the Cashfree key.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Target id"}],"responses":{"200":{"description":"{ removed: true }"},"404":{"description":"Destination not found"}}}},"/api/v1/targets/{id}/reconcile/run":{"post":{"tags":["Targets"],"summary":"Compare captured payments with what Route11 received","description":"provider defaults to razorpay. Send {\"send\": true} to deliver each missing payment once. Omit send to report only. Cashfree compares PG Reconciliation rows older than the report lag.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Target id"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"send":{"type":"boolean"},"hours":{"type":"number","minimum":1,"maximum":168},"provider":{"type":"string","enum":["razorpay","cashfree"]}}}}}},"responses":{"200":{"description":"The run, including missing_items (amount in paise) and missing_amounts by currency"},"404":{"description":"Destination or Razorpay key not found"},"409":{"description":"A check is already running"},"502":{"description":"Razorpay or the comparison failed"}}}},"/api/v1/targets/{id}/pulse":{"get":{"tags":["Targets"],"summary":"Live checkout rate versus the usual hour","description":"Razorpay and Cashfree destinations only. usual is the median of up to four complete weeks, weighted by how much of the last 30 minutes falls in each hour. Asia/Kolkata.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Target id"}],"responses":{"200":{"description":"{ applicable, actual, usual, window_minutes, level, snoozed_until }"},"404":{"description":"Destination not found"}}}},"/api/v1/targets/{id}/pulse/snooze":{"post":{"tags":["Targets"],"summary":"Snooze checkout drop alerts","description":"Write permission. hours is an integer from 1 to 72. Drop alerts are held until snoozed_until.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Target id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["hours"],"properties":{"hours":{"type":"integer","minimum":1,"maximum":72}}}}}},"responses":{"200":{"description":"{ snoozed_until, hours }"},"400":{"description":"hours was rejected"},"403":{"description":"Write permission required"},"404":{"description":"Destination not found"}}},"delete":{"tags":["Targets"],"summary":"Cancel a checkout snooze","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Target id"}],"responses":{"200":{"description":"{ snoozed_until: null }"},"403":{"description":"Write permission required"},"404":{"description":"Destination not found"}}}},"/api/v1/targets/{id}/completeness":{"get":{"tags":["Targets"],"summary":"Monthly payment completeness and a signed summary","description":"month=YYYY-MM. The summary is canonical JSON signed with the receipts key, version route11-completeness-v1, including days_covered and generated_at.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Target id"},{"name":"month","in":"query","required":true,"schema":{"type":"string","example":"2026-10"}}],"responses":{"200":{"description":"{ month, days, summary }"},"400":{"description":"month must be YYYY-MM"},"404":{"description":"Destination not found"}}}},"/api/v1/targets/{id}/apply-patch":{"post":{"tags":["Targets"],"summary":"Apply a reviewed schema patch and replay","description":"Validates the transform in the existing sandbox, saves it on the target, and replays the failed log through the idempotent replay path. Does not apply a patch automatically.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Target id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["log_id"],"properties":{"log_id":{"type":"string"},"script":{"type":"string"}}}}}},"responses":{"200":{"description":"Patch saved and replay queued"},"400":{"description":"Patch failed sandbox validation"},"404":{"description":"Target or log not found"}}}},"/api/v1/transforms/dry-run":{"post":{"tags":["Transforms"],"summary":"Dry-run a sandboxed JS transform","description":"Executes transform_rules in a worker_thread+vm sandbox (trusted single-tenant scripts, not a multi-tenant security boundary). Caps timeout/heap; isolate crashes fail closed. Does not enqueue delivery.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"script":{"type":"string"},"transform_rules":{"type":"string"},"payload":{},"headers":{"type":"object"},"target_id":{"type":"string","format":"uuid"}}}}}},"responses":{"200":{"description":"Transformed payload, drop flag, console lines, or sandbox error"}}}},"/api/v1/payments":{"get":{"tags":["Logs"],"summary":"One row per payment","description":"Folds the newest 2000 webhook logs into one payment per provider and payment id. A retry to the same destination stays one destination. A second destination is counted apart. The body fields are the payment fact: no email, phone, or VPA. outcome filters to captured, failed, refunded, or paid.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"outcome","in":"query","schema":{"type":"string","enum":["captured","failed","refunded","paid"]}},{"name":"time_range","in":"query","schema":{"type":"string","enum":["15m","1h","24h","7d"]}},{"name":"targetId","in":"query","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"{ payments: [{ provider, outcome, payment_id, order_id, amount_paise, state, label, log_id }], truncated }. truncated is true when the newest 2,000 logs filled the scan and older payments are absent."}}}},"/api/v1/logs":{"get":{"tags":["Logs"],"summary":"Query webhook logs","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0}},{"name":"paginated","in":"query","schema":{"type":"string","enum":["1"]},"description":"Return { items, limit, offset, next_offset } instead of a bare array"},{"name":"status","in":"query","schema":{"type":"string","enum":["delivered","failed","dlq","pending","retrying"]}},{"name":"time_range","in":"query","schema":{"type":"string","enum":["15m","1h","24h","7d"]}},{"name":"search","in":"query","schema":{"type":"string"},"description":"Case-insensitive match in payload, headers, or response body"},{"name":"targetId","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"target_id","in":"query","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Logs. A bare array unless paginated=1 or offset is set."}}}},"/api/v1/logs/export":{"get":{"tags":["Logs"],"summary":"Export logs as CSV or JSON","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"format","in":"query","schema":{"type":"string","enum":["csv","json"]}}],"responses":{"200":{"description":"Download"}}}},"/api/v1/logs/{logId}/attempts":{"get":{"tags":["Logs"],"summary":"List delivery attempts for one event","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"logId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Log id"}],"responses":{"200":{"description":"Attempts for this delivery and any replay of the same event"},"404":{"description":"Not found"}}}},"/api/v1/logs/{logId}/replay":{"post":{"tags":["Logs"],"summary":"Replay a webhook log","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"logId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Log id"}],"responses":{"200":{"description":"Queued"},"404":{"description":"Not found"}}}},"/api/v1/issues":{"get":{"tags":["Issues"],"summary":"List open and acknowledged destination issues","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"responses":{"200":{"description":"Issues for the authenticated organization"}}}},"/api/v1/issues/{id}/acknowledge":{"post":{"tags":["Issues"],"summary":"Acknowledge a destination issue","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Issue id"}],"responses":{"200":{"description":"Acknowledged"},"404":{"description":"Not found"}}}},"/api/v1/issues/{id}/resume":{"post":{"tags":["Issues"],"summary":"Resolve an issue and clear the circuit breaker","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Issue id"}],"responses":{"200":{"description":"Destination resumed"},"404":{"description":"Not found"}}}},"/api/v1/issues/{id}/replay":{"post":{"tags":["Issues"],"summary":"Replay dead-letter deliveries for a destination issue","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Issue id"}],"responses":{"200":{"description":"Replay queued through the shared replay path"},"404":{"description":"Not found"}}}},"/api/v1/dlq":{"get":{"tags":["DLQ"],"summary":"List dead letter items","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"responses":{"200":{"description":"DLQ items for the authenticated organization"}}}},"/api/v1/dlq/{dlqId}/replay":{"post":{"tags":["DLQ"],"summary":"Replay a single DLQ item","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"dlqId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Webhook log id in the DLQ"}],"responses":{"200":{"description":"Replay result"}}}},"/api/v1/dlq/replay":{"post":{"tags":["DLQ"],"summary":"Replay selected DLQ items","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string","format":"uuid"}}}}}}},"responses":{"200":{"description":"Bulk replay result"}}}},"/api/v1/dlq/replay-all":{"post":{"tags":["DLQ"],"summary":"Replay every DLQ item in the organization","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"responses":{"200":{"description":"Bulk replay result"}}}},"/api/v1/dlq/purge":{"post":{"tags":["DLQ"],"summary":"Purge the organization DLQ","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"responses":{"200":{"description":"Purge result"}}}},"/api/v1/usage":{"get":{"tags":["Organizations"],"summary":"This month's events against the organization's plan","description":"Counts webhooks accepted for the organization this month (Indian time). Retries, replays and rejected signatures are not counted. Nothing is ever blocked when a plan is used up.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"responses":{"200":{"description":"plan, plan_name, month, events, payment_events, included_events, used_pct, over_by, extra_cost_inr, retention_days, destinations { used, included }, upgrade_url"}}}},"/api/v1/session":{"get":{"tags":["Organizations"],"summary":"Current auth session and organization","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"responses":{"200":{"description":"Session payload. Email sign-in also returns user and memberships."}}}},"/api/v1/audit":{"get":{"tags":["Organizations"],"summary":"Recent team activity for this organization","description":"Invites, joins, role changes, removals, sign-ins, and organization switches. Tokens and API keys are not stored.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"responses":{"200":{"description":"{ events: [{ id, actor_email, action, detail, created_at }] }"}}}},"/api/v1/members":{"get":{"tags":["Organizations"],"summary":"People on this organization and invitations that have not been accepted","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"responses":{"200":{"description":"{ members: [{ user_id, email, role, created_at }], invites: [{ id, email, role, expires_at, created_at }] }. No invite token is returned."}}}},"/api/v1/members/invite":{"post":{"tags":["Organizations"],"summary":"Invite a person by email (admin permission)","description":"Sends one email. The link token is not included in this response. An admin cannot grant the owner role.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["email","role"],"properties":{"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["owner","admin","developer","viewer"]}}}}}},"responses":{"201":{"description":"Invitation stored"},"403":{"description":"Forbidden"},"409":{"description":"Already on the team"},"503":{"description":"Email is not set up"}}}},"/api/v1/members/accept":{"post":{"tags":["Organizations"],"summary":"Accept an invitation from the email link","security":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["token"],"properties":{"token":{"type":"string"}}}}}},"responses":{"200":{"description":"Short-lived dashboard key for the organization"},"410":{"description":"Expired or already used"}}}},"/api/v1/members/{user_id}":{"patch":{"tags":["Organizations"],"summary":"Change a teammate role (admin permission)","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["role"],"properties":{"role":{"type":"string","enum":["owner","admin","developer","viewer"]}}}}}},"responses":{"200":{"description":"Updated"},"409":{"description":"Would leave the organization with no owner"}}},"delete":{"tags":["Organizations"],"summary":"Remove a teammate (admin permission)","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Removed"},"409":{"description":"Would leave the organization with no owner"}}}},"/api/v1/session/switch":{"post":{"tags":["Organizations"],"summary":"Sign the current person into another organization they belong to","description":"Returns a new short-lived dashboard key for that organization. Refuses the switch when the key is not tied to a person, or the person has no membership there. The key is shown once in this response and is not written to the activity log.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["org_id"],"properties":{"org_id":{"type":"string","format":"uuid"}}}}}},"responses":{"200":{"description":"key, expires_at, org, permissions"},"403":{"description":"Not a member, or this key cannot switch"}}}},"/api/v1/organizations":{"get":{"tags":["Organizations"],"summary":"List organizations visible to the caller","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"responses":{"200":{"description":"Organization list"}}},"post":{"tags":["Organizations"],"summary":"Create an organization (platform admin)","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"owner_email":{"type":"string","format":"email"},"plan":{"type":"string","enum":["pilot","free","paid"]}}}}}},"responses":{"200":{"description":"Created"},"403":{"description":"Forbidden"},"409":{"description":"Owner email already used"}}}},"/api/v1/auth/email-link":{"post":{"tags":["Sign-up"],"summary":"Email a one-time sign-up or sign-in link (always 202, so it never shows whether an address has an account)","security":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"},"company":{"type":"string","description":"Given on sign-up"}}}}}},"responses":{"202":{"description":"Accepted"},"400":{"description":"Invalid email or company"},"429":{"description":"Too many requests"},"503":{"description":"Email is not set up on this server"}}}},"/api/v1/auth/verify":{"post":{"tags":["Sign-up"],"summary":"Use a link once: creates a free-plan organization on sign-up, and returns a dashboard key that expires after 12 hours","security":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["token"],"properties":{"token":{"type":"string"}}}}}},"responses":{"200":{"description":"Signed in; key, expires_at, created, org"},"400":{"description":"Malformed token"},"410":{"description":"Expired or already used"}}}},"/api/v1/organizations/{id}":{"patch":{"tags":["Organizations"],"summary":"Update organization settings","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Organization id"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"alert_webhook_url":{"type":"string","format":"uri"}}}}}},"responses":{"200":{"description":"Updated"},"403":{"description":"Outside tenant boundary"}}}},"/api/v1/api-keys":{"get":{"tags":["Organizations"],"summary":"List organization API keys","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"responses":{"200":{"description":"Key metadata (secrets are never listed)"}}},"post":{"tags":["Organizations"],"summary":"Create an organization API key","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"permissions":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"Created key (plaintext shown once)"}}}},"/api/v1/api-keys/{id}":{"delete":{"tags":["Organizations"],"summary":"Revoke an API key","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"API key id"}],"responses":{"200":{"description":"Revoked"},"404":{"description":"Not found"}}}},"/api/v1/metrics":{"get":{"tags":["Observability"],"summary":"Organization delivery metrics","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"responses":{"200":{"description":"Rolling metrics"}}}},"/api/v1/events/ticket":{"post":{"tags":["Observability"],"summary":"Single-use ticket for the event stream","description":"Send the API key in a header; the answer is a ticket valid for 60 seconds and one connection. Browsers use it because EventSource cannot set headers.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"responses":{"200":{"description":"{ ticket, expires_in }"}}}},"/api/v1/events":{"get":{"tags":["Observability"],"summary":"Server-sent events for live log updates","description":"Authenticate with a header, or with ?ticket= from POST /api/v1/events/ticket. An API key in the query string is refused (401 query_key_refused) unless ROUTE11_ALLOW_QUERY_KEY=true.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"ticket","in":"query","schema":{"type":"string"},"description":"Single-use ticket from POST /api/v1/events/ticket"}],"responses":{"200":{"description":"text/event-stream"}}}},"/.well-known/route11-receipts-key":{"get":{"tags":["Receipts"],"summary":"Public keys for signed delivery-receipt tree heads","description":"No authentication. key_id is the lowercase hex SHA-256 of the SPKI DER. active is the key that signs new tree heads. Older keys remain so previously signed heads still verify.","security":[],"responses":{"200":{"description":"Ed25519 public keys"}}}},"/api/v1/receipts/sth":{"get":{"tags":["Receipts"],"summary":"Latest signed tree head for this organization","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"responses":{"200":{"description":"Signed tree head"},"404":{"description":"No signed tree head yet"},"503":{"description":"Receipts are not switched on"}}}},"/api/v1/receipts/consistency":{"get":{"tags":["Receipts"],"summary":"Consistency proof between two signed tree sizes","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"first","in":"query","required":true,"schema":{"type":"integer","minimum":1}},{"name":"second","in":"query","required":true,"schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"Consistency proof and the two signed heads"},"404":{"description":"No signed tree head at that size"},"409":{"description":"Stored leaves do not match the signed head"}}}},"/api/v1/receipts/{log_id}":{"get":{"tags":["Receipts"],"summary":"Receipt, leaf index, inclusion proof, and signed tree head","description":"Returns the latest leaf when one log has more than one final status. Pass status to select an earlier leaf.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"log_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Webhook log id"},{"name":"status","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Inclusion proof"},"404":{"description":"Receipt not found"},"409":{"description":"Stored leaves do not match the signed head"}}}},"/api/v1/tunnel/{targetId}":{"get":{"tags":["Observability"],"summary":"WebSocket tunnel for local forwarding","description":"Upgrade with an API key that has write permission, in x-api-key or Authorization: Bearer (platform admins add x-route11-org-id). A key in the query string is refused unless ROUTE11_ALLOW_QUERY_KEY=true. The CLI posts the local response back on the same socket.","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"parameters":[{"name":"targetId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Target to subscribe"}],"responses":{"426":{"description":"Upgrade Required"}}}},"/api/v1/debug/headers":{"get":{"tags":["Observability"],"summary":"Echo selected request headers for proxy debugging","security":[{"AdminKey":[]},{"BearerAuth":[]},{"ApiKey":[]}],"responses":{"200":{"description":"Header dump"}}}}},"components":{"securitySchemes":{"AdminKey":{"type":"apiKey","in":"header","name":"X-Route11-Admin-Key","description":"Platform admin key (`ROUTE11_ADMIN_KEY`) or hashed organization key (`r11_live_...`)."},"BearerAuth":{"type":"http","scheme":"bearer"},"ApiKey":{"type":"apiKey","in":"header","name":"X-Api-Key"},"OrgId":{"type":"apiKey","in":"header","name":"X-Route11-Org-Id","description":"Honored only for platform admins."}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"},"reason":{"type":"string"}}},"Target":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"url":{"type":"string","format":"uri"},"verification_preset":{"type":"string","enum":["none","stripe","github","shopify","razorpay","cashfree","phonepe","payu","juspay","easebuzz","paytm","generic_hmac"]},"max_retries":{"type":"integer"},"max_requests_per_minute":{"type":"integer","description":"Per-target token bucket. Omit or 0 for unlimited."},"retry_strategy":{"type":"string","enum":["exponential","linear","fixed"]},"base_delay_ms":{"type":"integer"},"has_signing_secret":{"type":"boolean"},"disabled":{"type":"boolean","description":"When true, signed ingest returns 409 target_disabled."},"event_allowlist":{"type":"array","items":{"type":"string"},"description":"Named provider events to forward. Empty means all events."},"dedupe_field":{"type":"string","nullable":true,"maxLength":200,"description":"Dot path of a payload field. A repeat of its value inside the window is answered 202 duplicate and not delivered. Empty means no field dedupe."},"dedupe_window_hours":{"type":"integer","nullable":true,"minimum":1,"maximum":72,"description":"How long a dedupe_field value is remembered. Default 24."},"health_score":{"type":"integer","minimum":0,"maximum":100},"health_label":{"type":"string","enum":["healthy","watch","sick","paused","quiet"]},"created_at":{"type":"string","format":"date-time"}}},"WebhookLog":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"target_id":{"type":"string","format":"uuid"},"target_name":{"type":"string"},"delivery_state":{"type":"string"},"diagnostic_tag":{"type":"string","nullable":true},"diagnosis":{"type":"object","nullable":true,"properties":{"title":{"type":"string"},"explanation":{"type":"string"},"healer":{"type":"string"}}},"ingest_id":{"type":"string"},"created_at":{"type":"string","format":"date-time"}}}}}}