Edit landing page draft
Applies edit operations to the draft of the landing page, never to the live page. Free pages and pages in the page model take different operations: see get_landing_catalog. If one operation is rejected nothing changes.
POST /v1/landing-page/operations
| Permission | landing:write (all permissions) |
| Risk | Write (no outside effect) |
| Idempotency-Key | Required (how it works) |
| Safe to repeat | Safe to repeat with the same Idempotency-Key: the first answer comes back and nothing is done twice. |
| Rate limit class | write (120 requests per minute per key) |
| Confirmation | None |
| MCP tool | apply_landing_page_ops |
| Since version | 2026-10-25 |
#What it does
- Changes data in your account. It does not send messages to contacts.
- Safe to repeat with the same Idempotency-Key.
#Request
Header
| Name | Required | Description |
|---|---|---|
Authorization | yes | Bearer <key> |
Idempotency-Key | yes | A unique value for this operation, for example a UUID (1 to 255 visible ASCII characters). |
Body (JSON)
| Name | Type | Required | Description |
|---|---|---|---|
operations | array of object | yes | The operations, applied in this order. up to 50 items |
operations[].type | string | yes | Kind of operation. See get_landing_catalog. one of: replace_text, set_page_title, set_page_description, set_design_token, add_section, update_section_data, change_variant, move_section, delete_section, set_style, set_settings, replace_media |
operations[].find | string | no | replace_text: the text to find. It must occur exactly once in the page. up to 2000 characters |
operations[].replace | string | no | replace_text: the new text (plain text). up to 2000 characters |
operations[].text | string | no | set_page_title (up to 160 characters), set_page_description (up to 300), replace_text in the page model (the new text). up to 2000 characters |
operations[].token | string | no | set_design_token: name of an existing design value, for example --brand-color. up to 41 characters |
operations[].value | string | no | set_design_token: a color (#hex, rgb(), hsl()) or a length (px, rem, em, %). up to 60 characters |
operations[].id | string | no | Page model: id of the section or element (from get_landing_page include=sections). up to 40 characters |
operations[].field | string | no | Page model: field name, for example title or items[0].title. up to 100 characters |
operations[].section | object | no | add_section: the new section. kind block with type, variant and data, or kind free with layout and elements. See get_landing_catalog. |
operations[].position | object | no | add_section: where the section goes. Default: at the end. |
operations[].position.at | string | no | The start or the end of the page. one of: start, end |
operations[].position.index | integer | no | Place number, counted from 0. 0 to 100 |
operations[].position.after | string | no | Id of the section it goes after. up to 40 characters |
operations[].position.before | string | no | Id of the section it goes before. up to 40 characters |
operations[].to | object | no | move_section: the new place. |
operations[].to.at | string | no | The start or the end of the page. one of: start, end |
operations[].to.index | integer | no | Place number, counted from 0. 0 to 100 |
operations[].to.after | string | no | Id of the section it goes after. up to 40 characters |
operations[].to.before | string | no | Id of the section it goes before. up to 40 characters |
operations[].data | object | no | update_section_data: fields to change. A value null removes the field. |
operations[].variant | string | no | change_variant: the new variant of the section. up to 40 characters |
operations[].style | object | no | set_style: style values to change, for example palette or mood. |
operations[].settings | object | no | set_settings: settings to change. language sets the one language of the page. |
operations[].url | string | no | replace_media: address of the new image (https, from the media library of the account). up to 2000 characters |
operations[].alt | string | no | replace_media: short description of the image. up to 200 characters |
operations[].decorative | boolean | no | replace_media: true if the image only decorates. |
operations[].origin | string | no | replace_media: origin of the image. Always own. one of: own |
dry_run | boolean | no | True: check and show the changes, write nothing. |
#Examples
curl -X POST "https://api.smartchat.marketing/v1/landing-page/operations" \
-H "Authorization: Bearer $SMARTCHAT_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"operations": [
{
"type": "replace_text",
"find": "Fresh bread every morning",
"replace": "Fresh bread from 6 o'\''clock"
}
]
}'import os
import uuid
import requests
response = requests.post(
"https://api.smartchat.marketing/v1/landing-page/operations",
headers={
"Authorization": "Bearer " + os.environ["SMARTCHAT_API_KEY"],
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"operations": [
{
"type": "replace_text",
"find": "Fresh bread every morning",
"replace": "Fresh bread from 6 o'clock",
},
],
},
)
response.raise_for_status()
print(response.json())const response = await fetch("https://api.smartchat.marketing/v1/landing-page/operations", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SMARTCHAT_API_KEY}`,
"Idempotency-Key": crypto.randomUUID(),
"Content-Type": "application/json",
},
body: JSON.stringify({
"operations": [
{
"type": "replace_text",
"find": "Fresh bread every morning",
"replace": "Fresh bread from 6 o'clock"
}
]
}),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());Response (200):
{
"object": "landing_page_operations",
"applied": 1,
"dry_run": false,
"diff": [
{
"operation": 0,
"field": "text",
"before": "Fresh bread every morning",
"after": "Fresh bread from 6 o'clock"
}
],
"has_draft": true
}#Response
Status 200. Every response has the headers Request-Id, SmartChat-Version and X-RateLimit-*.
| Name | Type | Description |
|---|---|---|
object | string | Always "landing_page_operations". always landing_page_operations |
applied | integer | Number of operations applied. 0 to 1000 |
dry_run | boolean | True if nothing was written. |
diff | array of object | Before and after of every change. up to 1000 items |
diff[].operation | integer | Index of the operation (free pages). 0 to 1000 |
diff[].kind | string | Kind of change (page model). one of: added, removed, changed, moved |
diff[].field | string | What changed. up to 200 characters |
diff[].before | string | Before. up to 600 characters |
diff[].after | string | After. up to 600 characters |
has_draft | boolean | True if there is a draft after the call. |
#Errors
| Code | Status | When |
|---|---|---|
idempotency_key_invalid | 400 | The 'Idempotency-Key' header must be 1 to 255 visible ASCII characters. |
idempotency_key_required | 400 | This call needs an 'Idempotency-Key' header. |
api_key_expired | 401 | This API key has expired. |
api_key_invalid | 401 | This API key is not valid. |
api_key_revoked | 401 | This API key was revoked. |
authentication_required | 401 | No API key was sent. Send 'Authorization: Bearer <key>'. |
insufficient_scope | 403 | This key lacks a required permission. |
ip_not_allowed | 403 | This IP address is not allowed for this key. |
not_found | 404 | This path does not exist. |
idempotency_in_progress | 409 | A request with this idempotency key is still running. |
idempotency_key_reused | 422 | This idempotency key was already used with a different request. |
landing_language_single | 422 | A landing page has exactly one language. |
landing_ops_rejected | 422 | Some operations were rejected. Nothing was changed. |
validation_failed | 422 | A field is not valid. |
rate_limited | 429 | Too many requests. Wait and try again. |
internal_error | 500 | Something went wrong on our side. |
All errors use one format.