Skip to content
Panel

API Reference Endpoints

Channels

Read the channel catalog, register channel accounts, wire them to tunnels, send and signal typing as a tunnel, and fetch files from incoming messages.

A channel account is one identity on a messaging channel, for example one Telegram bot. The account belongs to your mot account; a wiring connects it to a tunnel, so messages that reach the account land in that tunnel's inbox and the tunnel can answer through it. Account and wiring management uses the account root key. Sending, typing and file downloads act as the tunnel and use a tunnel key. Errors use the envelope described in Errors.

#List channel kinds

GET /v1/channels/kinds

Returns the catalog of channel kinds with their rules: direction, transport, outbound rule and thread window. Use it to learn which kinds you can register.

Authentication: none. The catalog holds no accounts and no secrets.

The catalog can also list unavailable kinds. Use only kinds whose status is live.

Parameters

This endpoint takes no parameters.

Request

bash
curl -sS https://api.mot3r.com/v1/channels/kinds

Response 200

JSON
{
  "kinds": [
    {
      "kind": "mot_email",
      "about": "The tunnel's own mailbox, <name>@mot.email. Mail from the open internet is data, not instructions. This kind receives mail; letters are sent with the mail endpoint.",
      "owner": "ext",
      "state": "live",
      "sealed": false,
      "meter_in": null,
      "out_rule": "none",
      "meter_out": null,
      "transport": "webhook",
      "directions": ["in"],
      "auth_scheme": "none",
      "thread_owner": "reply_header",
      "out_daily_max": null,
      "memory_default": "all",
      "thread_window_days": 30,
      "out_thread_hourly_max": null,
      "status": "live",
      "status_dot": "green",
      "status_word": "Works"
    },
    {
      "kind": "mot_fleet",
      "about": "Messages between the tunnels of one owner and from the owner, delivered inside mot. No credentials: mot creates the account.",
      "owner": "ours",
      "state": "live",
      "sealed": false,
      "meter_in": null,
      "out_rule": "free",
      "meter_out": null,
      "transport": "internal",
      "directions": ["in", "out"],
      "auth_scheme": "none",
      "thread_owner": "window",
      "out_daily_max": null,
      "memory_default": "all",
      "thread_window_days": 30,
      "out_thread_hourly_max": null,
      "status": "live",
      "status_dot": "green",
      "status_word": "Works"
    },
    {
      "kind": "ours_mirc",
      "about": "mIRC chat channels of the tunnel identity. Wire a channel in and the tunnel reads it; the owner can answer from D3CK as the tunnel in open channels the tunnel is a member of.",
      "owner": "ours",
      "state": "live",
      "sealed": false,
      "meter_in": null,
      "out_rule": "free",
      "meter_out": null,
      "transport": "internal",
      "directions": ["in", "out"],
      "auth_scheme": "none",
      "thread_owner": "window",
      "out_daily_max": null,
      "memory_default": "all",
      "thread_window_days": 30,
      "out_thread_hourly_max": null,
      "status": "live",
      "status_dot": "green",
      "status_word": "Works"
    },
    {
      "kind": "ours_murl",
      "about": "mURL rooms tied to a web domain, in the tunnel identity. Wire a room in as an inbound room and the tunnel reads it; sending into a room is not available.",
      "owner": "ours",
      "state": "live",
      "sealed": false,
      "meter_in": null,
      "out_rule": "free",
      "meter_out": null,
      "transport": "internal",
      "directions": ["in", "out"],
      "auth_scheme": "none",
      "thread_owner": "window",
      "out_daily_max": null,
      "memory_default": "all",
      "thread_window_days": 30,
      "out_thread_hourly_max": null,
      "status": "live",
      "status_dot": "green",
      "status_word": "Works"
    },
    {
      "kind": "telegram_bot",
      "about": "Telegram bot (Bot API); a bot cannot start a conversation",
      "owner": "ext",
      "state": "live",
      "sealed": false,
      "meter_in": null,
      "out_rule": "reply_only",
      "meter_out": null,
      "transport": "webhook",
      "directions": ["in", "out"],
      "auth_scheme": "bot_token",
      "thread_owner": "window",
      "out_daily_max": null,
      "memory_default": "all",
      "thread_window_days": 7,
      "out_thread_hourly_max": null,
      "status": "live",
      "status_dot": "green",
      "status_word": "Works"
    }
  ],
  "measured_at": "2026-10-16T15:38:35.726Z"
}
NameTypeDescription
kindstringKind identifier used in kind fields elsewhere in the API.
ownerstringours for mot's own channels, ext for third-party channels.
directionsstring[]in, out or both.
transportstringHow messages arrive: webhook, poll or internal.
out_rulestringOutbound rule. reply_only: the other side must write first in the thread. free: no restriction. none: the kind does not send.
thread_ownerstringHow a reply finds its tunnel: window (the tunnel that last wrote in the thread within thread_window_days) or reply_header (mail reply headers).
memory_defaultstringDefault memory policy of a new wiring: all, text_only or off.
sealedbooleantrue when content is end-to-end encrypted and never stored in readable form.
out_daily_maxinteger or nullOutbound messages per account per day, when the kind has a limit.
out_thread_hourly_maxinteger or nullOutbound messages per thread per hour, when the kind has a limit.
statusstringlive when the kind works in production.
status_dot, status_wordstringDisplay form of status.

