For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

List segments.

get

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.

Authorizations
AuthorizationstringRequired

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.

Query parameters
workroomstringOptional

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.

limitinteger Β· min: 1 Β· max: 100Optional

Page size. Default 25, max 100.

Default: 25
cursorstringOptional

Opaque 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.

sortstringOptional

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.

Example: -created_at,email
fieldsstringOptional

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.

Example: id,email,phone,tags
Header parameters
Gleantap-VersionstringOptional

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.

Example: 2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$
Gleantap-AccountstringOptional

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=.

Example: acc_59fca1e3d2a57d28a10b0442
Gleantap-WorkroomstringOptional

Which 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.

Example: G Test1
Responses
200

A page of segments.

application/json
objectconst: listRequired
has_morebooleanRequired

True if additional records exist beyond this page.

next_cursorstring Β· nullableRequired

Opaque cursor for the next page. Null on the last page.

prev_cursorstring Β· nullableRequired

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/segments
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"
}

Create a segment (static or dynamic).

post

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.

Authorizations
AuthorizationstringRequired

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.

Query parameters
workroomstringOptional

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.

Header parameters
Gleantap-VersionstringOptional

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.

Example: 2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$
Gleantap-AccountstringOptional

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=.

Example: acc_59fca1e3d2a57d28a10b0442
Gleantap-WorkroomstringOptional

Which 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.

Example: G Test1
Idempotency-Keystring Β· max: 255Optional

A 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.

Example: 8e3c7a90-7c4d-4f8e-8e3c-7a907c4d4f8e
Body

Create 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 read query.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 as contact_ids, or the criteria is lost and the dashboard shows no filter.
  • Or pass an explicit contact_ids list 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.

typestring Β· enumRequired

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.

Possible values:
namestring Β· max: 200Required
descriptionstring Β· max: 2000Optional
contact_idsstring[] Β· max: 10000Optional

Optional explicit initial member list. Static segments only. Prefer query instead when the segment represents "everyone matching X" β€” see the schema description.

folder_idstringOptional

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.

Example: sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$
Responses
201

Segment created.

application/json

A named collection of contacts. Either static (hand-managed list) or dynamic (query-defined). Discriminated by the type field, which is immutable after creation.

idstringRequiredExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
objectconst: segmentRequired
workroom_idstring Β· nullableOptional

The workroom that owns this segment. A flow can only be triggered by segments in its own workroom β€” compare against Flow.workroom_id.

Example: wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$
typestring Β· enumRequired

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.

Possible values:
namestring Β· max: 200Required
descriptionstring Β· max: 2000 Β· nullableOptional
sizeintegerRequired

Current member count. Eventually consistent β€” up to minutes of lag on dynamic segments.

email_countintegerOptional

Members with a non-empty, non-invalid email.

phone_countintegerOptional

Members with a non-empty, non-invalid phone.

last_evaluated_atstring Β· date-time Β· nullableOptional

When this dynamic segment was last recomputed. Null on static.

Example: 2026-05-27T14:23:11.482Z
folder_idstring Β· nullableOptional

The segment folder this segment currently belongs to, or null if unfoldered.

Example: sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$
segment_summarystring Β· nullableOptional

AI-generated narrative summary of the segment's criteria. Populated on demand via POST /v3/segments/{id}/summary.

created_atstring Β· date-timeRequired

RFC 3339 timestamp, always UTC, millisecond precision.

Example: 2026-05-27T14:23:11.482Z
updated_atstring Β· date-timeRequired

RFC 3339 timestamp, always UTC, millisecond precision.

Example: 2026-05-27T14:23:11.482Z
post/segments
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"
}

Retrieve a segment.

get

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.

Authorizations
AuthorizationstringRequired

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.

Path parameters
idstringRequiredExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
Query parameters
workroomstringOptional

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.

fieldsstringOptional

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.

Example: id,email,phone,tags
Header parameters
Gleantap-VersionstringOptional

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.

Example: 2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$
Gleantap-AccountstringOptional

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=.

Example: acc_59fca1e3d2a57d28a10b0442
Gleantap-WorkroomstringOptional

Which 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.

Example: G Test1
Responses
200

The segment.

application/json

A named collection of contacts. Either static (hand-managed list) or dynamic (query-defined). Discriminated by the type field, which is immutable after creation.

idstringRequiredExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
objectconst: segmentRequired
workroom_idstring Β· nullableOptional

The workroom that owns this segment. A flow can only be triggered by segments in its own workroom β€” compare against Flow.workroom_id.

Example: wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$
typestring Β· enumRequired

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.

Possible values:
namestring Β· max: 200Required
descriptionstring Β· max: 2000 Β· nullableOptional
sizeintegerRequired

Current member count. Eventually consistent β€” up to minutes of lag on dynamic segments.

email_countintegerOptional

Members with a non-empty, non-invalid email.

phone_countintegerOptional

Members with a non-empty, non-invalid phone.

last_evaluated_atstring Β· date-time Β· nullableOptional

When this dynamic segment was last recomputed. Null on static.

Example: 2026-05-27T14:23:11.482Z
folder_idstring Β· nullableOptional

The segment folder this segment currently belongs to, or null if unfoldered.

Example: sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$
segment_summarystring Β· nullableOptional

AI-generated narrative summary of the segment's criteria. Populated on demand via POST /v3/segments/{id}/summary.

created_atstring Β· date-timeRequired

RFC 3339 timestamp, always UTC, millisecond precision.

Example: 2026-05-27T14:23:11.482Z
updated_atstring Β· date-timeRequired

RFC 3339 timestamp, always UTC, millisecond precision.

Example: 2026-05-27T14:23:11.482Z
get/segments/{id}
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 a segment.

patch

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.

Authorizations
AuthorizationstringRequired

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.

Path parameters
idstringRequiredExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
Query parameters
workroomstringOptional

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.

Header parameters
Gleantap-VersionstringOptional

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.

Example: 2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$
Gleantap-AccountstringOptional

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=.

Example: acc_59fca1e3d2a57d28a10b0442
Gleantap-WorkroomstringOptional

Which 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.

Example: G Test1
Body

Partial 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.

namestring Β· max: 200Optional
descriptionstring Β· max: 2000 Β· nullableOptional
folder_idstring Β· nullableOptional

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.

Example: sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$
Responses
200

Updated.

application/json

A named collection of contacts. Either static (hand-managed list) or dynamic (query-defined). Discriminated by the type field, which is immutable after creation.

idstringRequiredExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
objectconst: segmentRequired
workroom_idstring Β· nullableOptional

The workroom that owns this segment. A flow can only be triggered by segments in its own workroom β€” compare against Flow.workroom_id.

Example: wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$
typestring Β· enumRequired

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.

Possible values:
namestring Β· max: 200Required
descriptionstring Β· max: 2000 Β· nullableOptional
sizeintegerRequired

Current member count. Eventually consistent β€” up to minutes of lag on dynamic segments.

email_countintegerOptional

Members with a non-empty, non-invalid email.

phone_countintegerOptional

Members with a non-empty, non-invalid phone.

last_evaluated_atstring Β· date-time Β· nullableOptional

When this dynamic segment was last recomputed. Null on static.

Example: 2026-05-27T14:23:11.482Z
folder_idstring Β· nullableOptional

The segment folder this segment currently belongs to, or null if unfoldered.

Example: sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$
segment_summarystring Β· nullableOptional

AI-generated narrative summary of the segment's criteria. Populated on demand via POST /v3/segments/{id}/summary.

created_atstring Β· date-timeRequired

RFC 3339 timestamp, always UTC, millisecond precision.

Example: 2026-05-27T14:23:11.482Z
updated_atstring Β· date-timeRequired

RFC 3339 timestamp, always UTC, millisecond precision.

Example: 2026-05-27T14:23:11.482Z
patch/segments/{id}
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 a segment.

delete

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.

Authorizations
AuthorizationstringRequired

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.

Path parameters
idstringRequiredExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
Query parameters
workroomstringOptional

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.

forcebooleanOptional

If true, cascade-remove references from active flows/campaigns. Admin-only.

Default: false
Header parameters
Gleantap-VersionstringOptional

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.

Example: 2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$
Gleantap-AccountstringOptional

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=.

Example: acc_59fca1e3d2a57d28a10b0442
Gleantap-WorkroomstringOptional

Which 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.

Example: G Test1
Responses
204

Deleted.

No content

delete/segments/{id}
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.

get

⚠️ 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.

Authorizations
AuthorizationstringRequired

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.

