> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dubly.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Save timeline edits of one language

> One save of the web app's visual (timeline) editor for one target language of a completed dub: move segments, shorten or lengthen them, change their speech rate, text or speaker, split them, create new ones and delete them — with the editor's own save logic and limits. Engine v1 only (capability supportsTimelineEditor): on any other engine the request returns 400 — correct texts there with PATCH /api/v1/dubs/{id}/segments. All times are in seconds.

Every entry of updated carries the segment's complete new state; an entry whose values are all as stored is reported as "unchanged" and is neither written nor counted. The changes reach the video with the next POST /api/v1/dubs/{id}/update, which re-voices every segment whose duration, text or speaker changed (pending_revoice in GET /api/v1/dubs/{id}/segments); an empty target_text mutes a segment. A changed source_text sent with the stored (or an empty) target_text clears the translation: the segment is translated from the new source line; sent with a new target_text, that translation is kept.

created adds segments, and the answer (200) maps each client_id to the new segment id. A split is the original segment in updated, shortened to its left half (with source_rebase when its source line is divided as well), plus its right half in created with split_from set to the original's id; a split_from that is not in updated of the same request returns 400. deleted removes segments: the freed time stays a gap, and GET /api/v1/dubs/{id}/segments no longer lists them.

resync_retranslations: true re-translates and re-voices every segment whose source_text changed right away and voices every created segment that has a target_text (resynced_segment_ids); without it nothing is voiced before the next update.

Everything is checked before anything is written: a speech_rate outside 0.7–1.3, a duration under 0.8 s (a segment that is already shorter may keep its length), an unknown speaker, an invalid field, an id twice or in updated and deleted, or more than 500 entries return 400; a segment id that does not belong to this dub and target_language, or is deleted, returns 404. While a review is in progress, an update or a lip sync is running for this language, or a changed segment is being re-translated or re-voiced, the request returns 409. Nothing is written in any of these cases.

Every segment in updated that actually changes costs one of its 2 API edits — the same counter as PATCH /api/v1/dubs/{id}/segments and POST …/regenerate. A new segment starts with 1 edit used, both halves of a split continue with the original's count + 1, and deleting costs nothing. If even one segment would go over the limit, the request returns 403 FORBIDDEN and nothing is written. A save that fails with an internal error while writing can already have written part of the changes, so its edits stay counted — check GET /api/v1/dubs/{id}/segments before you send it again. See [Edit limits](/guides/edit-limits). No credits are charged.



## OpenAPI

````yaml /openapi.json post /api/v1/dubs/{id}/segments/timeline
openapi: 3.1.0
info:
  title: Dubly API
  version: 1.0.0
  description: >-
    The Dubly public API creates, edits and downloads AI-dubbed videos. Every
    request authenticates with an API token as a Bearer token
    ([Authentication](/authentication)). Every answer is JSON in an envelope: `{
    "status": "success", "response": … }` on success, `{ "status": "error",
    "message": … }` on failure — see [Errors](/guides/errors).
servers:
  - url: https://app.dubly.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Create dubs
    description: >-
      Start a dub from a YouTube video, a Google Drive file or a public video
      URL.
  - name: Dubs
    description: >-
      Read a dub's status and results, rename, move or delete it, list its
      downloads and set the original-voice volume.
  - name: Dub editing
    description: >-
      Read and correct segments, edit the timeline, re-voice a segment and apply
      the changes with an update. See [Edit limits](/guides/edit-limits).
  - name: Lip sync
    description: >-
      Start lip sync for a language, follow its progress and switch lip sync per
      block.
  - name: Subtitled video
    description: Burn subtitles into the video of a language and fetch the result.
  - name: Account
    description: List the projects and custom voices of your account.
