Skip to main content
Version: 2.0

Brochures API

The Brochures API turns a natural-language prompt into a brand-styled, print-ready brochure, lets you revise it page by page, and hands you the finished file.

Generate and edit stream: you start the work, then read Server-Sent Events for progress and the result.

Full schemas and per-field documentation live in the interactive API Reference.

Authentication​

All endpoints require a Bearer token:

Authorization: Bearer YOUR_API_KEY

See Getting Started → Authentication for details.

Endpoint summary​

MethodPathDescription
POST/api/v1/brochures/generateGenerate a brochure
POST/api/v1/brochures/editRevise a brochure
POST/api/v1/brochures/downloadDownload the file
POST/api/v2/streams/sessionsGet a stream URL for a callback_id
GET/api/v1/brochures/statusGet a turn's status (polling alternative)
GET/api/v1/brochures/templatesList available templates
GET/api/v1/brochures/languagesList supported languages
GET/api/v1/brochures/skillsList available skills

How the streaming flow works​

1. POST /api/v1/brochures/generate  →  { resData: { callback_id } }
2. POST /api/v2/streams/sessions → { data: { stream_url } }
3. open stream_url (SSE) → progress events…
terminal event + download_url

Edit follows the same three steps. Every event has the same shape:

event: status
data: {"status":"inprogress","message":"Designing your pages","callback_id":"3f8e7d61-…"}
FieldNotes
statusinprogress while working; then one of success, failed, cancelled
messageHuman-readable step — safe to show a user verbatim
callback_idThe generation or edit turn this event belongs to
download_urlOnly on a success event — the brochure in its configured export_type

Reconnection, timeouts, and client code are in Streaming (SSE).

Response envelopes​

Errors use the canonical envelope on every endpoint:

{ "success": false, "data": null, "error": { "code": "...", "message": "..." } }

Success shapes differ per endpoint:

EndpointSuccess shape
POST /api/v1/brochures/generate{ message, resData, error }
POST /api/v1/brochures/edit{ message, resData, error }
POST /api/v1/brochures/downloadflat top-level fields
POST /api/v2/streams/sessions{ success, data }
GET /api/v1/brochures/statusflat { message, status, download_url }
GET /api/v1/brochures/templates{ status, log, data }
GET /api/v1/brochures/languages{ status, log, data }
GET /api/v1/brochures/skills{ status, log, data }

POST /api/v1/brochures/generate — Generate a brochure​

Starts a generation and returns a callback_id. The brochure arrives over the stream.

Request body​

FieldTypeRequiredDescription
promptstringyesWhat to generate, in plain language.
template_idstringnoBrand template to apply. Takes precedence over settings.template_id; falls back to your key's template, then your default theme.
audience_idstringnoAudience to tailor the brochure to, from GET /api/v1/audiences.
skill_idstringnoA skill_id from /api/v1/brochures/skills. A skill not available to you is rejected with 422.
filesarrayno[{ "file_id": "…" }] — files to ground the brochure in. See File Upload.
web_linksarraynoURLs for the generator to read.
textstringnoA block of text as source material.
websearchbooleannoLet the generator search the web. Takes precedence over settings.websearch.
settingsobjectnoBrochure settings — see below.

Unknown fields — at the root or in settings — are rejected with 422 rather than ignored.

Settings​

Every key is optional. An omitted key falls back to your API key's configured default, then to the default below.

KeyTypeAccepted values / default
template_idstringAny template you can access. Root template_id wins.
orientationstringportrait or landscape. Default portrait.
sizestringa4, a5, letter, or legal. Default a4.
languagestringA locale from /api/v1/brochures/languages. Default en.
websearchbooleanDefault false.
voice_settingsobject{ "type": "standard" }, { "type": "brand" }, or a custom voice — same shape as AI Builder → Voice. Default standard.
export_typestringpdf, png, or jpg. Default pdf.
image_libraryobject{ brand_library, prezent_library, ai_images, my_workspace, additional_context }, each a boolean.
add_sources_to_footerbooleanDefault true.
ignore_audiencebooleanGenerate with no audience tailoring. When true, audience_id is not applied.

