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

# Re-voice one segment

> Re-voices one segment of a completed dub right away with its stored state — "Regenerate" in the web app's visual editor. The stored translation is spoken again (mode "revoice"). If the translation was cleared because POST /api/v1/dubs/{id}/segments/timeline changed the source text, the segment is first translated from the new source line and then voiced (mode "retranslate"); a muted segment stays silent.

The run is asynchronous: the answer is 202, and GET /api/v1/dubs/{id}/segments shows processing true for the segment until its new voice-over is in place. Engine v1 only (capabilities supportsTimelineEditor and supportsPerSegmentRegenerate): on any other engine the request returns 400.

A segmentId that does not belong to this dub and target_language, or is deleted, returns 404. While the segment is already being re-translated or re-voiced, a review is in progress, or an update or a lip sync is running for this language, the request returns 409 and starts nothing.

Every accepted regenerate costs one of the segment's 2 API edits — the same counter as PATCH /api/v1/dubs/{id}/segments and POST …/segments/timeline; once they are used up, the next regenerate returns 403 FORBIDDEN and starts nothing — the segment can still be regenerated in the Dubly web app. A regenerate refused with 400, 403, 404 or 409, or one that fails to start with 500, is not counted. See [Edit limits](/guides/edit-limits). No credits are charged.



## OpenAPI

````yaml /openapi.json post /api/v1/dubs/{id}/segments/{segmentId}/regenerate
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/{segmentId}/regenerate:
    post:
      tags:
        - Dub editing
      summary: Re-voice one segment
      description: >-
        Re-voices one segment of a completed dub right away with its stored
        state — "Regenerate" in the web app's visual editor. The stored
        translation is spoken again (mode "revoice"). If the translation was
        cleared because POST /api/v1/dubs/{id}/segments/timeline changed the
        source text, the segment is first translated from the new source line
        and then voiced (mode "retranslate"); a muted segment stays silent.


        The run is asynchronous: the answer is 202, and GET
        /api/v1/dubs/{id}/segments shows processing true for the segment until
        its new voice-over is in place. Engine v1 only (capabilities
        supportsTimelineEditor and supportsPerSegmentRegenerate): on any other
        engine the request returns 400.


        A segmentId that does not belong to this dub and target_language, or is
        deleted, returns 404. While the segment is already being re-translated
        or re-voiced, a review is in progress, or an update or a lip sync is
        running for this language, the request returns 409 and starts nothing.


        Every accepted regenerate costs one of the segment's 2 API edits — the
        same counter as PATCH /api/v1/dubs/{id}/segments and POST
        …/segments/timeline; once they are used up, the next regenerate returns
        403 FORBIDDEN and starts nothing — the segment can still be regenerated
        in the Dubly web app. A regenerate refused with 400, 403, 404 or 409, or
        one that fails to start with 500, is not counted. See [Edit
        limits](/guides/edit-limits). No credits are charged.
      operationId: regenerate-dub-segment
      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
        - name: segmentId
          in: path
          required: true
          description: >-
            Segment id from GET /api/v1/dubs/{id}/segments (path parameter). A
            segment of another dub or language, or a deleted one, returns 404.
          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: 5b1e7c2a-9d43-4f8e-a6b0-2c7d9e1f3a54
      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 the segment belongs to. A
                    language the dub does not have returns 404.
              required:
                - target_language
              additionalProperties: false
            examples:
              regenerate:
                summary: Re-voice a German segment
                value:
                  target_language: de
      responses:
        '202':
          description: >-
            Started: poll GET /api/v1/dubs/{id}/segments until processing is
            false for the segment.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    const: success
                  response:
                    type: object
                    properties:
                      dub_id:
                        type: string
                      target_language:
                        type: string
                      segment_id:
                        type: string
                      mode:
                        type: string
                        enum:
                          - revoice
                          - retranslate
                        description: >-
                          "revoice": the stored translation is spoken again.
                          "retranslate": the translation was cleared by a source
                          edit — it is translated from the new source line, then
                          voiced.
                      api_edits_remaining:
                        type: integer
                        minimum: -9007199254740991
                        maximum: 9007199254740991
                        description: >-
                          API edits left for this segment after this regenerate
                          (at most 2).
                    required:
                      - dub_id
                      - target_language
                      - segment_id
                      - mode
                      - api_edits_remaining
                required:
                  - status
                  - response
              examples:
                revoice:
                  summary: 'Started: the stored translation is spoken again'
                  value:
                    status: success
                    response:
                      dub_id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                      target_language: de
                      segment_id: 5b1e7c2a-9d43-4f8e-a6b0-2c7d9e1f3a54
                      mode: revoice
                      api_edits_remaining: 1
                retranslate:
                  summary: 'Started: translated from the new source line, then voiced'
                  value:
                    status: success
                    response:
                      dub_id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                      target_language: de
                      segment_id: 5b1e7c2a-9d43-4f8e-a6b0-2c7d9e1f3a54
                      mode: retranslate
                      api_edits_remaining: 1
        '400':
          description: >-
            BAD_REQUEST — The dub ID or segmentId is not a UUID, target_language
            is missing or no supported target language code, the dub has not
            finished processing (status "Dubbed"), or its engine cannot re-voice
            a single segment (supportsTimelineEditor,
            supportsPerSegmentRegenerate). Nothing was started, nothing was
            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 segment has used all its 2 API edits (shared with
            PATCH /api/v1/dubs/{id}/segments and POST …/segments/timeline).
            Nothing was started — the segment can still be regenerated 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 or a
            target_language the dub does not have, or a segmentId that does not
            belong to this dub and target_language, or is deleted. Nothing was
            counted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: >-
            CONFLICT — The segment is already being re-translated or re-voiced,
            a review is in progress, an update or a lip sync is running for this
            language, or a voice of the dub is no longer available. Nothing was
            started, nothing was counted. Example message: "Cannot regenerate
            right now: segment 5b1e7c2a-9d43-4f8e-a6b0-2c7d9e1f3a54 ("de") is
            being re-translated or re-voiced right now. Nothing was changed."
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: >-
            INTERNAL_ERROR — The dub or its segments could not be read, the API
            edit limit could not be checked, or the re-voicing failed to start.
            Nothing was 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.