Connect a phone by QR code in Channels and activate a plan.
In Developer access, create a public phone API key. Copy it once and store it securely. Creating another key revokes the previous one; the provider connection is unaffected.
Send a request with x-api-key. Use an assistant key only for /chat.
Numbers use international digits (8–15 digits), optionally with a leading +. JSON endpoints require Content-Type: application/json; media uses multipart/form-data and accepts JPEG, PNG, WebP or MP4 up to 10 MiB.
Rate limits: 60 v1 requests per minute per API key (or IP without a key). OTP issue is additionally limited to five requests per number per 10 minutes and 30 per device per hour. Campaign messages consume quota when each recipient is sent.
Message states are pending, accepted, sent, delivered, read, failed or unknown. Providers may skip intermediate states; status never moves backward. An unknown outcome may still be delivered.
Supply Idempotency-Key on sends, OTP issue, campaigns, and chat. Repeating the same payload returns the original result for 24 hours. A changed payload or pending request returns 409. A timeout can mean the provider accepted the send: do not automatically retry with a new key.
OTP is a device-and-number-bound, single-use code valid for five minutes with at most five verification attempts. It does not log users into SmarticBot.
Customer webhooks
Available for paid phone plans. Enable a webhook URL in phone settings, then create a signing secret in Developer access. Each delivery includes X-Webhook-ID, X-Webhook-Timestamp, X-Webhook-Key-Version and X-Webhook-Signature. Verify the hex HMAC-SHA256 signature over timestamp + "." + the exact raw JSON body. Deduplicate by event ID. Retries preserve the body and signing version.
Events include device_status_updated and message_status_updated. Provider callbacks are private; there is no public status-update endpoint.
Responses & errors
Success has success=true and a data object. Errors have success=false with error.code, error.message and error.details (an object, empty when there is nothing to add). Branch on error.code, not on the message text. Every request is limited to 60 per minute per API key.
Error codes
HTTP
error.code
When it happens
What to do
401
unauthorized
The x-api-key header is missing, invalid, expired or revoked. A phone key cannot call /chat.
No active device plan, the device is inactive, or the assistant is switched off.
Do not retry. Fix the account state first.
404
not_found
The message or campaign ID does not exist for this key.
Do not retry. Check the ID.
409
device_disconnected
The QR-connected device is not connected.
Reconnect it in Channels, then retry.
409
idempotency_conflict
This Idempotency-Key was already used with a different request.
Use a new key for a new request. Never change the payload under the same key.
409
idempotency_in_progress
The original request with this key is still running, or its outcome is unknown.
Wait, then retry with the same key. Do not send it again with a new key.
409
conversation_busy
POST /chat: this session is still processing another turn.
Retry after the Retry-After header (2 seconds). details.retryable is true.
422
validation_error
A field is missing or breaks a rule from the field tables. details lists every failing field.
Do not retry unchanged. Fix the fields.
422
otp_invalid
The code is wrong, expired, already used, or has had five attempts.
Issue a new code with POST /send-otp.
429
rate_limited
More than 60 requests per minute for this key, or too many OTP requests for one number or device.
Wait for the Retry-After header when present, then retry.
429
message_quota_exceeded
The account message quota for the current period is used up. All phones on the account share it.
Do not retry in a loop. Wait for the next period or upgrade the plan.
502
provider_rejected
The provider definitely rejected the send or the OTP.
Do not retry unchanged. Check the number and content.
503
retry_queue_full
SmarticBot has no space for this send in the retry queue.
Wait, then retry with the same idempotency key.
503
delivery_uncertain
The send outcome is unknown. details.message_id identifies it. For OTP, a code that arrives can still be verified.
Never retry with a new key. Check GET /messages/{id}, or retry with the same key.
503
chat_unavailable
POST /chat: the assistant could not complete this turn. Failed turns add no history.
Retry later with backoff, using the same key.
Error examples
Redacted examples. Real responses carry your own values.
422 · validation_error
{
"success": false,
"error": {
"code": "validation_error",
"message": "The request contains invalid fields.",
"details": {
"number": [
"The number field format is invalid."
]
}
}
}
401 · unauthorized
{
"success": false,
"error": {
"code": "unauthorized",
"message": "Invalid or expired API key.",
"details": {}
}
}
{
"success": false,
"error": {
"code": "delivery_uncertain",
"message": "The send outcome is unknown. Do not retry with a new idempotency key.",
"details": {
"message_id": "01J..."
}
}
}
Retries and idempotency
For text, media and polls, HTTP 202 with queued means SmarticBot will retry the saved request automatically for up to 24 hours. Use GET /messages/{id} to track it. A new send request may create a duplicate.
Safe to retry: 429 (after the wait), 409 conversation_busy, 503 chat_unavailable, 409 idempotency_in_progress, and network timeouts. Use exponential backoff with jitter, for example about 1 s, 2 s, 4 s, up to five tries.
Send an Idempotency-Key on every send, OTP issue, campaign creation and chat turn. Create a new unique value (a UUID works) for each new operation, and reuse it only to retry that same request. Keys are scoped to your key and the operation, and remembered for 24 hours.
A replayed response is the original response with the header Idempotency-Replayed: true. The same key with a different payload returns 409 idempotency_conflict.
After a timeout or a 503 on a send, do not send it again with a new key: the message may already have gone out. Check GET /messages/{id} (the id is in details.message_id), or retry with the same key.
Changelog
2026-11-26 — Documentation: field tables now show every constraint in the OpenAPI file (lengths, item limits, uniqueness, enums, file limits) and each endpoint lists its headers and path parameters. Added the error catalogue, examples and retry guidance.
2026-11-13 — Legacy keys tied to provider identities stopped working. Use public keys created in Developer access.
2026-10-22 — Public API v1 reworked: idempotent sends, message quota reservation, signed customer webhooks and verifiable OTP codes (five minutes, five attempts, single use). Campaign recipients are a JSON array of 1–500 unique numbers and scheduled_at must include a timezone offset. The public device and message status-update endpoints were removed, and request_id is no longer used.
Messages
Send text
POST/api/v1/send-message
Parameters
Name
In
Required
Type
Rules
Idempotency-Key
header
No
string
1–128 characters · Replay the same principal, operation and payload for 24 hours. Changed or pending requests return 409.
Request fields
Field
Type
Required
Rules
number
string
Yes
matches ^\+?[1-9][0-9]{7,14}$ · International digits with optional leading +. Example is an illustrative Yemeni mobile number; replace it with your intended recipient.
message
string
Yes
1–4096 characters
Possible HTTP statuses
202401409422429502503
Response data fields
Field
Type
Required
Rules
id
string
Yes
Public message ID for GET /messages/{id}
status
string
Yes
one of: accepted, queued · Accepted by WhatsApp or stored for automatic retry for up to 24 hours. Poll the message ID for the current status.
1–128 characters · Replay the same principal, operation and payload for 24 hours. Changed or pending requests return 409.
Request fields (multipart/form-data)
Field
Type
Required
Rules
number
string
Yes
matches ^\+?[1-9][0-9]{7,14}$ · International digits with optional leading +. Example is an illustrative Yemeni mobile number; replace it with your intended recipient.
media
file
Yes
JPEG, PNG, WebP or MP4; 10 MiB maximum
caption
string
No
up to 3500 characters
Possible HTTP statuses
202401409422429502503
Response data fields
Field
Type
Required
Rules
id
string
Yes
Public message ID for GET /messages/{id}
status
string
Yes
one of: accepted, queued · Accepted by WhatsApp or stored for automatic retry for up to 24 hours. Poll the message ID for the current status.
1–128 characters · Replay the same principal, operation and payload for 24 hours. Changed or pending requests return 409.
Request fields
Field
Type
Required
Rules
number
string
Yes
matches ^\+?[1-9][0-9]{7,14}$ · International digits with optional leading +. Example is an illustrative Yemeni mobile number; replace it with your intended recipient.
poll_question
string
Yes
1–255 characters
poll_options
array of string
Yes
2–12 items · unique · each item: 1–255 characters
allow_multiple_answers
boolean
No
default: false
Possible HTTP statuses
202401409422429502503
Response data fields
Field
Type
Required
Rules
id
string
Yes
Public message ID for GET /messages/{id}
status
string
Yes
one of: accepted, queued · Accepted by WhatsApp or stored for automatic retry for up to 24 hours. Poll the message ID for the current status.
1–128 characters · Replay the same principal, operation and payload for 24 hours. Changed or pending requests return 409.
Request fields
Field
Type
Required
Rules
number
string
Yes
matches ^\+?[1-9][0-9]{7,14}$ · International digits with optional leading +. Example is an illustrative Yemeni mobile number; replace it with your intended recipient.
matches ^\+?[1-9][0-9]{7,14}$ · International digits with optional leading +. Example is an illustrative Yemeni mobile number; replace it with your intended recipient.
Send a turn to an assistant using an assistant key
POST/api/v1/chat
Each assistant has its own API key. The key in x-api-key selects that assistant. Reuse session_id for follow-up turns: the last 10 successful turns from this assistant and session in the previous 30 days are sent as context. Use a new value for a new conversation; send turns for one session sequentially. Prior context consumes input tokens and may increase credits used. A phone key cannot call this endpoint.
Parameters
Name
In
Required
Type
Rules
Idempotency-Key
header
No
string
1–128 characters · Replay the same principal, operation and payload for 24 hours. Changed or pending requests return 409.
Request fields
Field
Type
Required
Rules
session_id
string
Yes
1–128 characters · Caller-chosen conversation identifier, scoped to this assistant. Reuse it for follow-up turns; use a new value for a new conversation.
message
string
Yes
1–4096 characters
Possible HTTP statuses
200401402403409422503
Response data fields
Field
Type
Required
Rules
reply
string
Yes
tokens
integer
Yes
at least 0
credits_used
integer
Yes
at least 0
Request
curl -X POST https://smarticbot.com/api/v1/chat \
-H 'x-api-key: YOUR_PUBLIC_ASSISTANT_KEY' \
-H 'Content-Type: application/json' \
-d '{
"session_id": "customer-42",
"message": "What are your opening hours?"
}'
Success response
{
"success": true,
"data": {
"reply": "We are open 9–5.",
"tokens": 120,
"credits_used": 2
}
}