---
search:
  tags:
    - Segments
    - POST
seo:
  description: >-
    Create a segment. Reference for the POST /segments endpoint in the
    BillionSend API.
sidebar:
  label: Create a segment
  badge: POST
title: Create a segment
type: openapi-operation
---
`POST /segments`

**Request body** (`application/json`, required)

- `name` (string, required)
- `domain_id` (string<uuid> | null) — BillionSend extension: id of one of your domains. A broadcast to this segment must then be sent from that domain (422 otherwise), so an audience is never mailed under another brand or against another brand's opt-outs. null or omitted: a segment of the whole team, sendable from any domain. On update, null makes the segment a team-wide one again.
- `filter` (SegmentFilter | null)

Request body example:

```json
{
  "name": "string",
  "domain_id": "b2f7354f-b74d-4332-ab10-1a5e3c56466c",
  "filter": {
    "match": "all",
    "conditions": [
      {
        "field": "string",
        "op": "string",
        "value": "string"
      }
    ]
  }
}
```

**Responses**

- `200` — Segment created
- `401` — Missing, malformed, unknown or revoked API key
- `403` — A key held to one domain bound this to another domain, or unbound it
- `422` — Validation error, or a domain\_id that is not one of your domains
- `429` — Over the rate limit (rate\_limit\_exceeded, with Retry-After)

Response example, 200:

```json
{
  "object": "segment",
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "name": "string",
  "domain_id": "b2f7354f-b74d-4332-ab10-1a5e3c56466c",
  "filter": {
    "match": "all",
    "conditions": [
      {
        "field": "string",
        "op": "string",
        "value": "string"
      }
    ]
  },
  "created_at": "string"
}
```
