Developer Docs/Hailuo Video API

Hailuo Video API

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

Overview

Generate videos with Hailuo from text prompts or image references with configurable duration and output settings.

Primary Endpoint

POST/api/v1/hailuoVideo/start

Generate videos using Hailuo. Only supports image-to-video mode. **Required:** `prompt` and at least one non-blank `image_url` or `image_urls` entry. A non-empty `image_url` takes precedence over `image_urls`; otherwise the first non-empty `image_urls` entry is used and must not be whitespace-only, and later entries are ignored. **Duration:** `6` or `10` seconds. **Resolution:** `768P` (default) or `1080P` (not available for 10s). This is an asynchronous API. After calling this endpoint, poll `/api/v1/hailuoVideo/{_id}` to check task status. Model tiers: standard/pro. Valid duration/resolution pairs: 6s+768P, 6s+1080P, 10s+768P; 10s+1080P is rejected. At least one non-blank image_url or image_urls entry is required. ### 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: `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 - `401` — Unauthorized - Invalid or missing JWT token. - `422` — Content moderation rejected the first input image supplied via `image_urls` or `image_url`. 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/hailuoVideo/allRecords` — Get Hailuo Video task list. - `GET /api/v1/hailuoVideo/{_id}` — Get Hailuo Video task detail. - `DELETE /api/v1/hailuoVideo/{_id}` — Delete Hailuo Video 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. When supplied, receipts must include both the intermediary KIE and the model provider MiniMax.
ai_sharing_consent.versionenum: 2026-11-12Yes-
ai_sharing_consent.recipientsarray<string>Yes-
namestringNoTask name (optional)
promptstringYesText prompt describing the video content. Required.
image_urlsarray<string>NoArray of reference image URLs. At least one is required.
image_urlstringNoSingle reference image URL (alternative to image_urls).
resolutionenum: 768P | 1080PNoOutput video resolution. 1080P is not supported for 10s duration.; default: "768P"
durationenum: 6 | 10NoVideo duration in seconds.; default: "6"
modelenum: standard | proNoPricing/model tier; independent from resolution.; default: "standard"
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. When supplied, receipts must include both the intermediary KIE and the model provider MiniMax.",
          "required": [
            "version",
            "recipients"
          ],
          "properties": {
            "version": {
              "type": "string",
              "enum": [
                "2026-11-12"
              ]
            },
            "recipients": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "example": [
                "A2E",
                "Alibaba Cloud",
                "KIE",
                "MiniMax"
              ]
            }
          }
        },
        "name": {
          "type": "string",
          "description": "Task name (optional)",
          "example": "My Hailuo Video"
        },
        "prompt": {
          "type": "string",
          "description": "Text prompt describing the video content. Required.",
          "example": "A cat playing with a ball of yarn"
        },
        "image_urls": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Array of reference image URLs. At least one is required.",
          "example": [
            "https://example.com/image.jpg"
          ]
        },
        "image_url": {
          "type": "string",
          "description": "Single reference image URL (alternative to image_urls)."
        },
        "resolution": {
          "type": "string",
          "enum": [
            "768P",
            "1080P"
          ],
          "description": "Output video resolution. 1080P is not supported for 10s duration.",
          "default": "768P"
        },
        "duration": {
          "type": "string",
          "enum": [
            "6",
            "10"
          ],
          "description": "Video duration in seconds.",
          "default": "6"
        },
        "model": {
          "type": "string",
          "enum": [
            "standard",
            "pro"
          ],
          "default": "standard",
          "description": "Pricing/model tier; independent from resolution."
        },
        "minor_suspected_skip": {
          "type": "boolean",
          "default": false,
          "description": "Confirm retry after the suspected-minor soft block; hard blocks remain enforced."
        }
      },
      "required": [
        "prompt"
      ],
      "description": "prompt is required, plus at least one non-blank image_url OR image_urls entry. 10s+1080P is not supported.",
      "anyOf": [
        {
          "required": [
            "image_url"
          ],
          "properties": {
            "image_url": {
              "type": "string",
              "pattern": "\\S"
            }
          }
        },
        {
          "required": [
            "image_urls"
          ],
          "properties": {
            "image_url": {
              "type": "string",
              "enum": [
                ""
              ]
            },
            "image_urls": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "string"
              },
              "not": {
                "items": {
                  "pattern": "^\\s*$"
                }
              }
            }
          }
        }
      ],
      "not": {
        "required": [
          "duration",
          "resolution"
        ],
        "properties": {
          "duration": {
            "enum": [
              "10",
              10
            ]
          },
          "resolution": {
            "enum": [
              "1080P"
            ]
          }
        }
      }
    },
    {
      "$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.
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://headswap.app/api/v1/hailuoVideo/start" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "prompt": "A cat playing with a ball of yarn",
  "image_url": "https://example.com/image.jpg"
}'

Related Endpoints

Responses

200

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.

401

Unauthorized - Invalid or missing bearer token

422

Content moderation rejected the first input image supplied via `image_urls` or `image_url`. Code `1003` means confirmed minor content. Code `1004` means suspected minor content. For `1004`, confirm the input and retry with `minor_suspected_skip: true`.

Hailuo Video API Documentation