Path parameters
idstringRequiredExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
Query parameters
workroomstringOptional

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.

limitinteger Β· min: 1 Β· max: 100Optional

Page size. Default 25, max 100.

Default: 25
cursorstringOptional

Opaque 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.

beforestringOptional

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.

exportbooleanOptional

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).

fieldsstringOptional

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.

Header parameters
Gleantap-VersionstringOptional

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.

Example: 2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$
Gleantap-AccountstringOptional

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=.

Example: acc_59fca1e3d2a57d28a10b0442
Gleantap-WorkroomstringOptional

Which 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.

Example: G Test1
Responses
200

A page of contacts.

application/json
objectconst: listRequired
has_morebooleanRequired

True if additional records exist beyond this page.

next_cursorstring Β· nullableRequired

Opaque cursor for the next page. Null on the last page.

prev_cursorstring Β· nullableRequired

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/segments/{id}/contacts
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"
}

Add contact(s) to a static segment.

post

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.

Authorizations
AuthorizationstringRequired

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.

Path parameters
idstringRequiredExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
Query parameters
workroomstringOptional

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.

Header parameters
Gleantap-VersionstringOptional

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.

Example: 2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$
Gleantap-AccountstringOptional

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=.

Example: acc_59fca1e3d2a57d28a10b0442
Gleantap-WorkroomstringOptional

Which 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.

Example: G Test1
Idempotency-Keystring Β· max: 255Optional

A 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.

Example: 8e3c7a90-7c4d-4f8e-8e3c-7a907c4d4f8e
Body

Add contact(s) to a static segment. Duplicates are silently deduped.

contact_idsstring[] Β· min: 1 Β· max: 1000Required

A contact ID. Accepts either the native prefixed id (con_<24-hex>) or an external-ID reference (external_id:<your_id>).

Responses
200

Contacts added. Returns the updated segment with new size.

application/json

A named collection of contacts. Either static (hand-managed list) or dynamic (query-defined). Discriminated by the type field, which is immutable after creation.

idstringRequiredExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
objectconst: segmentRequired
workroom_idstring Β· nullableOptional

The workroom that owns this segment. A flow can only be triggered by segments in its own workroom β€” compare against Flow.workroom_id.

Example: wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$
typestring Β· enumRequired

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.

Possible values:
namestring Β· max: 200Required
descriptionstring Β· max: 2000 Β· nullableOptional
sizeintegerRequired

Current member count. Eventually consistent β€” up to minutes of lag on dynamic segments.

email_countintegerOptional

Members with a non-empty, non-invalid email.

phone_countintegerOptional

Members with a non-empty, non-invalid phone.

last_evaluated_atstring Β· date-time Β· nullableOptional

When this dynamic segment was last recomputed. Null on static.

Example: 2026-05-27T14:23:11.482Z
folder_idstring Β· nullableOptional

The segment folder this segment currently belongs to, or null if unfoldered.

Example: sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$
segment_summarystring Β· nullableOptional

AI-generated narrative summary of the segment's criteria. Populated on demand via POST /v3/segments/{id}/summary.

created_atstring Β· date-timeRequired

RFC 3339 timestamp, always UTC, millisecond precision.

Example: 2026-05-27T14:23:11.482Z
updated_atstring Β· date-timeRequired

RFC 3339 timestamp, always UTC, millisecond precision.

Example: 2026-05-27T14:23:11.482Z
post/segments/{id}/contacts
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"
}

Remove a contact from a static segment.

delete

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.

Authorizations
AuthorizationstringRequired

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.

Path parameters
idstringRequiredExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
contact_idstringRequired

A contact ID. Accepts either the native prefixed id (con_<24-hex>) or an external-ID reference (external_id:<your_id>).

Example: con_6a7eaec3505bea795709f897Pattern: ^con_[0-9a-f]{24}$|^external_id:[^/]+$
Query parameters
workroomstringOptional

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.

Header parameters
Gleantap-VersionstringOptional

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.

Example: 2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$
Gleantap-AccountstringOptional

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=.

Example: acc_59fca1e3d2a57d28a10b0442
Gleantap-WorkroomstringOptional

Which 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.

Example: G Test1
Responses
204

Removed.

No content

delete/segments/{id}/contacts/{contact_id}
DELETE /v3/segments/{id}/contacts/{contact_id} HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*

