> ## 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.

# Reconocer imágenes con Kling

> Usa CometAPI POST /kling/v1/videos/image-recognize para ejecutar Kling Image Recognize en imágenes y devolver resultados de reconocimiento para flujos de trabajo de generación de video.

Usa este endpoint para ejecutar las comprobaciones de reconocimiento de imágenes de Kling antes de decidir qué flujo de trabajo posterior usar.

## Qué devuelve

* La ruta es síncrona y devuelve directamente indicadores de reconocimiento
* Los resultados actuales indican si la imagen contiene regiones como `head_seg`, `face_seg`, `cloth_seg` y `object_seg`
* Usa estos indicadores para decidir si una imagen de origen es adecuada para avatar, try-on u otros flujos de trabajo basados en recursos

<Tip>
  Para consultar la referencia completa de parámetros, consulta la [documentación oficial de Kling](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.

````