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

# Translate text segments (async)

> Submit a batch text translation job. The HTTP response only confirms acceptance (`taskId`). Translated segments arrive in your [Webhook](/guides/webhooks) callback (`event`: `openapi-translate`).



## OpenAPI

````yaml /api-reference/openapi.json post /openapi/v1/task/translate/create-async
openapi: 3.1.0
info:
  title: VMEG Open API
  description: >-
    Integrate VMEG into your product: translate and dub video or audio,
    synthesize speech, clone voices, translate plain text, and manage API-side
    files. All responses use `{ code, message, data }`; `code === 200` means
    success.
  version: 1.0.0
servers:
  - url: https://api.vmeg.ai
    description: Production
security:
  - apiKeyAuth: []
tags:
  - name: Media translation
    x-group: Video & audio translate and dub
    description: >-
      Localize uploaded video or audio end-to-end: transcribe speech, translate
      the script, generate AI dubbing (cloned or preset voices), and return new
      dubbed media. Optional subtitles and lip sync. **Async only** — dubbed
      files arrive via [Webhook](/guides/webhooks). This is not plain text
      translation; see [Media translation](/guides/products/media-translation).
  - name: TTS
    x-group: Text to speech (TTS)
    description: >-
      Turn text into natural speech with preset or cloned voices. **Sync**
      returns audio URLs in the HTTP response; **async** delivers results via
      [Webhook](/guides/webhooks). See [Text to
      speech](/guides/products/text-to-speech).
  - name: Voice clone
    x-group: Voice cloning
    description: >-
      Create a reusable voice from a short reference recording. Returns a
      `voiceId` you can pass to TTS or translate-and-dub jobs. See [Voice
      clone](/guides/products/voice-clone).
  - name: Text translation
    x-group: Text translation (text only)
    description: >-
      Translate plain text segments — no audio or video processing. For spoken
      content in media files, use **Video & audio translate and dub** instead.
      See [Text translation](/guides/products/text-translation).
  - name: Task management
    x-group: Task status and history
    description: >-
      List, inspect, or delete jobs created through any product API. Poll `GET
      .../tasks/detail` when you cannot rely on webhooks. Scoped to your **API
      Key**. See [Products overview](/guides/products/overview).
  - name: Assets - Materials
    x-group: Upload files (materials)
    description: >-
      Upload and manage video/audio files used as input for translate-and-dub
      jobs. Flow: finish the full upload (presigned or multipart → register) →
      pass the registered `materialId` to create-async. See [Material
      upload](/guides/assets/material-upload).
  - name: Assets - Voices
    x-group: Voices (presets and clones)
    description: >-
      List preset voices for TTS, or manage voices you cloned. Cloned voices are
      created via **Voice cloning**. See [Voices](/guides/assets/voices).
paths:
  /openapi/v1/task/translate/create-async:
    post:
      tags:
        - Text translation
      summary: Translate text segments (async)
      description: >-
        Submit a batch text translation job. The HTTP response only confirms
        acceptance (`taskId`). Translated segments arrive in your
        [Webhook](/guides/webhooks) callback (`event`: `openapi-translate`).
      operationId: translateCreateAsync
      parameters:
        - $ref: '#/components/parameters/IdempotencyKeyRequired'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OpenApiTranslateCreateAsyncRequest'
      responses:
        '200':
          description: >-
            Acceptance only (`taskId`, `createdAt`). Final results are in the
            [Webhook](/guides/webhooks) callback request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenApiTaskAcceptedResponse'
      callbacks:
        taskCompleted:
          https://{yourWebhookUrl}:
            post:
              summary: 'Webhook when async task finishes (`event`: `openapi-translate`)'
              description: >-
                HTTP **request body** VMEG POSTs to your
                [Webhook](/guides/webhooks) URL when a Text translation async
                task finishes. The JSON field `event` is `openapi-translate`
                (see [Webhook request body](/guides/webhook-request)). Not part
                of the create-async **Response** above. Full schema: [Create
                text translation
                (async)](/api-reference/text-translation/create-text-translation-async)
                → **Callbacks**.
              parameters:
                - $ref: '#/components/parameters/CallbackTimestamp'
                - $ref: '#/components/parameters/CallbackSignature'
              requestBody:
                required: true
                content:
                  application/json:
                    schema:
                      $ref: >-
                        #/components/schemas/OpenApiTranslateTaskCompletedCallback
              responses:
                '200':
                  description: Return 2xx promptly to stop retries
              method: post
              type: path
            path: https://{yourWebhookUrl}
