curl --request PUT \
--url https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123 \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"events": ["points.earned", "points.redeemed"],
"is_active": false
}'
const response = await fetch(
"https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123",
{
method: "PUT",
headers: {
Authorization: "<api-key>",
"Content-Type": "application/json",
},
body: JSON.stringify({
events: ["points.earned", "points.redeemed"],
is_active: false,
}),
}
);
const data = await response.json();
import requests
response = requests.put(
"https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123",
headers={"Authorization": "<api-key>"},
json={
"events": ["points.earned", "points.redeemed"],
"is_active": False,
},
)
data = response.json()
<?php
$ch = curl_init("https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"events" => ["points.earned", "points.redeemed"],
"is_active" => false,
]),
]);
$data = json_decode(curl_exec($ch), true);
{
"data": {
"type": "webhook_subscription",
"id": "whsub_abc123",
"attributes": {
"url": "https://example.com/webhooks/mage",
"events": ["points.earned", "points.redeemed"],
"is_active": false,
"description": "Production points + tier sync",
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-01-02T00:00:00.000Z"
}
}
}
{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "Invalid event(s): points.created. Valid events: points.earned, points.redeemed, customer.tier_upgrade, customer.tier_downgrade"
}
]
}
{
"errors": [
{
"status": "404",
"title": "Not Found",
"detail": "Webhook subscription 'whsub_abc123' not found"
}
]
}
Managing Subscriptions
Update a webhook subscription
Update the URL, events, active status, or description of a webhook subscription.
PUT
/
v1
/
webhook-subscriptions
/
{id}
curl --request PUT \
--url https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123 \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"events": ["points.earned", "points.redeemed"],
"is_active": false
}'
const response = await fetch(
"https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123",
{
method: "PUT",
headers: {
Authorization: "<api-key>",
"Content-Type": "application/json",
},
body: JSON.stringify({
events: ["points.earned", "points.redeemed"],
is_active: false,
}),
}
);
const data = await response.json();
import requests
response = requests.put(
"https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123",
headers={"Authorization": "<api-key>"},
json={
"events": ["points.earned", "points.redeemed"],
"is_active": False,
},
)
data = response.json()
<?php
$ch = curl_init("https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"events" => ["points.earned", "points.redeemed"],
"is_active" => false,
]),
]);
$data = json_decode(curl_exec($ch), true);
{
"data": {
"type": "webhook_subscription",
"id": "whsub_abc123",
"attributes": {
"url": "https://example.com/webhooks/mage",
"events": ["points.earned", "points.redeemed"],
"is_active": false,
"description": "Production points + tier sync",
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-01-02T00:00:00.000Z"
}
}
}
{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "Invalid event(s): points.created. Valid events: points.earned, points.redeemed, customer.tier_upgrade, customer.tier_downgrade"
}
]
}
{
"errors": [
{
"status": "404",
"title": "Not Found",
"detail": "Webhook subscription 'whsub_abc123' not found"
}
]
}
Update a webhook subscription. Send only the fields you want to change. The signing secret is not returned by this endpoint and is never changed here. To issue a new secret, use rotate secret.
Path parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The webhook subscription ID |
Request body
All fields are optional. Include any subset you want to change.| Field | Type | Description |
|---|---|---|
url | string | A new HTTPS endpoint. Must be a valid URL |
events | string[] | A non-empty array of events. Valid events: points.earned, points.redeemed, customer.tier_upgrade, customer.tier_downgrade |
is_active | boolean | Set to false to pause deliveries, true to resume |
description | string | null | A new label, or null to clear it |
Errors
| Status | Scenario |
|---|---|
400 | url not a string, url not a valid URL, events empty, one or more events invalid, or invalid JSON |
401 | Missing or invalid API key |
403 | The API key is read-only and cannot perform write operations |
404 | No subscription with this ID exists for the shop |
429 | Rate limit exceeded (6 requests/second) |
curl --request PUT \
--url https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123 \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"events": ["points.earned", "points.redeemed"],
"is_active": false
}'
const response = await fetch(
"https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123",
{
method: "PUT",
headers: {
Authorization: "<api-key>",
"Content-Type": "application/json",
},
body: JSON.stringify({
events: ["points.earned", "points.redeemed"],
is_active: false,
}),
}
);
const data = await response.json();
import requests
response = requests.put(
"https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123",
headers={"Authorization": "<api-key>"},
json={
"events": ["points.earned", "points.redeemed"],
"is_active": False,
},
)
data = response.json()
<?php
$ch = curl_init("https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"events" => ["points.earned", "points.redeemed"],
"is_active" => false,
]),
]);
$data = json_decode(curl_exec($ch), true);
{
"data": {
"type": "webhook_subscription",
"id": "whsub_abc123",
"attributes": {
"url": "https://example.com/webhooks/mage",
"events": ["points.earned", "points.redeemed"],
"is_active": false,
"description": "Production points + tier sync",
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-01-02T00:00:00.000Z"
}
}
}
{
"errors": [
{
"status": "400",
"title": "Bad Request",
"detail": "Invalid event(s): points.created. Valid events: points.earned, points.redeemed, customer.tier_upgrade, customer.tier_downgrade"
}
]
}
{
"errors": [
{
"status": "404",
"title": "Not Found",
"detail": "Webhook subscription 'whsub_abc123' not found"
}
]
}
⌘I