API reference
Segments
Saved filters over your contacts (area code, name, email, status, source, list, when added, custom fields), worked out each time they are used. Use them as campaign audiences, to enroll people in workflows, or to filter contacts. See SegmentRule for the rule format.
List segments
/v1/segmentsAll your segments, newest first, each with how many contacts match it now.
Request
curl https://app.smsblast.net/v1/segments \
-H "Authorization: Bearer $SMSBLAST_API_KEY"const res = await fetch('https://app.smsblast.net/v1/segments', {
headers: {
Authorization: `Bearer ${process.env.SMSBLAST_API_KEY}`,
},
});
console.log(res.status, await res.json());import os
import requests
res = requests.get(
"https://app.smsblast.net/v1/segments",
headers={
"Authorization": f"Bearer {os.environ['SMSBLAST_API_KEY']}",
},
)
print(res.status_code, res.json()){
"segments": [
{
"id": "4f2a8c6e-1d3b-4f5a-9e7c-8b0d2f4a6c53",
"account_id": "5d0c6a2e-8f43-4b8a-9c1d-2e7f4a6b3c10",
"name": "San Francisco sourdough fans",
"description": null,
"match": "all",
"rules": [
{
"field": "area_code",
"op": "is",
"value": "415, 628"
},
{
"field": "custom",
"key": "favorite_bread",
"op": "equals",
"value": "Sourdough"
}
],
"created_at": "2026-11-05T19:11:42.250Z",
"total": 236,
"subscribed": 229
}
]
}Needs an API key: Authorization: Bearer sb_... Authentication
Query parameters#
searchstringOnly segments whose name contains this text (ignoring case).
Responses#
Your segments.
application/json
segmentsarray of objectsrequiredNewest first.
Fields of each item
idstringuuidrequiredThe segment id.
account_idstringuuidrequiredYour account id.
namestringrequiredThe segment name.
descriptionstringnullablerequiredA note about the segment.
matchstringrequiredall: a contact must match every rule. any: one rule is enough.
rulesarray of objectsrequired1 to 20 rules.
Fields of each item
field: area_code
Contacts by the area code of their number.
fieldstringrequiredopstringrequiredWhether the number is (or is not) in one of the area codes.
valuestringrequiredOne or more 3-digit area codes, separated by spaces or commas.
field: first_name, last_name, email
Contacts by first name, last name or email.
fieldstringrequiredThe contact field.
opstringrequiredequals and contains ignore case.
valuestringThe text to compare with, for equals and contains.
field: status
Contacts by subscription status.
fieldstringrequiredopstringrequiredvaluestringrequiredThe status.
field: source
Contacts by how they joined.
fieldstringrequiredopstringrequiredWhether the contact came (or did not come) from this source.
valuestringrequiredWhere the contact came from. keyword matches every signup keyword and web_form every signup form.
field: list
Contacts by list membership.
fieldstringrequiredopstringrequiredWhether the contact is (or is not) on the list.
valuestringuuidrequiredThe list id.
field: created
Contacts by when they were added.
fieldstringrequiredopstringrequiredwithin_days: added in the last N days. after: added on or after the date. before: added before the date.
valueinteger or stringrequiredFor within_days, a whole number of days from 1 to 3650. For after and before, a date like 2026-11-30.
field: custom
Contacts by a custom field.
fieldstringrequiredkeystringrequiredThe custom field name, as in the contact's fields.
opstringrequiredequals and contains ignore case.
valuestringThe text to compare with, for equals and contains.
field: clicked
Contacts by tracked link clicks.
fieldstringrequiredopstringrequiredcampaign: clicked a tracked link in that campaign. not_campaign: was sent that campaign but clicked none of its links. within_days: clicked any tracked link in the last N days.
valuestring or integerrequiredA campaign id for campaign and not_campaign; a whole number of days from 1 to 3650 for within_days.
field: replied
Contacts by whether they text you.
fieldstringrequiredopstringrequiredwithin_days: texted you anything in the last N days. never: has never texted you.
valueintegerFor within_days, a whole number of days from 1 to 3650.
created_atstringdate-timerequiredWhen the segment was created.
totalintegerrequiredContacts matching the segment now.
subscribedintegerrequiredOf those, subscribed contacts (the ones a campaign would reach).
Response headers
The id of this request (req_...), on every answer. Quote it when you contact support.
Requests allowed per minute with this API key.
Requests left in the current minute.
When the current minute ends and the count starts again, in Unix seconds.
No API key, or one that is not valid or has been revoked (unauthorized).
Too many requests with this API key (rate_limited). Wait for the number of seconds in Retry-After.
Create a segment
/v1/segmentsSaves a filter over your contacts, such as "area code 415 or 628 and favourite bread is sourdough". A segment is worked out each time it is used, so it always reflects your contacts as they are. Use it as a campaign audience, to enroll people in a workflow, or to filter GET /v1/contacts.
A segment has 1 to 20 rules (see SegmentRule) and match: all (every rule) or any (at least one). Try rules first with POST /v1/segments/preview.
Request
curl -X POST https://app.smsblast.net/v1/segments \
-H "Authorization: Bearer $SMSBLAST_API_KEY" \
-H "Idempotency-Key: $(openssl rand -hex 16)" \
-H "Content-Type: application/json" \
-d '{
"name": "San Francisco sourdough fans",
"match": "all",
"rules": [
{
"field": "area_code",
"op": "is",
"value": "415, 628"
},
{
"field": "custom",
"key": "favorite_bread",
"op": "equals",
"value": "Sourdough"
}
]
}'const res = await fetch('https://app.smsblast.net/v1/segments', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.SMSBLAST_API_KEY}`,
'Idempotency-Key': crypto.randomUUID(),
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'San Francisco sourdough fans',
match: 'all',
rules: [
{
field: 'area_code',
op: 'is',
value: '415, 628',
},
{
field: 'custom',
key: 'favorite_bread',
op: 'equals',
value: 'Sourdough',
},
],
}),
});
console.log(res.status, await res.json());import os
import uuid
import requests
res = requests.post(
"https://app.smsblast.net/v1/segments",
headers={
"Authorization": f"Bearer {os.environ['SMSBLAST_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"name": "San Francisco sourdough fans",
"match": "all",
"rules": [
{
"field": "area_code",
"op": "is",
"value": "415, 628",
},
{
"field": "custom",
"key": "favorite_bread",
"op": "equals",
"value": "Sourdough",
},
],
},
)
print(res.status_code, res.json()){
"segment": {
"id": "4f2a8c6e-1d3b-4f5a-9e7c-8b0d2f4a6c53",
"account_id": "5d0c6a2e-8f43-4b8a-9c1d-2e7f4a6b3c10",
"name": "San Francisco sourdough fans",
"description": null,
"match": "all",
"rules": [
{
"field": "area_code",
"op": "is",
"value": "415, 628"
},
{
"field": "custom",
"key": "favorite_bread",
"op": "equals",
"value": "Sourdough"
}
],
"created_at": "2026-11-05T19:11:42.250Z"
}
}Needs an API key: Authorization: Bearer sb_... Authentication
Headers#
Any unique string up to 200 characters (a UUID works well). If a POST times out or you are not sure it went through, send it again with the same key and the same body: you get the first answer back (with Idempotent-Replayed: true) instead of the work being done twice. Keys are kept for 24 hours per account.
Request body#
application/json · required
namestringrequiredThe segment name, up to 120 characters.
descriptionstringnullableA note, up to 300 characters. Leaving it out clears it.
matchstringany to match contacts that meet any rule; anything else means all.
rulesarray of objectsrequired1 to 20 rules.
Fields of each item
field: area_code
Contacts by the area code of their number.
fieldstringrequiredopstringrequiredWhether the number is (or is not) in one of the area codes.
valuestringrequiredOne or more 3-digit area codes, separated by spaces or commas.
field: first_name, last_name, email
Contacts by first name, last name or email.
fieldstringrequiredThe contact field.
opstringrequiredequals and contains ignore case.
valuestringThe text to compare with, for equals and contains.
field: status
Contacts by subscription status.
fieldstringrequiredopstringrequiredvaluestringrequiredThe status.
field: source
Contacts by how they joined.
fieldstringrequiredopstringrequiredWhether the contact came (or did not come) from this source.
valuestringrequiredWhere the contact came from. keyword matches every signup keyword and web_form every signup form.
field: list
Contacts by list membership.
fieldstringrequiredopstringrequiredWhether the contact is (or is not) on the list.
valuestringuuidrequiredThe list id.
field: created
Contacts by when they were added.
fieldstringrequiredopstringrequiredwithin_days: added in the last N days. after: added on or after the date. before: added before the date.
valueinteger or stringrequiredFor within_days, a whole number of days from 1 to 3650. For after and before, a date like 2026-11-30.
field: custom
Contacts by a custom field.
fieldstringrequiredkeystringrequiredThe custom field name, as in the contact's fields.
opstringrequiredequals and contains ignore case.
valuestringThe text to compare with, for equals and contains.
field: clicked
Contacts by tracked link clicks.
fieldstringrequiredopstringrequiredcampaign: clicked a tracked link in that campaign. not_campaign: was sent that campaign but clicked none of its links. within_days: clicked any tracked link in the last N days.
valuestring or integerrequiredA campaign id for campaign and not_campaign; a whole number of days from 1 to 3650 for within_days.
field: replied
Contacts by whether they text you.
fieldstringrequiredopstringrequiredwithin_days: texted you anything in the last N days. never: has never texted you.
valueintegerFor within_days, a whole number of days from 1 to 3650.
Example request body
{
"name": "San Francisco sourdough fans",
"match": "all",
"rules": [
{
"field": "area_code",
"op": "is",
"value": "415, 628"
},
{
"field": "custom",
"key": "favorite_bread",
"op": "equals",
"value": "Sourdough"
}
]
}Responses#
The new segment.
application/json
segmentobjectrequiredA saved filter over your contacts. It is worked out each time it is used, so it is always current.
Child fields
idstringuuidrequiredThe segment id.
account_idstringuuidrequiredYour account id.
namestringrequiredThe segment name.
descriptionstringnullablerequiredA note about the segment.
matchstringrequiredall: a contact must match every rule. any: one rule is enough.
rulesarray of objectsrequired1 to 20 rules.
Fields of each item
field: area_code
Contacts by the area code of their number.
fieldstringrequiredopstringrequiredWhether the number is (or is not) in one of the area codes.
valuestringrequiredOne or more 3-digit area codes, separated by spaces or commas.
field: first_name, last_name, email
Contacts by first name, last name or email.
fieldstringrequiredThe contact field.
opstringrequiredequals and contains ignore case.
valuestringThe text to compare with, for equals and contains.
field: status
Contacts by subscription status.
fieldstringrequiredopstringrequiredvaluestringrequiredThe status.
field: source
Contacts by how they joined.
fieldstringrequiredopstringrequiredWhether the contact came (or did not come) from this source.
valuestringrequiredWhere the contact came from. keyword matches every signup keyword and web_form every signup form.
field: list
Contacts by list membership.
fieldstringrequiredopstringrequiredWhether the contact is (or is not) on the list.
valuestringuuidrequiredThe list id.
field: created
Contacts by when they were added.
fieldstringrequiredopstringrequiredwithin_days: added in the last N days. after: added on or after the date. before: added before the date.
valueinteger or stringrequiredFor within_days, a whole number of days from 1 to 3650. For after and before, a date like 2026-11-30.
field: custom
Contacts by a custom field.
fieldstringrequiredkeystringrequiredThe custom field name, as in the contact's fields.
opstringrequiredequals and contains ignore case.
valuestringThe text to compare with, for equals and contains.
field: clicked
Contacts by tracked link clicks.
fieldstringrequiredopstringrequiredcampaign: clicked a tracked link in that campaign. not_campaign: was sent that campaign but clicked none of its links. within_days: clicked any tracked link in the last N days.
valuestring or integerrequiredA campaign id for campaign and not_campaign; a whole number of days from 1 to 3650 for within_days.
field: replied
Contacts by whether they text you.
fieldstringrequiredopstringrequiredwithin_days: texted you anything in the last N days. never: has never texted you.
valueintegerFor within_days, a whole number of days from 1 to 3650.
created_atstringdate-timerequiredWhen the segment was created.
Response headers
The id of this request (req_...), on every answer. Quote it when you contact support.
Requests allowed per minute with this API key.
Requests left in the current minute.
When the current minute ends and the count starts again, in Unix seconds.
true when this is the stored answer to an earlier request with the same Idempotency-Key, not a new one.
The request was refused because something in it is not valid. error.code is one of:
invalid_name:nameis missing or empty.no_rules:rulesis missing or empty.too_many_rules: More than 20 rules.invalid_rule: A rule has an unknown field or operator, or a missing or invalid value. The message says which.invalid_json: The body is not a JSON object.invalid_idempotency_key: The Idempotency-Key header is longer than 200 characters.
No API key, or one that is not valid or has been revoked (unauthorized).
The request clashes with the current state of things. error.code is one of:
idempotency_in_progress: A request with the same Idempotency-Key is still running. Try again in a moment.
This Idempotency-Key was already used for a different request (another path or body) in the last 24 hours (idempotency_key_reused). Use a new key for each new request.
Too many requests with this API key (rate_limited). Wait for the number of seconds in Retry-After.
Count a segment before saving
/v1/segments/previewCounts the contacts that match some rules, without saving anything. An empty list of rules counts nobody.
Request
curl -X POST https://app.smsblast.net/v1/segments/preview \
-H "Authorization: Bearer $SMSBLAST_API_KEY" \
-H "Idempotency-Key: $(openssl rand -hex 16)" \
-H "Content-Type: application/json" \
-d '{
"match": "any",
"rules": [
{
"field": "area_code",
"op": "is",
"value": "415"
},
{
"field": "created",
"op": "within_days",
"value": 30
}
]
}'const res = await fetch('https://app.smsblast.net/v1/segments/preview', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.SMSBLAST_API_KEY}`,
'Idempotency-Key': crypto.randomUUID(),
'Content-Type': 'application/json',
},
body: JSON.stringify({
match: 'any',
rules: [
{
field: 'area_code',
op: 'is',
value: '415',
},
{
field: 'created',
op: 'within_days',
value: 30,
},
],
}),
});
console.log(res.status, await res.json());import os
import uuid
import requests
res = requests.post(
"https://app.smsblast.net/v1/segments/preview",
headers={
"Authorization": f"Bearer {os.environ['SMSBLAST_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"match": "any",
"rules": [
{
"field": "area_code",
"op": "is",
"value": "415",
},
{
"field": "created",
"op": "within_days",
"value": 30,
},
],
},
)
print(res.status_code, res.json()){
"total": 312,
"subscribed": 301
}Needs an API key: Authorization: Bearer sb_... Authentication
Headers#
Any unique string up to 200 characters (a UUID works well). If a POST times out or you are not sure it went through, send it again with the same key and the same body: you get the first answer back (with Idempotent-Replayed: true) instead of the work being done twice. Keys are kept for 24 hours per account.
Request body#
application/json · required
matchstringany, or anything else for all.
rulesarray of objectsThe rules to count. An empty list counts nobody.
Fields of each item
field: area_code
Contacts by the area code of their number.
fieldstringrequiredopstringrequiredWhether the number is (or is not) in one of the area codes.
valuestringrequiredOne or more 3-digit area codes, separated by spaces or commas.
field: first_name, last_name, email
Contacts by first name, last name or email.
fieldstringrequiredThe contact field.
opstringrequiredequals and contains ignore case.
valuestringThe text to compare with, for equals and contains.
field: status
Contacts by subscription status.
fieldstringrequiredopstringrequiredvaluestringrequiredThe status.
field: source
Contacts by how they joined.
fieldstringrequiredopstringrequiredWhether the contact came (or did not come) from this source.
valuestringrequiredWhere the contact came from. keyword matches every signup keyword and web_form every signup form.
field: list
Contacts by list membership.
fieldstringrequiredopstringrequiredWhether the contact is (or is not) on the list.
valuestringuuidrequiredThe list id.
field: created
Contacts by when they were added.
fieldstringrequiredopstringrequiredwithin_days: added in the last N days. after: added on or after the date. before: added before the date.
valueinteger or stringrequiredFor within_days, a whole number of days from 1 to 3650. For after and before, a date like 2026-11-30.
field: custom
Contacts by a custom field.
fieldstringrequiredkeystringrequiredThe custom field name, as in the contact's fields.
opstringrequiredequals and contains ignore case.
valuestringThe text to compare with, for equals and contains.
field: clicked
Contacts by tracked link clicks.
fieldstringrequiredopstringrequiredcampaign: clicked a tracked link in that campaign. not_campaign: was sent that campaign but clicked none of its links. within_days: clicked any tracked link in the last N days.
valuestring or integerrequiredA campaign id for campaign and not_campaign; a whole number of days from 1 to 3650 for within_days.
field: replied
Contacts by whether they text you.
fieldstringrequiredopstringrequiredwithin_days: texted you anything in the last N days. never: has never texted you.
valueintegerFor within_days, a whole number of days from 1 to 3650.
Example request body
{
"match": "any",
"rules": [
{
"field": "area_code",
"op": "is",
"value": "415"
},
{
"field": "created",
"op": "within_days",
"value": 30
}
]
}Responses#
The counts.
application/json
totalintegerrequiredContacts matching.
subscribedintegerrequiredOf those, subscribed contacts.
Response headers
The id of this request (req_...), on every answer. Quote it when you contact support.
Requests allowed per minute with this API key.
Requests left in the current minute.
When the current minute ends and the count starts again, in Unix seconds.
true when this is the stored answer to an earlier request with the same Idempotency-Key, not a new one.
The request was refused because something in it is not valid. error.code is one of:
invalid_rule: A rule has an unknown field or operator, or a missing or invalid value.invalid_json: The body is not a JSON object.invalid_idempotency_key: The Idempotency-Key header is longer than 200 characters.
No API key, or one that is not valid or has been revoked (unauthorized).
The request clashes with the current state of things. error.code is one of:
idempotency_in_progress: A request with the same Idempotency-Key is still running. Try again in a moment.
This Idempotency-Key was already used for a different request (another path or body) in the last 24 hours (idempotency_key_reused). Use a new key for each new request.
Too many requests with this API key (rate_limited). Wait for the number of seconds in Retry-After.
Get a segment
/v1/segments/{id}One segment and how many contacts match it now. To see who, use GET /v1/contacts?segmentId=....
Request
curl https://app.smsblast.net/v1/segments/4f2a8c6e-1d3b-4f5a-9e7c-8b0d2f4a6c53 \
-H "Authorization: Bearer $SMSBLAST_API_KEY"const res = await fetch('https://app.smsblast.net/v1/segments/4f2a8c6e-1d3b-4f5a-9e7c-8b0d2f4a6c53', {
headers: {
Authorization: `Bearer ${process.env.SMSBLAST_API_KEY}`,
},
});
console.log(res.status, await res.json());import os
import requests
res = requests.get(
"https://app.smsblast.net/v1/segments/4f2a8c6e-1d3b-4f5a-9e7c-8b0d2f4a6c53",
headers={
"Authorization": f"Bearer {os.environ['SMSBLAST_API_KEY']}",
},
)
print(res.status_code, res.json()){
"segment": {
"id": "4f2a8c6e-1d3b-4f5a-9e7c-8b0d2f4a6c53",
"account_id": "5d0c6a2e-8f43-4b8a-9c1d-2e7f4a6b3c10",
"name": "San Francisco sourdough fans",
"description": null,
"match": "all",
"rules": [
{
"field": "area_code",
"op": "is",
"value": "415, 628"
},
{
"field": "custom",
"key": "favorite_bread",
"op": "equals",
"value": "Sourdough"
}
],
"created_at": "2026-11-05T19:11:42.250Z"
},
"total": 236,
"subscribed": 229
}Needs an API key: Authorization: Bearer sb_... Authentication
Path parameters#
idstringuuidrequiredThe segment id.
Responses#
The segment and its counts.
application/json
segmentobjectrequiredA saved filter over your contacts. It is worked out each time it is used, so it is always current.
Child fields
idstringuuidrequiredThe segment id.
account_idstringuuidrequiredYour account id.
namestringrequiredThe segment name.
descriptionstringnullablerequiredA note about the segment.
matchstringrequiredall: a contact must match every rule. any: one rule is enough.
rulesarray of objectsrequired1 to 20 rules.
Fields of each item
field: area_code
Contacts by the area code of their number.
fieldstringrequiredopstringrequiredWhether the number is (or is not) in one of the area codes.
valuestringrequiredOne or more 3-digit area codes, separated by spaces or commas.
field: first_name, last_name, email
Contacts by first name, last name or email.
fieldstringrequiredThe contact field.
opstringrequiredequals and contains ignore case.
valuestringThe text to compare with, for equals and contains.
field: status
Contacts by subscription status.
fieldstringrequiredopstringrequiredvaluestringrequiredThe status.
field: source
Contacts by how they joined.
fieldstringrequiredopstringrequiredWhether the contact came (or did not come) from this source.
valuestringrequiredWhere the contact came from. keyword matches every signup keyword and web_form every signup form.
field: list
Contacts by list membership.
fieldstringrequiredopstringrequiredWhether the contact is (or is not) on the list.
valuestringuuidrequiredThe list id.
field: created
Contacts by when they were added.
fieldstringrequiredopstringrequiredwithin_days: added in the last N days. after: added on or after the date. before: added before the date.
valueinteger or stringrequiredFor within_days, a whole number of days from 1 to 3650. For after and before, a date like 2026-11-30.
field: custom
Contacts by a custom field.
fieldstringrequiredkeystringrequiredThe custom field name, as in the contact's fields.
opstringrequiredequals and contains ignore case.
valuestringThe text to compare with, for equals and contains.
field: clicked
Contacts by tracked link clicks.
fieldstringrequiredopstringrequiredcampaign: clicked a tracked link in that campaign. not_campaign: was sent that campaign but clicked none of its links. within_days: clicked any tracked link in the last N days.
valuestring or integerrequiredA campaign id for campaign and not_campaign; a whole number of days from 1 to 3650 for within_days.
field: replied
Contacts by whether they text you.
fieldstringrequiredopstringrequiredwithin_days: texted you anything in the last N days. never: has never texted you.
valueintegerFor within_days, a whole number of days from 1 to 3650.
created_atstringdate-timerequiredWhen the segment was created.
totalintegerrequiredContacts matching now.
subscribedintegerrequiredOf those, subscribed.
Response headers
The id of this request (req_...), on every answer. Quote it when you contact support.
Requests allowed per minute with this API key.
Requests left in the current minute.
When the current minute ends and the count starts again, in Unix seconds.
No API key, or one that is not valid or has been revoked (unauthorized).
Something the request names does not exist in your account. error.code is one of:
not_found: No segment with that id in your account.
Too many requests with this API key (rate_limited). Wait for the number of seconds in Retry-After.
Update a segment
/v1/segments/{id}Replaces a segment's name, description, match and rules. Send them all: name and rules are required, and leaving description out clears it. The answer does not include counts.
Request
curl -X PATCH https://app.smsblast.net/v1/segments/4f2a8c6e-1d3b-4f5a-9e7c-8b0d2f4a6c53 \
-H "Authorization: Bearer $SMSBLAST_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "San Francisco bread fans",
"match": "all",
"rules": [
{
"field": "area_code",
"op": "is",
"value": "415, 628"
},
{
"field": "custom",
"key": "favorite_bread",
"op": "is_set"
}
]
}'const res = await fetch('https://app.smsblast.net/v1/segments/4f2a8c6e-1d3b-4f5a-9e7c-8b0d2f4a6c53', {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.SMSBLAST_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'San Francisco bread fans',
match: 'all',
rules: [
{
field: 'area_code',
op: 'is',
value: '415, 628',
},
{
field: 'custom',
key: 'favorite_bread',
op: 'is_set',
},
],
}),
});
console.log(res.status, await res.json());import os
import requests
res = requests.patch(
"https://app.smsblast.net/v1/segments/4f2a8c6e-1d3b-4f5a-9e7c-8b0d2f4a6c53",
headers={
"Authorization": f"Bearer {os.environ['SMSBLAST_API_KEY']}",
},
json={
"name": "San Francisco bread fans",
"match": "all",
"rules": [
{
"field": "area_code",
"op": "is",
"value": "415, 628",
},
{
"field": "custom",
"key": "favorite_bread",
"op": "is_set",
},
],
},
)
print(res.status_code, res.json()){
"segment": {
"id": "4f2a8c6e-1d3b-4f5a-9e7c-8b0d2f4a6c53",
"account_id": "5d0c6a2e-8f43-4b8a-9c1d-2e7f4a6b3c10",
"name": "San Francisco bread fans",
"description": null,
"match": "all",
"rules": [
{
"field": "area_code",
"op": "is",
"value": "415, 628"
},
{
"field": "custom",
"key": "favorite_bread",
"op": "is_set"
}
],
"created_at": "2026-11-05T19:11:42.250Z"
}
}Needs an API key: Authorization: Bearer sb_... Authentication
Path parameters#
idstringuuidrequiredThe segment id.
Request body#
application/json · required
namestringrequiredThe segment name, up to 120 characters.
descriptionstringnullableA note, up to 300 characters. Leaving it out clears it.
matchstringany to match contacts that meet any rule; anything else means all.
rulesarray of objectsrequired1 to 20 rules.
Fields of each item
field: area_code
Contacts by the area code of their number.
fieldstringrequiredopstringrequiredWhether the number is (or is not) in one of the area codes.
valuestringrequiredOne or more 3-digit area codes, separated by spaces or commas.
field: first_name, last_name, email
Contacts by first name, last name or email.
fieldstringrequiredThe contact field.
opstringrequiredequals and contains ignore case.
valuestringThe text to compare with, for equals and contains.
field: status
Contacts by subscription status.
fieldstringrequiredopstringrequiredvaluestringrequiredThe status.
field: source
Contacts by how they joined.
fieldstringrequiredopstringrequiredWhether the contact came (or did not come) from this source.
valuestringrequiredWhere the contact came from. keyword matches every signup keyword and web_form every signup form.
field: list
Contacts by list membership.
fieldstringrequiredopstringrequiredWhether the contact is (or is not) on the list.
valuestringuuidrequiredThe list id.
field: created
Contacts by when they were added.
fieldstringrequiredopstringrequiredwithin_days: added in the last N days. after: added on or after the date. before: added before the date.
valueinteger or stringrequiredFor within_days, a whole number of days from 1 to 3650. For after and before, a date like 2026-11-30.
field: custom
Contacts by a custom field.
fieldstringrequiredkeystringrequiredThe custom field name, as in the contact's fields.
opstringrequiredequals and contains ignore case.
valuestringThe text to compare with, for equals and contains.
field: clicked
Contacts by tracked link clicks.
fieldstringrequiredopstringrequiredcampaign: clicked a tracked link in that campaign. not_campaign: was sent that campaign but clicked none of its links. within_days: clicked any tracked link in the last N days.
valuestring or integerrequiredA campaign id for campaign and not_campaign; a whole number of days from 1 to 3650 for within_days.
field: replied
Contacts by whether they text you.
fieldstringrequiredopstringrequiredwithin_days: texted you anything in the last N days. never: has never texted you.
valueintegerFor within_days, a whole number of days from 1 to 3650.
Example request body
{
"name": "San Francisco bread fans",
"match": "all",
"rules": [
{
"field": "area_code",
"op": "is",
"value": "415, 628"
},
{
"field": "custom",
"key": "favorite_bread",
"op": "is_set"
}
]
}Responses#
The segment.
application/json
segmentobjectrequiredA saved filter over your contacts. It is worked out each time it is used, so it is always current.
Child fields
idstringuuidrequiredThe segment id.
account_idstringuuidrequiredYour account id.
namestringrequiredThe segment name.
descriptionstringnullablerequiredA note about the segment.
matchstringrequiredall: a contact must match every rule. any: one rule is enough.
rulesarray of objectsrequired1 to 20 rules.
Fields of each item
field: area_code
Contacts by the area code of their number.
fieldstringrequiredopstringrequiredWhether the number is (or is not) in one of the area codes.
valuestringrequiredOne or more 3-digit area codes, separated by spaces or commas.
field: first_name, last_name, email
Contacts by first name, last name or email.
fieldstringrequiredThe contact field.
opstringrequiredequals and contains ignore case.
valuestringThe text to compare with, for equals and contains.
field: status
Contacts by subscription status.
fieldstringrequiredopstringrequiredvaluestringrequiredThe status.
field: source
Contacts by how they joined.
fieldstringrequiredopstringrequiredWhether the contact came (or did not come) from this source.
valuestringrequiredWhere the contact came from. keyword matches every signup keyword and web_form every signup form.
field: list
Contacts by list membership.
fieldstringrequiredopstringrequiredWhether the contact is (or is not) on the list.
valuestringuuidrequiredThe list id.
field: created
Contacts by when they were added.
fieldstringrequiredopstringrequiredwithin_days: added in the last N days. after: added on or after the date. before: added before the date.
valueinteger or stringrequiredFor within_days, a whole number of days from 1 to 3650. For after and before, a date like 2026-11-30.
field: custom
Contacts by a custom field.
fieldstringrequiredkeystringrequiredThe custom field name, as in the contact's fields.
opstringrequiredequals and contains ignore case.
valuestringThe text to compare with, for equals and contains.
field: clicked
Contacts by tracked link clicks.
fieldstringrequiredopstringrequiredcampaign: clicked a tracked link in that campaign. not_campaign: was sent that campaign but clicked none of its links. within_days: clicked any tracked link in the last N days.
valuestring or integerrequiredA campaign id for campaign and not_campaign; a whole number of days from 1 to 3650 for within_days.
field: replied
Contacts by whether they text you.
fieldstringrequiredopstringrequiredwithin_days: texted you anything in the last N days. never: has never texted you.
valueintegerFor within_days, a whole number of days from 1 to 3650.
created_atstringdate-timerequiredWhen the segment was created.
Response headers
The id of this request (req_...), on every answer. Quote it when you contact support.
Requests allowed per minute with this API key.
Requests left in the current minute.
When the current minute ends and the count starts again, in Unix seconds.
The request was refused because something in it is not valid. error.code is one of:
invalid_name:nameis missing or empty.no_rules:rulesis missing or empty.too_many_rules: More than 20 rules.invalid_rule: A rule is not valid.invalid_json: The body is not a JSON object.
No API key, or one that is not valid or has been revoked (unauthorized).
Something the request names does not exist in your account. error.code is one of:
not_found: No segment with that id in your account.
Too many requests with this API key (rate_limited). Wait for the number of seconds in Retry-After.
Delete a segment
/v1/segments/{id}Deletes a segment. Contacts are not affected. Campaign drafts that use it no longer reach anyone through it.
Request
curl -X DELETE https://app.smsblast.net/v1/segments/4f2a8c6e-1d3b-4f5a-9e7c-8b0d2f4a6c53 \
-H "Authorization: Bearer $SMSBLAST_API_KEY"const res = await fetch('https://app.smsblast.net/v1/segments/4f2a8c6e-1d3b-4f5a-9e7c-8b0d2f4a6c53', {
method: 'DELETE',
headers: {
Authorization: `Bearer ${process.env.SMSBLAST_API_KEY}`,
},
});
console.log(res.status, await res.json());import os
import requests
res = requests.delete(
"https://app.smsblast.net/v1/segments/4f2a8c6e-1d3b-4f5a-9e7c-8b0d2f4a6c53",
headers={
"Authorization": f"Bearer {os.environ['SMSBLAST_API_KEY']}",
},
)
print(res.status_code, res.json()){
"ok": true
}Needs an API key: Authorization: Bearer sb_... Authentication
Path parameters#
idstringuuidrequiredThe segment id.
Responses#
Deleted.
application/json
okbooleanrequiredResponse headers
The id of this request (req_...), on every answer. Quote it when you contact support.
Requests allowed per minute with this API key.
Requests left in the current minute.
When the current minute ends and the count starts again, in Unix seconds.
No API key, or one that is not valid or has been revoked (unauthorized).
Something the request names does not exist in your account. error.code is one of:
not_found: No segment with that id in your account.
Too many requests with this API key (rate_limited). Wait for the number of seconds in Retry-After.