Skip to main content
POST
/
api
/
v1
/
segments
Create a segment
curl --request POST \
  --url https://api.railmail.app/api/v1/segments \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "name": "<string>",
  "description": "<string>",
  "rules": "<string>"
}
'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "segmentKey": "<string>",
  "name": "<string>",
  "description": "<string>",
  "type": "<string>",
  "rules": "<string>",
  "status": "<string>",
  "memberCount": 123,
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z"
}

Authorizations

X-API-Key
string
header
required

Project-scoped API key, format rm_(live|test)_... . May also be sent as Authorization: Bearer rm_....

Body

application/json
name
string
required
Maximum string length: 200
description
string | null
Maximum string length: 500
type
enum<string> | null
Available options:
STATIC,
DYNAMIC
rules
string | null

JSON rules definition for DYNAMIC segments.

Response

Segment created

id
string<uuid>
segmentKey
string | null
name
string
description
string | null
type
string
rules
string | null
status
string
memberCount
integer<int64> | null
createdAt
string<date-time>
updatedAt
string<date-time>