# List ContactGroups

{% get /%}
{% path text="/v1/contactGroups/list" /%}

This API allows you to get a list of contactgroups with access to the specified account. If a searchKey query is added to this API, you will get a response based on the searchKey keyword.

## Code snippet

{% codetab %}

cURL

```shell
curl -X 'GET' \
  'https://api.boldsign.com/v1/contactGroups/list?PageSize=10&Page=1&SearchKey=xxxx&ContactType=MyContacts&Directories=Sales,Legal' \
  -H 'accept: application/json' \
  -H 'X-API-KEY: {your API key}'
```

C#

```csharp
// accessing metadata property requires beta version of the SDK at least v4.10.18-beta
var apiClient = new ApiClient("https://api.boldsign.com", "apikey");
var groupContactClient = new GroupContactClient(apiClient);
var result = await groupContactClient.ListGroupContactsAsync(1, 10).ConfigureAwait(false);
```

Python

```python
import boldsign

configuration = boldsign.Configuration(host = "https://api.boldsign.com", api_key = "YOUR_API_KEY")

with boldsign.ApiClient(configuration) as api_client:

  group_contacts_api = boldsign.GroupContactsApi(api_client)

  list_contact_response = group_contacts_api.group_contact_list(
      page_size=10,
      page=1,
      contact_type="AllContacts", # or mycontacts
      directories=["directory1"]
  )
```

PHP

```php
<?php
require_once "vendor/autoload.php";
$config = new BoldSign\Configuration();
$config->setHost('https://api.boldsign.com');
$config->setApiKey('YOUR_API_KEY');
$apiInstance = new BoldSign\Api\GroupContactsApi($config);
$result = $apiInstance->groupContactList(page: 1, page_size: 10);
```

NodeJS

```js
import { GroupContactsApi } from "boldsign";

const contactGroupApi = new GroupContactsApi("https://api.boldsign.com");
contactGroupApi.setApiKey("YOUR_API_KEY");

var page = 1;
var pageSize = 10;
var contactGroups = await contactGroupApi.groupContactList(page, pageSize);
```
Java

```java
ApiClient apiClient = Configuration.getDefaultApiClient();
apiClient.setBasePath("https://api.boldsign.com");
apiClient.setApiKey("YOUR_API_KEY");
GroupContactsApi groupContactApi = new GroupContactsApi(apiClient);
GroupContactsList groupContactList = groupContactApi.groupContactList(1,10, null, null, null);
```

{% /codetab %}

## Request body

{% nestedtable %}

- {% arguments name="PageSize" /%}{% batch datatype="integer" /%}
- The number of results returned per page. The value must be between 1 and 100. The default value is 10.

---

- {% arguments name="Page" /%}{% batch datatype="integer" /%}{% required /%}
- The page number of the contact page to return.

---

- {% arguments name="SearchKey" /%}{% batch datatype="string" /%}
- Returns contactgroups of the searchKey results for a keyword.

---

- {% arguments name="ContactType" /%}{% batch datatype="string" /%}
- Type of Contacts such as `MyContacts` and `AllContacts`.

---

- {% arguments name="Directories" /%}{% batch datatype="string" /%}
- Group Contacts can be listed by the search based on the directories.

{% /nestedtable %}

## Example response

**_200 Success_**

```json
{
  "pageDetails": {
    "pageSize": 10,
    "page": 1,
    "totalRecordsCount": 1,
  },
  "result": [
    {
      "groupName": "testgroup1",
      "groupId": "e892ea92-xxxx-xxxx-xxxx-bbdbcaa5xxxxc_pgVgo",
      "contacts": [
        {
          "name": "xxxxx",
          "email": "cooper@cubeflakes.com"
        }
      ],
      "directories": ["Sales", "Legal"]
    }
  ]
}
```
