---
title: "API Operation"
description: "Developer documentation for Topol's embeddable white-label email editor and landing page editor (beta). Get practical insights and guidance for integration and optimized user experiences."
url: https://docs.topol.io/landing-page-editor/guide/operations/convertPageToHtml.html
---

## JSON to HTML (API key)

Convert a landing page JSON template definition to rendered HTML. This is the same rendering service the editor uses when a page is saved or previewed. Authentication is carried in the request body: the apiKey must be valid and the hostname must be on the key's allowed-domain list. This is the endpoint the editor itself calls; for server-to-server rendering prefer `/landing-page/v1/json2html`, which authenticates with the secret key and additionally reports missing fonts.

If the template contains synced sections (any section node with a `syncedId` property), pass their current content through the optional `syncedSections` request field. The endpoint looks up each `syncedId` in the supplied array and splices the section's full definition into the template before rendering, regenerating child block UIDs to avoid collisions. Without this field the page renders with the section content embedded in the template definition, which may be stale.

### Endpoint

`POST https://api.topol.io/landing-page/get-html`

### Request body (required)

Template conversion request

Content-Type: `application/json`

- `apiKey` _string_ **required** — Your Topol API key. The request is rejected when the key is invalid or the hostname is not on the key's allowed-domain list.
- `hostname` _string_ **required** — A hostname on the API key's allowed-domain list
- `userId` _string | number_ — ID of the user (optional)
- `definition` _string_ **required** — The landing page template definition as a JSON string - the same JSON your onSave callback receives, serialized with JSON.stringify()
- `options` _object_ **required** — Template conversion options
  - `minify` _boolean_ — Whether to minify the output HTML
  - `fonts` _string_ **required** — JSON string containing an array of font objects with label, style, and url properties
- `syncedSections` _object[]_ — Resolved content for every synced section referenced by the template. A section in the template JSON that carries a `syncedId` is stored as a lightweight reference only; supply the matching content here so the endpoint renders the latest version of each section instead of the copy embedded in the template definition. Fetch each referenced synced section from your `api.SAVED_SECTIONS` storage (see the Reusable Content guide) and pass it in this array. Sections whose `syncedId` has no match in this array keep the content embedded in the definition.
  - `id` _number_ **required** — ID of the synced section. Must match the `syncedId` on a section node in the template JSON.
  - `definition` _string_ **required** — JSON-encoded definition of the synced section (string, not a nested object) - the `definition` your `api.SAVED_SECTIONS` endpoint returns for the section.

### Responses

#### 200 — Template converted successfully

Content-Type: `application/json`

- `html` _string_ **required** — Rendered HTML output

#### 400 — Bad request - validation failures return message/success/errors; conversion range errors return errorText instead

Content-Type: `application/json`

#### 401 — Unauthorized - invalid API key or hostname not on the allowed-domain list

Content-Type: `application/json`

- `message` _string_ — Error message
- `success` _boolean_
- `errors` _object[]_ — Validation issues (present on 400 validation failures)

#### 500 — Internal server error during HTML conversion

Content-Type: `application/json`

- `errorText` _string_ — Error message from the HTML conversion step
