短信从您自己的手机发出。了解工作原理
石窟画API 第一种架构安全设备配对交付可见度多设备控制已版本文件
开发者枢纽/ Telegram API

TG · 6 已提供文档的接口操作

Telegram API 文档

在您自己的应用中使用已连接的 Telegram 账户:查找联系人、将消息排队并跟踪其发送状态。

与业务应用连接的 Telegram 联系人和消息
REST 基础 URLhttps://api.smsmobileapi.com

· ZXX-10Z 答复 · ZX-11XZS 需要 · UTF-8

连接您的 API 密钥

连接一次,然后在短信、通话、通知、WhatsApp、Telegram 和电子邮件中测试端点。

从这里开始

你的第一个要求,分四步走

1

Keep your main SMSMobileAPI subscription active; Telegram connection, API access, sending and sent-message history pause when it expires.

2

在仪表板中通过 QR code 连接您自己的 Telegram 帐户并同步其联系人。

3

从 My API Key 复制您的 SMSMobileAPI 密钥并将其保存在您的服务器上。

4

列出联系人并复制目标收件人的 contact_id。

5

Send JSON for text, or multipart/form-data to attach an image or document. Use the returned message_id to check the sent log.

您的 TELEGRAM 账户

连接、选择联系人,然后跟踪发送情况。

账户范围d

每位客户通过 QR code 扫描以连接其自己的 Telegram 帐户。在仪表板中同步联系人,使用返回的联系 ID 将消息入队,然后在已发送日志中检查其状态。

1

连接

在 Telegram 仪表板页面扫描 QR code。

2

查找联系人

先同步,然后通过 API 搜索联系人 ID。

3

发送

使用幂等键 POST 一条 JSON 消息。

4

追踪

读取排队、已发送、未知或错误状态。

验证

在服务器上保存证书

Send X-SMSMobileAPI-Key: YOUR_API_KEY in an HTTPS header. Keep this key on your server, never in browser JavaScript or a public repository. The endpoints are scoped to the Telegram account connected to that SMSMobileAPI account. A short-lived signed download_url can be opened without the key. Access can be disabled in My API Key.

在你融入之前
  • An expired SMSMobileAPI subscription blocks Telegram API access with HTTP 402 subscription_expired, including attachment downloads. Renew in the dashboard to restore access; existing connection and history are preserved.
  • QR code 将每位客户自己的 Telegram 账户关联起来。消息由该账户发送,而非共享的 SMSMobileAPI 账户。
  • 202 响应表示请求已排队。这并不证明 Telegram 已接受或投递该消息。请轮询已发送日志以确认已发送或错误。
  • 本服务当前每次请求向一个已同步联系人或已保存的 @username 发送。请遵守 Telegram 规则并确保收件人同意。
  • 请求速率限制为每分钟 15 条新消息,每个已连接账户最多 30 条排队消息。重试时使用稳定的 idempotency_key。
  • Images and documents can be up to 5 MB. The send queue holds file bytes only until processing finishes; a separate private copy supports later downloads. File bytes are never embedded in the sent log.
  • Newly sent attachments are kept in private storage for 90 days. The sent log returns a download_url valid for 15 minutes; request the log again to get a new link. Older attachments sent before this feature have no downloadable copy.
得到

列出 Telegram 联系人

#
终 编https://api.smsmobileapi.com/telegram/contacts/

返回您已连接的 Telegram 账户中可用的联系人。

什么时候用

按显示名称或 @username 搜索,然后使用 contact_id 发送。

参数

姓名类型所需经费描述
q 细绳 可选 可选的名称或用户名搜索,最多 80 个字符。
limit 整数 可选 页面大小为 1 到 100;默认 50。
cursor 整数 可选 使用上一次响应中的 paging.next_cursor;第一页请求时省略此参数。

请求示例

库尔
curl -G 'https://api.smsmobileapi.com/telegram/contacts/' \
  -H 'X-SMSMobileAPI-Key: YOUR_API_KEY' \
  --data-urlencode 'q=Alex' \
  --data-urlencode 'limit=50'

示例回复

JSON
{"ok":true,"data":[{"contact_id":42,"display_name":"Alex Example","username":"alex_example","source":"telegram"}],"paging":{"has_more":false,"next_cursor":null}}

想听这个请求吗?连接页面上方的 API 键以解锁交互式测试器 。

连接密钥 QQ
很高兴知道
  • 联系 ID 属于已连接的帐户;不能使用其他帐户的 ID。
  • 当有人未出现时,请在仪表板 → Telegram 联系人 刷新联系人。
邮政

发送 Telegram 消息

#
终 编https://api.smsmobileapi.com/telegram/send/

将一条文本消息排入队列,发送到您已连接的 Telegram 帐户中的联系人。

什么时候用

请使用来自联系人端点的 contact_id。保存 message_id 以便跟踪。

参数

