# List customers

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


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

Retrieves a list of customers added to your Chargebee site. The list contains the necessary customer details such as First Name, Last Name and the Customer ID.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v1/customers \
     -u {site_api_key}:
```

#### .NET

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

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

foreach (var listItem in result.List){
  Customer customer = listItem.Customer;
  Card card = listItem.Card;
}
```

#### Go

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

#### 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.CustomerListRequest{}
  res, err := client.Customer.List(req)
      if err != nil {
        fmt.Println(err)
    } else {
        for idx := 0; idx < len(res.List); idx++ {
            Customer := res.List[idx].Customer
            Card := res.List[idx].Card
        }
    }
}
```

#### 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 = Customer.list().request();

        for (ListResult.Entry entry : result) {
            Customer customer = entry.customer();
            Card card = entry.card();
        }
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.card.Card;
import com.chargebee.v4.models.customer.Customer;
import com.chargebee.v4.models.customer.params.CustomerListParams;
import com.chargebee.v4.models.customer.responses.CustomerListResponse;
import java.util.List;

public class CustomerList {

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

        CustomerListResponse response = client.customers().list();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

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

try {
    const result = await chargebee.customer.list();
    result.list.forEach((entry) => {
        console.log(entry);
        const customer = entry.customer;
        const card = entry.card;
    });
} 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->customer()->all();
foreach($result->list as $entry) {
    $customer = $entry->customer;
    $card = $entry->card;
}
```

#### Python

```python
from chargebee import Chargebee, Filters

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
entries = cb_client.Customer.list()
for entry in entries.list:
    customer = entry.customer
    card = entry.card
```

#### Ruby

```ruby
require 'chargebee'

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

list = ChargeBee::Customer.list()

list.each do |entry|
  customer = entry.customer
  card = entry.card
end
```

## Sample Response

```json
{
  "list": [
    {
      "customer": {
        "account_credits": 0,
        "allow_direct_debit": false,
        "auto_collection": "on",
        "card_status": "no_card",
        "created_at": 1517506685,
        "email": "john@test.com",
        "excess_payments": 0,
        "first_name": "John",
        "id": "__test__5SK0bLNFRFuBzHXC8",
        "last_name": "Doe",
        "object": "customer",
        "refundable_credits": 0,
        "taxability": "taxable"
      }
    },
    {..}
  ],
  "next_offset": "[\"1517506680000\",\"154000000144\"]"
}
```

## URL Format

**GET** https://[site].chargebee.com/api/v1/customers

## 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`.

- `customer` (Customer object)
  Resource object representing customer

- `card` (Card object)
  Resource object representing card
