# Generate and download subtitles

Generate source or translated SRT/VTT tracks from registered media and download each completed locale.

URL: /guides/subtitles/generate



Register media first, then start the subtitle workflow with every required target locale.

## Generate tracks [#generate-tracks]

```bash
export LINGOPAL_API_KEY="your-api-key"
export JOB_ID="replace-with-job-id"

curl -X POST "https://api.lingopal.ai/v2/jobs/$JOB_ID/subtitles" \
  -H "X-API-Key: $LINGOPAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "target_languages": ["es", "fr"],
  "format": "srt",
  "include_source_language": true,
  "word_count_per_line": 7,
  "burn_subtitles": false,
  "reset": false
}'
```

## POST /v2/jobs/{job_id}/subtitles

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Generate subtitles for a registered job",
    "description": "Lingopal v2 public API for text translation, storage uploads, registered jobs, job workflows, and job outputs.",
    "version": "v2"
  },
  "servers": [
    {
      "url": "https://vod-api.lingopal-dev.com"
    }
  ],
  "security": [
    {
      "APIKeyHeader": []
    }
  ],
  "paths": {
    "/v2/jobs/{job_id}/subtitles": {
      "post": {
        "tags": [
          "Job Workflows"
        ],
        "summary": "Generate subtitles for a registered job",
        "description": "Starts translated subtitle generation for a reusable registered media file.",
        "operationId": "generateJobSubtitles",
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Reusable registered job ID returned by `/v2/jobs/register` or `/v2/jobs/upload-and-register`.",
              "examples": [
                "job_123"
              ],
              "title": "Job Id"
            },
            "description": "Reusable registered job ID returned by `/v2/jobs/register` or `/v2/jobs/upload-and-register`."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TranslateSubtitlesRequest"
              },
              "examples": {
                "generateJobSubtitlesMinimal": {
                  "summary": "Generate subtitles minimal",
                  "description": "Start translated subtitle generation for a registered media job.",
                  "value": {
                    "target_languages": [
                      "es"
                    ]
                  }
                },
                "generateJobSubtitlesWithOptions": {
                  "summary": "Generate subtitles with options",
                  "description": "Start subtitle generation with output format and subtitle layout controls.",
                  "value": {
                    "target_languages": [
                      "es",
                      "fr"
                    ],
                    "format": "srt",
                    "reset": true,
                    "burn_subtitles": false,
                    "include_source_language": false,
                    "word_count_per_line": 7
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Started subtitle generation workflow.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TranslationJobResponse"
                },
                "example": {
                  "workflow": "translate_subtitles",
                  "status": "started",
                  "job_id": "job_123",
                  "target_languages": [
                    "es"
                  ],
                  "format": "srt",
                  "message": "Subtitle workflow started",
                  "links": {
                    "job": "/v2/jobs/job_123",
                    "status": "/v2/jobs/job_123/status"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid authentication token."
          },
          "422": {
            "description": "Request validation error."
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Job Workflows",
      "description": "Start translation and subtitle workflows for registered jobs."
    }
  ],
  "components": {
    "schemas": {
      "TranslateSubtitlesRequest": {
        "properties": {
          "target_languages": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "minItems": 1,
            "title": "Target Languages",
            "description": "Target locale codes. Use `GET /v2/languages/text` to list supported subtitle translation languages. Alias accepted: `languages`.",
            "examples": [
              [
                "es",
                "fr"
              ]
            ]
          },
          "format": {
            "type": "string",
            "enum": [
              "srt",
              "vtt"
            ],
            "title": "Format",
            "description": "Preferred subtitle output format.",
            "default": "srt"
          },
          "reset": {
            "type": "boolean",
            "title": "Reset",
            "description": "Whether to prune existing subtitle target state before starting processing.",
            "default": false
          },
          "burn_subtitles": {
            "type": "boolean",
            "title": "Burn Subtitles",
            "description": "Whether to burn generated subtitles into media output when supported.",
            "default": false
          },
          "include_source_language": {
            "type": "boolean",
            "title": "Include Source Language",
            "description": "Whether to include source-language subtitles in generated outputs when supported.",
            "default": false
          },
          "word_count_per_line": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "title": "Word Count Per Line",
            "description": "Maximum subtitle words per line.",
            "default": 7
          }
        },
        "type": "object",
        "required": [
          "target_languages"
        ],
        "title": "TranslateSubtitlesRequest"
      },
      "TranslationJobResponse": {
        "properties": {
          "workflow": {
            "type": "string",
            "enum": [
              "translate_media",
              "translate_text",
              "translate_document",
              "translate_subtitles",
              "transcribe_media",
              "republish_media"
            ],
            "title": "Workflow",
            "description": "Translation workflow that was started."
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "started",
              "completed",
              "error"
            ],
            "title": "Status",
            "description": "Current workflow status."
          },
          "job_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Job Id",
            "description": "Reusable registered job ID associated with this workflow."
          },
          "target_languages": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Languages",
            "description": "Target locale codes requested for this workflow."
          },
          "format": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Format",
            "description": "Requested output format when applicable."
          },
          "message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Message",
            "description": "Human-readable status message."
          },
          "links": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object",
            "title": "Links",
            "description": "Related API links."
          }
        },
        "type": "object",
        "required": [
          "workflow",
          "status"
        ],
        "title": "TranslationJobResponse",
        "examples": [
          {
            "job_id": "job_123",
            "links": {
              "job": "/v2/jobs/job_123",
              "status": "/v2/jobs/job_123/status"
            },
            "message": "Translation workflow started",
            "status": "started",
            "target_languages": [
              "es",
              "fr"
            ],
            "workflow": "translate_media"
          }
        ]
      }
    },
    "securitySchemes": {
      "APIKeyHeader": {
        "in": "header",
        "name": "X-API-Key",
        "type": "apiKey"
      }
    }
  }
}
```

Use the [API Reference entry for generateJobSubtitles](/reference/job-workflows/generateJobSubtitles) for complete request and response details.

Choose SRT for broad compatibility or VTT for HTML5 playback. `include_source_language` adds a source-language track when supported. `word_count_per_line` controls subtitle line density.

Follow the [job lifecycle](/guides/jobs/job-lifecycle) until `workflows.subtitles.status` is `completed`. Subtitle generation is its own workflow; do not call media translation merely to create translated subtitle tracks.

## Download a track [#download-a-track]

Request one completed subtitle track at a time:

```bash
curl "https://api.lingopal.ai/v2/jobs/$JOB_ID/outputs/subtitle?locale=es&file_type=srt" \
  -H "X-API-Key: $LINGOPAL_API_KEY" \
  --output subtitles-es.srt