No content

Retrieve the segment DSL catalog for this account/workroom.

get

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 segment category + data attribute names to reference in segment_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 operators are valid for a given attribute's data_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.

Authorizations
AuthorizationstringRequired

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.

Query parameters
workroomstringOptional

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.

Header parameters
Gleantap-VersionstringOptional

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.

Example: 2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$
Gleantap-AccountstringOptional

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=.

Example: acc_59fca1e3d2a57d28a10b0442
Gleantap-WorkroomstringOptional

Which 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.

Example: G Test1
Responses
200

The segment DSL schema.

application/json

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.

objectstring Β· enumOptionalPossible values:
workroom_idstring Β· nullableOptional

The workroom this schema is scoped to. null when no workroom hint was provided.

Example: wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$
shared_contacts_enabledbooleanOptional

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.

notesstring[]Optional

Human-readable guidance about how to use the schema. Include verbatim in AI prompts when constructing segments.

get/segments/schema
GET /v3/segments/schema HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

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"
        }
      ]
    }
  }
}

List the values an attribute actually holds in this workroom.

get

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 β€” values holds the real values, most common first. truncated: true means there are more than are shown.

  • high_cardinality β€” too many distinct values to enumerate, and too many to pick from. Contains or an exact Equals suit this better than Is 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.

Authorizations
AuthorizationstringRequired

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.

Query parameters
workroomstringOptional

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.

attributestringRequired

Attribute name as describeSegmentSchema reports it, e.g. membership_status or memberships.status.

Example: memberships.status
refreshbooleanOptional

Recompute instead of using the cached result. Use sparingly β€” enumeration scans contact data.

Default: false
Header parameters
Gleantap-VersionstringOptional

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.

Example: 2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$
Gleantap-AccountstringOptional

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=.

Example: acc_59fca1e3d2a57d28a10b0442
Gleantap-WorkroomstringOptional

Which 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.

Example: G Test1
Responses
200

The attribute's values, or why they could not be listed.

application/json

The values one attribute actually holds in a workroom. Always check status before reading values β€” an empty values means something different in each case.

objectstring Β· enumOptionalPossible values:
attributestringOptional

The attribute as requested.

Example: memberships.status
resolution_pathstringOptional

Where the attribute lives on the contact document. Custom attributes resolve under data..

Example: memberships.status
statusstring Β· enumOptional

enumerated β€” 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.

Possible values:
valuesstring[]Optional

Real values, most common first. Empty unless status is enumerated.

Example: ["Active","Depleted","Freeze","inactive"]
distinct_totalinteger Β· nullableOptional

How many distinct values exist. Null when the attribute was refused before counting.

truncatedbooleanOptional

Present and true when there are more values than are shown.

reasonstringOptional

Why the values could not be listed. Present for every status except enumerated.

cachedbooleanOptional

True when answered from the stored option list rather than recomputed.

computed_atstring Β· date-timeOptional
notestringOptional

Human-readable footnote, e.g. that the list was capped.

get/segments/attribute_values
GET /v3/segments/attribute_values?attribute=text HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

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"
}

Preview membership for a dynamic query without saving.

post

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).

Authorizations
AuthorizationstringRequired

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.

Query parameters
workroomstringOptional

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.

Header parameters
Gleantap-VersionstringOptional

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.

Example: 2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$
Gleantap-AccountstringOptional

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=.

Example: acc_59fca1e3d2a57d28a10b0442
Gleantap-WorkroomstringOptional

Which 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.

Example: G Test1
Body

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

include_samplebooleanOptional

If true, include sample contacts in the response. Adds latency.

Default: false
sample_limitinteger Β· min: 1 Β· max: 50Optional

Number of sample contacts when include_sample is true.

Default: 10
Responses
200

Preview result.

application/json
objectconst: segment_previewRequired
workroom_idstring Β· nullableOptional
workroom_countintegerOptional

Number of workrooms the preview was scoped to.

estimated_sizeinteger Β· nullableRequired

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.

engineconst: legacy_createWhereOptional
timezonestringOptional

The account timezone relative-date operators were evaluated in (the same one the cron uses).

warningsstring[]Optional

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:.

post/segments/preview
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"
      }
    }
  ]
}

Force recompute of a dynamic segment.

post

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.

