Layers
Partner APIAPI referenceContent

POST /v1/projects/:projectId/content/slideshow-builder

Generate a hook-driven multi-image vertical slideshow.

View as Markdown
POST/v1/projects/:projectId/content/slideshow-builder
Phase 1stableidempotent
Auth
Bearer
Scope
content:write

Starts a content-generate job. Returns 202 with containerIds (single-element array — the partner surface never fans out variants), a jobId, and a locationUrl.

The format is the URL — there is no format discriminator in the body. The only required input is hook. socialAccountId and influencerId are optional axes that resolve voice / language / influencer when supplied.

slideshow-builder is the only format that allows a layerless run with neither socialAccountId nor influencerId — the workflow falls back to the project's default voice and language. Every other format requires a named on-camera actor.

Path parameters

  • projectId
    string (uuid)required
    The project to generate content for.

Body

Body
  • hook
    stringrequired
    Used verbatim as the slideshow first-slide overlay. 1–2000 chars; line breaks and emoji preserved. Pull from `/content/hooks` or send your own.
  • socialAccountId
    stringoptional
    Connected social-account id. Walks the wiring chain to anchor the container on the wired content layer and use that layer's influencer voice/language.
  • influencerId
    stringoptional
    Explicit influencer override. Wins over the wired influencer when both are supplied. Required for partners with no connected social account who want a non-default voice.

Resolution rules

socialAccountIdinfluencerIdBehavior
ProvidedWalk chain. Use wired influencer's voice/language. Container anchored to the wired content layer.
ProvidedUse that influencer directly. Layerless container (unassigned pool).
ProvidedProvidedWalk chain for layer anchoring; use the override for voice/language.
Project default voice/language. Layerless container.

Request

terminal
curl -X POST https://api.layers.com/v1/projects/{projectId}/content/slideshow-builder \
  -H "Authorization: Bearer $LAYERS_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "hook": "wait for it...\nthis simple habit changed everything 🧠"
  }'
slideshow-builder.ts
const res = await fetch(
  `https://api.layers.com/v1/projects/${projectId}/content/slideshow-builder`,
  {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.LAYERS_API_KEY}`,
      'Content-Type': 'application/json',
      'Idempotency-Key': crypto.randomUUID(),
    },
    body: JSON.stringify({
      hook: 'wait for it...\nthis simple habit changed everything 🧠',
      influencerId: 'inf_4a8e1bc2...',
    }),
  },
);
const { jobId, containerIds } = await res.json();
const [containerId] = containerIds;
slideshow_builder.py
import os, uuid, httpx

r = httpx.post(
    f"https://api.layers.com/v1/projects/{project_id}/content/slideshow-builder",
    headers={
        "Authorization": f"Bearer {os.environ['LAYERS_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={"hook": "wait for it...\nthis simple habit changed everything 🧠"},
)
job = r.json()

Responses

202Job accepted. The container exists in `processing` status — poll the job and the container.
{
  "jobId": "job_01HZX3...",
  "kind": "content_generate",
  "status": "running",
  "containerIds": ["cnt_7d18b9a1..."],
  "locationUrl": "/v1/jobs/job_01HZX3..."
}
422Resolution failure or precondition not met.
{
  "error": {
    "code": "VALIDATION",
    "message": "MISSING_APP_DESCRIPTION: slideshow-builder requires projects.app_description.",
    "requestId": "req_...",
    "details": {
      "code": "MISSING_APP_DESCRIPTION",
      "format": "slideshow-builder"
    }
  }
}

The top-level error.code is the generic VALIDATION envelope. The specific failure code lives at error.details.code — that's what partners switch on programmatically.

details.codeCause
MISSING_APP_DESCRIPTIONprojects.app_description empty. Run an ingest job or PATCH /v1/projects/:id.
ACCOUNT_NOT_WIREDsocialAccountId exists but no distribution layer references it.
NO_CONTENT_LAYER_WIREDDistribution layer's contentLayerSourceIds[] is empty.
INFLUENCER_NOT_WIREDWired content layer has no customInfluencerId.
404`socialAccountId` or `influencerId` not on this project.
{
  "error": {
    "code": "NOT_FOUND",
    "message": "socialAccountId is not on this project.",
    "requestId": "req_..."
  }
}

Errors

CodeWhen
VALIDATIONMissing hook, body shape invalid, body id set.
NOT_FOUNDsocialAccountId / influencerId not on this project.
MISSING_APP_DESCRIPTIONProject missing app_description.
ACCOUNT_NOT_WIRED / NO_CONTENT_LAYER_WIRED / INFLUENCER_NOT_WIREDsocialAccountId resolution failed mid-chain.
IDEMPOTENCY_CONFLICTSame Idempotency-Key reused with different body.
BILLING_EXHAUSTEDOrg wallet at zero.

See also

On this page