Treasure Data Segments API

In marketing, a segment is a container that groups profiles (usually people) who share one or more common characteristics. In Treasure Data, the parent segment is your total population of people, accounts, or other type of collection and can be both existing and potential customers. You create segments to divide the population into subgroups of consumers based on some type of shared characteristics. Segments and subsegments enable more specific targeting for your marketing campaigns. _Treasure Data is making an effort to use more inclusive language in its product, content, and customer solutions. As we gradually make the move to replace insensitive language beginning in our UI, you may continue to see parent segments in the UI, for example, referenced as master segment in portions of Treasure Data APIs._

Business capability
Customer Segmentation Management BC-420.20

Operations 16

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /audiences/{audienceId}/segments List segments in a parent segment · Retrieve list of segments #
Ask an LLM
“What segments exist in my parent segment?”
“Where can I see all segments built on one parent segment?”
Tell an agent
List segments in parent segment {audienceId}.
Show every segment built on parent segment {audienceId}.
POST /audiences/{audienceId}/segments Create a segment · Create new segment #
Ask an LLM
“How do I create a new customer segment with a rule in Treasure Data?”
“Can I put a new segment into a specific folder when I create it?”
Tell an agent
Create segment {name} in parent segment {audienceId} with rule {rule}.
Create segment {name} in parent segment {audienceId} inside folder {segmentFolderId}.
GET /audiences/{audienceId}/folders/{folderId}/segments List segments in a folder · Retrieve list of segments in a folder #
Ask an LLM
“Which segments are stored in one particular segment folder?”
“Can I browse segments folder by folder?”
Tell an agent
List segments in folder {folderId} of parent segment {audienceId}.
Show the segments stored in segment folder {folderId}, parent segment {audienceId}.
POST /audiences/{audienceId}/segments/query Generate the SQL for a segment rule · Retrieve SQL from segment rule #
Ask an LLM
“Can I see the SQL that a segment rule translates to?”
“How do I turn a segment rule into a query I can run myself?”
Tell an agent
Get the SQL for rule {rule} in parent segment {audienceId}.
Translate segment rule {rule} for parent segment {audienceId} into SQL.
POST /audiences/{audienceId}/segments/queries Count profiles matching segment rules · Retrieve number of profiles based on set of segment rules #
Ask an LLM
“How many profiles would a set of segment rules match before I save it?”
“Can I preview a segment's population size from its rules?”
Tell an agent
Count profiles in parent segment {audienceId} that match rule {rule}.
Preview how many profiles rule {rule} would include in parent segment {audienceId}.
GET /audiences/{audienceId}/segments/{segmentId} Get a segment by ID · Retrieve segment by ID #
Ask an LLM
“How do I see a segment's rule and settings?”
“Can I fetch one segment's definition by its ID?”
Tell an agent
Show segment {segmentId} in parent segment {audienceId}.
Get the rule and settings of segment {segmentId} in parent segment {audienceId}.
PUT /audiences/{audienceId}/segments/{segmentId} Update a segment · Update segment #
Ask an LLM
“Can I change the rule of a segment that already exists?”
“How do I move an existing segment to another folder?”
Tell an agent
Update the rule of segment {segmentId} in parent segment {audienceId} to {rule}.
Rename segment {segmentId} in parent segment {audienceId} to {name}.
DELETE /audiences/{audienceId}/segments/{segmentId} Delete a segment (legacy Audience Studio) · Delete segment (legacy) #
Ask an LLM
“How do I delete a segment in legacy Audience Studio?”
“Can I permanently remove a segment I no longer use?”
Tell an agent destructive · confirm first
Delete segment {segmentId} from parent segment {audienceId}.
Remove legacy segment {segmentId} in parent segment {audienceId}.
GET /audiences/{audienceId}/segments/queries/{queryId} Check the status of a segment query · Retrieve status of query #
Ask an LLM
“Has my segment population query finished yet?”
“What's the status of a segment rule query I started?”
Tell an agent
Check status of segment query {queryId} in parent segment {audienceId}.
Tell me if segment query {queryId} in parent segment {audienceId} has finished.
POST /audiences/{audienceId}/segments/queries/{queryId}/kill Kill a running segment query · Kill current running query of segment #
Ask an LLM
“Can I stop a segment query that's still running?”
“How do I cancel a slow segment population count?”
Tell an agent destructive · confirm first
Kill segment query {queryId} in parent segment {audienceId}.
Cancel running segment query {queryId} for parent segment {audienceId}.
GET /audiences/{audienceId}/segments/queries/{queryId}/customers List profiles returned by a segment query · Retrieve profiles of query #
Ask an LLM
“How do I see the actual customer profiles a segment query returned?”
“Can I page through the profiles from a segment query result?”
Tell an agent
List profiles from segment query {queryId} in parent segment {audienceId}.
Show page {page} of profiles for segment query {queryId} in parent segment {audienceId}.
GET /audiences/{audienceId}/segments/{segmentId}/statistics Get a segment's daily population history · Retrieve population statistics of segment #
Ask an LLM
“How has a segment's population changed day by day?”
“Can I get segment population history between two dates?”
Tell an agent
Show population history of segment {segmentId} in parent segment {audienceId}.
Get population stats for segment {segmentId} (parent segment {audienceId}) from {from} to {to}.
POST /entities/segments Create a segment via the entities API · Create segment #
Ask an LLM
“Can I create a segment through the entities API instead of the parent segment path?”
“What attributes define a segment created as an entity?”
Tell an agent
Create an entities-API segment with attributes {attributes}.
Create a segment entity with attributes {attributes} linked to {relationships}.
GET /entities/segments/{id} Get a segment by entity ID · Retrieve segment by ID #
Ask an LLM
“Can I fetch a segment using only its entity ID?”
“What does the entities API return for a single segment?”
Tell an agent
Get entities-API segment {id}.
Fetch segment entity {id} by ID alone.
PATCH /entities/segments/{id} Update a segment via the entities API · Update segment #
Ask an LLM
“Can I patch a segment's attributes with only its entity ID?”
“Which segment fields can the entities API change?”
Tell an agent
Patch entities-API segment {id} with attributes {attributes}.
Update segment entity {id} to {attributes}.
DELETE /entities/segments/{id} Delete a segment via the entities API · Delete segment #
Ask an LLM
“Can I delete a segment by its entity ID in the current Audience Studio?”
“What removes a segment through the entities API?”
Tell an agent destructive · confirm first
Delete entities-API segment {id}.
Remove segment entity {id}.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/treasure-data:treasure-data-segments-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

treasure-data-segments-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: cdp-api Segments API
  description: All of the CDP APIs are organized around REST - if you've interacted with a RESTful API already, many of the concepts will be familiar to you. All API calls to CDP API should be made to the following endpoints depending on the region. For historical reasons there are REST API endpoints and JSON:API endpoints. JSON:API endpoints are located under "/entities".
  termsOfService: https://www.treasuredata.com/terms/
  version: 1.0.0
servers:
- url: https://api-cdp.treasuredata.com
- url: https://api-cdp.treasuredata.co.jp
- url: https://api-cdp.eu01.treasuredata.com
- url: https://api-cdp.ap02.treasuredata.com
- url: https://api-cdp.ap03.treasuredata.com
tags:


# --- truncated at 32 KB (76 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/treasure-data/refs/heads/main/openapi/treasure-data-segments-api-openapi.yml