Create a campaign
const url = 'https://dev-api.infiniteaudience.ai/v1/campaigns';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"Q3 2026 Prospecting"}'};
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/campaigns \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "Q3 2026 Prospecting" }'Creates a new campaign workspace. A Campaign is a named container that groups related audiences and deliveries under a single context — useful for organising a body of work such as a quarterly prospecting initiative or a product-launch outreach.
Campaign association is optional. Audiences, file-match jobs, and deliveries all work independently without a campaign. Use campaigns when you want to track related work together — e.g. filtering GET /v1/operations to campaign_id for a specific initiative’s activity.
After creation, associate audiences with the campaign by:
- Passing
campaign_idtoPOST /v1/audiencesorPOST /v1/match/fileat creation time (auto-links on creation). - Calling
POST /v1/campaigns/{id}/audiences/{audience_id}to link an existing audience.
Requires ‘purchase’ scope.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Display name for the campaign.
Examples
Create a campaign
{ "name": "Q3 2026 Prospecting"}Responses
Section titled “Responses”Campaign created.
A named workspace grouping related audiences and deliveries. There is no audience_ids[] field — audiences[] (below) is the only audience-linkage field the handler ever returns.
object
Unique campaign identifier.
Display name of the campaign.
Lifecycle state of the campaign.
Associated chat session IDs.
Audiences linked to this campaign — expanded on GET /v1/campaigns/{id}; empty array on list responses.
object
IDs of include-role segments in this audience.
IDs of exclude-role segments in this audience.
Expanded summaries of the include-role segments, in segment_ids order (best-effort — missing or deleted segment docs are skipped). The first entry is the primary segment; its subtype determines the audience’s subtype-specific behavior.
Lightweight summary of a constituent segment, expanded server-side from the audience’s composition. Returned on both list and single-GET audience responses. subtype is the segment’s own subtype — use the first entry of segments (the primary included segment) to derive subtype-specific presentation for the audience.
object
Segment document ID.
Segment display name.
Cached record count of the segment. Null if never counted.
Subtype of the constituent segment.
Matched subtype only. Count of records in the uploaded identity file. Null otherwise.
Matched subtype only. Count of records successfully matched. Null otherwise.
Expanded summaries of the exclude-role segments, same semantics as segments.
Lightweight summary of a constituent segment, expanded server-side from the audience’s composition. Returned on both list and single-GET audience responses. subtype is the segment’s own subtype — use the first entry of segments (the primary included segment) to derive subtype-specific presentation for the audience.
object
Segment document ID.
Segment display name.
Cached record count of the segment. Null if never counted.
Subtype of the constituent segment.
Matched subtype only. Count of records in the uploaded identity file. Null otherwise.
Matched subtype only. Count of records successfully matched. Null otherwise.
When this audience was linked to the campaign.
UID of the user who linked this audience to the campaign.
UID of the user who created the campaign.
UID of the user who last updated the campaign.
Example
{ "status": "active", "audiences": [ { "status": "active", "segments": [ { "subtype": "filter" } ], "excluded_segments": [ { "subtype": "filter" } ], "set_logic": "union" } ]}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."}