Error 503

JSON
{"error":{"status":503,"reason":"unmeasured","message":"mot could not read this value. This is a failure on our side, not missing data."}}

#List channel accounts

GET /v1/channel-accounts

Lists channel accounts. A secret never comes back: you see has_secret and the last four characters in last4.

Authentication: root key or tunnel key. The root key sees every channel account of the account. A tunnel key sees the wirings of its own tunnel, in the wiring shape shown under Wire an account to a tunnel.

Parameters

This endpoint takes no parameters.

Request

bash
curl -sS https://api.mot3r.com/v1/channel-accounts \
  -H "Authorization: Bearer mot_lk_live_xxxxxxxxxxxx"

Response 200

JSON
{
  "rows": [
    {
      "account_id": "3f2b8c1e-7a4d-4e5b-9c6f-1d2e3a4b5c6d",
      "kind": "telegram_bot",
      "external_id": "7412345678",
      "label": "Support bot",
      "config": {},
      "last4": "x9Qk",
      "composio_account_id": null,
      "app_identity_id": null,
      "status": "active",
      "verified_at": "2026-10-14T09:15:22.104Z",
      "verified_by": "probe",
      "last_in_at": "2026-10-16T14:02:11.530Z",
      "last_out_at": "2026-10-16T14:02:40.918Z",
      "error_streak": 0,
      "last_error": null,
      "created_at": "2026-10-14T09:12:03.411Z",
      "has_secret": true
    }
  ],
  "measured_at": "2026-10-16T15:40:00.000Z"
}
NameTypeDescription
external_idstringIdentity of the account at the provider. For telegram_bot, the bot number.
configobjectNon-secret settings, at most 2000 bytes. allow_to (array of recipients) limits who the account may send to.
last4string or nullLast four characters of the stored secret.
statusstringpending, active, paused, error or revoked. A new or replaced secret puts the account in pending until a test passes.
verified_at, verified_bystring or nullWhen and how the account was last verified.
error_streakintegerConsecutive failures. Any value above 0 marks the account unhealthy.
last_errorstring or nullCode of the last failure.
has_secretbooleanWhether a secret is stored.

Error 401

JSON
{"error":{"status":401,"reason":"missing_credential","message":"Send a key as Authorization: Bearer <key>."}}

#Create or update a channel account

POST /v1/channel-accounts

Registers a channel account, or updates the one with the same kind and external_id. The secret is sealed on the server and never returned. For telegram_bot mot asks Telegram to confirm the token before it saves anything, marks the account active and registers the webhook. For the other kinds a new secret sets the account to pending; test the account to activate it.

Authentication: root key only.

For telegram_bot, pass the bot token from BotFather as secret. The bot number is read from the token, so external_id can be omitted; if you pass it, it must match the token.

Parameters

NameInTypeRequiredDescription
kindbodystringyesA live kind from the catalog that you register yourself, such as telegram_bot.
secretbodystringyes for telegram_botProvider secret. For telegram_bot, the bot token.
external_idbodystringnoIdentity at the provider, 1 to 200 characters.
labelbodystringnoYour name for the account, at most 80 characters.
configbodyobjectnoNon-secret settings, at most 2000 bytes. Secrets inside config are refused.

Request

bash
curl -sS -X POST https://api.mot3r.com/v1/channel-accounts \
  -H "Authorization: Bearer $MOT_ROOT_KEY" \
  -H "content-type: application/json" \
  -d '{"kind":"telegram_bot","secret":"7412345678:AAH-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","label":"Support bot"}'

Response 200

