> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mailofly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Segments

# Segments

Contact segments (audiences). Used by campaigns as the recipient set.

## GET `/v1/segments`

**List segments**

Lists contact segments (audiences), ordered by name. Used by campaigns as the recipient set.

### Examples

#### 200 — OK

```json theme={null}
{ "data": [ … ] }
```

### cURL

```bash theme={null}
curl -sS -X GET "https://api.mailofly.com/v1/segments" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer mf_live_your_key_here"
```

## POST `/v1/segments`

**Create segment**

Creates a segment with a non-empty name.

### Request body — Body

```json theme={null}
{ "name": "Newsletter" }
```

### Examples

#### 201 — Created

```json theme={null}
{ "data": { "id": "uuid", "name": "Newsletter" } }
```

### cURL

```bash theme={null}
curl -sS -X POST "https://api.mailofly.com/v1/segments" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer mf_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"name":"Newsletter"}'
```

## GET `/v1/segments/{id}`

**Get segment**

Fetch one segment.

### Examples

#### 200 — OK

```json theme={null}
{ "data": { … } }
```

### cURL

```bash theme={null}
curl -sS -X GET "https://api.mailofly.com/v1/segments/00000000-0000-0000-0000-000000000001" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer mf_live_your_key_here"
```

## PATCH `/v1/segments/{id}`

**Update segment**

Body must include a non-empty name.

### Request body — Body

```json theme={null}
{ "name": "Renamed" }
```

### Examples

#### 200 — OK

```json theme={null}
{ "data": { … } }
```

### cURL

```bash theme={null}
curl -sS -X PATCH "https://api.mailofly.com/v1/segments/00000000-0000-0000-0000-000000000001" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer mf_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"name":"Renamed"}'
```

## DELETE `/v1/segments/{id}`

**Delete segment**

Deletes the segment. Contacts are not deleted.

### Examples

#### 200 — OK

```json theme={null}
{ "ok": true }
```

### cURL

```bash theme={null}
curl -sS -X DELETE "https://api.mailofly.com/v1/segments/00000000-0000-0000-0000-000000000001" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer mf_live_your_key_here"
```

## Related

* [Product: Contacts & segments](../product/contacts.md)
* [Segment contacts API](segment-contacts.md)
* [← API overview](README.md)


## Related topics

- [Segments](/audience/segments.md)
- [Introduction](/api/index.md)
- [Send Campaign](/api/campaigns/send-campaign.md)
- [Create Campaign](/api/campaigns/create-campaign.md)
- [List Contacts](/api/contacts/list-contacts.md)
