Skip to main content

Get Campaign Variant HTML

Retrieve a campaign variant's content: the editor JSON and the rendered HTML.


Endpoint

GET https://api.campaignlark.com/v1/campaigns/:id/variants/:type/html

Path Parameters

ParameterTypeRequiredDescription
idstringrequiredThe campaign ID.
typestringrequiredVariant type: A or B (case-insensitive).

Sample Request

GET https://api.campaignlark.com/v1/campaigns/64f1a2b3c4d5e6f7a8b9c0d1/variants/A/html

Response

Success — 200 OK

{
"error": null,
"data": {
"id": "6512a...",
"type": "A",
"template_type": "EDITOR",
"body_json": "{...}",
"body_html": "<html>...</html>"
}
}

Response Fields

FieldTypeDescription
idstringThe variant's object ID.
typestringA or B.
template_typestringEDITOR (drag-and-drop builder) or CODE (raw HTML).
body_jsonstring or nullThe editor's JSON document. null for CODE variants.
body_htmlstringThe rendered HTML. May be empty if no content has been set.

Errors

StatusMessageCause
400Please provide a campaign ID.id path param is missing.
400Invalid variant type. Must be 'A' or 'B'.type is not A or B.
400We could not find the campaign you are looking for.Campaign not found.
400We could not find the variant you are looking for.Variant not found.