JSON
{
  "created": true,
  "account": {
    "account_id": "3f2b8c1e-7a4d-4e5b-9c6f-1d2e3a4b5c6d",
    "kind": "telegram_bot",
    "external_id": "7412345678",
    "label": "Support bot",
    "config": {},
    "last4": "xxxx",
    "composio_account_id": null,
    "app_identity_id": null,
    "status": "active",
    "verified_at": "2026-10-16T15:40:00.412Z",
    "verified_by": "probe",
    "last_in_at": null,
    "last_out_at": null,
    "error_streak": 0,
    "last_error": null,
    "created_at": "2026-10-16T15:40:00.000Z",
    "has_secret": true
  },
  "webhook_url": "https://api.mot3r.com/v1/wires/telegram/3f2b8c1e-7a4d-4e5b-9c6f-1d2e3a4b5c6d",
  "oauth_connect": null,
  "probe": {"ok": true, "error": null, "username": "support_bot"},
  "webhook_set": true,
  "measured_at": "2026-10-16T15:40:00.000Z"
}
NameTypeDescription
createdbooleantrue for a new account, false when an existing one was updated.
webhook_urlstring or nullAddress the provider delivers to. For telegram_bot mot registers it with Telegram when the account is created and again when the test passes.
probeobjecttelegram_bot only: the token check, {ok, error, username}. A token that Telegram refuses is rejected with 400 bot_token_rejected and no account is created.
webhook_setbooleantelegram_bot only: whether mot registered the webhook with Telegram. When it is false, webhook_error names the reason; run the test call to try again.

Error 400

JSON
{"error":{"status":400,"reason":"bad_bot_token","message":"Pass the Telegram bot token from BotFather as secret (digits, colon, token)."}}

#Test a channel account

POST /v1/channel-accounts/:id/test

Checks the account at the provider and records the result. For telegram_bot mot calls Telegram getMe with the stored token and expects the bot number of the account. On success the account becomes active and mot registers the webhook; on failure the account goes to error and error_streak grows.

Authentication: root key only. A tunnel key gets 403 key_kind_not_allowed.

Parameters

NameInTypeRequiredDescription
idpathuuidyesChannel account id.

Request

bash
curl -sS -X POST https://api.mot3r.com/v1/channel-accounts/3f2b8c1e-7a4d-4e5b-9c6f-1d2e3a4b5c6d/test \
  -H "Authorization: Bearer $MOT_ROOT_KEY"

Response 200

JSON
{
  "account": {
    "account_id": "3f2b8c1e-7a4d-4e5b-9c6f-1d2e3a4b5c6d",
    "kind": "telegram_bot",
    "external_id": "7412345678",
    "label": "Support bot",
    "config": {},
    "last4": "xxxx",
    "composio_account_id": null,
    "app_identity_id": null,
    "status": "active",
    "verified_at": "2026-10-16T15:41:02.220Z",
    "verified_by": "probe",
    "last_in_at": null,
    "last_out_at": null,
    "error_streak": 0,
    "last_error": null,
    "created_at": "2026-10-16T15:40:00.000Z",
    "has_secret": true
  },
  "probe": { "ok": true, "error": null, "username": "acme_support_bot" },
  "webhook_url": "https://api.mot3r.com/v1/wires/telegram/3f2b8c1e-7a4d-4e5b-9c6f-1d2e3a4b5c6d",
  "webhook_set": true,
  "measured_at": "2026-10-16T15:41:02.231Z"
}
NameTypeDescription
probe.okbooleanWhether the provider confirmed the account.
probe.errorstring or nullbot_token_rejected, bot_id_mismatch, not_a_bot or another provider code.
probe.usernamestring or nullBot username reported by Telegram.
webhook_setbooleanWhether the webhook was registered. A failed registration does not fail the test.
webhook_errorstringPresent only when the webhook registration failed.

Error 404

JSON
{"error":{"status":404,"reason":"account_not_found","message":"Account not found."}}

#Revoke a channel account

DELETE /v1/channel-accounts/:id

Revokes the account: the stored secret is deleted, every wiring of the account is switched off, and each wired tunnel gets a channel.unwired event. For telegram_bot mot also removes the webhook at Telegram. Registering the same account again with a new secret brings it back as pending.

Authentication: root key only.

Parameters

NameInTypeRequiredDescription
idpathuuidyesChannel account id.

Request

bash
curl -sS -X DELETE https://api.mot3r.com/v1/channel-accounts/3f2b8c1e-7a4d-4e5b-9c6f-1d2e3a4b5c6d \
  -H "Authorization: Bearer $MOT_ROOT_KEY"

Response 200

