POST /v1/content/:containerId/regenerate
Regenerate a container in place, optionally updating the brief.
POST
/v1/content/:containerId/regeneratePhase 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/:containerIdreturns only the current set inassets. - Caption: replaced entirely.
- Approval status: reset to
pendingif 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
containerIdstring (uuid)requiredThe container to regenerate.
Body
Body (all optional)
briefobjectoptionalOverrides for the original brief. Anything you omit keeps its previous value.brief.topicstringoptionalNew subject or premise.brief.anglestringoptionalNew point of view.brief.ctastringoptionalNew closing call-to-action.brief.valuePropositionsstring[]optionalReplace the benefit array.referencesobjectoptionalUpdated structured references. `{ sourcePostIds?: string[], assetIds?: string[] }`preserveAssetsbooleanoptionaldefault: falseIf true, the workflow keeps existing assets and regenerates only the caption.
Request
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." } }'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();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: planning → generating_visuals → assembling → finalizing.
Errors
| Code | When |
|---|---|
VALIDATION_FAILED | Bad field in brief or references. |
BILLING_EXHAUSTED | Credits insufficient. |
MODERATION_BLOCKED | Updated brief failed safety. |
NOT_FOUND | Container id not in this org. |