--- title: "Creating and Publishing a Segment" slug: "engage-api-creating-and-publishing-a-segment" updated: 2026-07-30T16:37:18Z published: 2026-07-30T16:40:14Z canonical: "docs.mapp.com/engage-api-creating-and-publishing-a-segment" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.mapp.com/llms.txt > Use this file to discover all available pages before exploring further. # Creating and Publishing a Segment Segments define target audiences in Engage — dynamic sets of contacts that match conditions on profile data and behavior and update automatically as the data changes. They are used to target message sendouts, feed automation workflows, and build A/B or pilot groups. This use case shows how to create a segment and make it live through the Engage API, so you can automate audience creation from your own systems. ## Prerequisites Before you begin, make sure you have valid authorization credentials. See [Getting Started with Engage API](/v1-api/apidocs/getting-started-with-engage-api) for more information. A segment is first saved as a draft and then published; publishing validates the plan. ## Procedure Optionally, fetch the plan JSON schema with `GET /segmentation/schema` and validate your plan against it first. Then create the plan. The request body is a wrapper whose `json` field carries the plan document — containing at least `name` and `nodes` — as an escaped string. ```json POST 'https://your-engage-domain.com/api/rest/segmentation/create' {  "json": "{\"name\":\"High-value customers\",\"nodes\":[ ... ]}" } ``` The response returns the new plan's `id`. Publish it to make it the live version: ```json POST 'https://your-engage-domain.com/api/rest/segmentation/publish?id=' ``` ## Conclusion A draft may save even with incomplete criteria, but `publish` fully validates the plan and rejects an invalid one with a **400** response. After publishing, you can check the audience size with `getCount` or `preview`. ## Related Topics [Create a segment](/v1-api/apidocs/create-a-selection-plan) [Publish a segment](/v1-api/apidocs/publish-a-selection-plan) [Segment schema](/v1-api/apidocs/get-the-selection-plan-schema) [Getting Started with Engage API](/v1-api/apidocs/getting-started-with-engage-api)