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

# Events and webhooks

> Hear about changes in your account by polling events or receiving webhooks

Alex records an **event** when something changes in your account: an application moves stage, an interview is evaluated, a handoff is booked. Read events in two ways:

* **Poll** [`GET /events`](https://docs.alex.com/api-reference/v2/events/list).
* **Receive webhooks**: register a [webhook endpoint](https://docs.alex.com/api-reference/v2/webhook-endpoints/create.md) and Alex sends each event to it.

Both carry the same event objects. Events are recorded once your company has an API key or a webhook endpoint, and kept for 30 days.

## The event object

```json theme={null}
{
  "object": "event",
  "id": "9d4c2b1a-8e7f-4a6b-9c5d-3e2f1a0b9c8d",
  "type": "application.stage_changed",
  "created_at": "2026-11-30T14:05:12.000Z",
  "data": {
    "application_id": "e7a3c1f0-9b2d-4c8e-a6f5-3d1b0c9e8f72",
    "candidate_id": "5d2c7a90-1f4e-4b6a-8c3d-9e0f1a2b3c4d",
    "job_id": "8b1f0c52-3e4a-4d8e-9a77-2f6c1d0b9e31",
    "stage": { "id": "s9e8d7c6-b5a4-4321-8fed-cba987654321", "label": "Screening", "category": "in_progress" },
    "previous_stage": { "id": "s1a2b3c4-d5e6-4f78-9abc-def012345678", "label": "New", "category": "not_started" }
  }
}
```

Events are **thin**: `data` holds the ids of what changed and the few fields needed to route the event. Fetch the object for its current state. By the time you read an event, the object may have changed again.

## Event types

| Type | When | `data` |
| - | - | - |
| `application.created` | An application is created. | `application_id`, `candidate_id`, `job_id` |
| `application.stage_changed` | An application moves to another stage. | `application_id`, `candidate_id`, `job_id`, `stage`, `previous_stage` |
| `application.round_advanced` | An application's current round changes. | `application_id`, `candidate_id`, `job_id`, `round_number` |
| `application.withdrawn` | The candidate withdraws. | `application_id`, `candidate_id`, `job_id` |
| `interview.started` | The candidate starts an interview. | `interview_id`, `application_id`, `candidate_id`, `job_id`, `round_number` |
| `interview.completed` | An interview ends. | `interview_id`, `application_id`, `candidate_id`, `job_id`, `round_number` |
| `interview.evaluated` | An interview's evaluation is ready. | `interview_id`, `application_id`, `candidate_id`, `job_id`, `round_number` |
| `handoff.scheduled` | A meeting with a recruiter is booked. | `handoff_id`, `interview_id`, `application_id`, `candidate_id`, `job_id`, `round_number` |
| `handoff.completed` | The meeting took place. | `handoff_id`, `interview_id`, `application_id`, `candidate_id`, `job_id`, `round_number` |
| `handoff.missed` | The meeting was missed. | `handoff_id`, `interview_id`, `application_id`, `candidate_id`, `job_id`, `round_number` |
| `handoff.cancelled` | The recruiter, or the API, cancelled the handoff. | `handoff_id`, `interview_id`, `application_id`, `candidate_id`, `job_id`, `round_number` |
| `handoff.reopened` | A cancelled handoff is reopened for booking. | `handoff_id`, `interview_id`, `application_id`, `candidate_id`, `job_id`, `round_number` |
| `job.created` | A job is created. | `job_id` |
| `job.updated` | A job, or one of its rounds, changes. | `job_id` |
| `job.deleted` | A job is deleted. | `job_id` |
| `data_export.completed` | A data export's file is ready. | `data_export_id` |

`job.deleted` fires once per job, whether it was deleted or [deleted permanently](https://docs.alex.com/api-reference/v2/jobs/delete.md). A permanent delete also removes the job's applications and interviews, and emits no event for them: after a `job.deleted`, a `404` for one of the job's applications or interviews means it was removed with the job.

`stage` and `previous_stage` are `null` when the application had no stage. Handoff events are emitted only when the handoff's status actually changes.

New event types may be added. Ignore types you don't recognize.

## Polling events

[`GET /events`](https://docs.alex.com/api-reference/v2/events/list) lists events oldest first, filtered by `type` and `created_since`. Page through with `cursor` while `has_more` is `true`.

An event younger than 10 seconds is held back from the list, so one whose write committed late still appears after the pages you've read. [`GET /events/{id}`](https://docs.alex.com/api-reference/v2/events/get) returns an event at once.

As with every list, `next_cursor` is `null` on the last page. To resume on your next poll, save the `id` of the last event you handled and pass it as `after`:

```bash theme={null}
curl "https://api.alex.com/v2/events?after=9d4c2b1a-8e7f-4a6b-9c5d-3e2f1a0b9c8d&limit=100" \
  -H "X-API-Key: $ALEX_API_KEY"
```

The list starts just past that event, in the same order and behind the same 10-second window. Follow `next_cursor` for the pages after that; `after` can't be combined with `cursor`. An `after` that isn't the id of one of your events from the last 30 days returns `400` `parameter_invalid`, as does a `cursor` that names an event older than 30 days: start again with `created_since`.

## Webhook endpoints

Register an HTTPS URL with the event types it should receive, or `"*"` for every type:

```bash theme={null}
curl -X POST "https://api.alex.com/v2/webhook-endpoints" \
  -H "X-API-Key: $ALEX_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://hooks.example.com/alex",
    "event_types": ["application.stage_changed", "interview.evaluated"]
  }'
```

The response carries the endpoint's signing `secret`, which starts with `whsec_`. It is shown only here and when you [rotate it](https://docs.alex.com/api-reference/v2/webhook-endpoints/rotate-secret.md), so store it. An idempotent replay of either response has `secret: null`.

The URL must use `https` and its host must resolve only to public addresses; otherwise the request returns `400` `parameter_invalid` on `url`.

## Receiving a webhook

Alex sends each event as a `POST` with the event object as its JSON body and these headers:

| Header | Value |
| - | - |
| `Content-Type` | `application/json` |
| `User-Agent` | `Alex-Webhooks/1.0` |
| `Alex-Event-Id` | The event's `id`. The same on every attempt. |
| `Alex-Signature` | `t=<unix seconds>,v1=<signature>` |

Answer with any `2xx` status within 5 seconds. Anything else, including a redirect, is a failed attempt. Do slow work after you answer.

Deliveries can arrive more than once and out of order. Use `Alex-Event-Id` to drop duplicates, and the event's `created_at`, or a fresh read of the object, to decide what is current.

## Verifying the signature

`v1` is the hex HMAC-SHA256 of `<t>.<raw request body>`, keyed with the whole secret string, `whsec_` included. Compute it over the raw bytes you received, before parsing the JSON:

```javascript theme={null}
import crypto from "node:crypto";

function verifyAlexSignature(rawBody, header, secret, toleranceSeconds = 300) {
  const parts = Object.fromEntries(header.split(",").map((part) => part.split("=")));
  const timestamp = Number(parts.t);
  if (!timestamp || Math.abs(Date.now() / 1000 - timestamp) > toleranceSeconds) {
    return false;
  }
  const expected = crypto.createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex");
  const received = Buffer.from(parts.v1 ?? "", "hex");
  return received.length === expected.length / 2 && crypto.timingSafeEqual(received, Buffer.from(expected, "hex"));
}
```

Reject a request whose timestamp is too old, to stop replays.

## Retries and disabling

A failed delivery is retried up to 8 attempts in all, about 1 minute, 5 minutes, 30 minutes, 2 hours, 5 hours, 10 hours and 6 hours apart: about 24 hours from the first attempt.

When deliveries to an endpoint keep failing for 3 days, Alex disables it: `enabled` becomes `false` and `disabled_reason` becomes `"failing"`. Events meant for a disabled endpoint are not sent. Fix the endpoint, then turn it back on with [`PATCH /webhook-endpoints/{id}`](https://docs.alex.com/api-reference/v2/webhook-endpoints/update) and `{"enabled": true}`, and catch up on what you missed with [`GET /events`](https://docs.alex.com/api-reference/v2/events/list).

## Rotating the secret

[`POST /webhook-endpoints/{id}/rotate-secret`](https://docs.alex.com/api-reference/v2/webhook-endpoints/rotate-secret) returns a new secret. The old one stops at once, and deliveries already queued are signed with the new one, so update your receiver as soon as you rotate.

## v1 webhooks

The [v1 webhooks](https://docs.alex.com/api-reference/webhooks.md) are separate and keep working. Their `reportId` is the interview's `id` in v2.


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