Generate a slideshow (AI, async)
const url = 'https://api.loomta.com/public/v1/slides/generate';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"platformIds":["8b2c1f4a-77d0-4e2c-9a1e-5c3b2a1d0e4f"],"topic":"Why indie devs love our app","slideCount":4,"mode":"draft"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.loomta.com/public/v1/slides/generate \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "platformIds": [ "8b2c1f4a-77d0-4e2c-9a1e-5c3b2a1d0e4f" ], "topic": "Why indie devs love our app", "slideCount": 4, "mode": "draft" }'The hands-off endpoint: give it a topic and it generates the captions + image prompts, generates an AI image for each slide, composites the captions, and creates the post (draft / scheduled / now, per mode) — all server-side. Advanced callers can instead pass a pre-built slides array (caption + imagePrompt each) to skip caption generation. Provide exactly one of topic or slides.
Async: returns a jobId immediately; generation runs in the background (batch; usually minutes). Poll GET /slides/generate/{jobId} until DONE, then read postGroupId. Spends one caption credit (topic path only, charged immediately on generation) plus one image credit per slide (charged on success); the Free plan includes 0 image credits. Image-credit affordability is checked before caption generation runs, so a workspace with no image credits gets 402 immediately without spending a caption credit.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Provide exactly one of topic (we generate the captions + image prompts for you) or slides (you supply them, e.g. from POST /slides/caption with imagePrompt: true).
object
Required. Platform IDs the finished post targets.
Required unless slides is given. Brief to generate captions + image prompts from. Charges one caption credit.
Optional (default 6). Number of slides to generate on the topic path.
Optional. The overall post caption. On the topic path, falls back to the generated caption when omitted. Required-ish on the slides path (omit to post with no caption).
Optional (default is the workspace setting). Language code for generated text, e.g. en, vi.
Optional (default is the workspace setting). How much text per slide (topic path).
Required unless topic is given. Pre-generated captions + image prompts.
object
Baked onto the generated image.
Prompt to generate this slide’s image.
Required. How the resulting post is created once images are ready. draft (recommended) lets you review before publishing; schedule requires scheduledFor.
ISO 8601. Required when mode is schedule; ignored otherwise.
Optional (default is the workspace setting). Caption font-style preset.
Optional (default is the workspace setting, or medium). Caption size.
Optional (default {}). Provider-specific settings for the created post (e.g. TikTok privacy).
object
Examples
Hands-off from a topic (recommended)
{ "platformIds": [ "8b2c1f4a-77d0-4e2c-9a1e-5c3b2a1d0e4f" ], "topic": "Why indie devs love our app", "slideCount": 4, "mode": "draft"}From pre-generated captions + prompts
{ "platformIds": [ "8b2c1f4a-77d0-4e2c-9a1e-5c3b2a1d0e4f" ], "content": "4 reasons indie devs keep coming back 👇", "mode": "draft", "slides": [ { "index": 0, "caption": "The tool that ships with you", "imagePrompt": "A glowing laptop on a cluttered indie dev desk at night, cinematic" }, { "index": 1, "caption": "Zero-config setup", "imagePrompt": "A clean terminal window with a single command, minimalist" } ]}Responses
Section titled “Responses”The generation job was queued.
object
Example
{ "status": "WAITING"}The request body failed validation.
object
A stable, machine-readable error code to branch on.
A human-readable description.
Optional structured detail (for example Zod validation issues).
Example
{ "code": "invalid_request", "message": "The request payload is invalid.", "details": [ { "path": [ "slideCount" ], "message": "Number must be greater than or equal to 3" } ]}The API key is missing or invalid.
object
A stable, machine-readable error code to branch on.
A human-readable description.
Optional structured detail (for example Zod validation issues).
Examples
{ "code": "missing_api_key", "message": "A Bearer API key is required."}{ "code": "invalid_api_key", "message": "The API key is invalid."}The account’s monthly image credit allowance is exhausted.
object
A stable, machine-readable error code to branch on.
A human-readable description.
Optional structured detail (for example Zod validation issues).
Example
{ "code": "ai_image_limit_reached", "message": "Your plan includes 0 AI images per month. Upgrade your plan for more."}