> ## Documentation Index
> Fetch the complete documentation index at: https://developers.mageloyalty.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List rewards

> List all rewards for the shop.

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](/api-reference/rewards/object) along with a `meta` object describing the page.

<RequestExample>
  ```bash cURL theme={null}
  curl --request GET \
    --url 'https://api.mageloyalty.com/v1/rewards?filter[is_active]=true&sort=-created_at' \
    --header 'Authorization: <api-key>'
  ```

  ```javascript Node theme={null}
  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();
  ```

  ```python Python theme={null}
  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 PHP theme={null}
  <?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);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "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
    }
  }
  ```

  ```json 401 Unauthorized theme={null}
  {
    "errors": [
      {
        "status": "401",
        "title": "Unauthorized",
        "detail": "Invalid or revoked API key"
      }
    ]
  }
  ```
</ResponseExample>
