Get the SMS send-audience count for a channel
const url = 'https://api.tryletterhead.com/api/v3/channels/example/sms/audience-count';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"api":true,"segments":[1],"excludeSegments":[1]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.tryletterhead.com/api/v3/channels/example/sms/audience-count \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "api": true, "segments": [ 1 ], "excludeSegments": [ 1 ] }'The number of contacts an SMS send to this audience selection would actually reach — the same resolved recipient count the schedule screen previews before sending.
This endpoint is gated behind an internal feature flag that is not yet enabled for any tenant.
While it’s off, the endpoint returns 0.
v3 endpoints expect a company API key.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”The newsletter’s channel identifier (slug).
Request Body required
Section titled “Request Body required ”object
Required. Set to true to authenticate with an API key.
Segment ids to include. 0 is the built-in “All active subscribers” segment and counts as a member of the inclusion set.
Segment ids to hold back from the send. 0 is not accepted here — it would exclude everyone.
Example generated
{ "api": true, "segments": [ 1 ], "excludeSegments": [ 1 ]}Responses
Section titled “ Responses ”200 OK
object
object
The eligible recipient count.
Example
{ "items": [], "message": "SMS send audience count retrieved.", "total": 4213}404 Not Found — channel doesn’t match a channel this company owns.
object
object
object
Example
{ "data": [], "items": [], "message": "Channel is not found.", "total": 0}Still can’t find what you need? Contact support.