components:
  parameters:
    IdempotencyKeyRequired:
      name: X-Idempotency-Key
      in: header
      required: true
      description: >-
        Required on mutating `POST` requests that create tasks or change
        persisted data (max 64 characters). See
        [Idempotency](/guides/idempotency).
      schema:
        type: string
        maxLength: 64
    CallbackTimestamp:
      name: X-Timestamp
      in: header
      required: true
      description: Unix timestamp in milliseconds (string)
      schema:
        type: string
    CallbackSignature:
      name: X-Signature
      in: header
      required: true
      description: Lowercase hex HMAC-SHA256(secret, X-Timestamp + rawBody)
      schema:
        type: string
  schemas:
    OpenApiTranslateCreateAsyncRequest:
      allOf:
        - $ref: '#/components/schemas/OpenApiTranslateCreateRequest'
        - type: object
          properties:
            extraData:
              $ref: '#/components/schemas/OpenApiExtraData'
    OpenApiTaskAcceptedResponse:
      allOf:
        - $ref: '#/components/schemas/OpenApiResponseBase'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/OpenApiTaskAcceptedData'
    OpenApiTranslateTaskCompletedCallback:
      description: >-
        Webhook callback **request body** for Text translation when `event` is
        `openapi-translate`. `data.items` holds translated segments aligned with
        your request. See [Webhook request body](/guides/webhook-request) and
        [Create text translation
        (async)](/api-reference/text-translation/create-text-translation-async)
        → **Callbacks**.
      allOf:
        - $ref: '#/components/schemas/OpenApiCallbackEnvelope'
        - type: object
          required:
            - data
          properties:
            data:
              description: >-
                Product-specific results when `event` is `openapi-translate`.
                `data.items` holds translated segments aligned with your
                request.
              allOf:
                - $ref: '#/components/schemas/OpenApiTranslateCreateData'
    OpenApiTranslateCreateRequest:
      type: object
      required:
        - language
        - segments
      properties:
        language:
          type: object
          required:
            - source
            - target
          properties:
            source:
              type: string
              example: zh-CN
              description: >-
                Source locale (BCP-47). See [Supported
                languages](/guides/supported-languages).
            target:
              type: string
              example: en-US
              description: >-
                Target locale (BCP-47). See [Supported
                languages](/guides/supported-languages).
          description: Source and target locales for translation
        segments:
          type: array
          maxItems: 50
          items:
            $ref: '#/components/schemas/OpenApiTranslateSegment'
          description: Text segments to translate (max 50)
        options:
          $ref: '#/components/schemas/OpenApiTranslateOptions'
          description: Optional translation settings (context, scene, glossary, prompt)
    OpenApiExtraData:
      type: object
      additionalProperties: true
      description: >-
        Optional client metadata on async submit; echoed in the completion
        webhook (`extraData` in callback body). Not used on sync create
        endpoints.
    OpenApiResponseBase:
      type: object
      properties:
        code:
          type: integer
          example: 200
          description: Business code; 200 means success
        message:
          type: string
          example: ''
          description: Human-readable detail when `code` is not success
      required:
        - code
    OpenApiTaskAcceptedData:
      type: object
      description: Immediate response for async task submission (no task results)
      required:
        - taskId
      properties:
        taskId:
          type: string
          description: Open API task ID; use for polling or correlation
        createdAt:
          type: string
          description: Returned by TTS and text translation async create
    OpenApiCallbackEnvelope:
      type: object
      description: >-
        Shared top-level fields of the webhook POST body when an async task
        finishes. See [Webhook request body](/guides/webhook-request) for the
        `event` field and per-product values.
      properties:
        code:
          type: integer
          example: 200
          description: Business outcome for this delivery
        version:
          type: string
          example: v1
          description: >-
            API version of the task (e.g. `v1`, `v2`). Matches the version in
            the request path (`/openapi/v1/...`).
        event:
          type: string
          enum:
            - openapi-tts
            - openapi-translate
            - openapi-clone-voice
            - openapi-media-translation
          example: openapi-tts
          description: >-
            Which product completed. Route your handler by this value:
            `openapi-tts` (TTS), `openapi-translate` (text translation),
            `openapi-clone-voice` (voice clone), `openapi-media-translation`
            (media translation). Listed in [Webhook request
            body](/guides/webhook-request).
        pipelineKey:
          type: string
          example: a1b2c3d4e5f6789012345678901234ab
          description: >-
            Stable ID for this async completion. Deduplicate webhook handling by
            this value — see [Webhook request
            body](/guides/webhook-request#deduplicate-by-pipelinekey).
        message:
          type: string
          description: Detail when `code` is not success
        extraData:
          type: object
          additionalProperties: true
          description: Echo of `extraData` from your async submit request
    OpenApiTranslateCreateData:
      type: object
      properties:
        taskId:
          type: string
          description: Open API task ID
        items:
          type: array
          items:
            $ref: '#/components/schemas/OpenApiTranslateResultItem'
          description: Translated segments, aligned with request segments by index
        createdAt:
          type: string
          description: Task creation time (ISO 8601)
    OpenApiTranslateSegment:
      type: object
      required:
        - text
      properties:
        text:
          type: string
          description: Source text for this segment
        gender:
          $ref: '#/components/schemas/OpenApiTranslateSpeakerGender'
          description: 'Speaker gender for this segment. Enum: `male` or `female`.'
        speaker:
          type: string
          example: Speaker A
          description: >-
            Speaker label for multi-speaker content; helps keep pronouns and
            voice consistent across segments
        locale:
          type: string
          example: zh-CN
          description: Per-segment locale when it differs from `language.source`
        context:
          type: array
          items:
            type: string
          description: >-
            Per-segment neighbor lines. Takes priority over
            `options.sourceContext`; useful with `provided_only` when segments
            are not time-contiguous
        start:
          type: number
          description: >-
            Start time in seconds on the source timeline. Pair with `end` to
            mark this segment's time span for neighbor context
        end:
          type: number
          description: >-
            End time in seconds on the source timeline. Must be provided with
            `start` and be greater than or equal to `start`
    OpenApiTranslateOptions:
      type: object
      description: Optional translation settings
      properties:
        sourceContext:
          $ref: '#/components/schemas/OpenApiTranslateSourceContext'
          description: >-
            How to use surrounding source text. Defaults to `independent` when
            omitted
        sceneCustomized:
          $ref: '#/components/schemas/OpenApiTranslateSceneCustomized'
          description: Scene and delivery style hints
        glossary:
          type: object
          additionalProperties:
            type: string
          description: Term glossary map (source term → preferred translation)
        prompt:
          type: string
          description: Custom prompt appended to the translation instruction
        skipMissingTranslationCheck:
          type: boolean
          default: false
          description: >-
            When `true`, skip validation that every segment received a
            translation
    OpenApiTranslateResultItem:
      type: object
      properties:
        text:
          type: string
          description: Translated text
        errorMessage:
          type: string
          description: Failure reason when translation failed for this segment
    OpenApiTranslateSpeakerGender:
      type: string
      description: Speaker gender for a translation segment
      enum:
        - male
        - female
      example: male
    OpenApiTranslateSourceContext:
      type: object
      description: >-
        Global strategy for using neighbor context. Lower priority than
        per-segment `context`
      properties:
        mode:
          type: string
          enum:
            - independent
            - provided_only
            - neighbor
          default: independent
          description: >-
            `independent` — translate each segment alone. `provided_only` — use
            neighbor text supplied in segment `context`. `neighbor` — auto-pick
            neighbors from ordered segments using `contextWindow`
        contextWindow:
          type: integer
          minimum: 1
          maximum: 20
          default: 5
          description: >-
            Only when `mode` is `neighbor`: number of segments before and after
            the current one to include (1–20)
    OpenApiTranslateSceneCustomized:
      type: object
      description: Scene-specific translation behavior
      properties:
        scene:
          type: string
          enum:
            - video
            - audio
            - subtitle
            - voiceover
          default: video
          description: Content type hint for the translation model
        allowStutter:
          type: boolean
          default: true
          description: >-
            Whether disfluencies (stutters) in the source may be preserved in
            the translation
  securitySchemes:
    apiKeyAuth:
      type: http
      scheme: bearer
      description: >-
        Send your API Key in the **`Authorization`** header (`Bearer
        <api_key>`). See [Authentication](/guides/authentication).

````