JSON

Choose Language

Webhooks Calls

/webhooks/list.json

Get the list of all webhooks defined on the account

Example Request JSON

{"key":"example key"}

Example Response JSON

[{"id":42,"url":"http:\/\/example\/webhook-url","description":"My Example Webhook","auth_key":"gplJ8yWptFTqCoq5S1SHPA","events":["send","open","click"],"created_at":"2013-01-01 15:30:27","last_sent_at":"2013-01-01 15:30:49","batches_sent":42,"events_sent":42,"last_error":"example last_error"}]

Example Error Response JSON

{"status":"error","code":-1,"name":"Invalid_Key","message":"Invalid API key"}
Parameters
key* string a valid API key
Return Value
array the webhooks associated with the account
return[] struct the individual webhook info
id integer a unique integer indentifier for the webhook
url string The URL that the event data will be posted to
description string a description of the webhook
auth_key string the key used to requests for this webhook
events array The message events that will be posted to the hook
events[] string the individual message event (send, hard_bounce, soft_bounce, open, click, spam, unsub, or reject)
created_at string the date and time that the webhook was created as a UTC string in YYYY-MM-DD HH:MM:SS format
last_sent_at string the date and time that the webhook last successfully received events as a UTC string in YYYY-MM-DD HH:MM:SS format
batches_sent integer the number of event batches that have ever been sent to this webhook
events_sent integer the total number of events that have ever been sent to this webhook
last_error string if we've ever gotten an error trying to post to this webhook, the last error that we've seen
Errors
Invalid_Key The provided API key is not a valid Mandrill API key
ValidationError The parameters passed to the API call are invalid or not provided when required
GeneralError An unexpected error occurred processing the request. Mandrill developers will be notified.

/webhooks/add.json

Add a new webhook

Example Request JSON

{"key":"example key","url":"http:\/\/example\/webhook-url","description":"My Example Webhook","events":["send","open","click"]}

Example Response JSON

{"id":42,"url":"http:\/\/example\/webhook-url","description":"My Example Webhook","auth_key":"gplJ8yWptFTqCoq5S1SHPA","events":["send","open","click"],"created_at":"2013-01-01 15:30:27","last_sent_at":"2013-01-01 15:30:49","batches_sent":42,"events_sent":42,"last_error":"example last_error"}

Example Error Response JSON

{"status":"error","code":-1,"name":"Invalid_Key","message":"Invalid API key"}
Parameters
key* string a valid API key
url* string the URL to POST batches of events
Validation: required, webhookexists
description string an optional description of the webhook
events array an optional list of events that will be posted to the webhook
events[] string the individual event to listen for
oneof(send, hard_bounce, soft_bounce, open, click, spam, unsub, reject, blacklist, whitelist)
Return Value
struct the information saved about the new webhook
id integer a unique integer indentifier for the webhook
url string The URL that the event data will be posted to
description string a description of the webhook
auth_key string the key used to requests for this webhook
events array The message events that will be posted to the hook
events[] string the individual message event (send, hard_bounce, soft_bounce, open, click, spam, unsub, or reject)
created_at string the date and time that the webhook was created as a UTC string in YYYY-MM-DD HH:MM:SS format
last_sent_at string the date and time that the webhook last successfully received events as a UTC string in YYYY-MM-DD HH:MM:SS format
batches_sent integer the number of event batches that have ever been sent to this webhook
events_sent integer the total number of events that have ever been sent to this webhook
last_error string if we've ever gotten an error trying to post to this webhook, the last error that we've seen
Errors
Invalid_Key The provided API key is not a valid Mandrill API key
ValidationError The parameters passed to the API call are invalid or not provided when required
GeneralError An unexpected error occurred processing the request. Mandrill developers will be notified.

/webhooks/info.json

Given the ID of an existing webhook, return the data about it

Example Request JSON

{"key":"example key","id":42}

Example Response JSON

{"id":42,"url":"http:\/\/example\/webhook-url","description":"My Example Webhook","auth_key":"gplJ8yWptFTqCoq5S1SHPA","events":["send","open","click"],"created_at":"2013-01-01 15:30:27","last_sent_at":"2013-01-01 15:30:49","batches_sent":42,"events_sent":42,"last_error":"example last_error"}

Example Error Response JSON

