POST /api/sms/phones/{id}/verify
Verifica OTP de 6 dígitos e marca verified_at.
- Access: Signed in
- Service:
https://messaging-api.axuz.net
Accepted authentication
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 e marca telefone como verificado.
Motivo: sem verify o /v1/notify não teria segurança quanto ao owner do número; auto-primary evita fricção adicional. Comportamento: parse UUID; decode body; exige código de 6 caracteres; TX; SELECT verification_code+expires — 404 se não pertence, 400 se ausente, 400 "code_expired" ou "invalid_code" conforme; COUNT de primary existentes; UPDATE limpa code/expires, seta verified_at=NOW(), promove is_primary automaticamente se era 0; commit; devolve Phone atualizado.
Entradas: URLParam id, JSON {code}.
Retorno: 200 Phone; 400/404/500.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | yes |
Request body
application/json · Required
| Name | Type | Required | Description |
|---|---|---|---|
code | string | yes |
{
"code": "123456"
}Responses
200
Verified.
| Name | Type | Required | Description |
|---|---|---|---|
id | string<uuid> | yes | |
phone | string | yes | |
verified_at | string<date-time> | null | no | |
verification_expires_at | string<date-time> | null | no | |
is_primary | boolean | yes | |
created_at | string<date-time> | yes |
400
invalid_code / code_expired / invalid body.
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
401
Falta cookie/bearer ou X-Axuz-Internal.
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
404
Recurso não existe (ou não pertence ao user).
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
429
Limite de requisições excedido.
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
500
Erro interno. Tente de novo com backoff; reporte o X-Request-Id.
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
Examples
"Try it" is turned off in this reference. Use the examples with your test credential.
curl
curl -sS -X POST 'https://messaging-api.axuz.net/api/sms/phones/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/sms/phones/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/sms/phones/ID/verify",
headers={
"Authorization": f"Bearer {os.environ['AXUZ_TOKEN']}",
},
json={
"code": "123456",
},
timeout=30,
)
res.raise_for_status()
print(res.json())