# Run an AI Image Generator task V2 for image to image.

AI tasks are asynchronous. Prefer webhook-based completion handling when the feature supports webhooks. Configure your webhook endpoint, verify webhook signatures, and use the received `task_id` to query the task result after a `success` or `error` notification. See the [webhook integration guide](/develop/webhook) for setup and verification details.
If webhooks are not supported or cannot be used in your integration, implement polling. After submitting an AI task, poll the status endpoint at regular intervals (e.g., every 10 seconds) until the task status is `success` or `error`.

Endpoint: POST /s2s/v2.0/task/image-to-image/youcam
Security: BearerAuthenticationV2

## Security:

  - `BearerAuthenticationV2` (unknown)
    http bearer

## Request fields (application/json):

  - `model` (string, required)
    Model name.
    Enum: "youcam-image-v2"

  - `prompt` (string, required)
    The image editing instruction (positive prompt) that describes the elements and visual features you want in the generated image. This parameter supports Chinese and English with a maximum length of 800 characters. Each Chinese character or English letter counts as one character.
    Example: Make the girl from Image 1 wear the black dress from Image 2 and sit in the pose from Image 3. Keep her clothing, hairstyle, and expression unchanged, and ensure the action is natural and smooth.

  - `negative_prompt` (string)
    The negative prompt, describing content you do not want in the generated image. This parameter supports Chinese and English with a maximum length of 500 characters. Each Chinese character or English letter counts as one character.
    Example: low resolution, error, worst quality, low quality, disfigured, extra fingers, bad proportions.

  - `size` (string)
    Specifies the resolution of the output image in the width*height format, such as "1024*1536". - The width and height must each be in the range of [512, 2048] pixels. - By default, the total number of pixels is approximately 1024*1024, with an aspect ratio similar to the input image (or the last image in a multi-image request). When you specify the size parameter, the system uses the width and height specified by size as the target and adjusts the width and height of the actual output image to the nearest multiple of 16. For example, if you specify 1033*1032, the output image dimensions are 1040*1024. Recommended resolutions for common aspect ratios: - 1:1: 1024*1024, 1536*1536 - 2:3: 768*1152, 1024*1536 - 3:2: 1152*768, 1536*1024 - 3:4: 960*1280, 1080*1440 - 4:3: 1280*960, 1440*1080 - 9:16: 720*1280, 1080*1920 - 16:9: 1280*720, 1920*1080 - 21:9: 1344*576, 2048*872
    Example: 1024*1024

  - `prompt_extend` (boolean)
    Enable smart prompt rewriting. The model optimizes the positive prompt. Does not affect the negative prompt.
    Enum: "true", "false"

  - `src_file_urls` (array, required)
    The file URLs from upload file API. Should provide either 'src_file_urls' or 'src_file_ids'.
    Example: ["https://example.com/selfie.jpg","https://example.com/selfie.jpg","https://example.com/selfie.jpg"]

  - `src_file_ids` (array, required)
    The file IDs from upload file API. Should provide either 'src_file_urls' or 'src_file_ids'.
    Example: ["pfNK5PuRe0MrwLHcGA3DOmB1ahwfXTbYHjv+KoBIxbE=","pkVzplMv8Y1QPgHbqtKfyJmg+xJDUbTP16YijZ3qARNf","B5LNohvvO+7d/78Ymuhp6vMiSooN/5DX9oVuupzkKctf"]

## Response 200:

  - `200` (unknown)
    Successful execution of the task

## Response 200 fields (application/json):

  - `status` (integer)
    Response status
    Example: 200

  - `data` (object)

  - `data.task_id` (string)
    ID of this task. Task result is valid to query by this ID for 24 hours.
    Example: grH0CvsgXuAIHLUzD0V1Ol34hoet3R1tvdbtiVHrDb6_UqCLKIejAIajwxrhOAfe

## Response 400:

  - `400` (unknown)
    Failed execution of task

## Response 400 fields (application/json):

  - `status` (integer)
    Response status
    Example: 400

  - `error` (string)
    Error message
    Example: The operation could not be completed

  - `error_code` (string)
    Error code:
* InvalidParameters - Invalid request parameters
* CreditInsufficiency - Insufficient unit to run
* BadRequest - Unexpected request parameter
* InvalidStyleGroup - Invalid style group id
* InvalidStyle - Invalid style id
    Enum: "InvalidParameters", "CreditInsufficiency", "InvalidStyleGroup", "InvalidStyle", "BadRequest"

## Response 401:

  - `401` (unknown)
    Invalid or missing API key

## Response 401 fields (application/json):

  - `status` (integer)
    Response status
    Example: 401

  - `error` (string)
    Example: Invalid API key

## Response 429:

  - `429` (unknown)
    Too many requests

## Response 429 fields (application/json):

  - `status` (integer)
    Response status
    Example: 429

  - `error` (string)
    Example: Too many requests

