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

# Afbeeldingen herkennen met Kling

> Gebruik CometAPI POST /kling/v1/videos/image-recognize om Kling Image Recognize op afbeeldingen uit te voeren en herkenningsresultaten terug te geven voor workflows voor videogeneratie.

Gebruik dit endpoint om de beeldherkenningscontroles van Kling uit te voeren voordat je beslist welke downstream-workflow je wilt gebruiken.

## Wat het retourneert

* De route is synchroon en retourneert herkenningsvlaggen direct
* De huidige resultaten geven aan of de afbeelding regio's bevat zoals `head_seg`, `face_seg`, `cloth_seg` en `object_seg`
* Gebruik deze vlaggen om te bepalen of een bronafbeelding geschikt is voor avatar-, try-on- of andere assetgedreven workflows

<Tip>
  Voor de volledige parameterreferentie, zie de [officiële Kling-documentatie](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.

````