# List order lines

> Your store's sales, line by line, most recent first: which product sold, the culture line it is matched to, how many, at what unit price, and when. Filter with from and to for a period and product_link_id for one product.

Source: https://docs.xplantpro.com/docs/api/commerce/list-order-lines

`GET https://app.xplantpro.com/api/v1/commerce/order-lines`

- Required scope: `read:commerce`
- Credentials: workspace API key (`xpk_`)
- Idempotency-Key: ignored on this endpoint

Order lines carry no buyer details — no names, email or postal addresses — and leave out your store's order numbers. For totals, use the sell-through summary rather than adding these lines up: amounts are exact decimal text, and lines in different currencies must never be added together.

Needs culture line pricing, which includes sell-through, in the workspace's plan; without it the answer is `FEATURE_NOT_INCLUDED`.

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `from` | string (date-time) | No | Only sales at or after this time, as an ISO 8601 timestamp. |
| `to` | string (date-time) | No | Only sales at or before this time, as an ISO 8601 timestamp. |
| `product_link_id` | string (uuid) | No | Only lines for this store product, by the `product_link_id` an order line carries. |
| `limit` | integer | No | Page size. Values above 200 are capped at 200. Default `50`. From 1 to 200. |
| `offset` | integer | No | Number of records to skip. Prefer `cursor` where a list offers it: an offset shifts when records are added ahead of it. Default `0`. At least 0. |
| `cursor` | string | No | Continue from the previous page: pass its `meta.next_cursor` unchanged, with the same filters. Treat it as opaque. Not combinable with `offset`. Up to 2048 characters. |

## Example

**curl**

```bash
curl "https://app.xplantpro.com/api/v1/commerce/order-lines?from=2026-09-01T00%3A00%3A00Z&to=2026-09-25T00%3A00%3A00Z" \
  -H "Authorization: Bearer $XPLANT_API_KEY"
```

**JavaScript**

```js
import { XPlantClient } from "@shmaplex/xplant-sdk";

const client = new XPlantClient({ apiKey: process.env.XPLANT_API_KEY });

const lines = await client.commerce.listOrderLines({ from: "2026-09-01T00:00:00Z", to: "2026-09-25T00:00:00Z" });
```

**Python**

```python
import os
import requests

resp = requests.get(
    "https://app.xplantpro.com/api/v1/commerce/order-lines",
    headers={"Authorization": f"Bearer {os.environ['XPLANT_API_KEY']}"},
    params={
        "from": "2026-09-01T00:00:00Z",
        "to": "2026-09-25T00:00:00Z",
    },
    timeout=10,
)
body = resp.json()
if not body["ok"]:
    raise RuntimeError(f"{resp.status_code} {body['code']}: {body['error']}")
lines = body["data"]
```

## Response

`200` with `{ "ok": true, "data": … }`. `data` is an array. To get the next page, pass `meta.next_cursor` back as `cursor`; it is `null` on the last page. See [Pagination](https://docs.xplantpro.com/docs/pagination.md).

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string (uuid) | Yes | — |
| `product_link_id` | string \| null (uuid) | Yes | The store product this line sold, as xPlant tracks it; null when it is not tracked yet. Pass it as `product_link_id` to list that product's lines. |
| `plant_id` | string \| null (uuid) | Yes | The culture line the product is matched to (a plant id). Null until someone in the lab matches the product. |
| `store_product_id` | string \| null | Yes | Your store's own id for the product. |
| `store_variant_id` | string \| null | Yes | Your store's own id for the variant, when the product has variants. |
| `quantity` | integer | Yes | — |
| `unit_price` | object \| null | Yes | The price per unit, with its currency. Null when your store reported none. |
| `occurred_at` | string \| null | Yes | When the sale happened in your store, as an ISO 8601 timestamp in UTC. |

```json title="Response"
{
  "ok": true,
  "data": [
    {
      "id": "9b3d5f7a-1c2e-4a4b-8d6f-0e2a4c6e8b1d",
      "product_link_id": "f2a4c6e8-0b1d-4e3f-a5b7-c9d1e3f5a7b9",
      "plant_id": "6d1b3f8a-4c2e-4a97-b5d0-8e7f2a1c9b43",
      "store_product_id": "prod-5521",
      "store_variant_id": "var-5521-4in",
      "quantity": 3,
      "unit_price": {
        "amount": "18.50",
        "currency": "USD"
      },
      "occurred_at": "2026-09-21T15:02:44.000Z"
    }
  ]
}
```

The envelope can also carry `meta`:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `next_cursor` | string \| null | Yes | Pass as `cursor` to fetch the next page. `null` means this is the last page. |

| Response header | Meaning |
| --- | --- |
| `X-Request-Id` | Identifies this request. Include it when you contact support. |

## Errors

| Status | Code | When |
| --- | --- | --- |
| `401` | `UNAUTHORIZED` | The key is missing, malformed or revoked, or its owner is no longer a member of the workspace. |
| `402` | `PAID_PLAN_REQUIRED` | The workspace's plan does not include the API. The full API is included with xPlant+ Teams and Enterprise; on Hobby and Pro Lab, keys can connect devices only. |
| `402` | `FEATURE_NOT_INCLUDED` | Culture line pricing, which includes sell-through, is not included in your plan. |
| `403` | `FORBIDDEN` | The key lacks a scope this operation requires, or its owner's current role in the workspace cannot use it — a key never does more than its owner can in xPlant. `error` names the scope, and for a role, the role it needs. |
| `403` | `DEVICE_TOKEN_NOT_ACCEPTED` | A device token was sent; this operation needs a workspace API key. |
| `404` | `NOT_FOUND` | `product_link_id` names no store product in the key's workspace. |
| `422` | `VALIDATION_ERROR` | Both `cursor` and `offset` were sent; use one. |
| `422` | `INVALID_CURSOR` | The cursor is malformed, or came from a different list or different filters. Start again without it. |
| `422` | `VALIDATION_ERROR` | A query parameter is malformed, or `from` is later than `to`. `error` names it. |
| `429` | `RATE_LIMIT_EXCEEDED` | Too many requests for this key, device token or workspace. Wait `Retry-After` seconds. |
| `500` | `FEATURE_CHECK_FAILED` | Your plan could not be checked. Retry later. |
| `500` | `SELL_THROUGH_EVENT_QUERY_FAILED` | The sales could not be read. Retry later. |

Branch on `code`, never on the `error` text. See [Errors](https://docs.xplantpro.com/docs/errors.md).