paths:
  /api/v1/dubs/{id}/segments/timeline:
    post:
      tags:
        - Dub editing
      summary: Save timeline edits of one language
      description: >-
        One save of the web app's visual (timeline) editor for one target
        language of a completed dub: move segments, shorten or lengthen them,
        change their speech rate, text or speaker, split them, create new ones
        and delete them — with the editor's own save logic and limits. Engine v1
        only (capability supportsTimelineEditor): on any other engine the
        request returns 400 — correct texts there with PATCH
        /api/v1/dubs/{id}/segments. All times are in seconds.


        Every entry of updated carries the segment's complete new state; an
        entry whose values are all as stored is reported as "unchanged" and is
        neither written nor counted. The changes reach the video with the next
        POST /api/v1/dubs/{id}/update, which re-voices every segment whose
        duration, text or speaker changed (pending_revoice in GET
        /api/v1/dubs/{id}/segments); an empty target_text mutes a segment. A
        changed source_text sent with the stored (or an empty) target_text
        clears the translation: the segment is translated from the new source
        line; sent with a new target_text, that translation is kept.


        created adds segments, and the answer (200) maps each client_id to the
        new segment id. A split is the original segment in updated, shortened to
        its left half (with source_rebase when its source line is divided as
        well), plus its right half in created with split_from set to the
        original's id; a split_from that is not in updated of the same request
        returns 400. deleted removes segments: the freed time stays a gap, and
        GET /api/v1/dubs/{id}/segments no longer lists them.


        resync_retranslations: true re-translates and re-voices every segment
        whose source_text changed right away and voices every created segment
        that has a target_text (resynced_segment_ids); without it nothing is
        voiced before the next update.


        Everything is checked before anything is written: a speech_rate outside
        0.7–1.3, a duration under 0.8 s (a segment that is already shorter may
        keep its length), an unknown speaker, an invalid field, an id twice or
        in updated and deleted, or more than 500 entries return 400; a segment
        id that does not belong to this dub and target_language, or is deleted,
        returns 404. While a review is in progress, an update or a lip sync is
        running for this language, or a changed segment is being re-translated
        or re-voiced, the request returns 409. Nothing is written in any of
        these cases.


        Every segment in updated that actually changes costs one of its 2 API
        edits — the same counter as PATCH /api/v1/dubs/{id}/segments and POST
        …/regenerate. A new segment starts with 1 edit used, both halves of a
        split continue with the original's count + 1, and deleting costs
        nothing. If even one segment would go over the limit, the request
        returns 403 FORBIDDEN and nothing is written. A save that fails with an
        internal error while writing can already have written part of the
        changes, so its edits stay counted — check GET
        /api/v1/dubs/{id}/segments before you send it again. See [Edit
        limits](/guides/edit-limits). No credits are charged.
      operationId: save-dub-timeline
      parameters:
        - name: id
          in: path
          required: true
          description: >-
            The dub ID (path parameter). The dub must have finished processing
            (status "Dubbed"); otherwise the request returns 400.
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
          example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                target_language:
                  type: string
                  enum:
                    - af
                    - ar
                    - hy
                    - as
                    - az
                    - be
                    - bn
                    - bs
                    - bg
                    - ca
                    - ceb
                    - ny
                    - zh
                    - hr
                    - cs
                    - da
                    - nl
                    - en
                    - et
                    - fil
                    - fi
                    - fr
                    - gl
                    - ka
                    - de
                    - el
                    - gu
                    - ha
                    - he
                    - hi
                    - hu
                    - is
                    - id
                    - ga
                    - it
                    - ja
                    - jv
                    - kn
                    - kk
                    - ko
                    - ky
                    - lv
                    - ln
                    - lt
                    - lb
                    - mk
                    - ms
                    - ml
                    - mr
                    - ne
                    - 'no'
                    - ps
                    - fa
                    - pl
                    - pt
                    - pa
                    - ro
                    - ru
                    - sr
                    - sd
                    - sk
                    - sl
                    - so
                    - es
                    - sw
                    - sv
                    - ta
                    - te
                    - th
                    - tr
                    - uk
                    - ur
                    - vi
                    - cy
                    - en-GB
                    - en-US
                    - es-419
                    - es-ES
                  description: >-
                    BCP 47 code of the language whose timeline is saved. A
                    language the dub does not have returns 404.
                created:
                  default: []
                  type: array
                  items:
                    type: object
                    properties:
                      client_id:
                        type: string
                        minLength: 1
                        description: >-
                          Your own id for the entry, unique in this request. The
                          answer maps it to the new segment id.
                      split_from:
                        type: string
                        format: uuid
                        pattern: >-
                          ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                        description: >-
                          Only for the right half of a split: the id of the
                          original segment, which must be in updated of this
                          request with its shortened left half (otherwise 400).
                          The half starts with the original's API edits used.
                          That includes this save: both halves continue with the
                          original's count + 1.
                      start_time:
                        type: number
                        minimum: 0
                        description: Start in seconds (≥ 0).
                      duration:
                        type: number
                        exclusiveMinimum: 0
                        description: Length in seconds, at least 0.8 s.
                      speech_rate:
                        type: number
                        minimum: 0.7
                        maximum: 1.3
                        description: Speech rate from 0.7 to 1.3 (1 = normal).
                      target_text:
                        type: string
                        description: >-
                          Translation of the new segment, voiced as it stands.
                          An empty string: translated from source_text first, or
                          silent without one.
                      source_text:
                        default: ''
                        type: string
                        description: >-
                          Source line of the new segment — for the right half of
                          a split, the part of the original line it keeps.
                          Defaults to an empty string (no source line).
                      speaker:
                        type: integer
                        minimum: 1
                        maximum: 9007199254740991
                        description: >-
                          Speaker id from speakers of GET
                          /api/v1/dubs/{id}/segments ("1", "2", …); an unknown
                          id returns 400. Sent as a number (1) or as that string
                          ("1").
                    required:
                      - client_id
                      - start_time
                      - duration
                      - speech_rate
                      - target_text
                      - speaker
                    additionalProperties: false
                  description: >-
                    New segments { client_id, split_from?, start_time, duration,
                    speech_rate, target_text, source_text?, speaker } with the
                    same field rules as updated. A created segment with a
                    target_text is voiced as it stands; with only a source_text
                    it is translated first; with neither it stays silent.
                updated:
                  default: []
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                        pattern: >-
                          ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                        description: >-
                          Segment id from GET /api/v1/dubs/{id}/segments. An id
                          of another dub or language, or a deleted one, returns
                          404.
                      start_time:
                        type: number
                        minimum: 0
                        description: >-
                          Start in seconds (≥ 0), like start in GET
                          /api/v1/dubs/{id}/segments.
                      duration:
                        type: number
                        exclusiveMinimum: 0
                        description: >-
                          Length in seconds (end − start in GET
                          /api/v1/dubs/{id}/segments), at least 0.8 s — a
                          segment that is already shorter may keep its length,
                          but not get any shorter.
                      speech_rate:
                        type: number
                        minimum: 0.7
                        maximum: 1.3
                        description: Speech rate from 0.7 to 1.3 (1 = normal).
                      target_text:
                        type: string
                        description: >-
                          Translation. An empty string mutes the segment —
                          unless source_text changes in the same entry: then the
                          segment is translated from the new source line.
                      source_text:
                        type: string
                        description: >-
                          Rewritten source text; left out, the source stays as
                          it is. With the stored or an empty target_text the
                          segment is translated from it (at the next update, or
                          right away with resync_retranslations).
                      source_rebase:
                        type: object
                        properties:
                          text:
                            type: string
                            description: >-
                              The part of the original source line this half
                              keeps.
                          start_time:
                            type: number
                            minimum: 0
                            description: >-
                              Start of this half inside the original segment, in
                              seconds (≥ 0).
                          duration:
                            type: number
                            exclusiveMinimum: 0
                            description: >-
                              Length of this half's share of the original source
                              line, in seconds.
                        required:
                          - text
                          - start_time
                          - duration
                        additionalProperties: false
                        description: >-
                          The left half of a split only: { text, start_time,
                          duration } — the part of the original source line this
                          half keeps, with its start inside the original segment
                          and its length in seconds. Gives the half a source
                          line of its own; nothing is re-translated.
                      speaker:
                        type: integer
                        minimum: 1
                        maximum: 9007199254740991
                        description: >-
                          Speaker id from speakers of GET
                          /api/v1/dubs/{id}/segments ("1", "2", …); an unknown
                          id returns 400. Sent as a number (1) or as that string
                          ("1").
                    required:
                      - id
                      - start_time
                      - duration
                      - speech_rate
                      - target_text
                      - speaker
                    additionalProperties: false
                  description: >-
                    Existing segments with their complete new state { id,
                    start_time, duration, speech_rate, target_text,
                    source_text?, source_rebase?, speaker }; each id at most
                    once. Segments left out stay as they are. At least one of
                    created, updated and deleted must have an entry, and
                    together they carry at most 500 entries.
                deleted:
                  default: []
                  type: array
                  items:
                    type: string
                    format: uuid
                    pattern: >-
                      ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                  description: >-
                    Ids of segments to delete. The freed time stays a gap.
                    Deleting costs no API edit.
                resync_retranslations:
                  type: boolean
                  description: >-
                    true: re-translate and re-voice every segment whose
                    source_text changed right away, and voice every created
                    segment with a target_text right away. If starting one of
                    them fails, the save still stands: resync_error says so and
                    the rest are voiced by the next update. Defaults to false —
                    nothing is voiced before POST /api/v1/dubs/{id}/update.
              required:
                - target_language
              additionalProperties: false
            examples:
              split:
                summary: Split a segment and delete another
                value:
                  target_language: de
                  updated:
                    - id: 5b1e7c2a-9d43-4f8e-a6b0-2c7d9e1f3a54
                      start_time: 0.48
                      duration: 1.32
                      speech_rate: 1
                      target_text: Willkommen zu unserer
                      source_rebase:
                        text: Welcome to our
                        start_time: 0
                        duration: 1.32
                      speaker: 1
                  created:
                    - client_id: split-right
                      split_from: 5b1e7c2a-9d43-4f8e-a6b0-2c7d9e1f3a54
                      start_time: 1.8
                      duration: 1.32
                      speech_rate: 1
                      target_text: Produkttour.
                      source_text: product tour.
                      speaker: 1
                  deleted:
                    - c9e0d2f1-47ab-4c3e-8f21-6a5b4d3c2e10
                  resync_retranslations: false
              resync:
                summary: Rewrite a source line, add a segment and voice both right away
                value:
                  target_language: de
                  updated:
                    - id: 5b1e7c2a-9d43-4f8e-a6b0-2c7d9e1f3a54
                      start_time: 0.48
                      duration: 2.64
                      speech_rate: 1
                      target_text: ''
                      source_text: Welcome to our product demo.
                      speaker: 1
                  created:
                    - client_id: new-1
                      start_time: 3.5
                      duration: 1.6
                      speech_rate: 1.1
                      target_text: Viel Spaß!
                      speaker: 2
                  resync_retranslations: true
      responses:
        '200':
          description: >-
            The save went through; created maps each client_id to its new
            segment id.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    const: success
                  response:
                    type: object
                    properties:
                      dub_id:
                        type: string
                      target_language:
                        type: string
                      created:
                        type: array
                        items:
                          type: object
                          properties:
                            client_id:
                              type: string
                            id:
                              type: string
                              description: >-
                                The new segment id — use it like any id from GET
                                /api/v1/dubs/{id}/segments.
                            split_from:
                              type:
                                - string
                                - 'null'
                              description: >-
                                The segment this one was split from (split_from
                                of the request), else null.
                            api_edits_remaining:
                              type: integer
                              minimum: -9007199254740991
                              maximum: 9007199254740991
                              description: API edits left for the new segment (at most 2).
                          required:
                            - client_id
                            - id
                            - split_from
                            - api_edits_remaining
                      updated:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                            result:
                              type: string
                              enum:
                                - updated
                                - unchanged
                              description: >-
                                "updated", or "unchanged": every field already
                                had the stored value — neither written nor
                                counted.
                            api_edits_remaining:
                              type: integer
                              minimum: -9007199254740991
                              maximum: 9007199254740991
                              description: >-
                                API edits left for this segment after this save
                                (at most 2).
                          required:
                            - id
                            - result
                            - api_edits_remaining
                      deleted:
                        type: array
                        items:
                          type: string
                        description: The deleted segment ids.
                      resynced_segment_ids:
                        type: array
                        items:
                          type: string
                        description: >-
                          resync_retranslations: true only — the segments whose
                          translation and voice-over were started right away;
                          otherwise empty.
                      resync_error:
                        type: string
                        description: >-
                          resync_retranslations: true only — the save went
                          through, but starting the immediate re-voicing failed;
                          the remaining segments are voiced by the next POST
                          /api/v1/dubs/{id}/update.
                    required:
                      - dub_id
                      - target_language
                      - created
                      - updated
                      - deleted
                      - resynced_segment_ids
                required:
                  - status
                  - response
              examples:
                split:
                  summary: Split and delete saved
                  value:
                    status: success
                    response:
                      dub_id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                      target_language: de
                      created:
                        - client_id: split-right
                          id: 7a3c9e1b-5d2f-4b8a-9c6e-1f0d3b5a7c92
                          split_from: 5b1e7c2a-9d43-4f8e-a6b0-2c7d9e1f3a54
                          api_edits_remaining: 1
                      updated:
                        - id: 5b1e7c2a-9d43-4f8e-a6b0-2c7d9e1f3a54
                          result: updated
                          api_edits_remaining: 1
                      deleted:
                        - c9e0d2f1-47ab-4c3e-8f21-6a5b4d3c2e10
                      resynced_segment_ids: []
                resync:
                  summary: >-
                    Saved; the re-translation started, voicing the new segment
                    did not
                  value:
                    status: success
                    response:
                      dub_id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                      target_language: de
                      created:
                        - client_id: new-1
                          id: e4f8a2c6-1b3d-4e5f-9a7b-8c0d2e4f6a18
                          split_from: null
                          api_edits_remaining: 1
                      updated:
                        - id: 5b1e7c2a-9d43-4f8e-a6b0-2c7d9e1f3a54
                          result: updated
                          api_edits_remaining: 1
                      deleted: []
                      resynced_segment_ids:
                        - 5b1e7c2a-9d43-4f8e-a6b0-2c7d9e1f3a54
                      resync_error: >-
                        The edits were saved, but re-voicing segment
                        e4f8a2c6-1b3d-4e5f-9a7b-8c0d2e4f6a18 right away failed:
                        Failed to sync the segment. Please try again. The
                        remaining segments are voiced by POST
                        /api/v1/dubs/{id}/update.
        '400':
          description: >-
            BAD_REQUEST — The dub ID is not a UUID; the dub has not finished
            processing (status "Dubbed") or its engine has no timeline editing
            (supportsTimelineEditor); or a field is invalid — a speech_rate
            outside 0.7–1.3, a duration under 0.8 s (a segment that is already
            shorter may keep its length), an unknown speaker, an unknown field,
            an id twice or in updated and deleted, a client_id twice, a
            split_from that is not in updated, no entry at all or more than 500
            entries. Nothing was written. Example message:
            "created[0].split_from: segment 5b1e7c2a-9d43-4f8e-a6b0-2c7d9e1f3a54
            must also be in updated of this request (with its shortened left
            half)".
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: UNAUTHORIZED — Missing or invalid API token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            FORBIDDEN — A segment in updated that changes has used all its 2 API
            edits (shared with PATCH /api/v1/dubs/{id}/segments and POST
            …/regenerate). Nothing was written, nothing was counted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: >-
            NOT_FOUND — An unknown dub, a dub of another account or a
            target_language the dub does not have, or a segment id in updated or
            deleted that does not belong to this dub and target_language, or is
            deleted. Nothing was written.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: >-
            CONFLICT — A review is in progress, an update or a lip sync is
            running for this language, or a changed segment is being
            re-translated or re-voiced. Nothing was written.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: >-
            INTERNAL_ERROR — The dub, its segments or its API usage could not be
            read, or the API edit limit could not be checked — nothing was
            written. Or the save failed while writing: part of it may already be
            written, so its API edits stay counted — check the segments with GET
            /api/v1/dubs/{id}/segments before you retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        status:
          type: string
          const: error
        message:
          type: string
      required:
        - status
        - message
      description: >-
        The error envelope. The HTTP status carries the error code; `message`
        says what went wrong, in English.
      examples:
        - status: error
          message: Dub not found
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        An API token from Settings → API in the Dubly web app, sent as
        `Authorization: Bearer <token>`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.