Skip to content
Panel

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

NameInTypeRequiredDescription
afterquerystringnoEvent id to read after (digits only). 0 or omitted = from the oldest event still kept.
limitqueryintegernoPage size, 1 to 500. Defaults to 100.
typesquerystringnoComma-separated filter, up to 30 entries: an exact type (key.created), a family (key.*) or *.

Request

bash
curl -sS "https://mcp.mot3r.com/v1/events?after=0&limit=100&types=key.*" \
  -H "Authorization: Bearer mot_lk_live_xxxxxxxxxxxx"

Response 200

JSON
{
  "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"
}
NameTypeDescription
data[].idstringEvent number. Increases over time; use it as the cursor.
data[].typestringEvent type, <family>.<name>.
data[].line_iduuid or nullThe tunnel the event belongs to; null for an account-wide event.
data[].dataobjectPayload of the event.
next_afterstringCursor for the next call.
has_morebooleantrue 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

JSON
{"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

NameInTypeRequiredDescription
Last-Event-IDheaderstringnoId of the last event received. Takes precedence over after. Sent automatically by browser EventSource on reconnect.
afterquerystringnoEvent id to resume after (digits only). Omit both cursors to stream from now.
typesquerystringnoComma-separated filter, same syntax as on GET /v1/events.

Request

bash
curl -sS -N https://mcp.mot3r.com/v1/events/stream \
  -H "Authorization: Bearer mot_lk_live_xxxxxxxxxxxx" \
  -H "Last-Event-ID: 48213"

Response 200

text
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.000Z

Stream behaviour:

  • Each event is one frame: id is the event number, event is the type, data is the whole event as JSON (same shape as in GET /v1/events).
  • The stream opens with retry: 3000 (reconnect after 3 seconds) and a comment line. A : ping comment 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: reconnect and data: {"reason":"max_duration"}; reconnect with Last-Event-ID to continue without gaps or duplicates.
  • If the key is revoked while the stream is open, the stream ends with event: error and data: {"status":401,"reason":"key_revoked"}. A cursor that falls behind retention while streaming ends it with event: error and a cursor_expired payload carrying resume_after.
  • A cursor that is already behind retention when you connect is refused before the stream opens, with the same 410 cursor_expired JSON error as GET /v1/events. Resume with after=<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_streams with a Retry-After: 30 header.

Error 429

JSON
{"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):

JSON
{"error":{"status":401,"reason":"missing_credential","message":"Unauthorized — send Authorization: Bearer <tunnel key>."}}