Duplicate a segment with lineage tracking
const url = 'https://dev-api.infiniteaudience.ai/v1/segments/example/duplicate';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example"}'};
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://dev-api.infiniteaudience.ai/v1/segments/example/duplicate \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example" }'Creates a new segment pre-populated from the source segment. Core and subtype-specific attributes are carried; underlying computed data (match results, lookalike/propensity scores) is referenced, never recomputed. Records parent_segment_id, derived_from (root ancestor — propagates through duplicate-of-duplicate chains), and parent_segment_version for lineage. The duplicate gets fresh created_at/updated_at and a fresh 90-day expires_at. No audience wrapper is created.
Per-subtype behavior:
-
filter — status active, record_count reset to null (recount via
POST /v1/segments/{id}/count), version history restarts atcurrent_version: 1. -
matched — record_count and match_count carried. The duplicate references the source’s match data via
source_data_segment_id(the root data owner), so it stays deliverable without re-running the match. Sources with expired/failed status or incomplete match data are rejected with 409 SOURCE_MATCH_UNAVAILABLE. -
similarity/propensity — seed/model references and record_count carried; the duplicate points at the same generated scores.
Pending or failed sources are rejected with 409 SOURCE_NOT_READY. Requires ‘purchase’ scope.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Source segment document ID.
Request Body
Section titled “Request Body”object
Display name for the duplicate. Defaults to “
Examplegenerated
{ "name": "example"}Responses
Section titled “Responses”Duplicated segment created.
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; similarity = lookalike model; propensity = ML scoring model.
Pending = computation in progress (matched/similarity/propensity during creation); active = fully ready; failed = workflow or enrichment error (see error_message); archived = hidden from the default segment catalog and new audience compositions, but otherwise fully functional — audiences that already reference an archived segment are unaffected, and it can be restored with PATCH status:active at any time. Distinct from DELETE, which is not reversible and does change referencing audiences’ composition; expired = past 90-day TTL.
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.
True for a scratch/free/auto-expiring filter-subtype segment. Absent/false reads as persistent. Promote to persistent via PATCH /v1/segments/{id} {ephemeral: false}, or implicitly by composing it into an audience.
ISO datetime the segment was promoted from ephemeral to persistent. Absent until promotion happens.
How the segment was promoted to persistent — explicit_save (a direct ephemeral: false PATCH) or composition (referenced by an audience create/update). Absent until promotion happens.
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. Legacy flat filter array.
A single filter condition for audience discovery or job execution
Filter subtype only. Grouped filter conditions.
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
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-min presigned GCS PUT 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 presigned GCS PUT 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 duplicates only. ID of the segment that owns the underlying match-result data (the root data owner). Set when the segment was created via POST /v1/segments/{id}/duplicate; propagates unchanged through duplicate-of-duplicate chains. Null on segments that own their own data.
Similarity subtype only. Natural language ICP persona description used as seed.
Similarity subtype only. ID of an existing segment used as the lookalike seed.
Similarity/propensity subtype. References the lookalike run or propensity model ID.
Similarity and propensity subtypes. The workflow run ID. Poll GET /v1/workflows/{workflow_run_id} to monitor progress.
Propensity subtype only. ID of the segment whose members are the positive training class.
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.
Example
{ "segment_id": "seg_dup456", "name": "West Coast Adults 25-44 (copy)", "subtype": "filter", "status": "active", "record_count": null, "expires_at": "2026-10-03", "ephemeral": false, "visibility": "org", "current_version": 1, "filters": [], "filter_groups": [ { "id": "g1", "filters": [ { "field": "state", "op": "IN", "value": [ "CA", "OR", "WA" ] } ], "combinator": "AND" } ], "parent_segment_id": "seg_abc123", "derived_from": "seg_abc123", "parent_segment_version": 3, "created_at": "2026-07-05T18:00:00Z", "updated_at": "2026-07-05T18:00:00Z"}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.
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.
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.
Examples
{ "error": "SCOPE_REQUIRED", "message": "This endpoint requires the purchase 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.
Examples
{ "error": "Audience not found"}The source segment cannot be duplicated. SOURCE_MATCH_UNAVAILABLE — matched source whose status is pending/expired/failed or whose matching_status is incomplete (its match data cannot be referenced). SOURCE_NOT_READY — non-matched source with status pending or failed.
object
Example
{ "error": "Conflict", "code": "SOURCE_MATCH_UNAVAILABLE", "message": "The source segment's match data is unavailable (status 'expired'). Only matched segments with completed match data can be duplicated."}