Developer Docs/Veo Video API

Veo Video API

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

Overview

Text-to-video generation powered by Google DeepMind's Veo model. Produces high-definition, cinematic video clips from a text prompt or a reference image.

Primary Endpoint

POST/api/v1/veoVideo/start

Generate videos using Google DeepMind's Veo 3.1 AI model. Supports text-to-video, image-to-video, and reference-based generation. ### 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 - `400` — Bad Request - Invalid parameters. - `401` — Unauthorized - Invalid or missing JWT token. - `422` — Content moderation rejected the input `imageUrls`. 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 - `POST /api/v1/veoVideo/batchDetail` — Batch query task details. 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 Google DeepMind.
ai_sharing_consent.versionenum: 2026-11-12Yes-
ai_sharing_consent.recipientsarray<string>Yes-
namestringNoName of the video generation task (optional, auto-generated if not provided)
promptstringYesText prompt describing the video content. Can be empty to use default placeholder text.
generationTypeenum: TEXT_2_VIDEO | FIRST_AND_LAST_FRAMES_2_VIDEO | REFERENCE_2_VIDEONoType of generation (TEXT_2_VIDEO for text-only, FIRST_AND_LAST_FRAMES_2_VIDEO for image frames, REFERENCE_2_VIDEO for reference images); default: "TEXT_2_VIDEO"
imageUrlsarray<string>NoImage URLs for image-to-video generation. For FIRST_AND_LAST_FRAMES_2_VIDEO mode, 1-2 images (start/end frames). For REFERENCE_2_VIDEO mode, 1-3 reference images.
modelenum: veo3 | veo3_fastNoGeneration model (veo3 for quality, veo3_fast for speed); default: "veo3_fast"
aspectRatioenum: 16:9 | 9:16 | AutoNoVideo aspect ratio (Auto will determine automatically); default: "Auto"
watermarkstringNoCustom watermark text (optional)
seedsnumberNoRandom seed for reproducible generation (10000-99999, optional)
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 Google DeepMind.",
          "required": [
            "version",
            "recipients"
          ],
          "properties": {
            "version": {
              "type": "string",
              "enum": [
                "2026-11-12"
              ]
            },
            "recipients": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "example": [
                "A2E",
                "Alibaba Cloud",
                "KIE",
                "Google DeepMind"
              ]
            }
          }
        },
        "name": {
          "type": "string",
          "description": "Name of the video generation task (optional, auto-generated if not provided)",
          "example": "My Veo Video"
        },
        "prompt": {
          "type": "string",
          "description": "Text prompt describing the video content. Can be empty to use default placeholder text.",
          "example": "Two person street interview in New York City. Sample Dialogue: Host: \"Did you hear the news?\" Person: \"Yes! Veo 3.1 is now available through this API.\""
        },
        "generationType": {
          "type": "string",
          "enum": [
            "TEXT_2_VIDEO",
            "FIRST_AND_LAST_FRAMES_2_VIDEO",
            "REFERENCE_2_VIDEO"
          ],
          "description": "Type of generation (TEXT_2_VIDEO for text-only, FIRST_AND_LAST_FRAMES_2_VIDEO for image frames, REFERENCE_2_VIDEO for reference images)",
          "default": "TEXT_2_VIDEO",
          "example": "TEXT_2_VIDEO"
        },
        "imageUrls": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Image URLs for image-to-video generation. For FIRST_AND_LAST_FRAMES_2_VIDEO mode, 1-2 images (start/end frames). For REFERENCE_2_VIDEO mode, 1-3 reference images.",
          "example": [
            "https://example.com/start_frame.jpg",
            "https://example.com/end_frame.jpg"
          ]
        },
        "model": {
          "type": "string",
          "enum": [
            "veo3",
            "veo3_fast"
          ],
          "description": "Generation model (veo3 for quality, veo3_fast for speed)",
          "default": "veo3_fast",
          "example": "veo3_fast"
        },
        "aspectRatio": {
          "type": "string",
          "enum": [
            "16:9",
            "9:16",
            "Auto"
          ],
          "description": "Video aspect ratio (Auto will determine automatically)",
          "default": "Auto",
          "example": "16:9"
        },
        "watermark": {
          "type": "string",
          "description": "Custom watermark text (optional)",
          "example": "MyBrand"
        },
        "seeds": {
          "type": "number",
          "description": "Random seed for reproducible generation (10000-99999, optional)",
          "example": 12345
        },
        "minor_suspected_skip": {
          "type": "boolean",
          "default": false,
          "description": "Confirm retry after the suspected-minor soft block; hard blocks remain enforced."
        }
      },
      "required": [
        "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.
data._id: string
Task ID
data.name: string
Task name
data.prompt: string
Generation prompt
data.generationType: string
Generation type
data.model: string
Model used
data.aspectRatio: string
Aspect ratio
data.current_status: string
Current task status (initialized, submitted, generating, completed, failed)
data.coins: number
Credits consumed
data.createdAt: string
Task creation time
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/veoVideo/start" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "prompt": "Two person street interview in New York City. Sample Dialogue: Host: \"Did you hear the news?\" Person: \"Yes! Veo 3.1 is now available through this API.\""
}'

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

Bad Request - Invalid parameters

401

Unauthorized - Invalid or missing bearer token

422

Content moderation rejected the input `imageUrls`. Code `1003` means confirmed minor content. Code `1004` means suspected minor content. For `1004`, confirm the input and retry with `minor_suspected_skip: true`.

Veo Video API Documentation