短信从您自己的手机发出。了解工作原理
PLATFORMAPI-first architectureSecure device pairingDelivery visibilityMulti-device controlVersioned documentation
Developer hub/ WhatsApp API

WA · 9 已提供文档的接口操作

WhatsApp API documentation

Send WhatsApp messages and media, retry failures, verify recipient numbers and securely retrieve received messages after an explicit synchronization request.

Connected phones synchronizing conversations and media
REST base URLhttps://api.smsmobileapi.com

JSON responses · HTTPS required · UTF-8

Connect your API key

Connect once, then test endpoints across SMS, calls, notifications, WhatsApp and email.

Start here

Your first request in four steps

1

Connect and enable WhatsApp for a supported mobile.

2

Confirm the recipient with the number-check endpoint.

3

Send with waonly=yes.

4

To retrieve received messages: activate collection, call /getwa/synchronisation/, wait for recovery, then call /getwa.

MANDATORY BEFORE RETRIEVING RECEIVED MESSAGES

Request WhatsApp synchronization first.

Before calling /getwa to view received WhatsApp messages, you must request a synchronization window through https://api.smsmobileapi.com/getwa/synchronisation/. This explicit step is required to securely authorize the exchange between WhatsApp and SMSMobileAPI. Wait for recovery, then call /getwa.

Open the required synchronization endpoint →

此 API 的 WEBHOOK V2

仅订阅您的工作流所需的移动事件。

5 种事件类型

一个目标可以接收全部事件,或者您可以将生产系统、分析和运维告警分开。每个事件都有精确的名称,使您的应用能够可预测地处理它们。

whatsapp.submitted

WhatsApp 已提交

已创建一个 WhatsApp 发送任务。

whatsapp.sent

WhatsApp 已发送

已连接的 WhatsApp 环境确认消息已发送。

whatsapp.failed

WhatsApp 失败

WhatsApp 的发送操作失败。

whatsapp.received

WhatsApp 已接收

在账户请求同步后检索到了一条 WhatsApp 消息。

whatsapp.voice.transcribed

语音留言已转写

一条符合条件的检索到的 WhatsApp 语音留言已被转换为可用文本。

Authentication

Keep credentials on your server

Use apikey for direct integrations. OAuth2 client credentials are available for server-side applications; request a token and send it as Authorization: Bearer ACCESS_TOKEN.

历史管理

安全清除历史: 预览、 删除、 跟踪进度

这些端点清除您所选服务器历史 API 键,而不是电话或外部服务中的信息。 它们不能提供账号的去除。 新的活性可以在删除后出现.

读取 request_id 和重试指南
保护已连接的外部集成

默认情况下,链接或处理记录仍然可见. 只使用 include_linked=1 或正在处理的软件。

怎样 request_id 工作内容

  1. 预览计数方式 action=preview。无 request_id 需要删除任何记录。
  2. 生成一个独特的 request_id 用于删除新内容,例如a UUID。发送前保存它 action=delete. . . . . . . . . . . .
  3. 重复、超时或 HTTP 202,再利用相同 API 键,历史终点, request_id 财务报告和已审计财务报表 include_linked 值。 错误发生后, 绝不自动生成新的 ID 。
  4. 何时 completed=true,操作结束。 重用其ID返回的相同结果,而不是删除新到的记录. 仅为有意进行新清理而使用新ID.

request_id 识别您的删除操作, 而不是个人 SMS允许的格式:16-128 ASCII 字母、数字、连字符或下划线。 A. 国家 UUID 用 Crypto.randomUUID () 生成是合适的。

删除按批次执行。如果返回 HTTP 202 且 continue_required=true,请在 3 秒后再次请求 action=delete。没有后台 cron 任务。action=status 只读取进度,不会继续删除,即使返回 HTTP 200 也是如此。

删除和查询状态的示例

替换样本 request_id 开始前,有你独特的价值。 以下删除请求更改真实账户历史; 它们不是预览 。

POST · 妇女 API 键
curl -X POST "https://api.smsmobileapi.com/delete-history-whatsapp-sent/" \
  --data-urlencode "apikey=YOUR_API_KEY" \
  -d "action=delete" -d "include_linked=0" \
  -d "request_id=6d54ac58-41f1-4fbc-9a39-6e6c86089451"
POST · 妇女 OAuth2
curl -X POST "https://api.smsmobileapi.com/delete-history-whatsapp-sent/" \
  -H "Authorization: Bearer YOUR_OAUTH_ACCESS_TOKEN" \
  -d "action=delete" -d "include_linked=0" \
  -d "request_id=6d54ac58-41f1-4fbc-9a39-6e6c86089451"
