API Reference Endpoints
Events
Read account and tunnel events from a cursor, or receive them live over Server-Sent Events.
Events record what happens on an account and its tunnels, for example a new key (key.created). Read them page by page from a cursor with GET /v1/events, or keep a Server-Sent Events stream open with GET /v1/events/stream. Both endpoints live on the MCP gateway at https://mcp.mot3r.com and need a tunnel key with the events:r scope or a test key; the root key does not work here. A key sees the events of its own tunnel plus the account-wide events, and events are kept for 30 days.
#List events
GET /v1/events
Returns events after a cursor, oldest first. Pass next_after from the previous page as after to continue; keep going while has_more is true.
Authentication: tunnel key with the events:r scope, or test key. The root key gets 401 root_key_not_allowed; observation and account agent keys get 403 key_kind_not_allowed.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
after | query | string | no | Event id to read after (digits only). 0 or omitted = from the oldest event still kept. |
limit | query | integer | no | Page size, 1 to 500. Defaults to 100. |
types | query | string | no | Comma-separated filter, up to 30 entries: an exact type (key.created), a family (key.*) or *. |
Request
curl -sS "https://mcp.mot3r.com/v1/events?after=0&limit=100&types=key.*" \
-H "Authorization: Bearer mot_lk_live_xxxxxxxxxxxx"Response 200
{
"data": [
{
"id": "48213",
"type": "key.created",
"created_at": "2026-10-16T15:40:00.000Z",
"line_id": "3f2b8c1e-7a4d-4e5b-9c6f-1d2e3a4b5c6d",
"data": {"key_id": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d", "kind": "line"}
}
],
"next_after": "48213",
"has_more": false,
"measured_at": "2026-10-16T15:41:12.000Z"
}| Name | Type | Description |
|---|---|---|
data[].id | string | Event number. Increases over time; use it as the cursor. |
data[].type | string | Event type, <family>.<name>. |
data[].line_id | uuid or null | The tunnel the event belongs to; null for an account-wide event. |
data[].data | object | Payload of the event. |
next_after | string | Cursor for the next call. |
has_more | boolean | true when the page was full and more events are waiting. |
When retention has already deleted events that this key would have received after the given cursor, the call fails with 410 cursor_expired instead of skipping them. The error carries resume_after: call again with after=<resume_after> to continue from the oldest event still kept.
Error 410
{"error":{"status":410,"reason":"cursor_expired","message":"Gone — events after this cursor were deleted by the 30-day retention. Resume from the oldest available event with after=51007, or reconnect without Last-Event-ID to stream from now.","resume_after":"51007","after":"48213","retention_days":30}}#Stream events
GET /v1/events/stream
Opens a Server-Sent Events stream (text/event-stream) that delivers new events as they happen. Without a cursor the stream starts from now; with Last-Event-ID or after it first replays everything after that event, then continues live.
Authentication: tunnel key with the events:r scope, or test key. The root key gets 401 root_key_not_allowed; observation and account agent keys get 403 key_kind_not_allowed.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Last-Event-ID | header | string | no | Id of the last event received. Takes precedence over after. Sent automatically by browser EventSource on reconnect. |
after | query | string | no | Event id to resume after (digits only). Omit both cursors to stream from now. |
types | query | string | no | Comma-separated filter, same syntax as on GET /v1/events. |
Request
curl -sS -N https://mcp.mot3r.com/v1/events/stream \
-H "Authorization: Bearer mot_lk_live_xxxxxxxxxxxx" \
-H "Last-Event-ID: 48213"Response 200
retry: 3000
id: 48214
event: key.created
data: {"id":"48214","type":"key.created","created_at":"2026-10-16T15:42:05.120Z","line_id":"3f2b8c1e-7a4d-4e5b-9c6f-1d2e3a4b5c6d","data":{"key_id":"5d4c3b2a-1f0e-4d9c-8b7a-6f5e4d3c2b1a","kind":"line"}}
: ping 2026-10-16T15:42:30.000ZStream behaviour:
- Each event is one frame:
idis the event number,eventis the type,datais the whole event as JSON (same shape as inGET /v1/events). - The stream opens with
retry: 3000(reconnect after 3 seconds) and a comment line. A: pingcomment follows every 25 seconds so proxies keep the connection open. - New events arrive within about a second; the stream also re-reads at least every 5 seconds.
- A connection lasts at most 1 hour. It then ends with
event: reconnectanddata: {"reason":"max_duration"}; reconnect withLast-Event-IDto continue without gaps or duplicates. - If the key is revoked while the stream is open, the stream ends with
event: erroranddata: {"status":401,"reason":"key_revoked"}. A cursor that falls behind retention while streaming ends it withevent: errorand acursor_expiredpayload carryingresume_after. - A cursor that is already behind retention when you connect is refused before the stream opens, with the same
410 cursor_expiredJSON error asGET /v1/events. Resume withafter=<resume_after>, or reconnect without a cursor to stream from now. - At most 5 streams can be open at the same time per key. A sixth gets
429 too_many_streamswith aRetry-After: 30header.
Error 429
{"error":{"status":429,"reason":"too_many_streams","message":"Too many requests — at most 5 open event streams per key.","retry_after_s":30}}Without a key, both endpoints answer 401 (see Errors):
{"error":{"status":401,"reason":"missing_credential","message":"Unauthorized — send Authorization: Bearer <tunnel key>."}}