Generate chapters | Mux

Generate chapters

Create timestamped chapters for a video with the Mux Robots API. Use chapters when viewers must jump to sections of long content, such as lectures or podcasts.

Network Error

A network error caused the media download to fail.

Generate timestamped chapters from a video's caption track. This is useful for creating a table of contents for long-form video content, improving navigation, and making video content easier to scan. See the Generate Chapters API reference for the full endpoint specification. See Mux Robots pricing for unit costs.

Chapter generation uses caption tracks on the asset to understand the video content. Make sure your asset has captions, either auto-generated or manually added, before creating a chapter generation job.

Create a generate-chapters job

This request is asynchronous. The POST returns immediately with the job in pending status and does not include results. We strongly recommend listening for the robots.job.generate_chapters.completed webhook — the payload contains the full completed job, so no follow-up API call is needed. If webhooks aren't an option, you can poll GET /robots/v0/jobs/generate-chapters/{JOB_ID} with the id from the response until the status is completed.

Parameters

Parameter Type Description
asset_id string Required. The Mux asset ID of the video.
language_code string BCP 47 language code of the caption track to analyze (e.g. en, fr). When omitted, the SDK prefers English if available. See language support for Mux Robots.
output_language_code string BCP 47 language code for the output chapter titles. Auto-detected from the transcript if omitted. See language support for Mux Robots.
output_steering object Curated controls that guide chapter style, granularity, audience, and brand terminology without changing the output schema. See Output steering.
update_asset_chapters boolean When true, the chapters are written to the asset as a chapters text track once the job completes, replacing any chapters track already on the asset. Defaults to false. See Add chapters to the asset.

Output steering

Use output_steering when you want best-effort control over how chapters are generated. These fields guide the workflow but do not guarantee exact output. output_steering replaces the legacy prompt_overrides parameter.

Field Type Description
chapter_style string Preferred style for generated chapter titles. Supported values: descriptive, punchy, educational, seo, and platform_neutral.
chapter_granularity string Preferred chapter granularity. Supported values: coarse, balanced, and fine.
audience string Intended audience used to guide chapter titles and emphasis.
brand_terms array Preferred brand or domain terms to use when supported by the source content.

Output

The outputs object is included in the job once its status is completed. You'll receive it on the robots.job.generate_chapters.completed webhook (recommended), or you can fetch it with GET /robots/v0/jobs/generate-chapters/{JOB_ID}. It contains:

Field Type Description
chapters array Generated chapters, ordered by start time.
chapters[].start_time number Chapter start time in seconds. The first chapter always starts at 0.
chapters[].title string Concise chapter title.
asset_update object What happened when the chapters were written to the asset. Present only when update_asset_chapters is true.

Example response

This is the payload delivered to the robots.job.generate_chapters.completed webhook, and the same shape you get from GET /robots/v0/jobs/generate-chapters/{JOB_ID}:

Add chapters to the asset

Set update_asset_chapters to true to have Mux write the generated chapters to the asset as a chapters text track, so they're delivered with the asset.

An asset holds a single chapters track, so any chapters track already on the asset is deleted and replaced. That includes one in a different language, or one you added yourself. The new track uses the language of the chapter titles.

The write is best-effort: if it fails, the job still completes with the generated chapters. Check outputs.asset_update for the outcome.

Field Type Description
status string created when the asset now carries these chapters. failed when the write errored; the chapters in outputs are still valid and can be added manually.
track_id string Mux text track ID of the new chapters track. Present when status is created.
replaced_track_id string Mux text track ID of the chapters track that was deleted. Absent when the asset had no chapters track. On a failed status, the old track was deleted but the new one wasn't added, so the asset has no chapters track.