> ## Documentation Index
> Fetch the complete documentation index at: https://vetta.sh/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhooks

> Get a signed POST when an identity's inbox receives mail, or when an approval is requested or decided.

Webhooks push events to your server. Endpoints, signatures, retries and redelivery work exactly as described in
[Webhooks](https://vetta.sh/docs/capabilities/webhooks.md) and the [webhooks API](https://vetta.sh/docs/api/webhooks.md); this page covers the events developer
workspaces use most.

## Events

| Event | When | `data` |
| - | - | - |
| `email.received` | An identity's inbox received a message. | `{ inbox_id, identity_id, message_id, from, subject, received_at }` |
| `approval.requested` | A call was held for approval. | `{ approval_id, action, identity_id, status }` |
| `approval.decided` | A person approved or denied it. An approval that expires is not announced. | `{ approval_id, action, identity_id, status }` |

These events must be **named** in `events`. An endpoint subscribed to `["*"]` keeps receiving exactly the set it
received before, so existing endpoints see no new traffic.

## Subscribe to inbound mail

```bash curl theme={"system"}
curl https://api.vetta.sh/v1/webhooks \
  -H "Authorization: Bearer $NAIVE_API_KEY" -H "Content-Type: application/json" \
  -d '{ "url": "https://example.com/hooks/naive", "events": ["email.received"] }'
```

```ts TypeScript theme={"system"}
const hook = await client.webhooks.create({
  url: "https://example.com/hooks/naive",
  events: ["email.received"],
});
console.log(hook.secret); // shown once; verify deliveries with it
```

A delivery:

```json theme={"system"}
{
  "id": "evt_01JD7T5P7R9T1V3X5Z7B9D1F3H",
  "type": "email.received",
  "created_at": "2026-12-01T10:04:00Z",
  "data": {
    "inbox_id": "eml_01JD7Q3S8W2N4V6X8Z0B2C4D6F",
    "identity_id": "idn_01JD7Q2R5T7V9X1Z3B5D7F9H1K",
    "message_id": "inb_01JD7T5N3Q5S7U9W1Y3A5C7E9G",
    "from": "customer@example.com",
    "subject": "Re: Hello",
    "received_at": "2026-12-01T10:03:58Z"
  }
}
```

The payload carries no message body. Fetch the message with `GET /v1/identities/{id}/messages`, then reply from the
same inbox with `POST /v1/identities/{id}/emails/{eid}/send`.

Verify every delivery's signature before trusting it; see
[Delivery and verification](https://vetta.sh/docs/capabilities/webhooks.md#delivery--verification).

## From the CLI

```bash theme={"system"}
naive webhook add --url https://example.com/hooks/naive --events email.received
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.