Layers
Partner APIAPI referenceContent

POST /v1/content/:containerId/regenerate

Regenerate a container in place, optionally updating the brief.

View as Markdown
POST/v1/content/:containerId/regenerate
Phase 1stableidempotent
Auth
Bearer
Scope
content:write

Runs the generation pipeline again for an existing container. The container id stays the same; the media and caption get replaced.

Use regenerate when a container is almost right but you want a new take — different visuals, tighter caption. The container's id, approval state, and scheduled-post links are preserved. Old media assets are superseded but not deleted (previous versions remain accessible via their asset ids until storage lifecycle rules clean them up).

What happens to the old content

  • Media assets: new assets are written; GET /v1/content/:containerId returns only the current set in assets.
  • Caption: replaced entirely.
  • Approval status: reset to pending if the project's approval policy requires review. Previously approved? You'll need to approve again.
  • Scheduled posts: untouched. If they were queued against the old caption, they'll publish the old caption. Cancel and re-schedule if the caption change matters.

Path parameters

  • containerId
    string (uuid)required
    The container to regenerate.

Body

Body (all optional)
  • brief
    objectoptional
    Overrides for the original brief. Anything you omit keeps its previous value.
  • brief.topic
    stringoptional
    New subject or premise.
  • brief.angle
    stringoptional
    New point of view.
  • brief.cta
    stringoptional
    New closing call-to-action.
  • brief.valuePropositions
    string[]optional
    Replace the benefit array.
  • references
    objectoptional
    Updated structured references. `{ sourcePostIds?: string[], assetIds?: string[] }`
  • preserveAssets
    booleanoptionaldefault: false
    If true, the workflow keeps existing assets and regenerates only the caption.

Request

terminal
curl -X POST https://api.layers.com/v1/content/{containerId}/regenerate \
  -H "X-Api-Key: $LAYERS_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 8d2f1a3e-0b4c-4a11-9f7e-33c0a2c1bd55" \
  -d '{ "brief": { "topic": "Thirty days, one run at a time." } }'
regenerate-content.ts
const res = await fetch(
  `https://api.layers.com/v1/content/${containerId}/regenerate`,
  {
    method: 'POST',
    headers: {
      'X-Api-Key': process.env.LAYERS_API_KEY!,
      'Content-Type': 'application/json',
      'Idempotency-Key': crypto.randomUUID(),
    },
    body: JSON.stringify({
      brief: { cta: 'Start today — link in bio.' },
      preserveAssets: false,
    }),
  },
);
const { jobId, containerId: id } = await res.json();
regenerate_content.py
import os, uuid, httpx

r = httpx.post(
    f"https://api.layers.com/v1/content/{container_id}/regenerate",
    headers={
        "X-Api-Key": os.environ["LAYERS_API_KEY"],
        "Content-Type": "application/json",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={"brief": {"cta": "Start today — link in bio."}},
)
job = r.json()

Responses

202Regeneration job accepted.
{
  "jobId": "job_01HXZ9G7KMV2QX8Y1S5RJW3B7T",
  "kind": "content_regenerate",
  "status": "running",
  "containerId": "cnt_01HXZ9...",
  "locationUrl": "/v1/jobs/job_01HXZ9G7KMV2QX8Y1S5RJW3B7T"
}

Stages

Uses the content_regenerate job kind. Same stages as generate: planninggenerating_visualsassemblingfinalizing.

Errors

CodeWhen
VALIDATION_FAILEDBad field in brief or references.
BILLING_EXHAUSTEDCredits insufficient.
MODERATION_BLOCKEDUpdated brief failed safety.
NOT_FOUNDContainer id not in this org.

See also

On this page