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

# Recognize images with Kling

> Use CometAPI POST /kling/v1/videos/image-recognize to run Kling Image Recognize on images and return recognition results for video generation workflows.

Use this endpoint to run Kling's image-recognition checks before you decide which downstream workflow to use.

## What it returns

* The route is synchronous and returns recognition flags directly
* Current results indicate whether the image contains regions such as `head_seg`, `face_seg`, `cloth_seg`, and `object_seg`
* Use these flags to decide whether a source image is suitable for avatar, try-on, or other asset-driven workflows

<Tip>
  For the complete parameter reference, see the [official Kling documentation](https://app.klingai.com/global/dev/document-api/apiReference/model/imageRecognize).
</Tip>


## OpenAPI

````yaml api/openapi/video/kling/post-image-recognize.openapi.json POST /kling/v1/videos/image-recognize
openapi: 3.1.0
info:
  title: Image Recognize API
  version: 1.0.0
  description: >-
    Run Kling image-recognition checks and receive recognition flags
    synchronously.
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /kling/v1/videos/image-recognize:
    post:
      summary: Run Kling image recognition
      description: >-
        Submit one image and receive recognition flags such as head, face,
        cloth, or object segmentation presence.
      operationId: image_recognize
      parameters:
        - name: Content-Type
          in: header
          required: false
          description: Optional content type header.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - image
              properties:
                image:
                  type: string
                  description: >-
                    Image to analyze. Accepts an image URL or raw Base64 string
                    (no `data:` prefix). Supported formats: JPG, JPEG, PNG. Max
                    10 MB, minimum 300 px per side, aspect ratio between 1:2.5
                    and 2.5:1.
              default:
                image: https://your-image-host/portrait.jpg
            examples:
              Example 1:
                summary: Example 1
                value:
                  image: https://your-image-host/portrait.jpg
      responses:
        '200':
          description: Recognition result.
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - message
                  - data
                properties:
                  code:
                    type: integer
                  message:
                    type: string
                  request_id:
                    type: string
                  data:
                    type: object
                    required:
                      - task_result
                    properties:
                      task_result:
                        type: object
                        required:
                          - images
                        properties:
                          images:
                            type: array
                            items:
                              type: object
                              properties:
                                type:
                                  type: string
                                is_contain:
                                  type: boolean
                example:
                  code: 0
                  message: SUCCEED
                  data:
                    task_result:
                      images:
                        - type: head_seg
                          is_contain: true
                        - type: face_seg
                          is_contain: true
                        - type: cloth_seg
                          is_contain: true
                        - type: object_seg
                          is_contain: true
      x-codeSamples:
        - lang: Shell
          label: Default
          source: |
            curl https://api.cometapi.com/kling/v1/videos/image-recognize \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                  "image": "https://your-image-host/portrait.jpg"
                }'
        - lang: Python
          label: Default
          source: >
            import os

            import requests


            response = requests.post(
                "https://api.cometapi.com/kling/v1/videos/image-recognize",
                headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
                json={
                        "image": "https://your-image-host/portrait.jpg"
                },
            )


            result = response.json()

            print(result["code"], result.get("data", {}).get("task_id"))  # the
            route responds with the result payload directly
        - lang: JavaScript
          label: Default
          source: >
            const response = await
            fetch("https://api.cometapi.com/kling/v1/videos/image-recognize", {
                method: "POST",
                headers: {
                    Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
                    "Content-Type": "application/json",
                },
                body: JSON.stringify({
                        "image": "https://your-image-host/portrait.jpg"
                    }),
            });


            const result = await response.json();

            console.log(result.code, result.data?.task_id); // the route
            responds with the result payload directly
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer token authentication. Use your CometAPI key.

````