Add a webhook
POST /v1/webhooks
Read as Markdown ↗POST /v1/webhooks
Requires an API key: Authorization: Bearer YOUR_CREDENTIAL.
Adds a webhook: an HTTPS URL that receives one or both event types, for every inbox on the account (including ones created later) or for up to 10 listed inboxes. The 201 response includes the signing secret; after that it appears only when you retrieve it.
message.received: a received message is ready to read.message.sent: the provider accepted a sent message. This is not delivery.
A delivery carries identifiers only (id, type, timestamp, data.inbox_id, data.message_id): fetch the message through the API, and deduplicate on id. Verify the signature on the raw body and answer with a 2xx within 15 seconds once you've stored the event: see Verify and acknowledge.
If the response is lost, list webhooks, find the URL and retrieve its secret rather than adding it again.
Request body
JSON object, at most 4 KiB in total.
Schema: CreateWebhook
| Field | Required | Type | Meaning and constraints |
|---|---|---|---|
url | Yes | string | HTTPS URL on a public host, without credentials or a fragment; at most 2048 characters. It can't be changed later: to move it, add a new webhook and delete this one. |
event_types | Yes | array of WebhookEventType | minItems: 1 maxItems: 2 |
inbox_ids | No | array of string | Up to 10 of the account's live inboxes. Empty or omitted means every inbox, including ones created later. maxItems: 10 |
Unknown fields are rejected.
curl example
Supply CHERAMI_API_KEY privately.
Save the payload as request.json, replacing the example values.
{
"url": "https://example.com/hooks/cherami",
"event_types": [
"message.received"
],
"inbox_ids": [
"22222222-2222-4222-8222-222222222222"
]
}curl --silent --show-error --include --request POST \
"https://cherami.to/v1/webhooks" \
--header "Authorization: Bearer $CHERAMI_API_KEY" \
--header 'Content-Type: application/json' \
--data-binary @request.jsonResponses
HTTP 201
Created.
X-Request-ID: Identifies this request; include it when reporting a problem.Location: Relative URL of the resulting resource.
Content type: application/json.
{
"id": "55555555-5555-4555-8555-555555555555",
"created_at": "2026-10-01T00:00:00.000Z",
"url": "https://example.com/hooks/cherami",
"event_types": [
"message.received"
],
"inbox_ids": [
"11111111-1111-4111-8111-111111111111"
],
"deleted_inbox_ids": [],
"enabled": true,
"updated_at": "2026-10-01T00:00:00.000Z",
"status": "active",
"pending_operation": null,
"secret_rotated_at": null,
"previous_secret_expires_at": null,
"secret": "whsec_EXAMPLE_NOT_A_REAL_SECRET"
}HTTP 400
invalid_json: Send a valid UTF-8 JSON object, not an array or scalar.
invalid_webhook: Adding a webhook takes only url, event_types and inbox_ids.
invalid_webhook_url: Use an https URL with a public hostname (not an IP address), without credentials or a fragment.
invalid_webhook_event_types: Supply a nonempty array of message.received, message.sent or both.
invalid_webhook_inbox_ids: Supply inbox_ids as an array of at most 10 inbox IDs, or an empty array for every inbox.
unknown_webhook_inbox: An inbox_ids entry is not a live inbox of this account. Remove the IDs listed in error.details.inbox_ids.
X-Request-ID: Identifies this request; include it when reporting a problem.
Content type: application/json.
HTTP 401
unauthorized: Send a valid API key as Authorization: Bearer <key>. If the key stopped working, get a new one through recovery.
X-Request-ID: Identifies this request; include it when reporting a problem.WWW-Authenticate:"Bearer"
Content type: application/json.
HTTP 413
body_too_large: Reduce the JSON request to the operation's body limit.
X-Request-ID: Identifies this request; include it when reporting a problem.
Content type: application/json.
HTTP 415
unsupported_media_type: Send Content-Type: application/json.
X-Request-ID: Identifies this request; include it when reporting a problem.
Content type: application/json.
HTTP 503
webhook_provider_unavailable: The request could not be completed, and nothing changed. Retry later.
webhook_creation_uncertain: The new webhook was not confirmed and is listed as pending. Within a few minutes the webhook in error.details.webhook_id becomes active, and you retrieve its secret, or leaves the list, and you add it again.
webhook_secret_unavailable: The signing secret could not be read; retry the read later. When error.details.webhook_id is present the webhook was added: retrieve its secret rather than adding it again.
webhooks_unavailable: Webhook management failed. If it was a change, it may have been applied: list or read the webhooks before repeating it.
X-Request-ID: Identifies this request; include it when reporting a problem.
Content type: application/json.
Schema: CreatedWebhook
status is active (delivering), disabled (not delivering until you set enabled to true; you or repeated delivery failures turned it off), pending (creation or removal not yet confirmed; read it again shortly) or unknown (the configuration couldn't be read and its fields are null; if it stays unknown, delete the webhook and add it again). pending_operation names the unconfirmed work.
| Field | Required | Type | Meaning and constraints |
|---|---|---|---|
id | Yes | string | Cherami resource ID. |
created_at | Yes | string | UTC timestamp with milliseconds. format: date-time pattern: ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$ |
url | Yes | string or null | Destination URL; null while status is pending or unknown. |
event_types | Yes | array of WebhookEventType or null | |
inbox_ids | Yes | array of string or null | Scoped inboxes; empty means every inbox. |
deleted_inbox_ids | Yes | array of string | Scoped inboxes that have since been deleted. They match nothing; edit inbox_ids to remove them. |
enabled | Yes | boolean or null | |
updated_at | Yes | string or null | |
status | Yes | "active" or "disabled" or "pending" or "unknown" | |
pending_operation | Yes | object or null | |
secret_rotated_at | Yes | string or null | |
previous_secret_expires_at | Yes | string or null | |
secret | Yes | string | Signing secret for Standard Webhooks verification (whsec_...). Returned only on creation, retrieval and rotation. |
Schema: WebhookEventType
message.received: a received message is ready to read. message.sent: the provider accepted a sent message, which is not delivery.
"message.received" or "message.sent"
Schema: Error
| Field | Required | Type | Meaning and constraints |
|---|---|---|---|
error | Yes | object |
error fields
| Field | Required | Type | Meaning and constraints |
|---|---|---|---|
code | Yes | string | Code to handle. Handle a code you don't recognize by its HTTP status. |
message | Yes | string | Explanation of this case; its wording can change. |