Overview
Generate a video from reference images with the fast Wan 2.6 reference-to-video workflow.
Primary Endpoint
/api/v1/userWan26R2V/startGenerate a video from reference images/videos using Wan 2.6 R2V Flash. ### 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`, `reference_urls`. - 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 images in `reference_urls`. 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/userWan26R2V/allRecords` — Get all R2V tasks. - `GET /api/v1/userWan26R2V/{_id}` — Get R2V task details. - `DELETE /api/v1/userWan26R2V/{_id}` — Delete a R2V task. Authentication: set header Authorization: Bearer <token> (supports user JWT or sk_ API token).
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| ai_sharing_consent | object | No | 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. |
| ai_sharing_consent.version | enum: 2026-11-12 | Yes | - |
| ai_sharing_consent.recipients | array<string> | Yes | - |
| model | enum: wan2.6-r2v-flash | wan2.6-r2v | No | Model variant (flash=faster+cheaper, standard=higher quality audio-only); default: "wan2.6-r2v-flash" |
| name | string | No | Task name |
| reference_urls | array<string> | Yes | Array of reference image/video URLs (max 5) |
| prompt | string | Yes | Generation prompt (use character1, character2 to reference inputs) |
| duration | enum: 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | No | Output duration in seconds. Any integer from 2 to 10, matching the upstream model.; default: "5" |
| resolution | enum: 720p | 1080p | No | Resolution tier, combined with aspect_ratio to determine actual size; default: "720p" |
| aspect_ratio | enum: 16:9 | 9:16 | 1:1 | 4:3 | 3:4 | No | Aspect ratio for the output video; default: "16:9" |
| shot_type | enum: single | multi | No | default: "single" |
| audio | boolean | No | default: true |
| reference_durations | array<number> | No | Client-supplied durations in seconds aligned with reference_urls; use zero for images. Input-video billing uses these paired durations, with each video capped at 5 divided by the reference count and a five-second total cap.; maxItems: 5 |
| minor_suspected_skip | boolean | No | Confirm retry after the suspected-minor soft block; hard blocks remain enforced.; default: false |
| webhook_url | string | No | HTTPS 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_token | string | No | Optional 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"
]
}
}
},
"model": {
"type": "string",
"enum": [
"wan2.6-r2v-flash",
"wan2.6-r2v"
],
"default": "wan2.6-r2v-flash",
"description": "Model variant (flash=faster+cheaper, standard=higher quality audio-only)"
},
"name": {
"type": "string",
"description": "Task name"
},
"reference_urls": {
"type": "array",
"items": {
"type": "string"
},
"description": "Array of reference image/video URLs (max 5)"
},
"prompt": {
"type": "string",
"description": "Generation prompt (use character1, character2 to reference inputs)"
},
"duration": {
"type": "string",
"enum": [
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10"
],
"default": "5",
"description": "Output duration in seconds. Any integer from 2 to 10, matching the upstream model."
},
"resolution": {
"type": "string",
"enum": [
"720p",
"1080p"
],
"default": "720p",
"description": "Resolution tier, combined with aspect_ratio to determine actual size"
},
"aspect_ratio": {
"type": "string",
"enum": [
"16:9",
"9:16",
"1:1",
"4:3",
"3:4"
],
"default": "16:9",
"description": "Aspect ratio for the output video"
},
"shot_type": {
"type": "string",
"enum": [
"single",
"multi"
],
"default": "single"
},
"audio": {
"type": "boolean",
"default": true
},
"reference_durations": {
"type": "array",
"maxItems": 5,
"items": {
"type": "number"
},
"description": "Client-supplied durations in seconds aligned with reference_urls; use zero for images. Input-video billing uses these paired durations, with each video capped at 5 divided by the reference count and a five-second total cap."
},
"minor_suspected_skip": {
"type": "boolean",
"default": false,
"description": "Confirm retry after the suspected-minor soft block; hard blocks remain enforced."
}
},
"required": [
"prompt",
"reference_urls"
]
},
{
"$ref": "#/components/schemas/WebhookInput"
}
]
}Response Fields
- code: enum: 0
- data: object
- data._id: string
- Task ID for detail and batch polling.
- data.name: string
- data.prompt: string
- data.is_downloaded: boolean
- data.is_previewed: boolean
- data.current_status: string
- Persisted task state; use the concrete task family schema for its allowed values and terminal states.
- data.createdAt: string
- data.updatedAt: string
- data.expirationDate: string
- data.remainingDays: number
- data.isExpired: boolean
- data.coins: number
- data.hasRefundCoin: boolean
- Whether charged credits were refunded.
- data.failed_code: string
- data.failed_message: string
- data.failed_reason: string
- Public failure category when available.
- data.image_url: string
- data.image_urls: array<string>
- data.result_url: string
- data.video_url: string
- data.result_video_url: string
- data.cover_url: string
- data.result_cover: string
- data.hd_video_url: string
- data.video_time: number
- data.duration_seconds: number
- 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/userWan26R2V/start" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"prompt": "high quality, clear, cinematic",
"reference_urls": [
"https://example.com/file"
]
}'Related Endpoints
Responses
Task started successfully
Unauthorized - Invalid or missing bearer token
Content moderation rejected the images in `reference_urls`. Code `1003` means confirmed minor content. Code `1004` means suspected minor content. For `1004`, confirm the input and retry with `minor_suspected_skip: true`.