Refresh a segment against the latest data
const url = 'https://api.infiniteaudience.ai/v1/segments/example/refresh';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"hitl":false,"force":false,"shard_count":1,"compression":"none"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.infiniteaudience.ai/v1/segments/example/refresh \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "hitl": false, "force": false, "shard_count": 1, "compression": "none" }'Refresh an existing filter or matched segment against current data. Requires ‘creator’ scope. Filter refresh is synchronous and invalidates its cached count. Matched refresh returns replacement upload URL(s); upload and complete identity processing before delivery. Matched duplicates return 409 SHARED_SOURCE_DATA so their shared artifact cannot be overwritten. Archived segments return 409 SEGMENT_ARCHIVED. Custom snapshots return 409 CUSTOM_REGENERATION_REQUIRED and require a new internal publication; their immutable lifetime is not extended. Retired subtypes return 400 UNKNOWN_SUBTYPE without work. No model workflow is launched.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Segment document ID.
Request Body
Section titled “Request Body”object
Matched uploads only. Stage the replacement file for mapping confirmation.
(filter only) Bump the version and invalidate the count even when the segment already looks fresh (skips the no-op short-circuit).
(matched only) Set > 1 for same-format shards. Every CSV shard must include the same header, and all shards must share schema and compression. Returns upload_urls instead of upload_url.
(matched only) Compression for this new upload. It does not inherit the previous upload’s setting. Send raw gzip bytes without Content-Encoding. gzip is not supported for avro-format segments — rejected with 400 UNSUPPORTED_INPUT_COMPRESSION.
Responses
Section titled “Responses”Successful filter or matched refresh. Matched results may include replacement upload URL(s).
Successful filter or matched refresh result. Custom snapshots return 409 CUSTOM_REGENERATION_REQUIRED; retired subtypes are rejected. No model workflow is launched.
object
Delivered IAG refresh version. Independent of license status. Null provenance means unknown; a newer refresh-major can prompt a refresh through existing workflows. Active licenses and existing identity IDs support free refresh; normal charges may apply otherwise.
object
object
Unique segment identifier
Display name of the segment
Segment subtype. Determines which additional attributes are present. filter = saved filter criteria; matched = customer list upload with identity resolution; custom = immutable membership published by the internal data-team tool.
Pending = matched processing or custom publication in progress; active = ready; failed = processing failure; archived = hidden from new composition until restored; expired = past snapshot lifetime. Custom publication never extends an old immutable snapshot.
Total matched/qualified records. Null while pending or if count has not been run.
Date-only ISO string (90-day hard expiry from creation) for a persistent segment; a full ISO datetime (short, hour-granular TTL) while ephemeral is true.
Org (default) — visible to all members of the org. private — visible only to the creating user.
Filter subtype only. Current version counter.
Filter subtype only — membership cap; null when uncapped (see POST /v1/segments)
Filter subtype only. Complete saved definition; a single AND group represents a flat input.
A group of Filter conditions. All filters within a single group are always ANDed together — there is no per-group intra-operator. The combinator attribute is an inter-group operator: it controls how this group is joined to the immediately preceding group in the array. The combinator on the first group (index 0) is always ignored.
Example — (city = "NYC" AND state = "NY") OR (state = "CA"):
{ "id": "g1", "filters": [{"field":"city","op":"=","value":"NYC"},
{"field":"state","op":"=","value":"NY"}],
"combinator": "AND" },
{ "id": "g2", "filters": [{"field":"state","op":"=","value":"CA"}],
"combinator": "OR" }
] ```
Group g1's `combinator` is irrelevant (it is the first group). Group g2's `combinator: "OR"` means the result is `(g1) OR (g2)`.
object
Stable identifier (UUID or NanoID). Used to track groups across edits.
One or more filter conditions. All conditions in this array are combined with AND. Provide at least one filter per group.
A single filter condition for audience discovery or job execution
object
Canonical catalog field_name (e.g. age or state). ZIP5 also accepts zip, zip_code, or postal_code as input aliases; saved responses use zip5.
Comparison operator
Optional STRING comparison mode for =, !=, IN, NOT IN, and LIKE, or ARRAY
Optionally trim leading and trailing whitespace on both sides of a STRING or ARRAY
Inter-group operator. Joins this group to the previous group in the array. AND narrows the result; OR broadens it. Ignored on the first group (index 0) — that group has no predecessor to join.
Matched subtype only. Input file format.
Matched subtype only. Input artifact compression, normalized to none by current handlers.
Matched subtype only. Number of same-format input objects, normalized to 1 for unsharded uploads.
Matched subtype only. Source column name → standard identity attribute mappings. Populated after the analyze-and-store workflow gate runs.
Matched subtype only. True once column mappings have been confirmed.
Matched subtype only. Number of rows in the original upload.
Matched subtype only. Rows that resolved to a known identity after enrichment.
Matched subtype only. match_count / input_record_count.
Matched subtype only. 30-minute signed upload URL. Present on create and refresh responses only, when shard_count was 1 (the default) — absent when sharded, use upload_urls instead.
Matched subtype only. N signed upload URLs (index-ordered). Present on create and refresh responses only when shard_count > 1 was requested — upload_url is absent. Every CSV shard must include the same header row.
Matched subtype only. Expiry of upload_url/upload_urls.
Present when status is failed. Describes the reason for failure.
Matched subtype only. Opaque, read-only reference to stored match results when they are shared or versioned independently from the segment metadata. Null when no separate result reference is needed.
ID of the segment this was duplicated or derived from, if applicable.
Root ancestor segment ID. Stable across duplicate-of-duplicate chains — always points at the original segment, never an intermediate duplicate.
Version of the parent segment pinned at duplicate time (current_version for filter parents; snapshot_version otherwise). Null on segments that are not duplicates.
ID of the campaign whose chat session first produced this segment. Metadata only — does not restrict the segment to that campaign. Present only when the segment was created via POST /v1/segments with a campaign_id.
Cross-campaign usage stats. Only present on GET /v1/segments/{id} — not included on list responses. Useful for understanding impact before archiving.
object
Number of active audiences that reference this segment.
Number of distinct campaigns those audiences belong to.
True when the segment was re-derived; false when the filter no-op path returned the current object unchanged (already active, count already null, TTL already fresh — pass force: true to bump anyway).
IDs of non-deleted audiences that reference this segment. They are NOT auto-refreshed — their status, record_count, and expiry may now be stale. Recount or refresh them as needed, or use POST /v1/audiences/{id}/refresh for a whole-composition refresh.
Human-readable hint for the calling agent on how to proceed (recount, upload to upload_url, or wait for the workflow).
Example
{ "segment_id": "seg_abc123", "description": null, "labels": [], "name": "West Coast Adults 25-44", "subtype": "filter", "status": "active", "record_count": null, "expires_at": "2026-10-03", "visibility": "org", "current_version": 4, "filters": [], "filter_groups": [ { "id": "g1", "filters": [ { "field": "state", "op": "IN", "value": [ "CA", "OR", "WA" ] } ], "combinator": "AND" } ], "created_at": "2026-04-01T12:00:00Z", "updated_at": "2026-07-05T18:00:00Z", "refreshed": true, "affected_audiences": [ "aud_123", "aud_456" ], "next_step": "Call POST /v1/segments/{id}/count (recount) to refresh the record count. Referencing audiences are NOT auto-refreshed — recount or refresh the audiences listed in affected_audiences as needed.", "integration_collection_provenance": null}Invalid request — malformed body, missing required attribute, or failed validation. See error and message for details.
object
Stable machine-readable error code (e.g. INVALID_STATUS_TRANSITION, BILLING_INSUFFICIENT_BALANCE). Always present.
Human-readable explanation of the error.
Alternate machine-readable code — present on some endpoints as an alias for error for backward compatibility.
Opaque support/debug identifier when available.
Public action for correcting the request or retrying later.
object
JSON path to the invalid filter field or value.
Examples
{ "error": "Bad Request", "code": "MISSING_SEGMENTS", "message": "segment_ids is required for filter audiences."}Missing or invalid Bearer token. Obtain one via POST /v1/auth/token. When a token was supplied but rejected, code distinguishes TOKEN_EXPIRED (the token’s lifetime has passed — request a new one via POST /v1/auth/token and retry) from TOKEN_INVALID (malformed or revoked — re-authenticate).
object
Stable machine-readable error code (e.g. INVALID_STATUS_TRANSITION, BILLING_INSUFFICIENT_BALANCE). Always present.
Human-readable explanation of the error.
Alternate machine-readable code — present on some endpoints as an alias for error for backward compatibility.
Opaque support/debug identifier when available.
Public action for correcting the request or retrying later.
object
JSON path to the invalid filter field or value.
Examples
{ "error": "Unauthorized: Missing or invalid Authorization header"}{ "error": "Unauthorized", "code": "TOKEN_EXPIRED", "message": "Your session has expired. Please sign in again."}Token is valid but lacks the required scope for this endpoint. Check the endpoint description for the required scope (discovery, purchase, or account).
object
Stable machine-readable error code (e.g. INVALID_STATUS_TRANSITION, BILLING_INSUFFICIENT_BALANCE). Always present.
Human-readable explanation of the error.
Alternate machine-readable code — present on some endpoints as an alias for error for backward compatibility.
Opaque support/debug identifier when available.
Public action for correcting the request or retrying later.
object
JSON path to the invalid filter field or value.
Examples
{ "error": "SCOPE_REQUIRED", "message": "This endpoint requires the creator scope."}Resource not found or not accessible to the calling org.
object
Stable machine-readable error code (e.g. INVALID_STATUS_TRANSITION, BILLING_INSUFFICIENT_BALANCE). Always present.
Human-readable explanation of the error.
Alternate machine-readable code — present on some endpoints as an alias for error for backward compatibility.
Opaque support/debug identifier when available.
Public action for correcting the request or retrying later.
object
JSON path to the invalid filter field or value.
Examples
{ "error": "Audience not found"}Resource state conflicts with the request. For upload analysis this includes FILE_NOT_YET_UPLOADED.
object
Stable machine-readable error code (e.g. INVALID_STATUS_TRANSITION, BILLING_INSUFFICIENT_BALANCE). Always present.
Human-readable explanation of the error.
Alternate machine-readable code — present on some endpoints as an alias for error for backward compatibility.
Opaque support/debug identifier when available.
Public action for correcting the request or retrying later.
object
JSON path to the invalid filter field or value.
Example
{ "issues": [ { "code": "INVALID_FILTER_SHAPE" } ]}