Authorizations
AuthorizationstringRequired

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.

Path parameters
idstringRequiredExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
Query parameters
workroomstringOptional

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.

Header parameters
Gleantap-VersionstringOptional

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.

Example: 2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$
Gleantap-AccountstringOptional

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=.

Example: acc_59fca1e3d2a57d28a10b0442
Gleantap-WorkroomstringOptional

Which 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.

Example: G Test1
Responses
200

Segment recomputed. Counts are the freshly evaluated values.

application/json

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).

objectconst: segment_refreshRequired
segment_idstringRequiredExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
statusstring Β· enumRequired

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.

Possible values:
sizeintegerOptional

Member count after the evaluation. A zero size on a queued refresh means not evaluated, not empty.

email_countintegerOptional
phone_countintegerOptional
last_evaluated_atstring Β· date-time Β· nullableOptional

When membership was last computed. null means never evaluated.

Example: 2026-05-27T14:23:11.482Z
reasonstringOptional

Present only when the refresh was queued β€” why the evaluation failed.

post/segments/{id}/refresh
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"
}

List segment folders.

get

Backed by the dashboard's segment_folder collection.

Authorizations
AuthorizationstringRequired

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.

Query parameters
workroomstringOptional

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.

limitinteger Β· min: 1 Β· max: 100Optional

Page size. Default 25, max 100.

Default: 25
cursorstringOptional

Opaque 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.

Header parameters
Gleantap-VersionstringOptional

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.

Example: 2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$
Gleantap-AccountstringOptional

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=.

Example: acc_59fca1e3d2a57d28a10b0442
Gleantap-WorkroomstringOptional

Which 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.

Example: G Test1
Responses
200

A page of folders.

application/json
objectconst: listRequired
has_morebooleanRequired

True if additional records exist beyond this page.

next_cursorstring Β· nullableRequired

Opaque cursor for the next page. Null on the last page.

prev_cursorstring Β· nullableRequired

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/segments/folders
GET /v3/segments/folders HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
200

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"
}

Create a segment folder.

post

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.

Authorizations
AuthorizationstringRequired

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.

Query parameters
workroomstringOptional

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.

Header parameters
Gleantap-VersionstringOptional

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.

Example: 2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$
Gleantap-AccountstringOptional

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=.

Example: acc_59fca1e3d2a57d28a10b0442
Gleantap-WorkroomstringOptional

Which 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.

Example: G Test1
Body
namestring Β· min: 1Required
workroom_idstringOptionalExample: wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$
Responses
201

Folder created.

application/json
objectconst: segment_folderOptional
idstringOptional

Segment folder ID.

Example: sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$
workroom_idstringOptionalExample: wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$
namestringOptional
segment_countintegerOptional
created_atstring Β· date-time Β· nullableOptional
updated_atstring Β· date-time Β· nullableOptional
post/segments/folders
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"
}

Retrieve a segment folder.

get
Authorizations
AuthorizationstringRequired

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.

Path parameters
idstringRequired

Segment folder ID.

Example: sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$
Query parameters
workroomstringOptional

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.

Header parameters
Gleantap-VersionstringOptional

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.

Example: 2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$
Gleantap-AccountstringOptional

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=.

Example: acc_59fca1e3d2a57d28a10b0442
Gleantap-WorkroomstringOptional

Which 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.

Example: G Test1
Responses
200

Folder.

application/json
objectconst: segment_folderOptional
idstringOptional

Segment folder ID.

Example: sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$
workroom_idstringOptionalExample: wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$
namestringOptional
segment_countintegerOptional
created_atstring Β· date-time Β· nullableOptional
updated_atstring Β· date-time Β· nullableOptional
get/segments/folders/{id}
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"
}

Rename a segment folder.

patch
Authorizations
AuthorizationstringRequired

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.

Path parameters
idstringRequired

Segment folder ID.

Example: sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$
Query parameters
workroomstringOptional

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.

Header parameters
Gleantap-VersionstringOptional

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.

Example: 2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$
Gleantap-AccountstringOptional

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=.

Example: acc_59fca1e3d2a57d28a10b0442
Gleantap-WorkroomstringOptional

Which 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.

Example: G Test1
Body
namestring Β· min: 1Optional
Responses
200

Updated folder.

application/json
objectconst: segment_folderOptional
idstringOptional

