# List customers

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


[Eventually Consistent](/docs/api/v2/pcv-1/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/v2/customers \
     -G  \
     -u {site_api_key}:\
     --data-urlencode "first_name[is]"="John" \
     --data-urlencode "last_name[is]"="Doe" \
     --data-urlencode "email[is]"="john@test.com"
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
ListResult result = Customer.List()
		.FirstName().Is("John")
		.LastName().Is("Doe")
		.Email().Is("john@test.com")
		.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"
    "github.com/chargebee/chargebee-go/v3/filter"
    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{
        FirstName : &filter.StringFilter{
            Is : "John",
        },
        LastName : &filter.StringFilter{
            Is : "Doe",
        },
        Email : &filter.StringFilter{
            Is : "john@test.com",
        },
    }).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{
    FirstName : &chargebee.StringFilter{
        Is : "John",
    },
    LastName : &chargebee.StringFilter{
        Is : "Doe",
    },
    Email : &chargebee.StringFilter{
        Is : "john@test.com",
    },
}
  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().firstName().is("John").lastName().is("Doe").email().is("john@test.com").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();

        CustomerListParams params = CustomerListParams.builder()
            .firstName()
            .is("John")
            .lastName()
            .is("Doe")
            .email()
            .is("john@test.com")
            .build();

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

#### Node.js

```node
import Chargebee from "chargebee";

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

try {
    const result = await chargebee.customer.list({
        first_name: {
            is: "John"
        },
        last_name: {
            is: "Doe"
        },
        email: {
            is: "john@test.com"
        }
    });
    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([
    "first_name" => [
        "is" => "John"
    ],
    "last_name" => [
        "is" => "Doe"
    ],
    "email" => [
        "is" => "john@test.com"
    ]
]);
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(
    cb_client.Customer.ListParams(
        first_name=Filters.StringFilter(IS="John"),
        last_name=Filters.StringFilter(IS="Doe"),
        email=Filters.StringFilter(IS="john@test.com")
    )
)
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({
  "first_name[is]" => "John",
  "last_name[is]" => "Doe",
  "email[is]" => "john@test.com"
})

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

## Sample Response

```json
{
  "list": [
    {
      "customer": {
        "allow_direct_debit": false,
        "auto_collection": "on",
        "card_status": "no_card",
        "created_at": 1517505747,
        "deleted": false,
        "email": "john@test.com",
        "excess_payments": 0,
        "first_name": "John",
        "id": "__test__KyVnHhSBWlC1T2cj",
        "last_name": "Doe",
        "net_term_days": 0,
        "object": "customer",
        "pii_cleared": "active",
        "preferred_currency_code": "USD",
        "promotional_credits": 0,
        "refundable_credits": 0,
        "resource_version": 1517505747000,
        "taxability": "taxable",
        "unbilled_charges": 0,
        "updated_at": 1517505747
      }
    },
    {..}
  ]
}
```

## URL Format

**GET** https://[site].chargebee.com/api/v2/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.

- `include_deleted` (optional, boolean, default=false)
  If set to true, includes the deleted resources in the response. For the deleted resources in the response, the '**deleted** ' attribute will be '**true** '.

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