Webhooks API Routes
Gerenciamento de endpoints de webhook configurados pelo usuário (outbound webhooks).
GET /api/webhooks
Seção intitulada “GET /api/webhooks”Descrição: Lista webhooks configurados pelo usuário com paginação. Auth: Required
Request:
- Query params:
page,limit
Response:
- 200:
{ data: { data: Webhook[], total, page, limit, totalPages } }
POST /api/webhooks
Seção intitulada “POST /api/webhooks”Descrição: Cria um novo webhook endpoint.
Auth: Required
Audit: create webhook
Request:
- Body:
{ name, url, events, direction, ... }
Response:
- 201:
{ data: Webhook }
Notas: Gera secret automaticamente (32 bytes random hex).
GET /api/webhooks/[id]
Seção intitulada “GET /api/webhooks/[id]”Response:
- 200:
{ data: Webhook } - 404: Não encontrado
PUT /api/webhooks/[id]
Seção intitulada “PUT /api/webhooks/[id]”Descrição: Atualiza um webhook (parcial).
Audit: update webhook
Response:
- 200:
{ data: Webhook }
DELETE /api/webhooks/[id]
Seção intitulada “DELETE /api/webhooks/[id]”Audit: delete webhook
Response:
- 204: No Content
GET /api/webhooks/logs
Seção intitulada “GET /api/webhooks/logs”Descrição: Lista logs de execução de webhooks com filtros. Auth: Required
Request:
- Query params:
direction,status(“success” | “failed”),limit(default 50)
Response:
- 200:
{ "data": [{ "id": "string", "endpoint_id": "string", "direction": "inbound | outbound", "event_type": "string", "payload": "object", "response_status": "number | null", "created_at": "string" }]}Notas:
status: "success"= response_status 200-299status: "failed"= response_status >= 400 ou null- Ordenados por
created_atDESC