A token-authenticated endpoint called by the floating approval panel when the publisher approves or requests regeneration of an ad template.
The preview endpoint is called by the floating approval panel injected into the publisher's own site during live-site preview mode. It does not require session authentication — the previewToken (a CUID with ~128 bits of entropy) serves as the bearer credential for the specific placement it belongs to.
To mark a placement's template as approved and begin serving real ads:
{
"previewToken": "clp_abc123def456..."
}{
"ok": true,
"placementId": "clp_xyz789..."
}On success, Inlay sets templateApproved = true on the placement. Ad serving begins on the next matching page impression.
Idempotent
To clear the current template and request a new AI generation pass:
{
"previewToken": "clp_abc123def456...",
"regenerate": true,
"feedback": "Use a smaller font. Remove the border. Match the card style exactly."
}{
"ok": true,
"placementId": "clp_xyz789..."
}On regeneration, Inlay:
previousAdComponentHtmlregenerateFeedbackadComponentHtml, adPlacement, templateApproved, and firstVisitPageUrl| Field | Type | Description |
|---|---|---|
| previewToken | string | Required. The placement's unique preview token. |
| regenerate | boolean | Optional. If true, clears the template and schedules regeneration. Defaults to false. |
| feedback | string? | Optional. Human-readable feedback for the AI. Only used when regenerate: true. |
| Status | Body | Cause |
|---|---|---|
| 400 | { "ok": false, "error": "previewToken required" } | previewToken not provided or not a string |
| 404 | { "ok": false, "error": "Not found" } | No placement with the given previewToken exists |
| 422 | { "ok": false, "error": "No template to approve" } | Approve called but adComponentHtml is null |
| 500 | { "ok": false, "error": "Internal error" } | Unexpected server error |
The endpoint has no session authentication. It is intentionally designed to be callable from the publisher's own site without requiring the publisher to be logged in. Security is provided by the previewToken itself — a CUID value with approximately 128 bits of entropy, making brute-force guessing computationally infeasible.
The endpoint has wide-open CORS (Access-Control-Allow-Origin: *) to allow cross-origin requests from the publisher's domain.
Keep previewTokens private