Segment folder ID.

Example: sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$
workroom_idstringOptionalExample: wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$
namestringOptional
segment_countintegerOptional
created_atstring Β· date-time Β· nullableOptional
updated_atstring Β· date-time Β· nullableOptional
patch/segments/folders/{id}
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"
}

Delete a segment folder.

delete

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.

Authorizations
AuthorizationstringRequired

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.

Path parameters
idstringRequired

Segment folder ID.

Example: sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$
Query parameters
workroomstringOptional

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.

Header parameters
Gleantap-VersionstringOptional

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.

Example: 2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$
Gleantap-AccountstringOptional

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=.

Example: acc_59fca1e3d2a57d28a10b0442
Gleantap-WorkroomstringOptional

Which 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.

Example: G Test1
Responses
204

Deleted.

No content

delete/segments/folders/{id}
DELETE /v3/segments/folders/{id} HTTP/1.1
Host: api.gleantap.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*

No content

Read a segment's sharing configuration.

get
Authorizations
AuthorizationstringRequired

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.

Path parameters
idstringRequiredExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
Query parameters
workroomstringOptional

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.

Header parameters
Gleantap-VersionstringOptional

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.

Example: 2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$
Gleantap-AccountstringOptional

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=.

Example: acc_59fca1e3d2a57d28a10b0442
Gleantap-WorkroomstringOptional

Which 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.

Example: G Test1
Responses
200

Sharing config.

application/json
objectconst: segment_sharingOptional
segment_idstringOptionalExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
other_allowed_user_idsstring[]Optional

A staff user (from the legacy users collection). Used for owner_id, responsible_id, created_by, assigned_to, etc.

role_updated_onstring Β· date-time Β· nullableOptional
get/segments/{id}/sharing
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"
}

Replace a segment's sharing configuration.

put

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.

Authorizations
AuthorizationstringRequired

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.

Path parameters
idstringRequiredExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
Query parameters
workroomstringOptional

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.

Header parameters
Gleantap-VersionstringOptional

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.

Example: 2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$
Gleantap-AccountstringOptional

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=.

Example: acc_59fca1e3d2a57d28a10b0442
Gleantap-WorkroomstringOptional

Which 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.

Example: G Test1
Body
other_allowed_user_idsstring[]Optional

Required (non-empty) when allowed_roles.Other is true; otherwise ignored.

Responses
200

Updated sharing config.

application/json
objectconst: segment_sharingOptional
segment_idstringOptionalExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
other_allowed_user_idsstring[]Optional

A staff user (from the legacy users collection). Used for owner_id, responsible_id, created_by, assigned_to, etc.

role_updated_onstring Β· date-time Β· nullableOptional
put/segments/{id}/sharing
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"
}

Compute a demographic/behavior report for a segment.

get

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, Unknown

  • age β†’ buckets: <18, 18-24, 25-30, 31-40, 41-50, 50+, Unknown

  • lifespan β†’ buckets by add_date: < 2 mo, 2 - 6 mo, 6 - 12 mo, 12 - 24 mo, 24 mo +, plus Unknown

  • behaviour_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.

Authorizations
AuthorizationstringRequired

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.

Path parameters
idstringRequiredExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
Query parameters
workroomstringOptional

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.

typestring Β· enumRequiredPossible values:
Header parameters
Gleantap-VersionstringOptional

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.

Example: 2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$
Gleantap-AccountstringOptional

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=.

Example: acc_59fca1e3d2a57d28a10b0442
Gleantap-WorkroomstringOptional

Which 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.

Example: G Test1
Responses
200

Report data.

application/json
objectconst: segment_reportOptional
segment_idstringOptionalExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
workroom_idstringOptionalExample: wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$
typestring Β· enumOptionalPossible values:
segment_sizeintegerOptional

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.

generated_atstring Β· date-time Β· nullableOptional
dataanyOptional

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.

get/segments/{id}/report
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
}

Read Facebook Custom Audience sync status for a segment.

get
Authorizations
AuthorizationstringRequired

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.

Path parameters
idstringRequiredExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
Query parameters
workroomstringOptional

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.

Header parameters
Gleantap-VersionstringOptional

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.

Example: 2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$
Gleantap-AccountstringOptional

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=.

Example: acc_59fca1e3d2a57d28a10b0442
Gleantap-WorkroomstringOptional

