> ## 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.

# Switch lip sync on or off per block

> Switches lip sync on or off for blocks of one target language and re-assembles the finished lip-sync video from the segments it already has — the visual editor's "Re-render" when only the lip-sync track changed. There is no POST /api/v1/dubs/{id}/update, no new lip-sync run and no credits. Send the blocks to change, each id at most once.

The re-assembly runs asynchronously: the answer is 202 with lipsync_status "reconstructing"; poll GET /api/v1/dubs/{id}/lipsync, which answers "Processing" with step "reconstructing" until it is "Synced" again. If every block already has the requested value, the answer is 200 with applied false: nothing is re-assembled and nothing is counted.

An empty blocks array or a duplicate id returns 400, and so does a dub whose engine has no supportsTimelineEditor (v2). A block id that belongs to another language or another dub returns 404 — once the language's lip sync is finished; before that, every request returns 409. While the lip sync of the language is running or not finished, an update is running, a review is in progress, or the block files have already been cleaned up (then only a new lip sync via POST /api/v1/dubs/{id}/lipsync can change the blocks), the request returns 409; so does a block whose lip sync is no longer stored and can only come back with a new run. Nothing is changed in any of these cases.

Every re-assembly that actually starts costs one of the language's 2 API lip-sync applies — a counter of its own, separate from the segment edits; once they are used up, the next change returns 403 FORBIDDEN and changes nothing — the blocks can still be switched in the Dubly web app. A request refused with 400, 403, 404 or 409, or one whose re-assembly fails to start with 500, is not counted. See [Edit limits](/guides/edit-limits).



## OpenAPI

