Developer Docs/Kling Video API

Kling Video API

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

Overview

Text-to-video and image-to-video generation with Kling. Recognized for smooth motion dynamics, scene consistency, and high visual fidelity.

Primary Endpoint

POST/api/v1/klingVideo/start

Generate videos using Kling Official API. **Modes:** - `text-to-video` – generate video from text prompt - `image-to-video` – generate video from an image (+ optional end frame in PRO) - `motion-control` – transfer motion from a video onto an image **Versions:** `2.6` (5s/10s), `3.0` (standard/fast: 3s–15s), `4.0` (3s–30s, 720p/1080p), and `4.0-flash` (3s–20s, 720p) **Quality:** `std` (Standard), `pro` (Professional), or `4k` (Kling 3.0 Native 4K for text/image video). **Kling 4.0:** supports text, keyframe image, and multimodal reference video generation. Modes `text-to-video`, `image-to-video` (1–10 `keyframes`) and `reference-to-video` (images, videos, Elements and voices, up to 15 assets). Billing is per second of `resolution`: without input video the billed seconds equal `duration`; with input video, if the total input video seconds (server-measured, rounded up with a 0.3s tolerance) exceed `duration` the billed seconds are input + output, otherwise 2 × output. 2.6/3.0-only parameters (`sound`, `quality_mode`, `negative_prompt`, `cfg_scale`, `voice_list`, `video_urls`) are rejected for 4.0, and 4.0-only parameters are rejected for 2.6/3.0. ### Request - Send a valid bearer token. The server evaluates the operation in the authenticated caller's access context. - Send an `application/json` body. Required fields: `mode`, `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` — Invalid parameters, or ELEMENT_RECREATION_REQUIRED for incomplete Element media references outside the legacy native compatibility exception. Missing primary images and malformed reference metadata are not covered by that exception. - `401` — Unauthorized - Invalid or missing JWT token. - `422` — Content moderation rejected the input images, including keyframes and reference images when supplied. Code `1003` means confirmed minor content. Code `1004` means suspected minor content. For `1004`, confirm the input and retry with `minor_suspected_skip: true`. ### Related Operations - `GET /api/v1/klingVideo/allRecords` — Get all Kling video records. - `GET /api/v1/klingVideo/{_id}` — Get Kling video detail. - `PUT /api/v1/klingVideo/{_id}` — Update Kling video name. 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-
namestringNoName of the video generation task
modeenum: text-to-video | image-to-video | motion-control | reference-to-videoYesGeneration mode: text-to-video, image-to-video, or motion-control. reference-to-video requires version 4.0.
promptstringYesText prompt describing the desired video
versionenum: 2.6 | 3.0 | 4.0 | 4.0-flashNoKling model version. 2.6 supports 5s/10s; 3.0 supports 3s–15s; 4.0 supports 3s–30s; 4.0-flash supports 3s–20s at 720p only.; default: "2.6"
model_versionenum: standard | fastNoKling 3.0 model variant. fast requires version=3.0, supports text-to-video/image-to-video, supports 3–15s, and uses resolution instead of quality_mode=4k.; default: "standard"
resolutionenum: 720p | 1080pNoOutput resolution for model_version=fast and for version 4.0; default: "720p"
quality_modeenum: std | pro | 4kNoQuality mode. 4K is only available for Kling 3.0 text-to-video and image-to-video; default: "std"
durationenum: 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30NoVideo duration in seconds. Kling 2.6 supports 5s/10s; Kling 3.0 supports 3–15s; Kling 4.0 supports 3–30s (default 10).; default: "5"
image_urlstringNoInput image URL (required for image-to-video and motion-control modes)
video_urlstringNoInput video URL (required for motion-control mode)
aspect_ratioenum: 16:9 | 9:16 | 1:1 | 21:9 | adaptiveNoVideo aspect ratio (text-to-video mode; Kling 4.0 reference-to-video also accepts it). 21:9 requires 4.0; adaptive is only for 4.0 reference-to-video (its default). 4.0 image-to-video follows the keyframes and rejects this field.; default: "16:9"
soundbooleanNoEnable audio generation. For v2.6 only available in PRO mode (STD does not support sound). v3.0 supports sound in STD/PRO. 4K is billed as a separate quality tier.; default: false
end_image_urlstringNoEnd frame image URL (image-to-video + PRO mode only). Cannot be used with sound in v2.6
character_orientationenum: video | imageNoCharacter orientation for motion-control mode. 'image' limits duration to 3-10s, 'video' allows 3-30s; default: "video"
negative_promptstringNoNegative prompt to avoid certain elements
seednumberNoRandom seed for reproducibility
element_idsarray<string>NoOwned succeeded Kling Element asset_id values; the server resolves and validates ownership. Legacy native requests without ai_sharing_consent may reuse an image Element with an absent reference_image_urls field after reviewing its valid saved primary image; missing historical secondary images cannot be re-reviewed. Native requests with ai_sharing_consent still require complete media references. Ownership and output safety checks remain required.
element_namesarray<string>NoCompatibility names for Elements; resolved server-side names take precedence.
keyframesarray<object>NoKling 4.0 image-to-video / reference-to-video keyframes (at most one first_frame and one last_frame; middle frames keep their order). Referenced in the prompt as @image_1, @image_2, ... in first → middle → last order, followed by reference_image_urls. Images: jpg/png, ≤30MB, sides ≥300px, aspect ratio 2:5–5:2.; maxItems: 10
keyframes[].typeenum: first_frame | middle_frame | last_frameYes-
keyframes[].urlstringYes-
reference_image_urlsarray<string>NoKling 4.0 reference-to-video reference images (refer_image). Images plus keyframes ≤ 10.
reference_video_urlsarray<string>NoKling 4.0 reference-to-video feature reference videos (feature_video), referenced as @video_N. mp4/mov, ≤300MB, each and total 3–30s, sides 700–4553px, area ≤8294400px, aspect 2:5–5:2, nominal 24–60fps. Videos including base_video_url and video Elements ≤ 5. Video input duration is always probed server-side; client duration fields are ignored.
base_video_urlstringNoKling 4.0 reference-to-video video to edit (base_video), at most one; numbered after reference_video_urls.
voice_idsarray<string>NoKling 4.0 reference-to-video owned custom voice asset_id values, referenced as @voice_N. Elements (element_ids, ≤7, including ≤3 video Elements, referenced by their library name as @Name) are also accepted. Video Element durations count toward the video total and billing input duration. Images + videos + Elements + voices ≤ 15. Without input video, bill output seconds at the no-input rate. With input video, bill output + max(input total, output) seconds at the lower with-input rate; see GET /api/v1/feature-pricing for current coin rates.; maxItems: 3
minor_suspected_skipbooleanNoConfirm retry after the suspected-minor soft block; hard blocks remain enforced.; default: false
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",
                "Kuaishou"
              ]
            }
          }
        },
        "name": {
          "type": "string",
          "description": "Name of the video generation task",
          "example": "My Kling Video"
        },
        "mode": {
          "type": "string",
          "enum": [
            "text-to-video",
            "image-to-video",
            "motion-control",
            "reference-to-video"
          ],
          "description": "Generation mode: text-to-video, image-to-video, or motion-control. reference-to-video requires version 4.0.",
          "example": "image-to-video"
        },
        "prompt": {
          "type": "string",
          "description": "Text prompt describing the desired video",
          "example": "A beautiful sunset over the ocean"
        },
        "version": {
          "type": "string",
          "enum": [
            "2.6",
            "3.0",
            "4.0",
            "4.0-flash"
          ],
          "description": "Kling model version. 2.6 supports 5s/10s; 3.0 supports 3s–15s; 4.0 supports 3s–30s; 4.0-flash supports 3s–20s at 720p only.",
          "default": "2.6",
          "example": "3.0"
        },
        "model_version": {
          "type": "string",
          "enum": [
            "standard",
            "fast"
          ],
          "description": "Kling 3.0 model variant. fast requires version=3.0, supports text-to-video/image-to-video, supports 3–15s, and uses resolution instead of quality_mode=4k.",
          "default": "standard",
          "example": "fast"
        },
        "resolution": {
          "type": "string",
          "enum": [
            "720p",
            "1080p"
          ],
          "description": "Output resolution for model_version=fast and for version 4.0",
          "default": "720p",
          "example": "720p"
        },
        "quality_mode": {
          "type": "string",
          "enum": [
            "std",
            "pro",
            "4k"
          ],
          "description": "Quality mode. 4K is only available for Kling 3.0 text-to-video and image-to-video",
          "default": "std",
          "example": "std"
        },
        "duration": {
          "type": "string",
          "enum": [
            "3",
            "4",
            "5",
            "6",
            "7",
            "8",
            "9",
            "10",
            "11",
            "12",
            "13",
            "14",
            "15",
            "16",
            "17",
            "18",
            "19",
            "20",
            "21",
            "22",
            "23",
            "24",
            "25",
            "26",
            "27",
            "28",
            "29",
            "30"
          ],
          "description": "Video duration in seconds. Kling 2.6 supports 5s/10s; Kling 3.0 supports 3–15s; Kling 4.0 supports 3–30s (default 10).",
          "default": "5",
          "example": "5"
        },
        "image_url": {
          "type": "string",
          "description": "Input image URL (required for image-to-video and motion-control modes)",
          "example": "https://example.com/input.jpg"
        },
        "video_url": {
          "type": "string",
          "description": "Input video URL (required for motion-control mode)",
          "example": "https://example.com/input.mp4"
        },
        "aspect_ratio": {
          "type": "string",
          "enum": [
            "16:9",
            "9:16",
            "1:1",
            "21:9",
            "adaptive"
          ],
          "description": "Video aspect ratio (text-to-video mode; Kling 4.0 reference-to-video also accepts it). 21:9 requires 4.0; adaptive is only for 4.0 reference-to-video (its default). 4.0 image-to-video follows the keyframes and rejects this field.",
          "default": "16:9",
          "example": "16:9"
        },
        "sound": {
          "type": "boolean",
          "description": "Enable audio generation. For v2.6 only available in PRO mode (STD does not support sound). v3.0 supports sound in STD/PRO. 4K is billed as a separate quality tier.",
          "default": false,
          "example": false
        },
        "end_image_url": {
          "type": "string",
          "description": "End frame image URL (image-to-video + PRO mode only). Cannot be used with sound in v2.6",
          "example": "https://example.com/end_frame.jpg"
        },
        "character_orientation": {
          "type": "string",
          "enum": [
            "video",
            "image"
          ],
          "description": "Character orientation for motion-control mode. 'image' limits duration to 3-10s, 'video' allows 3-30s",
          "default": "video",
          "example": "video"
        },
        "negative_prompt": {
          "type": "string",
          "description": "Negative prompt to avoid certain elements",
          "example": "blurry, low quality"
        },
        "seed": {
          "type": "number",
          "description": "Random seed for reproducibility",
          "example": 12345
        },
        "element_ids": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Owned succeeded Kling Element asset_id values; the server resolves and validates ownership. Legacy native requests without ai_sharing_consent may reuse an image Element with an absent reference_image_urls field after reviewing its valid saved primary image; missing historical secondary images cannot be re-reviewed. Native requests with ai_sharing_consent still require complete media references. Ownership and output safety checks remain required."
        },
        "element_names": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Compatibility names for Elements; resolved server-side names take precedence."
        },
        "keyframes": {
          "type": "array",
          "maxItems": 10,
          "description": "Kling 4.0 image-to-video / reference-to-video keyframes (at most one first_frame and one last_frame; middle frames keep their order). Referenced in the prompt as @image_1, @image_2, ... in first → middle → last order, followed by reference_image_urls. Images: jpg/png, ≤30MB, sides ≥300px, aspect ratio 2:5–5:2.",
          "items": {
            "type": "object",
            "required": [
              "type",
              "url"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "first_frame",
                  "middle_frame",
                  "last_frame"
                ]
              },
              "url": {
                "type": "string"
              }
            }
          }
        },
        "reference_image_urls": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Kling 4.0 reference-to-video reference images (refer_image). Images plus keyframes ≤ 10."
        },
        "reference_video_urls": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Kling 4.0 reference-to-video feature reference videos (feature_video), referenced as @video_N. mp4/mov, ≤300MB, each and total 3–30s, sides 700–4553px, area ≤8294400px, aspect 2:5–5:2, nominal 24–60fps. Videos including base_video_url and video Elements ≤ 5. Video input duration is always probed server-side; client duration fields are ignored."
        },
        "base_video_url": {
          "type": "string",
          "description": "Kling 4.0 reference-to-video video to edit (base_video), at most one; numbered after reference_video_urls."
        },
        "voice_ids": {
          "type": "array",
          "maxItems": 3,
          "items": {
            "type": "string"
          },
          "description": "Kling 4.0 reference-to-video owned custom voice asset_id values, referenced as @voice_N. Elements (element_ids, ≤7, including ≤3 video Elements, referenced by their library name as @Name) are also accepted. Video Element durations count toward the video total and billing input duration. Images + videos + Elements + voices ≤ 15. Without input video, bill output seconds at the no-input rate. With input video, bill output + max(input total, output) seconds at the lower with-input rate; see GET /api/v1/feature-pricing for current coin rates."
        },
        "minor_suspected_skip": {
          "type": "boolean",
          "default": false,
          "description": "Confirm retry after the suspected-minor soft block; hard blocks remain enforced."
        }
      },
      "required": [
        "mode",
        "prompt"
      ]
    },
    {
      "$ref": "#/components/schemas/WebhookInput"
    }
  ]
}

Response Fields

code: integer
message: string
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.
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/klingVideo/start" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "mode": "image-to-video",
  "prompt": "A beautiful sunset over the ocean"
}'

Related Endpoints

Responses

200

Video generation task started successfully. Each returned task exposes optional boolean hasRefundCoin (true: refund recorded; false: not refunded; omitted: unknown). A generation failure reason does not prove that a refund was recorded.

400

Invalid parameters, or ELEMENT_RECREATION_REQUIRED for incomplete Element media references outside the legacy native compatibility exception. Missing primary images and malformed reference metadata are not covered by that exception.

401

Unauthorized - Invalid or missing bearer token

422

Content moderation rejected the input images, including keyframes and reference images when supplied. Code `1003` means confirmed minor content. Code `1004` means suspected minor content. For `1004`, confirm the input and retry with `minor_suspected_skip: true`.

Kling Video API Documentation