---
title: "Preview Endpoint"
method: POST
path: "/api/v1/webhooks/preview"
tags: ["webhooks"]
---

# Preview Endpoint

`POST /api/v1/webhooks/preview`

## Request

- Base URL: `https://legalize.dev` (the document declares no server; this is the origin it was published from)
- URL: `https://legalize.dev/api/v1/webhooks/preview`
- Auth: API key in header `Authorization`

What a rule would have delivered over the last 30 days. Creates nothing.

POST rather than GET because the rule is a document -- arrays and a free
text query -- and because a URL long enough to carry 200 law ids is not a
URL. It is still read-only: no row is written and nothing is sent.

Registered before `/{endpoint_id}` would ever be consulted, so "preview" is
never read as an id; FastAPI matches in declaration order.

## Request body

- WebhookPreview: A rule to try before committing to it. No endpoint, no url, no secret.
  - `event_types` string[], required
  - `countries` string[], nullable
  - `law_ids` string[], nullable
  - `match_query` string, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `401`: Missing, malformed, or invalid API key
- `422`: Validation Error
- `429`: Monthly quota exceeded. Includes Retry-After header.

---

[API](https://skmtc.dev/legalize/apis/legalize-api.md) · [All operations](https://skmtc.dev/legalize/apis/legalize-api/llms.txt) · [OpenAPI document](https://skmtc.dev/legalize/apis/legalize-api/revisions/305b67a14660?raw)