Which 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.

Example: G Test1
Responses
200

FB audience sync state.

application/json
objectconst: segment_facebook_audienceOptional
segment_idstringOptionalExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
workroom_idstringOptionalExample: wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$
enabledbooleanOptional
workroom_configuredbooleanOptional

True iff the workroom has an FB Ad Account linked in the dashboard.

ad_account_idstring Β· nullableOptional
custom_audience_idstring Β· nullableOptional

Populated once the dashboard cron creates the audience on Meta.

last_errorstring Β· nullableOptional

Last pending error from facebook_custom_audience_error, if any.

get/segments/{id}/facebook_audience
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 or disable FB Custom Audience sync for a segment.

put

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.

Authorizations
AuthorizationstringRequired

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.

Path parameters
idstringRequiredExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
Query parameters
workroomstringOptional

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.

Header parameters
Gleantap-VersionstringOptional

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.

Example: 2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$
Gleantap-AccountstringOptional

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=.

Example: acc_59fca1e3d2a57d28a10b0442
Gleantap-WorkroomstringOptional

Which 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.

Example: G Test1
Body
enabledbooleanRequired
Responses
200

Updated sync state.

application/json
objectconst: segment_facebook_audienceOptional
segment_idstringOptionalExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
workroom_idstringOptionalExample: wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$
enabledbooleanOptional
workroom_configuredbooleanOptional

True iff the workroom has an FB Ad Account linked in the dashboard.

ad_account_idstring Β· nullableOptional
custom_audience_idstring Β· nullableOptional

Populated once the dashboard cron creates the audience on Meta.

last_errorstring Β· nullableOptional

Last pending error from facebook_custom_audience_error, if any.

put/segments/{id}/facebook_audience
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"
}

Freeze a dynamic segment's current membership as static.

post

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.

Authorizations
AuthorizationstringRequired

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.

Path parameters
idstringRequiredExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
Query parameters
workroomstringOptional

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.

Header parameters
Gleantap-VersionstringOptional

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.

Example: 2026-05-27Pattern: ^\d{4}-\d{2}-\d{2}$
Gleantap-AccountstringOptional

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=.

Example: acc_59fca1e3d2a57d28a10b0442
Gleantap-WorkroomstringOptional

Which 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.

Example: G Test1
Responses
200

Converted segment (now static), with the membership frozen from a fresh evaluation.

application/json

A named collection of contacts. Either static (hand-managed list) or dynamic (query-defined). Discriminated by the type field, which is immutable after creation.

idstringRequiredExample: seg_01H8XKE...Pattern: ^seg_[0-9A-HJKMNP-TV-Z]{26}$
objectconst: segmentRequired
workroom_idstring Β· nullableOptional

The workroom that owns this segment. A flow can only be triggered by segments in its own workroom β€” compare against Flow.workroom_id.

Example: wrm_5ace370fd2a57d74d0548fb2Pattern: ^wrm_[0-9a-f]{24}$
typestring Β· enumRequired

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.

Possible values:
namestring Β· max: 200Required
descriptionstring Β· max: 2000 Β· nullableOptional
sizeintegerRequired

Current member count. Eventually consistent β€” up to minutes of lag on dynamic segments.

email_countintegerOptional

Members with a non-empty, non-invalid email.

phone_countintegerOptional

Members with a non-empty, non-invalid phone.

last_evaluated_atstring Β· date-time Β· nullableOptional

When this dynamic segment was last recomputed. Null on static.

Example: 2026-05-27T14:23:11.482Z
folder_idstring Β· nullableOptional

The segment folder this segment currently belongs to, or null if unfoldered.

Example: sfd_66b3a91d0e5b7c1a4d8e2f1aPattern: ^sfd_[0-9a-fA-F]{24}$
segment_summarystring Β· nullableOptional

AI-generated narrative summary of the segment's criteria. Populated on demand via POST /v3/segments/{id}/summary.

created_atstring Β· date-timeRequired

RFC 3339 timestamp, always UTC, millisecond precision.

Example: 2026-05-27T14:23:11.482Z
updated_atstring Β· date-timeRequired

RFC 3339 timestamp, always UTC, millisecond precision.

Example: 2026-05-27T14:23:11.482Z
post/segments/{id}/convert_to_static
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"
}