In this area
SMS
Send an SMS
post/v1/public/sms/messages
Accepts Idempotency-Key
Sends one SMS to a Brazilian mobile number. Costs 2 credits per 160-character segment, charged once the carrier route accepts it; the send is refused up front (code INSUFFICIENT_CREDITS) if the balance does not cover it. Returns 202 with the queued id. Pass an Idempotency-Key header to retry safely without sending twice.
Parameters
idempotency-keystringrequired· header
| Field | In | Type | Description |
|---|---|---|---|
idempotency-keyrequired | header | string |
Body (JSON)required
tostringrequired- Celular do Brasil, com DDD. Aceita +5511988887777, 5511988887777 ou 11988887777.
textstringrequired- Texto do SMS, até 640 caracteres. Cada 160 caracteres é um segmento e custa 2 créditos.
| Field | Type | Description |
|---|---|---|
torequired | string | Celular do Brasil, com DDD. Aceita +5511988887777, 5511988887777 ou 11988887777. |
textrequired | string | Texto do SMS, até 640 caracteres. Cada 160 caracteres é um segmento e custa 2 créditos. |
Responses
202SMS accepted and queued400Invalid number, empty/too long text or no credits
Examples
bash
curl -X POST "https://api.cognizy.ai/api/v1/public/sms/messages" \
-H "Authorization: Bearer $COGNIZY_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"to": "+5511988887777",
"text": "Seu código de acesso é 482913."
}'Get the status of a sent SMS
get/v1/public/sms/messages/{id}
Statuses: QUEUED → SENT → DELIVERED, or FAILED. Status never moves backwards.
Parameters
idstringrequired· path- OutboundSms id returned by POST
| Field | In | Type | Description |
|---|---|---|---|
idrequired | path | string | OutboundSms id returned by POST |
Responses
200
Examples
bash
curl -X GET "https://api.cognizy.ai/api/v1/public/sms/messages/<id>" \
-H "Authorization: Bearer $COGNIZY_API_KEY"