GET 现状
curl -G "https://api.smsmobileapi.com/delete-history-whatsapp-sent/" \
  --data-urlencode "apikey=YOUR_API_KEY" \
  -d "action=status" \
  -d "request_id=6d54ac58-41f1-4fbc-9a39-6e6c86089451"

GET 也接受 action=preview 或 或 双 action=delete. . . . . . . . . . . . POST 建议: URL参数可以被泄露到浏览器历史和服务器日志中. 永远不要将删除的 URL 放在公共链接, 图像或预选中 。

用于 POST,以窗体或一个格式发送所有参数 JSON 对象,从查询字符串中选择。 未知参数被拒绝;日期或移动过滤器不支持.

历史记录接口的身份验证

使用 apikey 或 一种 Authorization: 调取 Bearer 由 SMSMobileAPI OAuth2。不要发送刷新符号或 API 键为 a Bearer 符号。 过期的代币被拒绝.

瞄准镜设定完毕后 history:read 允许预览/状态和 history:delete 也允许删除。 对象征和 OAuth 客户端申请。 遗物无范围可查保留其现有的账户访问权.

OAuth2 选择唯一的主机 API 键。 如果存在几个主密钥,则还提供 apikey 以选择账户所属的账户。 次要钥匙从来不允许访问主要钥匙历史。

继续操作之前请先检查响应

count_delete 是该操作所删除的累积数。 selected_at_start 是初始选择; protected_at_start 记录不计在内。 使用 preview.linked_or_processing 以计算链接记录,即使 include_linked=1. . . . . . . . . . . .

JSON · 妇女 HTTP 202 (韩语).
{
    "result": {
        "error": 0,
        "history": "whatsapp-sent",
        "action": "delete",
        "request_id": "6d54ac58-41f1-4fbc-9a39-6e6c86089451",
        "status": "processing",
        "completed": false,
        "count_delete": 100,
        "total_before": 250,
        "selected_at_start": 200,
        "protected_at_start": 50,
        "include_linked": 0,
        "continue_required": true,
        "message": "Repeat GET or POST with the same request_id and include_linked to continue. Status requests do not run deletion."
    }
}
  • 200 与 . completed=true: 完成( 完成) 。 仅200个预览或状态回复并不能证明完成 。
  • 400,000 个 INVALID_REQUEST_ID:检查格式。 404 (中文(简体) ). REQUEST_NOT_FOUND: 没有为此ID操作, API 键和历史。
  • 401: 证书无效或过期. 403: 不足 OAuth 范围或未经授权的账户。
  • 409 (中文(简体) ). HISTORY_BUSY: 正在运行另一个清理; 从原客户端继续. 409 (中文(简体) ). INCLUDE_LINKED_CONFLICT: 恢复原样 include_linked 值。
  • 409 (中文(简体) ). OAUTH_ACCOUNT_AMBIGUOUS: 提供 API 属于此账户的密钥。
  • 503或网络中断:一些批次可能已经完成. 检查配置, 然后用原版重试 request_id中,不自动创建替换操作。
POST · GET

Send a WhatsApp message

#
ENDPOINThttps://api.smsmobileapi.com/sendsms

Sends a WhatsApp text or supported media through the connected environment.

When to use it

Use it for individual recipients or a dashboard contact group.

Parameters

姓名TypeRequirementDescription
apikey string Required Your API key; omit when using a Bearer token.
recipients phone Required Country code plus number, without + or 00.
message string Required Text body; multiple lines are supported.
waonly yes Required Must be yes to request WhatsApp-only delivery.
url_media HTTPS URL 可选 Public PDF, document, archive or JPG/PNG URL.
url_media_shorted yes 可选 Use a shortened download URL with PDF preview mode.
pdf_with_image yes 可选 Add an image preview for a PDF.
encrypt_message yes 可选 Require recipient-side decryption.
contactGroup GUID 可选 Send to every contact in a dashboard group.

Request example

cURL
curl -X POST "https://api.smsmobileapi.com/sendsms?waonly=yes" \
  -d "apikey=YOUR_API_KEY" \
  -d "recipients=191728660" \
  --data-urlencode "message=Your order is ready."

Example response

JSON
{
  "result": {
    "error": 0,
    "sent": "1",
    "id": "MESSAGE_GUID",
    "send_with_whatsapp": "1"
  }
}

Want to run this request? Connect your API key at the top of the page to unlock the interactive tester.

Connect key ↑
Good to know
  • Supported media URLs must be public HTTPS resources.
  • WhatsApp formatting: *bold*, _italic_, ~strikethrough~ and triple-backtick monospace.
POST · GET

