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

# Webhooks

> Receive verification results on your backend.

Webhooks are the preferred way to receive results. The result is sent to your endpoint as a `POST` with a JSON body in the same structure as `GET /api/v1/application/{id}`.

## Set up

* **Global:** Backoffice → Settings → Webhooks. Notifications go to all configured endpoints.
* **Per flow:** Flows → \[flow name] → Webhooks, then enable **Use own webhooks**. Events from that flow then trigger only the flow's webhooks, and the global webhooks are disabled for it.
* **Signature key:** Backoffice → Settings → Webhooks → Signature key. It differs between sandbox and production.

## Events

Webhooks are sent for two kinds of events.

### Application events

Events that just occurred at application level: the application was created, verified or changed.

| Event | Sent when |
| - | - |
| `application.created` | The application is created |
| `application.verified` | The application is verified |
| `application.error` | An error occurred with the application |
| `application.changed` | The application status is updated |

`application.changed` is also sent when the status is changed by hand in the Backoffice or through the API, if that event is enabled. See [Review requests](https://docs.checkin.com/backoffice/requests.md).

### SDK events

Callbacks on events that just occurred on the verification steps in the SDK, on the client side.

| Event | Sent when |
| - | - |
| `sdk.init` | The SDK is initialized |
| `sdk.completed` | The applicant completed the SDK flow |
| `sdk.stepComplete` | The applicant completed a step in the SDK flow |

## Delivery

| | |
| - | - |
| Method | `POST`, JSON body |
| Headers | `X-Signature`, `X-Timestamp` |
| Acknowledge | Return `200` |
| Retries | Every 5 seconds until your endpoint returns `200` |
| Failure | Marked as failed after 5 minutes without a `200` |
| Sender IPs | Sandbox: dynamic. Production: fixed range. |

## Verify the signature

The signature uses EdDSA (Ed25519). The signed message is the HTTP body followed by the `X-Timestamp` value. `X-Signature` is Base64-encoded.

Verify against the raw request body. Re-serialising parsed JSON may not reproduce the exact bytes that were signed.

```javascript Node.js (Express) theme={null}
import crypto from 'node:crypto';
import express from 'express';

const publicKey = crypto.createPublicKey(process.env.CHECKIN_WEBHOOK_PUBLIC_KEY_PEM);
const app = express();

app.post('/webhooks/checkin', express.raw({ type: 'application/json' }), (req, res) => {
  const signature = req.get('X-Signature');
  const timestamp = req.get('X-Timestamp');
  if (!signature || !timestamp) return res.sendStatus(400);

  const message = Buffer.concat([req.body, Buffer.from(timestamp, 'utf8')]);
  const valid = crypto.verify(null, message, publicKey, Buffer.from(signature, 'base64'));
  if (!valid) return res.sendStatus(401);

  const result = JSON.parse(req.body.toString('utf8'));
  // store result, then process it
  res.sendStatus(200);
});
```

```python Python (Flask) theme={null}
import base64, os
from flask import Flask, request, abort
from cryptography.hazmat.primitives.serialization import load_pem_public_key
from cryptography.exceptions import InvalidSignature

public_key = load_pem_public_key(os.environ["CHECKIN_WEBHOOK_PUBLIC_KEY_PEM"].encode())
app = Flask(__name__)

@app.post("/webhooks/checkin")
def checkin_webhook():
    signature = request.headers.get("X-Signature")
    timestamp = request.headers.get("X-Timestamp")
    if not signature or not timestamp:
        abort(400)
    try:
        public_key.verify(base64.b64decode(signature), request.get_data() + timestamp.encode("utf-8"))
    except InvalidSignature:
        abort(401)
    result = request.get_json()
    # store result, then process it
    return "", 200
```

## Build a reliable receiver

* **Acknowledge fast.** Verify the signature, store the payload, return `200`, and do slow work afterwards. Delivery is marked as failed after 5 minutes without a `200`.
* **Expect repeats.** Failed deliveries are retried, so the same result can arrive more than once. Make processing safe to repeat.
* **Check `processingState`.** Act on the result only when it is `done`.
* **Have a fallback.** If no result arrives for an application in the time you expect, [fetch it from the API](https://docs.checkin.com/integrate/results/retrieve-results.md).


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