curl --request GET \
--url 'https://api.mageloyalty.com/v1/rewards?filter[is_active]=true&sort=-created_at' \
--header 'Authorization: <api-key>'
const response = await fetch(
"https://api.mageloyalty.com/v1/rewards?filter[is_active]=true&sort=-created_at",
{
method: "GET",
headers: {
Authorization: "<api-key>",
},
}
);
const data = await response.json();
import requests
response = requests.get(
"https://api.mageloyalty.com/v1/rewards",
headers={"Authorization": "<api-key>"},
params={"filter[is_active]": "true", "sort": "-created_at"},
)
data = response.json()
<?php
$ch = curl_init("https://api.mageloyalty.com/v1/rewards?filter[is_active]=true&sort=-created_at");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
],
]);
$data = json_decode(curl_exec($ch), true);
{
"data": [
{
"type": "reward",
"id": "reward_abc",
"attributes": {
"name": "£5 off your next order",
"description": null,
"discount_type": "fixed",
"reward_type": "loyalty",
"points_cost": 500,
"discount_amount": 5.00,
"minimum_spend": 20.00,
"is_active": true,
"max_redemptions": null,
"expiry_days": 30,
"tier_name": null,
"redemption_mode": "standard",
"free_product": null,
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-01-01T00:00:00.000Z"
}
}
],
"meta": {
"total": 3,
"page": 1,
"per_page": 20,
"total_pages": 1
}
}
{
"errors": [
{
"status": "401",
"title": "Unauthorized",
"detail": "Invalid or revoked API key"
}
]
}
Rewards
List rewards
List all rewards for the shop.
GET
/
v1
/
rewards
curl --request GET \
--url 'https://api.mageloyalty.com/v1/rewards?filter[is_active]=true&sort=-created_at' \
--header 'Authorization: <api-key>'
const response = await fetch(
"https://api.mageloyalty.com/v1/rewards?filter[is_active]=true&sort=-created_at",
{
method: "GET",
headers: {
Authorization: "<api-key>",
},
}
);
const data = await response.json();
import requests
response = requests.get(
"https://api.mageloyalty.com/v1/rewards",
headers={"Authorization": "<api-key>"},
params={"filter[is_active]": "true", "sort": "-created_at"},
)
data = response.json()
<?php
$ch = curl_init("https://api.mageloyalty.com/v1/rewards?filter[is_active]=true&sort=-created_at");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
],
]);
$data = json_decode(curl_exec($ch), true);
{
"data": [
{
"type": "reward",
"id": "reward_abc",
"attributes": {
"name": "£5 off your next order",
"description": null,
"discount_type": "fixed",
"reward_type": "loyalty",
"points_cost": 500,
"discount_amount": 5.00,
"minimum_spend": 20.00,
"is_active": true,
"max_redemptions": null,
"expiry_days": 30,
"tier_name": null,
"redemption_mode": "standard",
"free_product": null,
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-01-01T00:00:00.000Z"
}
}
],
"meta": {
"total": 3,
"page": 1,
"per_page": 20,
"total_pages": 1
}
}
{
"errors": [
{
"status": "401",
"title": "Unauthorized",
"detail": "Invalid or revoked API key"
}
]
}
List all rewards for the shop. Excludes soft-deleted rewards.
Query parameters
| Parameter | Type | Description |
|---|---|---|
filter[is_active] | string | Filter by active status: true or false |
sort | string | Sort field. Prefix with - for descending. Options: created_at, name, points_cost. Default: -created_at |
page[number] | integer | Page number (default: 1) |
page[size] | integer | Results per page (default: 20, max: 100) |
Response
Returns a paginated list of reward objects along with ameta object describing the page.
curl --request GET \
--url 'https://api.mageloyalty.com/v1/rewards?filter[is_active]=true&sort=-created_at' \
--header 'Authorization: <api-key>'
const response = await fetch(
"https://api.mageloyalty.com/v1/rewards?filter[is_active]=true&sort=-created_at",
{
method: "GET",
headers: {
Authorization: "<api-key>",
},
}
);
const data = await response.json();
import requests
response = requests.get(
"https://api.mageloyalty.com/v1/rewards",
headers={"Authorization": "<api-key>"},
params={"filter[is_active]": "true", "sort": "-created_at"},
)
data = response.json()
<?php
$ch = curl_init("https://api.mageloyalty.com/v1/rewards?filter[is_active]=true&sort=-created_at");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
],
]);
$data = json_decode(curl_exec($ch), true);
{
"data": [
{
"type": "reward",
"id": "reward_abc",
"attributes": {
"name": "£5 off your next order",
"description": null,
"discount_type": "fixed",
"reward_type": "loyalty",
"points_cost": 500,
"discount_amount": 5.00,
"minimum_spend": 20.00,
"is_active": true,
"max_redemptions": null,
"expiry_days": 30,
"tier_name": null,
"redemption_mode": "standard",
"free_product": null,
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-01-01T00:00:00.000Z"
}
}
],
"meta": {
"total": 3,
"page": 1,
"per_page": 20,
"total_pages": 1
}
}
{
"errors": [
{
"status": "401",
"title": "Unauthorized",
"detail": "Invalid or revoked API key"
}
]
}
⌘I