Resend an unsent WhatsApp message

#
ENDPOINThttps://api.smsmobileapi.com/resendwa/

Retries a WhatsApp message that currently has an error status.

When to use it

Use it after diagnosing a failed WhatsApp log entry.

Parameters

姓名TypeRequirementDescription
apikey string Required Your API key.
guid string Required GUID of the failed message.

Request example

cURL
curl "https://api.smsmobileapi.com/resendwa/?apikey=YOUR_API_KEY&guid=MESSAGE_GUID"

Want to run this request? Connect your API key at the top of the page to unlock the interactive tester.

Connect key ↑
Good to know
  • Only failed messages are eligible for resend.
GET

Activate inbound retrieval

#
ENDPOINThttps://api.smsmobileapi.com/getwa/active/

Activates, deactivates or toggles WhatsApp message retrieval.

When to use it

Activate collection first. Then, before retrieving received messages, you must request synchronization through /getwa/synchronisation/.

Parameters

姓名TypeRequirementDescription
apikey string Required Your API key.
statut 0 | 1 | x 可选 1 activates, 0 deactivates, x or omission toggles the current state.

Request example

cURL
curl "https://api.smsmobileapi.com/getwa/active/?apikey=YOUR_API_KEY&statut=1"

Example response

JSON
{
  "success": true,
  "read_message_active": 1,
  "status_note": "Activated"
}

Want to run this request? Connect your API key at the top of the page to unlock the interactive tester.

Connect key ↑
Good to know
  • Inbound retrieval is disabled by default for privacy.
  • Activation alone does not retrieve messages: a synchronization request remains mandatory before using /getwa for newly received activity.
GET

Required: request WhatsApp synchronization

#
ENDPOINThttps://api.smsmobileapi.com/getwa/synchronisation/

Mandatory security step before retrieving received WhatsApp messages. It opens a time-limited synchronization window.

When to use it

You must call this endpoint before /getwa whenever you need SMSMobileAPI to check WhatsApp for newly received messages. Wait for recovery, then call /getwa.

Parameters

姓名TypeRequirementDescription
apikey string Required Your API key.

Request example

cURL
curl "https://api.smsmobileapi.com/getwa/synchronisation/?apikey=YOUR_API_KEY"

Example response

JSON
{
  "error": "0",
  "messages": "synchronized",
  "expire_at": "2026-03-11 12:27:00",
  "expire_at_unix": "1773232020"
}

Want to run this request? Connect your API key at the top of the page to unlock the interactive tester.

Connect key ↑
Good to know
  • Synchronization is for receiving messages only. Do not call it before sending.
  • The response returns expire_at and expire_at_unix. Request another synchronization window when you need to collect newer received messages.
  • A synchronization request is mandatory to protect the exchange between WhatsApp and SMSMobileAPI.
GET

Retrieve WhatsApp messages

#
ENDPOINThttps://api.smsmobileapi.com/getwa

Returns received WhatsApp messages that were recovered during a requested synchronization window.

When to use it

Mandatory prerequisite: activate inbound retrieval, call https://api.smsmobileapi.com/getwa/synchronisation/ first, wait for recovery, then call this endpoint. /getwa does not itself start synchronization.

Parameters

姓名TypeRequirementDescription
apikey string Required Your API key.
before Unix timestamp 可选 Return records before this timestamp.
date YYYY-MM-DD 可选 Return records for one date.
message_type text | audio 可选 Filter text messages or audio messages converted to text; omit for both.

Request example

cURL
curl "https://api.smsmobileapi.com/getwa/?apikey=YOUR_API_KEY&message_type=text"

Example response

JSON
{
  "date": "2026-03-11",
  "hour": "12:27:00",
  "timestamp": "1773232020",
  "number": "19176728660",
  "contact": "SMSMobileAPI",
  "message": "When will I receive my order?",
  "guid": "652fcfc0-12a8-46f5-b5ba-9391135b8b4c"
}

Want to run this request? Connect your API key at the top of the page to unlock the interactive tester.

Connect key ↑
GET

Check a WhatsApp number

#
ENDPOINThttps://api.smsmobileapi.com/whatsapp/checknumber/

Checks whether a phone number is available on WhatsApp.

When to use it

Use it before sending to reduce avoidable failures.

Parameters

姓名TypeRequirementDescription
apikey string Required Your API key.
recipients phone Required Country code plus number, without + or 00.

Request example

cURL
curl "https://api.smsmobileapi.com/whatsapp/checknumber/?apikey=YOUR_API_KEY&recipients=19176728660"

Example response

JSON
{
  "contact_found_on_whatsapp": "yes",
  "recipients": "19176728660"
}

