Nesta área
SMS
Send an SMS
post/v1/public/sms/messages
Aceita 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.
Parâmetros
idempotency-keystringobrigatório· cabeçalho
| Campo | Onde | Tipo | Descrição |
|---|---|---|---|
idempotency-keyobrigatório | cabeçalho | string |
Corpo (JSON)obrigatório
tostringobrigatório- Celular do Brasil, com DDD. Aceita +5511988887777, 5511988887777 ou 11988887777.
textstringobrigatório- Texto do SMS, até 640 caracteres. Cada 160 caracteres é um segmento e custa 2 créditos.
| Campo | Tipo | Descrição |
|---|---|---|
toobrigatório | string | Celular do Brasil, com DDD. Aceita +5511988887777, 5511988887777 ou 11988887777. |
textobrigatório | string | Texto do SMS, até 640 caracteres. Cada 160 caracteres é um segmento e custa 2 créditos. |
Respostas
202SMS accepted and queued400Invalid number, empty/too long text or no credits
Exemplos
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.
Parâmetros
idstringobrigatório· caminho- OutboundSms id returned by POST
| Campo | Onde | Tipo | Descrição |
|---|---|---|---|
idobrigatório | caminho | string | OutboundSms id returned by POST |
Respostas
200
Exemplos
bash
curl -X GET "https://api.cognizy.ai/api/v1/public/sms/messages/<id>" \
-H "Authorization: Bearer $COGNIZY_API_KEY"