Update a Webhook
curl --request PUT \
--url https://cloudapi.mailercloud.com/v1/webhooks/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: <content-type>' \
--data '
{
"name": "Test Webhook",
"url": "https://example.com",
"events": [
"campaign_sent",
"campaign_opened"
]
}
'import requests
url = "https://cloudapi.mailercloud.com/v1/webhooks/{id}"
payload = {
"name": "Test Webhook",
"url": "https://example.com",
"events": ["campaign_sent", "campaign_opened"]
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<api-key>"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': '<content-type>', Authorization: '<api-key>'},
body: JSON.stringify({
name: 'Test Webhook',
url: 'https://example.com',
events: ['campaign_sent', 'campaign_opened']
})
};
fetch('https://cloudapi.mailercloud.com/v1/webhooks/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cloudapi.mailercloud.com/v1/webhooks/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Test Webhook',
'url' => 'https://example.com',
'events' => [
'campaign_sent',
'campaign_opened'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cloudapi.mailercloud.com/v1/webhooks/{id}"
payload := strings.NewReader("{\n \"name\": \"Test Webhook\",\n \"url\": \"https://example.com\",\n \"events\": [\n \"campaign_sent\",\n \"campaign_opened\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"message": "Updated the webhook successfully"
}{
"error": {
"field": "url",
"message": "url is not valid"
}
}{
"errors": [
{
"field": "",
"message": "Authorization failed"
}
]
}Update a Webhook
API for modifying webhook information. This allows you to update the webhook’s name, URL, and events.
PUT
/
webhooks
/
{id}
Update a Webhook
curl --request PUT \
--url https://cloudapi.mailercloud.com/v1/webhooks/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: <content-type>' \
--data '
{
"name": "Test Webhook",
"url": "https://example.com",
"events": [
"campaign_sent",
"campaign_opened"
]
}
'import requests
url = "https://cloudapi.mailercloud.com/v1/webhooks/{id}"
payload = {
"name": "Test Webhook",
"url": "https://example.com",
"events": ["campaign_sent", "campaign_opened"]
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<api-key>"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': '<content-type>', Authorization: '<api-key>'},
body: JSON.stringify({
name: 'Test Webhook',
url: 'https://example.com',
events: ['campaign_sent', 'campaign_opened']
})
};
fetch('https://cloudapi.mailercloud.com/v1/webhooks/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cloudapi.mailercloud.com/v1/webhooks/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Test Webhook',
'url' => 'https://example.com',
'events' => [
'campaign_sent',
'campaign_opened'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cloudapi.mailercloud.com/v1/webhooks/{id}"
payload := strings.NewReader("{\n \"name\": \"Test Webhook\",\n \"url\": \"https://example.com\",\n \"events\": [\n \"campaign_sent\",\n \"campaign_opened\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"message": "Updated the webhook successfully"
}{
"error": {
"field": "url",
"message": "url is not valid"
}
}{
"errors": [
{
"field": "",
"message": "Authorization failed"
}
]
}Authorizations
Your Mailercloud API key (plain text, no Bearer prefix). Create keys in Settings → API.
Headers
Request body type
Path Parameters
Webhook Id
Body
application/json
Updated name of your Webhook.
Required string length:
3 - 100Pattern:
^[a-zA-Z0-9._ \-]+$/iUpdated URL for your webhook.
Supported URL Protocols - HTTP, HTTPS
List the specific events that you would want to trigger webhook.
Supported events :
"campaign_sent",
"campaign_opened",
"campaign_clicked",
"unsubscribe",
"campaign_error",
"spam",
"hard_bounce"
Maximum array length:
7Response
OK
⌘I