Segments
Named collections of contacts. Static segments are hand-managed member lists; dynamic segments are defined by a query and re-evaluated automatically. Use GET /segments/schema to discover the fields and operators a query can use, and POST /segments/preview to test a query before saving it.
Paginated list of segments. Filter by type via ?filter[type]=static or ?filter[type]=dynamic. Other filters: ?filter[name]=... (case-insensitive prefix), ?filter[created_at][gte]=.... Honours the sparse fieldset: ?fields=id,name,type,size returns only those keys (plus id and object, which are always kept) instead of the full segment, including its query. Rate limit bucket: read.
The API Secret from the Gleantap dashboard under Settings β API (Generate New Key if none exists). Send it bare (40 hex characters) or prefixed as gltp_sk_live_<40-hex>. There is no sandbox: every key acts on the live account.
Keys are account-scoped and carry all permissions on that account (no per-key scope selection). Cross-workroom reads are unrestricted by default β narrow with ?workroom= / Gleantap-Workroom on each request. Revoke via the dashboard.
For per-user consent, per-workroom scoping, and short-lived tokens, use OAuth 2.1 instead.
Same semantics as the Gleantap-Workroom header, including that a write should never be sent without a workroom the user actually chose, and that an omitted workroom scopes a read to the account default rather than spanning the account. Prefer this on GETs so proxies and caches can key on it. Accepts name, prefixed ID, raw hex, or all.
Page size. Default 25, max 100.
25Opaque cursor from a prior response's next_cursor, to fetch the NEXT page (alias - after). On listContacts and listSegmentContacts, use before with a prev_cursor to page backward; other list endpoints are forward-only.
Comma-separated list of fields to sort by. Leading - reverses. Default -created_at. Sortable fields vary per resource; unsortable fields return 400 invalid_sort_field.
-created_at,emailSparse fieldset β comma-separated list of fields to include in the response. Reduces payload size on high-volume reads. Nested field access is not supported; request the parent object.
id,email,phone,tagsMinor version to run the request under (date-based). Older dates remain supported for at least 24 months. If omitted, the account's default pinned version is used.
2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$Target customer account, as acc_<24-hex> or a bare 24-hex ID. Only for Gleantap staff (CSM) tokens, which authenticate against the internal staff directory and are bound to no account; for a normal customer token the account is fixed by the token and this header is ignored.
A staff token MUST name an account on every request β there is no default, and omitting it returns 400 admin_account_required rather than falling back to some first account. Switching accounts is just a different value here; no re-authorization. Account names are rejected (400 admin_account_invalid) because they are neither unique nor stable β list IDs with GET /v3/accounts.
Every impersonated response carries an impersonation block naming the account actually acted on, so an account switch mid-session is always visible. Also settable via ?account=.
acc_59fca1e3d2a57d28a10b0442Which workroom to act in. Accepts a workroom name (case-insensitive), a prefixed ID (wrm_<hex>), a raw 24-hex ID, or the literal all.
On any write, ask the user which workroom β do not omit this. Optional here means the server has a fallback, not that the fallback is what anyone wanted: an omitted workroom sends the write to the account's default workroom, and accounts routinely have dozens. Creating a contact, flow, campaign or segment in the wrong workroom puts it where nobody is looking, and moving it afterwards is manual.
The one case where you need not ask: the account has exactly one workroom. Call listWorkrooms to find out β if it returns a single row, use it; if it returns several, ask which one before writing.
Reads are scoped too. Omitting a workroom on a read does not span the account β it narrows to the same default workroom a write would go to, and the response carries a workroom_defaulted warning saying so. So a count, a list or a segment preview describes one workroom unless you said otherwise. Pass all to deliberately span every workroom; that is the only way to get account-wide figures, and it is never the default. listWorkrooms itself is never narrowed, since it is how you discover what to ask for.
Also settable via ?workroom= or a workroom body field (POST/PATCH only) β query wins over header wins over body.
G Test1A page of segments.
True if additional records exist beyond this page.
Opaque cursor for the next page. Null on the last page.
Cursor for the previous page. Supported on listContacts and listSegmentContacts: pass it back as ?before=... to page backward; null on the first page. On every other list endpoint paging is forward-only and this is always null.
Missing or invalid credentials.
Rate limited.
GET /v3/segments HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"object": "text",
"data": [
{
"id": "seg_01H8XKE...",
"object": "segment",
"type": "dynamic",
"name": "Active VIPs in Mumbai",
"description": "VIP-tagged members who checked in or purchased recently",
"query": {
"segment_users": [
{
"segment": "Tags",
"operator": "Contains",
"value": [
"vip"
]
},
{
"segment": "City",
"operator": "=",
"value": [
"Mumbai"
]
}
]
},
"size": 1247,
"email_count": 1188,
"phone_count": 1201,
"last_evaluated_at": "2026-05-27T14:00:00Z",
"created_at": "2026-04-01T09:00:00Z",
"updated_at": "2026-05-27T14:00:00Z"
}
],
"has_more": true,
"next_cursor": "text",
"prev_cursor": "text"
}Before constructing query.segment_users, call GET /v3/segments/schema (MCP: describeSegmentSchema) to see the available categories, their attributes, valid operators per data type, and observed values on the current workroom. This is the authoritative source.
Prefer built-in categories over creating custom fields. For membership status, purchases, appointments, visits, engagement, forms, flows, ratings, loyalty, sales pipeline stage, etc., there is already a first-class category (memberships, purchases, appointments, visits, email_engagement, sms_engagement, forms, flows, ratings, loyalty, salesattributes). The attributes (Custom) category resolves to userdetails.data.<key> and covers concepts with no built-in category.
type is immutable β pick correctly at creation. Dynamic segments require query and are evaluated on the server; membership updates automatically. Static segments accept an optional initial contact_ids list and are mutated via POST /v3/segments/{id}/contacts. Rate limit bucket: write.
Requires the name and the actual conditions. Optional fields fall back to a server-side default when omitted. That includes the workroom: an omitted workroom resolves to the account default, and a record created in the wrong workroom is invisible where it was expected. Half-specified records are created successfully and then have to be hunted down and fixed by hand.
The API Secret from the Gleantap dashboard under Settings β API (Generate New Key if none exists). Send it bare (40 hex characters) or prefixed as gltp_sk_live_<40-hex>. There is no sandbox: every key acts on the live account.
Keys are account-scoped and carry all permissions on that account (no per-key scope selection). Cross-workroom reads are unrestricted by default β narrow with ?workroom= / Gleantap-Workroom on each request. Revoke via the dashboard.
For per-user consent, per-workroom scoping, and short-lived tokens, use OAuth 2.1 instead.
Same semantics as the Gleantap-Workroom header, including that a write should never be sent without a workroom the user actually chose, and that an omitted workroom scopes a read to the account default rather than spanning the account. Prefer this on GETs so proxies and caches can key on it. Accepts name, prefixed ID, raw hex, or all.
Minor version to run the request under (date-based). Older dates remain supported for at least 24 months. If omitted, the account's default pinned version is used.
2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$Target customer account, as acc_<24-hex> or a bare 24-hex ID. Only for Gleantap staff (CSM) tokens, which authenticate against the internal staff directory and are bound to no account; for a normal customer token the account is fixed by the token and this header is ignored.
A staff token MUST name an account on every request β there is no default, and omitting it returns 400 admin_account_required rather than falling back to some first account. Switching accounts is just a different value here; no re-authorization. Account names are rejected (400 admin_account_invalid) because they are neither unique nor stable β list IDs with GET /v3/accounts.
Every impersonated response carries an impersonation block naming the account actually acted on, so an account switch mid-session is always visible. Also settable via ?account=.
acc_59fca1e3d2a57d28a10b0442Which workroom to act in. Accepts a workroom name (case-insensitive), a prefixed ID (wrm_<hex>), a raw 24-hex ID, or the literal all.
On any write, ask the user which workroom β do not omit this. Optional here means the server has a fallback, not that the fallback is what anyone wanted: an omitted workroom sends the write to the account's default workroom, and accounts routinely have dozens. Creating a contact, flow, campaign or segment in the wrong workroom puts it where nobody is looking, and moving it afterwards is manual.
The one case where you need not ask: the account has exactly one workroom. Call listWorkrooms to find out β if it returns a single row, use it; if it returns several, ask which one before writing.
Reads are scoped too. Omitting a workroom on a read does not span the account β it narrows to the same default workroom a write would go to, and the response carries a workroom_defaulted warning saying so. So a count, a list or a segment preview describes one workroom unless you said otherwise. Pass all to deliberately span every workroom; that is the only way to get account-wide figures, and it is never the default. listWorkrooms itself is never narrowed, since it is how you discover what to ask for.
Also settable via ?workroom= or a workroom body field (POST/PATCH only) β query wins over header wins over body.
G Test1A unique key (β€255 chars) chosen by the client. Replays with the same key + same body return the cached response. Replays with the same key + different body return 409 idempotency_conflict. Required on messaging sends and bulk operations; recommended elsewhere.
8e3c7a90-7c4d-4f8e-8e3c-7a907c4d4f8eCreate a static or dynamic segment. type is immutable β you cannot convert a static to dynamic later. Dynamic segments require query.
Static segments β how to supply initial members (pick ONE):
- Pass a
query(the filter criteria). The server stores the criteria on the segment (so the dashboard shows "what this segment was built from" and diagnostics can readquery.segment_users) AND evaluates it once at creation time to freeze the currently-matching contacts as members. This is the preferred way to build a "static snapshot of everyone matching X" β do not pre-compute the matches yourself and pass them ascontact_ids, or the criteria is lost and the dashboard shows no filter. - Or pass an explicit
contact_idslist for a purely hand-managed membership with no defining criteria.
If both are given, contact_ids wins and query is stored as criteria only (not re-evaluated). A snapshot that matches more than 100k contacts is rejected β narrow the filter. The snapshot is computed the way the dashboard cron computes membership (OR groups, shared-contact excludes, account timezone).
Exception: a query with External Events / Event Attributes conditions is not snapshotted at creation β the segment is created with size 0 and the dashboard's external-events cron computes its membership once (usually within minutes), exactly as for a static segment saved in the dashboard.
static β hand-managed member list. Contacts are added/removed explicitly.
dynamic β query-defined membership. Auto-evaluated; membership changes as contact data changes.
Immutable after creation.
Optional explicit initial member list. Static segments only. Prefer query instead when the segment represents "everyone matching X" β see the schema description.
Optional segment folder to file this segment under at creation time. Must reference an existing folder in the same workroom β an unresolvable id returns 422.
sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$Segment created.
A named collection of contacts. Either static (hand-managed list) or dynamic (query-defined). Discriminated by the type field, which is immutable after creation.
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$The workroom that owns this segment. A flow can only be triggered by segments in its own workroom β compare against Flow.workroom_id.
wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$static β hand-managed member list. Contacts are added/removed explicitly.
dynamic β query-defined membership. Auto-evaluated; membership changes as contact data changes.
Immutable after creation.
Current member count. Eventually consistent β up to minutes of lag on dynamic segments.
Members with a non-empty, non-invalid email.
Members with a non-empty, non-invalid phone.
When this dynamic segment was last recomputed. Null on static.
2026-05-27T14:23:11.482ZThe segment folder this segment currently belongs to, or null if unfoldered.
sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$AI-generated narrative summary of the segment's criteria. Populated on demand via POST /v3/segments/{id}/summary.
RFC 3339 timestamp, always UTC, millisecond precision.
2026-05-27T14:23:11.482ZRFC 3339 timestamp, always UTC, millisecond precision.
2026-05-27T14:23:11.482ZRequest could not be parsed or failed validation.
Missing or invalid credentials.
Semantic validation failed β the request is well-formed but references an object in the wrong state (e.g., sending to an opted-out contact).
Rate limited.
POST /v3/segments HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 303
{
"type": "dynamic",
"name": "Active VIPs",
"description": "VIP-tagged contacts who purchased in the last 30 days",
"query": {
"segment_users": [
{
"segment": "Tags",
"operator": "Contains",
"value": [
"vip"
]
},
{
"segment": "External Events",
"data": "is_purchase",
"operator": "InLast",
"value": 30,
"operator2": ">",
"value2": 0
}
]
}
}{
"id": "seg_01H8XKE...",
"object": "segment",
"type": "dynamic",
"name": "Active VIPs in Mumbai",
"description": "VIP-tagged members who checked in or purchased recently",
"query": {
"segment_users": [
{
"segment": "Tags",
"operator": "Contains",
"value": [
"vip"
]
},
{
"segment": "City",
"operator": "=",
"value": [
"Mumbai"
]
}
]
},
"size": 1247,
"email_count": 1188,
"phone_count": 1201,
"last_evaluated_at": "2026-05-27T14:00:00Z",
"created_at": "2026-04-01T09:00:00Z",
"updated_at": "2026-05-27T14:00:00Z"
}Fetch a segment with current size, email_count, and phone_count. For dynamic segments, these values are eventually consistent (up to minutes of lag from underlying contact writes). Honours the sparse fieldset: ?fields=id,name,type,size returns only those keys (plus id and object, which are always kept) instead of the full segment, including its query.
The API Secret from the Gleantap dashboard under Settings β API (Generate New Key if none exists). Send it bare (40 hex characters) or prefixed as gltp_sk_live_<40-hex>. There is no sandbox: every key acts on the live account.
Keys are account-scoped and carry all permissions on that account (no per-key scope selection). Cross-workroom reads are unrestricted by default β narrow with ?workroom= / Gleantap-Workroom on each request. Revoke via the dashboard.
For per-user consent, per-workroom scoping, and short-lived tokens, use OAuth 2.1 instead.
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$Same semantics as the Gleantap-Workroom header, including that a write should never be sent without a workroom the user actually chose, and that an omitted workroom scopes a read to the account default rather than spanning the account. Prefer this on GETs so proxies and caches can key on it. Accepts name, prefixed ID, raw hex, or all.
Sparse fieldset β comma-separated list of fields to include in the response. Reduces payload size on high-volume reads. Nested field access is not supported; request the parent object.
id,email,phone,tagsMinor version to run the request under (date-based). Older dates remain supported for at least 24 months. If omitted, the account's default pinned version is used.
2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$Target customer account, as acc_<24-hex> or a bare 24-hex ID. Only for Gleantap staff (CSM) tokens, which authenticate against the internal staff directory and are bound to no account; for a normal customer token the account is fixed by the token and this header is ignored.
A staff token MUST name an account on every request β there is no default, and omitting it returns 400 admin_account_required rather than falling back to some first account. Switching accounts is just a different value here; no re-authorization. Account names are rejected (400 admin_account_invalid) because they are neither unique nor stable β list IDs with GET /v3/accounts.
Every impersonated response carries an impersonation block naming the account actually acted on, so an account switch mid-session is always visible. Also settable via ?account=.
acc_59fca1e3d2a57d28a10b0442Which workroom to act in. Accepts a workroom name (case-insensitive), a prefixed ID (wrm_<hex>), a raw 24-hex ID, or the literal all.
On any write, ask the user which workroom β do not omit this. Optional here means the server has a fallback, not that the fallback is what anyone wanted: an omitted workroom sends the write to the account's default workroom, and accounts routinely have dozens. Creating a contact, flow, campaign or segment in the wrong workroom puts it where nobody is looking, and moving it afterwards is manual.
The one case where you need not ask: the account has exactly one workroom. Call listWorkrooms to find out β if it returns a single row, use it; if it returns several, ask which one before writing.
Reads are scoped too. Omitting a workroom on a read does not span the account β it narrows to the same default workroom a write would go to, and the response carries a workroom_defaulted warning saying so. So a count, a list or a segment preview describes one workroom unless you said otherwise. Pass all to deliberately span every workroom; that is the only way to get account-wide figures, and it is never the default. listWorkrooms itself is never narrowed, since it is how you discover what to ask for.
Also settable via ?workroom= or a workroom body field (POST/PATCH only) β query wins over header wins over body.
G Test1The segment.
A named collection of contacts. Either static (hand-managed list) or dynamic (query-defined). Discriminated by the type field, which is immutable after creation.
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$The workroom that owns this segment. A flow can only be triggered by segments in its own workroom β compare against Flow.workroom_id.
wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$static β hand-managed member list. Contacts are added/removed explicitly.
dynamic β query-defined membership. Auto-evaluated; membership changes as contact data changes.
Immutable after creation.
Current member count. Eventually consistent β up to minutes of lag on dynamic segments.
Members with a non-empty, non-invalid email.
Members with a non-empty, non-invalid phone.
When this dynamic segment was last recomputed. Null on static.
2026-05-27T14:23:11.482ZThe segment folder this segment currently belongs to, or null if unfoldered.
sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$AI-generated narrative summary of the segment's criteria. Populated on demand via POST /v3/segments/{id}/summary.
RFC 3339 timestamp, always UTC, millisecond precision.
2026-05-27T14:23:11.482ZRFC 3339 timestamp, always UTC, millisecond precision.
2026-05-27T14:23:11.482ZThe resource doesn't exist or isn't visible to this caller.
GET /v3/segments/{id} HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"id": "seg_01H8XKE...",
"object": "segment",
"type": "dynamic",
"name": "Active VIPs in Mumbai",
"description": "VIP-tagged members who checked in or purchased recently",
"query": {
"segment_users": [
{
"segment": "Tags",
"operator": "Contains",
"value": [
"vip"
]
},
{
"segment": "City",
"operator": "=",
"value": [
"Mumbai"
]
}
]
},
"size": 1247,
"email_count": 1188,
"phone_count": 1201,
"last_evaluated_at": "2026-05-27T14:00:00Z",
"created_at": "2026-04-01T09:00:00Z",
"updated_at": "2026-05-27T14:00:00Z"
}Update name, description, folder, or (for dynamic segments) query. type cannot be changed. Sending query on a static segment returns 422 wrong_segment_type. To modify static membership use POST / DELETE on /segments/{id}/contacts. To move the segment into (or out of) a folder, set folder_id (pass null to unfolder it) β an unresolvable folder_id returns 422.
The API Secret from the Gleantap dashboard under Settings β API (Generate New Key if none exists). Send it bare (40 hex characters) or prefixed as gltp_sk_live_<40-hex>. There is no sandbox: every key acts on the live account.
Keys are account-scoped and carry all permissions on that account (no per-key scope selection). Cross-workroom reads are unrestricted by default β narrow with ?workroom= / Gleantap-Workroom on each request. Revoke via the dashboard.
For per-user consent, per-workroom scoping, and short-lived tokens, use OAuth 2.1 instead.
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$Same semantics as the Gleantap-Workroom header, including that a write should never be sent without a workroom the user actually chose, and that an omitted workroom scopes a read to the account default rather than spanning the account. Prefer this on GETs so proxies and caches can key on it. Accepts name, prefixed ID, raw hex, or all.
Minor version to run the request under (date-based). Older dates remain supported for at least 24 months. If omitted, the account's default pinned version is used.
2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$Target customer account, as acc_<24-hex> or a bare 24-hex ID. Only for Gleantap staff (CSM) tokens, which authenticate against the internal staff directory and are bound to no account; for a normal customer token the account is fixed by the token and this header is ignored.
A staff token MUST name an account on every request β there is no default, and omitting it returns 400 admin_account_required rather than falling back to some first account. Switching accounts is just a different value here; no re-authorization. Account names are rejected (400 admin_account_invalid) because they are neither unique nor stable β list IDs with GET /v3/accounts.
Every impersonated response carries an impersonation block naming the account actually acted on, so an account switch mid-session is always visible. Also settable via ?account=.
acc_59fca1e3d2a57d28a10b0442Which workroom to act in. Accepts a workroom name (case-insensitive), a prefixed ID (wrm_<hex>), a raw 24-hex ID, or the literal all.
On any write, ask the user which workroom β do not omit this. Optional here means the server has a fallback, not that the fallback is what anyone wanted: an omitted workroom sends the write to the account's default workroom, and accounts routinely have dozens. Creating a contact, flow, campaign or segment in the wrong workroom puts it where nobody is looking, and moving it afterwards is manual.
The one case where you need not ask: the account has exactly one workroom. Call listWorkrooms to find out β if it returns a single row, use it; if it returns several, ask which one before writing.
Reads are scoped too. Omitting a workroom on a read does not span the account β it narrows to the same default workroom a write would go to, and the response carries a workroom_defaulted warning saying so. So a count, a list or a segment preview describes one workroom unless you said otherwise. Pass all to deliberately span every workroom; that is the only way to get account-wide figures, and it is never the default. listWorkrooms itself is never narrowed, since it is how you discover what to ask for.
Also settable via ?workroom= or a workroom body field (POST/PATCH only) β query wins over header wins over body.
G Test1Partial update. type cannot be changed. Sending query on a static segment returns 422 wrong_segment_type; sending contact_ids here does nothing β use POST /v3/segments/{id}/contacts instead.
Move the segment into this folder. Pass null explicitly to remove it from its current folder (unfolder it). Must reference an existing folder in the same workroom β an unresolvable id returns 422.
sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$Updated.
A named collection of contacts. Either static (hand-managed list) or dynamic (query-defined). Discriminated by the type field, which is immutable after creation.
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$The workroom that owns this segment. A flow can only be triggered by segments in its own workroom β compare against Flow.workroom_id.
wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$static β hand-managed member list. Contacts are added/removed explicitly.
dynamic β query-defined membership. Auto-evaluated; membership changes as contact data changes.
Immutable after creation.
Current member count. Eventually consistent β up to minutes of lag on dynamic segments.
Members with a non-empty, non-invalid email.
Members with a non-empty, non-invalid phone.
When this dynamic segment was last recomputed. Null on static.
2026-05-27T14:23:11.482ZThe segment folder this segment currently belongs to, or null if unfoldered.
sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$AI-generated narrative summary of the segment's criteria. Populated on demand via POST /v3/segments/{id}/summary.
RFC 3339 timestamp, always UTC, millisecond precision.
2026-05-27T14:23:11.482ZRFC 3339 timestamp, always UTC, millisecond precision.
2026-05-27T14:23:11.482ZRequest could not be parsed or failed validation.
The resource doesn't exist or isn't visible to this caller.
Semantic validation failed β the request is well-formed but references an object in the wrong state (e.g., sending to an opted-out contact).
PATCH /v3/segments/{id} HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 871
{
"name": "text",
"description": "text",
"query": {
"segment_users": [
{
"segment": "Attributes",
"data": "text",
"event": "text",
"operator": "=",
"value": null,
"value2": null,
"operator2": "text",
"value2_id": [
"text"
],
"data_type": "String",
"dataAlias": "text",
"ANY_ADDITIONAL_PROPERTY": "anything"
}
],
"with_or_segment_users": [
[
{
"segment": "Attributes",
"data": "text",
"event": "text",
"operator": "=",
"value": null,
"value2": null,
"operator2": "text",
"value2_id": [
"text"
],
"data_type": "String",
"dataAlias": "text",
"ANY_ADDITIONAL_PROPERTY": "anything"
}
]
],
"exclude_segment_users": [
{
"segment": "Attributes",
"data": "text",
"event": "text",
"operator": "=",
"value": null,
"value2": null,
"operator2": "text",
"value2_id": [
"text"
],
"data_type": "String",
"dataAlias": "text",
"ANY_ADDITIONAL_PROPERTY": "anything"
}
]
},
"folder_id": "sfd_66b3a91d0e5b7c1a4d8e2f1a",
"metadata": {
"our_crm_id": "cust_884321",
"sync_batch": "2026-05-imports"
}
}{
"id": "seg_01H8XKE...",
"object": "segment",
"type": "dynamic",
"name": "Active VIPs in Mumbai",
"description": "VIP-tagged members who checked in or purchased recently",
"query": {
"segment_users": [
{
"segment": "Tags",
"operator": "Contains",
"value": [
"vip"
]
},
{
"segment": "City",
"operator": "=",
"value": [
"Mumbai"
]
}
]
},
"size": 1247,
"email_count": 1188,
"phone_count": 1201,
"last_evaluated_at": "2026-05-27T14:00:00Z",
"created_at": "2026-04-01T09:00:00Z",
"updated_at": "2026-05-27T14:00:00Z"
}Delete the segment. Contacts are not affected; only the segment definition and membership index are removed. Segments referenced by an active or paused flow, campaign, or sales automation cannot be deleted (409 segment_in_use) β remove the references first, or use ?force=true (requires segments:write plus admin role) to cascade-remove those references. force does not leave a half-edited rule behind: a rule whose last trigger segment is removed is marked broken and completed.
Permanent. There is no undo and no trash to restore from. Anything that references the deleted record is affected too.
The API Secret from the Gleantap dashboard under Settings β API (Generate New Key if none exists). Send it bare (40 hex characters) or prefixed as gltp_sk_live_<40-hex>. There is no sandbox: every key acts on the live account.
Keys are account-scoped and carry all permissions on that account (no per-key scope selection). Cross-workroom reads are unrestricted by default β narrow with ?workroom= / Gleantap-Workroom on each request. Revoke via the dashboard.
For per-user consent, per-workroom scoping, and short-lived tokens, use OAuth 2.1 instead.
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$Same semantics as the Gleantap-Workroom header, including that a write should never be sent without a workroom the user actually chose, and that an omitted workroom scopes a read to the account default rather than spanning the account. Prefer this on GETs so proxies and caches can key on it. Accepts name, prefixed ID, raw hex, or all.
If true, cascade-remove references from active flows/campaigns. Admin-only.
falseMinor version to run the request under (date-based). Older dates remain supported for at least 24 months. If omitted, the account's default pinned version is used.
2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$Target customer account, as acc_<24-hex> or a bare 24-hex ID. Only for Gleantap staff (CSM) tokens, which authenticate against the internal staff directory and are bound to no account; for a normal customer token the account is fixed by the token and this header is ignored.
A staff token MUST name an account on every request β there is no default, and omitting it returns 400 admin_account_required rather than falling back to some first account. Switching accounts is just a different value here; no re-authorization. Account names are rejected (400 admin_account_invalid) because they are neither unique nor stable β list IDs with GET /v3/accounts.
Every impersonated response carries an impersonation block naming the account actually acted on, so an account switch mid-session is always visible. Also settable via ?account=.
acc_59fca1e3d2a57d28a10b0442Which workroom to act in. Accepts a workroom name (case-insensitive), a prefixed ID (wrm_<hex>), a raw 24-hex ID, or the literal all.
On any write, ask the user which workroom β do not omit this. Optional here means the server has a fallback, not that the fallback is what anyone wanted: an omitted workroom sends the write to the account's default workroom, and accounts routinely have dozens. Creating a contact, flow, campaign or segment in the wrong workroom puts it where nobody is looking, and moving it afterwards is manual.
The one case where you need not ask: the account has exactly one workroom. Call listWorkrooms to find out β if it returns a single row, use it; if it returns several, ask which one before writing.
Reads are scoped too. Omitting a workroom on a read does not span the account β it narrows to the same default workroom a write would go to, and the response carries a workroom_defaulted warning saying so. So a count, a list or a segment preview describes one workroom unless you said otherwise. Pass all to deliberately span every workroom; that is the only way to get account-wide figures, and it is never the default. listWorkrooms itself is never narrowed, since it is how you discover what to ask for.
Also settable via ?workroom= or a workroom body field (POST/PATCH only) β query wins over header wins over body.
G Test1Deleted.
No content
The resource doesn't exist or isn't visible to this caller.
Idempotency conflict, version conflict (If-Match), or state conflict.
DELETE /v3/segments/{id} HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
No content
List/export segment members. When EXPORTING, ASK which columns first β do not export all fields by default.
β οΈ EXPORT RULE β READ FIRST: Plain member listing is unrestricted. But if the user is EXPORTING this segment (to CSV or a file), you MUST call with export=true, and then fields is mandatory: export=true with no fields returns 422 export_columns_required plus the column catalog β meaning ASK the user which columns they want (present the grouped human-readable options below), then call with export=true&fields=<chosen keys>. Never pick export columns yourself without asking, and never export all fields by default.
Paginated members β this endpoint also backs "export a segment". Works for both static and dynamic segments. The list is read from the membership index, so it is never filtered by the segment's cached size: a segment showing size: 0 with last_evaluated_at: null has simply never been evaluated, and may still list rows. On dynamic segments the list reflects the last evaluation β force a fresh one via POST /v3/segments/{id}/refresh if it is stale.
EXPORTING β CHOOSE COLUMNS FIRST: by default the full contact is returned. Before exporting, ASK the customer which columns they want and present them in human-readable form, grouped exactly like the segment UI (show the Label; send the key). Pass the chosen keys as a comma-separated fields value; the response is then one row per contact keyed by the human Label, ready to write as CSV. Personal Info β Contact Name β col_name, First Name β personalinfo.firstname, Last Name β personalinfo.lastname, Email β personalinfo.email, Phone β personalinfo.phone, Gender β personalinfo.gender, Date of Birth β personalinfo.dob, Birthday β personalinfo.birthday, City β personalinfo.city, State β personalinfo.state, Country β personalinfo.country, Added On β personalinfo.added_on Account Info β Location β accountinfo.location, Location ID β accountinfo.location_id, Status β accountinfo.status, Type β accountinfo.type, Tags β accountinfo.tags, Source β accountinfo.source Memberships β Membership Name β memberships.name, Membership Status β memberships.status, Membership Type β memberships.type, Membership Expiry β memberships.end_date, Membership Start Date β memberships.start_date, Membership Session Remaining β memberships.membership_session_remaining Contract Info β Contract Name β contracts.name, Contract Status β contracts.status, Contract Expiry β contracts.end_date, Contract Start Date β contracts.start_date, First Contract Date β contractinfo.first_contract_date Purchase Info β Last Purchased On β purchases.last_purchase_date, Last Purchased Item β purchases.last_purchase_products, Last Purchased Price β purchases.last_purchase_price, First Purchased On β purchases.first_purchase_date, First Purchased Item β purchases.first_purchase_products, First Purchased Price β purchases.first_purchase_price Visit Info β Last Visit On β visits.last_visit_date, Last Visit Service β visits.last_visit_services, Last Visit Type β visits.last_visit_type, Last Visit Status β visits.last_visit_status, First Visit On β visits.first_visit_date, First Visit Service β visits.first_visit_services, First Visit Status β visits.first_visit_status, Total Visits β visits.total_class_visits Pipeline β Pipeline Name β sales.pipeline, Stage β sales.stage, Status β sales.status, Responsible User β sales.responsible Ratings β Rating β ratings.rating, Review β ratings.review, Last Rating On β ratings.last_rating_on Custom β account-specific fields: call describeSegmentSchema (GET /v3/segments/schema), which exposes the account's custom attributes (the attributes map on the segments catalog β e.g. member_id, join_date, zipcode, β¦). Offer each key under a humanised label and pass the key verbatim as a fields value. (These are NOT on retrieveSegment, which returns only the saved segment definition.) Example: fields=personalinfo.firstname,personalinfo.lastname,personalinfo.email,memberships.name. Multiple memberships stack in the cell. Present/label columns with the human names above, never the raw keys.
The API Secret from the Gleantap dashboard under Settings β API (Generate New Key if none exists). Send it bare (40 hex characters) or prefixed as gltp_sk_live_<40-hex>. There is no sandbox: every key acts on the live account.
Keys are account-scoped and carry all permissions on that account (no per-key scope selection). Cross-workroom reads are unrestricted by default β narrow with ?workroom= / Gleantap-Workroom on each request. Revoke via the dashboard.
For per-user consent, per-workroom scoping, and short-lived tokens, use OAuth 2.1 instead.
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$Same semantics as the Gleantap-Workroom header, including that a write should never be sent without a workroom the user actually chose, and that an omitted workroom scopes a read to the account default rather than spanning the account. Prefer this on GETs so proxies and caches can key on it. Accepts name, prefixed ID, raw hex, or all.
Page size. Default 25, max 100.
25Opaque cursor from a prior response's next_cursor, to fetch the NEXT page (alias - after). On listContacts and listSegmentContacts, use before with a prev_cursor to page backward; other list endpoints are forward-only.
Opaque cursor from a prior response's prev_cursor, to fetch the PREVIOUS page. Supported on listContacts and listSegmentContacts only. If both before and cursor are sent, before wins.
Set true when the intent is to EXPORT this segment (CSV/file). With export=true and no fields, the endpoint returns 422 export_columns_required + the column catalog instead of data β forcing you to ask the user which columns first, then re-call with fields. Omit for normal member listing (no column restriction).
Comma-separated column KEYS to include, chosen by the user (see the grouped catalog in this operation's description). Required only for exports (export=true); optional for plain listing, where omitting it returns the full contact. DOTTED keys ARE supported and expected for exports (e.g. personalinfo.firstname, memberships.name, accountinfo.location), as are flat custom-attribute keys (e.g. member_id). When supplied, the response is one row per contact keyed by the human-readable column Label (ready to write as CSV). For exports, ASK the user which columns first β never default to all.
Minor version to run the request under (date-based). Older dates remain supported for at least 24 months. If omitted, the account's default pinned version is used.
2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$Target customer account, as acc_<24-hex> or a bare 24-hex ID. Only for Gleantap staff (CSM) tokens, which authenticate against the internal staff directory and are bound to no account; for a normal customer token the account is fixed by the token and this header is ignored.
A staff token MUST name an account on every request β there is no default, and omitting it returns 400 admin_account_required rather than falling back to some first account. Switching accounts is just a different value here; no re-authorization. Account names are rejected (400 admin_account_invalid) because they are neither unique nor stable β list IDs with GET /v3/accounts.
Every impersonated response carries an impersonation block naming the account actually acted on, so an account switch mid-session is always visible. Also settable via ?account=.
acc_59fca1e3d2a57d28a10b0442Which workroom to act in. Accepts a workroom name (case-insensitive), a prefixed ID (wrm_<hex>), a raw 24-hex ID, or the literal all.
On any write, ask the user which workroom β do not omit this. Optional here means the server has a fallback, not that the fallback is what anyone wanted: an omitted workroom sends the write to the account's default workroom, and accounts routinely have dozens. Creating a contact, flow, campaign or segment in the wrong workroom puts it where nobody is looking, and moving it afterwards is manual.
The one case where you need not ask: the account has exactly one workroom. Call listWorkrooms to find out β if it returns a single row, use it; if it returns several, ask which one before writing.
Reads are scoped too. Omitting a workroom on a read does not span the account β it narrows to the same default workroom a write would go to, and the response carries a workroom_defaulted warning saying so. So a count, a list or a segment preview describes one workroom unless you said otherwise. Pass all to deliberately span every workroom; that is the only way to get account-wide figures, and it is never the default. listWorkrooms itself is never narrowed, since it is how you discover what to ask for.
Also settable via ?workroom= or a workroom body field (POST/PATCH only) β query wins over header wins over body.
G Test1A page of contacts.
True if additional records exist beyond this page.
Opaque cursor for the next page. Null on the last page.
Cursor for the previous page. Supported on listContacts and listSegmentContacts: pass it back as ?before=... to page backward; null on the first page. On every other list endpoint paging is forward-only and this is always null.
The resource doesn't exist or isn't visible to this caller.
GET /v3/segments/{id}/contacts HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"object": "text",
"data": [
{
"id": "con_6a7eaec3505bea795709f897",
"object": "text",
"external_id": "user_12345",
"email": "[email protected]",
"phone": "+15558675309",
"first_name": "text",
"last_name": "text",
"date_of_birth": "1990-04-12",
"locale": "en-IN",
"timezone": "America/New_York",
"tags": [
"vip",
"trial"
],
"custom_fields": {
"favorite_color": "teal",
"lead_score": 87
},
"memberships": [
{
"id": "7da31914-6ef9-4a5d-b218-b8bdcfbe2954",
"name": "text",
"type": "text",
"status": "text",
"member_status": "text",
"member_status_date": "2026-01-01T00:00:00.000Z",
"price": 1,
"total_sessions": 1,
"sessions_remaining": 1,
"location_id": "text",
"start_date": "2026-01-01T00:00:00.000Z",
"begin_date": "2026-01-01T00:00:00.000Z",
"renewal_date": "2026-01-01T00:00:00.000Z",
"next_billing_date": "2026-01-01T00:00:00.000Z",
"end_date": "2026-01-01T00:00:00.000Z",
"expiration_date": "2026-01-01T00:00:00.000Z",
"renewal_type": "text",
"invoice_ids": [
"text"
],
"ANY_ADDITIONAL_PROPERTY": "anything"
}
],
"consent": {
"sms": {
"status": "opted_in",
"source": "form_submission",
"timestamp": "2026-04-01T10:14:00Z"
},
"email": {
"status": "opted_in",
"source": "form_submission",
"timestamp": "2026-04-01T10:14:00Z"
}
},
"primary_location_id": "loc_01H8XKG...",
"location": "text",
"location_id": "text",
"member_status": "text",
"owner_user_id": "usr_01H8XL7...",
"segments": [
"seg_01H8XKE..."
],
"pipelines": [
{
"pipeline_id": "text",
"stage_id": "text",
"stage_name": "text",
"status": "text",
"added_at": "2026-05-27T14:23:11.482Z",
"last_updated_at": "2026-05-27T14:23:11.482Z"
}
],
"lifecycle_stage": "member",
"last_seen_at": "2026-05-27T14:23:11.482Z",
"created_at": "2026-05-27T14:23:11.482Z",
"updated_at": "2026-05-27T14:23:11.482Z",
"deleted_at": "2026-05-27T14:23:11.482Z",
"metadata": {
"our_crm_id": "cust_884321",
"sync_batch": "2026-05-imports"
}
}
],
"has_more": true,
"next_cursor": "text",
"prev_cursor": "text"
}Static segments only. Adding to a dynamic segment returns 422 wrong_segment_type β dynamic membership is defined by query. Duplicates are silently deduped. Max 1000 contacts per call; use the bulk contacts import for larger batches.
The API Secret from the Gleantap dashboard under Settings β API (Generate New Key if none exists). Send it bare (40 hex characters) or prefixed as gltp_sk_live_<40-hex>. There is no sandbox: every key acts on the live account.
Keys are account-scoped and carry all permissions on that account (no per-key scope selection). Cross-workroom reads are unrestricted by default β narrow with ?workroom= / Gleantap-Workroom on each request. Revoke via the dashboard.
For per-user consent, per-workroom scoping, and short-lived tokens, use OAuth 2.1 instead.
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$Same semantics as the Gleantap-Workroom header, including that a write should never be sent without a workroom the user actually chose, and that an omitted workroom scopes a read to the account default rather than spanning the account. Prefer this on GETs so proxies and caches can key on it. Accepts name, prefixed ID, raw hex, or all.
Minor version to run the request under (date-based). Older dates remain supported for at least 24 months. If omitted, the account's default pinned version is used.
2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$Target customer account, as acc_<24-hex> or a bare 24-hex ID. Only for Gleantap staff (CSM) tokens, which authenticate against the internal staff directory and are bound to no account; for a normal customer token the account is fixed by the token and this header is ignored.
A staff token MUST name an account on every request β there is no default, and omitting it returns 400 admin_account_required rather than falling back to some first account. Switching accounts is just a different value here; no re-authorization. Account names are rejected (400 admin_account_invalid) because they are neither unique nor stable β list IDs with GET /v3/accounts.
Every impersonated response carries an impersonation block naming the account actually acted on, so an account switch mid-session is always visible. Also settable via ?account=.
acc_59fca1e3d2a57d28a10b0442Which workroom to act in. Accepts a workroom name (case-insensitive), a prefixed ID (wrm_<hex>), a raw 24-hex ID, or the literal all.
On any write, ask the user which workroom β do not omit this. Optional here means the server has a fallback, not that the fallback is what anyone wanted: an omitted workroom sends the write to the account's default workroom, and accounts routinely have dozens. Creating a contact, flow, campaign or segment in the wrong workroom puts it where nobody is looking, and moving it afterwards is manual.
The one case where you need not ask: the account has exactly one workroom. Call listWorkrooms to find out β if it returns a single row, use it; if it returns several, ask which one before writing.
Reads are scoped too. Omitting a workroom on a read does not span the account β it narrows to the same default workroom a write would go to, and the response carries a workroom_defaulted warning saying so. So a count, a list or a segment preview describes one workroom unless you said otherwise. Pass all to deliberately span every workroom; that is the only way to get account-wide figures, and it is never the default. listWorkrooms itself is never narrowed, since it is how you discover what to ask for.
Also settable via ?workroom= or a workroom body field (POST/PATCH only) β query wins over header wins over body.
G Test1A unique key (β€255 chars) chosen by the client. Replays with the same key + same body return the cached response. Replays with the same key + different body return 409 idempotency_conflict. Required on messaging sends and bulk operations; recommended elsewhere.
8e3c7a90-7c4d-4f8e-8e3c-7a907c4d4f8eAdd contact(s) to a static segment. Duplicates are silently deduped.
A contact ID. Accepts either the native prefixed id (con_<24-hex>) or an external-ID reference (external_id:<your_id>).
Contacts added. Returns the updated segment with new size.
A named collection of contacts. Either static (hand-managed list) or dynamic (query-defined). Discriminated by the type field, which is immutable after creation.
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$The workroom that owns this segment. A flow can only be triggered by segments in its own workroom β compare against Flow.workroom_id.
wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$static β hand-managed member list. Contacts are added/removed explicitly.
dynamic β query-defined membership. Auto-evaluated; membership changes as contact data changes.
Immutable after creation.
Current member count. Eventually consistent β up to minutes of lag on dynamic segments.
Members with a non-empty, non-invalid email.
Members with a non-empty, non-invalid phone.
When this dynamic segment was last recomputed. Null on static.
2026-05-27T14:23:11.482ZThe segment folder this segment currently belongs to, or null if unfoldered.
sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$AI-generated narrative summary of the segment's criteria. Populated on demand via POST /v3/segments/{id}/summary.
RFC 3339 timestamp, always UTC, millisecond precision.
2026-05-27T14:23:11.482ZRFC 3339 timestamp, always UTC, millisecond precision.
2026-05-27T14:23:11.482ZRequest could not be parsed or failed validation.
The resource doesn't exist or isn't visible to this caller.
Semantic validation failed β the request is well-formed but references an object in the wrong state (e.g., sending to an opted-out contact).
POST /v3/segments/{id}/contacts HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 48
{
"contact_ids": [
"con_6a7eaec3505bea795709f897"
]
}{
"id": "seg_01H8XKE...",
"object": "segment",
"type": "dynamic",
"name": "Active VIPs in Mumbai",
"description": "VIP-tagged members who checked in or purchased recently",
"query": {
"segment_users": [
{
"segment": "Tags",
"operator": "Contains",
"value": [
"vip"
]
},
{
"segment": "City",
"operator": "=",
"value": [
"Mumbai"
]
}
]
},
"size": 1247,
"email_count": 1188,
"phone_count": 1201,
"last_evaluated_at": "2026-05-27T14:00:00Z",
"created_at": "2026-04-01T09:00:00Z",
"updated_at": "2026-05-27T14:00:00Z"
}Static segments only. Returns 422 wrong_segment_type on dynamic segments. Idempotent β removing a non-member returns 204.
Permanent. There is no undo and no trash to restore from. Anything that references the deleted record is affected too.
The API Secret from the Gleantap dashboard under Settings β API (Generate New Key if none exists). Send it bare (40 hex characters) or prefixed as gltp_sk_live_<40-hex>. There is no sandbox: every key acts on the live account.
Keys are account-scoped and carry all permissions on that account (no per-key scope selection). Cross-workroom reads are unrestricted by default β narrow with ?workroom= / Gleantap-Workroom on each request. Revoke via the dashboard.
For per-user consent, per-workroom scoping, and short-lived tokens, use OAuth 2.1 instead.
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$A contact ID. Accepts either the native prefixed id (con_<24-hex>) or an external-ID reference (external_id:<your_id>).
con_6a7eaec3505bea795709f897Pattern: ^con_[0-9a-f]{24}$|^external_id:[^/]+$Same semantics as the Gleantap-Workroom header, including that a write should never be sent without a workroom the user actually chose, and that an omitted workroom scopes a read to the account default rather than spanning the account. Prefer this on GETs so proxies and caches can key on it. Accepts name, prefixed ID, raw hex, or all.
Minor version to run the request under (date-based). Older dates remain supported for at least 24 months. If omitted, the account's default pinned version is used.
2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$Target customer account, as acc_<24-hex> or a bare 24-hex ID. Only for Gleantap staff (CSM) tokens, which authenticate against the internal staff directory and are bound to no account; for a normal customer token the account is fixed by the token and this header is ignored.
A staff token MUST name an account on every request β there is no default, and omitting it returns 400 admin_account_required rather than falling back to some first account. Switching accounts is just a different value here; no re-authorization. Account names are rejected (400 admin_account_invalid) because they are neither unique nor stable β list IDs with GET /v3/accounts.
Every impersonated response carries an impersonation block naming the account actually acted on, so an account switch mid-session is always visible. Also settable via ?account=.
acc_59fca1e3d2a57d28a10b0442Which workroom to act in. Accepts a workroom name (case-insensitive), a prefixed ID (wrm_<hex>), a raw 24-hex ID, or the literal all.
On any write, ask the user which workroom β do not omit this. Optional here means the server has a fallback, not that the fallback is what anyone wanted: an omitted workroom sends the write to the account's default workroom, and accounts routinely have dozens. Creating a contact, flow, campaign or segment in the wrong workroom puts it where nobody is looking, and moving it afterwards is manual.
The one case where you need not ask: the account has exactly one workroom. Call listWorkrooms to find out β if it returns a single row, use it; if it returns several, ask which one before writing.
Reads are scoped too. Omitting a workroom on a read does not span the account β it narrows to the same default workroom a write would go to, and the response carries a workroom_defaulted warning saying so. So a count, a list or a segment preview describes one workroom unless you said otherwise. Pass all to deliberately span every workroom; that is the only way to get account-wide figures, and it is never the default. listWorkrooms itself is never narrowed, since it is how you discover what to ask for.
Also settable via ?workroom= or a workroom body field (POST/PATCH only) β query wins over header wins over body.
G Test1Removed.
No content
The resource doesn't exist or isn't visible to this caller.
Semantic validation failed β the request is well-formed but references an object in the wrong state (e.g., sending to an opted-out contact).
DELETE /v3/segments/{id}/contacts/{contact_id} HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
No content
Catalog for constructing a segment query. Returns the categories (memberships, purchases, visits, salesattributes, attributes/Custom, etc.), their attributes with data types and observed values from the current workroom's data, valid operators per data type, and each category's resolution_hint describing where the attribute is stored on the contact doc.
Workroom-aware: pass ?workroom=<name-or-id> to see values from a specific workroom, or omit for the account's default. The attributes (Custom) category resolves to userdetails.data.<attr> β that's where account-defined custom fields live.
Use this endpoint to:
Discover the correct
segmentcategory +dataattribute names to reference insegment_users.Verify an attribute has a first-class category BEFORE creating a new custom_field.
See real-world
possible_values(a hint, not an exhaustive whitelist).Look up which
operatorsare valid for a given attribute'sdata_type.
possible_values is empty where no option list has been generated. It is populated only where someone has generated an option list for that attribute, which is true of a small minority of them. listAttributeValues returns the values an attribute actually holds in the workroom. A filter built on invented values saves without error and matches nobody.
The API Secret from the Gleantap dashboard under Settings β API (Generate New Key if none exists). Send it bare (40 hex characters) or prefixed as gltp_sk_live_<40-hex>. There is no sandbox: every key acts on the live account.
Keys are account-scoped and carry all permissions on that account (no per-key scope selection). Cross-workroom reads are unrestricted by default β narrow with ?workroom= / Gleantap-Workroom on each request. Revoke via the dashboard.
For per-user consent, per-workroom scoping, and short-lived tokens, use OAuth 2.1 instead.
Same semantics as the Gleantap-Workroom header, including that a write should never be sent without a workroom the user actually chose, and that an omitted workroom scopes a read to the account default rather than spanning the account. Prefer this on GETs so proxies and caches can key on it. Accepts name, prefixed ID, raw hex, or all.
Minor version to run the request under (date-based). Older dates remain supported for at least 24 months. If omitted, the account's default pinned version is used.
2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$Target customer account, as acc_<24-hex> or a bare 24-hex ID. Only for Gleantap staff (CSM) tokens, which authenticate against the internal staff directory and are bound to no account; for a normal customer token the account is fixed by the token and this header is ignored.
A staff token MUST name an account on every request β there is no default, and omitting it returns 400 admin_account_required rather than falling back to some first account. Switching accounts is just a different value here; no re-authorization. Account names are rejected (400 admin_account_invalid) because they are neither unique nor stable β list IDs with GET /v3/accounts.
Every impersonated response carries an impersonation block naming the account actually acted on, so an account switch mid-session is always visible. Also settable via ?account=.
acc_59fca1e3d2a57d28a10b0442Which workroom to act in. Accepts a workroom name (case-insensitive), a prefixed ID (wrm_<hex>), a raw 24-hex ID, or the literal all.
On any write, ask the user which workroom β do not omit this. Optional here means the server has a fallback, not that the fallback is what anyone wanted: an omitted workroom sends the write to the account's default workroom, and accounts routinely have dozens. Creating a contact, flow, campaign or segment in the wrong workroom puts it where nobody is looking, and moving it afterwards is manual.
The one case where you need not ask: the account has exactly one workroom. Call listWorkrooms to find out β if it returns a single row, use it; if it returns several, ask which one before writing.
Reads are scoped too. Omitting a workroom on a read does not span the account β it narrows to the same default workroom a write would go to, and the response carries a workroom_defaulted warning saying so. So a count, a list or a segment preview describes one workroom unless you said otherwise. Pass all to deliberately span every workroom; that is the only way to get account-wide figures, and it is never the default. listWorkrooms itself is never narrowed, since it is how you discover what to ask for.
Also settable via ?workroom= or a workroom body field (POST/PATCH only) β query wins over header wins over body.
G Test1The segment DSL schema.
Machine-readable segment DSL catalog. Categories, attributes, valid operators per data type, and observed values in the current workroom. Merges three sources: (1) the global segmentation_attributes catalog, (2) this workroom's segments doc for possible_values, (3) the account's v3_custom_fields for Custom attributes.
The workroom this schema is scoped to. null when no workroom hint was provided.
wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$Whether this account has shared contacts (linked copies across workrooms) enabled (accountdetails.shared_contact_status). It decides how to build an "exclude X" request β see the EXCLUDE entry in notes[] and the exclude_segment_users description. When false, express the exclusion as a negative condition inside segment_users; when true, put it in exclude_segment_users with the positive operator.
Human-readable guidance about how to use the schema. Include verbatim in AI prompts when constructing segments.
GET /v3/segments/schema HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
The segment DSL schema.
{
"object": "segment_schema",
"workroom_id": "wrm_5ace370fd2a57d74d0548fb2",
"shared_contacts_enabled": true,
"categories": [
{
"value": "text",
"title": "text",
"data_type": "text",
"resolution_hint": "text",
"attributes": [
{
"value": "text",
"title": "text",
"data_type": "String",
"possible_values": [
"text"
],
"operators": [
"text"
],
"condition_template": {
"segment": "text",
"data": "text",
"dataAlias": "text",
"data_type": "text",
"operator": "text",
"value": "text",
"event": "text"
},
"source": "v3_custom_fields",
"resolution_path": "text"
}
]
}
],
"operators_by_data_type": {
"ANY_ADDITIONAL_PROPERTY": [
"text"
]
},
"notes": [
"text"
],
"examples": {
"ANY_ADDITIONAL_PROPERTY": {
"description": "text",
"segment_users": [
{
"segment": "text",
"data": "text",
"dataAlias": "text",
"data_type": "text",
"operator": "text",
"value": "text",
"event": "text"
}
]
}
}
}The values that exist in this workroom's data for one attribute β the API equivalent of the dashboard's Generate Options button.
Catalog for building an Is One Of / Is Not One Of filter on any attribute whose possible_values came back empty from describeSegmentSchema. Guessing values is the single most common way to produce a segment that saves cleanly and matches zero contacts: the values look plausible ("Gold", "Silver") while the workroom actually uses "Platinum Primary" and "Blue Card". Nothing errors, and the campaign built on it goes to nobody.
Pass the attribute exactly as describeSegmentSchema names it: bare for Custom attributes (membership_status), category-prefixed otherwise (memberships.status, personalinfo.state).
status reports how complete values is:
enumeratedβvaluesholds the real values, most common first.truncated: truemeans there are more than are shown.high_cardinalityβ too many distinct values to enumerate, and too many to pick from.Containsor an exactEqualssuit this better thanIs One Of, which needs a list to choose from.unsupported_typeβ a date, number or identity field. These are continuous or unique per contact; use a range or exact-match operator.emptyβ no contact in this workroom has this attribute set. Usually means the attribute name is wrong, or the data has not been imported yet. Say so rather than filtering on it.
Results are cached on the workroom, including the negative verdicts, so repeat calls are free. The list is shared with the dashboard's own option list, so generating it here also populates Configure Workroom. Pass refresh=true to recompute when you have reason to believe the data changed. Rate limit bucket: search.
The API Secret from the Gleantap dashboard under Settings β API (Generate New Key if none exists). Send it bare (40 hex characters) or prefixed as gltp_sk_live_<40-hex>. There is no sandbox: every key acts on the live account.
Keys are account-scoped and carry all permissions on that account (no per-key scope selection). Cross-workroom reads are unrestricted by default β narrow with ?workroom= / Gleantap-Workroom on each request. Revoke via the dashboard.
For per-user consent, per-workroom scoping, and short-lived tokens, use OAuth 2.1 instead.
Same semantics as the Gleantap-Workroom header, including that a write should never be sent without a workroom the user actually chose, and that an omitted workroom scopes a read to the account default rather than spanning the account. Prefer this on GETs so proxies and caches can key on it. Accepts name, prefixed ID, raw hex, or all.
Attribute name as describeSegmentSchema reports it, e.g. membership_status or memberships.status.
memberships.statusRecompute instead of using the cached result. Use sparingly β enumeration scans contact data.
falseMinor version to run the request under (date-based). Older dates remain supported for at least 24 months. If omitted, the account's default pinned version is used.
2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$Target customer account, as acc_<24-hex> or a bare 24-hex ID. Only for Gleantap staff (CSM) tokens, which authenticate against the internal staff directory and are bound to no account; for a normal customer token the account is fixed by the token and this header is ignored.
A staff token MUST name an account on every request β there is no default, and omitting it returns 400 admin_account_required rather than falling back to some first account. Switching accounts is just a different value here; no re-authorization. Account names are rejected (400 admin_account_invalid) because they are neither unique nor stable β list IDs with GET /v3/accounts.
Every impersonated response carries an impersonation block naming the account actually acted on, so an account switch mid-session is always visible. Also settable via ?account=.
acc_59fca1e3d2a57d28a10b0442Which workroom to act in. Accepts a workroom name (case-insensitive), a prefixed ID (wrm_<hex>), a raw 24-hex ID, or the literal all.
On any write, ask the user which workroom β do not omit this. Optional here means the server has a fallback, not that the fallback is what anyone wanted: an omitted workroom sends the write to the account's default workroom, and accounts routinely have dozens. Creating a contact, flow, campaign or segment in the wrong workroom puts it where nobody is looking, and moving it afterwards is manual.
The one case where you need not ask: the account has exactly one workroom. Call listWorkrooms to find out β if it returns a single row, use it; if it returns several, ask which one before writing.
Reads are scoped too. Omitting a workroom on a read does not span the account β it narrows to the same default workroom a write would go to, and the response carries a workroom_defaulted warning saying so. So a count, a list or a segment preview describes one workroom unless you said otherwise. Pass all to deliberately span every workroom; that is the only way to get account-wide figures, and it is never the default. listWorkrooms itself is never narrowed, since it is how you discover what to ask for.
Also settable via ?workroom= or a workroom body field (POST/PATCH only) β query wins over header wins over body.
G Test1The attribute's values, or why they could not be listed.
The values one attribute actually holds in a workroom. Always check status before reading values β an empty values means something different in each case.
The attribute as requested.
memberships.statusWhere the attribute lives on the contact document. Custom attributes resolve under data..
memberships.statusenumerated β values is usable.
high_cardinality β too many distinct values to list or to choose from; use Contains or Equals.
unsupported_type β a date, number or identity field; use a range or exact match.
empty β no contact here has this attribute set; check the name before filtering on it.
Real values, most common first. Empty unless status is enumerated.
["Active","Depleted","Freeze","inactive"]How many distinct values exist. Null when the attribute was refused before counting.
Present and true when there are more values than are shown.
Why the values could not be listed. Present for every status except enumerated.
True when answered from the stored option list rather than recomputed.
Human-readable footnote, e.g. that the list was capped.
GET /v3/segments/attribute_values?attribute=text HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
The attribute's values, or why they could not be listed.
{
"object": "attribute_values",
"attribute": "memberships.status",
"resolution_path": "memberships.status",
"status": "enumerated",
"values": [
"Active",
"Depleted",
"Freeze",
"inactive"
],
"distinct_total": 1,
"truncated": true,
"reason": "text",
"cached": true,
"computed_at": "2026-01-01T00:00:00.000Z",
"note": "text"
}Evaluate a query and return the estimated size. with_or_segment_users and exclude_segment_users are applied exactly as the dashboard cron applies them to a saved segment, in the account's timezone. Set include_sample: true to also get sample contacts (sample_limit, default 10). Use this to iterate on a query before persisting it as a segment. Rate limit bucket: search (60 req/min default).
A read: requires segments:read (a token with only segments:write is also accepted) and, for OAuth tokens, the dashboard role's Segments β View permission β view-only roles such as Analyst may preview. Own-records-only access does not restrict it (no saved segment is involved).
The API Secret from the Gleantap dashboard under Settings β API (Generate New Key if none exists). Send it bare (40 hex characters) or prefixed as gltp_sk_live_<40-hex>. There is no sandbox: every key acts on the live account.
Keys are account-scoped and carry all permissions on that account (no per-key scope selection). Cross-workroom reads are unrestricted by default β narrow with ?workroom= / Gleantap-Workroom on each request. Revoke via the dashboard.
For per-user consent, per-workroom scoping, and short-lived tokens, use OAuth 2.1 instead.
Same semantics as the Gleantap-Workroom header, including that a write should never be sent without a workroom the user actually chose, and that an omitted workroom scopes a read to the account default rather than spanning the account. Prefer this on GETs so proxies and caches can key on it. Accepts name, prefixed ID, raw hex, or all.
Minor version to run the request under (date-based). Older dates remain supported for at least 24 months. If omitted, the account's default pinned version is used.
2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$Target customer account, as acc_<24-hex> or a bare 24-hex ID. Only for Gleantap staff (CSM) tokens, which authenticate against the internal staff directory and are bound to no account; for a normal customer token the account is fixed by the token and this header is ignored.
A staff token MUST name an account on every request β there is no default, and omitting it returns 400 admin_account_required rather than falling back to some first account. Switching accounts is just a different value here; no re-authorization. Account names are rejected (400 admin_account_invalid) because they are neither unique nor stable β list IDs with GET /v3/accounts.
Every impersonated response carries an impersonation block naming the account actually acted on, so an account switch mid-session is always visible. Also settable via ?account=.
acc_59fca1e3d2a57d28a10b0442Which workroom to act in. Accepts a workroom name (case-insensitive), a prefixed ID (wrm_<hex>), a raw 24-hex ID, or the literal all.
On any write, ask the user which workroom β do not omit this. Optional here means the server has a fallback, not that the fallback is what anyone wanted: an omitted workroom sends the write to the account's default workroom, and accounts routinely have dozens. Creating a contact, flow, campaign or segment in the wrong workroom puts it where nobody is looking, and moving it afterwards is manual.
The one case where you need not ask: the account has exactly one workroom. Call listWorkrooms to find out β if it returns a single row, use it; if it returns several, ask which one before writing.
Reads are scoped too. Omitting a workroom on a read does not span the account β it narrows to the same default workroom a write would go to, and the response carries a workroom_defaulted warning saying so. So a count, a list or a segment preview describes one workroom unless you said otherwise. Pass all to deliberately span every workroom; that is the only way to get account-wide figures, and it is never the default. listWorkrooms itself is never narrowed, since it is how you discover what to ask for.
Also settable via ?workroom= or a workroom body field (POST/PATCH only) β query wins over header wins over body.
G Test1Preview membership size for a query without saving anything. The whole query is evaluated β segment_users, with_or_segment_users and exclude_segment_users β combined, normalized and timezone-resolved exactly as the dashboard cron does for a saved segment, so the preview predicts the saved segment's size.
If true, include sample contacts in the response. Adds latency.
falseNumber of sample contacts when include_sample is true.
10Preview result.
Number of workrooms the preview was scoped to.
Contacts matching the query (soft-deleted contacts excluded). null when the query carries an External Events count threshold (operator2/value2) the preview cannot apply β it would otherwise report the event-match total, which misleads; see the external_events_count_threshold warning. The saved segment's real size is computed by the external-events cron.
The account timezone relative-date operators were evaluated in (the same one the cron uses).
Non-fatal notes, e.g. invalid_operator: (saving this query would be rejected), external_events_approximate: (External Events count thresholds are evaluated only by the cron), condition_matches_nothing:.
Request could not be parsed or failed validation.
Semantic validation failed β the request is well-formed but references an object in the wrong state (e.g., sending to an opted-out contact).
Rate limited.
POST /v3/segments/preview HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 217
{
"query": {
"segment_users": [
{
"segment": "Tags",
"operator": "Contains",
"value": [
"vip"
]
},
{
"segment": "External Events",
"data": "is_purchase",
"operator": "InLast",
"value": 30,
"operator2": ">",
"value2": 0
}
]
},
"include_sample": true
}{
"object": "text",
"workroom_id": "text",
"workroom_count": 1,
"estimated_size": 1,
"engine": "text",
"timezone": "text",
"warnings": [
"text"
],
"sample": [
{
"id": "con_6a7eaec3505bea795709f897",
"object": "text",
"external_id": "user_12345",
"email": "[email protected]",
"phone": "+15558675309",
"first_name": "text",
"last_name": "text",
"date_of_birth": "1990-04-12",
"locale": "en-IN",
"timezone": "America/New_York",
"tags": [
"vip",
"trial"
],
"custom_fields": {
"favorite_color": "teal",
"lead_score": 87
},
"memberships": [
{
"id": "7da31914-6ef9-4a5d-b218-b8bdcfbe2954",
"name": "text",
"type": "text",
"status": "text",
"member_status": "text",
"member_status_date": "2026-01-01T00:00:00.000Z",
"price": 1,
"total_sessions": 1,
"sessions_remaining": 1,
"location_id": "text",
"start_date": "2026-01-01T00:00:00.000Z",
"begin_date": "2026-01-01T00:00:00.000Z",
"renewal_date": "2026-01-01T00:00:00.000Z",
"next_billing_date": "2026-01-01T00:00:00.000Z",
"end_date": "2026-01-01T00:00:00.000Z",
"expiration_date": "2026-01-01T00:00:00.000Z",
"renewal_type": "text",
"invoice_ids": [
"text"
],
"ANY_ADDITIONAL_PROPERTY": "anything"
}
],
"consent": {
"sms": {
"status": "opted_in",
"source": "form_submission",
"timestamp": "2026-04-01T10:14:00Z"
},
"email": {
"status": "opted_in",
"source": "form_submission",
"timestamp": "2026-04-01T10:14:00Z"
}
},
"primary_location_id": "loc_01H8XKG...",
"location": "text",
"location_id": "text",
"member_status": "text",
"owner_user_id": "usr_01H8XL7...",
"segments": [
"seg_01H8XKE..."
],
"pipelines": [
{
"pipeline_id": "text",
"stage_id": "text",
"stage_name": "text",
"status": "text",
"added_at": "2026-05-27T14:23:11.482Z",
"last_updated_at": "2026-05-27T14:23:11.482Z"
}
],
"lifecycle_stage": "member",
"last_seen_at": "2026-05-27T14:23:11.482Z",
"created_at": "2026-05-27T14:23:11.482Z",
"updated_at": "2026-05-27T14:23:11.482Z",
"deleted_at": "2026-05-27T14:23:11.482Z",
"metadata": {
"our_crm_id": "cust_884321",
"sync_batch": "2026-05-imports"
}
}
]
}Re-evaluate the segment now β synchronously. Membership is recomputed with the same engine the preview and the scheduled cron use, written to the membership index, and size / email_count / phone_count / last_evaluated_at are updated before the response is returned. Dynamic segments also refresh on a schedule (default ~30 min, longer for segments with external-event conditions); this forces an immediate pass.
The response is the segment's state AFTER the recompute, so there is nothing to poll: status: completed with the new counts, or status: queued when the evaluation itself failed β in that case nothing was written, reason names the failure, and the segment is left marked for the dashboard cron's next pass (a later GET /v3/segments/{id} shows whether it filled in). Returns 422 wrong_segment_type on static segments (nothing to refresh). Rate limit bucket: search.
The API Secret from the Gleantap dashboard under Settings β API (Generate New Key if none exists). Send it bare (40 hex characters) or prefixed as gltp_sk_live_<40-hex>. There is no sandbox: every key acts on the live account.
Keys are account-scoped and carry all permissions on that account (no per-key scope selection). Cross-workroom reads are unrestricted by default β narrow with ?workroom= / Gleantap-Workroom on each request. Revoke via the dashboard.
For per-user consent, per-workroom scoping, and short-lived tokens, use OAuth 2.1 instead.
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$Same semantics as the Gleantap-Workroom header, including that a write should never be sent without a workroom the user actually chose, and that an omitted workroom scopes a read to the account default rather than spanning the account. Prefer this on GETs so proxies and caches can key on it. Accepts name, prefixed ID, raw hex, or all.
Minor version to run the request under (date-based). Older dates remain supported for at least 24 months. If omitted, the account's default pinned version is used.
2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$Target customer account, as acc_<24-hex> or a bare 24-hex ID. Only for Gleantap staff (CSM) tokens, which authenticate against the internal staff directory and are bound to no account; for a normal customer token the account is fixed by the token and this header is ignored.
A staff token MUST name an account on every request β there is no default, and omitting it returns 400 admin_account_required rather than falling back to some first account. Switching accounts is just a different value here; no re-authorization. Account names are rejected (400 admin_account_invalid) because they are neither unique nor stable β list IDs with GET /v3/accounts.
Every impersonated response carries an impersonation block naming the account actually acted on, so an account switch mid-session is always visible. Also settable via ?account=.
acc_59fca1e3d2a57d28a10b0442Which workroom to act in. Accepts a workroom name (case-insensitive), a prefixed ID (wrm_<hex>), a raw 24-hex ID, or the literal all.
On any write, ask the user which workroom β do not omit this. Optional here means the server has a fallback, not that the fallback is what anyone wanted: an omitted workroom sends the write to the account's default workroom, and accounts routinely have dozens. Creating a contact, flow, campaign or segment in the wrong workroom puts it where nobody is looking, and moving it afterwards is manual.
The one case where you need not ask: the account has exactly one workroom. Call listWorkrooms to find out β if it returns a single row, use it; if it returns several, ask which one before writing.
Reads are scoped too. Omitting a workroom on a read does not span the account β it narrows to the same default workroom a write would go to, and the response carries a workroom_defaulted warning saying so. So a count, a list or a segment preview describes one workroom unless you said otherwise. Pass all to deliberately span every workroom; that is the only way to get account-wide figures, and it is never the default. listWorkrooms itself is never narrowed, since it is how you discover what to ask for.
Also settable via ?workroom= or a workroom body field (POST/PATCH only) β query wins over header wins over body.
G Test1Segment recomputed. Counts are the freshly evaluated values.
Result of a forced recompute β the segment's state after the evaluation attempt, so the caller can verify the refresh from this response alone (there is no job to poll).
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$completed β evaluated inline; the counts below are the new values. queued β the evaluation failed, nothing was written, and the segment was left marked for the dashboard cron; reason says why.
Member count after the evaluation. A zero size on a queued refresh means not evaluated, not empty.
When membership was last computed. null means never evaluated.
2026-05-27T14:23:11.482ZPresent only when the refresh was queued β why the evaluation failed.
Evaluation failed; the segment is queued for the dashboard cron's next pass. Nothing was written.
The resource doesn't exist or isn't visible to this caller.
Semantic validation failed β the request is well-formed but references an object in the wrong state (e.g., sending to an opted-out contact).
Rate limited.
refresh_engine_error β the evaluation could not run at all (no workroom, database handle unavailable). Nothing was written.
POST /v3/segments/{id}/refresh HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"object": "text",
"segment_id": "seg_01H8XKE...",
"status": "completed",
"size": 1,
"email_count": 1,
"phone_count": 1,
"last_evaluated_at": "2026-05-27T14:23:11.482Z",
"reason": "text"
}Backed by the dashboard's segment_folder collection.
The API Secret from the Gleantap dashboard under Settings β API (Generate New Key if none exists). Send it bare (40 hex characters) or prefixed as gltp_sk_live_<40-hex>. There is no sandbox: every key acts on the live account.
Keys are account-scoped and carry all permissions on that account (no per-key scope selection). Cross-workroom reads are unrestricted by default β narrow with ?workroom= / Gleantap-Workroom on each request. Revoke via the dashboard.
For per-user consent, per-workroom scoping, and short-lived tokens, use OAuth 2.1 instead.
Same semantics as the Gleantap-Workroom header, including that a write should never be sent without a workroom the user actually chose, and that an omitted workroom scopes a read to the account default rather than spanning the account. Prefer this on GETs so proxies and caches can key on it. Accepts name, prefixed ID, raw hex, or all.
Page size. Default 25, max 100.
25Opaque cursor from a prior response's next_cursor, to fetch the NEXT page (alias - after). On listContacts and listSegmentContacts, use before with a prev_cursor to page backward; other list endpoints are forward-only.
Minor version to run the request under (date-based). Older dates remain supported for at least 24 months. If omitted, the account's default pinned version is used.
2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$Target customer account, as acc_<24-hex> or a bare 24-hex ID. Only for Gleantap staff (CSM) tokens, which authenticate against the internal staff directory and are bound to no account; for a normal customer token the account is fixed by the token and this header is ignored.
A staff token MUST name an account on every request β there is no default, and omitting it returns 400 admin_account_required rather than falling back to some first account. Switching accounts is just a different value here; no re-authorization. Account names are rejected (400 admin_account_invalid) because they are neither unique nor stable β list IDs with GET /v3/accounts.
Every impersonated response carries an impersonation block naming the account actually acted on, so an account switch mid-session is always visible. Also settable via ?account=.
acc_59fca1e3d2a57d28a10b0442Which workroom to act in. Accepts a workroom name (case-insensitive), a prefixed ID (wrm_<hex>), a raw 24-hex ID, or the literal all.
On any write, ask the user which workroom β do not omit this. Optional here means the server has a fallback, not that the fallback is what anyone wanted: an omitted workroom sends the write to the account's default workroom, and accounts routinely have dozens. Creating a contact, flow, campaign or segment in the wrong workroom puts it where nobody is looking, and moving it afterwards is manual.
The one case where you need not ask: the account has exactly one workroom. Call listWorkrooms to find out β if it returns a single row, use it; if it returns several, ask which one before writing.
Reads are scoped too. Omitting a workroom on a read does not span the account β it narrows to the same default workroom a write would go to, and the response carries a workroom_defaulted warning saying so. So a count, a list or a segment preview describes one workroom unless you said otherwise. Pass all to deliberately span every workroom; that is the only way to get account-wide figures, and it is never the default. listWorkrooms itself is never narrowed, since it is how you discover what to ask for.
Also settable via ?workroom= or a workroom body field (POST/PATCH only) β query wins over header wins over body.
G Test1A page of folders.
True if additional records exist beyond this page.
Opaque cursor for the next page. Null on the last page.
Cursor for the previous page. Supported on listContacts and listSegmentContacts: pass it back as ?before=... to page backward; null on the first page. On every other list endpoint paging is forward-only and this is always null.
GET /v3/segments/folders HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
A page of folders.
{
"object": "text",
"data": [
{
"object": "text",
"id": "sfd_66b3a91d0e5b7c1a4d8e2f1a",
"workroom_id": "wrm_5ace370fd2a57d74d0548fb2",
"name": "text",
"segment_count": 1,
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z"
}
],
"has_more": true,
"next_cursor": "text",
"prev_cursor": "text"
}Names must be unique within a workroom; conflicts return 409.
Requires the folder name. Optional fields fall back to a server-side default when omitted. That includes the workroom: an omitted workroom resolves to the account default, and a record created in the wrong workroom is invisible where it was expected. Half-specified records are created successfully and then have to be hunted down and fixed by hand.
The API Secret from the Gleantap dashboard under Settings β API (Generate New Key if none exists). Send it bare (40 hex characters) or prefixed as gltp_sk_live_<40-hex>. There is no sandbox: every key acts on the live account.
Keys are account-scoped and carry all permissions on that account (no per-key scope selection). Cross-workroom reads are unrestricted by default β narrow with ?workroom= / Gleantap-Workroom on each request. Revoke via the dashboard.
For per-user consent, per-workroom scoping, and short-lived tokens, use OAuth 2.1 instead.
Same semantics as the Gleantap-Workroom header, including that a write should never be sent without a workroom the user actually chose, and that an omitted workroom scopes a read to the account default rather than spanning the account. Prefer this on GETs so proxies and caches can key on it. Accepts name, prefixed ID, raw hex, or all.
Minor version to run the request under (date-based). Older dates remain supported for at least 24 months. If omitted, the account's default pinned version is used.
2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$Target customer account, as acc_<24-hex> or a bare 24-hex ID. Only for Gleantap staff (CSM) tokens, which authenticate against the internal staff directory and are bound to no account; for a normal customer token the account is fixed by the token and this header is ignored.
A staff token MUST name an account on every request β there is no default, and omitting it returns 400 admin_account_required rather than falling back to some first account. Switching accounts is just a different value here; no re-authorization. Account names are rejected (400 admin_account_invalid) because they are neither unique nor stable β list IDs with GET /v3/accounts.
Every impersonated response carries an impersonation block naming the account actually acted on, so an account switch mid-session is always visible. Also settable via ?account=.
acc_59fca1e3d2a57d28a10b0442Which workroom to act in. Accepts a workroom name (case-insensitive), a prefixed ID (wrm_<hex>), a raw 24-hex ID, or the literal all.
On any write, ask the user which workroom β do not omit this. Optional here means the server has a fallback, not that the fallback is what anyone wanted: an omitted workroom sends the write to the account's default workroom, and accounts routinely have dozens. Creating a contact, flow, campaign or segment in the wrong workroom puts it where nobody is looking, and moving it afterwards is manual.
The one case where you need not ask: the account has exactly one workroom. Call listWorkrooms to find out β if it returns a single row, use it; if it returns several, ask which one before writing.
Reads are scoped too. Omitting a workroom on a read does not span the account β it narrows to the same default workroom a write would go to, and the response carries a workroom_defaulted warning saying so. So a count, a list or a segment preview describes one workroom unless you said otherwise. Pass all to deliberately span every workroom; that is the only way to get account-wide figures, and it is never the default. listWorkrooms itself is never narrowed, since it is how you discover what to ask for.
Also settable via ?workroom= or a workroom body field (POST/PATCH only) β query wins over header wins over body.
G Test1wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$Folder created.
Segment folder ID.
sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$Name conflict.
POST /v3/segments/folders HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 60
{
"name": "text",
"workroom_id": "wrm_5ace370fd2a57d74d0548fb2"
}{
"object": "text",
"id": "sfd_66b3a91d0e5b7c1a4d8e2f1a",
"workroom_id": "wrm_5ace370fd2a57d74d0548fb2",
"name": "text",
"segment_count": 1,
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z"
}The API Secret from the Gleantap dashboard under Settings β API (Generate New Key if none exists). Send it bare (40 hex characters) or prefixed as gltp_sk_live_<40-hex>. There is no sandbox: every key acts on the live account.
Keys are account-scoped and carry all permissions on that account (no per-key scope selection). Cross-workroom reads are unrestricted by default β narrow with ?workroom= / Gleantap-Workroom on each request. Revoke via the dashboard.
For per-user consent, per-workroom scoping, and short-lived tokens, use OAuth 2.1 instead.
Segment folder ID.
sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$Same semantics as the Gleantap-Workroom header, including that a write should never be sent without a workroom the user actually chose, and that an omitted workroom scopes a read to the account default rather than spanning the account. Prefer this on GETs so proxies and caches can key on it. Accepts name, prefixed ID, raw hex, or all.
Minor version to run the request under (date-based). Older dates remain supported for at least 24 months. If omitted, the account's default pinned version is used.
2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$Target customer account, as acc_<24-hex> or a bare 24-hex ID. Only for Gleantap staff (CSM) tokens, which authenticate against the internal staff directory and are bound to no account; for a normal customer token the account is fixed by the token and this header is ignored.
A staff token MUST name an account on every request β there is no default, and omitting it returns 400 admin_account_required rather than falling back to some first account. Switching accounts is just a different value here; no re-authorization. Account names are rejected (400 admin_account_invalid) because they are neither unique nor stable β list IDs with GET /v3/accounts.
Every impersonated response carries an impersonation block naming the account actually acted on, so an account switch mid-session is always visible. Also settable via ?account=.
acc_59fca1e3d2a57d28a10b0442Which workroom to act in. Accepts a workroom name (case-insensitive), a prefixed ID (wrm_<hex>), a raw 24-hex ID, or the literal all.
On any write, ask the user which workroom β do not omit this. Optional here means the server has a fallback, not that the fallback is what anyone wanted: an omitted workroom sends the write to the account's default workroom, and accounts routinely have dozens. Creating a contact, flow, campaign or segment in the wrong workroom puts it where nobody is looking, and moving it afterwards is manual.
The one case where you need not ask: the account has exactly one workroom. Call listWorkrooms to find out β if it returns a single row, use it; if it returns several, ask which one before writing.
Reads are scoped too. Omitting a workroom on a read does not span the account β it narrows to the same default workroom a write would go to, and the response carries a workroom_defaulted warning saying so. So a count, a list or a segment preview describes one workroom unless you said otherwise. Pass all to deliberately span every workroom; that is the only way to get account-wide figures, and it is never the default. listWorkrooms itself is never narrowed, since it is how you discover what to ask for.
Also settable via ?workroom= or a workroom body field (POST/PATCH only) β query wins over header wins over body.
G Test1Folder.
Segment folder ID.
sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$The resource doesn't exist or isn't visible to this caller.
GET /v3/segments/folders/{id} HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"object": "text",
"id": "sfd_66b3a91d0e5b7c1a4d8e2f1a",
"workroom_id": "wrm_5ace370fd2a57d74d0548fb2",
"name": "text",
"segment_count": 1,
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z"
}The API Secret from the Gleantap dashboard under Settings β API (Generate New Key if none exists). Send it bare (40 hex characters) or prefixed as gltp_sk_live_<40-hex>. There is no sandbox: every key acts on the live account.
Keys are account-scoped and carry all permissions on that account (no per-key scope selection). Cross-workroom reads are unrestricted by default β narrow with ?workroom= / Gleantap-Workroom on each request. Revoke via the dashboard.
For per-user consent, per-workroom scoping, and short-lived tokens, use OAuth 2.1 instead.
Segment folder ID.
sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$Same semantics as the Gleantap-Workroom header, including that a write should never be sent without a workroom the user actually chose, and that an omitted workroom scopes a read to the account default rather than spanning the account. Prefer this on GETs so proxies and caches can key on it. Accepts name, prefixed ID, raw hex, or all.
Minor version to run the request under (date-based). Older dates remain supported for at least 24 months. If omitted, the account's default pinned version is used.
2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$Target customer account, as acc_<24-hex> or a bare 24-hex ID. Only for Gleantap staff (CSM) tokens, which authenticate against the internal staff directory and are bound to no account; for a normal customer token the account is fixed by the token and this header is ignored.
A staff token MUST name an account on every request β there is no default, and omitting it returns 400 admin_account_required rather than falling back to some first account. Switching accounts is just a different value here; no re-authorization. Account names are rejected (400 admin_account_invalid) because they are neither unique nor stable β list IDs with GET /v3/accounts.
Every impersonated response carries an impersonation block naming the account actually acted on, so an account switch mid-session is always visible. Also settable via ?account=.
acc_59fca1e3d2a57d28a10b0442Which workroom to act in. Accepts a workroom name (case-insensitive), a prefixed ID (wrm_<hex>), a raw 24-hex ID, or the literal all.
On any write, ask the user which workroom β do not omit this. Optional here means the server has a fallback, not that the fallback is what anyone wanted: an omitted workroom sends the write to the account's default workroom, and accounts routinely have dozens. Creating a contact, flow, campaign or segment in the wrong workroom puts it where nobody is looking, and moving it afterwards is manual.
The one case where you need not ask: the account has exactly one workroom. Call listWorkrooms to find out β if it returns a single row, use it; if it returns several, ask which one before writing.
Reads are scoped too. Omitting a workroom on a read does not span the account β it narrows to the same default workroom a write would go to, and the response carries a workroom_defaulted warning saying so. So a count, a list or a segment preview describes one workroom unless you said otherwise. Pass all to deliberately span every workroom; that is the only way to get account-wide figures, and it is never the default. listWorkrooms itself is never narrowed, since it is how you discover what to ask for.
Also settable via ?workroom= or a workroom body field (POST/PATCH only) β query wins over header wins over body.
G Test1Updated folder.
Segment folder ID.
sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$The resource doesn't exist or isn't visible to this caller.
Name conflict.
PATCH /v3/segments/folders/{id} HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 15
{
"name": "text"
}{
"object": "text",
"id": "sfd_66b3a91d0e5b7c1a4d8e2f1a",
"workroom_id": "wrm_5ace370fd2a57d74d0548fb2",
"name": "text",
"segment_count": 1,
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z"
}Segments in the folder become unfoldered (they are not deleted).
Permanent. There is no undo and no trash to restore from. Anything that references the deleted record is affected too.
The API Secret from the Gleantap dashboard under Settings β API (Generate New Key if none exists). Send it bare (40 hex characters) or prefixed as gltp_sk_live_<40-hex>. There is no sandbox: every key acts on the live account.
Keys are account-scoped and carry all permissions on that account (no per-key scope selection). Cross-workroom reads are unrestricted by default β narrow with ?workroom= / Gleantap-Workroom on each request. Revoke via the dashboard.
For per-user consent, per-workroom scoping, and short-lived tokens, use OAuth 2.1 instead.
Segment folder ID.
sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$Same semantics as the Gleantap-Workroom header, including that a write should never be sent without a workroom the user actually chose, and that an omitted workroom scopes a read to the account default rather than spanning the account. Prefer this on GETs so proxies and caches can key on it. Accepts name, prefixed ID, raw hex, or all.
Minor version to run the request under (date-based). Older dates remain supported for at least 24 months. If omitted, the account's default pinned version is used.
2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$Target customer account, as acc_<24-hex> or a bare 24-hex ID. Only for Gleantap staff (CSM) tokens, which authenticate against the internal staff directory and are bound to no account; for a normal customer token the account is fixed by the token and this header is ignored.
A staff token MUST name an account on every request β there is no default, and omitting it returns 400 admin_account_required rather than falling back to some first account. Switching accounts is just a different value here; no re-authorization. Account names are rejected (400 admin_account_invalid) because they are neither unique nor stable β list IDs with GET /v3/accounts.
Every impersonated response carries an impersonation block naming the account actually acted on, so an account switch mid-session is always visible. Also settable via ?account=.
acc_59fca1e3d2a57d28a10b0442Which workroom to act in. Accepts a workroom name (case-insensitive), a prefixed ID (wrm_<hex>), a raw 24-hex ID, or the literal all.
On any write, ask the user which workroom β do not omit this. Optional here means the server has a fallback, not that the fallback is what anyone wanted: an omitted workroom sends the write to the account's default workroom, and accounts routinely have dozens. Creating a contact, flow, campaign or segment in the wrong workroom puts it where nobody is looking, and moving it afterwards is manual.
The one case where you need not ask: the account has exactly one workroom. Call listWorkrooms to find out β if it returns a single row, use it; if it returns several, ask which one before writing.
Reads are scoped too. Omitting a workroom on a read does not span the account β it narrows to the same default workroom a write would go to, and the response carries a workroom_defaulted warning saying so. So a count, a list or a segment preview describes one workroom unless you said otherwise. Pass all to deliberately span every workroom; that is the only way to get account-wide figures, and it is never the default. listWorkrooms itself is never narrowed, since it is how you discover what to ask for.
Also settable via ?workroom= or a workroom body field (POST/PATCH only) β query wins over header wins over body.
G Test1Deleted.
No content
The resource doesn't exist or isn't visible to this caller.
DELETE /v3/segments/folders/{id} HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
No content
The API Secret from the Gleantap dashboard under Settings β API (Generate New Key if none exists). Send it bare (40 hex characters) or prefixed as gltp_sk_live_<40-hex>. There is no sandbox: every key acts on the live account.
Keys are account-scoped and carry all permissions on that account (no per-key scope selection). Cross-workroom reads are unrestricted by default β narrow with ?workroom= / Gleantap-Workroom on each request. Revoke via the dashboard.
For per-user consent, per-workroom scoping, and short-lived tokens, use OAuth 2.1 instead.
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$Same semantics as the Gleantap-Workroom header, including that a write should never be sent without a workroom the user actually chose, and that an omitted workroom scopes a read to the account default rather than spanning the account. Prefer this on GETs so proxies and caches can key on it. Accepts name, prefixed ID, raw hex, or all.
Minor version to run the request under (date-based). Older dates remain supported for at least 24 months. If omitted, the account's default pinned version is used.
2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$Target customer account, as acc_<24-hex> or a bare 24-hex ID. Only for Gleantap staff (CSM) tokens, which authenticate against the internal staff directory and are bound to no account; for a normal customer token the account is fixed by the token and this header is ignored.
A staff token MUST name an account on every request β there is no default, and omitting it returns 400 admin_account_required rather than falling back to some first account. Switching accounts is just a different value here; no re-authorization. Account names are rejected (400 admin_account_invalid) because they are neither unique nor stable β list IDs with GET /v3/accounts.
Every impersonated response carries an impersonation block naming the account actually acted on, so an account switch mid-session is always visible. Also settable via ?account=.
acc_59fca1e3d2a57d28a10b0442Which workroom to act in. Accepts a workroom name (case-insensitive), a prefixed ID (wrm_<hex>), a raw 24-hex ID, or the literal all.
On any write, ask the user which workroom β do not omit this. Optional here means the server has a fallback, not that the fallback is what anyone wanted: an omitted workroom sends the write to the account's default workroom, and accounts routinely have dozens. Creating a contact, flow, campaign or segment in the wrong workroom puts it where nobody is looking, and moving it afterwards is manual.
The one case where you need not ask: the account has exactly one workroom. Call listWorkrooms to find out β if it returns a single row, use it; if it returns several, ask which one before writing.
Reads are scoped too. Omitting a workroom on a read does not span the account β it narrows to the same default workroom a write would go to, and the response carries a workroom_defaulted warning saying so. So a count, a list or a segment preview describes one workroom unless you said otherwise. Pass all to deliberately span every workroom; that is the only way to get account-wide figures, and it is never the default. listWorkrooms itself is never narrowed, since it is how you discover what to ask for.
Also settable via ?workroom= or a workroom body field (POST/PATCH only) β query wins over header wins over body.
G Test1Sharing config.
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$A staff user (from the legacy users collection). Used for owner_id, responsible_id, created_by, assigned_to, etc.
The resource doesn't exist or isn't visible to this caller.
GET /v3/segments/{id}/sharing HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"object": "text",
"segment_id": "seg_01H8XKE...",
"allowed_roles": {
"ANY_ADDITIONAL_PROPERTY": true
},
"other_allowed_user_ids": [
"text"
],
"role_updated_on": "2026-01-01T00:00:00.000Z"
}Full-replace (matches the dashboard's checkbox POST β unchecked boxes just don't appear). Accepted role keys: me, Admin, WorkroomAdmin, Marketing, Sales, Analyst, Other. When Other is true, other_allowed_user_ids[] must contain at least one valid staff ID or 400 is returned.
The API Secret from the Gleantap dashboard under Settings β API (Generate New Key if none exists). Send it bare (40 hex characters) or prefixed as gltp_sk_live_<40-hex>. There is no sandbox: every key acts on the live account.
Keys are account-scoped and carry all permissions on that account (no per-key scope selection). Cross-workroom reads are unrestricted by default β narrow with ?workroom= / Gleantap-Workroom on each request. Revoke via the dashboard.
For per-user consent, per-workroom scoping, and short-lived tokens, use OAuth 2.1 instead.
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$Same semantics as the Gleantap-Workroom header, including that a write should never be sent without a workroom the user actually chose, and that an omitted workroom scopes a read to the account default rather than spanning the account. Prefer this on GETs so proxies and caches can key on it. Accepts name, prefixed ID, raw hex, or all.
Minor version to run the request under (date-based). Older dates remain supported for at least 24 months. If omitted, the account's default pinned version is used.
2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$Target customer account, as acc_<24-hex> or a bare 24-hex ID. Only for Gleantap staff (CSM) tokens, which authenticate against the internal staff directory and are bound to no account; for a normal customer token the account is fixed by the token and this header is ignored.
A staff token MUST name an account on every request β there is no default, and omitting it returns 400 admin_account_required rather than falling back to some first account. Switching accounts is just a different value here; no re-authorization. Account names are rejected (400 admin_account_invalid) because they are neither unique nor stable β list IDs with GET /v3/accounts.
Every impersonated response carries an impersonation block naming the account actually acted on, so an account switch mid-session is always visible. Also settable via ?account=.
acc_59fca1e3d2a57d28a10b0442Which workroom to act in. Accepts a workroom name (case-insensitive), a prefixed ID (wrm_<hex>), a raw 24-hex ID, or the literal all.
On any write, ask the user which workroom β do not omit this. Optional here means the server has a fallback, not that the fallback is what anyone wanted: an omitted workroom sends the write to the account's default workroom, and accounts routinely have dozens. Creating a contact, flow, campaign or segment in the wrong workroom puts it where nobody is looking, and moving it afterwards is manual.
The one case where you need not ask: the account has exactly one workroom. Call listWorkrooms to find out β if it returns a single row, use it; if it returns several, ask which one before writing.
Reads are scoped too. Omitting a workroom on a read does not span the account β it narrows to the same default workroom a write would go to, and the response carries a workroom_defaulted warning saying so. So a count, a list or a segment preview describes one workroom unless you said otherwise. Pass all to deliberately span every workroom; that is the only way to get account-wide figures, and it is never the default. listWorkrooms itself is never narrowed, since it is how you discover what to ask for.
Also settable via ?workroom= or a workroom body field (POST/PATCH only) β query wins over header wins over body.
G Test1Required (non-empty) when allowed_roles.Other is true; otherwise ignored.
Updated sharing config.
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$A staff user (from the legacy users collection). Used for owner_id, responsible_id, created_by, assigned_to, etc.
Request could not be parsed or failed validation.
The resource doesn't exist or isn't visible to this caller.
PUT /v3/segments/{id}/sharing HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 84
{
"allowed_roles": {
"ANY_ADDITIONAL_PROPERTY": true
},
"other_allowed_user_ids": [
"text"
]
}{
"object": "text",
"segment_id": "seg_01H8XKE...",
"allowed_roles": {
"ANY_ADDITIONAL_PROPERTY": true
},
"other_allowed_user_ids": [
"text"
],
"role_updated_on": "2026-01-01T00:00:00.000Z"
}Ported from the dashboard's Audience::segmentGraphs β same aggregations against userdetails.segments1, same cache (segment_report_data) with a 4-day TTL. A cached report is reused only while the live membership count still matches the one it was computed over and the stored payload is the current shape version, so segment_size and the bucket totals always describe the same population.
Capped at 50,000 members. The cap is checked against the LIVE count, not the stored segment size, so a dynamic segment that has never been evaluated cannot slip past it; at 50,000 or more the request returns 413.
Report shapes by type:
genderβ[{gender, count}]normalized to Male, Female, Other, Unknownageβ buckets:<18, 18-24, 25-30, 31-40, 41-50, 50+, Unknownlifespanβ buckets byadd_date:< 2 mo, 2 - 6 mo, 6 - 12 mo, 12 - 24 mo, 24 mo +, plusUnknownbehaviour_analysisβ last-3-calendar-month rollup:{behaviorMonthLabel[], purchaseMonth[], checkinMonth[]}, always 3 labels with zero counts when no activity
A contact whose dob or add_date is not a parseable date is counted as Unknown rather than failing the request β one bad record does not take the report down.
The API Secret from the Gleantap dashboard under Settings β API (Generate New Key if none exists). Send it bare (40 hex characters) or prefixed as gltp_sk_live_<40-hex>. There is no sandbox: every key acts on the live account.
Keys are account-scoped and carry all permissions on that account (no per-key scope selection). Cross-workroom reads are unrestricted by default β narrow with ?workroom= / Gleantap-Workroom on each request. Revoke via the dashboard.
For per-user consent, per-workroom scoping, and short-lived tokens, use OAuth 2.1 instead.
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$Same semantics as the Gleantap-Workroom header, including that a write should never be sent without a workroom the user actually chose, and that an omitted workroom scopes a read to the account default rather than spanning the account. Prefer this on GETs so proxies and caches can key on it. Accepts name, prefixed ID, raw hex, or all.
Minor version to run the request under (date-based). Older dates remain supported for at least 24 months. If omitted, the account's default pinned version is used.
2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$Target customer account, as acc_<24-hex> or a bare 24-hex ID. Only for Gleantap staff (CSM) tokens, which authenticate against the internal staff directory and are bound to no account; for a normal customer token the account is fixed by the token and this header is ignored.
A staff token MUST name an account on every request β there is no default, and omitting it returns 400 admin_account_required rather than falling back to some first account. Switching accounts is just a different value here; no re-authorization. Account names are rejected (400 admin_account_invalid) because they are neither unique nor stable β list IDs with GET /v3/accounts.
Every impersonated response carries an impersonation block naming the account actually acted on, so an account switch mid-session is always visible. Also settable via ?account=.
acc_59fca1e3d2a57d28a10b0442Which workroom to act in. Accepts a workroom name (case-insensitive), a prefixed ID (wrm_<hex>), a raw 24-hex ID, or the literal all.
On any write, ask the user which workroom β do not omit this. Optional here means the server has a fallback, not that the fallback is what anyone wanted: an omitted workroom sends the write to the account's default workroom, and accounts routinely have dozens. Creating a contact, flow, campaign or segment in the wrong workroom puts it where nobody is looking, and moving it afterwards is manual.
The one case where you need not ask: the account has exactly one workroom. Call listWorkrooms to find out β if it returns a single row, use it; if it returns several, ask which one before writing.
Reads are scoped too. Omitting a workroom on a read does not span the account β it narrows to the same default workroom a write would go to, and the response carries a workroom_defaulted warning saying so. So a count, a list or a segment preview describes one workroom unless you said otherwise. Pass all to deliberately span every workroom; that is the only way to get account-wide figures, and it is never the default. listWorkrooms itself is never narrowed, since it is how you discover what to ask for.
Also settable via ?workroom= or a workroom body field (POST/PATCH only) β query wins over header wins over body.
G Test1Report data.
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$Membership counted at report time, over the same userdetails.segments1 population the buckets are aggregated from β so the bucket counts always sum to this value. Not the stored usersegments.size, which is only as fresh as the last refresh and is 0 for a never-evaluated dynamic segment.
Shape varies by type. For gender: [{gender, count}] normalized to Male, Female, Other, Unknown (Unknown always present; it absorbs null, empty and unrecognised values). For age: [{age, count}] (<18, 18-24, 25-30, 31-40, 41-50, 50+, Unknown β Unknown always present and holds contacts with no DOB or an unparseable one). For lifespan: [{lifespan, count}] (< 2 mo, 2 - 6 mo, 6 - 12 mo, 12 - 24 mo, 24 mo +, plus Unknown when any add_date is missing or unparseable). For behaviour_analysis: {behaviorMonthLabel[], purchaseMonth[], checkinMonth[]} for the last 3 calendar months, always with 3 labels and zero counts when there was no activity.
The resource doesn't exist or isn't visible to this caller.
Segment too large to report on (>50,000 members). Narrow the segment first.
Semantic validation failed β the request is well-formed but references an object in the wrong state (e.g., sending to an opted-out contact).
GET /v3/segments/{id}/report?type=gender HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"object": "text",
"segment_id": "seg_01H8XKE...",
"workroom_id": "wrm_5ace370fd2a57d74d0548fb2",
"type": "gender",
"segment_size": 1,
"generated_at": "2026-01-01T00:00:00.000Z",
"data": null
}The API Secret from the Gleantap dashboard under Settings β API (Generate New Key if none exists). Send it bare (40 hex characters) or prefixed as gltp_sk_live_<40-hex>. There is no sandbox: every key acts on the live account.
Keys are account-scoped and carry all permissions on that account (no per-key scope selection). Cross-workroom reads are unrestricted by default β narrow with ?workroom= / Gleantap-Workroom on each request. Revoke via the dashboard.
For per-user consent, per-workroom scoping, and short-lived tokens, use OAuth 2.1 instead.
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$Same semantics as the Gleantap-Workroom header, including that a write should never be sent without a workroom the user actually chose, and that an omitted workroom scopes a read to the account default rather than spanning the account. Prefer this on GETs so proxies and caches can key on it. Accepts name, prefixed ID, raw hex, or all.
Minor version to run the request under (date-based). Older dates remain supported for at least 24 months. If omitted, the account's default pinned version is used.
2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$Target customer account, as acc_<24-hex> or a bare 24-hex ID. Only for Gleantap staff (CSM) tokens, which authenticate against the internal staff directory and are bound to no account; for a normal customer token the account is fixed by the token and this header is ignored.
A staff token MUST name an account on every request β there is no default, and omitting it returns 400 admin_account_required rather than falling back to some first account. Switching accounts is just a different value here; no re-authorization. Account names are rejected (400 admin_account_invalid) because they are neither unique nor stable β list IDs with GET /v3/accounts.
Every impersonated response carries an impersonation block naming the account actually acted on, so an account switch mid-session is always visible. Also settable via ?account=.
acc_59fca1e3d2a57d28a10b0442Which workroom to act in. Accepts a workroom name (case-insensitive), a prefixed ID (wrm_<hex>), a raw 24-hex ID, or the literal all.
On any write, ask the user which workroom β do not omit this. Optional here means the server has a fallback, not that the fallback is what anyone wanted: an omitted workroom sends the write to the account's default workroom, and accounts routinely have dozens. Creating a contact, flow, campaign or segment in the wrong workroom puts it where nobody is looking, and moving it afterwards is manual.
The one case where you need not ask: the account has exactly one workroom. Call listWorkrooms to find out β if it returns a single row, use it; if it returns several, ask which one before writing.
Reads are scoped too. Omitting a workroom on a read does not span the account β it narrows to the same default workroom a write would go to, and the response carries a workroom_defaulted warning saying so. So a count, a list or a segment preview describes one workroom unless you said otherwise. Pass all to deliberately span every workroom; that is the only way to get account-wide figures, and it is never the default. listWorkrooms itself is never narrowed, since it is how you discover what to ask for.
Also settable via ?workroom= or a workroom body field (POST/PATCH only) β query wins over header wins over body.
G Test1FB audience sync state.
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$True iff the workroom has an FB Ad Account linked in the dashboard.
Populated once the dashboard cron creates the audience on Meta.
Last pending error from facebook_custom_audience_error, if any.
The resource doesn't exist or isn't visible to this caller.
GET /v3/segments/{id}/facebook_audience HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"object": "text",
"segment_id": "seg_01H8XKE...",
"workroom_id": "wrm_5ace370fd2a57d74d0548fb2",
"enabled": true,
"workroom_configured": true,
"ad_account_id": "text",
"custom_audience_id": "text",
"last_error": "text"
}Enable requires the workroom to have an FB Ad Account linked (setup is dashboard-only). If not linked, 422 workroom_not_configured is returned. Actual list creation + member sync runs in the dashboard's background cron once enabled.
The API Secret from the Gleantap dashboard under Settings β API (Generate New Key if none exists). Send it bare (40 hex characters) or prefixed as gltp_sk_live_<40-hex>. There is no sandbox: every key acts on the live account.
Keys are account-scoped and carry all permissions on that account (no per-key scope selection). Cross-workroom reads are unrestricted by default β narrow with ?workroom= / Gleantap-Workroom on each request. Revoke via the dashboard.
For per-user consent, per-workroom scoping, and short-lived tokens, use OAuth 2.1 instead.
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$Same semantics as the Gleantap-Workroom header, including that a write should never be sent without a workroom the user actually chose, and that an omitted workroom scopes a read to the account default rather than spanning the account. Prefer this on GETs so proxies and caches can key on it. Accepts name, prefixed ID, raw hex, or all.
Minor version to run the request under (date-based). Older dates remain supported for at least 24 months. If omitted, the account's default pinned version is used.
2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$Target customer account, as acc_<24-hex> or a bare 24-hex ID. Only for Gleantap staff (CSM) tokens, which authenticate against the internal staff directory and are bound to no account; for a normal customer token the account is fixed by the token and this header is ignored.
A staff token MUST name an account on every request β there is no default, and omitting it returns 400 admin_account_required rather than falling back to some first account. Switching accounts is just a different value here; no re-authorization. Account names are rejected (400 admin_account_invalid) because they are neither unique nor stable β list IDs with GET /v3/accounts.
Every impersonated response carries an impersonation block naming the account actually acted on, so an account switch mid-session is always visible. Also settable via ?account=.
acc_59fca1e3d2a57d28a10b0442Which workroom to act in. Accepts a workroom name (case-insensitive), a prefixed ID (wrm_<hex>), a raw 24-hex ID, or the literal all.
On any write, ask the user which workroom β do not omit this. Optional here means the server has a fallback, not that the fallback is what anyone wanted: an omitted workroom sends the write to the account's default workroom, and accounts routinely have dozens. Creating a contact, flow, campaign or segment in the wrong workroom puts it where nobody is looking, and moving it afterwards is manual.
The one case where you need not ask: the account has exactly one workroom. Call listWorkrooms to find out β if it returns a single row, use it; if it returns several, ask which one before writing.
Reads are scoped too. Omitting a workroom on a read does not span the account β it narrows to the same default workroom a write would go to, and the response carries a workroom_defaulted warning saying so. So a count, a list or a segment preview describes one workroom unless you said otherwise. Pass all to deliberately span every workroom; that is the only way to get account-wide figures, and it is never the default. listWorkrooms itself is never narrowed, since it is how you discover what to ask for.
Also settable via ?workroom= or a workroom body field (POST/PATCH only) β query wins over header wins over body.
G Test1Updated sync state.
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$True iff the workroom has an FB Ad Account linked in the dashboard.
Populated once the dashboard cron creates the audience on Meta.
Last pending error from facebook_custom_audience_error, if any.
The resource doesn't exist or isn't visible to this caller.
Semantic validation failed β the request is well-formed but references an object in the wrong state (e.g., sending to an opted-out contact).
PUT /v3/segments/{id}/facebook_audience HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 16
{
"enabled": true
}{
"object": "text",
"segment_id": "seg_01H8XKE...",
"workroom_id": "wrm_5ace370fd2a57d74d0548fb2",
"enabled": true,
"workroom_configured": true,
"ad_account_id": "text",
"custom_audience_id": "text",
"last_error": "text"
}Evaluates the segment's criteria NOW, then flips type to static and stamps last_evaluated_at. The evaluation is the same one refreshSegment and the preview run (OR groups, excludes, external events, account timezone), so the frozen list is the segment's membership at the moment of the call β not whatever the last cron pass happened to leave behind. Idempotent guard: 409 already_static if the segment is already static.
If the evaluation fails, nothing is converted β the response is 500 snapshot_evaluation_failed, the segment stays dynamic, and the detail names the failure. A static segment frozen from an unevaluated membership list would be wrong permanently, since nothing recomputes a static segment afterwards.
Irreversible. Converting to static freezes membership: the segment stops tracking its criteria and cannot be converted back.
The API Secret from the Gleantap dashboard under Settings β API (Generate New Key if none exists). Send it bare (40 hex characters) or prefixed as gltp_sk_live_<40-hex>. There is no sandbox: every key acts on the live account.
Keys are account-scoped and carry all permissions on that account (no per-key scope selection). Cross-workroom reads are unrestricted by default β narrow with ?workroom= / Gleantap-Workroom on each request. Revoke via the dashboard.
For per-user consent, per-workroom scoping, and short-lived tokens, use OAuth 2.1 instead.
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$Same semantics as the Gleantap-Workroom header, including that a write should never be sent without a workroom the user actually chose, and that an omitted workroom scopes a read to the account default rather than spanning the account. Prefer this on GETs so proxies and caches can key on it. Accepts name, prefixed ID, raw hex, or all.
Minor version to run the request under (date-based). Older dates remain supported for at least 24 months. If omitted, the account's default pinned version is used.
2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$Target customer account, as acc_<24-hex> or a bare 24-hex ID. Only for Gleantap staff (CSM) tokens, which authenticate against the internal staff directory and are bound to no account; for a normal customer token the account is fixed by the token and this header is ignored.
A staff token MUST name an account on every request β there is no default, and omitting it returns 400 admin_account_required rather than falling back to some first account. Switching accounts is just a different value here; no re-authorization. Account names are rejected (400 admin_account_invalid) because they are neither unique nor stable β list IDs with GET /v3/accounts.
Every impersonated response carries an impersonation block naming the account actually acted on, so an account switch mid-session is always visible. Also settable via ?account=.
acc_59fca1e3d2a57d28a10b0442Which workroom to act in. Accepts a workroom name (case-insensitive), a prefixed ID (wrm_<hex>), a raw 24-hex ID, or the literal all.
On any write, ask the user which workroom β do not omit this. Optional here means the server has a fallback, not that the fallback is what anyone wanted: an omitted workroom sends the write to the account's default workroom, and accounts routinely have dozens. Creating a contact, flow, campaign or segment in the wrong workroom puts it where nobody is looking, and moving it afterwards is manual.
The one case where you need not ask: the account has exactly one workroom. Call listWorkrooms to find out β if it returns a single row, use it; if it returns several, ask which one before writing.
Reads are scoped too. Omitting a workroom on a read does not span the account β it narrows to the same default workroom a write would go to, and the response carries a workroom_defaulted warning saying so. So a count, a list or a segment preview describes one workroom unless you said otherwise. Pass all to deliberately span every workroom; that is the only way to get account-wide figures, and it is never the default. listWorkrooms itself is never narrowed, since it is how you discover what to ask for.
Also settable via ?workroom= or a workroom body field (POST/PATCH only) β query wins over header wins over body.
G Test1Converted segment (now static), with the membership frozen from a fresh evaluation.
A named collection of contacts. Either static (hand-managed list) or dynamic (query-defined). Discriminated by the type field, which is immutable after creation.
seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$The workroom that owns this segment. A flow can only be triggered by segments in its own workroom β compare against Flow.workroom_id.
wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$static β hand-managed member list. Contacts are added/removed explicitly.
dynamic β query-defined membership. Auto-evaluated; membership changes as contact data changes.
Immutable after creation.
Current member count. Eventually consistent β up to minutes of lag on dynamic segments.
Members with a non-empty, non-invalid email.
Members with a non-empty, non-invalid phone.
When this dynamic segment was last recomputed. Null on static.
2026-05-27T14:23:11.482ZThe segment folder this segment currently belongs to, or null if unfoldered.
sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$AI-generated narrative summary of the segment's criteria. Populated on demand via POST /v3/segments/{id}/summary.
RFC 3339 timestamp, always UTC, millisecond precision.
2026-05-27T14:23:11.482ZRFC 3339 timestamp, always UTC, millisecond precision.
2026-05-27T14:23:11.482ZThe resource doesn't exist or isn't visible to this caller.
Segment is already static (already_static).
snapshot_evaluation_failed β membership could not be evaluated; the segment is unchanged and still dynamic.
POST /v3/segments/{id}/convert_to_static HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"id": "seg_01H8XKE...",
"object": "segment",
"type": "dynamic",
"name": "Active VIPs in Mumbai",
"description": "VIP-tagged members who checked in or purchased recently",
"query": {
"segment_users": [
{
"segment": "Tags",
"operator": "Contains",
"value": [
"vip"
]
},
{
"segment": "City",
"operator": "=",
"value": [
"Mumbai"
]
}
]
},
"size": 1247,
"email_count": 1188,
"phone_count": 1201,
"last_evaluated_at": "2026-05-27T14:00:00Z",
"created_at": "2026-04-01T09:00:00Z",
"updated_at": "2026-05-27T14:00:00Z"
}