---
title: "Create a webhook endpoint"
method: POST
path: "/v1/webhooks"
tags: ["Webhooks"]
---

# Create a webhook endpoint

`POST /v1/webhooks`

## Request

- Base URL: `https://api.astrocal.dev`
- URL: `https://api.astrocal.dev/v1/webhooks`
- Auth: HTTP bearer

Creates a new webhook endpoint for the authenticated organization. The signing secret is returned in the response — this is the only time it will be shown. Use the secret to verify webhook signatures via the `X-Astrocal-Signature` header.

Astrocal immediately POSTs a verification challenge to the URL, which your endpoint must echo back. The endpoint receives no events until `verification_status` is `verified`. Creation always succeeds — check `verification_status` in the response and retry with `POST /v1/webhooks/{id}/verify` if it is not yet verified.

An organization may hold at most 50 webhook endpoints.

## Request body

- object
  - `url` string, uri, required
  - `events` string[], required
  - `active` boolean

## Response `201`

Webhook endpoint created

- object
  - `id` string, uuid, required
  - `url` string, required
  - `events` string[], required
  - `secret` string, required
  - `active` boolean, required
  - `verification_status` 'pending' | 'verified' | 'failed', required
  - `verified_at` string, nullable, required
  - `verification_last_error` string, nullable, required
  - `consecutive_failures` integer, required
  - `suspended_at` string, nullable, required
  - `created_at` string, required
  - `updated_at` string, required

## Other responses

- `400`: Invalid input
- `401`: Unauthorized
- `409`: Webhook endpoint limit reached

---

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