JSON
{
  "account": {
    "account_id": "3f2b8c1e-7a4d-4e5b-9c6f-1d2e3a4b5c6d",
    "kind": "telegram_bot",
    "external_id": "7412345678",
    "label": "Support bot",
    "config": {},
    "last4": null,
    "composio_account_id": null,
    "app_identity_id": null,
    "status": "revoked",
    "verified_at": "2026-10-16T15:41:02.220Z",
    "verified_by": "probe",
    "last_in_at": "2026-10-16T14:02:11.530Z",
    "last_out_at": "2026-10-16T14:02:40.918Z",
    "error_streak": 0,
    "last_error": null,
    "created_at": "2026-10-14T09:12:03.411Z",
    "has_secret": false
  },
  "measured_at": "2026-10-16T15:45:00.000Z"
}

Error 409

JSON
{"error":{"status":409,"reason":"ours_account_bound_to_line","message":"Ours account bound to line."}}

Accounts of mot's own channels (kinds starting with ours_) belong to a tunnel and cannot be revoked here.

#Wire an account to a tunnel

PUT /v1/lines/:id/wiring/:account_id

Connects a channel account to a tunnel, or changes an existing wiring. Inbound messages of an account go to one home tunnel. Only one wiring per channel kind can be the default outbound account of a tunnel; setting default_out clears it on the others.

Authentication: root key only.

Parameters

NameInTypeRequiredDescription
idpathuuidyesTunnel id.
account_idpathuuidyesChannel account id.
directionbodystringnoin, out or both (default both). Must be supported by the kind.
memorybodystringnoall, text_only or off. Defaults to the kind's memory_default. With off, messages of this wiring do not reach tunnel memory.
default_outbodybooleannoUse this account when a send names only the kind. Default false. Needs out or both.
enabledbodybooleannoDefault true.

Request

bash
curl -sS -X PUT https://api.mot3r.com/v1/lines/7c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f/wiring/3f2b8c1e-7a4d-4e5b-9c6f-1d2e3a4b5c6d \
  -H "Authorization: Bearer $MOT_ROOT_KEY" \
  -H "content-type: application/json" \
  -d '{"direction":"both","memory":"all","default_out":true}'

Response 200

JSON
{
  "line_id": "7c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f",
  "created": true,
  "wiring": {
    "account_id": "3f2b8c1e-7a4d-4e5b-9c6f-1d2e3a4b5c6d",
    "kind": "telegram_bot",
    "external_id": "7412345678",
    "label": "Support bot",
    "direction": "both",
    "default_out": true,
    "memory": "all",
    "enabled": true,
    "status": "active",
    "healthy": true,
    "last_in_at": null,
    "last_out_at": null,
    "error_streak": 0
  },
  "measured_at": "2026-10-16T15:42:00.000Z"
}
NameTypeDescription
createdbooleantrue when the wiring is new.
wiring.healthybooleantrue when the wiring is enabled, the account is active and error_streak is 0.

Error 404

JSON
{"error":{"status":404,"reason":"account_not_found","message":"Account not found."}}

#Unwire an account from a tunnel

DELETE /v1/lines/:id/wiring/:account_id

Switches a wiring off. The wiring row stays and can be enabled again with a PUT. The tunnel gets a channel.unwired event.

Authentication: root key only.

Parameters

NameInTypeRequiredDescription
idpathuuidyesTunnel id.
account_idpathuuidyesChannel account id.

Request

bash
curl -sS -X DELETE https://api.mot3r.com/v1/lines/7c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f/wiring/3f2b8c1e-7a4d-4e5b-9c6f-1d2e3a4b5c6d \
  -H "Authorization: Bearer $MOT_ROOT_KEY"

Response 200

JSON
{
  "line_id": "7c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f",
  "wiring": {
    "account_id": "3f2b8c1e-7a4d-4e5b-9c6f-1d2e3a4b5c6d",
    "kind": "telegram_bot",
    "external_id": "7412345678",
    "label": "Support bot",
    "direction": "both",
    "default_out": false,
    "memory": "all",
    "enabled": false,
    "status": "active",
    "healthy": false,
    "last_in_at": "2026-10-16T14:02:11.530Z",
    "last_out_at": "2026-10-16T14:02:40.918Z",
    "error_streak": 0
  },
  "measured_at": "2026-10-16T15:50:00.000Z"
}

Error 404

JSON
{"error":{"status":404,"reason":"wiring_not_found","message":"Wiring not found."}}

#Wire a room to a tunnel

PUT /v1/lines/:id/rooms

