> For the complete documentation index, see [llms.txt](https://docs.commercelayer.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.commercelayer.io/core-api-reference/line_items/list.md).

# List all line items

To [fetch](https://docs.commercelayer.io/core/fetching-resources) a collection of line items, send a `GET` request to the `/api/line_items` endpoint.

## Request

**GET** <https://yourdomain.commercelayer.io/api/line\\_items>

### **Example**

{% tabs %}
{% tab title="Request" %}
The following request fetches a collection of line items:

```shell
curl -g -X GET \
  'https://yourdomain.commercelayer.io/api/line_items/' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token'
```

{% endtab %}

{% tab title="Response" %}
On success, the API responds with a `200 OK` status code, returning a paginated collection of resource objects:

```json
{
  "data": [
    {
      "id": "XAyRWNUzyN",
      "type": "line_items",
      "links": {
        "self": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN"
      },
      "attributes": {
        "sku_code": "TSHIRTMM000000FFFFFFXLXX",
        "bundle_code": "BUNDLEMM000000FFFFFFXLXX",
        "quantity": 4,
        "_external_price": true,
        "currency_code": "EUR",
        "unit_amount_cents": 10000,
        "unit_amount_float": 100.0,
        "formatted_unit_amount": "€100,00",
        "compare_at_amount_cents": 13000,
        "compare_at_amount_float": 130.0,
        "formatted_compare_at_amount": "€130,00",
        "options_amount_cents": 1000,
        "options_amount_float": 10.0,
        "formatted_options_amount": "€10,00",
        "discount_cents": -1000,
        "discount_float": 10.0,
        "formatted_discount": "€10,00",
        "total_amount_cents": 18800,
        "total_amount_float": 188.0,
        "formatted_total_amount": "€188,00",
        "tax_amount_cents": 1880,
        "tax_amount_float": 18.8,
        "formatted_tax_amount": "€18,80",
        "name": "Men's Black T-shirt with White Logo (XL)",
        "image_url": "https://img.yourdomain.com/skus/xYZkjABcde.png",
        "discount_breakdown": {
          "41": {
            "name": "10% ALL",
            "cents": -900,
            "weight": 0.416,
            "coupon_code": "XXXXXXXX"
          }
        },
        "tax_rate": 0.22,
        "tax_breakdown": {
          "id": "1234",
          "city_amount": "0.0",
          "state_amount": 6.6,
          "city_tax_rate": 0.0,
          "county_amount": 2.78,
          "taxable_amount": 139.0,
          "county_tax_rate": 0.02,
          "tax_collectable": 10.08,
          "special_tax_rate": 0.005,
          "combined_tax_rate": 0.0725,
          "city_taxable_amount": 0.0,
          "state_sales_tax_rate": 0.0475,
          "state_taxable_amount": 139.0,
          "county_taxable_amount": 139.0,
          "special_district_amount": 0.7,
          "special_district_taxable_amount": 139.0
        },
        "item_type": "skus",
        "frequency": "monthly",
        "coupon_code": "SUMMERDISCOUNT",
        "rule_outcomes": [],
        "created_at": "2018-01-01T12:00:00.000Z",
        "updated_at": "2018-01-01T12:00:00.000Z",
        "reference": "ANY-EXTERNAL-REFEFERNCE",
        "reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
        "metadata": {
          "foo": "bar"
        }
      },
      "relationships": {
        "order": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/relationships/order",
            "related": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/order"
          }
        },
        "item": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/relationships/item",
            "related": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/item"
          }
        },
        "sku": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/relationships/sku",
            "related": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/sku"
          }
        },
        "bundle": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/relationships/bundle",
            "related": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/bundle"
          }
        },
        "adjustment": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/relationships/adjustment",
            "related": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/adjustment"
          }
        },
        "gift_card": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/relationships/gift_card",
            "related": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/gift_card"
          }
        },
        "shipment": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/relationships/shipment",
            "related": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/shipment"
          }
        },
        "payment_method": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/relationships/payment_method",
            "related": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/payment_method"
          }
        },
        "line_item_options": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/relationships/line_item_options",
            "related": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/line_item_options"
          }
        },
        "return_line_items": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/relationships/return_line_items",
            "related": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/return_line_items"
          }
        },
        "stock_reservations": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/relationships/stock_reservations",
            "related": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/stock_reservations"
          }
        },
        "stock_line_items": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/relationships/stock_line_items",
            "related": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/stock_line_items"
          }
        },
        "stock_transfers": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/relationships/stock_transfers",
            "related": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/stock_transfers"
          }
        },
        "notifications": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/relationships/notifications",
            "related": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/notifications"
          }
        },
        "events": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/relationships/events",
            "related": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/events"
          }
        },
        "tags": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/relationships/tags",
            "related": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/tags"
          }
        },
        "event_stores": {
          "links": {
            "self": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/relationships/event_stores",
            "related": "https://yourdomain.commercelayer.io/api/line_items/XAyRWNUzyN/event_stores"
          }
        }
      },
      "meta": {
        "mode": "test",
        "organization_id": "xRRkjDFafe",
        "trace_id": "69abaa3545913c78132e5578bd26208d44aa9043647d78698fd0021f3958cd74"
      }
    },
    {
      "other": "... 9 line_items (first page)"
    }
  ],
  "meta": {
    "record_count": 140,
    "page_count": 14,
    "page_size": 10,
    "page_number": 1,
    "mode": "test",
    "organization_id": "xRRkjDFafe",
    "trace_id": "69abaa3545913c78132e5578bd26208d44aa9043647d78698fd0021f3958cd74"
  },
  "links": {
    "first": "https://yourdomain.commercelayer.io/api/line_items?page[number]=1&page[size]=10",
    "next": "https://yourdomain.commercelayer.io/api/line_items?page[number]=2&page[size]=10",
    "last": "https://yourdomain.commercelayer.io/api/line_items?page[number]=14&page[size]=10"
  }
}
```

{% endtab %}
{% endtabs %}

Remember that when you fetch a list of resources you get [paginated](https://docs.commercelayer.io/core/pagination) result.

### Sortable fields

The list of line items can be [sorted](https://docs.commercelayer.io/core/sorting-results) by the following fields:

#### Attributes

* `currency_code`
* `unit_amount_cents`
* `compare_at_amount_cents`
* `options_amount_cents`
* `discount_cents`
* `total_amount_cents`
* `tax_amount_cents`
* `name`
* `item_type`
* `id`
* `circuit_state`
* `circuit_failure_count`
* `created_at`
* `updated_at`
* `reference`
* `reference_origin`

#### Relationships

* `order`

### Filterable fields

The list of line items can be [filtered](https://docs.commercelayer.io/core/filtering-data) by the following fields:

#### Attributes

* `sku_code`
* `quantity`
* `currency_code`
* `unit_amount_cents`
* `compare_at_amount_cents`
* `options_amount_cents`
* `discount_cents`
* `total_amount_cents`
* `tax_amount_cents`
* `name`
* `image_url`
* `item_type`
* `id`
* `circuit_state`
* `circuit_failure_count`
* `created_at`
* `updated_at`
* `reference`
* `reference_origin`
* `metadata`

#### Relationships

* `order`
* `sku`
* `bundle`
* `adjustment`
* `gift_card`
* `shipment`
* `payment_method`
* `line_item_options`
* `return_line_items`
* `stock_reservations`
* `stock_line_items`
* `stock_transfers`
* `notifications`
* `events`
* `tags`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.commercelayer.io/core-api-reference/line_items/list.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
