Skip to content

Upload subtitles

PUT/api/v1/content/{id}/video-text

Access
API key
Permission
content:write

Import SRT/WebVTT or a manual transcript for a ready video

CAS under Content then current User lock. Normalized bytes count toward quota, replacement queues old objects for durable cleanup. One text track per video. Cues must have nondecreasing starts, end after start and no later than verified video duration+1second. Overlap is allowed; cue styling is represented as literal text.

Example request

curl -X PUT "https://lac.pics/api/v1/content/Xq3u9RkT0bLmA7cV2pWz1eFy/video-text" \
  -H "Authorization: Bearer lac_api_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "expectedRevision": 0,
  "format": "srt",
  "text": "1\n00:00:00,000 --> 00:00:02,500\nHello!\n",
  "language": "en",
  "label": "English"
}'

Parameters

Path

  • idstringrequired

    The file or note id.

Request body

application/jsonrequired

  • expectedRevisionintegerrequired

    The revision you read (revision; 0 for a video without text). Another one gets 409.

    0–2,147,483,646

  • formatstringrequired

    srt, vtt or text: a transcript without timings.

    values: "srt" "vtt" "text"

  • textstringrequired

    At most 256 KB of UTF-8 and 2000 cues; plain cue text, normalized WebVTT or manual transcript. No speech recognition.

    up to 200,000 characters

  • languagestring

    The track language, BCP 47: ru, en-US.

    up to 35 characters · pattern ^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$

  • labelstring

    The track caption in the player, up to 80 characters.

    up to 80 characters

Responses

  • 200Success.VideoTextResponse
    • revisionintegerrequired

      The revision the edit is based on: revision from GET /pastes/{id}.

      0–2,147,483,647

    • trackobjectrequiredor null

      The subtitle track or null.

      4 fields
      • formatstringrequired

        plain: text, markdown: Markdown, code: highlighted code.

        values: "vtt" "text"

      • languagestringrequired
      • labelstringrequired

        The track caption in the player, up to 80 characters.

      • textstringrequired

        The note text, 1–200,000 characters.

    • transcriptstringrequired

      The transcript.

  • 400Typed error; protected video access fails closed. Preserve owner drafts after conflicts.
  • 401Typed error; protected video access fails closed. Preserve owner drafts after conflicts.
  • 403Typed error; protected video access fails closed. Preserve owner drafts after conflicts.
  • 404Typed error; protected video access fails closed. Preserve owner drafts after conflicts.
  • 409Typed error; protected video access fails closed. Preserve owner drafts after conflicts.
  • 413Typed error; protected video access fails closed. Preserve owner drafts after conflicts.
  • 429Typed error; protected video access fails closed. Preserve owner drafts after conflicts.
  • 500Typed error; protected video access fails closed. Preserve owner drafts after conflicts.
  • 503Typed error; protected video access fails closed. Preserve owner drafts after conflicts.

Example response

200 · application/json
{
  "revision": 1,
  "track": null,
  "transcript": "Hello!"
}

Error codes

Answers of any method with a key (an invalid or expired key, a missing permission, too many requests) are in Errors.

Upload subtitles: PUT /api/v1/content/{id}/video-text · lacuna API