---
title: "Receive events with webhooks"
description: "Get a signed message when a report is published, a metric changes, or an information request is answered."
---

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

# Receive events with webhooks

A webhook tells your system that something changed. Each event carries IDs only, never values, report contents or messages. Your system then reads the details through the API with its own credential, so what it can read is decided there.

## Create an endpoint

An entity's owner or admin can add up to 10 endpoints under **Webhooks** in **Workspace settings**, or a firm client holding `webhooks:manage` can create them for its own firm. API keys cannot manage webhooks.

```bash
curl -X POST https://api.sureshake.com/v2/entities/$ENTITY_ID/webhooks \
  -H "Authorization: Bearer $FIRM_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://hooks.example.com/sureshake","events":["metric.updated"]}'
```

The response carries the signing secret once. It starts with `whsec_` and cannot be shown again, so store it then.

The URL must be `https` on the standard port, with a public hostname and no username or password. We check that the name resolves only to public addresses when you create the endpoint and again before every delivery. We do not follow redirects, so use the final URL.

## Events

| Event               | Sent to                                                                              | `data`                                                                           |
| ------------------- | ------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------- |
| `report.published`  | The report's entity                                                                  | `entityId`, `reportId`                                                           |
| `metric.updated`    | The row's entity, and firms that can read its private metrics when the event is sent | `entityId`, `concepts`, `fiscalYear`, `fiscalPeriod`, `periodStart`, `periodEnd` |
| `request.fulfilled` | The firm that made the information request                                           | `entityId`, `requestId`, `reportId`                                              |

`metric.updated` fires only when a period's content changes, including when a withdrawn report takes its figures out. A public filing notifies only its own entity. If access is withdrawn while an event waits, that event is not sent.

```json
{
  "id": "6b1c3a1e-52f1-4f6e-8a3f-0a9b1d2c3e4f",
  "type": "metric.updated",
  "timestamp": "2026-11-06T17:04:12.000Z",
  "data": {
    "entityId": "8f2349ef-22ab-46ae-a129-2eb4c2570001",
    "concepts": ["netIncome", "revenue"],
    "fiscalYear": 2026,
    "fiscalPeriod": "Q3",
    "periodStart": "2026-07-01",
    "periodEnd": "2026-09-30"
  }
}
```

## Verify the signature

Deliveries follow the [Standard Webhooks](https://www.standardwebhooks.com) specification. Each carries `webhook-id`, `webhook-timestamp` and `webhook-signature`. The signature is `v1,` and a base64 HMAC-SHA256 of `{id}.{timestamp}.{body}`, keyed with the base64 decoding of the secret after `whsec_`.

```ts
import { createHmac, timingSafeEqual } from "node:crypto";

function verify(secret: string, headers: Headers, rawBody: string) {
  const id = headers.get("webhook-id");
  const timestamp = headers.get("webhook-timestamp");
  const key = Buffer.from(secret.slice("whsec_".length), "base64");
  const expected = createHmac("sha256", key)
    .update(`${id}.${timestamp}.${rawBody}`)
    .digest();
  const age = Math.abs(Date.now() / 1000 - Number(timestamp));
  return (
    age < 300 &&
    (headers.get("webhook-signature") ?? "").split(" ").some((signature) => {
      const value = Buffer.from(signature.replace(/^v1,/, ""), "base64");
      return (
        value.length === expected.length && timingSafeEqual(value, expected)
      );
    })
  );
}
```

Verify against the raw request body, before parsing it.

## Delivery

Answer with any 2xx status within 10 seconds. A redirect, any other status, or no answer counts as a failure. We try up to 5 times, waiting about 1 minute, 5 minutes, 30 minutes and 2 hours, and then mark the delivery failed.

Delivery is at least once, and events can arrive out of order. `webhook-id` stays the same across retries, so use it to ignore a repeat. Read the current state through the API rather than relying on order.

We do not read your response body. **Recent deliveries** and `GET /v2/entities/{id}/webhooks/{webhookId}/deliveries` show the result and HTTP status for each delivery. Connection, certificate and timeout failures all read as `unreachable`.

Send a test with **Send test** or `POST /v2/entities/{id}/webhooks/{webhookId}/test`. It sends one signed `webhook.test` event, with no retry.

Deleting an endpoint stops its pending deliveries. Revoking the firm client that created an endpoint stops that endpoint. So does a suspended firm owner or a deleted entity.

Source: https://docs.sureshake.com/developers/webhooks/index.mdx
