Developer Docs/Talking Video API

Talking Video API

Build Talking Video integrations with A2E. Review authentication, request parameters, task creation, status, and result endpoints.

Overview

Re-lip-sync an existing video to a new audio source using AI-driven facial animation and motion warping.

Primary Endpoint

POST/api/v1/talkingVideo/start

Create a Talking task from the source video and required driving audio. Billing uses audio duration capped at 120 seconds. TTS is billed separately. API token requests pay the full calculated price and do not consume free uses. Anonymous audio must have a valid server-probed duration of at most 10 seconds; no client duration fallback is accepted. Anonymous source video must also have a valid duration of at most 10 seconds (0.3 second container tolerance). Source video never determines the price. For logged-in and API requests, missing probe duration retains the request duration and then 1-second billing fallback; probe exceptions still fail. Generation failures refund only the actual charge. Codes 12001 (quota exhausted), 12004 (anonymous media too long), 12005 (duration unavailable) and 12006 (free quota changed) require user action, not an automatic full-price retry. ### Request - This operation permits anonymous requests. Authenticated callers may send a bearer token. - Supply `x-anonymous-id` headers as documented in the parameter schema, including any anonymous identity requirements. - Send an `application/json` body. Required fields: `name`, `video_url`, `audio_url`, `prompt`, `negative_prompt`. - API-token callers may include `webhook_url` and `webhook_token` for best-effort terminal-state notifications; ordinary JWT/cookie calls ignore these fields. ### Behavior - This is an asynchronous operation: a successful submission creates a task and returns before processing finishes. - Persist the returned task identifier and use the corresponding detail or list operation to observe progress. - Treat the detail endpoint as the source of truth even when webhook delivery is enabled. ### Response - A `200` response confirms task acceptance; it does not by itself mean media generation has completed. - Retain the returned identifier and wait for a documented terminal status before using output URLs. - JSON object responses, including error responses, normally carry a top-level `trace_id` string for this request; include it when contacting support. It is not a task identifier. - Do not infer undocumented fields or statuses; clients should tolerate additional response properties. ### Errors - `400` — Bad Request - Invalid parameters. - `401` — Unauthorized - Invalid Authorization or missing anonymous identity. - `422` — Content moderation rejected the request. Code 1003 means content involving a minor was detected. ### Related Operations - `GET /api/v1/talkingVideo/allRecords` — Get all task records. - `GET /api/v1/talkingVideo/{_id}` — Get task details. - `DELETE /api/v1/talkingVideo/{_id}` — Delete task. Authentication: set header Authorization: Bearer <token> (supports user JWT or sk_ API token).

Request Parameters

NameTypeRequiredDescription
ai_sharing_consentobjectNoConsent receipt for newer native apps. Legacy native requests may omit this field and continue without a consent record. If present, null, malformed, expired or incomplete receipts return AI_SHARING_CONSENT_REQUIRED before generation. Valid receipts cover all actual AI recipients, including safety providers and intermediaries, and constrain later fallback. Content safety checks remain required for native requests. Web and legacy API behavior is unchanged.
ai_sharing_consent.versionenum: 2026-11-12Yes-
ai_sharing_consent.recipientsarray<string>Yes-
free_quota_expected_coinsnumberNoMinimum expected free credits. If the available discount decreases, returns 12006 without creating a task or automatically charging a higher price.; minimum: 0
free_quota_expectedbooleanNoSet true when the user saw a free discount; return code 12006 without charge if the quota is no longer available. API tokens always pay full price.
namestringYesName of the talking video task
video_urlstringYesURL of the source video
audio_urlstringYesRequired source audio URL
durationnumberNoFallback duration when the server cannot read audio metadata; normally billing uses the duration of audio_url.; default: 3
promptstringYesGeneration prompt
negative_promptstringYesNegative prompt to avoid unwanted features
webhook_urlstringNoHTTPS URL to receive task.completed / task.failed notifications. Best-effort delivery, single attempt, no retries; clients should treat the detail API as the source of truth.; maxLength: 2048
webhook_tokenstringNoOptional plaintext token returned in the X-A2e-Webhook-Token header so receivers can verify the request originated from a2e.; maxLength: 256
Request schema and conditional rules
{
  "allOf": [
    {
      "type": "object",
      "properties": {
        "ai_sharing_consent": {
          "type": "object",
          "description": "Consent receipt for newer native apps. Legacy native requests may omit this field and continue without a consent record. If present, null, malformed, expired or incomplete receipts return AI_SHARING_CONSENT_REQUIRED before generation. Valid receipts cover all actual AI recipients, including safety providers and intermediaries, and constrain later fallback. Content safety checks remain required for native requests. Web and legacy API behavior is unchanged.",
          "required": [
            "version",
            "recipients"
          ],
          "properties": {
            "version": {
              "type": "string",
              "enum": [
                "2026-11-12"
              ]
            },
            "recipients": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "example": [
                "A2E",
                "Alibaba Cloud"
              ]
            }
          }
        },
        "free_quota_expected_coins": {
          "type": "number",
          "minimum": 0,
          "description": "Minimum expected free credits. If the available discount decreases, returns 12006 without creating a task or automatically charging a higher price."
        },
        "free_quota_expected": {
          "type": "boolean",
          "description": "Set true when the user saw a free discount; return code 12006 without charge if the quota is no longer available. API tokens always pay full price."
        },
        "name": {
          "type": "string",
          "description": "Name of the talking video task",
          "example": "My Talking Video"
        },
        "video_url": {
          "type": "string",
          "description": "URL of the source video",
          "example": "https://example.com/video.mp4"
        },
        "audio_url": {
          "type": "string",
          "description": "Required source audio URL",
          "example": "https://example.com/audio.mp3"
        },
        "duration": {
          "type": "number",
          "description": "Fallback duration when the server cannot read audio metadata; normally billing uses the duration of audio_url.",
          "default": 3,
          "example": 5
        },
        "prompt": {
          "type": "string",
          "description": "Generation prompt",
          "example": "Make this person smile and speak"
        },
        "negative_prompt": {
          "type": "string",
          "description": "Negative prompt to avoid unwanted features",
          "example": "blurry, distorted"
        }
      },
      "required": [
        "name",
        "video_url",
        "audio_url",
        "prompt",
        "negative_prompt"
      ]
    },
    {
      "$ref": "#/components/schemas/WebhookInput"
    }
  ]
}

Response Fields

code: integer
data: object
data.hasRefundCoin: boolean
Stored refund flag; true does not confirm crediting while refund_pending is true. Omitted when unknown, including legacy records without a stored flag.
data.refund_pending: boolean
True means refund pending resolution and takes precedence over hasRefundCoin. Explicit false is preserved; omitted when unknown, including legacy records without a stored flag.
data._id: string
data.name: string
data.video_url: string
data.current_status: string
data.duration: number
data.coins: number
trace_id: string
Trace ID of this HTTP request. Include it when contacting support about this request. It is generated per request and is not a task identifier; use the returned task `_id` to query results.

Request Example

curl -X POST "https://www.a2e.com.cn/api/v1/talkingVideo/start" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "My Talking Video",
  "video_url": "https://example.com/video.mp4",
  "audio_url": "https://example.com/audio.mp3",
  "duration": 5,
  "prompt": "Make this person smile and speak",
  "negative_prompt": "blurry, distorted"
}'

Related Endpoints

Responses

200

Talking video task started successfully

400

Bad Request - Invalid parameters

401

Unauthorized - Invalid Authorization or missing anonymous identity

422

Content moderation rejected the request. Code 1003 means content involving a minor was detected.

Talking Video API Documentation