Skip to content
Esc
↑↓navigate↵open⌘Jpreview

Create a segment

POST/segments
Authorization
AuthorizationBearer token · headerrequired

A BillionSend API key (bs_…).

Request body
requiredapplication/json
namestringrequired
min length 1
domain_idstring<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.

filterSegmentFilter | null
Show properties
matchstringrequired
Allowed:allany
conditionsobject[]required
max items 50
Show properties
Array of object
fieldstringrequired
opstringrequired
valuestring | nullrequired
max length 500
Responses
200

Segment created

objectstringrequired
Allowed:segment
idstring<uuid>required
namestringrequired
domain_idstring<uuid> | nullrequired

BillionSend extension: the domain the segment is bound to; null for a team-wide segment

filterSegmentFilter | nullrequired
Show properties
matchstringrequired
Allowed:allany
conditionsobject[]required
max items 50
Show properties
Array of object
fieldstringrequired
opstringrequired
valuestring | nullrequired
max length 500
created_atstringrequired
401

Missing, malformed, unknown or revoked API key

statusCodenumberrequired
namestringrequired
messagestringrequired
403

A key held to one domain bound this to another domain, or unbound it

statusCodenumberrequired
namestringrequired
messagestringrequired
422

Validation error, or a domain_id that is not one of your domains

statusCodenumberrequired
namestringrequired
messagestringrequired
429

Over the rate limit (rate_limit_exceeded, with Retry-After)

statusCodenumberrequired
namestringrequired
messagestringrequired
Try it
Server
Authorization
Bodyapplication/json
Request
curl -X POST 'https://api.billionsend.com/segments' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "domain_id": "b2f7354f-b74d-4332-ab10-1a5e3c56466c",
  "filter": {
    "match": "all",
    "conditions": [
      {
        "field": "string",
        "op": "string",
        "value": "string"
      }
    ]
  }
}'
Response
{
  "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"
}

Was this page helpful?