姓名类型所需经费描述
contact_id 整数 必需的 由 /telegram/contacts/ 返回的联系 ID。
message 细绳 必需的 UTF-8 文本,1–4096 字符且最多 16,000 字节。
idempotency_key UUID 字符串 可选 稳定的 36 字符小写 UUID 风格密钥。网络重试时重用以避免重复消息。

请求示例

库尔
curl -X POST 'https://api.smsmobileapi.com/telegram/send/' \
  -H 'X-SMSMobileAPI-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"contact_id":42,"message":"Your appointment is confirmed.","idempotency_key":"2d40bb10-cc42-4c30-a282-93fc6dd8e161"}'

示例回复

JSON
{"ok":true,"message_id":123,"status":"queued","idempotency_key":"2d40bb10-cc42-4c30-a282-93fc6dd8e161","duplicate":false}

想听这个请求吗?连接页面上方的 API 键以解锁交互式测试器 。

连接密钥 QQ
很高兴知道
  • HTTP 202 表示已入队;这并非送达回执。精确重试将返回 HTTP 200 并带有 duplicate=true 以及原始 message_id。
  • 重试时,使用相同的 idempotency_key 并对同一联系人和消息重用。如果在相同键下更改了有效载荷,会返回 HTTP 409。
邮政

Send a Telegram image or document

#
终 编https://api.smsmobileapi.com/telegram/send/

Queue one file for a contact, with an optional caption.

什么时候用

Use multipart/form-data. The field name for the attachment is file.

参数

姓名类型所需经费描述
contact_id 整数 必需的 由 /telegram/contacts/ 返回的联系 ID。
file file 必需的 One JPG, PNG, WebP, PDF, TXT, CSV, JSON, ZIP or Office file, at most 5 MB.
message 细绳 可选 Optional caption of at most 1024 characters.
idempotency_key UUID 字符串 可选 Reuse the same key and identical file and caption when retrying.

请求示例

库尔
curl -X POST 'https://api.smsmobileapi.com/telegram/send/' \
  -H 'X-SMSMobileAPI-Key: YOUR_API_KEY' \
  -F 'contact_id=42' \
  -F 'message=Here is the document.' \
  -F 'file=@./document.pdf' \
  -F 'idempotency_key=2d40bb10-cc42-4c30-a282-93fc6dd8e161'

示例回复

JSON
{"ok":true,"message_id":124,"status":"queued","idempotency_key":"2d40bb10-cc42-4c30-a282-93fc6dd8e161","duplicate":false}

想听这个请求吗?连接页面上方的 API 键以解锁交互式测试器 。

连接密钥 QQ
很高兴知道
  • Do not set Content-Type manually; cURL adds the multipart boundary.
  • For JSON clients, send file_base64 with the Base64 file contents and filename, alongside contact_id and an optional message caption.
  • A queued response is not proof of delivery. Check GET /telegram/sent/?message_id=124.
  • The connected Telegram account sends the file to one contact.
邮政

Send a Telegram file using JSON

#
终 编https://api.smsmobileapi.com/telegram/send/

Queue one image or document using a Base64 string when multipart upload is inconvenient.

什么时候用

Encode the original file bytes with Base64. Do not include an API key in the JSON body.

参数

姓名类型所需经费描述
contact_id 整数 必需的 由 /telegram/contacts/ 返回的联系 ID。
filename 细绳 必需的 Original file name, for example photo.png or invoice.pdf.
file_base64 细绳 必需的 Raw Base64 file contents or a data URI; decoded file must be 5 MB or smaller.
message 细绳 可选 Optional caption of at most 1024 characters.
idempotency_key UUID 字符串 可选 Reuse the same key with identical file contents, filename and caption on retries.

请求示例

库尔
curl -X POST 'https://api.smsmobileapi.com/telegram/send/' \
  -H 'X-SMSMobileAPI-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"contact_id":42,"filename":"photo.png","file_base64":"BASE64_ENCODED_FILE","message":"See attached","idempotency_key":"2d40bb10-cc42-4c30-a282-93fc6dd8e161"}'

示例回复

JSON
{"ok":true,"message_id":125,"status":"queued","idempotency_key":"2d40bb10-cc42-4c30-a282-93fc6dd8e161","duplicate":false}

想听这个请求吗?连接页面上方的 API 键以解锁交互式测试器 。

连接密钥 QQ
很高兴知道
  • Replace BASE64_ENCODED_FILE with the actual Base64 of a supported file.
  • Use multipart/form-data instead if your client supports direct file upload; it avoids Base64 size overhead.
得到

列出已发送的 Telegram 消息

#
终 编https://api.smsmobileapi.com/telegram/sent/

返回最近的排队、发送中、已发送和发送失败的消息,按最新优先。

什么时候用

使用 message_id 对该端点进行轮询,以跟踪由 /telegram/send/ 返回的消息。

参数

