VocalDocscontracts 1.65.0

Enroll Contacts in a Campaign

POST /v1/campaigns/{campaign_id}/contacts

PropertyValue
Operationenroll_campaign_contacts
GroupCampaigns
Scopecampaigns:write
Route classcontrol
IdempotencyIdempotency-Key required: a retry with the same key replays the first answer
AuditAudited campaigns.enrollment.create (mutation)
Released in1.65.0
Phase 0 hostServed (the hosted api pins 1.65.0)

Enrolls up to 100 Contacts by id or by inline identities, upserted as Contacts, or a completed Contact import as a campaign.enrollment_import job, from draft until enrollment_closes_at (1.65.0; section 3.1). Each enrollment is unique per Campaign and Contact, so a Contact already enrolled answers its enrollment with created false; one that fails a check is recorded ineligible with its code. A Campaign whose enrollment closed or that ended is campaign_conflict; variables in an Organization that keeps no content are zero_retention_variables_not_allowed. The Idempotency-Key makes a repeated request answer the same batch.

Request

Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the campaigns:write scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.

curl -X POST "$VOCAL_API/v1/campaigns/cmp_.../contacts" \
  -H "Authorization: Bearer $VOCAL_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{}'

Parameters

NameInTypeRequiredDescription
campaign_idpathCampaignIdyesThe id of a Campaign: cmp_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log.
idempotency-keyheaderstringyesA client-chosen key, kept 24 hours per Organization, environment and route. A replay returns the stored response.

Request body

Content type application/json, required: CampaignEnrollRequest.

FieldTypeRequiredDescription
contactsarray of CampaignEnrollItemInputno
import_idContactImportIdnoA completed Contact import whose Contacts are enrolled by a job.

Responses

StatusContent typeShapeError codes
200application/jsonCampaignEnrollmentBatch
400application/jsonErrorEnvelopeinvalid_request
401application/jsonErrorEnvelopeunauthenticated
403application/jsonErrorEnvelopeforbidden, org_suspended
404application/jsonErrorEnvelopenot_found
409application/jsonErrorEnvelopecampaign_conflict, idempotency_in_progress, idempotency_key_reused
422application/jsonErrorEnvelopevalidation_failed
429application/jsonErrorEnveloperate_limited
500application/jsonErrorEnvelopeinternal_error

Fields of the 200 answer

The shape is CampaignEnrollmentBatch.

FieldTypeRequiredDescription
campaign_idCampaignIdyes
itemsarray of CampaignEnrollItemResultyesOne per item, in order; empty for an import.
jobJob or nullyesThe import job; null for inline items.
object"campaign_enrollment_batch"yes