Want to run this request? Connect your API key at the top of the page to unlock the interactive tester.

Connect key ↑
POST

Create an OAuth2 access token

#
ENDPOINThttps://api.smsmobileapi.com/oauth2/token

Exchanges client credentials for a Bearer token.

When to use it

Use it for server-to-server integrations where short-lived credentials are preferred.

Parameters

姓名TypeRequirementDescription
grant_type string Required Must be client_credentials.
client_id string Required Client ID from the dashboard.
client_secret string Required Client secret from the dashboard.

Request example

cURL
curl -X POST "https://api.smsmobileapi.com/oauth2/token" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=client_credentials" \
  -d "client_id=YOUR_CLIENT_ID" \
  -d "client_secret=YOUR_CLIENT_SECRET"

Want to run this request? Connect your API key at the top of the page to unlock the interactive tester.

Connect key ↑
Good to know
  • Keep the client secret on your server. Never include it in mobile or browser code.
POST · GET

清空已发送的 WhatsApp 消息记录

#
ENDPOINThttps://api.smsmobileapi.com/delete-history-whatsapp-sent/

清除已发送的服务器记录 WhatsApp 留言。 它不会删除信件从 WhatsApp 谈话

When to use it

首先使用预览,检查计数,然后明确请求删除. 清除了全部选取的历史 API 键,没有日期、电话或信件过滤器。

Parameters

姓名TypeRequirementDescription
apikey string 可选 需要时无需 OAuth2与 OAuth2,可选择选择 API 属于同一账户的密钥。
action preview | delete | status 可选 preview 只统计而不删除;delete 启动或继续删除;status 只查看进度。API 默认使用 delete,此测试工具默认使用 preview。
include_linked 0 | 1 可选 默认 0: 保留链接或处理记录. 设定1以包含,有破坏整合的风险. 继续删除时保持此值不变 。
request_id string 可选 delete 和 status 必须提供,preview 可不提供。使用 16–128 个 ASCII 字母、数字、连字符 (-) 或下划线 (_)。每次新的删除操作生成一个唯一 ID,并在所有重试中保留同一个 ID。它不是消息 ID,也不是 API 密钥。

Request example

cURL
curl -X POST "https://api.smsmobileapi.com/delete-history-whatsapp-sent/" \
  --data-urlencode "apikey=YOUR_API_KEY" \
  -d "action=preview" -d "include_linked=0"
删除和查询状态的示例

替换样本 request_id 开始前,有你独特的价值。 以下删除请求更改真实账户历史; 它们不是预览 。

POST · 妇女 API 键
curl -X POST "https://api.smsmobileapi.com/delete-history-whatsapp-sent/" \
  --data-urlencode "apikey=YOUR_API_KEY" \
  -d "action=delete" -d "include_linked=0" \
  -d "request_id=6d54ac58-41f1-4fbc-9a39-6e6c86089451"
POST · 妇女 OAuth2
curl -X POST "https://api.smsmobileapi.com/delete-history-whatsapp-sent/" \
  -H "Authorization: Bearer YOUR_OAUTH_ACCESS_TOKEN" \
  -d "action=delete" -d "include_linked=0" \
  -d "request_id=6d54ac58-41f1-4fbc-9a39-6e6c86089451"
GET 现状
curl -G "https://api.smsmobileapi.com/delete-history-whatsapp-sent/" \
  --data-urlencode "apikey=YOUR_API_KEY" \
  -d "action=status" \
  -d "request_id=6d54ac58-41f1-4fbc-9a39-6e6c86089451"

Example response

JSON
{
    "result": {
        "error": 0,
        "history": "whatsapp-sent",
        "action": "preview",
        "total": 120,
        "simple": 100,
        "linked_or_processing": 20,
        "selected": 100,
        "include_linked": 0,
        "operation_in_progress": false,
        "active_include_linked": null
    }
}

Want to run this request? Connect your API key at the top of the page to unlock the interactive tester.

Connect key ↑
Good to know
  • 以上示例为预览,而非删除. 计数是说明;删除开始时确定选择。
  • include_linked=1 可能破坏 GHL, , , , , , , , Zapier,自动化,不订阅链接或发送跟踪. 它从不绕过账户所有权或存储完整性检查.
POST · GET

清空已接收的 WhatsApp 消息记录

#
ENDPOINThttps://api.smsmobileapi.com/delete-history-whatsapp-received/

清除已接收的服务器记录 WhatsApp 留言。 无法断开 WhatsApp 或删除对话框。

When to use it

首先使用预览,检查计数,然后明确请求删除. 清除了全部选取的历史 API 键,没有日期、电话或信件过滤器。