Page count is not a setting. Your key's default (4 pages, up to 20) applies unless the prompt names a count — "a 6-page brochure" wins.

Example​

curl -X POST https://api.prezent.ai/api/v1/brochures/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A 6-page product brochure for our cloud security platform: overview, key features, customer results, pricing tiers, and contact details",
"template_id": "your-template-id",
"settings": {
"orientation": "portrait",
"size": "a4",
"language": "en",
"export_type": "pdf"
}
}'

A grounded request with a skill:

{
"prompt": "A tri-section brochure summarising our Q3 security findings",
"skill_id": "612a9f7d-c2b8-48ba-8f5a-8acdefade314",
"files": [{ "file_id": "0efc0f76-4c51-4564-a671-f0ff0c21d23e" }],
"web_links": ["https://example.com/2026-cloud-security-report"],
"websearch": true,
"settings": {
"orientation": "landscape",
"size": "letter",
"voice_settings": { "type": "custom", "details": { "tone": "factual", "emotion": "assertive" } }
}
}

Success response (200)​

{
"message": "Job submitted successfully",
"resData": {
"callback_id": "3f8e7d61-9a2b-4c5e-b013-7d4a6f2c8e91",
"preview_url": "https://…/brochures?…"
},
"error": null
}

The payload is under resData. callback_id is valid for about 3 hours. preview_url opens the brochure in the Prezent app and is present only when enabled on your key.

Validation errors (422)​

{
"success": false,
"data": null,
"error": {
"code": "INVALID_INPUT",
"message": "The request contains invalid input.",
"details": [
"prompt is required",
"settings.size: 'a3' is not supported (accepted values: a4, a5, letter, legal)"
]
}
}

POST /api/v1/brochures/edit — Revise a brochure​

Applies a natural-language edit to the whole brochure or to one page.

Edits are conversational: pass the callback_id of the most recent turn, and use the new id you get back for the next edit.

One turn at a time

Wait for the previous turn's terminal event before editing. A turn still in flight is rejected with that reason in error.message.

Request body​

FieldTypeRequiredDescription
callback_idstringyesThe brochure to edit — the original generation, or the most recent edit.
promptstringyesThe change to make, in plain language.
page_indexintegernoPage to edit, counting from 0. Omit to edit the whole brochure.
filesarrayno[{ "file_id": "…" }] — context for this edit.
web_linksarraynoURLs to read as context.
textstringnoA block of text as context.

Settings from generation carry over unchanged. A page_index past the last page returns 400 with the real page count.

Example​

# Edit page 2 (index 1)
curl -X POST https://api.prezent.ai/api/v1/brochures/edit \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"callback_id": "3f8e7d61-9a2b-4c5e-b013-7d4a6f2c8e91",
"prompt": "Replace the feature list with a three-column comparison table",
"page_index": 1
}'

Success response (200)​

{
"message": "Edit submitted successfully",
"resData": {
"callback_id": "8c1d4b92-6f37-4e2a-a95c-1b0e7d3f6a48"
},
"error": null
}

This callback_id is new. Stream it to watch the edit, and pass it to your next edit.


POST /api/v1/brochures/download — Download the file​

Returns the file for a finished brochure turn.

Request body​

FieldTypeRequiredDescription
callback_idstringyesThe brochure to download.
export_typestringnopdf, png, or jpg. Defaults to your key's configured format, then pdf.

Example​

curl -X POST https://api.prezent.ai/api/v1/brochures/download \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"callback_id": "3f8e7d61-9a2b-4c5e-b013-7d4a6f2c8e91",
"export_type": "pdf"
}'

Success response (200)​

The response carries either a download_url or a stream_url:

