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

# List Orders

> Retrieve a paginated list of orders with optional filters.

# List Orders

<div className="flex items-center gap-2 mb-4">
  <span className="px-2 py-1 bg-green-100 text-green-800 rounded text-sm font-mono font-bold">GET</span>
  <code>/orders</code>
</div>

Returns a paginated list of orders for the authenticated store. Includes customer and transaction data.

<Snippet file="rmz-plus-required.mdx" />

## Authentication

<Snippet file="auth-bearer-header.mdx" />

## Headers

| Header          | Value                   | Required    |
| --------------- | ----------------------- | ----------- |
| `Authorization` | `Bearer YOUR_API_TOKEN` | Yes         |
| `Accept`        | `application/json`      | Recommended |

## Query Parameters

| Parameter        | Type    | Required | Description                                                           |
| ---------------- | ------- | -------- | --------------------------------------------------------------------- |
| `page`           | integer | No       | Page number (default: 1)                                              |
| `created_from`   | date    | No       | Filter orders created on or after this date (e.g., `2024-01-01`)      |
| `created_to`     | date    | No       | Filter orders created on or before this date                          |
| `orderBy`        | string  | No       | Sort field: `id`, `created_at`, `updated_at`, `total` (default: `id`) |
| `orderDirection` | string  | No       | Sort direction: `asc` or `desc` (default: `desc`)                     |

## Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://merchant-api.rmz.gg/shawarma/orders?page=1&orderBy=created_at&orderDirection=desc" \
    -H "Authorization: Bearer YOUR_API_TOKEN"
  ```

  ```javascript JavaScript theme={null}
  const params = new URLSearchParams({
    page: "1",
    orderBy: "created_at",
    orderDirection: "desc"
  });

  const response = await fetch(
    `https://merchant-api.rmz.gg/shawarma/orders?${params}`,
    { headers: { "Authorization": "Bearer YOUR_API_TOKEN" } }
  );
  const orders = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://merchant-api.rmz.gg/shawarma/orders",
      headers={"Authorization": "Bearer YOUR_API_TOKEN"},
      params={
          "page": 1,
          "orderBy": "created_at",
          "orderDirection": "desc"
      }
  )
  orders = response.json()
  ```

  ```php PHP theme={null}
  $params = http_build_query([
      "page" => 1,
      "orderBy" => "created_at",
      "orderDirection" => "desc"
  ]);

  $ch = curl_init("https://merchant-api.rmz.gg/shawarma/orders?{$params}");
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      "Authorization: Bearer YOUR_API_TOKEN"
  ]);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  $response = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>

## Success Response

```json theme={null}
{
  "message": null,
  "data": {
    "current_page": 1,
    "data": [
      {
        "id": 78901,
        "store_id": 1,
        "customer_id": 123,
        "coupon_id": null,
        "total": 299.99,
        "checkout_id": 55001,
        "current_status": 4,
        "seen_at": null,
        "order_review_notification_sent_at": null,
        "tax_rate": null,
        "tax_amount": null,
        "prices_include_tax": false,
        "tax_country_code": null,
        "tax_registration_number": null,
        "created_at": "2024-01-15T14:30:00.000000Z",
        "updated_at": "2024-01-15T15:00:00.000000Z",
        "human_format": {
          "date_human": "منذ شهرين",
          "date_normal": "Mon, Jan 15, 2024 2:30 PM"
        },
        "transaction": {
          "id": 5001,
          "total": 299.99,
          "deserved": 280.00,
          "payment_method": "dokanpay",
          "is_refunded": false,
          "order_id": 78901,
          "human_format": {
            "payment.method": "البطائق الإئتمانية",
            "created_at": null,
            "created_at_text": null,
            "store_balance_scheduled_at_text": null,
            "store_balance_scheduled_at": null
          }
        },
        "customer": {
          "id": 123,
          "firstName": "Ahmed",
          "lastName": "Ali",
          "email": "ahmed@example.com",
          "country_code": "966",
          "phone": "501234567"
        }
      }
    ],
    "first_page_url": "https://merchant-api.rmz.gg/shawarma/orders?page=1",
    "from": 1,
    "next_page_url": "https://merchant-api.rmz.gg/shawarma/orders?page=2",
    "path": "https://merchant-api.rmz.gg/shawarma/orders",
    "per_page": 15,
    "prev_page_url": null,
    "to": 15
  },
  "api": "rmz.shawarma",
  "timestamp": 1699999999
}
```

<Note>
  The `transaction.human_format` values for `created_at` and `store_balance_scheduled_at` appear as `null` in the list endpoint because only specific transaction columns are selected. The `payment.method` field returns the Arabic translation of the payment method.
</Note>

## Filtering by Date Range

```bash theme={null}
curl -X GET "https://merchant-api.rmz.gg/shawarma/orders?created_from=2024-01-01&created_to=2024-01-31" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

## Error Responses

| Code  | Description                                  |
| ----- | -------------------------------------------- |
| `401` | Unauthorized — invalid or missing token      |
| `422` | Validation error — invalid filter parameters |
