> For the complete documentation index, see [llms.txt](https://docs.saas.haut.ai/haut.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.saas.haut.ai/haut.ai/developers/saas-api-overview/api-for-images.md).

# API for Images

This page contains description of images management via API.

Image is a data source object that is used by [Algorithms](/haut.ai/haut.ai-features/algorithms.md)to extract information and convert it into knowledge (for example, the estimation of skin concerns)

## What can you do?

You can find more details on these actions in the **Images section** of [Swagger](https://saas.haut.ai/api/swagger/#/Images).

* [Upload](#upload)
  * [Generate signed URL for upload](#generate-signed-url-for-upload)
  * [Send to computation](#send-to-computation)
* [List subject images](#list-subject-images)
* [Get image info](#get-image-info)
* [Delete image](#delete-image)

## Sides and lights IDs

side\_id: `1` - front image

side\_id: `2` - right image

side\_id: `3` - left image

light\_id: `1` - regular light

## Upload

### Generate signed URL for upload

{% openapi src="/files/YmTvOjpvwq9jx4lAuJV9" path="/api/v1/companies/{company\_id}/subjects/{subject\_id}/signed\_upload\_url/" method="post" %}
[openapi.json](https://245161714-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWxBX_zB4FnflOpyBGO%2Fuploads%2FRF3DdAp7DPLxOGdzKdfj%2Fopenapi.json?alt=media\&token=805fe368-c61f-4e86-bf72-e2de9d7d6e61)
{% endopenapi %}

When you've created a subject connected to your user, you can now request a signed URL to upload the image.

In the simplest case (uploading 1 frontal selfie to subject), you don't even need to send any extra payload in the body of this request.

After you've received response from this API method, you should take the key from response `upload_url`. It will contain following keys:

* `url` — the URL where to upload your image
* `method` — HTTP method that you should use for upload (`PUT` by default)
* `headers` — **required** headers to make an upload request

Also you need to save the response key `image_batch_id` to a variable in your code, it will be needed later. Batch is simply a grouping of images in one group. In the simplest case when you upload only selfies, it's just a group of 1 image.

Then you perform an upload request, sending exactly the headers returned in `upload_url.headers` (do not hardcode them — these values, such as the allowed size range, can change server-side, and a mismatch will cause the storage provider to reject the upload with a 403):

```
curl -X {upload_url.method} {upload_url.url} \
  -H "<header_name_1>: <upload_url.headers[header_name_1]>" \
  -H "<header_name_2>: <upload_url.headers[header_name_2]>" \
  --upload-file {file_name}
```

{% hint style="warning" %}
This upload request goes directly to the storage provider, not through the SaaS API. A `403` here means the headers sent don't match the signed URL's policy (e.g. an outdated or hardcoded size-range header) — it will **not** appear in SaaS API logs, so check the client-side response to this request, not the backend, when diagnosing upload failures.
{% endhint %}

Image requirements:

* Minimum image resolution is **256x256** pixels.
* Maximum resolution is not restricted, but remember - the heavier is the picture, the longer it's being processed.
* Maximum image size is **30MB**. The optimal image size is an average modern smartphone selfie (**3-5MB**).
* Images should be in one of these file formats:
  * JPEG
  * PNG
  * WEBP

***

### Send to computation

After the upload is done, you should send signal to SaaS API backend, that upload is complete and we should start processing your image by algorithms.

Use previously saved `image_batch_id` as a `batch_id` here. The request body can be empty.

{% openapi src="/files/YmTvOjpvwq9jx4lAuJV9" path="/api/v1/companies/{company\_id}/batches/{batch\_id}/compute/" method="post" %}
[openapi.json](https://245161714-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWxBX_zB4FnflOpyBGO%2Fuploads%2FRF3DdAp7DPLxOGdzKdfj%2Fopenapi.json?alt=media\&token=805fe368-c61f-4e86-bf72-e2de9d7d6e61)
{% endopenapi %}

***

## List subject images

{% openapi src="/files/YmTvOjpvwq9jx4lAuJV9" path="/api/v1/companies/{company\_id}/subjects/{subject\_id}/images/" method="get" %}
[openapi.json](https://245161714-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWxBX_zB4FnflOpyBGO%2Fuploads%2FRF3DdAp7DPLxOGdzKdfj%2Fopenapi.json?alt=media\&token=805fe368-c61f-4e86-bf72-e2de9d7d6e61)
{% endopenapi %}

Note that you can access aux images ([aux images API link](/haut.ai/developers/saas-api-overview/api-for-images/api-for-aux-images.md)) directly in this response.

***

## Get image info

{% openapi src="/files/YmTvOjpvwq9jx4lAuJV9" path="/api/v1/companies/{company\_id}/images/{image\_id}/" method="get" %}
[openapi.json](https://245161714-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWxBX_zB4FnflOpyBGO%2Fuploads%2FRF3DdAp7DPLxOGdzKdfj%2Fopenapi.json?alt=media\&token=805fe368-c61f-4e86-bf72-e2de9d7d6e61)
{% endopenapi %}

Note that you can access aux images ([aux images API link](/haut.ai/developers/saas-api-overview/api-for-images/api-for-aux-images.md)) directly in this response.

***

## Delete image

{% openapi src="/files/YmTvOjpvwq9jx4lAuJV9" path="/api/v1/companies/{company\_id}/images/{image\_id}/" method="delete" %}
[openapi.json](https://245161714-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWxBX_zB4FnflOpyBGO%2Fuploads%2FRF3DdAp7DPLxOGdzKdfj%2Fopenapi.json?alt=media\&token=805fe368-c61f-4e86-bf72-e2de9d7d6e61)
{% endopenapi %}

***

{% hint style="warning" %}
Not a Haut.AI client yet?
{% endhint %}

<a href="https://haut.ai/book-a-demo?utm_source=referral&#x26;utm_medium=saas_docs&#x26;utm_campaign=Docs_SaaS_HautAI" class="button primary" data-icon="user-vneck">Book a demo</a> <a href="https://haut.ai/product/ai-skin-analysis?utm_source=referral&#x26;utm_medium=saas_docs&#x26;utm_campaign=Docs_SaaS_HautAI" class="button secondary" data-icon="external-link">Platform overview on haut.ai</a>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.saas.haut.ai/haut.ai/developers/saas-api-overview/api-for-images.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