CaseFieldWhat to do
Already exported in this formatdownload_urlFetch it.
Needs exportingstream_urlOpen it and read the terminal event for the download_url.
{
"message": "Brochure exported successfully",
"status": "success",
"callback_id": "3f8e7d61-9a2b-4c5e-b013-7d4a6f2c8e91",
"export_type": "pdf",
"download_url": "https://assets.prezent.ai/protected/…/brochure.pdf?token=…",
"expires_at": "2026-08-05T12:34:56.000Z"
}
{
"message": "Connect to stream_url to receive the download URL on the done event",
"status": "success",
"callback_id": "3f8e7d61-9a2b-4c5e-b013-7d4a6f2c8e91",
"export_type": "png",
"stream_url": "https://stream-api-prod.myprezent.com/v2/streams/a1b2c3?token=…&stream_type=export&export_type=png",
"expires_at": "2026-08-05T12:34:56.000Z"
}

Both URLs carry their own token — send no Authorization header — and expire at expires_at (about 5 minutes). A requested jpg is reported back as jpeg.

If the turn has no file yet, the response is still 200, with no URL:

statusMeaning
inprogressStill generating — retry once it completes.
failedThe turn produced no brochure — start a new generation.

Errors​

Statuserror.codeCause
400MISSING_CALLBACK_IDNo callback_id in the body.
400INVALID_DATA_TYPEcallback_id is not a non-empty string, or export_type is unsupported.
400BAD_REQUESTNo active session for this callback_id (expires ~3 hours after generation).
429USAGE_LIMIT_EXCEEDEDThe download would exceed your key's limit, counted in pages.
500INTERNAL_SERVER_ERRORThe export could not be started.

POST /api/v2/streams/sessions — Get a stream URL​

Exchanges a callback_id from brochure generate or edit for an authenticated SSE URL. Shared across all 2.0 streaming surfaces.

curl -X POST https://api.prezent.ai/api/v2/streams/sessions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "callback_id": "3f8e7d61-9a2b-4c5e-b013-7d4a6f2c8e91" }'
{
"success": true,
"data": {
"callback_id": "3f8e7d61-9a2b-4c5e-b013-7d4a6f2c8e91",
"stream_url": "https://stream-api-prod.myprezent.com/v2/streams/a1b2c3?token=eyJhbGciOi...&turn_id=3f8e7d61",
"expires_at": "2026-08-05T12:34:56.000Z"
}
}

stream_url expires in about 5 minutes; calling again mints a fresh one that replays from the start of the turn. Full details: AI Builder → Get a stream URL.


GET /api/v1/brochures/status — Get a turn's status​

The polling alternative to streaming.

ParameterTypeRequiredDescription
callback_idstringyesThe id from brochure generate or edit.
curl -s "https://api.prezent.ai/api/v1/brochures/status?callback_id=3f8e7d61-9a2b-4c5e-b013-7d4a6f2c8e91" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"message": "Workflow status polling completed. Your brochure is ready to download.",
"status": "success",
"download_url": "https://cdn.prezent.ai/exports/a1b2c3/brochure.pdf?token=..."
}
statusMeaning
in_progressStill running.
successFinished — download_url is populated.
failedTerminal with no file. message carries the reason.
Statuserror.codeMeaning
400MISSING_REQUIRED_FIELDcallback_id absent.
400BAD_REQUESTcallback_id belongs to a presentation or poster — use that surface's status endpoint.
404STREAM_CALLBACK_NOT_FOUNDNo brochure with this id was issued to your key.

GET /api/v1/brochures/templates — List templates​

The brand templates available for brochures. Pass a template's code as template_id.

ParameterTypeRequiredDescription
namestringnoFilter by template name.
sortstringno<field>:asc or <field>:desc, for example name:asc.
curl -s "https://api.prezent.ai/api/v1/brochures/templates?sort=name:asc" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"status": "success",
"log": "success",
"data": [
{
"code": "CORP26",
"name": "Corporate 2026",
"isDisabled": false
}
]
}

GET /api/v1/brochures/languages — List supported languages​

Pass a locale from this list as settings.language. The list is static — cache it.