Wires one room of mot's own channels into a tunnel as inbound: an mIRC channel (ours_mirc) or an mURL link room (ours_murl). mot creates the channel account for the tunnel's identity and that room, wires it with direction in, and reads new messages from the moment of wiring, without replaying history. Calling it again for the same room updates the wiring.

Authentication: root key only. The tunnel must be active and linked to its app identity.

Parameters

NameInTypeRequiredDescription
idpathuuidyesTunnel id.
kindbodystringyesours_mirc or ours_murl.
roombodystringyesFor ours_mirc, the channel uuid. For ours_murl, the room name: 1 to 128 characters of a-z, 0-9, _, -.
memorybodystringnoall, text_only or off. Defaults to the kind's memory_default.
enabledbodybooleannoDefault true.
labelbodystringnoYour name for the room, at most 80 characters.

Request

bash
curl -sS -X PUT https://api.mot3r.com/v1/lines/7c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f/rooms \
  -H "Authorization: Bearer $MOT_ROOT_KEY" \
  -H "content-type: application/json" \
  -d '{"kind":"ours_murl","room":"release-notes","label":"Release notes room"}'

Response 200

JSON
{
  "line_id": "7c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f",
  "created": true,
  "wired": true,
  "account": {
    "account_id": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8d",
    "kind": "ours_murl",
    "external_id": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e:release-notes",
    "label": "Release notes room",
    "config": { "room": "release-notes" },
    "last4": null,
    "composio_account_id": null,
    "app_identity_id": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e",
    "status": "active",
    "verified_at": "2026-10-16T15:43:00.000Z",
    "verified_by": "wire_ours_room_put",
    "last_in_at": null,
    "last_out_at": null,
    "error_streak": 0,
    "last_error": null,
    "created_at": "2026-10-16T15:43:00.000Z",
    "has_secret": false
  },
  "wiring": {
    "account_id": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8d",
    "kind": "ours_murl",
    "external_id": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e:release-notes",
    "label": "Release notes room",
    "direction": "in",
    "default_out": false,
    "memory": "all",
    "enabled": true,
    "status": "active",
    "healthy": true,
    "last_in_at": null,
    "last_out_at": null,
    "error_streak": 0
  },
  "measured_at": "2026-10-16T15:43:00.000Z"
}
NameTypeDescription
createdbooleantrue when the room account is new.
wiredbooleantrue when the wiring is new.
account.external_idstring<identity>:<room>.

Error 409

JSON
{"error":{"status":409,"reason":"line_without_upstream_key","message":"Line without upstream key."}}

#Send a message as a tunnel

POST /v1/lines/:id/send

Sends a message from the tunnel through a wired channel account. mot checks the account, the outbound rule of the kind and config.allow_to before anything reaches the provider. telegram_bot only replies: the other side must have written first in the thread. Long Telegram text is split into parts of at most 4096 characters.

Authentication: tunnel key, for its own tunnel. Use me as :id for the tunnel of the key. A cable that no longer holds the tunnel gets 409 cable_superseded.

Send an Idempotency-Key header to make retries safe: the same key with the same body returns the first result with "replay": true and does not send again; the same key with a different body returns 409 idempotency_key_reused.

Parameters

NameInTypeRequiredDescription
idpathuuid or meyesTunnel id.
Idempotency-KeyheaderstringnoRequest id for safe retries.
reply_tobodyuuidone of reply_to, account_id, kindId of a message in the tunnel's inbox. The reply goes to the same account, thread and sender.
account_idbodyuuidChannel account to send from. Must be wired to the tunnel with out or both.
kindbodystringSend from the tunnel's default_out account of this kind.
tobodystringnoRecipient at the provider, at most 200 characters. With reply_to, defaults to the sender of that message.
thread_keybodystringnoThread at the provider, at most 200 characters. For Telegram, the chat id.
textbodystringyes for TelegramMessage text, at most 20000 characters.

Request

bash
curl -sS -X POST https://api.mot3r.com/v1/lines/me/send \
  -H "Authorization: Bearer mot_lk_live_xxxxxxxxxxxx" \
  -H "content-type: application/json" \
  -H "Idempotency-Key: 9d8c7b6a-5f4e-4d3c-8b2a-1f0e9d8c7b6a" \
  -d '{"reply_to":"0192a1b2-c3d4-7e5f-8a6b-7c8d9e0f1a2b","text":"Your order shipped today."}'

Response 200

