Initiate AI Generation
POST https://embed-api.postnitro.ai/post/initiate/generate
Generates a carousel post using AI with predefined content generation presets.
Headers
Content-Type: application/jsonembed-api-key: your-api-key-here(required)
Request Body
| Field | Type | Required | Description | Allowed Values |
|---|---|---|---|---|
postType | string | Yes | Type of post to generate | "CAROUSEL", "IMAGE" |
requestorId | string | No | Custom identifier for tracking | Any string |
templateId | string | Yes | ID of the template to use | Valid template ID |
brandId | string | Yes | ID of the brand configuration | Valid brand ID |
presetId | string | Yes | ID of the AI configuration preset | Valid preset ID |
responseType | string | No | Output format (default: “DESIGN”) | "DESIGN", "PDF", "PNG" |
aiGeneration | object | Yes | AI generation configuration | See below |
generateImages | object | No | Opt-in AI image generation — generates images and bakes them into the design before rendering | See AI Image Generation |
AI Generation Object
| Field | Type | Required | Description | Allowed Values |
|---|---|---|---|---|
type | string | Yes | Type of AI generation | "text", "article", "x" |
context | string | Yes | Context/prompt for AI generation | Any string |
instructions | string | No | Additional instructions for AI | Any string |
How type and context work together:
"text"—contextis a plain-text topic or prompt describing what to create (e.g."Create a carousel about digital marketing tips")"article"—contextis the URL of an article to turn into a carousel"x"—contextis the URL of an X (Twitter) post to turn into a carousel
AI Image Generation
Add an optional generateImages object to have the API generate AI images and bake them into the design before it’s rendered. Its presence is the opt-in — omit the field and no images are generated (existing behavior). Works for both CAROUSEL and IMAGE posts and with every responseType (PDF, PNG, DESIGN).
| Field | Type | Required | Default | Allowed Values |
|---|---|---|---|---|
context | string | No | Falls back to aiGeneration.context | Any string — topic/brief that guides the image prompts |
imagePlacement | string | No | "auto" | "auto", "background", "in-line" |
imageStrategy | string | No | "strategic" | "strategic", "all" |
These are the only accepted fields — any other key inside generateImages returns a 422. Everything else the image service needs (editorType, image model, and the AI copy config) is resolved server-side: editorType from postType, the platform image model, and socialPlatform/tone/audience/language from your AI preset.
On direct REST calls,
contextis optional (it falls back as shown above). Over the MCP server and CLI,contextis required — the AI agent composes it for the user. That is the only difference in howgenerateImagesbehaves across the two.
imagePlacement
| Value | Behavior |
|---|---|
auto | AI decides per slide whether an image is a background or placed in-line with the content. |
background | Images are generated for slide backgrounds. |
in-line | Images are generated to sit inside the slide content, alongside the text. |
imageStrategy
| Value | Behavior |
|---|---|
strategic | The AI picks which slides get images, capped at ~50% of slides for a balanced look. |
all | Every eligible slide gets an image, capped only by available credits. |
Behavior & limits:
- Image generation runs after the design is created and before rendering, so a rendered
PDF/PNGalready contains the images and aDESIGNresponse has them baked into the saved design (visible viaeditorUrl). The output shape is unchanged — no new fields. - Best-effort: if generation fails or isn’t permitted, the post still completes without images. A
GENERATE_IMAGESstep appears in the status logs —COMPLETEDon success,FAILED(with a skip reason) otherwise. - Free plan: AI image generation is not available — the step is skipped (logged as failed) and the post completes without images.
- Credits: the post’s reported
credits(slide-based) are unchanged. AI images bill against the organization’s separate AI-image quota. - Image generation adds latency — keep polling status until
COMPLETED.
On
generate,contextplussocialPlatform/tone/audience/languageare taken from the request/preset, sogenerateImagescan be as small as{ "imagePlacement": "auto" }— or{}to accept all defaults.
Example Request
curl --location 'https://embed-api.postnitro.ai/post/initiate/generate' \
--header 'Content-Type: application/json' \
--header 'embed-api-key: pn-your-api-key' \
--data '{
"postType": "CAROUSEL",
"requestorId": "user123",
"templateId": "xtrnxgfgk9a08tmsz2601k1c",
"brandId": "cmdhb8oe10006v0pmh6a4no6t",
"presetId": "preset123",
"responseType": "PNG",
"aiGeneration": {
"type": "text",
"context": "Create a carousel about digital marketing tips",
"instructions": "Focus on actionable tips for small businesses"
}
}'Example Request (with AI image generation)
curl --location 'https://embed-api.postnitro.ai/post/initiate/generate' \
--header 'Content-Type: application/json' \
--header 'embed-api-key: pn-your-api-key' \
--data '{
"postType": "CAROUSEL",
"requestorId": "user123",
"templateId": "xtrnxgfgk9a08tmsz2601k1c",
"brandId": "cmdhb8oe10006v0pmh6a4no6t",
"presetId": "preset123",
"responseType": "DESIGN",
"aiGeneration": {
"type": "text",
"context": "How our scheduling feature saves marketers time"
},
"generateImages": {
"imagePlacement": "auto",
"imageStrategy": "all"
}
}'Response
{
"success": true,
"message": "CAROUSEL generation initiated",
"data": {
"embedPostId": "post123",
"status": "PENDING"
}
}Generation is asynchronous. This endpoint returns immediately with an
embedPostIdwhile the carousel is generated in the background. Poll Check Post Status with theembedPostIduntil the status isCOMPLETED, then call Get Post Output to retrieve the final files.