Contacts: Segments
List Segments
Every saved segment of the account, with its where and sort.
POST
https://g.sendcorex.com/v1/contactscommand: list_segmentsi
Needs the contact:read scope on your API key.
Arguments
This endpoint takes no arguments.
Quick start
import axios from 'axios';
const response = await axios.post(
'https://g.sendcorex.com/v1/contacts',
{
commands: [
{
command: "list_segments"
}
]
},
{ headers: { Authorization: process.env.SENDCOREX_API_KEY } },
);
const [result] = response.data.results;
if (result.type !== 'SUCCESS') throw new Error(`${result.code}: ${result.message}`);
console.log(result.data);Response
{
"type": "SUCCESS",
"results": [
{
"command": "list_segments",
"id": "0",
"type": "SUCCESS",
"took_ms": 14,
"data": {
"segments": [
{
"segment_id": "engaged-vips",
"name": "Engaged VIPs",
"where": {
"tags": {
"has": "vip"
},
"last_open_at": {
"within_days": 30
}
},
"sort": {
"field": "open_rate"
},
"created_at": "2026-10-10T12:00:00.000Z",
"updated_at": "2026-10-10T12:00:00.000Z"
}
]
}
}
]
}Response fields
segments[].segment_idThe id used by Run Segment.
segments[].nameDisplay name.
segments[].where / sortThe saved query, same format as Query Contacts.
Errors
HTTP-level errors return type, code and message. Errors marked CMD come back inside the command result, with HTTP 200.
- 401
INVALID_API_KEYThe API key does not exist, was revoked or was disabled in the dashboard.
- 429
RATE_LIMITEDMore than 15 requests/s or 15 in flight for the same IP + API key. Wait the number of seconds in Retry-After.
- CMD
MISSING_SCOPEThe API key does not have the scope this command needs. The other commands in the request still run.
- CMD
INTERNALServer error. The detail is only written to the server log.