Segments API
The segments surface supports both read-side access to saved audience definitions and preview counts for unsaved logic built outside Mailrith.
3 min read
Read saved segments
Segments define reusable audience logic in a workspace. The public API exposes both the saved catalog and a preview endpoint for unsaved definitions.
Endpoints
Use GET /v1/segments when you need the saved definitions, and POST /v1/segments/preview when an external builder or sync tool wants counts before persisting anything.
/v1/segments List segments
Returns saved segments in the authenticated workspace.
View schema /v1/segments/preview Preview a segment definition
Returns subscriber counts for an unsaved audience definition.
View schemaPreview an unsaved definition
curl -X POST https://api.mailrith.com/v1/segments/preview \
-H "Authorization: Bearer mrk_example_secret_key" \
-H "Content-Type: application/json" \
-d '{
"definition": {}
}' Need help shipping an integration?
Reach the Mailrith team if you need help planning a sync, validating a webhook flow, or troubleshooting a request.
Related guides
List and upsert subscribers with tags, sequences, and custom-field values.
Read the tag catalog and create tags programmatically for targeting and automation.
Browse the generated endpoint reference and download the OpenAPI contract.