Skip to content

Build a slideshow

This guide builds a TikTok photo carousel end to end: generate captions with AI, bake them onto your images, then create the post. Each API step depends on the one before it, so the flow always ends on creating the post.

auth → (configure workspace AI settings) → generate captions
→ composite captions onto media → upload / pick media → create post
  • Auth — every call uses your loomta_sk_… key.
  • Workspace AI settings — the active system prompt + knowledge base (configured once in the Loomta app) steer caption tone and facts. You don’t send these per request; the API applies them for you.
  • Generate captions — turn a brief into a hook + per-slide captions.
  • Composite — bake those captions onto your images, producing new media.
  • Create post — the final step; schedule or publish the composited images.
  1. Generate captions. Give the model a brief and a slide count. The response is a post caption plus one caption per slide — slides[0] is the hook.

    Terminal window
    curl https://api.loomta.com/public/v1/slides/caption \
    -H "Authorization: Bearer $LOOMTA_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{ "topic": "Why indie devs love our app", "slideCount": 4 }'

    That’s the whole request — topic is the only required field (slideCount defaults to 6).

  2. Composite captions onto your images. Pass each slide as { index, mediaId, caption }, where mediaId is a READY image you’ve uploaded (see Quickstart step 3). The response gives you new composited mediaIds, in order.

    Terminal window
    curl https://api.loomta.com/public/v1/slides/composite \
    -H "Authorization: Bearer $LOOMTA_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
    "slides": [
    { "index": 0, "mediaId": "<IMG_0>", "caption": "The tool that ships with you" },
    { "index": 1, "mediaId": "<IMG_1>", "caption": "Zero-config setup" }
    ]
    }'

    Compositing is free (no AI credit). textStyleId and captionSize follow the same rule as the caption step — optional overrides that default to your workspace settings when omitted. Since there’s no UI picker over the API, the allowed values are fixed sets: textStyleId is one of tiktok-sans, anton, montserrat, poppins, league-spartan; captionSize is small, medium, or large. See the Slides API reference for the full list.

  3. Create the post (last). Use the composited mediaIds, in order, as the carousel. mode: schedule needs a scheduledFor; mode: now publishes immediately.

    Terminal window
    curl https://api.loomta.com/public/v1/posts \
    -H "Authorization: Bearer $LOOMTA_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
    "platformIds": ["<PLATFORM_ID>"],
    "content": "4 reasons indie devs keep coming back 👇",
    "mode": "schedule",
    "scheduledFor": "2026-07-01T15:00:00Z",
    "mediaIds": ["<COMPOSITED_0>", "<COMPOSITED_1>"],
    "settings": { "privacy_level": "PUBLIC_TO_EVERYONE" }
    }'

A — Captions only (bring your own images). The default flow above: slides:captionslides:compositeposts.

B — Steered output. Configure a system prompt and knowledge base in the Loomta app and mark them active. Every slides:caption call then reflects that voice and those facts automatically — no extra request fields. This is how the API matches what the web app produces.

C — Captions + image prompts. Pass "imagePrompt": true to also get a per-slide imagePrompt in the response. Each one is a self-contained prompt used to generate that slide’s image for the slideshow — feed them into AI image generation to produce the carousel’s visuals instead of supplying your own.

{ "topic": "Why indie devs love our app", "slideCount": 4 }

Hands-off: generate the whole slideshow (async)

Section titled “Hands-off: generate the whole slideshow (async)”

The fastest path skips all of the above. Give POST /slides/generate a topic and it does everything server-side: writes the captions + image prompts, generates an AI image per slide, composites the captions, and creates the post (draft / scheduled / now, per mode). One call, fire-and-forget.

It’s asynchronous — the request returns a jobId immediately, then you poll until it’s done. It spends one caption credit plus one image credit per slide.

  1. Submit the job with a topic. mode: draft (recommended) creates a reviewable draft when ready. slideCount defaults to 6.

    Terminal window
    curl https://api.loomta.com/public/v1/slides/generate \
    -H "Authorization: Bearer $LOOMTA_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
    "platformIds": ["<PLATFORM_ID>"],
    "topic": "Why indie devs love our app",
    "slideCount": 4,
    "mode": "draft"
    }'
    Response
    { "jobId": "", "status": "WAITING" }
  2. Poll the job until status is DONE (or FAILED).

    Terminal window
    curl https://api.loomta.com/public/v1/slides/generate/<JOB_ID> \
    -H "Authorization: Bearer $LOOMTA_API_KEY"
    Response
    { "id": "", "status": "DONE", "total": 4, "completed": 4, "postGroupId": "", "error": null }
  3. The post now exists at postGroupId — a draft (publish it when you’re happy) or a scheduled/published post, per mode.