# List Contact Segments

> GET /contacts/:id/segments — retrieve the segments a contact is part of.

`GET /contacts/:id/segments`

Retrieve a list of segments that a contact is part of. The contact is identified in the path by either its ID or its email address.

Either `id` or `email` must be provided.

**Path parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | No | The Contact ID. |
| `email` | string | No | The Contact Email. |

**Query parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | number | No | Number of segments to retrieve. Maximum value: `100`. Minimum value: `1`. |
| `after` | string | No | The ID *after* which we'll retrieve more segments (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `before` parameter. |
| `before` | string | No | The ID *before* which we'll retrieve more segments (for pagination). This ID will *not* be included in the returned list. Cannot be used with the `after` parameter. |

**Node.js**

```js
import { SendPing } from 'sendping';

const mb = new SendPing('mb_xxxxxxxxx');

const { data, error } = await mb.contacts.listSegments('e169aa45-1ecf-4183-9955-b1499d5701d3');
console.log({ data, error });
```

**Ruby**

```ruby
require "sendping"

SendPing.api_key = "mb_xxxxxxxxx"

SendPing::Contacts.list_segments("e169aa45-1ecf-4183-9955-b1499d5701d3")
```

**PHP**

```php
<?php
require 'vendor/autoload.php';

use SendPing\SendPing;

$sendping = SendPing::client('mb_xxxxxxxxx');

$sendping->contacts->listSegments('e169aa45-1ecf-4183-9955-b1499d5701d3');
```

**Python**

```python
import sendping

sendping.api_key = "mb_xxxxxxxxx"

sendping.Contacts.list_segments("e169aa45-1ecf-4183-9955-b1499d5701d3")
```

**Go**

```go
import "github.com/shekhu10/sendping-sdks/sendping-go"

client := sendping.NewClient("mb_xxxxxxxxx")

segments, err := client.Contacts.ListSegments("e169aa45-1ecf-4183-9955-b1499d5701d3", nil)
```

**Rust**

```rust
use sendping::SendPing;

let mb = SendPing::new("mb_xxxxxxxxx");

let _segments = mb.contacts.list_segments("e169aa45-1ecf-4183-9955-b1499d5701d3", None).await?;
```

**Java**

```java
import co.sendping.SendPing;
import co.sendping.SendPingResponse;

SendPing sendping = new SendPing("mb_xxxxxxxxx");

SendPingResponse response = sendping.contacts().listSegments("e169aa45-1ecf-4183-9955-b1499d5701d3");
```

**.NET**

```csharp
using SendPing;

ISendPing sendping = SendPingClient.Create("mb_xxxxxxxxx");

var resp = await sendping.ContactListSegmentsAsync("e169aa45-1ecf-4183-9955-b1499d5701d3");
```

**cURL**

```bash
curl -X GET 'https://www.sendping.co/api/contacts/e169aa45-1ecf-4183-9955-b1499d5701d3/segments' \
  -H 'Authorization: Bearer mb_xxxxxxxxx'
```

**CLI**

```bash
sendping contacts segments e169aa45-1ecf-4183-9955-b1499d5701d3
```

### Response

```json
{
  "object": "list",
  "has_more": false,
  "data": [
    {
      "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
      "name": "Registered Users",
      "created_at": "2026-10-06T22:59:55.000Z"
    }
  ]
}
```