{"status":"error","code":3,"name":"Unknown_Webhook","message":"Unknown hook ID 15"}
Parameters
key* string a valid API key
id* integer the unique identifier of a webhook belonging to this account
Return Value
struct the information about the webhook
id integer a unique integer indentifier for the webhook
url string The URL that the event data will be posted to
description string a description of the webhook
auth_key string the key used to requests for this webhook
events array The message events that will be posted to the hook
events[] string the individual message event (send, hard_bounce, soft_bounce, open, click, spam, unsub, or reject)
created_at string the date and time that the webhook was created as a UTC string in YYYY-MM-DD HH:MM:SS format
last_sent_at string the date and time that the webhook last successfully received events as a UTC string in YYYY-MM-DD HH:MM:SS format
batches_sent integer the number of event batches that have ever been sent to this webhook
events_sent integer the total number of events that have ever been sent to this webhook
last_error string if we've ever gotten an error trying to post to this webhook, the last error that we've seen
Errors
Invalid_Key The provided API key is not a valid Mandrill API key
Unknown_Webhook The requested webhook does not exist
ValidationError The parameters passed to the API call are invalid or not provided when required
GeneralError An unexpected error occurred processing the request. Mandrill developers will be notified.

/webhooks/update.json

Update an existing webhook

Example Request JSON

{"key":"example key","id":42,"url":"http:\/\/example\/webhook-url","description":"My Example Webhook","events":["send","open","click"]}

Example Response JSON

{"id":42,"url":"http:\/\/example\/webhook-url","description":"My Example Webhook","auth_key":"gplJ8yWptFTqCoq5S1SHPA","events":["send","open","click"],"created_at":"2013-01-01 15:30:27","last_sent_at":"2013-01-01 15:30:49","batches_sent":42,"events_sent":42,"last_error":"example last_error"}

Example Error Response JSON

{"status":"error","code":3,"name":"Unknown_Webhook","message":"Unknown hook ID 15"}
Parameters
key* string a valid API key
id* integer the unique identifier of a webhook belonging to this account
url* string the URL to POST batches of events
Validation: required, webhookexists
description string an optional description of the webhook
events array an optional list of events that will be posted to the webhook
events[] string the individual event to listen for
oneof(send, hard_bounce, soft_bounce, open, click, spam, unsub, reject, blacklist, whitelist)
Return Value
struct the information for the updated webhook
id integer a unique integer indentifier for the webhook
url string The URL that the event data will be posted to
description string a description of the webhook
auth_key string the key used to requests for this webhook
events array The message events that will be posted to the hook
events[] string the individual message event (send, hard_bounce, soft_bounce, open, click, spam, unsub, or reject)
created_at string the date and time that the webhook was created as a UTC string in YYYY-MM-DD HH:MM:SS format
last_sent_at string the date and time that the webhook last successfully received events as a UTC string in YYYY-MM-DD HH:MM:SS format
batches_sent integer the number of event batches that have ever been sent to this webhook
events_sent integer the total number of events that have ever been sent to this webhook
last_error string if we've ever gotten an error trying to post to this webhook, the last error that we've seen
Errors
Invalid_Key The provided API key is not a valid Mandrill API key
Unknown_Webhook The requested webhook does not exist
ValidationError The parameters passed to the API call are invalid or not provided when required
GeneralError An unexpected error occurred processing the request. Mandrill developers will be notified.

/webhooks/delete.json

Delete an existing webhook

Example Request JSON

{"key":"example key","id":42}

Example Response JSON

{"id":42,"url":"http:\/\/example\/webhook-url","description":"My Example Webhook","auth_key":"gplJ8yWptFTqCoq5S1SHPA","events":["send","open","click"],"created_at":"2013-01-01 15:30:27","last_sent_at":"2013-01-01 15:30:49","batches_sent":42,"events_sent":42,"last_error":"example last_error"}

Example Error Response JSON

{"status":"error","code":3,"name":"Unknown_Webhook","message":"Unknown hook ID 15"}
Parameters
key* string a valid API key
id* integer the unique identifier of a webhook belonging to this account
Return Value
struct the information for the deleted webhook
id integer a unique integer indentifier for the webhook
url string The URL that the event data will be posted to
description string a description of the webhook
auth_key string the key used to requests for this webhook
events array The message events that will be posted to the hook
events[] string the individual message event (send, hard_bounce, soft_bounce, open, click, spam, unsub, or reject)
created_at string the date and time that the webhook was created as a UTC string in YYYY-MM-DD HH:MM:SS format
last_sent_at string the date and time that the webhook last successfully received events as a UTC string in YYYY-MM-DD HH:MM:SS format
batches_sent integer the number of event batches that have ever been sent to this webhook
events_sent integer the total number of events that have ever been sent to this webhook
last_error string if we've ever gotten an error trying to post to this webhook, the last error that we've seen
Errors
Invalid_Key The provided API key is not a valid Mandrill API key
Unknown_Webhook The requested webhook does not exist
ValidationError The parameters passed to the API call are invalid or not provided when required
GeneralError An unexpected error occurred processing the request. Mandrill developers will be notified.