Create Webhook

Create a webhook scoped to this inbox. **CLI:** ```bash agentmail inboxes:webhooks create --inbox-id <inbox_id> --url https://example.com/webhook --event-type message.received ```

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Path parameters

inbox_idstringRequired
The ID of the inbox.

Request

This endpoint expects an object.
urlstringRequired
URL of webhook endpoint.
event_typeslist of enumsRequired

Full list of event types this webhook should receive. At least one type is required. Send every type you want in this array (not incremental). See Webhooks overview for spam, blocked, and unauthenticated events and required permissions.

client_idstringOptional
Client ID of webhook.
headersmap from strings to stringsOptional

Custom HTTP headers to include with every delivery to this webhook. Header values are write-only: AgentMail never returns them from webhook read endpoints. The map must contain at least one entry when provided, and every name and value must be a valid HTTP header.

Response

This endpoint returns an object.
webhook_idstring
ID of webhook.
urlstring
URL of webhook endpoint.
secretstring
Secret for webhook signature verification.
enabledboolean
Webhook is enabled.
updated_atdatetime
Time at which webhook was last updated.
created_atdatetime
Time at which webhook was created.
event_typeslist of enumsOptional
Event types for which to send events.
pod_idslist of stringsOptional
Pods for which to send events. Maximum 10 per webhook.
inbox_idslist of stringsOptional
Inboxes for which to send events. Maximum 10 per webhook.
client_idstringOptional
Client ID of webhook.

Errors

400
Validation Error