# List items

> For the complete machine-readable documentation index, see [llms.txt](https://apidocs.chargebee.com/llms.txt).


[Eventually Consistent](/docs/api/read-consistency)

Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order.

### Use Cases

##### Filter by custom fields[](#filter-by-custom-fields)

**Note:** Custom field filters are turned off by default. To turn them on for your site, contact [Chargebee Support](https://www.chargebee.com/docs/billing/2.0/kb/getting-started/how-to-contact-chargebees-support-team?utm_source=docs_api&utm_medium=content&utm_campaign=support).

You can filter the response by [custom fields](/docs/api/advanced-features#filtering-by-custom-field-values) configured on items. After they're turned on for your site, the filter parameters are visible on this page when you're logged in. For the supported operators and limits, see [Filtering by custom field values](/docs/api/advanced-features#filtering-by-custom-field-values).

Items can be one of three types: `plan`, `addon`, or `charge`. Each type can have its own custom fields, so the filter parameter is scoped per item type rather than shared across items.

Use one of the following forms, where `cf_CUSTOM_FIELD_NAME` is the exact, case-sensitive API name of a custom field configured on the corresponding item type:

For example, to filter plan items by the custom field `cf_package_id`, pass it as a query parameter:

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/items \
     -G  \
     -u {site_api_key}:\
     --data-urlencode limit=2
```

#### .NET

```dotnet
using ChargeBee.Api;
using ChargeBee.Models;

ApiConfig.Configure("{site}","{site_api_key}");
ListResult result = Item.List()
		.Limit(2)
		.Request();

foreach (var listItem in result.List){
  Item item = listItem.Item;
}
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    itemAction "github.com/chargebee/chargebee-go/v3/actions/item"
    "github.com/chargebee/chargebee-go/v3/models/item"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := itemAction.List(&item.ListRequestParams{
        Limit : chargebee.Int32(2),
    }).ListRequest()
    if err != nil {
        fmt.Println(err)
    } else {
        for idx := 0; idx < len(res.List); idx++ {
            Item := res.List[idx].Item
        }
    }
}
```

#### Go

```go
package main

import (
  "fmt"
  "github.com/chargebee/chargebee-go/v4"
)

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  req := &chargebee.ItemListRequest{
    Limit : chargebee.Int32(2),
}
  res, err := client.Item.List(req)
      if err != nil {
        fmt.Println(err)
    } else {
        for idx := 0; idx < len(res.List); idx++ {
            Item := res.List[idx].Item
        }
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import java.io.IOException;
import java.util.List;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        ListResult result = Item.list()
            .limit(2)
            .request();

        for (ListResult.Entry entry : result) {
            Item item = entry.item();
        }
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.item.Item;
import com.chargebee.v4.models.item.params.ItemListParams;
import com.chargebee.v4.models.item.responses.ItemListResponse;
import java.util.List;

public class ItemList {

    public static void main(String[] args) {
        ChargebeeClient client = ChargebeeClient.builder()
            .apiKey("{site_api_key}")
            .siteName("{site}")
            .build();

        ItemListParams params = ItemListParams.builder()
            .limit(2)
            .build();

        ItemListResponse response = client.items().list(params);
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

const chargebee = new Chargebee({
    site: "{site}",
    apiKey: "{site_api_key}",
});

try {
    const result = await chargebee.item.list({
        limit: 2
    });
    result.list.forEach((entry) => {
        console.log(entry);
        const item = entry.item;
    });
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->item()->all([
    "limit" => 2
]);
foreach($result->list as $entry) {
    $item = $entry->item;
}
```

#### Python

```python
from chargebee import Chargebee, Filters

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
entries = cb_client.Item.list(
    cb_client.Item.ListParams(
        limit=2
    )
)
for entry in entries.list:
    item = entry.item
```

#### Ruby

```ruby
require 'chargebee'

ChargeBee.configure(:site => "{site}",
  :api_key => "{site_api_key}")

list = ChargeBee::Item.list({
  :limit => 2
})

list.each do |entry|
  item = entry.item
end
```

## Sample Response

```json
{
  "list": [
    {
      "item": {
        "applicable_items": [
          {
            "id": "day-pass"
          },
          {..}
        ],
        "enabled_for_checkout": true,
        "enabled_in_portal": true,
        "id": "gold",
        "is_giftable": false,
        "is_shippable": false,
        "item_applicability": "restricted",
        "name": "Gold",
        "object": "item",
        "resource_version": 1599817250235,
        "status": "active",
        "type": "plan",
        "updated_at": 1599817250
      }
    },
    {..}
  ],
  "next_offset": "1"
}
```

## URL Format

**GET** https://[site].chargebee.com/api/v2/items

## Input Parameters

- `limit` (optional, integer, default=10, min=1, max=100)
  The number of resources to be returned.

- `offset` (optional, string, max chars=1000)
  Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call.

## Returns

- `next_offset` (optional, string, max chars=1000)
  This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`.

- `item` (Item object)
  Resource object representing item
