smartchat

Create opt-in confirmations

Sends the opt-in confirmation message by WhatsApp to chosen contacts who have not confirmed yet. Call without plan_id for a preview, then again with the plan_id and a new Idempotency-Key. Returns the preview or the queued count.

POST /v1/optin-confirmations

Permissionsends:create and newsletters:send (all permissions)
RiskSend (reaches other people)
Idempotency-KeyRequired (how it works)
Safe to repeatSafe to repeat with the same Idempotency-Key: the first answer comes back and nothing is done twice.
Rate limit classsend (120 requests per minute per key)
ConfirmationPreview first, then the call with the plan ID
MCP toolsend_optin_confirmations
Since version2026-10-25

#What it does

  • Sends WhatsApp messages to contacts.
  • Needs a confirmation step (a preview first).
  • Safe to repeat with the same Idempotency-Key.

#Request

Header

NameRequiredDescription
AuthorizationyesBearer <key>
Idempotency-KeyyesA unique value for this operation, for example a UUID (1 to 255 visible ASCII characters).

Body (JSON)

NameTypeRequiredDescription
contact_idsarray of stringyesThe contacts that should get the confirmation message (1 to 500). Only contacts with opt-in status none qualify. up to 500 items
plan_idstringnoPlan ID from the preview call. Leave out to get a preview.

#Examples

curl -X POST "https://api.smartchat.marketing/v1/optin-confirmations" \
  -H "Authorization: Bearer $SMARTCHAT_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "contact_ids": [
    "con_0f8c1a2e4b7d4c3e9a5b6d7e8f901234"
  ]
}'
import os
import uuid
import requests

response = requests.post(
    "https://api.smartchat.marketing/v1/optin-confirmations",
    headers={
        "Authorization": "Bearer " + os.environ["SMARTCHAT_API_KEY"],
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "contact_ids": [
            "con_0f8c1a2e4b7d4c3e9a5b6d7e8f901234",
        ],
    },
)
response.raise_for_status()
print(response.json())
const response = await fetch("https://api.smartchat.marketing/v1/optin-confirmations", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SMARTCHAT_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "contact_ids": [
      "con_0f8c1a2e4b7d4c3e9a5b6d7e8f901234"
    ]
  }),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());

Response (202):

{
  "object": "optin_confirmation_plan",
  "plan_id": "pln_5e6f7a8b9c0d41e2f3a4b5c6d7e8f901",
  "expires_at": "2026-10-25T09:51:07Z",
  "recipients": 1,
  "days": 1,
  "daily_limit": 250,
  "can_start": true,
  "template_state": "sendable",
  "truncated": false
}

#Response

Status 202. Every response has the headers Request-Id, SmartChat-Version and X-RateLimit-*.

#Errors

CodeStatusWhen
bad_request400The request could not be read.
idempotency_key_invalid400The 'Idempotency-Key' header must be 1 to 255 visible ASCII characters.
idempotency_key_required400This call needs an 'Idempotency-Key' header.
missing_parameter400A required field is missing.
unknown_parameter400A field is not known.
api_key_expired401This API key has expired.
api_key_invalid401This API key is not valid.
api_key_revoked401This API key was revoked.
authentication_required401No API key was sent. Send 'Authorization: Bearer <key>'.
account_blocked403This account is blocked.
insufficient_scope403This key lacks a required permission.
ip_not_allowed403This IP address is not allowed for this key.
subscription_locked403The subscription or payment state blocks this function.
plan_not_found404No plan with this ID exists.
conflict409The state of the object does not allow this.
idempotency_in_progress409A request with this idempotency key is still running.
plan_already_used409The plan was already used.
plan_changed409The content or audience changed after the preview.
plan_mismatch409The plan belongs to another account, key, action or request.
plan_expired410The plan is older than 10 minutes.
audience_empty422The audience has no reachable contacts.
idempotency_key_reused422This idempotency key was already used with a different request.
template_not_approved422The template is not approved.
validation_failed422A field is not valid.
rate_limited429Too many requests. Wait and try again.
internal_error500Something went wrong on our side.
service_unavailable503The service is temporarily unavailable.

All errors use one format.