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
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | required | The campaign ID. |
type | string | required | Variant type: A or B. |
Request Body
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
redirect_url | string | optional | — | URL to redirect the user to after saving in the editor. |
sender_identity_policy | string | optional | all | Controls which sender identities are available in the editor. all, specific, or none. |
sender_identity_id | integer | conditional | — | Required 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 bysender_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
| Status | Message | Cause |
|---|---|---|
400 | Please provide a campaign ID. | id path param is missing. |
400 | Invalid request body. | Request body could not be parsed. |
400 | Invalid variant type. Must be 'A' or 'B'. | Variant type is not A or B. |
400 | Invalid sender_identity_policy. Must be 'all', 'specific', or 'none'. | Invalid policy value. |
400 | Please provide a valid sender_identity_id when using 'specific' policy. | Missing or invalid sender_identity_id with specific policy. |
400 | We could not find the campaign you are looking for. | Campaign not found. |
400 | The campaign cannot be edited while it is being reviewed. | Campaign is in PREPROCESSING or IN_REVIEW status. |
400 | We could not find the variant you are looking for. | The specified variant does not exist on this campaign. |