Axuz Developers

DELETE /api/whatsapp/subscriptions/{id}

Remove subscription; limpa cache em `users` se foi a última.

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

Remove uma subscription; limpa cache em users se última.

Motivo: dispatch de reminders consulta users.whatsapp_phone_e164 direto; se a última subscription vai embora, o cache tem que zerar pra evitar envio pra número órfão. Comportamento: parse UUID; TX; DELETE por (id, user_id) — 404 se não afetar linha; COUNT das opted_in restantes; se zero, UPDATE users limpando cache; commit; 200 {"deleted": true}.

Entradas: URLParam id.

Retorno: 200; 400/404/500.

Parameters

NameInTypeRequiredDescription
idpathstringyes

Responses

200

Deletada.

NameTypeRequiredDescription
deletedbooleanyes

enum: true

400

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

NameTypeRequiredDescription
errorstringyes

401

Falta cookie/bearer ou X-Axuz-Internal.

NameTypeRequiredDescription
errorstringyes

404

Recurso não existe (ou não pertence ao user).

NameTypeRequiredDescription
errorstringyes

429

Limite de requisições excedido.

NameTypeRequiredDescription
errorstringyes

500

Erro interno. Tente de novo com backoff; reporte o X-Request-Id.

NameTypeRequiredDescription
errorstringyes

Examples

"Try it" is turned off in this reference. Use the examples with your test credential.

curl

curl -sS -X DELETE 'https://messaging-api.axuz.net/api/whatsapp/subscriptions/ID' \
  -H "Authorization: Bearer $AXUZ_TOKEN"

Node.js

const res = await fetch("https://messaging-api.axuz.net/api/whatsapp/subscriptions/ID", {
  method: 'DELETE',
  headers: {
    Authorization: `Bearer ${process.env.AXUZ_TOKEN}`,
  },
});
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(
    "DELETE",
    "https://messaging-api.axuz.net/api/whatsapp/subscriptions/ID",
    headers={
        "Authorization": f"Bearer {os.environ['AXUZ_TOKEN']}",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())