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

# List Orders

> Retrieve a list of all orders with optional filtering

# List Orders

Returns a paginated list of orders, ordered by creation date (most recent first). Supports filtering by status, customer, payment status, and date range.

## Authentication

```bash theme={null}
Authorization: Bearer glm_test_YOUR_API_KEY
```

## Query Parameters

| Parameter        | Type      | Description                                                                                     |
| ---------------- | --------- | ----------------------------------------------------------------------------------------------- |
| `limit`          | integer   | Number of results per page (default: 10, max: 100)                                              |
| `starting_after` | string    | Cursor for pagination (order ID)                                                                |
| `status`         | enum      | Filter by status: `pending`, `processing`, `completed`, `failed`, `cancelled`                   |
| `payment_status` | enum      | Filter by payment status: `pending`, `authorized`, `captured`, `failed`, `refunded`, `disputed` |
| `customer_email` | string    | Filter by customer email                                                                        |
| `created_after`  | timestamp | Filter orders created after this date                                                           |
| `created_before` | timestamp | Filter orders created before this date                                                          |

## Request

```bash theme={null}
GET /api/v2/orders?limit=10&status=completed
```

## Response

> All monetary amounts are integers in cents (e.g., 4995 = \$49.95).

```json theme={null}
{
  "data": [
    {
      "id": "ord_abc123",
      "order_number": "ORD-2025-001234",
      "status": "completed",
      "payment_status": "captured",
      "customer": {
        "email": "customer@example.com",
        "first_name": "Jane",
        "last_name": "Doe"
      },
      "amounts": {
        "total": 4235,
        "hsa_amount": 2995,
        "regular_amount": 0
      },
      "payment": {
        "payment_method": "hsa_fsa_card",
        "last4": "1111"
      },
      "created_at": "2025-10-18T15:00:00Z",
      "completed_at": "2025-10-18T15:30:00Z"
    },
    {
      "id": "ord_def456",
      "order_number": "ORD-2025-001235",
      "status": "completed",
      "payment_status": "captured",
      "customer": {
        "email": "member@example.com",
        "first_name": "John",
        "last_name": "Smith"
      },
      "amounts": {
        "total": 9900,
        "hsa_amount": 9900,
        "regular_amount": 0
      },
      "payment": {
        "payment_method": "hsa_fsa_card",
        "last4": "2222"
      },
      "created_at": "2025-10-17T10:00:00Z",
      "completed_at": "2025-10-17T10:15:00Z"
    }
  ],
  "has_more": true,
  "next_cursor": "ord_def456"
}
```

## Response Fields

| Field         | Type    | Description                                    |
| ------------- | ------- | ---------------------------------------------- |
| `data`        | array   | Array of order objects                         |
| `has_more`    | boolean | Whether more results are available             |
| `next_cursor` | string  | Cursor for next page (use as `starting_after`) |

## Examples

### List All Orders

```bash theme={null}
curl https://api.withgale.com/api/v2/orders \
  -H "Authorization: Bearer glm_test_YOUR_API_KEY"
```

### Filter by Status

```bash theme={null}
curl "https://api.withgale.com/api/v2/orders?status=completed&limit=50" \
  -H "Authorization: Bearer glm_test_YOUR_API_KEY"
```

### Filter by Payment Status

```bash theme={null}
curl "https://api.withgale.com/api/v2/orders?payment_status=captured" \
  -H "Authorization: Bearer glm_test_YOUR_API_KEY"
```

### Filter by Customer

```bash theme={null}
curl "https://api.withgale.com/api/v2/orders?customer_email=jane@example.com" \
  -H "Authorization: Bearer glm_test_YOUR_API_KEY"
```

## Errors

| Status Code | Error Code            | Description                |
| ----------- | --------------------- | -------------------------- |
| 400         | `invalid_request`     | Invalid query parameters   |
| 401         | `unauthorized`        | Invalid or missing API key |
| 429         | `rate_limit_exceeded` | Too many requests          |

Example error:

```json theme={null}
{
  "error": {
    "code": "invalid_request",
    "message": "Invalid status value",
    "param": "status"
  }
}
```

## Related

* [Get Order](/api-reference/endpoint/get-order)
* [Create Refund](/api-reference/endpoint/create-refund)
* [Order Object](/api-reference/objects/order)
* [Webhooks Reference](/developer-manual/webhooks)