姓名类型所需经费描述
message_id 整数 可选 返回 /telegram/send/ 的特定消息 ID。
contact_id 整数 可选 将结果限制为一个联系人 ID。
status queued | sending | sent | error | unknown 可选 按发送状态过滤。
limit 整数 可选 页面大小为 1 到 100;默认 50。
cursor 整数 可选 使用 paging.next_cursor 获取更早的消息。

请求示例

库尔
curl -G 'https://api.smsmobileapi.com/telegram/sent/' \
  -H 'X-SMSMobileAPI-Key: YOUR_API_KEY' \
  --data-urlencode 'message_id=123'

示例回复

JSON
{"ok":true,"data":[{"message_id":123,"contact_id":42,"contact_name":"Alex Example","username":"alex_example","message":"Your appointment is confirmed.","type":"text","media":null,"status":"sent","telegram_message_id":781,"error_code":null,"error_detail":null,"attempts":1,"queued_at":"2026-11-06T09:42:00+00:00","sent_at":"2026-11-06T09:42:04+00:00"}],"paging":{"has_more":false,"next_cursor":null}}

想听这个请求吗?连接页面上方的 API 键以解锁交互式测试器 。

连接密钥 QQ
很高兴知道
  • The top-level type is text, image or file. For an attachment, media contains the filename, MIME type, size, download_url and available_until; media is null for text messages. File bytes are not embedded in the log.
  • The download_url opens in a browser for 15 minutes. Refresh this endpoint for a new link while the file remains available.
  • sent 表示 Telegram 已从已连接账户接受该消息;未报告收件人交付或已读回执。
  • unknown 表示无法确认发送结果。请勿在此状态下盲目重发消息。
得到

Download a sent Telegram attachment

#
终 编https://api.smsmobileapi.com/telegram/media/

Downloads a previously sent image or document while it remains available.

什么时候用

Use media.download_url from the sent log, or call this endpoint with the account API key.

参数

姓名类型所需经费描述
message_id 整数 必需的 Message ID returned by /telegram/send/.

请求示例

库尔
curl -L 'https://api.smsmobileapi.com/telegram/media/?message_id=124' \
  -H 'X-SMSMobileAPI-Key: YOUR_API_KEY' \
  -o attachment

示例回复

JSON
Binary image or document bytes (Content-Type matches the file)

想听这个请求吗?连接页面上方的 API 键以解锁交互式测试器 。

连接密钥 QQ
很高兴知道
  • A download_url returned by /telegram/sent/ is signed and works without an API key for 15 minutes. Keep it private.
  • The authenticated endpoint requires the Telegram sent-log API access switch.
  • Files are retained for 90 days; the type and filename remain in the log after expiry.

故障排除

错误和安全的重试

在重试前读取 HTTP 状态和 JSON 错误字段 。 不先更正请求, 不重试验证或认证失败 。

HTTP代码怎么办
401api_key_required / invalid_api_key发送有效的 X-SMSMobileAPI-Key 请求头。
402subscription_expiredRenew the SMSMobileAPI subscription linked to the API key. Telegram API access resumes after renewal.
403API_ENDPOINT_DISABLED在 My API Key 中启用 Telegram API 或此特定端点。
404contact_not_found同步联系人并使用来自您自身 Telegram 连接的 ID。
409telegram_not_connected / idempotency_conflict连接 Telegram 或为已更改内容选择新的幂等键。
422invalid_message / invalid_pagination更正消息、联系 ID 或分页参数。
429queue_full / rate_limited等待排队发送或每分钟限制解除。
503sending_unavailable / service_unavailable发送工作进程或存储暂时不可用;请稍后重试。
503media_not_readyFile sending requires the current Telegram service update. Text sending remains available.
404 / 410media_not_found / media_expiredThe file is unavailable or past its 90-day retention period.
重试规则重试仅进行瞬态429和5xx响应. 1秒后开始,然后回到2,4和8秒.

需要帮助吗?

带上请求的背景 而不是你的秘密

共享端点,时间戳,HTTP状态和消毒响应. 永远不要包括API密钥,指使或私人消息内容.

联系API支持
安全无虞SMSMobileAPI移动应用程序连接手机到网络仪表板和REST API,用于短信和呼叫操作
加密的移动到平台连接

官方移动应用程序

电话、仪表板和API之间的安全桥

短信和呼叫业务通过官员SMSMobileAPI应用程序安装在您的连接电话上 。 应用软件安全地将设备与您的账户对齐,同步了授权的事件,并将移动网络连接到仪表板和REST API.

1移动应用程序给手机和它的SIM配对 2加密链接认证和保护过境数据 3发牌机和 API控制工作流程和活动
  • 通过Google Play和App Store官方上市发布签名的版本
  • Google和苹果平台审查、签署和发行控制
  • 安全设备对接、HTTPS运输和认证的API访问
  • 仅为您启用的移动特性所需的权限
找官来SMSMobileAPI应用程序在Google Play 下载苹果App Store上的官方SMSMobileAPI应用
能力取决于Android或iOS允许的权限和背景访问.