Skip to main content

Edit Campaign Variant

Generate an edit session URL for a campaign variant. The returned URL opens the email editor (drag-and-drop or code editor depending on the variant's template type).


Endpoint

POST https://api.campaignlark.com/v1/campaigns/:id/variants/:type/edit

Path Parameters

ParameterTypeRequiredDescription
idstringrequiredThe campaign ID.
typestringrequiredVariant type: A or B.

Request Body

FieldTypeRequiredDefaultDescription
redirect_urlstringoptionalURL to redirect the user to after saving in the editor.
sender_identity_policystringoptionalallControls which sender identities are available in the editor. all, specific, or none.
sender_identity_idintegerconditionalRequired when sender_identity_policy is specific. The sender identity to lock the editor to.

Sender Identity Policy

The sender_identity_policy controls which sender identities the user can choose from inside the email editor:

  • all — The user can select from every sender identity in the workspace. This is the default.
  • specific — The editor is locked to a single sender identity, specified by sender_identity_id. The user cannot change it.
  • none — Sender identity selection is hidden entirely in the editor.

Sample Request

POST https://api.campaignlark.com/v1/campaigns/64f1a2b3c4d5e6f7a8b9c0d1/variants/A/edit
Content-Type: application/json

{
"redirect_url": "https://myapp.com/campaigns/done",
"sender_identity_policy": "all"
}

Response

Success — 200 OK

{
"error": null,
"data": {
"edit_url": "https://editor.campaignlark.com/lark/?sess=abc123def456..."
}
}

Errors

StatusMessageCause
400Please provide a campaign ID.id path param is missing.
400Invalid request body.Request body could not be parsed.
400Invalid variant type. Must be 'A' or 'B'.Variant type is not A or B.
400Invalid sender_identity_policy. Must be 'all', 'specific', or 'none'.Invalid policy value.
400Please provide a valid sender_identity_id when using 'specific' policy.Missing or invalid sender_identity_id with specific policy.
400We could not find the campaign you are looking for.Campaign not found.
400The campaign cannot be edited while it is being reviewed.Campaign is in PREPROCESSING or IN_REVIEW status.
400We could not find the variant you are looking for.The specified variant does not exist on this campaign.