---
title: "Auto Subtitle Generator"
method: POST
path: "/v1/auto-subtitle-generator"
tags: ["Video Projects"]
---

# Auto Subtitle Generator

`POST /v1/auto-subtitle-generator`

Automatically generate subtitles for your video in multiple languages.

## Request body

- object
  - `name` string — Give your video a custom name for easy identification.
  - `start_seconds` number, float, required — Start time of your clip (seconds). Must be ≥ 0.
  - `end_seconds` number, float, required — End time of your clip (seconds). Must be greater than start_seconds.
  - `assets` object, required — Provide the assets for auto subtitle generator
    - `video_file_path` string, required — This is the video used to add subtitles. This value is either - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details.
  - `style` object, required — Style of the subtitle. At least one of `.style.template` or `.style.custom_config` must be provided. * If only `.style.template` is provided, default values for the template will be used. * If both are provided, the fields in `.style.custom_config` will be used to overwrite the fields in `.style.template`. * If only `.style.custom_config` is provided, then all fields in `.style.custom_config` will be used. To use custom config only, the following `custom_config` params are required: * `.style.custom_config.font` * `.style.custom_config.text_color` * `.style.custom_config.vertical_position` * `.style.custom_config.horizontal_position`
    - `template` 'karaoke' | 'cinematic' | 'minimalist' | 'highlight' — Preset subtitle templates. Please visit https://magichour.ai/create/auto-subtitle-generator to see the style of the existing templates.
    - `custom_config` object — Custom subtitle configuration.
      - `font` string — Font name from Google Fonts. Not all fonts support all languages or character sets. We recommend verifying language support and appearance directly on https://fonts.google.com before use.
      - `font_size` number — Font size in pixels. If not provided, the font size is automatically calculated based on the video resolution.
      - `font_style` string — Font style (e.g., normal, italic, bold)
      - `text_color` string — Primary text color in hex format
      - `highlighted_text_color` string — Color used to highlight the current spoken text
      - `stroke_color` string — Stroke (outline) color of the text
      - `stroke_width` number — Width of the text stroke in pixels. If `stroke_color` is provided, but `stroke_width` is not, the `stroke_width` will be calculated automatically based on the font size.
      - `vertical_position` string — Vertical alignment of the text (e.g., top, center, bottom)
      - `horizontal_position` string — Horizontal alignment of the text (e.g., left, center, right)

## Response `200`

Success

- object — Success
  - `id` string, required — Unique ID of the video. Use it with the [Get video Project API](https://docs.magichour.ai/api-reference/video-projects/get-video-details) to fetch status and downloads.
  - `credits_charged` integer, required — The amount of credits deducted from your account to generate the video. If the status is not 'complete', this value is an estimate and may be adjusted upon completion based on the actual FPS of the output video. If video generation fails, credits will be refunded, and this field will be updated to include the refund.

## Other responses

- `400` — Invalid Request
- `401` — Unauthorized
- `402` — Payment Required
- `404` — Not Found
- `422` — Unprocessable Entity

---

[API](https://skmtc.net/magichourhq/apis/magic-hour-api.md) · [All operations](https://skmtc.net/magichourhq/apis/magic-hour-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/magichourhq/magic-hour-api/versions/941298cfb29f/schema)
