Get opt-in status
Returns how many contacts are confirmed, pending, never asked or unsubscribed. Counts only, no personal data. Read-only.
GET /v1/optin-status
| Permission | contacts:read (all permissions) |
| Risk | Read |
| Idempotency-Key | Not needed (how it works) |
| Safe to repeat | Safe: the call only reads. |
| Rate limit class | read (120 requests per minute per key) |
| Confirmation | None |
| MCP tool | Not available in MCP |
| Since version | 2026-10-25 |
#What it does
- Only reads data. It changes nothing and sends nothing.
#Examples
curl "https://api.smartchat.marketing/v1/optin-status" \
-H "Authorization: Bearer $SMARTCHAT_API_KEY"import os
import requests
response = requests.get(
"https://api.smartchat.marketing/v1/optin-status",
headers={"Authorization": "Bearer " + os.environ["SMARTCHAT_API_KEY"]},
)
response.raise_for_status()
print(response.json())const response = await fetch("https://api.smartchat.marketing/v1/optin-status", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.SMARTCHAT_API_KEY}`,
},
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());Response (200):
{
"object": "optin_status",
"total": 340,
"confirmed": 250,
"pending": 10,
"none": 70,
"opted_out": 10,
"confirmation_messages_waiting": 0
}#Response
Status 200. Every response has the headers Request-Id, SmartChat-Version and X-RateLimit-*.
| Name | Type | Description |
|---|---|---|
object | string | Always "optin_status". always optin_status |
total | integer | All contacts. 0 to 1000000000 |
confirmed | integer | Contacts with a confirmed WhatsApp opt-in. 0 to 1000000000 |
pending | integer | Contacts who were asked to confirm and have not answered. 0 to 1000000000 |
none | integer | Contacts who were never asked to confirm. 0 to 1000000000 |
opted_out | integer | Contacts who unsubscribed. 0 to 1000000000 |
confirmation_messages_waiting | integer | Confirmation messages that wait until sending is possible again. 0 to 1000000000 |
#Errors
| Code | Status | When |
|---|---|---|
api_key_expired | 401 | This API key has expired. |
api_key_invalid | 401 | This API key is not valid. |
api_key_revoked | 401 | This API key was revoked. |
authentication_required | 401 | No API key was sent. Send 'Authorization: Bearer <key>'. |
account_blocked | 403 | This account is blocked. |
insufficient_scope | 403 | This key lacks a required permission. |
ip_not_allowed | 403 | This IP address is not allowed for this key. |
rate_limited | 429 | Too many requests. Wait and try again. |
internal_error | 500 | Something went wrong on our side. |
service_unavailable | 503 | The service is temporarily unavailable. |
All errors use one format.