Parameters

姓名TypeRequirementDescription
apikey string 可选 需要时无需 OAuth2与 OAuth2,可选择选择 API 属于同一账户的密钥。
action preview | delete | status 可选 preview 只统计而不删除;delete 启动或继续删除;status 只查看进度。API 默认使用 delete,此测试工具默认使用 preview。
include_linked 0 | 1 可选 默认 0: 保留链接或处理记录. 设定1以包含,有破坏整合的风险. 继续删除时保持此值不变 。
request_id string 可选 delete 和 status 必须提供,preview 可不提供。使用 16–128 个 ASCII 字母、数字、连字符 (-) 或下划线 (_)。每次新的删除操作生成一个唯一 ID,并在所有重试中保留同一个 ID。它不是消息 ID,也不是 API 密钥。

Request example

cURL
curl -X POST "https://api.smsmobileapi.com/delete-history-whatsapp-received/" \
  --data-urlencode "apikey=YOUR_API_KEY" \
  -d "action=preview" -d "include_linked=0"
删除和查询状态的示例

替换样本 request_id 开始前,有你独特的价值。 以下删除请求更改真实账户历史; 它们不是预览 。

POST · 妇女 API 键
curl -X POST "https://api.smsmobileapi.com/delete-history-whatsapp-received/" \
  --data-urlencode "apikey=YOUR_API_KEY" \
  -d "action=delete" -d "include_linked=0" \
  -d "request_id=6d54ac58-41f1-4fbc-9a39-6e6c86089451"
POST · 妇女 OAuth2
curl -X POST "https://api.smsmobileapi.com/delete-history-whatsapp-received/" \
  -H "Authorization: Bearer YOUR_OAUTH_ACCESS_TOKEN" \
  -d "action=delete" -d "include_linked=0" \
  -d "request_id=6d54ac58-41f1-4fbc-9a39-6e6c86089451"
GET 现状
curl -G "https://api.smsmobileapi.com/delete-history-whatsapp-received/" \
  --data-urlencode "apikey=YOUR_API_KEY" \
  -d "action=status" \
  -d "request_id=6d54ac58-41f1-4fbc-9a39-6e6c86089451"

Example response

JSON
{
    "result": {
        "error": 0,
        "history": "whatsapp-received",
        "action": "preview",
        "total": 120,
        "simple": 100,
        "linked_or_processing": 20,
        "selected": 100,
        "include_linked": 0,
        "operation_in_progress": false,
        "active_include_linked": null
    }
}

Want to run this request? Connect your API key at the top of the page to unlock the interactive tester.

Connect key ↑
Good to know
  • 以上示例为预览,而非删除. 计数是说明;删除开始时确定选择。
  • include_linked=1 可能破坏 GHL, , , , , , , , Zapier,自动化,不订阅链接或发送跟踪. 它从不绕过账户所有权或存储完整性检查.

Troubleshooting

Errors and safe retries

Read the HTTP status and the JSON error field before retrying. Do not retry validation or authentication failures without correcting the request first.

HTTPCodeWhat to do
400missing_parameterA required parameter is empty or absent. Check the parameter table for the endpoint.
403invalid_apikeyThe API key is unknown, expired or not authorized for the requested feature.
429too_many_requestsRequests are arriving too quickly. Wait, then retry with exponential backoff.
500server_errorThe service could not complete the request. Keep the response and contact support if it persists.
Retry ruleRetry only transient 429 and 5xx responses. Start after 1 second, then back off to 2, 4 and 8 seconds.

Need help?

Bring the request context—not your secrets.

Share the endpoint, timestamp, HTTP status and sanitized response. Never include API keys, tokens or private message content.

Contact API support →
The secure SMSMobileAPI mobile app connecting a phone to the web dashboard and REST API for SMS and call operations
Encrypted mobile-to-platform connection

Official mobile application

The secure bridge between your phone, dashboard and API.

SMS and call operations pass through the official SMSMobileAPI app installed on your connected phone. The app securely pairs the device with your account, synchronizes authorized events and links the mobile network to the dashboard and REST API.

1Mobile appPairs the phone and its SIM 2Encrypted linkAuthenticates and protects data in transit 3Dashboard & APIControls workflows and activity
  • Signed releases distributed through the official Google Play and Apple App Store listings
  • Google and Apple platform review, signing and distribution controls
  • Secure device pairing, HTTPS transport and authenticated API access
  • Only the permissions required for the mobile features you enable
Get the official SMSMobileAPI app on Google Play Download the official SMSMobileAPI app on the Apple App Store
Capabilities depend on the permissions and background access allowed by Android or iOS.