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

# Orders

> List and view order details via the Management API

# Orders

Retrieve order information including items, fulfillment orders, and shop data.

## List Orders

```bash theme={null}
GET /v1/management/orders
```

<ParamField query="page" type="integer" default="0">
  Page number (0-indexed)
</ParamField>

<ParamField query="limit" type="integer" default="50">
  Number of orders per page
</ParamField>

<ParamField query="created_at_from" type="integer">
  Filter orders created at or after this Unix timestamp
</ParamField>

<ParamField query="created_at_to" type="integer">
  Filter orders created at or before this Unix timestamp
</ParamField>

<ParamField query="updated_at_from" type="integer">
  Filter orders updated at or after this Unix timestamp
</ParamField>

<ParamField query="updated_at_to" type="integer">
  Filter orders updated at or before this Unix timestamp
</ParamField>

<ParamField query="shop_identifier" type="string">
  Filter by the shop's identifier (the string you configured when the shop
  was set up). Only orders whose linked shop belongs to your organisation
  and has this identifier are returned.
</ParamField>

<ParamField query="shop_order_external_id" type="string">
  Filter by the external order id assigned by the shop or e-commerce
  platform (for example, the Shopify order number). Combine with
  `shop_identifier` to look up a specific shop order.
</ParamField>

<ParamField query="search" type="string">
  Free-text search across the Shopify order name, the pharmacy order name
  (e.g. `PO-XXXX-XXXX-XXXX`), and the patient's full name. The same value
  is also matched as an exact UID against the order, its prescriptions,
  and its pharmacy orders, so you can paste an identifier directly. A
  leading `#` is stripped before the UID lookup so values copied from the
  admin interface (e.g. `#ord_…`) resolve as expected.
</ParamField>

**Required permission:** `order:read`

### Example Request

```bash theme={null}
curl -X GET "https://api.rxscale.com/v1/management/orders?page=0&limit=25&updated_at_from=1712300000" \
  -H "X-API-Key: your-api-key-here"
```

### Look Up a Specific Shop Order

Combine `shop_identifier` and `shop_order_external_id` to fetch the single
order that matches both. The response shape is unchanged (a paginated
list), but the result contains at most one order.

```bash theme={null}
curl -X GET "https://api.rxscale.com/v1/management/orders?shop_identifier=my-shop&shop_order_external_id=EXT-12345" \
  -H "X-API-Key: your-api-key-here"
```

### Response

```json theme={null}
{
  "orders": [
    {
      "uid": "ord-abc123",
      "status": "waiting for doctor",
      "overall_status": "pending",
      "created_at": 1712300000,
      "updated_at": 1712400000,
      "shop_order": {
        "uid": "so-789",
        "external_id": "EXT-12345",
        "shop": {
          "uid": "shop-456",
          "identifier": "my-shop"
        }
      },
      "items": [
        {
          "uid": "oi-001",
          "sku_uid": "sku-456",
          "sku_display_name": "Medication X 100mg",
          "sku_pzn": "12345678",
          "amount": 2,
          "prescription_uid": "px-001"
        }
      ],
      "fulfillment_orders": [
        {
          "uid": "fo-001",
          "status": "OPEN",
          "external_id": "ext-fo-1",
          "items": [
            {
              "uid": "foi-001",
              "order_item_uid": "oi-001",
              "status": "OPEN",
              "amount": 2
            }
          ]
        }
      ],
      "prescriptions": [
        {
          "uid": "px-001",
          "status": "signed",
          "doctor_uid": "doc-456",
          "doctor_name": "Dr. Schmidt"
        }
      ]
    }
  ],
  "totalRegistries": 150,
  "totalPages": 6
}
```

### Response Fields

| Field                               | Type    | Description                                                    |
| ----------------------------------- | ------- | -------------------------------------------------------------- |
| `orders[].uid`                      | string  | Order UID                                                      |
| `orders[].status`                   | string  | Order status                                                   |
| `orders[].overall_status`           | string  | Computed overall status                                        |
| `orders[].created_at`               | integer | Creation timestamp (Unix)                                      |
| `orders[].updated_at`               | integer | Last update timestamp (Unix)                                   |
| `orders[].shop_order`               | object  | Shop and external order reference                              |
| `orders[].items`                    | array   | Order items with SKU info                                      |
| `orders[].items[].sku_display_name` | string  | SKU display name                                               |
| `orders[].items[].sku_pzn`          | string  | Pharmazentralnummer                                            |
| `orders[].items[].amount`           | integer | Quantity                                                       |
| `orders[].items[].prescription_uid` | string  | Linked prescription (only with `prescription:read`)            |
| `orders[].fulfillment_orders`       | array   | Fulfillment orders with status and items                       |
| `orders[].prescriptions`            | array   | Prescriptions with doctor info (only with `prescription:read`) |
| `totalRegistries`                   | integer | Total number of orders                                         |
| `totalPages`                        | integer | Total number of pages                                          |

## Get Order Details

```bash theme={null}
GET /v1/management/orders/{order_uid}
```

<ParamField path="order_uid" type="string" required>
  The order UID
</ParamField>

**Required permission:** `order:read`

Returns the same structure as a single entry in the list response.

### Example Request

```bash theme={null}
curl -X GET "https://api.rxscale.com/v1/management/orders/ord-abc123" \
  -H "X-API-Key: your-api-key-here"
```

## Prescription Data

Prescription data is only included when your API key also has the `prescription:read` permission. Without it:

* The `prescriptions` array is returned as `[]`
* The `prescription_uid` field is removed from order items

<Note>
  If you need prescription details, ensure your API key has both `order:read` and `prescription:read` permissions. Contact your RxScale account manager to adjust permissions.
</Note>
