# Create a webhook

Source: https://ampost.io/docs/api/webhooks-create · Full reference: https://ampost.io/llms-full.txt

`POST /api/webhooks/endpoints` · MCP tool `webhooks_create` · scope `webhooks:write` · rate limit `createPost` · success `201`

Send events to an https URL. Ampost POSTs each event as JSON, signed with the webhook's secret (`Ampost-Signature`), and retries a failed delivery 7 times (1 min, 5 min, 30 min, 2 h, 6 h, 12 h and 24 h). After 5 deliveries in a row fail all retries the webhook is turned off. At most 10 webhooks. The response is the only one with the full `secret`: store it now. Revoking the key or app that created the webhook turns it off. Events: post.scheduled, post.unscheduled, post.discarded, post.published, post.partial, post.failed, post.platform.published, post.platform.failed, post.platform.deleted, post.platform.edited, post.approval_requested, post.approved, post.rejected, account.connected, account.disconnected, account.needs_reconnect, analytics.synced. Webhooks see every platform set, so keys restricted to some sets get 403 PLATFORM_SET_NOT_ALLOWED.

| Field | In | Type | Required | Description |
|---|---|---|---|---|
| `url` | body | string | yes | Public https URL that receives the events. Private, loopback, internal and Ampost's own hosts are rejected. |
| `events` | body | (post.scheduled \| post.unscheduled \| post.discarded \| post.published \| post.partial \| post.failed \| post.platform.published \| post.platform.failed \| post.platform.deleted \| post.platform.edited \| post.approval_requested \| post.approved \| post.rejected \| account.connected \| account.disconnected \| account.needs_reconnect \| analytics.synced)[] | yes | Events to send to this URL |
| `description` | body | string \| null | no | Your note for this webhook, at most 200 characters |
| `Idempotency-Key` (MCP `idempotencyKey`) | header | string | no | Idempotency key (1-255 visible ASCII characters, for example a UUID). A retry with the same key and arguments within 24 hours returns the first result instead of running again. Send a new key for each new action. See Idempotency. |

Example request:

```json
{
  "url": "https://example.com/ampost/webhooks",
  "events": [
    "post.published",
    "post.partial",
    "post.failed",
    "account.needs_reconnect"
  ],
  "description": "Production receiver"
}
```

Example response:

```json
{
  "id": "d3a7c1e9-5b2f-4a8d-9e6c-7f1b3d5a9c21",
  "url": "https://example.com/ampost/webhooks",
  "description": "Production receiver",
  "events": [
    "post.published",
    "post.partial",
    "post.failed",
    "account.needs_reconnect"
  ],
  "secretPreview": "whsec_…nM8q",
  "enabled": true,
  "disabledReason": null,
  "disabledAt": null,
  "consecutiveFailures": 0,
  "lastDeliveryAt": "2026-10-08T15:00:01.000Z",
  "lastSuccessAt": "2026-10-08T15:00:01.000Z",
  "createdAt": "2026-10-01T09:00:00.000Z",
  "updatedAt": "2026-10-01T09:00:00.000Z",
  "secret": "whsec_Jx2nQ8vR4tY6uI0oP3aS5dF7gH9jK1lZ2xC4vB6nM8q"
}
```
