POST /api/whatsapp/subscriptions/{id}/verify
Verifica OTP 6 dígitos; marca verified_at + opted_in_at.
- Acesso: Login
- Serviço:
https://messaging-api.axuz.net
Autenticação aceita
sessionCookie— Sessão plena Axuz (cookie de sessão da casa). Sessão restrita é 403 enrollment_required.bearerSession— JWT de acesso da sessão em `Authorization: Bearer`.
Valida OTP, marca verified_at + opted_in_at e propaga em users.
Motivo: sem verify o /v1/notify não teria proof-of-ownership; cache em users.whatsapp_phone_e164 evita JOIN em cada dispatch de reminder. Comportamento: parse UUID; decode body; exige código 6 chars; TX; SELECT verification_code+expires+phone_e164 — 404 se não pertence, 400 invalid/expired/mismatch; UPDATE whatsapp_subscriptions com verified_at=NOW e limpa code/expires; UPDATE users cache (falha silenciosa se coluna não existe em dev); commit; devolve subscription atualizada.
Entradas: URLParam id, JSON {code}.
Retorno: 200 WhatsAppSubscription; 400/404/500.
Parâmetros
| Nome | Em | Tipo | Obrigatório | Descrição |
|---|---|---|---|---|
id | path | string | sim |
Corpo da requisição
application/json · Obrigatório
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
code | string | sim |
{
"code": "123456"
}Respostas
200
Verified.
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
id | string<uuid> | sim | |
phone_e164 | string | sim | |
verified_at | string<date-time> | null | não | |
opted_in_at | string<date-time> | null | não | |
verification_expires_at | string<date-time> | null | não | |
created_at | string<date-time> | sim |
400
invalid_code / code_expired / bad body.
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
401
Falta cookie/bearer ou X-Axuz-Internal.
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
404
Recurso não existe (ou não pertence ao user).
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
429
Limite de requisições excedido.
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
500
Erro interno. Tente de novo com backoff; reporte o X-Request-Id.
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
Exemplos
O "Try it" está desligado nesta referência. Use os exemplos com a sua credencial de teste.
curl
curl -sS -X POST 'https://messaging-api.axuz.net/api/whatsapp/subscriptions/ID/verify' \
-H "Authorization: Bearer $AXUZ_TOKEN" \
-H "Content-Type: application/json" \
-d '{"code":"123456"}'Node.js
const res = await fetch("https://messaging-api.axuz.net/api/whatsapp/subscriptions/ID/verify", {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.AXUZ_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"code": "123456"
}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
console.log(await res.json());Python
import os
import requests
res = requests.request(
"POST",
"https://messaging-api.axuz.net/api/whatsapp/subscriptions/ID/verify",
headers={
"Authorization": f"Bearer {os.environ['AXUZ_TOKEN']}",
},
json={
"code": "123456",
},
timeout=30,
)
res.raise_for_status()
print(res.json())