JSON
{
  "message_id": "0192a1b3-d4e5-7f60-9a7b-8c9d0e1f2a3b",
  "line_id": "7c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f",
  "cable_id": "2e3f4a5b-6c7d-4e8f-9a0b-1c2d3e4f5a6b",
  "cable_epoch": 3,
  "to": "123456789",
  "thread_key": "123456789",
  "state": "sent",
  "ext_ref": "tg:7412345678:123456789:4821",
  "account": {
    "account_id": "3f2b8c1e-7a4d-4e5b-9c6f-1d2e3a4b5c6d",
    "kind": "telegram_bot",
    "external_id": "7412345678"
  },
  "parts_sent": 1,
  "parts_total": 1,
  "measured_at": "2026-10-16T15:44:00.000Z"
}
NameTypeDescription
message_iduuidId of the outbound message in the tunnel's log.
cable_id, cable_epochuuid, integerCable that wrote the message.
statestringState of the message after the provider answered.
ext_refstringReference of the message at the provider.
parts_sent, parts_totalintegerTelegram parts delivered, and the number of parts the text was split into.

Error 409

JSON
{"error":{"status":409,"reason":"out_rule_reply_only","message":"This channel account only replies: the other side has to write first in this thread (a Telegram bot never starts a conversation). Reply to a message from the line inbox."}}

#Show typing

POST /v1/lines/:id/typing

Shows a typing indicator in the chat of an incoming message while the tunnel prepares its answer. The signal is not written to the tunnel's log. Send at most one signal per thread every 3 seconds; Telegram clears the indicator after about 5 seconds or when the reply arrives, so repeat it about every 4 seconds during a long turn. Supported for telegram_bot; other kinds return 409 typing_not_supported.

Authentication: tunnel key, for its own tunnel. The root key gets 401 invalid_credential.

Parameters

NameInTypeRequiredDescription
idpathuuid or meyesTunnel id.
message_idbodyuuidyesId of an incoming message in the tunnel's inbox. The body takes no other field.

Request

bash
curl -sS -X POST https://api.mot3r.com/v1/lines/me/typing \
  -H "Authorization: Bearer mot_lk_live_xxxxxxxxxxxx" \
  -H "content-type: application/json" \
  -d '{"message_id":"0192a1b2-c3d4-7e5f-8a6b-7c8d9e0f1a2b"}'

Response 200

JSON
{
  "sent": true,
  "action": "typing",
  "line_id": "7c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f",
  "message_id": "0192a1b2-c3d4-7e5f-8a6b-7c8d9e0f1a2b",
  "kind": "telegram_bot",
  "next_after_ms": 3000,
  "measured_at": "2026-10-16T15:44:00.000Z"
}
NameTypeDescription
next_after_msintegerEarliest time, in milliseconds, for the next signal in this thread.

Error 429

JSON
{"error":{"status":429,"reason":"typing_rate_limited","message":"Typing rate limited.","line_id":"7c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f","message_id":"0192a1b2-c3d4-7e5f-8a6b-7c8d9e0f1a2b","kind":"telegram_bot","retry_after_ms":1800}}

#Download a Telegram file

GET /v1/wires/telegram/:account_id/file/:file_ref

Downloads a file attached to an incoming Telegram message of the tunnel. Incoming messages carry this address in the url of each part, so you rarely build it yourself. The file comes back as a download (content-disposition: attachment) with the part's content type. The bot token never appears in the address or the response.

Authentication: tunnel key of the tunnel that received the message. The root key gets 403. A file from another tunnel, another account or outside the tunnel's log returns 404 part_not_found.

Parameters

NameInTypeRequiredDescription
account_idpathuuidyesChannel account that received the message.
file_refpathstringyesTelegram file reference from the part url: 1 to 200 characters of A-Z, a-z, 0-9, _, -.

Request

bash
curl -sS https://api.mot3r.com/v1/wires/telegram/3f2b8c1e-7a4d-4e5b-9c6f-1d2e3a4b5c6d/file/BQACAgIAAxkBAAIBY2Zx \
  -H "Authorization: Bearer mot_lk_live_xxxxxxxxxxxx" \
  -o invoice.pdf

Response 200

The file bytes, at most 20 MB, with content-type set to the part's MIME type and content-disposition: attachment; filename="...".

Error 413

JSON
{"error":{"status":413,"reason":"file_too_large","message":"The file is too large (see max_bytes).","max_bytes":20971520}}

#Hand over a thread

POST /v1/threads/handover

