Skip to main content

Configure Campaign

Configure a campaign's sender identity, reply-to address, audience, and variant metadata in a single call. The campaign must be in DRAFT status.


Endpoint

PATCH https://api.campaignlark.com/v1/campaigns/:id/configure

Path Parameters

ParameterTypeRequiredDescription
idstringrequiredThe campaign ID.

Request Body

All top-level fields are optional — include only the sections you want to update. Omitted sections are left unchanged. When provided, sender and audience fully replace the existing configuration. All three must be configured (across one or more calls) before the campaign can be scheduled.

FieldTypeRequiredDescription
senderobjectoptionalSender identity configuration. Replaces the existing sender when provided.
sender.sender_identity_idintegerrequired (if sender provided)ID of the sender identity to use. Must exist in the workspace.
sender.reply_toobjectoptionalReply-to identity with display_name, local_part, and domain_name.
audienceobjectoptionalAudience targeting configuration. Replaces the existing audience when provided.
audience.typestringrequired (if audience provided)ENTIRE_AUDIENCE, TAGS, or SEGMENTS.
audience.include_tag_idsarray of integersrequired if type is TAGSTag IDs to send to.
audience.include_segment_idsarray of integersrequired if type is SEGMENTSSegment IDs to send to.
audience.exclude_tag_idsarray of integersoptionalTag IDs to exclude from the audience.
audience.exclude_segment_idsarray of integersoptionalSegment IDs to exclude from the audience.
variantsarray of objectsoptionalVariant subject/preview text configuration. Omit to leave variants unchanged.
variants[].typestringrequiredA or B.
variants[].subjectstringrequiredSubject line (3–90 characters).
variants[].preview_textstringoptionalPreview text (max 120 characters).

Sample Request

PATCH https://api.campaignlark.com/v1/campaigns/64f1a2b3c4d5e6f7a8b9c0d1/configure
Content-Type: application/json

{
"sender": {
"sender_identity_id": 12,
"reply_to": {
"display_name": "Support",
"local_part": "support",
"domain_name": "example.com"
}
},
"audience": {
"type": "SEGMENTS",
"include_segment_ids": [2, 7],
"exclude_segment_ids": [4]
},
"variants": [
{
"type": "A",
"subject": "Don't miss our Summer Sale!",
"preview_text": "Up to 50% off everything"
},
{
"type": "B",
"subject": "Summer Sale — Last Chance!",
"preview_text": "Ends tonight at midnight"
}
]
}

Response

Success — 200 OK

Returns the updated campaign configuration:

{
"error": null,
"data": {
"id": "64f1a2b3c4d5e6f7a8b9c0d1",
"name": "Summer Sale Campaign",
"type": "SINGLE_VARIANT",
"sender_identity": {
"display_name": "My Store",
"local_part": "hello",
"domain_name": "example.com"
},
"reply_to": {
"display_name": "Support",
"local_part": "support",
"domain_name": "example.com"
},
"audience": [
{
"type": "TAGS",
"include_tag_ids": [1, 3],
"exclude_tag_ids": [5]
}
],
"variants": [
{
"id": "64f1a2b3c4d5e6f7a8b9c0d2",
"type": "A",
"subject": "Don't miss our Summer Sale!",
"preview_text": "Up to 50% off everything",
"template_type": "EDITOR",
"preview_url": "https://usercontent.campaignlark.com/image/abc123.png"
}
]
}
}

Errors

StatusMessageCause
400Please provide a campaign ID.id path param is missing.
400Invalid request body.Request body could not be parsed.
400We could not find the campaign you are looking for.Campaign not found.
400The campaign must be in draft mode before it can be configured.Campaign is not in DRAFT status.
400Invalid sender identity DomainID.sender_identity_id is invalid.
400The sender identity could not be found.Sender identity does not exist in the workspace.
400Invalid audience type. Must be 'ENTIRE_AUDIENCE', 'TAGS', or 'SEGMENTS'.Invalid audience type.
400At least one tag is required when audience type is 'TAGS'.include_tag_ids is empty when type is TAGS.
400One or more tags could not be found.A provided tag ID does not exist.
400At least one segment is required when audience type is 'SEGMENTS'.include_segment_ids is empty when type is SEGMENTS.
400One or more segments could not be found.A provided segment ID does not exist.
400One or more exclude tags could not be found.An exclude tag ID does not exist.
400One or more exclude segments could not be found.An exclude segment ID does not exist.
400Invalid variant type. Must be 'A' or 'B'.Variant type is not A or B.
400Single variant campaigns cannot have a 'B' variant.Tried to add variant B to a SINGLE_VARIANT campaign.
400Single variant campaigns must include variant 'A'.Variant A is missing for a SINGLE_VARIANT campaign.
400A/B testing campaigns must include both variant 'A' and variant 'B'.Missing a variant for an AB_TESTING campaign.
400Please provide a subject for this variant.Variant subject is empty.
400The subject must be at least 3 characters long.Subject is too short.
400The subject must be 90 characters or less.Subject exceeds 90 characters.
400The preview text must be 120 characters or less.Preview text exceeds 120 characters.