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.

GET /v1/segments

List segments

Returns saved segments in the authenticated workspace.

View schema
POST /v1/segments/preview

Preview a segment definition

Returns subscriber counts for an unsaved audience definition.

View schema

Preview an unsaved definition

Preview request
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.

Contact Mailrith

Related guides

On this page

Jump to the section you need.