Passes a conversation thread from one tunnel to another tunnel of the same account. For a thread on a wired channel account, the sender's next replies go to the target tunnel, within the thread window of the channel kind and for as long as that tunnel keeps the account wired. For a thread between tunnels on the mot fleet bus, the replies come back to the target tunnel. The target tunnel gets a note in its inbox with a contact card: the channel kind, account, thread, sender and your reason.

Authentication: root key with the keys:rw scope (any message of the account), or tunnel key or test key (only messages of its own tunnel). A tunnel key bound to a cable must hold the tunnel's live lease, otherwise the call is refused with 409 cable_superseded, 409 lease_required or 409 lease_released; a tunnel key that is not bound to a cable gets 409 line_in_core_needs_cable on a tunnel that has an address (every tunnel created with the API has one). A panel session is not accepted.

Parameters

NameInTypeRequiredDescription
message_idbodyuuidyesA message of the thread, as returned in the tunnel's inbox.
tobodystringyesThe target tunnel of the same account: its UUID, address, handle or <name>@mot.email address. Up to 200 characters.
reasonbodystringyesWhy the thread moves, 3 to 200 characters. Included in the note to the target tunnel.

Request

bash
curl -sS -X POST https://api.mot3r.com/v1/threads/handover \
  -H "Authorization: Bearer mot_lk_live_xxxxxxxxxxxx" \
  -H "content-type: application/json" \
  -d '{"message_id":"0192a1b2-c3d4-7e5f-8a6b-7c8d9e0f1a2b","to":"billing-bot@mot.email","reason":"billing question"}'

Response 200

JSON
{
  "replay": false,
  "handover_id": 17,
  "from_line_id": "3f2b8c1e-7a4d-4e5b-9c6f-1d2e3a4b5c6d",
  "to_line_id": "7c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f",
  "account_id": "9a0b1c2d-3e4f-4a5b-8c6d-7e8f9a0b1c2d",
  "thread_key": "123456789",
  "fleet_thread_id": null,
  "note_message_id": "0192a1b4-e5f6-7a71-8b8c-9d0e1f2a3b4c"
}
NameTypeDescription
replaybooleantrue when the thread was already handed to this tunnel. No new record was written.
handover_idinteger or nullID of the handover record. null when a thread between tunnels is already with the target tunnel.
from_line_iduuidThe tunnel that had the thread.
to_line_iduuidThe target tunnel.
account_iduuid or nullThe channel account of the thread. null for a thread between tunnels.
thread_keystringThread at the provider. For a thread between tunnels, fleet: followed by the thread ID.
fleet_thread_iduuid or nullID of the thread between tunnels. null for a channel thread.
note_message_iduuid or nullThe note placed in the target tunnel's inbox.

Other refusals: 400 bad_request, 400 bad_message_id, 400 bad_reason, 401 missing_credential, 401 invalid_credential, 403 key_kind_not_allowed, 403 scope_missing, 403 not_thread_owner (a thread between tunnels can be handed over only by the tunnel that has it, or by the root key), 404 message_not_found, 404 fleet_line_not_found, 409 line_not_active, 409 line_not_in_core (the target tunnel has no address, cable or wiring), 409 handover_target_not_wired (a channel thread needs the target tunnel to have the same channel account wired), 409 handover_same_line.

Error 409

JSON
{"error":{"status":409,"reason":"line_not_active","message":"This line is not active."}}

#Send a message from your own channel

POST /v1/wires/custom/:account_id

Delivers one message from your own system to the tunnel that the channel account of kind custom_webhook is wired to. Call it from your server whenever a person writes in the system you connected as a custom channel. The message lands in the tunnel's inbox with trust: ext.

Authentication: no key. The request proves that you hold the signing secret of the channel account with two headers. x-mot-timestamp is the Unix time in seconds, 1 to 12 digits, within 300 seconds of the server clock. x-mot-signature is v1= followed by 64 lowercase hex characters: the HMAC-SHA256 of the text v1:<timestamp>:<raw body>, with the signing secret as the key. Use the secret exactly as returned (the 64 hex characters as text, not decoded) and the body bytes exactly as you send them. The signing secret is returned once as signing_secret when the account is created with POST /v1/channel-accounts. A wrong, old or missing signature, an unknown account, a revoked account and an account of another kind all give the same 401 invalid_webhook_signature.

Parameters

