> ## Documentation Index
> Fetch the complete documentation index at: https://docs.powertokens.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Kling Image Generation kling-v2-new

> Submit a Kling native async image generation or image-to-image task via `/kling/v1/images/generations`.



## OpenAPI

````yaml api-reference/en/zmodelImage/kling/kling-v2-new-image-generations.json POST /kling/v1/images/generations
openapi: 3.0.1
info:
  title: Kling Image Generation Task - Submit Task
  version: 1.0.0
  description: >-
    Submit a Kling native async image generation or image-to-image task via
    `/kling/v1/images/generations`.
servers:
  - url: https://api.powertokens.ai
    description: ''
security: []
tags:
  - name: Kling
    description: Kling native async task endpoints
paths:
  /kling/v1/images/generations:
    post:
      tags:
        - Kling
      summary: Kling Image Generation Task
      description: >-
        Submit a Kling native async image generation or image-to-image task via
        `/kling/v1/images/generations`.
      operationId: createKlingImageGeneration
      parameters:
        - name: Content-Type
          in: header
          required: true
          schema:
            type: string
            default: application/json
          description: Data exchange format
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KlingRequest'
            examples:
              request:
                summary: Request example
                value:
                  model_name: kling-v2-new
                  prompt: Generate a Pixar-style puppy
                  negative_prompt: ''
                  image: >-
                    https://p1-kling.klingai.com/kcdn/cdn-kcdn112452/kling-qa-test/dog.png
                  'n': 2
                  external_task_id: ''
                  callback_url: ''
      responses:
        '200':
          description: Task accepted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubmitResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    KlingRequest:
      type: object
      required:
        - model_name
        - prompt
        - image
      properties:
        model_name:
          type: string
          description: Model name
          enum:
            - kling-v2-new
        prompt:
          type: string
          description: |-
            Positive text prompt
            Must not exceed 2500 characters.
          maxLength: 2500
        negative_prompt:
          type: string
          description: >-
            Negative text prompt

            Must not exceed 2500 characters.

            Note: Negative prompt is not supported in image-to-image mode (i.e.,
            when the image field is not empty).
          maxLength: 2500
        image:
          type: string
          description: >-
            Reference image


            - Supports image Base64 encoding or image URL (must be accessible)


            Base64 encoding notes:

            Please ensure all image data parameters use Base64 encoding format.
            When using Base64, do not add any prefix such as
            data:image/png;base64, — provide only the Base64 encoded string
            itself.


            Correct example:

            `iVBORw0KGgoAAAANSUhEUgAAAAUA...`


            Incorrect example:

            `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA...`


            - Supported image formats: .jpg / .jpeg / .png

            - Image file size must not exceed 10MB, image dimensions must be at
            least 300px, aspect ratio between 1:2.5 ~ 2.5:1

            - Required when image_reference is not empty
        image_reference:
          type: string
          enum:
            - subject
            - face
          description: >-
            Image reference type.


            - subject (character feature reference), face (facial appearance
            reference)

            - When using face (facial appearance reference), the uploaded image
            must contain only 1 face
        element_list:
          type: array
          items:
            type: object
            required:
              - element_id
            properties:
              element_id:
                type: integer
                format: int64
                description: Element ID from the element library.
          description: >-
            Element reference list, configured based on element IDs in the
            element library.

            Use key:value format:

            `"element_list":[{ "element_id": long },{ "element_id": long }]`

            The total number of reference elements and reference images must not
            exceed 10.
          maxItems: 10
        resolution:
          type: string
          enum:
            - 1k
          default: 1k
          description: Generated image resolution.
        'n':
          type: integer
          minimum: 1
          maximum: 9
          default: 1
          description: Number of images to generate.
        aspect_ratio:
          type: string
          description: Aspect ratio of generated images (width:height)
          default: '16:9'
          enum:
            - '1:1'
            - '16:9'
            - '4:3'
            - '3:2'
            - '2:3'
            - '3:4'
            - '9:16'
            - '21:9'
        watermark_info:
          type: object
          description: |-
            Whether to also generate a watermarked result.
            - Defined via the enabled parameter:

            ```json
             "watermark_info": { "enabled": boolean }
            ```

            - true to generate, false to not generate
            - Custom watermarks are not currently supported
          properties:
            enabled:
              type: boolean
              description: true to generate watermarked result, false to not generate.
        callback_url:
          type: string
          description: >-
            Callback notification URL for this task. If configured, the server
            will proactively notify when the task status changes.
        external_task_id:
          type: string
          description: >-
            Custom task ID.

            - Does not override the system-generated task ID, but supports
            querying by this ID.

            - Must be unique per user.
    SubmitResponse:
      type: object
      properties:
        code:
          type: integer
          description: Error code; see error codes for details.
          example: 0
        message:
          type: string
          description: Error message.
          example: string
        request_id:
          type: string
          description: >-
            Request ID, system-generated, used for request tracking and
            troubleshooting.
          example: string
        data:
          type: object
          properties:
            task_id:
              type: string
              description: Task ID, system-generated.
              example: string
            task_info:
              type: object
              description: Task creation parameter information.
              properties:
                external_task_id:
                  type: string
                  description: Client-provided custom task ID.
                  example: string
            task_status:
              type: string
              description: >-
                Task status. Enum values: submitted, processing, succeed,
                failed.
              enum:
                - submitted
                - processing
                - succeed
                - failed
              example: submitted
            created_at:
              type: integer
              format: int64
              description: Task creation time, Unix timestamp in milliseconds.
              example: 1722769557708
            updated_at:
              type: integer
              format: int64
              description: Task update time, Unix timestamp in milliseconds.
              example: 1722769557708
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Pass `Authorization: Bearer <token>` in the request header.'

````