POST
https://api.myidvirtual.com
/
webhooks
Criar Webhook
curl --request POST \
  --url https://api.myidvirtual.com/webhooks \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "url": "<string>",
  "method": "<string>",
  "authorization": "<string>",
  "events": [
    {}
  ]
}
'
{
  "id": "webhook-id-123",
  "url": "https://seu-servidor.com/webhook",
  "method": "POST",
  "authorization": "Bearer token123",
  "events": ["payment.created", "payment.confirmed"],
  "status": "active",
  "createdAt": "2024-01-15T10:30:00.000Z"
}

Criar Webhook

Endpoint para criar um novo webhook que receberá notificações de eventos do sistema.

Autenticação

Authorization
string
required
Bearer token JWT do usuário autenticado

Request Body

url
string
required
URL que receberá as notificações
method
string
Método HTTP: GET, POST, PUT, PATCH, DELETE (padrão: POST)
authorization
string
Token de autorização para o webhook
events
array
Lista de eventos que ativarão o webhook

Responses

{
  "id": "webhook-id-123",
  "url": "https://seu-servidor.com/webhook",
  "method": "POST",
  "authorization": "Bearer token123",
  "events": ["payment.created", "payment.confirmed"],
  "status": "active",
  "createdAt": "2024-01-15T10:30:00.000Z"
}

Exemplo de Requisição

curl --location --request POST 'http://localhost:3333/webhooks' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' \
--header 'Content-Type: application/json' \
--data-raw '{
  "url": "https://seu-servidor.com/webhook",
  "method": "POST",
  "authorization": "Bearer token123",
  "events": ["payment.created", "payment.confirmed"]
}'
Configure webhooks para automatizar processos como confirmação de pagamentos e notificações de eventos.