---
title: "Webhooks · Referência REST"
description: "As rotas de Webhooks. Todo corpo é JSON, e o erro sempre volta como um objeto com código e mensagem."
lang: "pt-BR"
canonical: "https://zaiped.com/developers/docs/reference/webhooks"
alternate: "https://zaiped.com/en/developers/docs/reference/webhooks"
---

# Webhooks · Referência REST

## GET /v1/webhooks

List webhook endpoints

**Resposta (object[])**

- `id` · string (Obrigatório): Zaiped id (developerWebhooks)
- `url` · string (Obrigatório)
- `events` · string[] (Obrigatório)
- `enabled` · boolean (Obrigatório)
- `createdAt` · number (Obrigatório)
- `lastDeliveryAt` · number
- `lastFailureAt` · number

```
curl -X GET "https://zaiped.com/v1/webhooks" \
  -H "Authorization: Bearer zp_..."
```

## POST /v1/webhooks

Create a webhook endpoint

Registers an HTTPS URL for the given events (`message.received`, `message.status`, `template.status`, `number.update`, `account.notice`, `call.event`). The signing secret is returned once: verify `X-Zaiped-Signature` (`t=TIMESTAMP,v1=HEX`, where HEX is the HMAC-SHA256 of `TIMESTAMP.BODY`) with it.

**Corpo da requisição**

- `url` · string (Obrigatório)
- `events` · string[] (Obrigatório)

**Resposta (object)**

- `id` · string (Obrigatório): Zaiped id (developerWebhooks)
- `url` · string (Obrigatório)
- `events` · string[] (Obrigatório)
- `secret` · string (Obrigatório)

```
curl -X POST "https://zaiped.com/v1/webhooks" \
  -H "Authorization: Bearer zp_..." \
  -H "Content-Type: application/json" \
  -d '{
  "url": "…",
  "events": []
}'
```

## GET /v1/webhooks/{webhookId}

Get a webhook endpoint

**Parâmetros de caminho**

- `webhookId` · string (Obrigatório): The webhook id, as returned by list_webhooks.

**Resposta (object)**

- `id` · string (Obrigatório): Zaiped id (developerWebhooks)
- `url` · string (Obrigatório)
- `events` · string[] (Obrigatório)
- `enabled` · boolean (Obrigatório)
- `createdAt` · number (Obrigatório)
- `lastDeliveryAt` · number
- `lastFailureAt` · number

```
curl -X GET "https://zaiped.com/v1/webhooks/YOUR_WEBHOOK_ID" \
  -H "Authorization: Bearer zp_..."
```

## PUT /v1/webhooks/{webhookId}

Update a webhook endpoint

**Parâmetros de caminho**

- `webhookId` · string (Obrigatório): The webhook id.

**Corpo da requisição**

- `url` · string
- `events` · string[]
- `enabled` · boolean

**Resposta (object)**

- `id` · string (Obrigatório): Zaiped id (developerWebhooks)
- `url` · string (Obrigatório)
- `events` · string[] (Obrigatório)
- `enabled` · boolean (Obrigatório)
- `createdAt` · number (Obrigatório)
- `lastDeliveryAt` · number
- `lastFailureAt` · number

```
curl -X PUT "https://zaiped.com/v1/webhooks/YOUR_WEBHOOK_ID" \
  -H "Authorization: Bearer zp_..." \
  -H "Content-Type: application/json" \
  -d '{}'
```

## DELETE /v1/webhooks/{webhookId}

Delete a webhook endpoint

**Parâmetros de caminho**

- `webhookId` · string (Obrigatório): The webhook id.

**Resposta (object)**

- `ok` · true (Obrigatório)

```
curl -X DELETE "https://zaiped.com/v1/webhooks/YOUR_WEBHOOK_ID" \
  -H "Authorization: Bearer zp_..."
```

## POST /v1/webhooks/{webhookId}/test

Send a test event

Queues a `test` event to this endpoint, signed like any other.

**Parâmetros de caminho**

- `webhookId` · string (Obrigatório): The webhook id.

**Resposta (object)**

- `deliveryId` · string (Obrigatório): Zaiped id (developerWebhookDeliveries)

```
curl -X POST "https://zaiped.com/v1/webhooks/YOUR_WEBHOOK_ID/test" \
  -H "Authorization: Bearer zp_..."
```

## GET /v1/webhooks/{webhookId}/deliveries

List recent deliveries

The last deliveries to this endpoint, newest first, with the attempt count and the last HTTP status.

**Parâmetros de caminho**

- `webhookId` · string (Obrigatório): The webhook id.

**Resposta (object[])**

- `id` · string (Obrigatório): Zaiped id (developerWebhookDeliveries)
- `event` · string (Obrigatório)
- `status` · "pending" | "delivered" | "failed" (Obrigatório)
- `attempts` · number (Obrigatório)
- `lastStatusCode` · number
- `lastError` · string
- `nextAttemptAt` · number
- `createdAt` · number (Obrigatório)

```
curl -X GET "https://zaiped.com/v1/webhooks/YOUR_WEBHOOK_ID/deliveries" \
  -H "Authorization: Bearer zp_..."
```