> For the complete documentation index, see [llms.txt](https://docs.insurgrid.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.insurgrid.com/get-started/04-webhook-endpoint.md).

# Set up a webhook endpoint

A webhook endpoint is just a URL on your server that accepts an HTTP `POST`. When something happens, InsurGrid sends the data there. This is the one prerequisite the webhook quickstarts need.

## The rules

Your endpoint must:

1. **Be reachable over HTTPS.** Not plain HTTP. (In local development you'll get an HTTPS URL with a tunnel — see [next page](/get-started/05-local-development.md).)
2. **Accept a `POST`** with a JSON body.
3. **Return a `2xx` status quickly.**

> **New term — `2xx`:** any HTTP status code from 200 to 299 (like `200 OK` or `202 Accepted`). To InsurGrid it means "I received it, thanks." Anything else (or a timeout) tells us delivery failed, and we'll retry.

## Acknowledge first, work later

Return `2xx` *immediately*, then do your real processing (saving to your database, calling other services) afterwards — in a background job, a queue, or after you've sent the response.

Why: we expect a fast acknowledgement. If your handler does slow work *before* replying, you may time out, we'll count it as failed, and we'll retry — so you'd process the same event several times.

**Do this:**

```js
// server (Node/Express)
app.post("/hooks/insurgrid", (req, res) => {
  res.sendStatus(200);        // acknowledge first
  queue.add("process-webhook", req.body);   // then work, off the request
});
```

**Not this:**

```js
// server — DON'T: slow work before replying
app.post("/hooks/insurgrid", async (req, res) => {
  await doSlowProcessing(req.body);   // may time out → we retry → duplicate work
  res.sendStatus(200);
});
```

## Register it

Add the endpoint's URL in the **API section** of your dashboard, under the topic you want (see [Get access](/get-started/02-get-access.md)). Add a staging URL first.

![Registering a webhook endpoint — enter your HTTPS destination URL, choose the topic, and pick how deliveries are authenticated (Default signs every request).](https://3825213797-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjBgAFiZ99Eug1CmRq2QO%2Fuploads%2FPlw2N8Qp4OnhpVZGdS5j%2Fregister-endpoint.png?alt=media)

You now have everything you need. Continue to the [first quickstart](/quickstarts/a-receive-policy-data.md) — but if you're developing locally, read the next page first.

Next: [Expose your local endpoint →](/get-started/05-local-development.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.insurgrid.com/get-started/04-webhook-endpoint.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
