Axuz Developers

POST /api/whatsapp/subscribe

Opt-in WhatsApp — envia OTP via template `axuz_otp`.

  • 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`.

WhatsApp Cloud exige template pré-aprovado; sem creds a subscription nem é criada (503). Rate limit compartilhado com SMS (3/h/user).

Parameters

No parameters.

Request body

application/json · Required

NameTypeRequiredDescription
phonestringyes
{
  "phone": "+5511999998888"
}

Responses

201

Subscription criada (OTP enviado).

NameTypeRequiredDescription
idstring<uuid>yes
phone_e164stringyes
verified_atstring<date-time> | nullno
opted_in_atstring<date-time> | nullno
verification_expires_atstring<date-time> | nullno
created_atstring<date-time>yes

400

Body inválido ou parâmetro fora do esperado.

NameTypeRequiredDescription
errorstringyes

401

Falta cookie/bearer ou X-Axuz-Internal.

NameTypeRequiredDescription
errorstringyes

429

Rate limit por user excedido.

NameTypeRequiredDescription
errorstringyes

500

Falha inesperada no server.

NameTypeRequiredDescription
errorstringyes

502

Meta recusou o envio (rollback do OTP na row).

NameTypeRequiredDescription
errorstringyes

503

WHATSAPP_TOKEN/PHONE_ID não configurados.

NameTypeRequiredDescription
errorstringyes

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/whatsapp/subscribe' \
  -H "Authorization: Bearer $AXUZ_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"phone":"+5511999998888"}'

Node.js

const res = await fetch("https://messaging-api.axuz.net/api/whatsapp/subscribe", {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.AXUZ_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "phone": "+5511999998888"
  }),
});
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/subscribe",
    headers={
        "Authorization": f"Bearer {os.environ['AXUZ_TOKEN']}",
    },
    json={
        "phone": "+5511999998888",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())