NameInTypeRequiredDescription
account_idpathuuidyesId of the channel account. It is the last part of the webhook_url returned when the account is created.
x-mot-timestampheaderintegeryesUnix time in seconds, 1 to 12 digits. Must be within 300 seconds of the server clock.
x-mot-signatureheaderstringyesv1= plus 64 lowercase hex characters, see Authentication.
vbodystringyes, in the mot formatMust be mot.msg.v1. A body with a v field is read in the mot format.
idbodystringyesYour id of the message: 1 to 160 printable ASCII characters without spaces. It is the idempotency key: the same id again returns duplicate: true and stores no second message, in any thread and in any of your channel accounts.
frombodyobjectyesThe sender: external_id (string, 1 to 200 characters, required) and display (string of 1 to 80 characters or null, optional). kind may be ext. line and confirmed are refused.
textbodystring or nullone of text and partsMessage text, up to 20000 characters.
partsbodyarraynoUp to 20 attachment links. Each item has type (voice, audio, image, video, file or link), mime (lowercase type/subtype, up to 100 characters), url (an HTTPS address, up to 2000 characters), size (integer or null), sha256 (64 lowercase hex characters or null) and optionally name (1 to 255 characters or null). size and sha256 must be present; null is allowed.
threadbodyobjectno{"key": "<1 to 120 characters>"}. Messages with the same key form one conversation. Without it the thread key is default.
tsbodystringnoTime of the message at your system, ISO 8601 UTC (2026-10-16T15:40:00.000Z). Checked for shape only.
trustbodystringnoWhen present, must be ext.
dirbodystringnoWhen present, must be in.

The body may carry no other field. The fields line, account, via, hop, derived_from_ext, cable, reply_to and to are set by mot and are refused with 400 server_stamp.

Your own JSON shape. When the body has no v field, mot reads it through the config.map of the account. Each map key names a mot field and each value is a data path into your JSON, for example $.message.text. A value that is an object or an array counts as missing. Without a map the body is refused with 400 bad_envelope.

Map keyRequiredLimitMeaning
external_idyes200 charactersThe sender. Missing: the answer is 200 with ignored: no_sender.
textyes20000 charactersThe message text. Missing or empty: 200 with ignored: empty_message.
thread_keyno120 charactersThe conversation. Default default.
displayno80 charactersDisplay name of the sender.
ext_refno160 charactersYour id of the message, the idempotency key. Without it every delivery becomes a new message.

Request

bash
BODY='{"v":"mot.msg.v1","id":"crm-msg-10234","thread":{"key":"ticket-8841"},"from":{"external_id":"customer-552","display":"Anna K."},"text":"Where is my order?"}'
TS=$(date +%s)
SIG=$(printf 'v1:%s:%s' "$TS" "$BODY" | openssl dgst -sha256 -hmac "$MOT_CHANNEL_SIGNING_SECRET" -hex | sed 's/^.* //')
curl -sS -X POST https://api.mot3r.com/v1/wires/custom/3f2b8c1e-7a4d-4e5b-9c6f-1d2e3a4b5c6d \
  -H "content-type: application/json" \
  -H "x-mot-timestamp: $TS" \
  -H "x-mot-signature: v1=$SIG" \
  --data-binary "$BODY"

Response 200

The message was stored, or it was a repeat of an id you sent before.

JSON
{ "ok": true, "duplicate": false }
NameTypeDescription
okbooleanAlways true on a 200.
duplicatebooleantrue when this id was received before. No second message is stored.
ignoredstringPresent instead of duplicate when your own JSON had no sender or no text: no_sender or empty_message. The message is not stored.
droppedstringPresent instead of duplicate when mot refused the message for a reason that sending it again cannot fix. The value is the reason, for example bad_thread_key.

Send the request again after 409 and after 5xx; do not send it again after 400 or 401.

Other refusals: 400 bad_json (the body is not JSON), 400 bad_envelope (the body is not a JSON object, or it has no v field and the account has no config.map), 400 server_stamp (a field that only mot sets), 400 trust_laundering (trust or from.kind other than ext, or from.line or from.confirmed present), 400 bad_dir (dir other than in), 400 bad_v, 400 bad_id, 400 bad_from, 400 bad_from_external_id, 400 bad_thread_key, 400 bad_text (also for a message with neither text nor parts), 400 bad_parts; any other malformed field gives bad_ plus its path (an unknown field foo gives 400 bad_foo), 404 not_found (this channel kind is switched off on the server), 409 account_not_verified (the account is still pending: run POST /v1/channel-accounts/:id/test first), 413 body_too_large (the body is above 64 KB), 503 kek_unconfigured and 503 unmeasured (try again later).

Error 401

JSON
{"error":{"status":401,"reason":"invalid_webhook_signature","message":"Invalid webhook signature."}}