```

## GET /v2/jobs/{job_id}/outputs/subtitle

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Download job subtitle",
    "description": "Lingopal v2 public API for text translation, storage uploads, registered jobs, job workflows, and job outputs.",
    "version": "v2"
  },
  "servers": [
    {
      "url": "https://vod-api.lingopal-dev.com"
    }
  ],
  "security": [
    {
      "APIKeyHeader": []
    }
  ],
  "paths": {
    "/v2/jobs/{job_id}/outputs/subtitle": {
      "get": {
        "tags": [
          "Job Outputs"
        ],
        "summary": "Download job subtitle",
        "description": "Downloads generated subtitles for a registered job as SRT or VTT.",
        "operationId": "downloadJobSubtitle",
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Reusable registered job ID returned by `/v2/jobs/register` or `/v2/jobs/upload-and-register`.",
              "examples": [
                "job_123"
              ],
              "title": "Job Id"
            },
            "description": "Reusable registered job ID returned by `/v2/jobs/register` or `/v2/jobs/upload-and-register`."
          },
          {
            "name": "file_type",
            "in": "query",
            "required": false,
            "schema": {
              "enum": [
                "srt",
                "vtt"
              ],
              "type": "string",
              "default": "srt",
              "title": "File Type"
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "source",
              "title": "Locale"
            }
          },
          {
            "name": "line_length",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 7,
              "title": "Line Length"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Subtitle file content.",
            "content": {
              "application/json": {
                "schema": {}
              },
              "application/x-subrip": {
                "example": "1\n00:00:00,000 --> 00:00:02,400\nBienvenido a Lingopal.\n"
              },
              "text/vtt": {
                "example": "WEBVTT\n\n00:00:00.000 --> 00:00:02.400\nBienvenido a Lingopal.\n"
              }
            }
          },
          "404": {
            "description": "The requested resource was not found.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Subtitle Not Found"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Job Outputs",
      "description": "Download transcripts, subtitles, and exported job outputs."
    }
  ],
  "components": {
    "schemas": {
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          },
          "input": {
            "title": "Input"
          },
          "ctx": {
            "type": "object",
            "title": "Context"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    },
    "securitySchemes": {
      "APIKeyHeader": {
        "in": "header",
        "name": "X-API-Key",
        "type": "apiKey"
      }
    }
  }
}
```

| Parameter     | Use                                 |
| ------------- | ----------------------------------- |
| `locale`      | Source or translated track locale   |
| `file_type`   | Requested subtitle file type        |
| `line_length` | Optional output line-length control |

Use the [API Reference entry for downloadJobSubtitle](/reference/job-outputs/downloadJobSubtitle) for complete query and error details. A `404` generally means the job or requested output is unavailable; confirm workflow status, locale, and file type before retrying.
