Skip to main content
PUT
AhaSend Go SDK
The AhaSend API updates an existing webhook. Omitted or null fields are unchanged. Omitted/null domains preserves associations, while [] clears the associations of a resulting-scoped webhook. Moving from global to scoped requires a non-empty domains array in the same request. Moving to global clears associations and ignores supplied domains. A domain-scoped key must be authorized for the existing webhook and every newly supplied domain; changing to global requires webhooks:write:all. Turning on a contact event (the on_contact_* fields) for an account without the marketing features returns HTTP 400. A webhook with any contact event on needs an API key with contacts:read, and with lists:read as well for on_contact_added_to_list, on_contact_removed_from_list, on_contact_subscribed, on_contact_unsubscribed, and on_contact_complained. This check runs against the webhook as it will be after the update, so every update of an enabled webhook that keeps a contact event on needs these scopes, also an update of only name, url, scope, domains, or origins, and returns HTTP 403 without them. A key without them can only turn those events off or disable the webhook (enabled: false); turning it on again needs the scopes. The marketing check runs first. Note: The webhook secret is not updatable

Authorizations

Authorization
string
header
required

API key for authentication. Non-empty Security Requirement values are AhaSend API-key roles. Roles listed within one requirement object are jointly required; separate requirement objects are alternatives.

Path Parameters

account_id
string<uuid>
required

Account ID

webhook_id
string<uuid>
required

Webhook ID

Body

application/json

Partial update. Omitted and null scalar fields leave their stored values unchanged. Domain transition rules depend on the webhook's existing scope and are described on domains.

name
string | null

Webhook name

Maximum string length: 255
url
string<uri> | null

Webhook URL

enabled
boolean | null

Whether the webhook is enabled

on_reception
boolean | null

Trigger on message reception

on_delivered
boolean | null

Trigger on message delivery

on_transient_error
boolean | null

Trigger on transient errors

on_failed
boolean | null

Trigger on permanent failures

on_bounced
boolean | null

Trigger on bounces

on_suppressed
boolean | null

Trigger on suppressions

on_opened
boolean | null

Trigger on opens

on_clicked
boolean | null

Trigger on clicks

on_unsubscribed
boolean | null

Trigger on unsubscribes

on_complained
boolean | null

Trigger on spam complaints

on_suppression_created
boolean | null

Trigger on suppression creation

on_suppression_deleted
boolean | null

Trigger on suppression deletion

on_dns_error
boolean | null

Trigger on DNS errors

on_contact_created
boolean | null

Trigger on contact creation

on_contact_updated
boolean | null

Trigger on contact updates

on_contact_deleted
boolean | null

Trigger on contact deletion

on_contact_added_to_list
boolean | null

Trigger when a contact is added to a list

on_contact_removed_from_list
boolean | null

Trigger when a contact is removed from a list

on_contact_subscribed
boolean | null

Trigger when a contact subscribes

on_contact_unsubscribed
boolean | null

Trigger when a contact unsubscribes

on_contact_complained
boolean | null

Trigger when a contact reports spam

origins
enum<string>[] | null

The origins of the contact and suppression events that the webhook gets. Omit it or send null to keep the stored value; send all four origins to get every origin again. An empty array is refused with HTTP 400. An array that holds all four origins is saved as null, so that an origin added later reaches the webhook too.

Minimum array length: 1

Who made a change that a contact or suppression event reports: recipient for the contact or recipient, through an unsubscribe link, a one-click unsubscribe, or a spam complaint; api for you, through the AhaSend API; dashboard for you, through the AhaSend dashboard; system for AhaSend, for example after a bounce, an expired message or an email validation, or when AhaSend support makes the change.

Available options:
recipient,
api,
dashboard,
system
scope
enum<string> | null

Webhook scope. Omit or send null to keep the current scope.

Available options:
global,
scoped,
null
domains
string[] | null

Omit or send null to leave domain associations unchanged. An array replaces associations when the resulting scope is scoped; [] explicitly clears them. Changing a global webhook to scoped requires a non-empty array in the same request and otherwise returns HTTP 400. Changing to global clears all associations; supplied domains are ignored when the resulting scope is global.

Response

Webhook updated successfully

object
enum<string>
required

Object type identifier

Available options:
webhook
id
string<uuid>
required

Unique identifier for the webhook

created_at
string<date-time>
required

When the webhook was created

updated_at
string<date-time>
required

When the webhook was last updated

name
string
required

Webhook name

url
string<uri>
required

Webhook URL

enabled
boolean
required

Whether the webhook is enabled

on_reception
boolean
required

Trigger on message reception

on_delivered
boolean
required

Trigger on message delivery

on_transient_error
boolean
required

Trigger on transient errors

on_failed
boolean
required

Trigger on permanent failures

on_bounced
boolean
required

Trigger on bounces

on_suppressed
boolean
required

Trigger on suppressions

on_opened
boolean
required

Trigger on opens

on_clicked
boolean
required

Trigger on clicks

on_unsubscribed
boolean
required

Trigger on unsubscribes

on_complained
boolean
required

Trigger on spam complaints

on_suppression_created
boolean
required

Trigger on suppression creation

on_suppression_deleted
boolean
required

Trigger on suppression deletion

on_dns_error
boolean
required

Trigger on DNS errors

on_contact_created
boolean
required

Trigger on contact creation

on_contact_updated
boolean
required

Trigger on contact updates

on_contact_deleted
boolean
required

Trigger on contact deletion

on_contact_added_to_list
boolean
required

Trigger when a contact is added to a list

on_contact_removed_from_list
boolean
required

Trigger when a contact is removed from a list

on_contact_subscribed
boolean
required

Trigger when a contact subscribes

on_contact_unsubscribed
boolean
required

Trigger when a contact unsubscribes

on_contact_complained
boolean
required

Trigger when a contact reports spam

origins
enum<string>[] | null
required

The origins of the contact and suppression events that the webhook gets, or null for every origin. Message events and domain.dns_error have no origin, and the webhook always gets them.

Who made a change that a contact or suppression event reports: recipient for the contact or recipient, through an unsubscribe link, a one-click unsubscribe, or a spam complaint; api for you, through the AhaSend API; dashboard for you, through the AhaSend dashboard; system for AhaSend, for example after a bounce, an expired message or an email validation, or when AhaSend support makes the change.

Available options:
recipient,
api,
dashboard,
system
scope
enum<string>
required

Webhook scope

Available options:
global,
scoped
domains
string[]
required

Domains this webhook applies to. Always present; global webhooks return an empty array.

success_count
integer
required

Number of successful calls

Required range: x >= 0
error_count
integer
required

Number of unsuccessful calls

Required range: x >= 0
errors_since_last_success
integer
required

Number of consecutive failed calls. Reset to zero by the next successful call.

Required range: x >= 0
last_request_at
string<date-time> | null
required

When the webhook was last called