---
title: "Analyze an image using AI"
method: POST
path: "/api/ai/images/v2/image-analysis"
tags: ["AI Services"]
---

# Analyze an image using AI

`POST /api/ai/images/v2/image-analysis`

## Request

- Base URL: `https://api.worqhat.com`
- URL: `https://api.worqhat.com/api/ai/images/v2/image-analysis`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/worqhat/apis/worqhat-ai-api-endpoints-2/docs/api/ai/images/v2/image-analysis/post.ts> (a function with typed inputs; its response is checked against the schema)

Analyse an Image using AI. This endpoint helps to identify the different objects in the image, classify them and assign them under different aliases. It also analyses the Colour combinations of the different objects, describes the activities and the dominant colours in the image.

## Request body `multi-part/form-data`

- object
  - `images` string[]: The images to be sent as input. You can pass a maximum of 10 images.
  - `output_type` 'json' | 'text': The type of output to be generated. You can choose between `json` and `text`. `json` will return the text detection results as a JSON object with the scan words marked and positional information. `text` will return the text detection results as a plain text string with a proper description of the image and what it contains.
  - `question` string: The question to be answered by the AI or any specific command you would like the Model to take into consideration while analysing the image. This is an optional parameter. If not provided, the AI will only send a description of the image and what it contains.
  - `training_data` string: The training data to be used for the AI. This is an optional parameter. If not provided, the AI will use the default training data. It is only applicable for Image Analysis process with Text as `output_type`.
  - `stream_data` boolean: Whether to stream the data as it is being generated. If set to true, the response will be streamed as the data is being generated. This is useful when you want to generate a lot of content and want to save the data as it is being generated. You need to handle Server Sent Events for this use case.

## Response `200`

OK

- object
  - `code` integer: The HTTP status code.
  - `status` string: Status indicating the success of the response.
  - `data` object: The response data.
    - `analysed_data` array[]: Analyzed data.
      - unknown[]
        - unknown
    - `quality` object: Quality information.
      - `brightness` number: Brightness value.
      - `contrast` number: Contrast value.
      - `sharpness` number: Sharpness value.
    - `foreground` object: Foreground information.
      - `dominant_colors` string[]: Dominant colors in the foreground.
      - `quality` unknown[]
        - unknown
    - `background` object: Background information.
      - `dominant_colors` string[]: Dominant colors in the background.
      - `quality` unknown[]
        - unknown
    - `primary_colours` array[]: Primary colors.
      - unknown[]
        - unknown
  - `processing_time` integer: The time taken to process the request, in milliseconds.
  - `processing_id` string: A universally unique identifier for the request. This can be used to track the request in the logs.
  - `processing_count` integer: The number of times the request has been processed.

## Other responses

- `400`: Bad Request. This mostly happens because of invalid image sizes. Neither `height` nor `width` of the image should be less than 128px. Only one of the sides of the image should be greater than or equal to 512px. (Eg: 512x512, 512x768, 768x512) Maximum dimensions supported is 512x896.
- `401`: Unauthorized
- `404`: Not Found
- `406`: Not Acceptable
- `500`: Internal Server Error

## Changes

- **2024-03-14** `8a9f01a62e1e`: 1 warning, 3 info
  - removed the request property `image`
  - added the new optional request property `images`
  - added the new optional request property `stream_data`
  - added the new optional request property `training_data`
- **2024-01-13** `7fd477384d88`: 1 warning
  - removed the request property `stream_data`
- **2024-01-12** `865876b137c8`: 1 info
  - added the new optional request property `stream_data`
- **2023-11-25** `804b6a21160a`: 2 info
  - added the new optional request property `output_type`
  - added the new optional request property `question`
- **2023-10-20** `871850b7231f`: 2 breaking, 3 warning, 19 info
  - request body became required
  - removed the media type `multipart/form-data` from the request body
  - removed the optional property `content` from the response with the `200` status
  - removed the optional property `id` from the response with the `200` status
  - …20 more

[Operation history](https://skmtc.dev/worqhat/apis/worqhat-ai-api-endpoints-2/changes/api/ai/images/v2/image-analysis/post.md)

---

[API](https://skmtc.dev/worqhat/apis/worqhat-ai-api-endpoints-2.md) - [All operations](https://skmtc.dev/worqhat/apis/worqhat-ai-api-endpoints-2/llms.txt) - [OpenAPI document](https://skmtc.dev/worqhat/apis/worqhat-ai-api-endpoints-2/revisions/fc369f69a3e6?raw)
