# List of contacts for a customer

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


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

This API retrieves all the contacts for a customer.

## Sample Request

#### cURL

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

#### .NET

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

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

foreach (var listItem in result.List){
  Contact contact = listItem.Contact;
}
```

#### Go

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

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

#### 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.contactsForCustomer("__test__KyVnHhSBWlCK52cl").request();

        for (ListResult.Entry entry : result) {
            Contact contact = entry.contact();
        }
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.contact.Contact;
import com.chargebee.v4.models.customer.params.ContactsForCustomerParams;
import com.chargebee.v4.models.customer.responses.ContactsForCustomerResponse;
import java.util.List;

public class ContactsForCustomer {

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

        ContactsForCustomerResponse response = client.customers().contactsForCustomer("__test__KyVnHhSBWlCK52cl");
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

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

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

#### Python

```python
from chargebee import Chargebee, Filters

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

#### Ruby

```ruby
require 'chargebee'

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

list = ChargeBee::Customer.contacts_for_customer("__test__KyVnHhSBWlCK52cl")

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

## Sample Response

```json
{
  "list": [
    {
      "contact": {
        "email": "jane@test.com",
        "enabled": true,
        "first_name": "Jane",
        "id": "contact___test__KyVnHhSBWlCKq2cn",
        "label": "dev",
        "last_name": "Doe",
        "object": "contact",
        "send_account_email": true,
        "send_billing_email": true
      }
    },
    {..}
  ]
}
```

## URL Format

**GET** https://[site].chargebee.com/api/v2/customers/{customer-id}/contacts

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

- `contact` (Contact object)
  Resource object representing contact
