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

# Webhook events

A webhook is an HTTP callback. When something happens to a document, Circularo sends a `POST` request to a URL you registered, so your system hears about it instead of asking. Webhooks can be registered in the Circularo web app or through the API ([Webhooks endpoints](https://developers.circularo.com/api-v2/webhooks)) — this page describes what Circularo sends, whichever way the webhook was created.

## Document events

A webhook belongs to an organization and receives the events of that organization's documents.

| Event | Sent when |
| - | - |
| `documentCreated` | a document is created |
| `documentEdited` | a document is edited |
| `documentDeleted` | a document is deleted permanently — moving it to the trash sends no event |
| `signRequest` | a document is sent to recipients for signature |
| `signDelegated` | a recipient hands their action over to someone else |
| `signRejected` | a recipient rejects the document |
| `signExpired` | a recipient's deadline passes — a `signCancelled` for the same document is sent alongside it |
| `signCancelled` | a recipient's request is withdrawn — the transaction is cancelled, a recipient is removed, a deadline passes, or the document is deleted permanently while recipients are still pending |
| `documentSigned` | someone signs the document |
| `documentCompleted` | the document's transaction completes |
| `documentSimpleActionExecuted` | a recipient approves, reviews or accepts the document |

Branch on the events you care about and ignore the rest. More events can be added over time, so a receiver that treats an unrecognized `event` as a no-op keeps working.

## The payload

Every delivery is a JSON `POST` carrying these fields, and nothing else:

```json theme={null}
{
  "documentId": "9ff53f87-e82b-472b-908e-ad1fd298ac58",
  "event": "documentCreated",
  "actor": "john.smith@example.com",
  "timestamp": "2024-06-01T13:10:10.500Z"
}
```

`documentId` is the document the event happened to, `event` the name of the event from the list above, `actor` the user who caused it, and `timestamp` when it happened. `actor` is `null` when the event was caused by the system itself rather than a person — a recipient's deadline passing, for example.

The notification carries no document content — it is a pointer. Read the document itself when you need more than the fact that something changed.

## Delivery

A delivery is attempted once and is not repeated: a receiver that fails, or does not answer promptly, loses that notification. Acknowledge the request first and do your own work afterwards.

A webhook registered through the API delivers to `https` addresses only.

## Securing the deliveries

To prevent spoofing, a webhook can authenticate its deliveries in one of two ways: with an HMAC signature of the payload, or with HTTP Basic credentials. Both are optional, and a webhook uses one of them, never both.

To use the HMAC, specify the `hmacSecret` field when creating the webhook. HMAC uses the SHA256 algorithm and hexadecimal encoding, and is computed over the complete payload buffer. The hash is presented in the `X-Circularo-Signature` header.

To verify that a callback request really comes from Circularo, compute your own HMAC hash over the received payload buffer — before parsing it, since re-serializing JSON changes the bytes — and check that it matches the signature in the header. The [React to events with webhooks](https://developers.circularo.com/guides/robust-integrations/webhooks.md) guide includes a receiver that does this, with a timing-safe comparison.

With HTTP Basic authentication instead, specify `basicAuth` with a `username` and a `password` when creating the webhook, and every delivery carries them in an ordinary `Authorization: Basic` header. The password is write-only and never returned.

## In this section

> [card] [Manage webhooks in the web app](https://developers.circularo.com/webhooks/manage-webhooks-in-the-web-app.md)
>
> Create, edit and delete webhooks in the administration of the web app, without writing code.


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