webhooks commands let you manage, forward and trigger email event webhooks; this page lists their arguments and flags. For the complete local testing workflow, use the webhook testing guide. For dashboard setup, see the webhooks guide.
Before running the examples, log in with an API key that has the read, write and delete webhook scopes for all domains, and replace YOUR_RESOURCE_ID with the ID of one of your webhooks. In the --domains examples, replace example.com and example.org with domains in your account; for any other domain, the API answers 400 invalid domain: <domain>.
Overview
list- List webhookscreate- Create a webhookget- Get a webhookupdate- Update a webhookdelete- Delete a webhooklisten- Listen for webhook events in real-timetrigger- Trigger webhook events for testing
webhooks get, webhooks update, webhooks delete and webhooks trigger take the webhook ID as their positional argument. A webhook ID that is not a UUID fails with exit code 4 before any request. Find IDs with ahasend webhooks list.
Event Types
--events on create, update, listen and trigger takes each event by its key or by its type, such as delivered or message.delivered. See the event reference for the payloads.
--events can be given several times, and each value can hold several events separated by commas, so --events delivered,bounced is the same as --events delivered --events bounced. An unknown event, or the same event given twice (by its key, its type or both), fails with exit code 4 before any request.
List Webhooks
--enabled filter, so a page holds up to --limit matching webhooks. Pages work as Lists and Pagination describes.
Create Webhook
--nameand--urlare required. When one is missing and stdin is a terminal, the command asks for it. With--non-interactive, or when stdin is not a terminal, a missing value fails with exit code 4.- On a terminal, without
--eventsor--all-events, the command also asks for the events. A webhook created without events receives none untilwebhooks updategives it some. --scopeisglobalunless you set it. A global webhook receives the events of every domain. Ascopedwebhook receives only the events of the domains you give with--domains, which it requires.--domainswithout--scope scopedfails with exit code 4.- A webhook is enabled unless you set
--enabled=false. --urlmust be an HTTP or HTTPS URL with a host name and no user name or password. Use HTTPS in production: a plain HTTP URL for a host other thanlocalhostor a loopback address prints a warning on stderr.
webhooks get does not show it.
Get Webhook
Show a webhook’s name, URL, status, events, scope and domains, its timestamps and its call counters (successful calls, failed calls, errors since the last success and the last call time). The output has no secret: the API returns it only when you create the webhook.Update Webhook
Only the flags you set are sent; other settings stay as they are. Give at least one flag.--eventsreplaces the webhook’s events.--all-eventsselects every event type and--clear-eventsremoves them all. These three flags cannot be combined.--domainsreplaces the domains of a scoped webhook. The API ignores it on a global webhook unless you also give--scope scoped.--scope global --domains <domain>fails with exit code 4.--scope globalremoves the domain restriction.
Delete Webhook
--force (-f) skips it. A deleted webhook cannot be restored.
Listen for Events
webhooks listen streams webhook events to your terminal over a WebSocket connection, and can forward each event to a local endpoint. It prints events as text, whatever --output says, and runs until you press Ctrl+C or the connection closes.
webhooks:write:all scope. Without --webhook-id, the API creates a temporary webhook that stays after the command ends. Forwarded events are signed with a forwarding secret that the command prints when it connects. The webhook testing guide covers temporary webhooks, forwarding, signatures and exit codes.
Trigger Test Events
webhooks trigger asks the API to send test events to a webhook, so you can test your endpoint without waiting for real email events.
--events or --all-events, but not both; without either, the command fails with exit code 4. The output is the API’s message. A disabled webhook gets no events: the API answers that they are queued, and then drops them. Enable the webhook first with ahasend webhooks update YOUR_RESOURCE_ID --enabled.
Command Flags
These flags come from the CLI’s--help. All commands also accept the global flags.

