---
title: "Create a webhook endpoint"
method: POST
path: "/v1/webhook_endpoints"
tags: ["Webhook endpoints"]
---

# Create a webhook endpoint

`POST /v1/webhook_endpoints`

## Request

- Base URL: `https://api.affiliaterail.com`
- URL: `https://api.affiliaterail.com/v1/webhook_endpoints`
- Auth: HTTP bearer

HTTPS, public address only. The response carries `secret` exactly once.

**Scope:** `webhooks:write` (or `write`)

## Request body

- WebhookEndpointCreate
  - `program_id` string, required: Prefixed id (`prg_…`)
  - `url` string, uri, required
  - `event_types` string[]: Empty means every event

## Response `201`

The new endpoint, with its secret

- WebhookEndpoint
  - `id` string, required: Prefixed id (`whe_…`)
  - `object` 'webhook_endpoint', required
  - `program_id` string, required: Prefixed id (`prg_…`)
  - `partner_id` string, nullable, required: Prefixed id (`part_…`)
  - `url` string, required
  - `event_types` string[], required
  - `enabled` boolean, required
  - `secret` string: Shown once, on creation
  - `created_at` string, date-time, required: ISO-8601, UTC
  - `updated_at` string, date-time, required: ISO-8601, UTC

## Other responses

- `400`: Invalid request
- `401`: Missing or unknown API key
- `403`: Key lacks the required scope
- `404`: No such object in your organization
- `422`: The request was understood and refused
- `429`: Rate limited: see Retry-After

---

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