Skip to main content
POST
Attach campaign sources
Use this endpoint to connect Audiences and/or Segments to a campaign. Only the links are stored — no contacts are copied at attach time; connected contacts are materialized in the background.

Endpoint

POST /campaign/attach-sources Content-Type: application/json Authentication: Required (workspace auth)

Request Body

Response

Behavior

  • Both audience_ids and segment_ids are deduplicated and coerced to numbers; non-numeric or zero values are dropped.
  • Each ID is verified to belong to the caller’s company and workspace, and to not be soft-deleted. Any ID that doesn’t resolve fails the whole request.
  • If the campaign’s agent has required input fields (from its latest flow), every attached audience — and every attached segment’s parent audience — must already contain those input variables. Otherwise the attach is blocked, since the agent would otherwise dial contacts missing the data it needs.
  • Idempotent: re-attaching a source that was previously detached reactivates it instead of creating a duplicate link.
  • Attaching a source immediately queues contact materialization in the background; it does not block on that work completing.

Error Cases

Example cURL

Headers

token
string
required

API token for authentication

Body

application/json
campaign_id
integer
required

Campaign identifier

audience_ids
integer[]

Audience IDs to attach. At least one of audience_ids or segment_ids is required.

segment_ids
integer[]

Segment IDs to attach. At least one of audience_ids or segment_ids is required.

Response

Sources connected to campaign successfully

message
string
data
object