````yaml /openapi.json patch /api/v1/dubs/{id}/lipsync/segments
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}/lipsync/segments:
    patch:
      tags:
        - Lip sync
      summary: Switch lip sync on or off per block
      description: >-
        Switches lip sync on or off for blocks of one target language and
        re-assembles the finished lip-sync video from the segments it already
        has — the visual editor's "Re-render" when only the lip-sync track
        changed. There is no POST /api/v1/dubs/{id}/update, no new lip-sync run
        and no credits. Send the blocks to change, each id at most once.


        The re-assembly runs asynchronously: the answer is 202 with
        lipsync_status "reconstructing"; poll GET /api/v1/dubs/{id}/lipsync,
        which answers "Processing" with step "reconstructing" until it is
        "Synced" again. If every block already has the requested value, the
        answer is 200 with applied false: nothing is re-assembled and nothing is
        counted.


        An empty blocks array or a duplicate id returns 400, and so does a dub
        whose engine has no supportsTimelineEditor (v2). A block id that belongs
        to another language or another dub returns 404 — once the language's lip
        sync is finished; before that, every request returns 409. While the lip
        sync of the language is running or not finished, an update is running, a
        review is in progress, or the block files have already been cleaned up
        (then only a new lip sync via POST /api/v1/dubs/{id}/lipsync can change
        the blocks), the request returns 409; so does a block whose lip sync is
        no longer stored and can only come back with a new run. Nothing is
        changed in any of these cases.


        Every re-assembly that actually starts costs one of the language's 2 API
        lip-sync applies — a counter of its own, separate from the segment
        edits; once they are used up, the next change returns 403 FORBIDDEN and
        changes nothing — the blocks can still be switched in the Dubly web app.
        A request refused with 400, 403, 404 or 409, or one whose re-assembly
        fails to start with 500, is not counted. See [Edit
        limits](/guides/edit-limits).
      operationId: patch-lipsync-segments
      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 lip-sync blocks are
                    switched. A language the dub does not have returns 404.
                blocks:
                  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: >-
                          Block id from GET /api/v1/dubs/{id}/lipsync/segments.
                          A block of another language or dub returns 404; a
                          value that is not a UUID returns 400.
                      enabled:
                        type: boolean
                        description: >-
                          true: apply lip sync to this block; false: show the
                          original video there.
                    required:
                      - id
                      - enabled
                    additionalProperties: false
                  description: >-
                    At least one entry { id, enabled }; each id at most once
                    (otherwise 400). Blocks left out stay as they are.
              required:
                - target_language
                - blocks
              additionalProperties: false
            examples:
              switch:
                summary: Switch two blocks
                value:
                  target_language: de
                  blocks:
                    - id: 8d2f4b6a-1c3e-4a5b-9d7f-0e2a4c6b8d1f
                      enabled: false
                    - id: f1e3c5a7-9b2d-4f6e-8a0c-2d4f6b8a0c3e
                      enabled: true
      responses:
        '200':
          description: >-
            Every block already as requested: nothing re-assembled, nothing
            counted.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    const: success
                  response:
                    type: object
                    properties:
                      dub_id:
                        type: string
                      target_language:
                        type: string
                      applied:
                        type: boolean
                        description: >-
                          true: the lip-sync video is being re-assembled. false:
                          every block already had the requested value — nothing
                          was re-assembled or counted.
                      changed_segment_ids:
                        type: array
                        items:
                          type: string
                        description: >-
                          The blocks whose value changed; empty when applied is
                          false.
                      lipsync_status:
                        type:
                          - string
                          - 'null'
                        description: >-
                          "reconstructing" while the video is re-assembled —
                          poll GET /api/v1/dubs/{id}/lipsync; "done" when
                          nothing changed.
                      api_lipsync_applies_remaining:
                        type: number
                        description: >-
                          The API lip-sync applies this language has left (at
                          most 2).
                    required:
                      - dub_id
                      - target_language
                      - applied
                      - changed_segment_ids
                      - lipsync_status
                      - api_lipsync_applies_remaining
                required:
                  - status
                  - response
              examples:
                unchanged:
                  summary: Nothing to change
                  value:
                    status: success
                    response:
                      dub_id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                      target_language: de
                      applied: false
                      changed_segment_ids: []
                      lipsync_status: done
                      api_lipsync_applies_remaining: 2
        '202':
          description: >-
            Re-assembly started: poll GET /api/v1/dubs/{id}/lipsync until it is
            "Synced" again. Counted as one API lip-sync apply.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    const: success
                  response:
                    type: object
                    properties:
                      dub_id:
                        type: string
                      target_language:
                        type: string
                      applied:
                        type: boolean
                        description: >-
                          true: the lip-sync video is being re-assembled. false:
                          every block already had the requested value — nothing
                          was re-assembled or counted.
                      changed_segment_ids:
                        type: array
                        items:
                          type: string
                        description: >-
                          The blocks whose value changed; empty when applied is
                          false.
                      lipsync_status:
                        type:
                          - string
                          - 'null'
                        description: >-
                          "reconstructing" while the video is re-assembled —
                          poll GET /api/v1/dubs/{id}/lipsync; "done" when
                          nothing changed.
                      api_lipsync_applies_remaining:
                        type: number
                        description: >-
                          The API lip-sync applies this language has left (at
                          most 2).
                    required:
                      - dub_id
                      - target_language
                      - applied
                      - changed_segment_ids
                      - lipsync_status
                      - api_lipsync_applies_remaining
                required:
                  - status
                  - response
              examples:
                reassembling:
                  summary: Re-assembly started
                  value:
                    status: success
                    response:
                      dub_id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                      target_language: de
                      applied: true
                      changed_segment_ids:
                        - 8d2f4b6a-1c3e-4a5b-9d7f-0e2a4c6b8d1f
                        - f1e3c5a7-9b2d-4f6e-8a0c-2d4f6b8a0c3e
                      lipsync_status: reconstructing
                      api_lipsync_applies_remaining: 1
        '400':
          description: >-
            BAD_REQUEST — The dub ID is not a UUID; the body is not valid JSON
            or has an unknown field; target_language is missing or not a
            supported target language code; blocks is empty or has a duplicate
            id or an id that is not a UUID; the dub has not finished processing;
            or the dub's engine has no timeline editing (capability
            supportsTimelineEditor, e.g. v2). Nothing is changed or counted.
          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 — The language has used all of its 2 API lip-sync applies.
            Nothing was changed, nothing was counted — the blocks can still be
            switched in the Dubly web app. Example message: `API lip-sync limit
            reached: the lip-sync blocks of a language can be applied at most 2
            times through the API. Exhausted: "de". Nothing was changed — the
            blocks can still be changed in the Dubly web app.`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: >-
            NOT_FOUND — An unknown dub, a dub of another account, a
            target_language the dub does not have, or — once the language's lip
            sync is finished — a block id of another language or dub. Nothing is
            changed or counted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: >-
            CONFLICT — The lip sync of the language is running or not finished,
            an update is running, a review is in progress, the block files have
            been cleaned up (only a new lip sync via POST
            /api/v1/dubs/{id}/lipsync can change the blocks), or a block's lip
            sync is no longer stored and can only come back with a new run.
            Nothing is changed or counted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: >-
            INTERNAL_ERROR — The dub, its blocks or the API lip-sync limit could
            not be read (nothing is changed), or the re-assembly failed to
            start. Not counted.
          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.