curl -s https://api.prezent.ai/api/v1/brochures/languages \
-H "Authorization: Bearer YOUR_API_KEY"
{
"status": "success",
"log": "Supported languages retrieved successfully",
"data": [
{ "language": "English (US)", "locale": "en" },
{ "language": "French", "locale": "fr" },
{ "language": "German", "locale": "de" }
]
}

GET /api/v1/brochures/skills — List skills​

The brochure skills available to you — the values you pass as skill_id on generate.

ListContents
default_skillsPrezent's skills for your industry, including any you have customized.
my_skillsSkills you created from scratch.
shared_skillsSkills other people in your company shared with you.
curl -s https://api.prezent.ai/api/v1/brochures/skills \
-H "Authorization: Bearer YOUR_API_KEY"
{
"status": "success",
"log": "Skills retrieved successfully",
"data": {
"default_skills": [
{
"skill_id": "product_brochure",
"skill_name": "Product Brochure",
"description": "Feature-led brochures for a single product.",
"display_description": "Product brochure",
"instructions": "Open with the value proposition, then features, proof points, and a call to action.",
"industry": "Technology",
"function": null
}
],
"my_skills": [],
"shared_skills": [
{
"skill_id": "8d3e41b0-5f6a-4c2e-9b7d-1a2c3e4f5a6b",
"skill_name": "Partner Program Brochure",
"description": "Brochures for our channel partner program.",
"display_description": null,
"instructions": "Lead with partner benefits, then tiers, requirements, and how to apply.",
"industry": null,
"function": null
}
]
}
}

End-to-end example​

Generate a brochure, stream it to completion, then download it.

import json
import httpx # pip install httpx httpx-sse
from httpx_sse import connect_sse

BASE = "https://api.prezent.ai"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}


def read_stream(stream_url):
"""Read a stream to its terminal event and return that event."""
with httpx.Client(timeout=None) as sc:
with connect_sse(sc, "GET", stream_url) as events:
for sse in events.iter_sse():
if not sse.data.strip(): # keep-alive ping
continue
event = json.loads(sse.data)
print(event["status"], "-", event.get("message"))
if event["status"] == "inprogress":
continue
if event["status"] != "success":
raise RuntimeError(f"{event['status']}: {event.get('message')}")
return event
raise RuntimeError("stream closed without a terminal event")


with httpx.Client(base_url=BASE, headers=HEADERS, timeout=30) as c:
# 1. start the generation
gen = c.post("/api/v1/brochures/generate", json={
"prompt": "A 6-page product brochure for our cloud security platform",
"settings": {"orientation": "portrait", "size": "a4"},
})
gen.raise_for_status()
callback_id = gen.json()["resData"]["callback_id"]

# 2 + 3. stream to completion
sess = c.post("/api/v2/streams/sessions", json={"callback_id": callback_id})
sess.raise_for_status()
read_stream(sess.json()["data"]["stream_url"])

# 4. download — inline URL, or a stream that delivers one
dl = c.post("/api/v1/brochures/download",
json={"callback_id": callback_id, "export_type": "png"}).json()
url = dl.get("download_url") or read_stream(dl["stream_url"])["download_url"]
print("brochure ready:", url)

Errors​

Statuserror.codeCause
400BAD_REQUEST, INVALID_JSON, MISSING_CALLBACK_ID, MISSING_REQUIRED_FIELD, INVALID_DATA_TYPEMalformed request, unknown or expired callback_id, or page_index out of range.
401UNAUTHORIZED, INVALID_API_KEY, EXPIRED_API_KEYMissing, invalid, or expired key.
404ENDPOINT_NOT_FOUND, STREAM_CALLBACK_NOT_FOUNDKey not scoped to this path, or expired session.
422INVALID_INPUTField validation failed. error.details is an array of messages.
429TOO_MANY_REQUESTS, RATE_LIMIT_EXCEEDED, USAGE_LIMIT_EXCEEDEDGateway throttle, per-category limit, or quota.
500INTERNAL_SERVER_ERRORUnexpected server error.

Full catalog: Error Reference.

Where to go next​