Generate slideshow captions
const url = 'https://api.loomta.com/public/v1/slides/caption';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"topic":"Why indie devs love our app"}'};
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/caption \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "topic": "Why indie devs love our app" }'Generates an overall caption plus per-slide text for a photo carousel. Spends one caption credit from the account’s monthly allowance.
Only topic is required. Everything that shapes the writing — the system prompt, knowledge base, language, and slide length — is taken from the workspace’s saved settings (configured in the Loomta app), so a minimal request already produces on-brand output. slideCount (default 6), language, and slideLength are optional per-call overrides; the system prompt and knowledge base are workspace-only and cannot be passed here.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Only topic is required. Tone and facts come from the workspace’s active system prompt and knowledge base (set in the Loomta app) automatically — you don’t pass those here. slideCount, language, and slideLength are optional (they default to a sensible value / the workspace defaults).
object
Required. The topic or brief the slideshow is about — turned into a hook + per-slide captions.
Optional. How many slides to write captions for (3–10). Defaults to 6.
Optional override. ISO code for the language of the generated text. First-class support: en (English), vi (Vietnamese), ja (Japanese), ko (Korean), zh (Chinese), es (Spanish), fr (French), de (German), pt (Portuguese), id (Indonesian). Other codes are passed through and usually work. Omit to use the workspace’s configured default.
Optional override. How much text per slide. Omit to use the workspace’s configured default (which falls back to medium).
Whether the response includes per-slide image prompts. Omitted or false — captions only (the default). true — every slide additionally gets an imagePrompt: a vivid, self-contained prompt for generating that slide’s background image (the input for AI image generation).
Examples
Minimal — just a topic (6 slides, workspace defaults)
{ "topic": "Why indie devs love our app"}Override slide count + language + slide length
{ "topic": "Why indie devs love our app", "slideCount": 4, "language": "vi", "slideLength": "short"}Captions + per-slide image prompts
With imagePrompt: true, each slide also gets an imagePrompt — the prompt used to generate that slide’s image for the slideshow (feed it into AI image generation).
{ "topic": "Why indie devs love our app", "slideCount": 4, "imagePrompt": true}Responses
Section titled “Responses”The generated caption and slides.
object
The overall post caption.
One entry per slide, in order. index 0 is the hook (first slide). imagePrompt appears only when the request’s imagePrompt was true.
object
0-based slide position; 0 is the hook.
Only present when requested — a prompt to generate this slide’s background image.
Example
{ "caption": "4 reasons indie devs keep coming back 👇", "slides": [ { "index": 0, "caption": "The tool that ships with you" }, { "index": 1, "caption": "Zero-config setup" }, { "index": 2, "caption": "Fair, usage-based pricing" }, { "index": 3, "caption": "Built for automation" } ]}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 caption 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_credit_limit_reached", "message": "Your plan includes 50 AI credits per month. Upgrade your plan for more."}