curl --request GET \
--url 'https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123/delivery-logs?filter[success]=false&page[number]=1&page[size]=20' \
--header 'Authorization: <api-key>'
const response = await fetch(
"https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123/delivery-logs?filter[success]=false&page[number]=1&page[size]=20",
{
method: "GET",
headers: {
Authorization: "<api-key>",
},
}
);
const data = await response.json();
import requests
response = requests.get(
"https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123/delivery-logs",
headers={"Authorization": "<api-key>"},
params={"filter[success]": "false", "page[number]": 1, "page[size]": 20},
)
data = response.json()
<?php
$ch = curl_init("https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123/delivery-logs?filter[success]=false&page[number]=1&page[size]=20");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
],
]);
$data = json_decode(curl_exec($ch), true);
{
"data": [
{
"type": "webhook_delivery_log",
"id": "whlog_def456",
"attributes": {
"event": "points.earned",
"status_code": 500,
"success": false,
"error": "Endpoint returned 500 Internal Server Error",
"delivered_at": "2024-01-01T00:00:01.000Z",
"created_at": "2024-01-01T00:00:01.000Z"
}
},
{
"type": "webhook_delivery_log",
"id": "whlog_abc123",
"attributes": {
"event": "points.earned",
"status_code": 200,
"success": true,
"error": null,
"delivered_at": "2024-01-01T00:00:00.000Z",
"created_at": "2024-01-01T00:00:00.000Z"
}
}
],
"meta": {
"total": 2,
"page": 1,
"per_page": 20,
"total_pages": 1
}
}
{
"errors": [
{
"status": "404",
"title": "Not Found",
"detail": "Webhook subscription 'whsub_abc123' not found"
}
]
}
Managing Subscriptions
List delivery logs
List the delivery attempts for a webhook subscription to debug failures.
GET
/
v1
/
webhook-subscriptions
/
{id}
/
delivery-logs
curl --request GET \
--url 'https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123/delivery-logs?filter[success]=false&page[number]=1&page[size]=20' \
--header 'Authorization: <api-key>'
const response = await fetch(
"https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123/delivery-logs?filter[success]=false&page[number]=1&page[size]=20",
{
method: "GET",
headers: {
Authorization: "<api-key>",
},
}
);
const data = await response.json();
import requests
response = requests.get(
"https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123/delivery-logs",
headers={"Authorization": "<api-key>"},
params={"filter[success]": "false", "page[number]": 1, "page[size]": 20},
)
data = response.json()
<?php
$ch = curl_init("https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123/delivery-logs?filter[success]=false&page[number]=1&page[size]=20");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
],
]);
$data = json_decode(curl_exec($ch), true);
{
"data": [
{
"type": "webhook_delivery_log",
"id": "whlog_def456",
"attributes": {
"event": "points.earned",
"status_code": 500,
"success": false,
"error": "Endpoint returned 500 Internal Server Error",
"delivered_at": "2024-01-01T00:00:01.000Z",
"created_at": "2024-01-01T00:00:01.000Z"
}
},
{
"type": "webhook_delivery_log",
"id": "whlog_abc123",
"attributes": {
"event": "points.earned",
"status_code": 200,
"success": true,
"error": null,
"delivered_at": "2024-01-01T00:00:00.000Z",
"created_at": "2024-01-01T00:00:00.000Z"
}
}
],
"meta": {
"total": 2,
"page": 1,
"per_page": 20,
"total_pages": 1
}
}
{
"errors": [
{
"status": "404",
"title": "Not Found",
"detail": "Webhook subscription 'whsub_abc123' not found"
}
]
}
List the delivery attempts for a webhook subscription, newest first. Use this to confirm that events reached your endpoint, and to debug failures by inspecting the response status code and any error message.
Path parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The webhook subscription ID |
Query parameters
| Parameter | Type | Description |
|---|---|---|
filter[event] | string | Only return deliveries for this event (e.g. points.earned) |
filter[success] | string | Filter by outcome: true for successful deliveries, false for failures |
page[number] | integer | Page number (default: 1) |
page[size] | integer | Results per page (default: 20, max: 100) |
Delivery log fields
| Field | Type | Description |
|---|---|---|
event | string | The event that was delivered |
status_code | integer | null | The HTTP status code your endpoint returned, or null if no response was received |
success | boolean | Whether the delivery was considered successful |
error | string | null | An error message when the delivery failed, otherwise null |
delivered_at | string | null | ISO 8601 timestamp of delivery, or null if it was never delivered |
created_at | string | ISO 8601 timestamp of when the attempt was recorded |
Errors
| Status | Scenario |
|---|---|
401 | Missing or invalid API key |
404 | No subscription with this ID exists for the shop |
429 | Rate limit exceeded (6 requests/second) |
curl --request GET \
--url 'https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123/delivery-logs?filter[success]=false&page[number]=1&page[size]=20' \
--header 'Authorization: <api-key>'
const response = await fetch(
"https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123/delivery-logs?filter[success]=false&page[number]=1&page[size]=20",
{
method: "GET",
headers: {
Authorization: "<api-key>",
},
}
);
const data = await response.json();
import requests
response = requests.get(
"https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123/delivery-logs",
headers={"Authorization": "<api-key>"},
params={"filter[success]": "false", "page[number]": 1, "page[size]": 20},
)
data = response.json()
<?php
$ch = curl_init("https://api.mageloyalty.com/v1/webhook-subscriptions/whsub_abc123/delivery-logs?filter[success]=false&page[number]=1&page[size]=20");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
],
]);
$data = json_decode(curl_exec($ch), true);
{
"data": [
{
"type": "webhook_delivery_log",
"id": "whlog_def456",
"attributes": {
"event": "points.earned",
"status_code": 500,
"success": false,
"error": "Endpoint returned 500 Internal Server Error",
"delivered_at": "2024-01-01T00:00:01.000Z",
"created_at": "2024-01-01T00:00:01.000Z"
}
},
{
"type": "webhook_delivery_log",
"id": "whlog_abc123",
"attributes": {
"event": "points.earned",
"status_code": 200,
"success": true,
"error": null,
"delivered_at": "2024-01-01T00:00:00.000Z",
"created_at": "2024-01-01T00:00:00.000Z"
}
}
],
"meta": {
"total": 2,
"page": 1,
"per_page": 20,
"total_pages": 1
}
}
{
"errors": [
{
"status": "404",
"title": "Not Found",
"detail": "Webhook subscription 'whsub_abc123' not found"
}
]
}
⌘I