cherami.
API referenceWebhooks

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

FieldRequiredTypeMeaning and constraints
urlYesstringHTTPS 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_typesYesarray of WebhookEventTypeminItems: 1 maxItems: 2
inbox_idsNoarray of stringUp 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.json

Responses

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.

CreatedWebhook

{
  "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.

Error

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.

Error

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.

Error

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.

Error

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.

Error

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.

FieldRequiredTypeMeaning and constraints
idYesstringCherami resource ID.
created_atYesstringUTC timestamp with milliseconds. format: date-time pattern: ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$
urlYesstring or nullDestination URL; null while status is pending or unknown.
event_typesYesarray of WebhookEventType or null
inbox_idsYesarray of string or nullScoped inboxes; empty means every inbox.
deleted_inbox_idsYesarray of stringScoped inboxes that have since been deleted. They match nothing; edit inbox_ids to remove them.
enabledYesboolean or null
updated_atYesstring or null
statusYes"active" or "disabled" or "pending" or "unknown"
pending_operationYesobject or null
secret_rotated_atYesstring or null
previous_secret_expires_atYesstring or null
secretYesstringSigning 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

FieldRequiredTypeMeaning and constraints
errorYesobject

error fields

FieldRequiredTypeMeaning and constraints
codeYesstringCode to handle. Handle a code you don't recognize by its HTTP status.
messageYesstringExplanation of this case; its wording can change.

Errors, limits and pagination · Download OpenAPI 3.1

On this page