# Overview

An introduction to Claid's API

Claid API provides access to powerful AI-based image editing workflows via a simple declarative interface. It allows you to enhance and restore images, fit size to given requirements, separate object from background, align the object within a frame and automatically adjust colors.&#x20;

This comprehensive guide for developers describes all the API features and image processing operations.

[Getting started with Claid API: Step-by-step video tutorial.](https://www.youtube.com/watch?v=vvcV1L6UZK8\&t=4s)

[Quick Start](/quick-start) is a hands-on introduction to Claid API to get a feel of what it can do.

[Guides section](/guides/e-commerce) contains industry-specific examples.

[Image Operations](/image-editing-api/image-operations) provides an in-depth explanation of all the image processing options and their combinations.

[Storage Management](/storage-connectors/overview) describes how to connect your cloud storage using Storage Connectors and storage API reference.

{% hint style="info" %}
If your company does not have a Claid account, please [book a call with our team](https://claid.ai/schedule-demo).
{% endhint %}

See our [Blog](https://claid.ai/blog/) and follow [@ClaidAI](https://twitter.com/ClaidAI) on Twitter to stay updated.

{% content-ref url="/pages/DSShbU64RGw5lKVebIjm" %}
[Quick Start](/quick-start)
{% endcontent-ref %}


# Quick Start

Get up and running with Claid API within minutes

## Get your API keys

Your API requests are authenticated using API keys. Any request that doesn't include an API key will return an error.  You can generate and manage API keys in [your Claid account](<https://claid.ai/account/api >).&#x20;

## Make an image processing request

To make your first request, send an authenticated request to the [image editing](/image-editing-api/image-i-o) endpoint. All you need to do is just replace API key placeholder with your actual API key.

This sample request will perform ML-based color adjustment, sharpen the image and turn it into 800x800 square.

{% tabs %}
{% tab title="HTTP" %}

```http
POST /v1/image/edit HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
Content-Type: application/json

{
    "input": "https://claid.ai/doc-samples/bag.jpeg",
    "operations": {
        "resizing": {
            "width": 800,
            "height": 800,
            "fit": "crop"
        },
        "adjustments": {
            "hdr": 60,
            "sharpness": 40
        }
    },
    "output": {
        "format": {
	    "type": "jpeg",
	    "quality": 90
	}
    }
}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl -X POST --location "https://api.claid.ai/v1/image/edit" --http1.1 \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}" \
    -H "Content-Type: application/json" \
    -d "{
            \"input\": \"https://claid.ai/doc-samples/bag.jpeg\",
            \"operations\": {
                \"resizing\": {
                    \"width\": 800,
                    \"height\": 800,
                    \"fit\": \"crop\"
                },
                \"adjustments\": {
                    \"hdr\": 60,
                    \"sharpness\": 40
                }
            },
            \"output\": {
                \"format\": {
        	    \"type\": \"jpeg\",
        	    \"quality\": 90
        	}
            }
        }"c
```

{% endtab %}
{% endtabs %}

Your response should be similar to following:

```http
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 319
Connection: keep-alive
ratelimit-limit: 120, 120;w=60, 4;w=1
ratelimit-remaining: 118
ratelimit-reset: 42
x-request-id: 4005f581-723f-4c79-85a1-bdd752718887


{
  "data": {
    "input": {
      "ext": "jpeg",
      "mps": 4.1472,
      "mime": "image/jpeg",
      "format": "JPEG",
      "width": 2880,
      "height": 1440
    },
    "output": {
      "ext": "jpeg",
      "mps": 0.64,
      "mime": "image/jpeg",
      "format": "JPEG",
      "width": 800,
      "height": 800,
      "tmp_url": "....."
    }
  }
}
```

And here's the sample image we just used in our request (left) and the result it produced (right).

![Input image](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FgLU7GdECOBF8K1qtvsKM%2Fbag.jpeg?alt=media\&token=95627755-fadd-45f7-ada9-4cd43426774e) ![Output image, 800x800 square](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2F9yuW8YcZSqqxI0l9lEas%2Fbag-quickstart-output.jpeg?alt=media\&token=acf04b0b-7939-40ef-8a3e-13ba83e8b87a)


# Authentication

The Claid API uses API keys via **Bearer Auth** for API authentication with the following format: `Authorization: Bearer {YOUR_API_KEY}`.

To get your API key, [sign in to your Claid account](https://claid.ai/account/overview) and click ***Create API key*** button from the ***Overview*** or ***API keys*** pages.

![Create API key from the Claid dashboard](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2Ft7uRnxTcsAGIPhWS6VjK%2FScreen%20Recording%202022-05-09%20at%2015.43.31.gif?alt=media\&token=9145ce8b-9dd1-4013-81c2-b0ae55cf6c78)

Once API key is generated, you can either copy it or download it as a txt file.

{% hint style="info" %}
Make sure to save the API key in a safe place, as it has certain privileges and is only visible on the Claid dashboard once, at the time of creation.
{% endhint %}

### API key usage

Authentication to the API is performed via [Bearer Authentication](https://swagger.io/docs/specification/authentication/bearer-authentication/):

{% tabs %}
{% tab title="HTTP" %}

```http
GET {API_ENDPOINT} HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl -X GET --location "https://{API_ENDPOINT}" --http1.1 \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}"
```

{% endtab %}
{% endtabs %}

### Permission scopes

Each API key can have permissions to perform [Storage](/storage-connectors/api-reference), [Image editing](/image-editing-api/api-reference) or both types of operations with **Admin** permission scope.

Scopes can be assigned to API key from the [Claid dashboard](https://claid.ai/account/api) at the creation time or later, via ***API keys*** → ***Edit key*** page.

{% hint style="info" %}
It’s always better to create API keys with minimal permissions scopes necessary for your use case.
{% endhint %}


# Rate limits

The Claid API uses a number of safeguards against bursts of incoming traffic to help maximize its stability. Image processing requests that come with relatively high intensity can be temporarily limited.

{% hint style="info" %}
By default, users may issue up to **120 requests per minute** and **4 request per second**. \
if you need to **expand the limits** to process even more images or use **image batch processing** to efficiently process multiple images, please [contact us](mailto:sales@claid.ai).
{% endhint %}

&#x20;To explore the remaining restrictions, every image processing response contains relevant headers:

* `RateLimit-Limit` indicates the request-quota associated with the user in the current time window.
* `RateLimit-Remaining` indicates the remaining requests that you can issue in the current time window.
* `RateLimit-Reset` is the number of seconds until the quota resets.

<details>

<summary>Example of a typical response headers</summary>

Let's explore the example of a typical response headers for an image processing request:

```http
HTTP/2 200
Content-Type: application/json
RateLimit-Limit: 120, 120;w=60, 4;w=1
RateLimit-Remaining: 118
RateLimit-Reset: 32
```

Here we can see that we have request limits:

* `120;w=60` which means 120 requests per 60 seconds.
* `4;w=1` which means 4 requests per 1 second.

Besides, the `RateLimit-Limit` header indicates that we got under the first limit of **120** **requests per minute**. This leaves us with **118** **remaining request** that we can send in the next **32 seconds**. When this time passes - the limits will be reset.

</details>

<details>

<summary>Example of a limits exceed response</summary>

If you exceed limits, the example of payload with response headers may look like this:

```http
HTTP/2 429
Content-Type: application/json
RateLimit-Limit: 4, 120;w=60, 4;w=1
RateLimit-Remaining: -1
RateLimit-Reset: 1

{
  "detail": {
    "error_code": "2001",
    "error_type": "general",
    "error_message": "Too Many Requests. Rate limit exceeded."
  }
}
```

Here we can see that we've got a <mark style="background-color:red;">`429 status code`</mark> which indicates that we exceeded the **4 requests per second** rate limit. Since we don't have any remaining allowed requests, we will be able to process new images again in **1 second**, when the limit will be reset.

</details>


# Errors

The page provides the description of expected errors of Claid API and guidance how to handle them.

The Claid API provides standard HTTP status codes. Every successful responses are indicated with a 200-series and error responses with non-200-series HTTP code.

Error reasons can vary, but the structure of the response always looks the following:

### Error response structure

```json
{
    "error_code": "9000",
    "error_type": "validation",
    "error_message": "name: ensure this value has at most 50 characters. parameters.credentials.access_key: field required.",
    "error_details": {
        "name": [
            "ensure this value has at most 50 characters"
        ],
        "parameters.credentials.access_key": [
            "field required"
        ],
}
```

#### Error response  attributes:

* **`error_code`** *<mark style="color:blue;">string</mark>*\
  &#x20;Claid internal error identifier.
* **`error_type`** *<mark style="color:blue;">string</mark>*\
  &#x20;Claid errors are grouped by topics and this field returns the name of that group.
* **`error_message`** *<mark style="color:blue;">string</mark>*\
  A human-readable description of the error. \
  If there were several reasons for failure - they will be concatenated as separate sentences, divided with `.` (dot).
* **`error_details`** *<mark style="color:blue;">object</mark>*\
  If there is a request validation error with `key:value` pairs - this field represents a nicely formatted version of `error_message`. Otherwise it can be an empty object - `{}`.

Error response example with an empty **`error_details`**

```json
{
    "error_code": "111",
    "error_type": "auth",
    "error_message": "Authorization is required.",
    "error_details": {}
}
```

#### How to get error reason

If you want to get a human-readable error message, then it is best to always get data from the **`error_message`** attribute.

If you prefer to represent the error yourself according to the `key:value` pairs of errored fields,  use **`error_details`**. Note: It can be an empty object if there was no validation error associated with the field. In this case, you can get the message from the **`error_message`** attribute.

### HTTP status codes summary

**`200-2xx`**  *<mark style="color:blue;">OK</mark>*

Everything worked as expected

&#x20;**`400`**  *<mark style="color:blue;">Bad Request</mark>*

Since this is a generic error, there can be several reasons why we get it, such as when we can't get the object from storage, or can't even parse JSON payload when it's invalid.&#x20;

In any case, you can get the error reason from `error_message` attribute. See the [How to get error reason](#strategy-to-get-error-reason) above.

**`401`**  *<mark style="color:blue;">Unauthorized</mark>*

You are unauthorized to access the requested resource. Learn how to [authenticate via API key](/authentication).

**`402`**  *<mark style="color:blue;">No API calls left</mark>*

Your account has run out of API calls. Purchase more API call credits to continue using [Claid.ai](http://claid.ai/).

**`403`**  *<mark style="color:blue;">Forbidden</mark>*

The API key doesn't have permissions to perform the request. We recommend checking the scopes and correctness of the API key.

**`404`**  *<mark style="color:blue;">Not Found</mark>*

The requested resource doesn't exist.&#x20;

**`409`**  *<mark style="color:blue;">Conflict</mark>*

The request can't be processed, because of conflict in the current state of the resource.

**`422`**  *<mark style="color:blue;">Unprocessable Entity</mark>*

The error indicates that the payload has logical or validation issues. The concrete reasons can be found in `error_message` and `error_details` fields.&#x20;

**`429`**  *<mark style="color:blue;">Too Many Requests</mark>*

Request cannot be served due to the API's rate limit. See [Rate Limits](/rate-limits) page for more information.

**`500`**  *<mark style="color:blue;">Internal Server Error</mark>*

Temporary error, which indicates that we experiencing an internal error.

This is a rare case but if you continue to receive this error, please [reach out to API support](#get-help) with request details.

### Get help

In case of any issues with image processing, you can reach out to our [technical support](mailto:support@claid.ai) and provide them details with `x-request-id` header value (see the API reference).


# Image I/O

### Input

Our API supports several options to provide source images that need to be processed.

#### HTTP(S) URL

URL of the input image should be from 1 to 512 characters. The image must be accessible by our system.

```json
{
    "input": "https://letsenhance.io/docs/assets/samples/burger.jpg"
}
```

#### &#x20;Image upload

Our API also supports the ability to upload image content directly. Just make sure that all respective headers are set. See [Upload API Reference](/image-editing-api/upload-api-reference) for more info.

#### Connected storage

You can connect [Cloud Storage](/storage-connectors/overview) and use it as a source for images. Currently, our API supports AWS S3 and Google Cloud Storage.

After connecting your Cloud Storage, you can refer the storage name as an input.

```json
{
    "input": "storage://storage-name/path/image-name.jpg"
}
```

#### Input image file types

Our API supports the following image formats as inputs: BMP, GIF, JPEG, PNG, TIFF, WEBP, AVIF, and HEIC.

### Output

Configuration of result output is optional.&#x20;

By default, you may omit the output option from the request payload. In this case, our system stores the result in a temporary bucket with a lifespan of 24 hours and provides a public URL to the image.

Alternatively, you can use a connected [Cloud Storage](/storage-connectors/overview): just configure the path to the folder where you want to store results.

#### Output image file types

The following image formats are supported for the output: JPEG, PNG, TIFF, WEBP and AVIF.

#### Basic and advanced output options

{% tabs %}
{% tab title="Basic Usage" %}

```json
{
    "output": "storage://storage-name/result-path/image-name.jpg"
}
```

{% endtab %}

{% tab title="Advanced Usage" %}

```json
"output": {
    "destination": "storage://storage-name/result-path/image-name.jpg",
    "format": "jpeg",
    "metadata": {
        "dpi": 300,
        "color_space": {
            "type": "CMYK",
            "color_profile": "ISO_Coated"
        }
    }
}
```

{% endtab %}

{% tab title="Advanced Format Usage" %}

```json
"output": {
    "destination": "storage://storage-name/result-path/image-name.jpg",
    "format": {
        "type": "jpeg",
        "quality": 85,
        "progressive": true
    }
}

```

{% endtab %}
{% endtabs %}

&#x20;See the full list of the advanced format-specific options below:

{% tabs %}
{% tab title="jpeg" %}

<table><thead><tr><th width="164">Name</th><th width="101">Type</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:purple;"><code>quality</code></mark></td><td><em>integer</em></td><td>Specifies the amount of JPEG lossy compression in the range 1 - 100. Defaults to <strong>85</strong>.</td></tr><tr><td><mark style="color:purple;"><code>progressive</code></mark></td><td><em>boolean</em></td><td>Progressive JPEG loads in a browser in successive waves until a clear picture is formed, thus improving the image loading speed. Used by default.</td></tr></tbody></table>
{% endtab %}

{% tab title="png" %}

<table><thead><tr><th width="163">Name</th><th width="102">Type</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:purple;"><code>compression</code></mark></td><td><em>string</em></td><td><p>Indicates compression effort that will be applied during the PNG image encoding. Should have one of the values:</p><ul><li><mark style="color:purple;"><code>fast</code></mark> is used to apply minimum compression resulting in a bigger image size but less processing time.</li><li><mark style="color:purple;"><code>best</code></mark> is used to apply maximum compression resulting in a smaller image size but more processing time.</li><li><mark style="color:purple;"><code>optimal</code></mark> is the <strong>default</strong> and used to balance between compression effort and processing time.</li></ul></td></tr></tbody></table>
{% endtab %}

{% tab title="tiff" %}

<table><thead><tr><th width="164">Name</th><th width="101">Type</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:purple;"><code>compression</code></mark></td><td>string,<br>object</td><td><p></p><p>The TIFF codec supports both lossless and lossy modes of operation, so you can select the one that is appropriate for your goals. Should have one of the values:</p><ul><li><mark style="color:purple;"><code>lossy</code></mark> is used to apply lossy compression to significantly reduce the image size in exchange for some loss of data, reducing the quality of an image. JPEG compression is used.</li><li><mark style="color:purple;"><code>{"type": "lossy", "quality": 1..100}</code></mark> is used to apply lossy compression and specify the amount of loss you are willing to accept. Defaults to <strong>75</strong>.</li><li><mark style="color:purple;"><code>lossless</code></mark> is used to apply lossless compression to preserve maximum image detail in exchange for a significantly increased file size. Lempel–Ziv–Welch (LZW) compression is used.</li></ul><p>By default, <mark style="color:purple;"><code>lossless</code></mark> is used if <mark style="color:purple;"><code>compression</code></mark> is not selected.</p></td></tr></tbody></table>
{% endtab %}

{% tab title="avif" %}

<table><thead><tr><th width="164">Name</th><th width="101">Type</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:purple;"><code>compression</code></mark></td><td>string,<br>object</td><td><p></p><p>The AVIF codec supports both lossless and lossy modes of operation, so you can select the one that is appropriate for your goals. Should have one of the values:</p><ul><li><mark style="color:purple;"><code>lossy</code></mark> is used to apply lossy compression to significantly reduce the image size in exchange for some loss of data, reducing the quality of an image.</li><li><mark style="color:purple;"><code>{"type": "lossy", "quality": 1..100}</code></mark> is used to apply lossy compression and specify the amount of loss you are willing to accept. Defaults to <strong>50</strong>.</li><li><mark style="color:purple;"><code>lossless</code> i</mark>s used to apply lossless compression to preserve maximum image detail in exchange for a significantly increased file size. </li></ul></td></tr></tbody></table>
{% endtab %}

{% tab title="webp" %}

<table><thead><tr><th width="164">Name</th><th width="101">Type</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:purple;"><code>compression</code></mark></td><td>string,<br>object</td><td><p></p><p>The WEBP format supports both lossless and lossy modes of operation, so you can select the one that is appropriate for your goals. Should have one of the values:</p><ul><li><mark style="color:purple;"><code>lossy</code></mark> is used to apply lossy compression to significantly reduce the image size in exchange for some loss of data, reducing the quality of an image.</li><li><mark style="color:purple;"><code>{"type": "lossy", "quality": 1..100}</code></mark> is used to apply lossy compression and specify the amount of loss you are willing to accept. Defaults to <strong>75</strong>.</li><li><mark style="color:purple;"><code>lossless</code> i</mark>s used to apply lossless compression to preserve maximum image detail in exchange for a significantly increased file size. </li></ul></td></tr></tbody></table>
{% endtab %}
{% endtabs %}

#### Color space

The API supports changing color space for an output image.

```json
"output": {
    "destination": "storage://storage-name/result-path/image-name.jpg",
    "metadata": {
        "color_space": "RGB"
    }
}
```

If you do not specify a color space or color profile when making a request, the API automatically takes care of preserving color space. For images in RGB, the API keeps the RGB color space and assigns the standard sRGB profile to the output. For images in CMYK or GRAY, the API keeps the original color space and also carries over any embedded color profile that was present in the input. This way, the output image stays visually consistent with the source image.

<table><thead><tr><th width="123.33333333333331">Name</th><th width="117">Type</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:purple;"><code>RGB</code></mark></td><td><em>string</em></td><td>Is the color space for digital images. Use the RGB color mode if your image is supposed to be displayed on any kind of screen.</td></tr><tr><td><mark style="color:purple;"><code>CMYK</code></mark></td><td><em>string</em></td><td>Is the color space for printed materials. Use CMYK for any image that will be physically printed, not viewed on a screen.</td></tr></tbody></table>

&#x20;For CMYK color space, you also can specify the color profile that will be applied to the image.&#x20;

```json
"output": {
    "destination": "storage://storage-name/result-path/image-name.jpg",
    "metadata": {
        "color_space": {
            "type": "CMYK",
            "color_profile": "ISO_Coated"
        }
    }
}
```

<table><thead><tr><th width="196.33333333333331">Name</th><th width="77">Type</th><th width="210">Description</th><th width="77">TAC *</th><th>Characterisation data</th></tr></thead><tbody><tr><td><mark style="color:purple;"><code>ISO_Coated</code></mark></td><td><em>string</em></td><td>Standard for glossy and matte coated paper (grades 1 and 2).</td><td>330%</td><td>Coated FOGRA39<br><em>ISO 12647-2:2004</em></td></tr><tr><td><mark style="color:purple;"><code>ISO_Uncoated</code></mark></td><td><em>string</em></td><td>Standard for uncoated white natural paper (grade 4).</td><td>300%</td><td>Uncoated FOGRA29<br><em>ISO 12647-2:2004</em></td></tr><tr><td><mark style="color:purple;"><code>USWeb_Coated</code></mark></td><td><em>string</em></td><td>Standard for glossy and matte coated paper in the United States (grades 1, 2, 3 and 4).</td><td>300%</td><td>SWOP2006 Coated3v2<br><em>CGATS TR003</em></td></tr><tr><td><mark style="color:purple;"><code>USWeb_Uncoated</code></mark></td><td><em>string</em></td><td>Standard for uncoated white natural paper in the United States (grade 4).</td><td>260%</td><td>GRACoL 2013 Uncoated<br><em>CGATS21-2-CRPC3</em></td></tr></tbody></table>

{% hint style="info" %}
\* "Total Area Coverage” – or TAC for short – refers to the amount of ink coverage called for in a given area of an image. It's calculated by summing the **C**yan, **M**agenta, **Y**ellow and Blac**k** percentages in that area.
{% endhint %}

{% hint style="warning" %}
Color space is only supported in <mark style="color:purple;">`JPEG`</mark> format.
{% endhint %}


# Image Operations

Operations are the core of the Claid API. They represent the specific tasks that the API will perform on images you process. We use our proprietary AI-powered, GPU-optimized rendering pipeline. It hosts a variety of operations to automate image processing workflows.

![From upscaling to background removal: some of Claid's image operations that you can perform in a single API call](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2F4ClSGxuNDyprF9QnUy9C%2F54ffc146-53df-4482-aa4e-399b5d46c470%201.png?alt=media\&token=5568042a-607b-41fa-8971-3104152346ae)


# Restorations

Restore lost details and decompress images

Image restorations are one of the most important operations to perform with Claid API. You can choose from a wide range of AI-powered neural networks to <mark style="color:purple;">`decompress`</mark>, <mark style="color:purple;">`upscale`</mark>, and <mark style="color:purple;">`polish`</mark> images for different processing workflows.

## Upscale <a href="#upscale" id="upscale"></a>

The <mark style="color:purple;">`upscale`</mark> operation allows you to improve the overall quality of an image by rendering out new pixels. The upscale operation works along with [Resizing](/image-editing-api/image-operations/resizing) through numeric or percentage values for upscaling.  &#x20;

Upscaling is turned off by default. It can be defined by setting the <mark style="color:purple;">`upscale`</mark> object to one of the following upscaling methods below.

{% hint style="info" %}
The lower the image resolution is the less information it has, making the upscaling more difficult. We recommend you to try different upscaling methods to increase the chances of finding consistent, quality results.
{% endhint %}

#### Properties

<table><thead><tr><th width="240.16507345606317">Name</th><th width="150">Type</th><th width="358.37336504161715">Description</th></tr></thead><tbody><tr><td><mark style="color:purple;"><code>smart_enhance</code></mark></td><td><em>string</em></td><td>Used on small low quality product, real estate and food images.</td></tr><tr><td><mark style="color:purple;"><code>smart_resize</code></mark></td><td><em>string</em></td><td>Used on high-quality images and photos with barely readable text. </td></tr><tr><td><mark style="color:purple;"><code>digital_art</code></mark></td><td><em>string</em></td><td>Used on drawings, illustrations, paintings, cartoons, anime, etc.</td></tr><tr><td><mark style="color:purple;"><code>faces</code></mark></td><td><em>string</em></td><td>Used on images containing people</td></tr><tr><td><mark style="color:purple;"><code>photo</code></mark></td><td><em>string</em></td><td>Used on photos of people, nature, architecture, etc. taken with phones or digital cameras.</td></tr></tbody></table>

#### **Request example for Upscale:**

This code sample combines the use of `restorations` and `resizing` operations. For more details, see [Resizing](/image-editing-api/image-operations/resizing).

{% tabs %}
{% tab title="Smart Enhance" %}

```json
"operations": {
    "restorations": {
        "upscale": "smart_enhance"
    },
    "resizing": {
        "width": "200%",
        "height": "200%"
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FDoQE5oZM8JuNHyC32Bcw%2FRestorations%20-%20Upscale%20-%20Smart%20Enhance.png?alt=media\&token=19ffcfcc-70f3-4965-ab54-d54c92f7e96b)
{% endtab %}

{% tab title="Smart Resize" %}

```json
"operations": {
    "restorations": {
        "upscale": "smart_resize"
    },
    "resizing": {
        "width": "200%",
        "height": "200%"
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FlkIKC9A5KqCs6ILDogkF%2FRestorations%20-%20Upscale%20-%20Smart%20Resize.png?alt=media\&token=b3d78dfc-7e72-4cc7-8570-abddecf6effd)
{% endtab %}

{% tab title="Photo" %}

```json
"operations": {
    "restorations": {
        "upscale": "photo"
    },
    "resizing": {
        "width": "200%",
        "height": "200%"
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FvXKXbjaVQBqel2gA8bRw%2FRestorations%20-%20Upscale%20-%20Photo.png?alt=media\&token=4e0f3d23-cddd-4494-9726-e9311b8e9401)
{% endtab %}

{% tab title="Faces" %}

```json
"operations": {
    "restorations": {
        "upscale": "faces"
    },
    "resizing": {
        "width": "200%",
        "height": "200%"
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FzktP52W6qsgP60mZy2Ts%2FRestorations%20-%20Upscale%20-%20Faces.png?alt=media\&token=55201493-bf89-4709-a01d-e83c1e1d629d)
{% endtab %}

{% tab title="Digital Art" %}

```json
"operations": {
    "restorations": {
        "upscale": "digital_art"
    },
    "resizing": {
        "width": "200%",
        "height": "200%"
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FFAGj51JVeZYnRlUTO7K4%2FRestorations%20-%20Upscale%20-%20Digital%20Art.png?alt=media\&token=16ca8dbe-9f64-4d44-89db-613485edf0aa)
{% endtab %}
{% endtabs %}

**Tip:** Click on the image to inspect it closer.

### Decompress

The decompress operation allows you to remove distortion and artifacts caused by image compression. It can be used in conjunction with the <mark style="color:purple;">`upscale`</mark> operation to prepare an image for upscaling.

Decompress is turned off by default. It can be configured by setting the <mark style="color:purple;">`decompress`</mark> object to either <mark style="color:purple;">`moderate`</mark> or <mark style="color:purple;">`strong`</mark>, depending on how heavily compressed images are. If you are not sure whether to apply a decompression – you can choose auto-select mode by setting the <mark style="color:purple;">`decompress`</mark> object to <mark style="color:purple;">`auto`</mark>.

**Possible values:**

| Value      | Type     | Description                                                 |
| ---------- | -------- | ----------------------------------------------------------- |
| `moderate` | *string* | Removes JPEG artifacts from the image.                      |
| `strong`   | *string* | Removes JPEG artifacts more aggressively than moderate.     |
| `auto`     | string   | Automatically detects and removes JPEG artifacts if needed. |

{% tabs %}
{% tab title="Moderate" %}

```json
"operations": {
  "restorations": {
    "decompress": "moderate"
  }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2F7o7FFHmBtr0cazZMEERP%2FRestorations%20-%20Decompress%20-%20Moderate.png?alt=media\&token=0eb1bd9a-6136-4891-ae5d-e4c61e82889b)
{% endtab %}

{% tab title="Strong" %}

```json
"operations": {
  "restorations": {
    "decompress": "strong"
  }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2F9FyvcMB6XdikJlbod24u%2FRestorations%20-%20Decompress%20-%20Strong.png?alt=media\&token=fa1cca94-9f11-4824-b8e6-ad58650ebf35)
{% endtab %}

{% tab title="Auto" %}

```json
"operations": {
  "restorations": {
    "decompress": "auto"
  }
}
```

<figure><img src="https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FOC8vjUxsZNUlVmjNoGl1%2FRestorations%20-%20Decompress%20-%20Conditional.png?alt=media&amp;token=0f5d4b39-f345-45ad-a906-4b90580744cc" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

### Polish

The polish operation allows you to redraw image parts making them sharper, yet keeping the original structure. It can be used individually, or in conjunction with the [#upscale](#upscale "mention") (we recommend [#smart-enhance](#smart-enhance "mention") upscale) operation to make the image look even sharper and more realistic.&#x20;

{% hint style="warning" %}
`polish` operation currently has size limitations: the target image size must not exceed 16 MP (e.g., 4096 x 4096 pixels, 5000 x 3500 pixels). Our team is working on increasing max size.
{% endhint %}

#### Request example of polishing an image:

```json
"operations": {
  "restorations": {
    "polish": true
  }
}
```

<figure><img src="https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FsCM9QWGLvh7boT1lUIzx%2FRestorations%20-%20Polishing.png?alt=media&amp;token=0a1dc0e8-1b17-4709-b635-77283ef9197f" alt=""><figcaption></figcaption></figure>


# Resizing

The Claid API allows you to set the final image size for different workflows you may have. By default, API will perform all calculations respecting the original image aspect ratio. Meaning, the image can be cropped but it won't be stretched or squeezed.

{% hint style="info" %}
When you need a size bigger than the original image, you can use [<mark style="color:purple;">`upscale`</mark>](/image-editing-api/image-operations/restorations#upscale) parameter to increase the final image resolution&#x20;
{% endhint %}

### Width and Height

Specifies the size of the output image. The <mark style="color:purple;">`width`</mark> and <mark style="color:purple;">`height`</mark> parameter supports dynamic sizing and is based on pixels or percent values.

#### The default behavior of API resizing

* If `width` and `height` are **not specified** the image size will not be changed.&#x20;
* If you use default fit option(**`crop`**) and **specify only one side** of the image(`width` or `height`), the unspecified side remains unchanged and you get a cropped image.
* If you use a fit option **other** **than** the default **`crop`** and **specify only one side** of the image(`width` or `height`), another side will be defined as auto and the final image will be resized keeping the aspect ratio.
* When `width` and `height` are **specified** the resulting image will be resized until it fully covers the specified dimensions and gets cropped.&#x20;

The default behavior can be changed by the fit property.

**Acceptable values:**

<table><thead><tr><th width="150">Value</th><th width="150">Type</th><th width="299">Description</th></tr></thead><tbody><tr><td>"auto"</td><td>string</td><td>The dimension will be calculated automatically to save the aspect ratio of the input image. Both width and height cannot be set to auto. When using <code>auto</code>, specify at least one of the dimensions in pixels or percentages.</td></tr><tr><td>1000</td><td>integer</td><td><code>width</code> or <code>height</code> in pixels.</td></tr><tr><td>"200%"</td><td>string</td><td>Percentage as a string. E.g. "200%" means that the dimension will double relative to the input image.</td></tr></tbody></table>

#### Examples

{% hint style="info" %}
You can read more about **`"fit": "bounds"`**, which is used in the following examples in [Fit section](#fit)
{% endhint %}

{% tabs %}
{% tab title="Empty" %}
**JSON Body**

```json
"operations": {
    "resizing": {
        "width": 4000,
        "fit": "bounds"
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FxXUQMcvMb8ckwBZ7XEg3%2FResizing%20-%20Width%20and%20Height%20-%20Empty.png?alt=media\&token=95eaa54c-a534-4573-804b-65f403968b25)
{% endtab %}

{% tab title="Auto" %}
**JSON Body**

```json
"operations": {
    "resizing": {
        "width": "auto",
        "height": 4000,
        "fit": "bounds"
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2F3cKPliVircWMkP5S9ovZ%2FResizing%20-%20Width%20and%20Height%20-%20Auto.png?alt=media\&token=b53c321d-7bb3-4165-a2ea-81252256dde5)
{% endtab %}

{% tab title="Pixels" %}
**JSON Body**

```json
"operations": {
    "resizing": {
        "width": 4000,
        "height": 4000,
        "fit": "bounds"
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FBEysD7V2iBWqVVEE1rKL%2FResizing%20-%20Width%20and%20Height%20-%20Pixels.png?alt=media\&token=49db448e-e6a7-4236-8605-66e5f86e3f81)
{% endtab %}

{% tab title="Percentage" %}
**JSON Body**

```json
"operations": {
    "resizing": {
        "width": "200%",
        "height": "200%",
        "fit": "bounds"
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2Fj7ZuT39U7gLfM5l1dWhw%2FResizing%20-%20Width%20and%20Height%20-%20Percentage.png?alt=media\&token=86d2c2d3-f04c-437f-ba37-510fe86b4800)
{% endtab %}
{% endtabs %}

### Fit <a href="#resizing-fit" id="resizing-fit"></a>

The <mark style="color:purple;">`fit`</mark> parameter controls how the image will be constrained within the provided size, relative to the `width` and `height`<mark style="color:purple;">.</mark> Check the image examples below to see how `fit` works.

Possible properties:

<mark style="color:purple;">`bounds`</mark> Preserves the aspect ratio. Resize the image to fit entirely within the specified region, making one dimension smaller if needed.

<mark style="color:purple;">`cover`</mark> Preserving aspect ratio. Resize the image to entirely cover the specified region, making one dimension larger if needed.

<mark style="color:purple;">`canvas`</mark> Input image will be placed on the canvas established by `width` and `height`. The aspect ratio of the input image won’t change. Extra space will be filled with the background color.

<mark style="color:purple;">`crop`</mark>  Scales an image until it fully covers the specified dimensions, the rest gets cropped. Fit crop support <mark style="color:purple;">`center`</mark> and <mark style="color:purple;">`smart`</mark> modes for cropping.  See the [Smart Crop](#smart-crop) section of this page to learn more.

#### Outpainting

<mark style="color:purple;">`outpaint`</mark> Generates a coherent background for an image to fit specified dimensions, scaling an image until the larger side reaches the edge of canvas established by `width` and `height` first, so generation happens on either left-right or top-bottom sides symmetrically.

{% hint style="info" %}
If you are looking for outpainting all four directions simultaneously - see [Zoom Out **(**&#x4F;utpaint on all side&#x73;**)**](/image-editing-api/image-operations/resizing#zoom-out-outpaint-on-all-sides)**.**
{% endhint %}

The <mark style="color:purple;">`feathering`</mark> parameter of the <mark style="color:purple;">`fit`</mark> object for <mark style="color:purple;">`outpaint`</mark> type allows you to adjust the smoothness of the transition from the original image content to the generated area. The <mark style="color:purple;">`feathering`</mark> value is the ratio of the transition area to the total width or height of the input image, depending on what is being resized. In most cases there will be two generated areas on the output image, so `"50%"` is a limit as it will turn the entire input image into a transition area.

```json
"operations": {
    "resizing": {
        "width": "150%",
        "height": "100%",
        "fit": {
            "type": "outpaint",
            "feathering": "20%"
        }
    }
}
```

{% hint style="warning" %}
`outpaint` fit type currently has size limitations: the target image size must not exceed 16.78 Mp (e.g., 4096 x 4096 pixels, 5461 x 3072 pixels). Our team is working on increasing max size
{% endhint %}

#### **Zoom Out (**&#x4F;utpaint on all side&#x73;**)**

Expands an image in **all four directions simultaneously**—top, bottom, left, and right. The effect is like zooming out of the original shot, creating a consistent, larger background around the entire image.

To use this, set the <mark style="color:purple;">`fit`</mark> type to <mark style="color:purple;">`outpaint`</mark> and provide values for the <mark style="color:purple;">`outpaint_by`</mark> parameter. You can specify how much to expand in each direction either b**y percentage** of the input image size or by **fixed pixel values**.

<table><thead><tr><th width="204.8488754421951">Value</th><th width="132.46975099615454">Type</th><th width="413.506927402293">Description</th></tr></thead><tbody><tr><td><p><code>"10%"</code>, or </p><p><code>"5% 15%"</code></p></td><td>string</td><td><p>Fills the space relative to the total image size. Can be specified: </p><ul><li>A single value for all sides. </li><li>Two values for the horizontal and vertical sides.</li></ul><p><span data-gb-custom-inline data-tag="emoji" data-code="2757">❗</span> The value cannot exceed 50%.</p></td></tr><tr><td><p><code>"30px"</code>, or</p><p><code>"100px 150px"</code>,</p></td><td>string</td><td><p>Fills the space with the exact number of pixels. Can be specified:</p><ul><li>As a single value for all sides.</li><li>Two values for the horizontal and vertical sides.</li></ul><p><span data-gb-custom-inline data-tag="emoji" data-code="2757">❗</span> The value cannot exceed 50% of the image's width or height, respectively.</p></td></tr></tbody></table>

{% hint style="info" %}
The values in `outpaint_by` are added to each side of the image, not split — this applies to both pixels and percentages.&#x20;

So `"100px 50px"` means 100 pixels on the left and right, 50 on the top and bottom.&#x20;

`"10% 5%"` means 10% of the image width added to each side, and 5% of the height to the top and bottom.&#x20;

A 1000×1000 image with `"10% 5%"` would become 1200×1100.
{% endhint %}

The `width` and `height` parameters still define the final output size. When using `outpaint_by`, these values are **applied after** the outpainted area has been generated.

{% hint style="info" %}
If you only want to extend the image by a fixed amount in all directions — **without resizing the final image** — you should either set both `width` and `height` to `"auto"`, **or o**mit `width` and `height` entirely.
{% endhint %}

This means you can:

1. **Control how much padding is added around the image** using `outpaint_by`.
2. **Scale the outpainted result** using `width` and `height`.

{% hint style="danger" %}
Ensure that the `restorations.upscale` property is set to an upscaling method of your choice. See [Upscale](/image-editing-api/image-operations/restorations#upscale) from more info.
{% endhint %}

```json
"operations": {
    "resizing": {
        "width": "200%",
        "height": "auto",
        "fit": {
            "type": "outpaint",
            "feathering": "20%",
            "outpaint_by": "20% 10%"
        }
    }
}
```

{% hint style="warning" %}
`outpaint` fit type currently has size limitations: the target image size must not exceed 16.78 Mp (e.g., 4096 x 4096 pixels, 5461 x 3072 pixels). Our team is working on increasing max size
{% endhint %}

**Possible values:**

<table><thead><tr><th width="208.3868379574476">Value</th><th width="171.58055671182493">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>crop</strong></td><td><strong>string or object</strong></td><td><strong>DEFAULT.</strong> <br>Scales an image until it fully covers the specified <code>width</code> and <code>height</code>, the rest gets cropped. Content-aware cropping.</td></tr><tr><td>bounds</td><td>string <strong>or object</strong></td><td>Scales an image until the larger side reaches the edge of canvas established by <code>width</code> and <code>height</code>.</td></tr><tr><td>cover</td><td>string <strong>or object</strong></td><td>Scales an image until the smaller side reaches the edge of canvas established by <code>width</code> and <code>height</code>.</td></tr><tr><td>canvas</td><td>string <strong>or object</strong></td><td>Puts input image on the canvas established by width and height. Aspect ratio and size of the input image won't change. Extra space will be filled with the specified background color.</td></tr><tr><td>outpaint</td><td>string <strong>or object</strong></td><td>Scales an image until the larger side reaches the edge of canvas established by <code>width</code> and <code>height</code>, then fills the extra space with a generated coherent background. </td></tr></tbody></table>

#### Examples

{% tabs %}
{% tab title="Crop" %}
**JSON Body**

```json
"operations": {
    "resizing": {
        "width": 1440,
        "height": 1440,
	"fit": "crop"
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FYZPEyoeginHQZcrwPKdl%2FResizing%20-%20Fit%20-%20Crop.png?alt=media\&token=d654e177-b508-4b1b-a065-af50e932efe1)
{% endtab %}

{% tab title="Bounds" %}
**JSON Body**

```json
"operations": {
    "resizing": {
        "width": 1440,
        "height": 1440,
	"fit": "bounds"
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FnBvKnN7GH9NJIhxO4U1d%2FResizing%20-%20Fit%20-%20Bounds.png?alt=media\&token=ef6ba9f1-fb70-4216-966b-3d57d0afdbd8)
{% endtab %}

{% tab title="Cover" %}
**JSON Body**

```json
"operations": {
    "resizing": {
        "width": 1440,
        "height": 1440,
	"fit": "cover"
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2F7Gz8vEFoVlNjJ6gR7yJ2%2FResizing%20-%20Fit%20-%20Cover.png?alt=media\&token=6864857c-c35e-4883-9b35-9b9b6458a4ac)
{% endtab %}

{% tab title="Canvas" %}
**JSON Body**

```json
"operations": {
    "resizing": {
        "width": 1440,
        "height": 1440,
	"fit": "canvas"
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FOymYJaZgqJhRD2dzuKL1%2FResizing%20-%20Fit%20-%20Canvas.png?alt=media\&token=c3bc0ff1-7222-45d1-9c6a-876b9e70c9eb)
{% endtab %}

{% tab title="Outpaint" %}
**JSON Body**

```json
"operations": {
    "resizing": {
        "width": 1200,
        "height": 900,
	"fit": "outpaint"
    }
}
```

<figure><img src="https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2F8esEc69EVIYEVVJLLYCI%2FResizing%20-%20Fit%20-%20Outpaint.png?alt=media&amp;token=aaa59341-331d-4430-ac86-fde794e10619" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Zoom Out" %}
**JSON Body**

```json
"operations": {
    "resizing": {
        "width": "auto",
        "height": "auto",
	"fit": {
	    "type": "outpaint",
	    "outpaint_by": "150px 0px"
    }
}
```

<figure><img src="https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2F8esEc69EVIYEVVJLLYCI%2FResizing%20-%20Fit%20-%20Outpaint.png?alt=media&amp;token=aaa59341-331d-4430-ac86-fde794e10619" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

### Smart Crop

&#x20;Fit `crop` supports <mark style="color:purple;">`center`</mark> and <mark style="color:purple;">`smart`</mark> modes for cropping.

<mark style="color:purple;">`center`</mark> is a basic cropping mode that crops images from their center without considering their content.

<mark style="color:purple;">`smart`</mark> is a content-aware cropping mode that detects a main object in a photo and uses it as the center point for cropping.

<figure><img src="https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FGFKmw93FREpximZy8ZiM%2FUntitled%20(1).png?alt=media&amp;token=265496d9-bc89-48ce-a75e-7f3854de097c" alt=""><figcaption><p><code>crop: center</code> compared to <code>crop: smart</code></p></figcaption></figure>

Smart Crop ensures output photos are perfectly framed and focused on the main object.

{% tabs %}
{% tab title="Center" %}
**JSON Body**

```json
"operations": {
    "resizing": {
        "width": 1440,
        "height": 1440,
	"fit": { 
	    "crop": "center" 
	}
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FlKMFS7p67LH1DJ11QsBN%2FResizing%20-%20Fit%20-%20Smart%20Crop.png?alt=media\&token=1621ab37-01d1-4767-a81c-2f2e63fa989e)

####

{% endtab %}

{% tab title="Smart" %}
**JSON Body**

```json
"operations": {
    "resizing": {
        "width": 2000,
        "height": 2000,
	"fit": { 
	    "crop": "smart" 
	}
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FbWLchEL3T3Ldksq4FxA1%2FResizing%20-%20Fit%20-%20Smart%20Crop.png?alt=media\&token=7bf541f9-6b96-46f0-84e7-848461d09e00)
{% endtab %}
{% endtabs %}


# Generative Editing

The Generative section contains AI-powered image processing operations that can be used in a variety of workflows.

### Style Transfer

This operation proposes to change the style of an input image to a style of a reference image.

A reference image URL goes to the `style_reference_image` parameter of the `style_transfer` object. You can control style transferring strength with the  `style_strength` parameter, colors and texture preservation of the original image with the `denoising_strength` parameter, overall composition and shape preservation with the `depth_strength` parameter. You can also control the generation by explicitly describing the desired style in the `prompt` parameter.&#x20;

{% hint style="warning" %}
The style transfer operation can't be used in conjunction with the remove background or blur operations.
{% endhint %}

#### **Properties**

<table><thead><tr><th width="261">Parameter</th><th width="185">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>style_reference_image</code></td><td>string (URL)</td><td>URL of the image to be used as a style reference, can be a Storage URL.</td></tr><tr><td><code>prompt</code></td><td>string</td><td>Text prompt to adjust the style transfer output.</td></tr><tr><td><code>style_strength</code></td><td>float (unit interval)</td><td>Determines the degree of overall style intensity as taken from the style reference, default value is 0.75. Higher values means higher reference style influence.</td></tr><tr><td><code>denoising_strength</code></td><td>float (unit interval)</td><td>Determines the degree of color and texture modification, default value is 0.75. Higher values means higher colors and textures creativity.</td></tr><tr><td><code>depth_strength</code></td><td>float (unit interval)</td><td>Determines the degree of overall composition and shape preservation, default value is 1.0. Higher values means higher input image composition influence. </td></tr></tbody></table>

#### Request example of style transferring:

```json
"operations": {
    "generative": {
        "style_transfer": {
             "style_reference_image": "storage://storage-name/path/reference.jpg",
             "prompt": "an oil painting",
             "style_strength": 0.75,
             "denoising_strength": 0.75,
             "depth_strength": 1.0
        }
    }
}
```

<figure><img src="https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2Fy1w9uvhFHdlUXFIPN9Ad%2Fdogs_smaller.webp?alt=media&amp;token=419c9b14-fd92-429b-9f29-bd713f1c896c" alt=""><figcaption></figcaption></figure>


# Color Adjustments

Changes image histogram. By setting up `adjustments`, you can ensure that output images meet the required brightness, saturation, and dynamic range.

Color and light adjustments offer both fully [automated options](https://www.notion.so/Claid-Marketing-API-docs-in-progress-35d651c7f35f442b8adfec83531fc14c) and manual [fine-tuning](https://www.notion.so/Claid-Marketing-API-docs-in-progress-35d651c7f35f442b8adfec83531fc14c).

### ML Color Adjustments

Balance out colors and lighting. Supports changing the intensity of operation. `100` is most recommended.  For 360 images you can use Edge Stitching.

{% tabs %}
{% tab title="HDR" %}

#### **JSON Request:**

```json
"operations": {
    "adjustments": {
        "hdr": 100
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FSZY1YGzYYYQTXmgCclGu%2FColor%20Adjustments%20-%20ML%20-%20HDR.png?alt=media\&token=4dd7138a-dde4-4242-a2c8-dcb736018a78)
{% endtab %}

{% tab title="Edge Stitching" %}
**JSON Request:**

```json
"operations": {
    "adjustments": {
        "hdr": {
            "intensity": 100,
            "stitching": true
        }
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FkAp2oflypGWy0xX1vpmR%2FColor%20Adjustments%20-%20ML%20-%20Edge%20Stitching.png?alt=media\&token=6b100a78-f301-42ea-90bc-d718d180e011)
{% endtab %}
{% endtabs %}

### Manual Color Adjustments

ML color adjustments have an automated option (`hdr`) that covers most cases. But if you need finer control over color and lighting, you can use the operations listed in this section.

All operations below use relative rather than absolute values. They take into account the initial values of the images. For example, if an image is very dark, you might want to set the `exposure` to a higher value compared to cases when photos of slight underexposure.

You can control `exposure`, `saturation`, `contrast`, `sharpness`.

#### `Possible values`

<table><thead><tr><th width="189">Parameter</th><th width="150">Type</th><th width="151">Range</th><th>Description</th></tr></thead><tbody><tr><td>exposure</td><td>integer</td><td>-100 - 100</td><td>Decrease (negative integer) or increase (positive) exposure.</td></tr><tr><td>saturation</td><td>integer</td><td>-100 - 100</td><td>Decrease (negative integer) or increase (positive) saturation.</td></tr><tr><td>contrast</td><td>integer</td><td>-100 - 100</td><td>Decrease (negative integer) or increase (positive) contrast.</td></tr><tr><td>sharpness</td><td>integer</td><td>0 - 100</td><td>Increase sharpness.</td></tr></tbody></table>

**JSON Request**

{% tabs %}
{% tab title="Exposure" %}

```json
"operations": {
    "adjustments": {
        "exposure": 80
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2F63w414l7yloorHMYTJaq%2FColor%20Adjustments%20-%20Manual%20-%20Exposure.png?alt=media\&token=0695b0f7-c73f-4094-bad5-78a8ec34d15e)
{% endtab %}

{% tab title="Saturation" %}

```json
"operations": {
    "adjustments": {
        "saturation": 15
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FFjCUFUK7eo8hhi1hDjBZ%2FColor%20Adjustments%20-%20Manual%20-%20Saturation.png?alt=media\&token=c3ea424d-4302-4681-aecd-68ce2f45505a)
{% endtab %}

{% tab title="Contrast" %}

```json
"operations": {
    "adjustments": {
        "contrast": 10
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FeBWumlmMDtahnn0U78MW%2FColor%20Adjustments%20-%20Manual%20-%20Contrast.png?alt=media\&token=4c485e47-9d72-4de0-a5d3-a30ac1f92335)
{% endtab %}

{% tab title="Sharpness" %}

```json
"operations": {
    "adjustments": {
        "sharpness": 15
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FDBCaIvD795ad2DropfVD%2FColor%20Adjustments%20-%20Manual%20-%20Sharpness.png?alt=media\&token=eaa8a98c-2e24-4fcc-a9a6-0d9f99a1a7ed)
{% endtab %}
{% endtabs %}


# Background

The background section contains all background properties, such as removing the background, blurring the background, and setting the color.

### Background removal

Remove image background. This operation offers both fully automated mode and advanced manual options. Following is a description of `remove` option.

**Possible values:**

<table><thead><tr><th width="282.8488754421951">Value</th><th width="107.46975099615454">Type</th><th width="333.506927402293">Description</th></tr></thead><tbody><tr><td>true</td><td>boolean</td><td>Removes image background.</td></tr><tr><td>false</td><td>boolean</td><td><strong>Default</strong>. Keeps the background of the original image intact.</td></tr><tr><td>{ <br>    "category": "general", <br>    "clipping": true <br>}</td><td>object</td><td>Advanced options for background removal. See detailed description in the table below.</td></tr><tr><td>{ <br>    "selective": { <br>        "object_to_keep": "&#x3C;object>" <br>    }, <br>    "clipping": true <br>}</td><td>object</td><td>Advanced options for background removal. See detailed description in the table below.</td></tr></tbody></table>

Below are advanced options supported by `remove`:

<table><thead><tr><th width="212.33333333333331">Option</th><th width="111">Type</th><th>Description</th></tr></thead><tbody><tr><td>category</td><td>string</td><td><p></p><p>Provides a hint about the nature of object in the foreground for a more accurate result of background removal. Possible values: </p><ul><li><code>"general"</code> is suitable for all objects.</li><li><code>"products"</code> is the advanced category that will have better results with product, grocery and food objects. It is used <strong>by default</strong>.</li><li><code>"cars"</code> is the advanced category that will have better results with automotive objects.</li></ul><p>The <code>category</code> background removal option is used by default and cannot be used together with <code>selective</code>.</p></td></tr><tr><td>selective</td><td>object</td><td>Allows to specify exactly which object should remain on the image, e.g. <code>"food"</code>, <code>"sleeping bag"</code>, <code>"product"</code>, etc. Specifying which object to keep is mandatory and should be short and precise.<br>The Selective background removal is an alternative to the <code>category</code> option and cannot be used together.</td></tr><tr><td>clipping</td><td>boolean</td><td><code>false</code> by default. If <code>true</code>, image is clipped to the foreground object bounds. Resulting image canvas is controlled by the <a href="/image-editing-api/image-operations/resizing">resizing</a> block. </td></tr></tbody></table>

{% hint style="warning" %}
Please be aware that older versions of the <mark style="color:purple;">`products`</mark> background removal category will be deprecated and automatically updated to the latest version starting January 1, 2025.
{% endhint %}

{% hint style="info" %}
If `clipping` is enabled, `resizing.fit` value is `"crop"/`unspecified, `resizing.width` and `resizing.height`are also unspecified - the resulting cropped image will be scaled to the dimensions of the input image. \
\
If you want to keep the clipped region unchanged, set `resizing.fit` to `"bounds"` and leave `resizing.width` and `resizing.height` unspecified.\
\
You can also upscale or downscale the clipped region in many different ways. See [Resizing](/image-editing-api/image-operations/resizing) and [Upscale](/image-editing-api/image-operations/restorations#upscale) to learn more.
{% endhint %}

{% tabs %}
{% tab title="Simple background removal" %}
**JSON Request**

```json
"operations": {
    "background": {
        "remove": true
    }
}
```

{% endtab %}

{% tab title="Advanced: category" %}

### Category: Products

#### JSON Request

```json
"operations": {
    "background": {
        "remove": {
            "category": "products"
        }
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FsVO87EhVXxiXSh5GkpE7%2Fshoes.png?alt=media\&token=119c9c0c-0232-4f67-b9b3-72bcd8026bee)

### Category: Cars

#### JSON Request

```json
"operations": {
    "background": {
        "remove": {
            "category": "cars"
        }
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FgewyfAJP7Q6NO4NppWL1%2FBackground%20-%20Remove%20-%20Cars.png?alt=media\&token=c3553f40-62ad-4b87-a3e7-3356b3248f4d)
{% endtab %}

{% tab title="Advanced: selective" %}

#### JSON Request

```json
"operations": {
    "background": {
        "remove": {
            "selective": {
                "object_to_keep": "bottle"
            }
        }
    }
}
```

<figure><img src="https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2Fwu1r4hrlofDC0RZhloQy%2Fimage.png?alt=media&amp;token=9039dbff-cc6d-4818-93fe-22b92a7f8ae2" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Advanced: clipping and color" %}

#### JSON Request

```json
"operations": {
    "background": {
        "remove": {
            "category": "products",
            "clipping": true
        },
        "color": "transparent"
    }
}
```

![JSON Request](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2Fx1Cv0cWfwxRuaezJQiLS%2FBackground%20-%20Transperent%20-%20Clipping%20\(2\).png?alt=media\&token=90bbe021-32d9-4fdc-aad8-c7273fecdccf)
{% endtab %}
{% endtabs %}

### Background **color**

The image background. You can set transparent background or any color in hexadecimal format.

**Possible values**

| Value       | Type   | Description                                                                                                                                |
| ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
| transparent | string | To set transparent background the image format should support an alpha channel (PNG, WEBP or AVIF) otherwise the background will be white. |
| color       | string | Set the color of the background in hexadecimal format. Default is white color.                                                             |

**JSON Request**

{% tabs %}
{% tab title="Transparent" %}

```json
"operations": {
    "background": {
        "remove": {
            "category": "products"
        },
        "color": "transparent"
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2F4IXCCItiRDFWZHUEFpgA%2FBackground%20-%20Transperent.png?alt=media\&token=373de900-6197-4e90-b9d8-566291fbdb38)
{% endtab %}

{% tab title="Color" %}

```json
"operations": {
    "background": {
        "remove": {
            "category": "products"
        },
        "color": "#C5C6FF"
    }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2F84kvz6y9VSKEiZpn6HQM%2FBackground%20-%20Color.png?alt=media\&token=234eafe6-2dba-48ea-a432-abd7833b1c9f)
{% endtab %}
{% endtabs %}

### Background blurring

Blur image background. This operation offers both fully automated mode and advanced manual options. Here's a description of `blur` option.

**Possible values:**

<table><thead><tr><th>Value</th><th width="130">Type</th><th>Description</th></tr></thead><tbody><tr><td>true</td><td>boolean</td><td>Blurs image background</td></tr><tr><td>false</td><td>boolean</td><td><strong>Default</strong>. Keeps the background of the original image intact.</td></tr><tr><td><p>{ <br>    "category": "general",<br>    "type": "regular", <br>    "level": "medium" </p><p>}</p></td><td>object</td><td>Advanced options for background blurring. See detailed description in the table below.</td></tr><tr><td>{ <br>    "selective": { <br>        "object_to_keep": "&#x3C;object>" <br>    }, <br>    "type": "regular", <br>    "level": "medium" <br>}</td><td>object</td><td>Advanced options for background blurring. See detailed description in the table below.</td></tr></tbody></table>

Below are advanced options supported by `blur`:

<table><thead><tr><th width="307">Advanced option</th><th width="130">Type</th><th>Description</th></tr></thead><tbody><tr><td>category</td><td>string</td><td><p></p><p>Provides a hint about the nature of object in the foreground for a more accurate result of background blurring. Possible values: </p><ul><li><code>"general"</code> is suitable for all objects and is used by <strong>default</strong>.</li><li><code>"products"</code>is the advanced category that will have better results with product, grocery and food objects.</li><li><code>"cars"</code> is the advanced category that will have better results with automotive objects.</li></ul><p>The <code>category</code> background blur option is used by default and cannot be used together with <code>selective</code>.</p></td></tr><tr><td>selective</td><td>object</td><td>Allows to specify exactly which object should remain on the image unblurred, e.g. <code>"food"</code>, <code>"sleeping bag"</code>, <code>"product"</code>, etc. Specifying which object to keep is mandatory and should be short and precise. <br>The Selective background blur is an alternative to the <code>category</code> option and cannot be used together.</td></tr><tr><td>type</td><td>string</td><td><p>Selects the type of blur to be applied to the background. </p><p>Possible values: </p><ul><li><code>"regular"</code> is for gaussian blur type. Creates an effect of laying a translucent material like vellum on top of the image background. It is used as <strong>default</strong> parameter.</li><li><code>"lens"</code>is for lens blur type with linear focus. Mimics the blur applied to a photo when a wide aperture is used to achieve a narrow depth of field, so that the foreground objects stands out.</li></ul></td></tr><tr><td>level</td><td>string</td><td><p>Selects the level of blur strength to be applied to the background. Possible values: </p><ul><li><code>"low"</code> is for low blur strength.</li><li><code>"medium"</code> is for medium blur strength. It is used as <strong>default</strong> parameter.</li><li><code>"high"</code> is for high blur strength.</li></ul></td></tr></tbody></table>

**JSON Request**

{% tabs %}
{% tab title="Simple background blurring" %}

```json
"operations": {
    "background": {
        "blur": true
    }
}
```

<figure><img src="https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FJ466yDUsep1gD7ct41sM%2Fgen.png?alt=media&amp;token=2a659595-6b84-4455-8604-f5c1ee26b986" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Advanced: category" %}

### Category: Products

####

#### JSON Request

```json
"operations": {
    "background": {
        "blur": {
            "category": "products"
        }
    }
}
```

<figure><img src="https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FNB7GqNB08VQveiW1SdAU%2F2.png?alt=media&amp;token=f4b5fa85-6bad-4231-adda-a4a4ac881299" alt=""><figcaption></figcaption></figure>

### Category: Cars

####

#### JSON Request

```json
"operations": {
    "background": {
        "blur": {
            "category": "cars"
        }
    }
}
```

<figure><img src="https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FjHKwC0RYYR3wNIpNZJbO%2FUntitled.png?alt=media&amp;token=d2b18d4b-3ee7-4b4c-9198-98ffffcfbadb" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Advanced: selective" %}

#### JSON Request

```json
"operations": {
    "background": {
        "blur": {
            "selective": {
                "object_to_keep": "bottle"
            }
        }
    }
}
```

{% endtab %}

{% tab title="Advanced: type" %}

### Type: Regular

#### JSON Request

```json
"operations": {
    "background": {
        "blur": {
            "category": "cars",
            "type": "regular"
        }
    }
}
```

<figure><img src="https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FjHKwC0RYYR3wNIpNZJbO%2FUntitled.png?alt=media&amp;token=d2b18d4b-3ee7-4b4c-9198-98ffffcfbadb" alt=""><figcaption></figcaption></figure>

### Type: Lens

#### JSON Request

```json
"operations": {
    "background": {
        "blur": {
            "category": "cars",
            "type": "lens"
        }
    }
}
```

<figure><img src="https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2F9F9vpRAOTunTrCI6OtBh%2Flens.png?alt=media&amp;token=c96376cf-6578-4478-a5b3-e824b7f0bc83" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Advanced: level" %}

### Level: low

#### JSON Request

```json
"operations": {
    "background": {
        "blur": {
            "category": "cars",
            "type": "lens",
            "level": "low"
        }
    }
}
```

<figure><img src="https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FYHflO090VTKy3JV7s3QZ%2Flow.png?alt=media&amp;token=a62aed39-e424-4f80-a648-96f2129d41a0" alt=""><figcaption></figcaption></figure>

### Level: medium

#### JSON Request

```json
"operations": {
    "background": {
        "blur": {
            "category": "cars",
            "type": "lens",
            "level": "medium"
        }
    }
}
```

<figure><img src="https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2F9F9vpRAOTunTrCI6OtBh%2Flens.png?alt=media&amp;token=c96376cf-6578-4478-a5b3-e824b7f0bc83" alt=""><figcaption></figcaption></figure>

### Level: high

#### JSON Request

```json
"operations": {
    "background": {
        "blur": {
            "category": "cars",
            "type": "lens",
            "level": "high"
        }
    }
}
```

<figure><img src="https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FltUZkupn3TbI8b6FpFKC%2Fhigh.png?alt=media&amp;token=d688dabd-72e7-42c9-8852-61d8aa1c9dfe" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}


# Padding

With Claid you can control how much space there's around the object. `padding` allows you to achieve a consistent look for visuals across your platform. This is an essential operation for eCommerce where the frame around the goods is essential for a visual experience.&#x20;

There are two main ways to control padding in the Claid API: as a percentage or in pixels.

<table><thead><tr><th width="244.8488754421951">Value</th><th width="107.46975099615454">Type</th><th width="413.506927402293">Description</th></tr></thead><tbody><tr><td><p><code>"10%"</code>, or </p><p><code>"5% 15%"</code></p></td><td>string</td><td><p>Fills the space relative to the total image size, preserving the actual image size. Can be specified: </p><ul><li>A single value for all sides. </li><li>Two values for the horizontal and vertical sides.</li></ul><p>The padding cannot be more than half the width/height. </p></td></tr><tr><td><p><code>"30px"</code>, or</p><p><code>"100px 150px"</code>, or</p><p><code>"0px 400px 0px 0px"</code></p></td><td>string</td><td><p>Fills the space with the exact number of pixels. Can be specified:</p><ul><li>As a single value for all sides.</li><li>Two values for the horizontal and vertical sides.</li><li>Four values for the top, bottom, left, and right sides.</li></ul><p>The padding for each side of the image can't exceed <code>4096px</code>.</p></td></tr></tbody></table>

Let's explore the simple example where we just need to add padding around the picture:

```json
{
  "input": "https://claid.ai/assets/cms/shoe_example_05fb154a3a/shoe_example_05fb154a3a.png",
  "operations": {
     "padding": "30%"
  }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FmcVS2T6AyQBetolU3jTi%2FAfter.png?alt=media\&token=7fc2d469-4bbe-4cb2-a4ff-f3d669dee5a9)

In this request, Claid preserves the actual image size, hence squeezing the image and filling the surrounding space with padding.

But let's consider more use cases.

### Padding in percentage

{% tabs %}
{% tab title="Background Removal" %}
Most eCommerce platforms will require photos to have a white background. Claid has a feature that automatically [crops out the product image](/image-editing-api/image-operations/background) and leaves the background entirely white.&#x20;

But it's not enough just to remove the background because the resulting object will be trimmed to borders. Controlling the empty space surrounding the product image would add a more natural look and help meet the platform's requirements.

Let's assume that we need to remove the background and specify the amount of the surrounding space:

```json
{
  "input": "https://claid.ai/static/0190d55e7097dfad9239168a5cc2cfae/36f6d/E_com_Input_Enhancement_AI_Color_3e806177ae.webp",
  "operations": {
    "background": { 
      "remove": { 
        "clipping": true 
      }
    },
    "padding": "20%"
  }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FdLnXfOKyyVFjBHfcdOhL%2FPadding%20-%20Remove%20BG%20%2B%20Padding.png?alt=media\&token=eda95bc7-fcbf-4f02-b7b8-a52560e30814)

We specify the `clipping` background removal operation to crop the background up to the foreground object, so the start of padding will be counted from the borders of the object.&#x20;

If the output sizes are not specified, Claid uses the source width and height, squeezing the shoe to satisfy the padding value.&#x20;

Also, you can control the color of the background, please see the [Background section](/image-editing-api/image-operations/background).
{% endtab %}

{% tab title="Safe Zones" %}
An image can be shown to users on different pages squeezed with different dimensions. In general, objects are still visible after image transformations, but non-standard borders can be dropped from the visible area.&#x20;

![Squeezed images on different pages](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FOT8cO2Ii0kaXWO72VjYd%2Fsafe-zones-problem.png?alt=media\&token=7fdd5c3b-63d2-4544-96bb-1c6c253d221e)

With Claid, you can specify the *Safe Zone* for objects, setting up the padding from horizontal and vertical sides as the minimum borders. You can enumerate horizontal and vertical paddings via a space separator, e.g. **`"10% 25%"`**.

Let's explore an example of the resized image with removed background and compare the result with and without safe zones:

```json
{
  "input": "https://claid.ai/ecommerce-images/safe-zones/",
  "operations": {
    "resizing": { 
      "fit": "canvas",
      "width": 1600,
      "height": 900,
    },
    "background": { 
      "remove": { 
        "clipping": true 
      }
    },
    "padding": "10% 25%"
  }
}
```

![An example image](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2Fyu7tLY3mYLXYAtgkTyxa%2Fpears-initial.jpeg?alt=media\&token=9ebf7606-597b-4b2e-b53a-f650d1eaeae6)

![The square frame on top of the processed image without safe zones, padding is "10%](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2F3954yxPNR0zpnUY3b7HN%2Fpears-without-safe-zones-result.png?alt=media\&token=04ff502a-3c0d-4c97-b001-5562508beb12) ![The square frame on top of the processed image with safe zones, padding is "10% 25%"](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FDgw1cGWei4iff0ZdwS9I%2Freaps-with-safe-zones-result.png?alt=media\&token=6a6781ed-d384-4c03-a979-4d4e36cb1c2e)

We see that Claid uses our sizes and adjusts the object largeness to fit the required padding value.&#x20;

On the left side, we can observe the image that would not be correctly shown on a preview page due to the one-side padding. It's better to specify padding for both sides so the image would definitely fit on different pages as shown on the image on the right side.

Please note that Claid automatically detects and customizes the smaller side padding to meet the required dimensions.
{% endtab %}
{% endtabs %}

### Padding in pixels

Padding in pixels is used in the same cases as [#padding-in-percentage](#padding-in-percentage "mention"), but allows for more granular control over the surrounding space.&#x20;

{% tabs %}
{% tab title="Background removal" %}
Suppose you need to remove the background and fix the product to the top. In this case, specifying padding on all sides will give the most accurate result.

```json
{  
  "input": "https://claid.ai/static/0190d55e7097dfad9239168a5cc2cfae/36f6d/E_com_Input_Enhancement_AI_Color_3e806177ae.webp",
  "operations": {
    "background": { 
      "remove": { 
        "clipping": true 
      }
    },
    "resizing": {
      "width": 2048,
      "height": 2048,
      "fit": "canvas"
    },
    "padding": "0px 500px 0px 0px"
  }
}
```

<figure><img src="https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2F8P97r0PXZapbRBHeyDqy%2FGroup%2013491.png?alt=media&amp;token=c314ce81-c482-45e3-a28b-fff703ae4080" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

Be careful when choosing a [Resizing](/image-editing-api/image-operations/resizing#fit), as the `canvas` fit additionally fill the padding space to respect the aspect ratio.


# Privacy

The privacy section contains privacy control features such as blurring car license plates.

### License Plate Blur

This operation proposes to automatically blur found license plates on the image.&#x20;

#### Request example to blur a car license plate:

```json
"operations": {
    "privacy": {
        "blur_car_plate": true
    }
}
```

<figure><img src="https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FxES1B37hngtPLy4zZgV5%2FCar%20plate%20bluring.png?alt=media&amp;token=04cb56b5-a2dd-4cba-9906-528a3f321fca" alt=""><figcaption></figcaption></figure>

### Identity crop

This operation hides a person's identity by detecting a line between the nose and lips and cutting out everything above that line.

#### Request example to crop a person's identity:

```
"operations": {
    "privacy": {
        "identity_crop": true
    }
}
```


# API Reference

request and response description

### Image edit contract

Below you can see all possible options for the request body. See the [Image Operations](/image-editing-api/image-operations) and [Image I/O](/image-editing-api/image-i-o) sections to learn more about image operations.

```json
{
    "input": "http(s)://{public_url}/image.png" |
             "storage://{storage_name}/{image_folder}/image.png",
    "operations": {
        "restorations": {
            "decompress": null |
                          "moderate" | "strong" | "auto",
            "upscale": null |
                       "smart_enhance" | "smart_resize" | "faces" |
                       "digital_art" | "photo",
            "polish": false | true
        },
        "resizing": null | {
            "width": null | "auto" | 500 | "150%",
            "height": null | "auto" | 500 | "150%",
            "fit": "bounds" | "cover" | "canvas" | "outpaint" | "crop" |
                   {"type": "crop", "crop": "center" | "smart"} |
                   {"type": "outpaint", "feathering": "15%"}
        "adjustments": null | {
            "hdr": 0 | {"intensity": 0, "stitching": true | false},
            "exposure": 0,
            "saturation": 0,
            "contrast": 0,
            "sharpness": 0
        },
        "background": null | {
            "remove": false | true | {
                "category": "general" | "cars" | "products",
                "selective": { 
                    "object_to_keep": "<object>"
                },
                "clipping": false | true
            },
            "blur": false | true | {
                "category": "general" | "cars" | "products",
                "selective": { 
                    "object_to_keep": "<object>"
                },
                "type": "regular" | "lens",
                "level": "low" | "medium" | " high"
            }
            "color": "#ffffff" | "<color-hex>" | "transparent"
        },
        "padding": null | "10%" | "5% 25%",
        "privacy": {
            "blur_car_plate": false | true
        },
        "generative": null | {
            "style_transfer": null | {
                 "style_reference_image": "storage://{storage_name}/{image_folder}/reference.jpeg",
                 "prompt": null | "<string>",
                 "style_strength": null | 0.75,
                 "denoising_strength": null | 0.75,
                 "depth_strength": null | 1.0
            }
        }
    },
    "output": null | "storage://{storage_name}/{image_folder}/image.jpeg" | {
        "destination": null | "storage://{storage_name}/{image_folder}/image.jpeg",
        "metadata": null | {"dpi": null | 300},
        "format": "jpeg" | "png" | "webp" | "avif" | "tiff" | {
            "type": "jpeg",
            "quality": 85, // format-specific options
            "progressive": true | false
        } | {
            "type": "png",
            "compression": "fast" | "best" | "optimal"
        } | {
            "type": "webp" | "avif" | "tiff"
            "compression": {
                "type": "lossy" | "lossless",  
                "quality": 90
            }
        }
    }
}
```

## Image Edit

> Specifies: \
> \- what image will be processed (\`input\`)\
> \- how it will be processed (\`operations\`)\
> \- where it will be stored (\`output\`)

```json
{"openapi":"3.1.0","info":{"title":"Claid REST API","version":"v1"},"tags":[{"name":"Image","description":"Encompasses operations with images."}],"security":[{"OAuth2PasswordBearer":[]},{"OAuth2PasswordBearer":["image_editing"]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}},"description":"To work with the Claid API, send requests over HTTPS and authenticate using the `Authorization` header in the following format:`Authorization: Bearer <YOUR_API_KEY>`. You do not need to provide a password.\n\nTo get your API key, [sign in to your Claid account](https://claid.ai/login) and click ***Create API key*** button from the ***Overview*** or ***API keys*** pages.\n\nClaid API’s base URL is `https://api.claid.ai/v1/`. All available endpoints are listed in the [Storage](#tag/Storage) and [Image](#tag/Image) sections. \n\n## Bearer\n\nThis API uses OAuth 2.0 [bearer token](https://datatracker.ietf.org/doc/html/rfc6750) (API key) to authorize requests."}},"schemas":{"EditRequest":{"title":"EditRequest","required":["input","operations"],"type":"object","properties":{"input":{"title":"Input URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the input image. Should be from 1 to 512 characters. Image must be accessible by our system.","format":"uri"},"operations":{"title":"Operations","allOf":[{"$ref":"#/components/schemas/ImageOperations"}],"description":"Customize the editing workflow so that the output images meet your requirements."},"output":{"title":"Output","anyOf":[{"$ref":"#/components/schemas/ImageOutputOptions"},{"type":"string","minLength":1,"maxLength":4096,"format":"uri"}],"description":"Customize the result output.","default":{"format":"jpeg"}}},"additionalProperties":false},"ImageOperations":{"title":"image operations options","type":"object","properties":{"restorations":{"title":"Restorations","allOf":[{"$ref":"#/components/schemas/RestorationsOptions"}],"description":"Restore lost details and decompress image with a wide range of AI-powered neural networks. By default, both operations is turned off.","default":{"polish":false}},"adjustments":{"title":"Adjustments","allOf":[{"$ref":"#/components/schemas/AdjustmentsOptions"}],"description":"Change image histogram: set brightness, saturation, dynamic range, balance out colors and lighting. By default, no adjustments are made."},"background":{"title":"Background","allOf":[{"$ref":"#/components/schemas/BackgroundOptions"}],"description":"Remove the background and set a solid color. By default, no changes are made.","default":{"remove":false,"blur":false,"use_original_alpha":false}},"resizing":{"title":"Resizing","allOf":[{"$ref":"#/components/schemas/ResizingOptions"}],"description":"Set the final image size. Crop or fit image in canvas. By default, API will perform all calculations respecting the original image aspect ratio.","default":{"width":"auto","height":"auto","fit":"crop"}},"padding":{"title":"Padding","type":"string","description":"Add a space around the object equally to each of 4 sides, or for height&width separately. Can not be bigger than half of image width/height. By default, padding is not applied."},"privacy":{"title":"Privacy","allOf":[{"$ref":"#/components/schemas/PrivacyOptions"}],"description":"Manage sensitive information on the image.","default":{"blur_car_plate":false,"identity_crop":false}},"generative":{"title":"Generative","allOf":[{"$ref":"#/components/schemas/GenerativeOptions"}],"description":"Transform the image using generative models."}},"additionalProperties":false},"RestorationsOptions":{"title":"restorations options","type":"object","properties":{"decompress":{"allOf":[{"$ref":"#/components/schemas/DecompressEnum"}],"description":"The decompress operation allows you to remove distortion and artifacts caused by image compression methods. It can be used in conjunction with the upscale operation to prepare an image for upscaling.\n\n| Value | Description |\n| --- | --- |\n| null | DEFAULT. No restoration applied.|\n| `\"moderate\"` | Removes JPEG artifacts from the image.|\n| `\"strong\"` | Removes JPEG artifacts more aggressively than \"moderate\".|\n| `\"auto\"` | Automatically detects and remove JPEG artifacts if needed.|"},"upscale":{"title":"Upscale","anyOf":[{"$ref":"#/components/schemas/UpscaleEnum"},{"$ref":"#/components/schemas/UpscalePhotoOptions"}],"description":"The upscale operation allows you to improve the overall quality of an image by rendering out new pixels. The upscale operation works along with resizing through numeric or percentage values for upscaling."},"polish":{"title":"Polish image","type":"boolean","description":"If `true`, polishes an image","default":false}},"additionalProperties":false},"DecompressEnum":{"title":"Decompress","enum":["moderate","strong","auto"],"type":"string","description":"Selects the restoration mode.\n\n| Value | Description |\n| --- | --- |\n| `null` | DEFAULT. No restoration applied.|\n| `\"moderate\"` | Removes JPEG artifacts from the image.|\n| `\"strong\"` | Removes JPEG artifacts more aggressively than `\"moderate\"`.|\n| `\"auto\"` | Automatically detects and remove JPEG artifacts if needed.|"},"UpscaleEnum":{"title":"Upscale","enum":["smart_enhance","smart_resize","faces","digital_art","photo"],"type":"string","description":"Upscales the image with specified type of image upscaling neural network. \n\n| Value | Description |\n| --- | --- |\n| `null` | DEFAULT. Interpolation. Used when output image resolution is smaller than the input resolution.|\n| `\"smart_enhance\"` | Used for small low quality product, real estate and food images.|\n| `\"smart_resize\"` | Used for high quality images.|\n| `\"faces\"` | Used for images containing persons.|\n| `\"digital_art\"` | Used for drawings, illustrations, paintings, cartoons, anime, etc.|\n| `\"photo\"` | Used for images taken by mobile devices or digital camera of people, nature, architecture, etc.|"},"UpscalePhotoOptions":{"title":"photo upscale options","required":["type","version"],"type":"object","properties":{"type":{"title":"Type","enum":["photo"],"type":"string"},"version":{"title":"Version","allOf":[{"$ref":"#/components/schemas/PhotoVersionEnum"}],"description":"Upscales the image with specified version of photo upscaling neural network. \n\n| Value | Description |\n| --- | --- |\n| `\"1\"` | Is deprecated and not recommended.|\n| `\"2\"` | Used for restoring image quality that is taken by mobile devices or digital camera.|\n| `\"3\"` | Used for restoring image quality, a bit more aggressively than \"2\".|\n"}},"additionalProperties":false},"PhotoVersionEnum":{"title":"Version","enum":["1","2","3"],"type":"string","description":"Upscales the image with specified version of photo upscaling neural network. \n\n| Value | Description |\n| --- | --- |\n| `\"1\"` | Is deprecated and not recommended.|\n| `\"2\"` | Used for restoring image quality that is taken by mobile devices or digital camera.|\n| `\"3\"` | Used for restoring image quality, a bit more aggressively than `\"2\"`.|\n"},"AdjustmentsOptions":{"title":"adjustments options","type":"object","properties":{"hdr":{"title":"Hdr","anyOf":[{"type":"integer","description":"HDR effect intensity.","minimum":0,"maximum":100},{"$ref":"#/components/schemas/HdrOptions"}],"description":"Balances out colors and lighting. Allows to turn on `stitching` for stitched 360 photos.","default":0},"exposure":{"title":"Exposure","maximum":100,"minimum":-100,"type":"integer","description":"Decrease (negative integer) or increase (positive integer) exposure.","default":0},"saturation":{"title":"Saturation","maximum":100,"minimum":-100,"type":"integer","description":"Decrease (negative integer) or increase (positive integer) saturation.","default":0},"contrast":{"title":"Contrast","maximum":100,"minimum":-100,"type":"integer","description":"Decrease (negative integer) or increase (positive integer) contrast.","default":0},"sharpness":{"title":"Sharpness","maximum":100,"minimum":0,"type":"integer","description":"Increase sharpness.","default":0}},"additionalProperties":false},"HdrOptions":{"title":"hdr options","type":"object","properties":{"intensity":{"title":"Intensity","maximum":100,"minimum":0,"type":"integer","description":"HDR effect intensity.","default":100},"stitching":{"title":"Stitching","type":"boolean","description":"Set to true for seamless HDR effect on stitched 360 photos.","default":false}},"additionalProperties":false},"BackgroundOptions":{"title":"background options","type":"object","properties":{"remove":{"title":"Remove","anyOf":[{"type":"boolean","title":"Remove background","description":"If `true`, removes background"},{"$ref":"#/components/schemas/BackgroundRemovalOptions"}],"description":"Allows to turn on and configure image background removal.","default":false},"color":{"title":"Color","anyOf":[{"type":"string","title":"Color","description":"Color as a hexadecimal. Paints the background of the image. Examples: `\"#ffffff\"`, `\"#000000\"`."},{"$ref":"#/components/schemas/BackgroundEnum"}],"description":"Color as a hexadecimal. Sets a background color. Defaults to the `#ffffff` (white) color, or `transparent` if an input image has transparency."},"blur":{"title":"Blur","anyOf":[{"type":"boolean","title":"Blur background","description":"If `true`, blurs background. Defaults to `false`."},{"$ref":"#/components/schemas/BackgroundBlurOptions"}],"description":"Allows to turn on and configure image background blurring.","default":false}},"additionalProperties":false},"BackgroundRemovalOptions":{"title":"background removal options","type":"object","properties":{"clipping":{"title":"Clip to object","type":"boolean","description":"If `true` image will be cropped up to the edges of the foreground object.","default":false},"selective":{"title":"Selective","allOf":[{"$ref":"#/components/schemas/BackgroundSelectiveOptions"}],"description":"Allows to select an object to keep on the image and remove the background around it."},"category":{"title":"Category","allOf":[{"$ref":"#/components/schemas/BackgroundCategoryEnum"}],"description":"The background removal category hints the type of objects on the image."}},"additionalProperties":false},"BackgroundSelectiveOptions":{"title":"BackgroundSelectiveOptions","required":["object_to_keep"],"type":"object","properties":{"object_to_keep":{"title":"Object To Keep","maxLength":128,"minLength":3,"type":"string","description":"Specify an object to keep on the image."}},"additionalProperties":false},"BackgroundCategoryEnum":{"title":"Category of objects","enum":["general","cars","products"],"type":"string","description":"Selects the category of objects on the image: \n\n| Value | Description |\n| --- | --- |\n| `\"general\"` | The category that is suitable for all objects and is used by default.|\n| `\"cars\"` | The advanced category that will have better results for removing the background with cars on foreground.|\n| `\"products\"` | The advanced category that will have better results for background removal of various types of products and groceries.|\n"},"BackgroundEnum":{"title":"Transparent","enum":["transparent"],"type":"string","description":"Makes the background of the image transparent, only works for `\"png\"` output format."},"BackgroundBlurOptions":{"title":"background blur options","type":"object","properties":{"selective":{"title":"Selective","allOf":[{"$ref":"#/components/schemas/BackgroundSelectiveOptions"}],"description":"Allows to select an object to keep on the image and blur the background around it."},"category":{"allOf":[{"$ref":"#/components/schemas/BackgroundCategoryEnum"}],"description":"Selects the category of objects on the image: \n\n| Value | Description |\n| --- | --- |\n| `\"general\"` | The category that is suitable for all objects and is used by default.|\n| `\"cars\"` | The advanced category that will have better results for removing the background with cars on foreground.|\n| `\"products\"` | The advanced category that will have better results for background removal of various types of products and groceries.|\n"},"type":{"allOf":[{"$ref":"#/components/schemas/BackgroundBlurTypeEnum"}],"description":"Selects the type of blur to be applied to the background: \n\n| Value | Description |\n| --- | --- |\n| `\"regular\"` | Gaussian blur. Creates an effect of laying a translucent material like vellum on top of the image background, is used by default.|\n| `\"lens\"` | Lens blur with linear focus. Mimics the blur applied to a photo when a wide aperture is used to achieve a narrow depth of field, so that the foreground objects stands out.|\n","default":"regular"},"level":{"allOf":[{"$ref":"#/components/schemas/BackgroundBlurLevelEnum"}],"description":"Selects the level of blur strength to be applied to the background: \n\n| Value | Description |\n| --- | --- |\n| `\"low\"` | Low blur strength.|\n| `\"medium\"` | Medium blur strength, is used by default.|\n| `\"high\"` | High blur strength.|\n","default":"medium"}},"additionalProperties":false},"BackgroundBlurTypeEnum":{"title":"Type of background blur","enum":["regular","lens"],"type":"string","description":"Selects the type of blur: \n\n| Value | Description |\n| --- | --- |\n| `\"regular\"` | Gaussian blur. Creates an effect of laying a translucent material like vellum on top of the image background.|\n| `\"lens\"` | Lens blur with linear focus. Mimics the blur applied to a photo when a wide aperture is used to achieve a narrow depth of field, so that the foreground objects stands out.|\n"},"BackgroundBlurLevelEnum":{"title":"Background blur strength level","enum":["low","medium","high"],"type":"string","description":"Selects the level of blur strength: \n\n| Value | Description |\n| --- | --- |\n| `\"low\"` | Low blur strength.|\n| `\"medium\"` | Medium blur strength.|\n| `\"high\"` | High blur strength.|\n"},"ResizingOptions":{"title":"resizing options","type":"object","properties":{"width":{"title":"Width","anyOf":[{"type":"integer","title":"Pixels","description":"Width in pixels."},{"$ref":"#/components/schemas/SizesEnum"},{"type":"string","title":"Percentage","description":"Percentage as a string. E.g. `\"200%\"` means that the `width` will double relative to the input image.\nIf you express `width` as a percentage, `height` must have the same value or set to `\"auto\"`. Examples: `\"60%\"`, `\"40%\"`"}],"description":"Width of output image. Should be of the same type as `height`, or `\"auto\"`.","default":"auto"},"height":{"title":"Height","anyOf":[{"type":"integer","title":"Pixels","description":"Height in pixels."},{"$ref":"#/components/schemas/SizesEnum"},{"type":"string","title":"Percentage","description":"Percentage as a string. E.g. `\"200%\"` means that the `height` will double relatively to the input image.\nIf you express `height` as a percentage, `width` must have the same value or set to `\"auto\"`. Examples: `\"60%\"`, `\"40%\"`"}],"description":"Height of output image. Should be of the same type as `width`, or `\"auto\"`.","default":"auto"},"fit":{"title":"Fit","anyOf":[{"$ref":"#/components/schemas/FitEnum"},{"$ref":"#/components/schemas/CropOptions"},{"$ref":"#/components/schemas/CoverOptions"},{"$ref":"#/components/schemas/BoundsOptions"},{"$ref":"#/components/schemas/CanvasOptions"},{"$ref":"#/components/schemas/OutpaintOptions"}],"description":"The fit parameter controls how the image will be constrained within the provided size, relative to the `width` and `height`. By default, `fit` mode is `\"crop\"`.","default":"crop"}},"additionalProperties":false},"SizesEnum":{"title":"Auto","enum":["auto"],"type":"string","description":"`width` will have the same value as `height`, if `height` is defined in pixels or percentages; and vice versa."},"FitEnum":{"title":"Fit","enum":["crop","cover","bounds","canvas","outpaint"],"type":"string","description":"Selects the fit mode: \n(Note: All fit modes preserve the original image aspect ratio. Meaning, the image can be cropped but it won't be stretched or squeezed.)\n\n| Value | Description |\n| --- | --- |\n| `\"crop\"` | Scales an image until it fully covers the specified dimensions, the rest gets cropped. Fit `crop` support `\"center\"` and `\"smart\"` modes for cropping.|\n| `\"cover\"` | Resize the image to entirely cover the specified region, making one dimension larger if needed.|\n| `\"bounds\"` | Resize the image to fit entirely within the specified region, making one dimension smaller if needed. |\n| `\"canvas\"` | Input image will be placed on the canvas established by `width` and `height`. Extra space will be filled with the background `color`.|\n| `\"outpaint\"` | Extra space will be generated with the coherent background.|"},"CropOptions":{"title":"crop options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["crop"],"type":"string"},"crop":{"title":"Crop mode","allOf":[{"$ref":"#/components/schemas/FitCropEnum"}],"description":"Selects the crop mode: \n\n| Value | Description |\n| --- | --- |\n| `\"center\"` | Cropping relative to the center of the image.|\n| `\"smart\"` | Content aware image cropping.|\n","default":"center"}},"additionalProperties":false},"FitCropEnum":{"title":"Crop","enum":["center","smart"],"type":"string","description":"Selects the crop mode: \n\n| Value | Description |\n| --- | --- |\n| `\"center\"` | Cropping relative to the center of the image.|\n| `\"smart\"` | Content aware image cropping.|\n"},"CoverOptions":{"title":"cover options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["cover"],"type":"string"}},"additionalProperties":false},"BoundsOptions":{"title":"bounds options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["bounds"],"type":"string"}},"additionalProperties":false},"CanvasOptions":{"title":"canvas options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["canvas"],"type":"string"}},"additionalProperties":false},"OutpaintOptions":{"title":"outpaint options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["outpaint"],"type":"string"},"feathering":{"title":"Feathering","pattern":"^[1-9][0-9]+[%]$|^[0-9][%]$","type":"string","description":"Percentage in string format. Examples: `\"60%\"`, `\"200%\"`","default":"15%"},"outpaint_by":{"title":"Outpaint By","type":"string","description":"The amount of outpainting to be applied to the image. Should be a string with one or two values separated by space. Each value can be in pixels (e.g. `\"100px\"`) or in percentages (e.g. `\"20%\"`).\nIf two values are provided, the first value is for the width and the second value is for the height.\nIf only one value is provided, it will be applied to both width and height.\nIf not provided, the outpainting will be applied in one direction only based on `fit.width` and `fit.height`.\nExamples: `\"10%\"`, `\"5% 15%\"`, `\"5% 0%\"`, `\"1024px\"`, `\"1024px 512px\"`, `\"0px 1024px\"`."}},"additionalProperties":false},"PrivacyOptions":{"title":"PrivacyOptions","type":"object","properties":{"blur_car_plate":{"title":"Blur Car Plate","type":"boolean","description":"If `true`, blurs car plate.","default":false},"identity_crop":{"title":"Identity Crop","type":"boolean","description":"Removes a person's face from the image by cutting everything above the mouth.","default":false}},"additionalProperties":false},"GenerativeOptions":{"title":"generative transformations options","type":"object","properties":{"style_transfer":{"title":"Style Transfer","allOf":[{"$ref":"#/components/schemas/StyleTransferOptions"}],"description":"Apply style from a reference image."}},"additionalProperties":false},"StyleTransferOptions":{"title":"style transfer options","required":["style_reference_image"],"type":"object","properties":{"style_reference_image":{"title":"Style Reference Image","type":"string","description":"URL of the image to be used as a style reference."},"prompt":{"title":"Prompt","maxLength":1024,"minLength":3,"type":"string","description":"Text prompt to adjust the style transfer output."},"depth_strength":{"title":"Depth Strength","maximum":1,"minimum":0,"type":"number","description":"The denoising strength determines the degree of overall composition and shape preservation.","default":1},"denoising_strength":{"title":"Denoising Strength","maximum":1,"minimum":0,"type":"number","description":"The denoising strength determines the degree of color and texture modification.","default":0.75},"style_strength":{"title":"Style Strength","maximum":1,"minimum":0,"type":"number","description":"The style strength determines the degree of overall style intensity as taken from the reference.","default":0.75}},"additionalProperties":false},"ImageOutputOptions":{"title":"image output options","type":"object","properties":{"format":{"title":"Format","anyOf":[{"$ref":"#/components/schemas/FormatEnum"},{"$ref":"#/components/schemas/FormatJpegOptions"},{"$ref":"#/components/schemas/FormatPngOptions"},{"$ref":"#/components/schemas/FormatWebpOptions"},{"$ref":"#/components/schemas/FormatAvifOptions"},{"$ref":"#/components/schemas/FormatTiffOptions"}],"description":"Converts an image to one of the following formats: `\"jpeg\"`, `\"png\"`, `\"webp\"`, `\"avif\"`. Selecting *Jpeg Options* allows to specify quality.","default":"jpeg"},"destination":{"title":"Output URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the output image. If `output` is not defined, we store the output image on our bucket and return the temporary URL. The name of the output file remains the same as the input file. Images are stored for one day.","format":"uri"},"metadata":{"title":"Metadata","allOf":[{"$ref":"#/components/schemas/MetadataOptions"}],"description":"Defines characteristics of the output image, e.g. DPI."}},"additionalProperties":false},"FormatEnum":{"title":"Format","enum":["jpeg","png","webp","avif","tiff"],"type":"string","description":"Converts the image into specified format. Examples: `\"jpeg\"`, `\"png\"`."},"FormatJpegOptions":{"title":"jpeg options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["jpeg"],"type":"string","description":"Must have value `\"jpeg\"`"},"quality":{"title":"Quality","maximum":100,"minimum":1,"type":"integer","default":85},"progressive":{"title":"Progressive","type":"boolean","description":"Progressive JPEG loads in a browser in successive waves until a clear picture is formed. This improves image's loading speed.","default":true}},"additionalProperties":false},"FormatPngOptions":{"title":"png options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["png"],"type":"string","description":"Must have value `\"png\"`"},"compression":{"allOf":[{"$ref":"#/components/schemas/FormatCompressionLevelEnum"}],"description":"Specifies compression effort that will be applied during the PNG image encoding. Should have one of values: `\"fast\"`, `\"best\"`, or `\"optimal\"`. Defaults to `\"optimal\"`.","default":"optimal"}},"additionalProperties":false},"FormatCompressionLevelEnum":{"title":"Compression","enum":["fast","best","optimal"],"type":"string","description":"Indicates compression effort. \n\n| Value | Description |\n| --- | --- |\n| `\"fast\"` |  Used to apply minimum compression resulting in a bigger image size but less processing time.|\n| `\"best\"` | Used to apply maximum compression resulting in a smaller image size but more processing time.|\n| `\"optimal\"` | DEFAULT. Used to balance between compression effort and the processing time.|\n"},"FormatWebpOptions":{"title":"webp options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["webp"],"type":"string","description":"Must have value `\"webp\"`"},"compression":{"title":"Compression","anyOf":[{"$ref":"#/components/schemas/WebpCompressionEnum"},{"$ref":"#/components/schemas/WebpLossyCompressionOptions"},{"$ref":"#/components/schemas/WebpLosslessCompressionOptions"}],"description":"The WEBP codec supports both lossless and lossy modes of operation, so you can select the one that is appropriate for your goals. Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image. You can specify the amount of loss you are willing to accept. By default it's set to to 75. Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.","default":{"type":"lossy","quality":75}}},"additionalProperties":false},"WebpCompressionEnum":{"title":"WEBP Compression","enum":["lossy","lossless"],"type":"string","description":"Selects the WEBP compression type: \n\n| Value | Description |\n| --- | --- |\n| `\"lossy\"` | Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image.|\n| `\"lossless\"` | Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.|\n"},"WebpLossyCompressionOptions":{"title":"WebpLossyCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossy"],"type":"string","description":"Must have value `\"lossy\"`"},"quality":{"title":"Quality","maximum":100,"minimum":1,"type":"integer","default":75}},"additionalProperties":false},"WebpLosslessCompressionOptions":{"title":"WebpLosslessCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossless"],"type":"string","description":"Must have value `\"lossless\"`"}},"additionalProperties":false},"FormatAvifOptions":{"title":"avif options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["avif"],"type":"string","description":"Must have value `\"avif\"`"},"compression":{"title":"Compression","anyOf":[{"$ref":"#/components/schemas/AvifCompressionEnum"},{"$ref":"#/components/schemas/AvifLossyCompressionOptions"},{"$ref":"#/components/schemas/AvifLosslessCompressionOptions"}],"description":"The AVIF codec supports both lossless and lossy modes of operation, so you can select the one that is appropriate for your goals. Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image. You can specify the amount of loss you are willing to accept. Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.","default":{"type":"lossy","quality":50}}},"additionalProperties":false},"AvifCompressionEnum":{"title":"AVIF Compression","enum":["lossy","lossless"],"type":"string","description":"Selects the AVIF compression type: \n\n| Value | Description |\n| --- | --- |\n| `\"lossy\"` | Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image.|\n| `\"lossless\"` | Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.|\n"},"AvifLossyCompressionOptions":{"title":"AvifLossyCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossy"],"type":"string","description":"Must have value `\"lossy\"`"},"quality":{"title":"Quality","maximum":100,"minimum":1,"type":"integer","default":50}},"additionalProperties":false},"AvifLosslessCompressionOptions":{"title":"AvifLosslessCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossless"],"type":"string","description":"Must have value `\"lossless\"`"}},"additionalProperties":false},"FormatTiffOptions":{"title":"FormatTiffOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["tiff"],"type":"string","description":"Must have value `\"tiff\"`"},"compression":{"title":"Compression","anyOf":[{"$ref":"#/components/schemas/TiffCompressionEnum"},{"$ref":"#/components/schemas/TiffLossyCompressionOptions"},{"$ref":"#/components/schemas/TiffLosslessCompressionOptions"}],"description":"The TIFF codec supports both lossless and lossy modes of operation, so you can select the one that is appropriate for your goals. Lossy JPEG compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image. You can specify the amount of loss you are willing to accept. By default it's set to to 75. Lossless LZW (Lempel-Ziv-Welch) compression allows you to save maximum image details in exchange for a significantly increased file size.","default":{"type":"lossless"}}},"additionalProperties":false},"TiffCompressionEnum":{"title":"TIFF Compression","enum":["lossy","lossless"],"type":"string","description":"Selects the TIFF compression type: \n\n| Value | Description |\n| --- | --- |\n| `\"lossy\"` | Lossy JPEG compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image.|\n| `\"lossless\"` | Lossless LZW (Lempel-Ziv-Welch) compression allows you to save maximum image details in exchange for a significantly increased file size.|\n"},"TiffLossyCompressionOptions":{"title":"TiffLossyCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossy"],"type":"string","description":"Must have value `\"lossy\"`"},"quality":{"title":"Quality","maximum":100,"minimum":1,"type":"integer","default":75}},"additionalProperties":false},"TiffLosslessCompressionOptions":{"title":"TiffLosslessCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossless"],"type":"string","description":"Must have value `\"lossless\"`"}},"additionalProperties":false},"MetadataOptions":{"title":"image color space options","type":"object","properties":{"dpi":{"title":"DPI","type":"integer","description":"Dots per inch."},"color_space":{"title":"Color Space","anyOf":[{"$ref":"#/components/schemas/ColorSpaceEnum"},{"$ref":"#/components/schemas/RGBColorSpaceOptions"},{"$ref":"#/components/schemas/CMYKColorSpaceOptions"}],"description":"Specifies desirable color space of the output image. By default, preserves the color space of the original image."}},"additionalProperties":false},"ColorSpaceEnum":{"title":"Type of color space","enum":["RGB","CMYK"],"type":"string","description":"Selects the type of color space: \n\n| Value | Description |\n| --- | --- |\n| `\"RGB\"` | Is the color space for digital images. Use the RGB color mode if your image is supposed to be displayed on any kind of screen.|\n| `\"CMYK\"` | Is the color space for printed materials. Use CMYK for any image that will be physically printed, not viewed on a screen.|\n"},"RGBColorSpaceOptions":{"title":"RGBColorSpaceOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["RGB"],"type":"string"}},"additionalProperties":false},"CMYKColorSpaceOptions":{"title":"CMYKColorSpaceOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["CMYK"],"type":"string"},"color_profile":{"allOf":[{"$ref":"#/components/schemas/CMYKColorProfileEnum"}],"description":"Specifies color profile that will be used for color space. \n\nSelects the type of color space profile: \n\n| Value | Description | Paper | Max. total ink (TAC) | Characterisation data | \n| --- | --- | --- | --- | --- |\n| `\"ISO_Coated\"` | (Coated FOGRA39, ISO 12647-2:2004) Is used by default. Standard for glossy and matte coated paper. | Grades 1 and 2, gloss and matte coated. | 330% | FOGRA39 |\n| `\"ISO_Uncoated\"` | (Uncoated FOGRA29, ISO 12647-2:2004) Standard for uncoated white natural paper. | Grade 4, uncoated white offset. | 300% | FOGRA29 |\n| `\"USWeb_Coated\"` | (SWOP2006_Coated3v2) Standard for glossy and matte coated paper in the United States. | Grades 1, 2 and 3 gloss coated, matte coated and uncoated paper. | 300% | CGATS TR003 |\n| `\"USWeb_Uncoated\"` | (GRACoL 2013 Uncoated) Standard for uncoated white natural paper in the United States. | Grade 4, uncoated white offset. | 260% |  CGATS21-2-CRPC3 |\n","default":"USWeb_Coated"}},"additionalProperties":false},"CMYKColorProfileEnum":{"title":"Type of color space","enum":["ISO_Coated","ISO_Uncoated","USWeb_Coated","USWeb_Uncoated"],"type":"string","description":"Selects the type of color space profile: \n\n| Value | Description | Paper | Max. total ink (TAC) | Characterisation data | \n| --- | --- | --- | --- | --- |\n| `\"ISO_Coated\"` | (Coated FOGRA39, ISO 12647-2:2004) Is used by default. Standard for glossy and matte coated paper. | Grades 1 and 2, gloss and matte coated. | 330% | FOGRA39 |\n| `\"ISO_Uncoated\"` | (Uncoated FOGRA29, ISO 12647-2:2004) Standard for uncoated white natural paper. | Grade 4, uncoated white offset. | 300% | FOGRA29 |\n| `\"USWeb_Coated\"` | (SWOP2006_Coated3v2) Standard for glossy and matte coated paper in the United States. | Grades 1, 2 and 3 gloss coated, matte coated and uncoated paper. | 300% | CGATS TR003 |\n| `\"USWeb_Uncoated\"` | (GRACoL 2013 Uncoated) Standard for uncoated white natural paper in the United States. | Grade 4, uncoated white offset. | 260% |  CGATS21-2-CRPC3 |\n"},"Response_EditResponse_":{"title":"Response[EditResponse]","type":"object","properties":{"data":{"$ref":"#/components/schemas/EditResponse"}},"description":"Wrapper for responses"},"EditResponse":{"title":"EditResponse","required":["input","output"],"type":"object","properties":{"input":{"$ref":"#/components/schemas/PipelineInputObject"},"output":{"$ref":"#/components/schemas/PipelineOutputObject"},"profiling":{"title":"Profiling","type":"object"}}},"PipelineInputObject":{"title":"PipelineInputObject","required":["ext","mps","mime","format","width","height"],"type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension. Can have values: `\"jpg\"`, `\"png\"`, `\"avif\"`"},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as ‘media type’)"},"format":{"title":"Format","type":"string","description":"File format. Can have values: `\"jpeg\"`, `\"png\"`, `\"avif\"`"},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"}}},"PipelineOutputObject":{"title":"PipelineOutputObject","required":["ext","mps","mime","format","width","height"],"type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension. Can have values: `\"jpg\"`, `\"png\"`, `\"avif\"`"},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as ‘media type’)"},"format":{"title":"Format","type":"string","description":"File format. Can have values: `\"jpeg\"`, `\"png\"`, `\"avif\"`"},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"},"tmp_url":{"title":"Tmp Url","type":"string","description":"Temporal URL of a processed image"},"object_key":{"title":"Object Key","type":"string","description":"Path to a processed image in a bucket"},"object_bucket":{"title":"Object Bucket","type":"string","description":"Bucket name"},"object_uri":{"title":"Object Uri","type":"string","description":"URI of a processed image in a bucket"},"claid_storage_uri":{"title":"Claid Storage Uri","type":"string","description":"URI of a processed image in a storage"}}},"HttpErrorDetails":{"title":"HttpErrorDetails","required":["error_code","error_type","error_message"],"type":"object","properties":{"error_code":{"title":"Error Code","type":"string"},"error_type":{"$ref":"#/components/schemas/ErrorType"},"error_message":{"title":"Error Message","type":"string"},"error_details":{"title":"Error Details","type":"object","default":{}}}},"ErrorType":{"title":"ErrorType","enum":["auth","dlvr","general","le","survey","storage","image","user_settings","user","validation","analytics","scene","billing","web","runtime_settings","animation","custom_models"],"type":"string","description":"An enumeration."}}},"paths":{"/v1/image/edit":{"post":{"tags":["Image"],"summary":"Image Edit","description":"Specifies: \n- what image will be processed (`input`)\n- how it will be processed (`operations`)\n- where it will be stored (`output`)","operationId":"image_edit_v1_image_edit_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EditRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response_EditResponse_"}}}},"401":{"description":"Authorization is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"402":{"description":"No API calls left.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"403":{"description":"Not enough permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"422":{"description":"Unprocessable Entity.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}}}}}}}
```

**Request**

{% tabs %}
{% tab title="HTTP" %}

```http
POST /v1/image/edit HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
Content-Type: application/json

{
    "input": "https://claid.ai/assets/cms/shoe_example_05fb154a3a/shoe_example_05fb154a3a.png",
    "operations": {
        "resizing": {
            "width": 1000
        },
        "background": {
            "remove": false
        }
    }
}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl -X POST --location "https://api.claid.ai/v1/image/edit" --http1.1 \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}" \
    -H "Content-Type: application/json" \
    -d "{
            \"input\": \"https://claid.ai/assets/cms/shoe_example_05fb154a3a/shoe_example_05fb154a3a.png\",
            \"operations\": {
                \"resizing\": {
                    \"width\": 1000
                },
                \"background\": {
                    \"remove\": false
                }
            }
        }"
```

{% endtab %}
{% endtabs %}

#### Request headers:

In order to send a request, you should set `Content-Type` header to let our system know that you providing a valid json payload and `Authorization` header with a generated API key to [identify yourself](/authentication) as a Claid user.

```http
Content-Type: application/json
Authorization: Bearer {YOUR_API_KEY}
```

#### **Read a response**

Once you have made the request to `https://api.claid.ai/v1/image/edit` you will get a response with information about input and output images.

Image information shown in the response:

| Parameter | Type    | Description                                                  |
| --------- | ------- | ------------------------------------------------------------ |
| ext       | string  | File extension. Can have values: `jpg`, `png`, `webp`, `av1` |
| mps       | integer | Megapixel count                                              |
| mime      | string  | MIME type (also known as ‘media type’)                       |
| width     | integer | Image width in pixels                                        |
| height    | integer | Image height in pixels                                       |
| format    | string  | File format. Can have values: `jpeg`, `png`, `webp`, `avif`  |
| tmp\_url  | string  | Temporary URL of a processed image.\*                        |

**Response body**

```json
{
    "data": {
        "input": {
            "ext": "png",
            "mps": 0.125,
            "mime": "image/png",
            "width": 500,
            "format": "PNG",
            "height": 250
        },
        "output": {
            "ext": "png",
            "mps": 0.431,
            "mime": "image/jpeg",
            "width": 1000,
            "format": "JPEG",
            "height": 431,
            "tmp_url": "https://storage.googleapis.com/production-leapi-tmp-public/733a7c8f-1fea-4097-8fd4-17f54c94d998/shoe_example_05fb154a3a.png"
        }
    }
}
```

#### Response headers:

[Rate limit](/rate-limits) headers will help you to understand what number of requests you are able to send according to the current limits on your account:

```http
ratelimit-limit: 120, 120;w=60, 4;w=1
ratelimit-remaining: 119
ratelimit-reset: 34
```

Request Id header allows to track your request during image edit processing, so we are able to help you with troubleshooting and profiling your request if needed.

```http
x-request-id: 9b321763-1d09-4072-932b-ff031475affa
```


# Async API Reference

## Async image edit contract

Async endpoint returns a response without waiting for an actual result. The actual result should be queried with another request. So you can request image editing and separately get the result after it's ready.

### Request image processing

The request body for async endpoint is the same as for regular image edit operation. See [Image edit contract](/image-editing-api/api-reference#image-edit-contract) for more info.

## Async Image Edit

> Specifies: \
> \- what image will be processed (\`input\`)\
> \- how it will be processed (\`operations\`)\
> \- where it will be stored (\`output\`)

```json
{"openapi":"3.1.0","info":{"title":"Claid REST API","version":"v1"},"tags":[{"name":"Image","description":"Encompasses operations with images."}],"security":[{"OAuth2PasswordBearer":[]},{"OAuth2PasswordBearer":["image_editing"]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}},"description":"To work with the Claid API, send requests over HTTPS and authenticate using the `Authorization` header in the following format:`Authorization: Bearer <YOUR_API_KEY>`. You do not need to provide a password.\n\nTo get your API key, [sign in to your Claid account](https://claid.ai/login) and click ***Create API key*** button from the ***Overview*** or ***API keys*** pages.\n\nClaid API’s base URL is `https://api.claid.ai/v1/`. All available endpoints are listed in the [Storage](#tag/Storage) and [Image](#tag/Image) sections. \n\n## Bearer\n\nThis API uses OAuth 2.0 [bearer token](https://datatracker.ietf.org/doc/html/rfc6750) (API key) to authorize requests."}},"schemas":{"AsyncEditRequest":{"title":"AsyncEditRequest","required":["input","operations"],"type":"object","properties":{"input":{"title":"Input URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the input image. Should be from 1 to 512 characters. Image must be accessible by our system.","format":"uri"},"operations":{"title":"Operations","allOf":[{"$ref":"#/components/schemas/ImageOperations"}],"description":"Customize the editing workflow so that the output images meet your requirements."},"output":{"title":"Output","anyOf":[{"$ref":"#/components/schemas/ImageOutputOptions"},{"type":"string","minLength":1,"maxLength":4096,"format":"uri"}],"description":"Customize the result output.","default":{"format":"jpeg"}}},"additionalProperties":false},"ImageOperations":{"title":"image operations options","type":"object","properties":{"restorations":{"title":"Restorations","allOf":[{"$ref":"#/components/schemas/RestorationsOptions"}],"description":"Restore lost details and decompress image with a wide range of AI-powered neural networks. By default, both operations is turned off.","default":{"polish":false}},"adjustments":{"title":"Adjustments","allOf":[{"$ref":"#/components/schemas/AdjustmentsOptions"}],"description":"Change image histogram: set brightness, saturation, dynamic range, balance out colors and lighting. By default, no adjustments are made."},"background":{"title":"Background","allOf":[{"$ref":"#/components/schemas/BackgroundOptions"}],"description":"Remove the background and set a solid color. By default, no changes are made.","default":{"remove":false,"blur":false,"use_original_alpha":false}},"resizing":{"title":"Resizing","allOf":[{"$ref":"#/components/schemas/ResizingOptions"}],"description":"Set the final image size. Crop or fit image in canvas. By default, API will perform all calculations respecting the original image aspect ratio.","default":{"width":"auto","height":"auto","fit":"crop"}},"padding":{"title":"Padding","type":"string","description":"Add a space around the object equally to each of 4 sides, or for height&width separately. Can not be bigger than half of image width/height. By default, padding is not applied."},"privacy":{"title":"Privacy","allOf":[{"$ref":"#/components/schemas/PrivacyOptions"}],"description":"Manage sensitive information on the image.","default":{"blur_car_plate":false,"identity_crop":false}},"generative":{"title":"Generative","allOf":[{"$ref":"#/components/schemas/GenerativeOptions"}],"description":"Transform the image using generative models."}},"additionalProperties":false},"RestorationsOptions":{"title":"restorations options","type":"object","properties":{"decompress":{"allOf":[{"$ref":"#/components/schemas/DecompressEnum"}],"description":"The decompress operation allows you to remove distortion and artifacts caused by image compression methods. It can be used in conjunction with the upscale operation to prepare an image for upscaling.\n\n| Value | Description |\n| --- | --- |\n| null | DEFAULT. No restoration applied.|\n| `\"moderate\"` | Removes JPEG artifacts from the image.|\n| `\"strong\"` | Removes JPEG artifacts more aggressively than \"moderate\".|\n| `\"auto\"` | Automatically detects and remove JPEG artifacts if needed.|"},"upscale":{"title":"Upscale","anyOf":[{"$ref":"#/components/schemas/UpscaleEnum"},{"$ref":"#/components/schemas/UpscalePhotoOptions"}],"description":"The upscale operation allows you to improve the overall quality of an image by rendering out new pixels. The upscale operation works along with resizing through numeric or percentage values for upscaling."},"polish":{"title":"Polish image","type":"boolean","description":"If `true`, polishes an image","default":false}},"additionalProperties":false},"DecompressEnum":{"title":"Decompress","enum":["moderate","strong","auto"],"type":"string","description":"Selects the restoration mode.\n\n| Value | Description |\n| --- | --- |\n| `null` | DEFAULT. No restoration applied.|\n| `\"moderate\"` | Removes JPEG artifacts from the image.|\n| `\"strong\"` | Removes JPEG artifacts more aggressively than `\"moderate\"`.|\n| `\"auto\"` | Automatically detects and remove JPEG artifacts if needed.|"},"UpscaleEnum":{"title":"Upscale","enum":["smart_enhance","smart_resize","faces","digital_art","photo"],"type":"string","description":"Upscales the image with specified type of image upscaling neural network. \n\n| Value | Description |\n| --- | --- |\n| `null` | DEFAULT. Interpolation. Used when output image resolution is smaller than the input resolution.|\n| `\"smart_enhance\"` | Used for small low quality product, real estate and food images.|\n| `\"smart_resize\"` | Used for high quality images.|\n| `\"faces\"` | Used for images containing persons.|\n| `\"digital_art\"` | Used for drawings, illustrations, paintings, cartoons, anime, etc.|\n| `\"photo\"` | Used for images taken by mobile devices or digital camera of people, nature, architecture, etc.|"},"UpscalePhotoOptions":{"title":"photo upscale options","required":["type","version"],"type":"object","properties":{"type":{"title":"Type","enum":["photo"],"type":"string"},"version":{"title":"Version","allOf":[{"$ref":"#/components/schemas/PhotoVersionEnum"}],"description":"Upscales the image with specified version of photo upscaling neural network. \n\n| Value | Description |\n| --- | --- |\n| `\"1\"` | Is deprecated and not recommended.|\n| `\"2\"` | Used for restoring image quality that is taken by mobile devices or digital camera.|\n| `\"3\"` | Used for restoring image quality, a bit more aggressively than \"2\".|\n"}},"additionalProperties":false},"PhotoVersionEnum":{"title":"Version","enum":["1","2","3"],"type":"string","description":"Upscales the image with specified version of photo upscaling neural network. \n\n| Value | Description |\n| --- | --- |\n| `\"1\"` | Is deprecated and not recommended.|\n| `\"2\"` | Used for restoring image quality that is taken by mobile devices or digital camera.|\n| `\"3\"` | Used for restoring image quality, a bit more aggressively than `\"2\"`.|\n"},"AdjustmentsOptions":{"title":"adjustments options","type":"object","properties":{"hdr":{"title":"Hdr","anyOf":[{"type":"integer","description":"HDR effect intensity.","minimum":0,"maximum":100},{"$ref":"#/components/schemas/HdrOptions"}],"description":"Balances out colors and lighting. Allows to turn on `stitching` for stitched 360 photos.","default":0},"exposure":{"title":"Exposure","maximum":100,"minimum":-100,"type":"integer","description":"Decrease (negative integer) or increase (positive integer) exposure.","default":0},"saturation":{"title":"Saturation","maximum":100,"minimum":-100,"type":"integer","description":"Decrease (negative integer) or increase (positive integer) saturation.","default":0},"contrast":{"title":"Contrast","maximum":100,"minimum":-100,"type":"integer","description":"Decrease (negative integer) or increase (positive integer) contrast.","default":0},"sharpness":{"title":"Sharpness","maximum":100,"minimum":0,"type":"integer","description":"Increase sharpness.","default":0}},"additionalProperties":false},"HdrOptions":{"title":"hdr options","type":"object","properties":{"intensity":{"title":"Intensity","maximum":100,"minimum":0,"type":"integer","description":"HDR effect intensity.","default":100},"stitching":{"title":"Stitching","type":"boolean","description":"Set to true for seamless HDR effect on stitched 360 photos.","default":false}},"additionalProperties":false},"BackgroundOptions":{"title":"background options","type":"object","properties":{"remove":{"title":"Remove","anyOf":[{"type":"boolean","title":"Remove background","description":"If `true`, removes background"},{"$ref":"#/components/schemas/BackgroundRemovalOptions"}],"description":"Allows to turn on and configure image background removal.","default":false},"color":{"title":"Color","anyOf":[{"type":"string","title":"Color","description":"Color as a hexadecimal. Paints the background of the image. Examples: `\"#ffffff\"`, `\"#000000\"`."},{"$ref":"#/components/schemas/BackgroundEnum"}],"description":"Color as a hexadecimal. Sets a background color. Defaults to the `#ffffff` (white) color, or `transparent` if an input image has transparency."},"blur":{"title":"Blur","anyOf":[{"type":"boolean","title":"Blur background","description":"If `true`, blurs background. Defaults to `false`."},{"$ref":"#/components/schemas/BackgroundBlurOptions"}],"description":"Allows to turn on and configure image background blurring.","default":false}},"additionalProperties":false},"BackgroundRemovalOptions":{"title":"background removal options","type":"object","properties":{"clipping":{"title":"Clip to object","type":"boolean","description":"If `true` image will be cropped up to the edges of the foreground object.","default":false},"selective":{"title":"Selective","allOf":[{"$ref":"#/components/schemas/BackgroundSelectiveOptions"}],"description":"Allows to select an object to keep on the image and remove the background around it."},"category":{"title":"Category","allOf":[{"$ref":"#/components/schemas/BackgroundCategoryEnum"}],"description":"The background removal category hints the type of objects on the image."}},"additionalProperties":false},"BackgroundSelectiveOptions":{"title":"BackgroundSelectiveOptions","required":["object_to_keep"],"type":"object","properties":{"object_to_keep":{"title":"Object To Keep","maxLength":128,"minLength":3,"type":"string","description":"Specify an object to keep on the image."}},"additionalProperties":false},"BackgroundCategoryEnum":{"title":"Category of objects","enum":["general","cars","products"],"type":"string","description":"Selects the category of objects on the image: \n\n| Value | Description |\n| --- | --- |\n| `\"general\"` | The category that is suitable for all objects and is used by default.|\n| `\"cars\"` | The advanced category that will have better results for removing the background with cars on foreground.|\n| `\"products\"` | The advanced category that will have better results for background removal of various types of products and groceries.|\n"},"BackgroundEnum":{"title":"Transparent","enum":["transparent"],"type":"string","description":"Makes the background of the image transparent, only works for `\"png\"` output format."},"BackgroundBlurOptions":{"title":"background blur options","type":"object","properties":{"selective":{"title":"Selective","allOf":[{"$ref":"#/components/schemas/BackgroundSelectiveOptions"}],"description":"Allows to select an object to keep on the image and blur the background around it."},"category":{"allOf":[{"$ref":"#/components/schemas/BackgroundCategoryEnum"}],"description":"Selects the category of objects on the image: \n\n| Value | Description |\n| --- | --- |\n| `\"general\"` | The category that is suitable for all objects and is used by default.|\n| `\"cars\"` | The advanced category that will have better results for removing the background with cars on foreground.|\n| `\"products\"` | The advanced category that will have better results for background removal of various types of products and groceries.|\n"},"type":{"allOf":[{"$ref":"#/components/schemas/BackgroundBlurTypeEnum"}],"description":"Selects the type of blur to be applied to the background: \n\n| Value | Description |\n| --- | --- |\n| `\"regular\"` | Gaussian blur. Creates an effect of laying a translucent material like vellum on top of the image background, is used by default.|\n| `\"lens\"` | Lens blur with linear focus. Mimics the blur applied to a photo when a wide aperture is used to achieve a narrow depth of field, so that the foreground objects stands out.|\n","default":"regular"},"level":{"allOf":[{"$ref":"#/components/schemas/BackgroundBlurLevelEnum"}],"description":"Selects the level of blur strength to be applied to the background: \n\n| Value | Description |\n| --- | --- |\n| `\"low\"` | Low blur strength.|\n| `\"medium\"` | Medium blur strength, is used by default.|\n| `\"high\"` | High blur strength.|\n","default":"medium"}},"additionalProperties":false},"BackgroundBlurTypeEnum":{"title":"Type of background blur","enum":["regular","lens"],"type":"string","description":"Selects the type of blur: \n\n| Value | Description |\n| --- | --- |\n| `\"regular\"` | Gaussian blur. Creates an effect of laying a translucent material like vellum on top of the image background.|\n| `\"lens\"` | Lens blur with linear focus. Mimics the blur applied to a photo when a wide aperture is used to achieve a narrow depth of field, so that the foreground objects stands out.|\n"},"BackgroundBlurLevelEnum":{"title":"Background blur strength level","enum":["low","medium","high"],"type":"string","description":"Selects the level of blur strength: \n\n| Value | Description |\n| --- | --- |\n| `\"low\"` | Low blur strength.|\n| `\"medium\"` | Medium blur strength.|\n| `\"high\"` | High blur strength.|\n"},"ResizingOptions":{"title":"resizing options","type":"object","properties":{"width":{"title":"Width","anyOf":[{"type":"integer","title":"Pixels","description":"Width in pixels."},{"$ref":"#/components/schemas/SizesEnum"},{"type":"string","title":"Percentage","description":"Percentage as a string. E.g. `\"200%\"` means that the `width` will double relative to the input image.\nIf you express `width` as a percentage, `height` must have the same value or set to `\"auto\"`. Examples: `\"60%\"`, `\"40%\"`"}],"description":"Width of output image. Should be of the same type as `height`, or `\"auto\"`.","default":"auto"},"height":{"title":"Height","anyOf":[{"type":"integer","title":"Pixels","description":"Height in pixels."},{"$ref":"#/components/schemas/SizesEnum"},{"type":"string","title":"Percentage","description":"Percentage as a string. E.g. `\"200%\"` means that the `height` will double relatively to the input image.\nIf you express `height` as a percentage, `width` must have the same value or set to `\"auto\"`. Examples: `\"60%\"`, `\"40%\"`"}],"description":"Height of output image. Should be of the same type as `width`, or `\"auto\"`.","default":"auto"},"fit":{"title":"Fit","anyOf":[{"$ref":"#/components/schemas/FitEnum"},{"$ref":"#/components/schemas/CropOptions"},{"$ref":"#/components/schemas/CoverOptions"},{"$ref":"#/components/schemas/BoundsOptions"},{"$ref":"#/components/schemas/CanvasOptions"},{"$ref":"#/components/schemas/OutpaintOptions"}],"description":"The fit parameter controls how the image will be constrained within the provided size, relative to the `width` and `height`. By default, `fit` mode is `\"crop\"`.","default":"crop"}},"additionalProperties":false},"SizesEnum":{"title":"Auto","enum":["auto"],"type":"string","description":"`width` will have the same value as `height`, if `height` is defined in pixels or percentages; and vice versa."},"FitEnum":{"title":"Fit","enum":["crop","cover","bounds","canvas","outpaint"],"type":"string","description":"Selects the fit mode: \n(Note: All fit modes preserve the original image aspect ratio. Meaning, the image can be cropped but it won't be stretched or squeezed.)\n\n| Value | Description |\n| --- | --- |\n| `\"crop\"` | Scales an image until it fully covers the specified dimensions, the rest gets cropped. Fit `crop` support `\"center\"` and `\"smart\"` modes for cropping.|\n| `\"cover\"` | Resize the image to entirely cover the specified region, making one dimension larger if needed.|\n| `\"bounds\"` | Resize the image to fit entirely within the specified region, making one dimension smaller if needed. |\n| `\"canvas\"` | Input image will be placed on the canvas established by `width` and `height`. Extra space will be filled with the background `color`.|\n| `\"outpaint\"` | Extra space will be generated with the coherent background.|"},"CropOptions":{"title":"crop options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["crop"],"type":"string"},"crop":{"title":"Crop mode","allOf":[{"$ref":"#/components/schemas/FitCropEnum"}],"description":"Selects the crop mode: \n\n| Value | Description |\n| --- | --- |\n| `\"center\"` | Cropping relative to the center of the image.|\n| `\"smart\"` | Content aware image cropping.|\n","default":"center"}},"additionalProperties":false},"FitCropEnum":{"title":"Crop","enum":["center","smart"],"type":"string","description":"Selects the crop mode: \n\n| Value | Description |\n| --- | --- |\n| `\"center\"` | Cropping relative to the center of the image.|\n| `\"smart\"` | Content aware image cropping.|\n"},"CoverOptions":{"title":"cover options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["cover"],"type":"string"}},"additionalProperties":false},"BoundsOptions":{"title":"bounds options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["bounds"],"type":"string"}},"additionalProperties":false},"CanvasOptions":{"title":"canvas options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["canvas"],"type":"string"}},"additionalProperties":false},"OutpaintOptions":{"title":"outpaint options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["outpaint"],"type":"string"},"feathering":{"title":"Feathering","pattern":"^[1-9][0-9]+[%]$|^[0-9][%]$","type":"string","description":"Percentage in string format. Examples: `\"60%\"`, `\"200%\"`","default":"15%"},"outpaint_by":{"title":"Outpaint By","type":"string","description":"The amount of outpainting to be applied to the image. Should be a string with one or two values separated by space. Each value can be in pixels (e.g. `\"100px\"`) or in percentages (e.g. `\"20%\"`).\nIf two values are provided, the first value is for the width and the second value is for the height.\nIf only one value is provided, it will be applied to both width and height.\nIf not provided, the outpainting will be applied in one direction only based on `fit.width` and `fit.height`.\nExamples: `\"10%\"`, `\"5% 15%\"`, `\"5% 0%\"`, `\"1024px\"`, `\"1024px 512px\"`, `\"0px 1024px\"`."}},"additionalProperties":false},"PrivacyOptions":{"title":"PrivacyOptions","type":"object","properties":{"blur_car_plate":{"title":"Blur Car Plate","type":"boolean","description":"If `true`, blurs car plate.","default":false},"identity_crop":{"title":"Identity Crop","type":"boolean","description":"Removes a person's face from the image by cutting everything above the mouth.","default":false}},"additionalProperties":false},"GenerativeOptions":{"title":"generative transformations options","type":"object","properties":{"style_transfer":{"title":"Style Transfer","allOf":[{"$ref":"#/components/schemas/StyleTransferOptions"}],"description":"Apply style from a reference image."}},"additionalProperties":false},"StyleTransferOptions":{"title":"style transfer options","required":["style_reference_image"],"type":"object","properties":{"style_reference_image":{"title":"Style Reference Image","type":"string","description":"URL of the image to be used as a style reference."},"prompt":{"title":"Prompt","maxLength":1024,"minLength":3,"type":"string","description":"Text prompt to adjust the style transfer output."},"depth_strength":{"title":"Depth Strength","maximum":1,"minimum":0,"type":"number","description":"The denoising strength determines the degree of overall composition and shape preservation.","default":1},"denoising_strength":{"title":"Denoising Strength","maximum":1,"minimum":0,"type":"number","description":"The denoising strength determines the degree of color and texture modification.","default":0.75},"style_strength":{"title":"Style Strength","maximum":1,"minimum":0,"type":"number","description":"The style strength determines the degree of overall style intensity as taken from the reference.","default":0.75}},"additionalProperties":false},"ImageOutputOptions":{"title":"image output options","type":"object","properties":{"format":{"title":"Format","anyOf":[{"$ref":"#/components/schemas/FormatEnum"},{"$ref":"#/components/schemas/FormatJpegOptions"},{"$ref":"#/components/schemas/FormatPngOptions"},{"$ref":"#/components/schemas/FormatWebpOptions"},{"$ref":"#/components/schemas/FormatAvifOptions"},{"$ref":"#/components/schemas/FormatTiffOptions"}],"description":"Converts an image to one of the following formats: `\"jpeg\"`, `\"png\"`, `\"webp\"`, `\"avif\"`. Selecting *Jpeg Options* allows to specify quality.","default":"jpeg"},"destination":{"title":"Output URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the output image. If `output` is not defined, we store the output image on our bucket and return the temporary URL. The name of the output file remains the same as the input file. Images are stored for one day.","format":"uri"},"metadata":{"title":"Metadata","allOf":[{"$ref":"#/components/schemas/MetadataOptions"}],"description":"Defines characteristics of the output image, e.g. DPI."}},"additionalProperties":false},"FormatEnum":{"title":"Format","enum":["jpeg","png","webp","avif","tiff"],"type":"string","description":"Converts the image into specified format. Examples: `\"jpeg\"`, `\"png\"`."},"FormatJpegOptions":{"title":"jpeg options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["jpeg"],"type":"string","description":"Must have value `\"jpeg\"`"},"quality":{"title":"Quality","maximum":100,"minimum":1,"type":"integer","default":85},"progressive":{"title":"Progressive","type":"boolean","description":"Progressive JPEG loads in a browser in successive waves until a clear picture is formed. This improves image's loading speed.","default":true}},"additionalProperties":false},"FormatPngOptions":{"title":"png options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["png"],"type":"string","description":"Must have value `\"png\"`"},"compression":{"allOf":[{"$ref":"#/components/schemas/FormatCompressionLevelEnum"}],"description":"Specifies compression effort that will be applied during the PNG image encoding. Should have one of values: `\"fast\"`, `\"best\"`, or `\"optimal\"`. Defaults to `\"optimal\"`.","default":"optimal"}},"additionalProperties":false},"FormatCompressionLevelEnum":{"title":"Compression","enum":["fast","best","optimal"],"type":"string","description":"Indicates compression effort. \n\n| Value | Description |\n| --- | --- |\n| `\"fast\"` |  Used to apply minimum compression resulting in a bigger image size but less processing time.|\n| `\"best\"` | Used to apply maximum compression resulting in a smaller image size but more processing time.|\n| `\"optimal\"` | DEFAULT. Used to balance between compression effort and the processing time.|\n"},"FormatWebpOptions":{"title":"webp options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["webp"],"type":"string","description":"Must have value `\"webp\"`"},"compression":{"title":"Compression","anyOf":[{"$ref":"#/components/schemas/WebpCompressionEnum"},{"$ref":"#/components/schemas/WebpLossyCompressionOptions"},{"$ref":"#/components/schemas/WebpLosslessCompressionOptions"}],"description":"The WEBP codec supports both lossless and lossy modes of operation, so you can select the one that is appropriate for your goals. Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image. You can specify the amount of loss you are willing to accept. By default it's set to to 75. Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.","default":{"type":"lossy","quality":75}}},"additionalProperties":false},"WebpCompressionEnum":{"title":"WEBP Compression","enum":["lossy","lossless"],"type":"string","description":"Selects the WEBP compression type: \n\n| Value | Description |\n| --- | --- |\n| `\"lossy\"` | Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image.|\n| `\"lossless\"` | Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.|\n"},"WebpLossyCompressionOptions":{"title":"WebpLossyCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossy"],"type":"string","description":"Must have value `\"lossy\"`"},"quality":{"title":"Quality","maximum":100,"minimum":1,"type":"integer","default":75}},"additionalProperties":false},"WebpLosslessCompressionOptions":{"title":"WebpLosslessCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossless"],"type":"string","description":"Must have value `\"lossless\"`"}},"additionalProperties":false},"FormatAvifOptions":{"title":"avif options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["avif"],"type":"string","description":"Must have value `\"avif\"`"},"compression":{"title":"Compression","anyOf":[{"$ref":"#/components/schemas/AvifCompressionEnum"},{"$ref":"#/components/schemas/AvifLossyCompressionOptions"},{"$ref":"#/components/schemas/AvifLosslessCompressionOptions"}],"description":"The AVIF codec supports both lossless and lossy modes of operation, so you can select the one that is appropriate for your goals. Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image. You can specify the amount of loss you are willing to accept. Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.","default":{"type":"lossy","quality":50}}},"additionalProperties":false},"AvifCompressionEnum":{"title":"AVIF Compression","enum":["lossy","lossless"],"type":"string","description":"Selects the AVIF compression type: \n\n| Value | Description |\n| --- | --- |\n| `\"lossy\"` | Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image.|\n| `\"lossless\"` | Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.|\n"},"AvifLossyCompressionOptions":{"title":"AvifLossyCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossy"],"type":"string","description":"Must have value `\"lossy\"`"},"quality":{"title":"Quality","maximum":100,"minimum":1,"type":"integer","default":50}},"additionalProperties":false},"AvifLosslessCompressionOptions":{"title":"AvifLosslessCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossless"],"type":"string","description":"Must have value `\"lossless\"`"}},"additionalProperties":false},"FormatTiffOptions":{"title":"FormatTiffOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["tiff"],"type":"string","description":"Must have value `\"tiff\"`"},"compression":{"title":"Compression","anyOf":[{"$ref":"#/components/schemas/TiffCompressionEnum"},{"$ref":"#/components/schemas/TiffLossyCompressionOptions"},{"$ref":"#/components/schemas/TiffLosslessCompressionOptions"}],"description":"The TIFF codec supports both lossless and lossy modes of operation, so you can select the one that is appropriate for your goals. Lossy JPEG compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image. You can specify the amount of loss you are willing to accept. By default it's set to to 75. Lossless LZW (Lempel-Ziv-Welch) compression allows you to save maximum image details in exchange for a significantly increased file size.","default":{"type":"lossless"}}},"additionalProperties":false},"TiffCompressionEnum":{"title":"TIFF Compression","enum":["lossy","lossless"],"type":"string","description":"Selects the TIFF compression type: \n\n| Value | Description |\n| --- | --- |\n| `\"lossy\"` | Lossy JPEG compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image.|\n| `\"lossless\"` | Lossless LZW (Lempel-Ziv-Welch) compression allows you to save maximum image details in exchange for a significantly increased file size.|\n"},"TiffLossyCompressionOptions":{"title":"TiffLossyCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossy"],"type":"string","description":"Must have value `\"lossy\"`"},"quality":{"title":"Quality","maximum":100,"minimum":1,"type":"integer","default":75}},"additionalProperties":false},"TiffLosslessCompressionOptions":{"title":"TiffLosslessCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossless"],"type":"string","description":"Must have value `\"lossless\"`"}},"additionalProperties":false},"MetadataOptions":{"title":"image color space options","type":"object","properties":{"dpi":{"title":"DPI","type":"integer","description":"Dots per inch."},"color_space":{"title":"Color Space","anyOf":[{"$ref":"#/components/schemas/ColorSpaceEnum"},{"$ref":"#/components/schemas/RGBColorSpaceOptions"},{"$ref":"#/components/schemas/CMYKColorSpaceOptions"}],"description":"Specifies desirable color space of the output image. By default, preserves the color space of the original image."}},"additionalProperties":false},"ColorSpaceEnum":{"title":"Type of color space","enum":["RGB","CMYK"],"type":"string","description":"Selects the type of color space: \n\n| Value | Description |\n| --- | --- |\n| `\"RGB\"` | Is the color space for digital images. Use the RGB color mode if your image is supposed to be displayed on any kind of screen.|\n| `\"CMYK\"` | Is the color space for printed materials. Use CMYK for any image that will be physically printed, not viewed on a screen.|\n"},"RGBColorSpaceOptions":{"title":"RGBColorSpaceOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["RGB"],"type":"string"}},"additionalProperties":false},"CMYKColorSpaceOptions":{"title":"CMYKColorSpaceOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["CMYK"],"type":"string"},"color_profile":{"allOf":[{"$ref":"#/components/schemas/CMYKColorProfileEnum"}],"description":"Specifies color profile that will be used for color space. \n\nSelects the type of color space profile: \n\n| Value | Description | Paper | Max. total ink (TAC) | Characterisation data | \n| --- | --- | --- | --- | --- |\n| `\"ISO_Coated\"` | (Coated FOGRA39, ISO 12647-2:2004) Is used by default. Standard for glossy and matte coated paper. | Grades 1 and 2, gloss and matte coated. | 330% | FOGRA39 |\n| `\"ISO_Uncoated\"` | (Uncoated FOGRA29, ISO 12647-2:2004) Standard for uncoated white natural paper. | Grade 4, uncoated white offset. | 300% | FOGRA29 |\n| `\"USWeb_Coated\"` | (SWOP2006_Coated3v2) Standard for glossy and matte coated paper in the United States. | Grades 1, 2 and 3 gloss coated, matte coated and uncoated paper. | 300% | CGATS TR003 |\n| `\"USWeb_Uncoated\"` | (GRACoL 2013 Uncoated) Standard for uncoated white natural paper in the United States. | Grade 4, uncoated white offset. | 260% |  CGATS21-2-CRPC3 |\n","default":"USWeb_Coated"}},"additionalProperties":false},"CMYKColorProfileEnum":{"title":"Type of color space","enum":["ISO_Coated","ISO_Uncoated","USWeb_Coated","USWeb_Uncoated"],"type":"string","description":"Selects the type of color space profile: \n\n| Value | Description | Paper | Max. total ink (TAC) | Characterisation data | \n| --- | --- | --- | --- | --- |\n| `\"ISO_Coated\"` | (Coated FOGRA39, ISO 12647-2:2004) Is used by default. Standard for glossy and matte coated paper. | Grades 1 and 2, gloss and matte coated. | 330% | FOGRA39 |\n| `\"ISO_Uncoated\"` | (Uncoated FOGRA29, ISO 12647-2:2004) Standard for uncoated white natural paper. | Grade 4, uncoated white offset. | 300% | FOGRA29 |\n| `\"USWeb_Coated\"` | (SWOP2006_Coated3v2) Standard for glossy and matte coated paper in the United States. | Grades 1, 2 and 3 gloss coated, matte coated and uncoated paper. | 300% | CGATS TR003 |\n| `\"USWeb_Uncoated\"` | (GRACoL 2013 Uncoated) Standard for uncoated white natural paper in the United States. | Grade 4, uncoated white offset. | 260% |  CGATS21-2-CRPC3 |\n"},"Response_AsyncAcceptedResponse_":{"title":"Response[AsyncAcceptedResponse]","type":"object","properties":{"data":{"$ref":"#/components/schemas/AsyncAcceptedResponse"}},"description":"Wrapper for responses"},"AsyncAcceptedResponse":{"title":"AsyncAcceptedResponse","required":["id","status","created_at","request"],"type":"object","properties":{"id":{"title":"Id","type":"integer"},"status":{"$ref":"#/components/schemas/APIV1Status"},"result_url":{"title":"Result Url","maxLength":65536,"minLength":1,"type":"string","format":"uri"},"created_at":{"title":"Created At","type":"string","format":"date-time"},"request":{"title":"Request","anyOf":[{"$ref":"#/components/schemas/BatchEditRequest"},{"$ref":"#/components/schemas/AsyncEditRequest"},{"type":"object"}]},"errors":{"title":"Errors","type":"array","items":{"$ref":"#/components/schemas/BatchPipelineError"},"default":[]},"result":{"title":"Result","allOf":[{"$ref":"#/components/schemas/AsyncPipelineResultItem"}],"default":{}}}},"APIV1Status":{"title":"APIV1Status","enum":["ACCEPTED","WAITING","PROCESSING","DONE","ERROR","CANCELLED","PAUSED"],"type":"string","description":"An enumeration."},"BatchEditRequest":{"title":"BatchEditRequest","required":["input","operations"],"type":"object","properties":{"input":{"title":"Input folder URL or list of image URLs","anyOf":[{"$ref":"#/components/schemas/BatchEditInputOptions"},{"type":"string","minLength":1,"maxLength":4096,"format":"uri"},{"type":"array","items":{"type":"string","minLength":1,"maxLength":4096,"format":"uri"},"minItems":1}],"description":"URL of the input file or folder. Should be from 1 to 512 characters. Must be accessible by our system."},"operations":{"title":"Operations","allOf":[{"$ref":"#/components/schemas/ImageOperations"}],"description":"Customize the editing workflow so that the output images meet your requirements."},"output":{"title":"Output folder URL","anyOf":[{"$ref":"#/components/schemas/ImageOutputOptions"},{"type":"string","minLength":1,"maxLength":4096,"format":"uri"}],"description":"URL of the output folder. If `output` is not defined, we store the output image on our bucket and return the temporary URL. The name of the output file remains the same as the input file. Images are stored for one day.","default":{"format":"jpeg"}}},"additionalProperties":false},"BatchEditInputOptions":{"title":"image input options","required":["source"],"type":"object","properties":{"source":{"title":"Input folder URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the input file or folder. Should be from 1 to 512 characters. Must be accessible by our system.","format":"uri"},"recursive":{"title":"Recursive","type":"boolean","description":"If `true`, recursively processes all images in subfolders as well, works only if source is folder. ","default":false}},"additionalProperties":false},"BatchPipelineError":{"title":"BatchPipelineError","required":["error","created_at"],"type":"object","properties":{"error":{"title":"Error","type":"string"},"created_at":{"title":"Created At","type":"string"},"input_object":{"$ref":"#/components/schemas/PipelineInputObjectInError"}}},"PipelineInputObjectInError":{"title":"PipelineInputObjectInError","required":["ext","mps","mime","format","width","height"],"type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension. Can have values: `\"jpg\"`, `\"png\"`, `\"avif\"`"},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as ‘media type’)"},"format":{"title":"Format","type":"string","description":"File format. Can have values: `\"jpeg\"`, `\"png\"`, `\"avif\"`"},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"}}},"AsyncPipelineResultItem":{"title":"AsyncPipelineResultItem","required":["input_object","output_object"],"type":"object","properties":{"input_object":{"$ref":"#/components/schemas/PipelineInputObject"},"output_object":{"$ref":"#/components/schemas/PipelineOutputObject"}}},"PipelineInputObject":{"title":"PipelineInputObject","required":["ext","mps","mime","format","width","height"],"type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension. Can have values: `\"jpg\"`, `\"png\"`, `\"avif\"`"},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as ‘media type’)"},"format":{"title":"Format","type":"string","description":"File format. Can have values: `\"jpeg\"`, `\"png\"`, `\"avif\"`"},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"}}},"PipelineOutputObject":{"title":"PipelineOutputObject","required":["ext","mps","mime","format","width","height"],"type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension. Can have values: `\"jpg\"`, `\"png\"`, `\"avif\"`"},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as ‘media type’)"},"format":{"title":"Format","type":"string","description":"File format. Can have values: `\"jpeg\"`, `\"png\"`, `\"avif\"`"},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"},"tmp_url":{"title":"Tmp Url","type":"string","description":"Temporal URL of a processed image"},"object_key":{"title":"Object Key","type":"string","description":"Path to a processed image in a bucket"},"object_bucket":{"title":"Object Bucket","type":"string","description":"Bucket name"},"object_uri":{"title":"Object Uri","type":"string","description":"URI of a processed image in a bucket"},"claid_storage_uri":{"title":"Claid Storage Uri","type":"string","description":"URI of a processed image in a storage"}}},"HttpErrorDetails":{"title":"HttpErrorDetails","required":["error_code","error_type","error_message"],"type":"object","properties":{"error_code":{"title":"Error Code","type":"string"},"error_type":{"$ref":"#/components/schemas/ErrorType"},"error_message":{"title":"Error Message","type":"string"},"error_details":{"title":"Error Details","type":"object","default":{}}}},"ErrorType":{"title":"ErrorType","enum":["auth","dlvr","general","le","survey","storage","image","user_settings","user","validation","analytics","scene","billing","web","runtime_settings","animation","custom_models"],"type":"string","description":"An enumeration."}}},"paths":{"/v1/image/edit/async":{"post":{"tags":["Image"],"summary":"Async Image Edit","description":"Specifies: \n- what image will be processed (`input`)\n- how it will be processed (`operations`)\n- where it will be stored (`output`)","operationId":"async_image_edit_v1_image_edit_async_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AsyncEditRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response_AsyncAcceptedResponse_"}}}},"401":{"description":"Authorization is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"402":{"description":"No API calls left.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"403":{"description":"Not enough permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"422":{"description":"Unprocessable Entity.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}}}}}}}
```

#### **Request**

{% tabs %}
{% tab title="HTTP" %}

```http
POST /v1/image/edit/async HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
Content-Type: application/json

{
  "input": "https://picsum.photos/200.jpg",
  "operations": {
    "resizing": {
      "width": 1000
    },
    "background": {
      "remove": false
    }
  }
}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl -X POST --location "https://api.claid.ai/v1/image/edit/async" --http1.1 \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}" \
    -H "Content-Type: application/json" \
    -d "{
          \"input\": \"https://picsum.photos/200.jpg\",
          \"operations\": {
            \"resizing\": {
              \"width\": 1000
            },
            \"background\": {
              \"remove\": false
            }
          }
        }"
```

{% endtab %}
{% endtabs %}

#### **Read a response**

Once you have made the request to <mark style="color:purple;">`https://api.claid.ai/v1/image/edit/async`</mark> you will get a response with information about request status and some other details (listed below).

Request information shown in the response:

<table><thead><tr><th width="154">Parameter</th><th width="109.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>integer</td><td>Task ID.</td></tr><tr><td>status</td><td>string</td><td>Request processing status. For a valid request can only have one value: <mark style="color:purple;"><code>ACCEPTED</code></mark>.</td></tr><tr><td>result_url</td><td>string</td><td>URL of GET endpoint that can be used to get the result manually and get request status while it is still in process.</td></tr><tr><td>created_at</td><td>string</td><td>Exact time when the processing was requested.</td></tr><tr><td>request</td><td>object</td><td>The body of the request that was used for processing.</td></tr></tbody></table>

#### **Response body**

```json
{
  "data": {
    "id": 1,
    "status": "ACCEPTED",
    "result_url": "https://api.claid.ai/v1/image/edit/async/1",
    "created_at": "2023-03-13T11:37:09.160554+00:00",
    "request": {
      "input": "https://picsum.photos/200.jpg",
      "operations": {
        "resizing": {
            "width": 1000
        },
        "background": {
            "remove": false
        }
      }
    }
  }
}
```

See the [Request Headers](/image-editing-api/api-reference#request-headers) and [Response Headers](/image-editing-api/api-reference#response-headers) to learn about headers.

### Webhook notification

Webhook notifications are especially useful if you want to automate workflows, monitor request statuses, or trigger actions when an image generation job completes — either successfully or with an error.

See [Read a response](/image-editing-api/async-api-reference#read-a-response-1) to learn about webhook data.

#### How to Set Up Webhook notifications

Go to your [Integrations -> Webhook Settings](https://claid.ai/account/webhook) at [**claid.ai**](https://claid.ai/) and configure your webhook preferences:

1. **URL**\
   Provide the endpoint where you want to receive notifications (e.g., `https://yourdomain.com/webhooks/claid`).
2. **Subscribed events**\
   Enable types of events you’d like to receive:
   * **Success pipelines** — when a request completes successfully
   * **Failed pipelines** — when a request fails
3. Optional: **Set new secret** to enable signature verification\
   For extra security, you can enable **HMAC-SHA256 Webhook Signature Verification** by entering a **shared secret**. This allows you to verify that incoming requests were genuinely sent by us.

{% hint style="info" %}
Remember to store the secret **securely** on your server.
{% endhint %}

### Webhook Signature Verification (Optional but Recommended)

If you enable signature verification, each webhook we send will include a signature header:

```
X-Claid-Hmac-SHA256: <hmac-sha256-signature>
```

This header contains an HMAC hash computed from the request payload using your shared secret. You can use this hash to verify the authenticity and integrity of the request.

To verify the webhook:

1. Read the raw (not parsed) body of the incoming POST request as a string.
2. Compute the HMAC SHA-256 digest using:
   * The raw request body as the "message"
   * The shared secret as the "key"
3. Compare your computed digest to the value in the `X-Claid-Hmac-SHA256` header.

If the values match, the webhook is valid and unmodified.

{% tabs %}
{% tab title="Python example" %}
{% code overflow="wrap" %}

```python
import hashlib
import hmac
def verify_signature(payload_body, secret_token, signature_header):
    if not signature_header:
        raise HTTPException(status_code=403, detail="x-hub-signature-256 header is missing!")
    hash_object = hmac.new(secret_token.encode('utf-8'), msg=payload_body, digestmod=hashlib.sha256)
    expected_signature = "sha256=" + hash_object.hexdigest()
    if not hmac.compare_digest(expected_signature, signature_header):
        raise HTTPException(status_code=403, detail="Request signatures didn't match!")
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript example" %}

```javascript
let encoder = new TextEncoder();

async function verifySignature(secret, header, payload) {
    let parts = header.split("=");
    let sigHex = parts[1];

    let algorithm = { name: "HMAC", hash: { name: 'SHA-256' } };

    let keyBytes = encoder.encode(secret);
    let extractable = false;
    let key = await crypto.subtle.importKey(
        "raw",
        keyBytes,
        algorithm,
        extractable,
        [ "sign", "verify" ],
    );

    let sigBytes = hexToBytes(sigHex);
    let dataBytes = encoder.encode(payload);
    let equal = await crypto.subtle.verify(
        algorithm.name,
        key,
        sigBytes,
        dataBytes,
    );

    return equal;
}

function hexToBytes(hex) {
    let len = hex.length / 2;
    let bytes = new Uint8Array(len);

    let index = 0;
    for (let i = 0; i < hex.length; i += 2) {
        let c = hex.slice(i, i + 2);
        let b = parseInt(c, 16);
        bytes[index] = b;
        index += 1;
    }

    return bytes;
}
```

{% endtab %}

{% tab title="TypeScript example" %}

```typescript
import { Webhooks } from "@octokit/webhooks";

const webhooks = new Webhooks({
  secret: process.env.WEBHOOK_SECRET,
});

const handleWebhook = async (req, res) => {
  const signature = req.headers["x-claid-hmac-sha256"];
  const body = await req.text();

  if (!(await webhooks.verify(body, signature))) {
    res.status(401).send("Unauthorized");
    return;
  }
  // The rest of your logic here
};
```

{% endtab %}

{% tab title="Ruby example" %}
{% code overflow="wrap" %}

```ruby
def verify_signature(payload_body)
  signature = 'sha256=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), ENV['SECRET_TOKEN'], payload_body)
  return halt 500, "Signatures didn't match!" unless Rack::Utils.secure_compare(signature, request.env['X_CLAID-HMAC-SHA256'])
end

```

{% endcode %}
{% endtab %}
{% endtabs %}

#### Delivery Attempts and Timeouts

We attempt to deliver each webhook notification **up to 4 times** if necessary:

| Attempt       | Delay from previous attempt |
| ------------- | --------------------------- |
| 1st (initial) | Immediately                 |
| 2nd           | After 3 seconds             |
| 3rd           | After 6 seconds             |
| 4th (final)   | After 12 seconds            |

{% hint style="danger" %}
Each webhook delivery attempt has a **30-second timeout**.&#x20;

If your server doesn’t respond within 30 seconds or responds with a `5xx` error, we’ll retry according to the schedule above.
{% endhint %}

### Result of request processing contract

To get image editing result, you need to know the ID of the processing request. Or you can take a ready-to-use link from the <mark style="color:purple;">`result_url`</mark> property of the response body described above.

## GET /v1/image/edit/async/{task\_id}

> Async Image Edit Result

```json
{"openapi":"3.1.0","info":{"title":"Claid REST API","version":"v1"},"tags":[{"name":"Image","description":"Encompasses operations with images."}],"security":[{"OAuth2PasswordBearer":["image_editing"]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}},"description":"To work with the Claid API, send requests over HTTPS and authenticate using the `Authorization` header in the following format:`Authorization: Bearer <YOUR_API_KEY>`. You do not need to provide a password.\n\nTo get your API key, [sign in to your Claid account](https://claid.ai/login) and click ***Create API key*** button from the ***Overview*** or ***API keys*** pages.\n\nClaid API’s base URL is `https://api.claid.ai/v1/`. All available endpoints are listed in the [Storage](#tag/Storage) and [Image](#tag/Image) sections. \n\n## Bearer\n\nThis API uses OAuth 2.0 [bearer token](https://datatracker.ietf.org/doc/html/rfc6750) (API key) to authorize requests."}},"schemas":{"Response_AsyncResultResponse_":{"title":"Response[AsyncResultResponse]","type":"object","properties":{"data":{"$ref":"#/components/schemas/AsyncResultResponse"}},"description":"Wrapper for responses"},"AsyncResultResponse":{"title":"AsyncResultResponse","required":["id","status","created_at","request"],"type":"object","properties":{"id":{"title":"Id","type":"integer"},"status":{"$ref":"#/components/schemas/APIV1Status"},"result_url":{"title":"Result Url","maxLength":65536,"minLength":1,"type":"string","format":"uri"},"created_at":{"title":"Created At","type":"string","format":"date-time"},"request":{"title":"Request","anyOf":[{"$ref":"#/components/schemas/BatchEditRequest"},{"$ref":"#/components/schemas/AsyncEditRequest"},{"type":"object"}]},"errors":{"title":"Errors","type":"array","items":{"$ref":"#/components/schemas/BatchPipelineError"},"default":[]},"result":{"title":"Result","allOf":[{"$ref":"#/components/schemas/AsyncPipelineResultItem"}],"default":{}}}},"APIV1Status":{"title":"APIV1Status","enum":["ACCEPTED","WAITING","PROCESSING","DONE","ERROR","CANCELLED","PAUSED"],"type":"string","description":"An enumeration."},"BatchEditRequest":{"title":"BatchEditRequest","required":["input","operations"],"type":"object","properties":{"input":{"title":"Input folder URL or list of image URLs","anyOf":[{"$ref":"#/components/schemas/BatchEditInputOptions"},{"type":"string","minLength":1,"maxLength":4096,"format":"uri"},{"type":"array","items":{"type":"string","minLength":1,"maxLength":4096,"format":"uri"},"minItems":1}],"description":"URL of the input file or folder. Should be from 1 to 512 characters. Must be accessible by our system."},"operations":{"title":"Operations","allOf":[{"$ref":"#/components/schemas/ImageOperations"}],"description":"Customize the editing workflow so that the output images meet your requirements."},"output":{"title":"Output folder URL","anyOf":[{"$ref":"#/components/schemas/ImageOutputOptions"},{"type":"string","minLength":1,"maxLength":4096,"format":"uri"}],"description":"URL of the output folder. If `output` is not defined, we store the output image on our bucket and return the temporary URL. The name of the output file remains the same as the input file. Images are stored for one day.","default":{"format":"jpeg"}}},"additionalProperties":false},"BatchEditInputOptions":{"title":"image input options","required":["source"],"type":"object","properties":{"source":{"title":"Input folder URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the input file or folder. Should be from 1 to 512 characters. Must be accessible by our system.","format":"uri"},"recursive":{"title":"Recursive","type":"boolean","description":"If `true`, recursively processes all images in subfolders as well, works only if source is folder. ","default":false}},"additionalProperties":false},"ImageOperations":{"title":"image operations options","type":"object","properties":{"restorations":{"title":"Restorations","allOf":[{"$ref":"#/components/schemas/RestorationsOptions"}],"description":"Restore lost details and decompress image with a wide range of AI-powered neural networks. By default, both operations is turned off.","default":{"polish":false}},"adjustments":{"title":"Adjustments","allOf":[{"$ref":"#/components/schemas/AdjustmentsOptions"}],"description":"Change image histogram: set brightness, saturation, dynamic range, balance out colors and lighting. By default, no adjustments are made."},"background":{"title":"Background","allOf":[{"$ref":"#/components/schemas/BackgroundOptions"}],"description":"Remove the background and set a solid color. By default, no changes are made.","default":{"remove":false,"blur":false,"use_original_alpha":false}},"resizing":{"title":"Resizing","allOf":[{"$ref":"#/components/schemas/ResizingOptions"}],"description":"Set the final image size. Crop or fit image in canvas. By default, API will perform all calculations respecting the original image aspect ratio.","default":{"width":"auto","height":"auto","fit":"crop"}},"padding":{"title":"Padding","type":"string","description":"Add a space around the object equally to each of 4 sides, or for height&width separately. Can not be bigger than half of image width/height. By default, padding is not applied."},"privacy":{"title":"Privacy","allOf":[{"$ref":"#/components/schemas/PrivacyOptions"}],"description":"Manage sensitive information on the image.","default":{"blur_car_plate":false,"identity_crop":false}},"generative":{"title":"Generative","allOf":[{"$ref":"#/components/schemas/GenerativeOptions"}],"description":"Transform the image using generative models."}},"additionalProperties":false},"RestorationsOptions":{"title":"restorations options","type":"object","properties":{"decompress":{"allOf":[{"$ref":"#/components/schemas/DecompressEnum"}],"description":"The decompress operation allows you to remove distortion and artifacts caused by image compression methods. It can be used in conjunction with the upscale operation to prepare an image for upscaling.\n\n| Value | Description |\n| --- | --- |\n| null | DEFAULT. No restoration applied.|\n| `\"moderate\"` | Removes JPEG artifacts from the image.|\n| `\"strong\"` | Removes JPEG artifacts more aggressively than \"moderate\".|\n| `\"auto\"` | Automatically detects and remove JPEG artifacts if needed.|"},"upscale":{"title":"Upscale","anyOf":[{"$ref":"#/components/schemas/UpscaleEnum"},{"$ref":"#/components/schemas/UpscalePhotoOptions"}],"description":"The upscale operation allows you to improve the overall quality of an image by rendering out new pixels. The upscale operation works along with resizing through numeric or percentage values for upscaling."},"polish":{"title":"Polish image","type":"boolean","description":"If `true`, polishes an image","default":false}},"additionalProperties":false},"DecompressEnum":{"title":"Decompress","enum":["moderate","strong","auto"],"type":"string","description":"Selects the restoration mode.\n\n| Value | Description |\n| --- | --- |\n| `null` | DEFAULT. No restoration applied.|\n| `\"moderate\"` | Removes JPEG artifacts from the image.|\n| `\"strong\"` | Removes JPEG artifacts more aggressively than `\"moderate\"`.|\n| `\"auto\"` | Automatically detects and remove JPEG artifacts if needed.|"},"UpscaleEnum":{"title":"Upscale","enum":["smart_enhance","smart_resize","faces","digital_art","photo"],"type":"string","description":"Upscales the image with specified type of image upscaling neural network. \n\n| Value | Description |\n| --- | --- |\n| `null` | DEFAULT. Interpolation. Used when output image resolution is smaller than the input resolution.|\n| `\"smart_enhance\"` | Used for small low quality product, real estate and food images.|\n| `\"smart_resize\"` | Used for high quality images.|\n| `\"faces\"` | Used for images containing persons.|\n| `\"digital_art\"` | Used for drawings, illustrations, paintings, cartoons, anime, etc.|\n| `\"photo\"` | Used for images taken by mobile devices or digital camera of people, nature, architecture, etc.|"},"UpscalePhotoOptions":{"title":"photo upscale options","required":["type","version"],"type":"object","properties":{"type":{"title":"Type","enum":["photo"],"type":"string"},"version":{"title":"Version","allOf":[{"$ref":"#/components/schemas/PhotoVersionEnum"}],"description":"Upscales the image with specified version of photo upscaling neural network. \n\n| Value | Description |\n| --- | --- |\n| `\"1\"` | Is deprecated and not recommended.|\n| `\"2\"` | Used for restoring image quality that is taken by mobile devices or digital camera.|\n| `\"3\"` | Used for restoring image quality, a bit more aggressively than \"2\".|\n"}},"additionalProperties":false},"PhotoVersionEnum":{"title":"Version","enum":["1","2","3"],"type":"string","description":"Upscales the image with specified version of photo upscaling neural network. \n\n| Value | Description |\n| --- | --- |\n| `\"1\"` | Is deprecated and not recommended.|\n| `\"2\"` | Used for restoring image quality that is taken by mobile devices or digital camera.|\n| `\"3\"` | Used for restoring image quality, a bit more aggressively than `\"2\"`.|\n"},"AdjustmentsOptions":{"title":"adjustments options","type":"object","properties":{"hdr":{"title":"Hdr","anyOf":[{"type":"integer","description":"HDR effect intensity.","minimum":0,"maximum":100},{"$ref":"#/components/schemas/HdrOptions"}],"description":"Balances out colors and lighting. Allows to turn on `stitching` for stitched 360 photos.","default":0},"exposure":{"title":"Exposure","maximum":100,"minimum":-100,"type":"integer","description":"Decrease (negative integer) or increase (positive integer) exposure.","default":0},"saturation":{"title":"Saturation","maximum":100,"minimum":-100,"type":"integer","description":"Decrease (negative integer) or increase (positive integer) saturation.","default":0},"contrast":{"title":"Contrast","maximum":100,"minimum":-100,"type":"integer","description":"Decrease (negative integer) or increase (positive integer) contrast.","default":0},"sharpness":{"title":"Sharpness","maximum":100,"minimum":0,"type":"integer","description":"Increase sharpness.","default":0}},"additionalProperties":false},"HdrOptions":{"title":"hdr options","type":"object","properties":{"intensity":{"title":"Intensity","maximum":100,"minimum":0,"type":"integer","description":"HDR effect intensity.","default":100},"stitching":{"title":"Stitching","type":"boolean","description":"Set to true for seamless HDR effect on stitched 360 photos.","default":false}},"additionalProperties":false},"BackgroundOptions":{"title":"background options","type":"object","properties":{"remove":{"title":"Remove","anyOf":[{"type":"boolean","title":"Remove background","description":"If `true`, removes background"},{"$ref":"#/components/schemas/BackgroundRemovalOptions"}],"description":"Allows to turn on and configure image background removal.","default":false},"color":{"title":"Color","anyOf":[{"type":"string","title":"Color","description":"Color as a hexadecimal. Paints the background of the image. Examples: `\"#ffffff\"`, `\"#000000\"`."},{"$ref":"#/components/schemas/BackgroundEnum"}],"description":"Color as a hexadecimal. Sets a background color. Defaults to the `#ffffff` (white) color, or `transparent` if an input image has transparency."},"blur":{"title":"Blur","anyOf":[{"type":"boolean","title":"Blur background","description":"If `true`, blurs background. Defaults to `false`."},{"$ref":"#/components/schemas/BackgroundBlurOptions"}],"description":"Allows to turn on and configure image background blurring.","default":false}},"additionalProperties":false},"BackgroundRemovalOptions":{"title":"background removal options","type":"object","properties":{"clipping":{"title":"Clip to object","type":"boolean","description":"If `true` image will be cropped up to the edges of the foreground object.","default":false},"selective":{"title":"Selective","allOf":[{"$ref":"#/components/schemas/BackgroundSelectiveOptions"}],"description":"Allows to select an object to keep on the image and remove the background around it."},"category":{"title":"Category","allOf":[{"$ref":"#/components/schemas/BackgroundCategoryEnum"}],"description":"The background removal category hints the type of objects on the image."}},"additionalProperties":false},"BackgroundSelectiveOptions":{"title":"BackgroundSelectiveOptions","required":["object_to_keep"],"type":"object","properties":{"object_to_keep":{"title":"Object To Keep","maxLength":128,"minLength":3,"type":"string","description":"Specify an object to keep on the image."}},"additionalProperties":false},"BackgroundCategoryEnum":{"title":"Category of objects","enum":["general","cars","products"],"type":"string","description":"Selects the category of objects on the image: \n\n| Value | Description |\n| --- | --- |\n| `\"general\"` | The category that is suitable for all objects and is used by default.|\n| `\"cars\"` | The advanced category that will have better results for removing the background with cars on foreground.|\n| `\"products\"` | The advanced category that will have better results for background removal of various types of products and groceries.|\n"},"BackgroundEnum":{"title":"Transparent","enum":["transparent"],"type":"string","description":"Makes the background of the image transparent, only works for `\"png\"` output format."},"BackgroundBlurOptions":{"title":"background blur options","type":"object","properties":{"selective":{"title":"Selective","allOf":[{"$ref":"#/components/schemas/BackgroundSelectiveOptions"}],"description":"Allows to select an object to keep on the image and blur the background around it."},"category":{"allOf":[{"$ref":"#/components/schemas/BackgroundCategoryEnum"}],"description":"Selects the category of objects on the image: \n\n| Value | Description |\n| --- | --- |\n| `\"general\"` | The category that is suitable for all objects and is used by default.|\n| `\"cars\"` | The advanced category that will have better results for removing the background with cars on foreground.|\n| `\"products\"` | The advanced category that will have better results for background removal of various types of products and groceries.|\n"},"type":{"allOf":[{"$ref":"#/components/schemas/BackgroundBlurTypeEnum"}],"description":"Selects the type of blur to be applied to the background: \n\n| Value | Description |\n| --- | --- |\n| `\"regular\"` | Gaussian blur. Creates an effect of laying a translucent material like vellum on top of the image background, is used by default.|\n| `\"lens\"` | Lens blur with linear focus. Mimics the blur applied to a photo when a wide aperture is used to achieve a narrow depth of field, so that the foreground objects stands out.|\n","default":"regular"},"level":{"allOf":[{"$ref":"#/components/schemas/BackgroundBlurLevelEnum"}],"description":"Selects the level of blur strength to be applied to the background: \n\n| Value | Description |\n| --- | --- |\n| `\"low\"` | Low blur strength.|\n| `\"medium\"` | Medium blur strength, is used by default.|\n| `\"high\"` | High blur strength.|\n","default":"medium"}},"additionalProperties":false},"BackgroundBlurTypeEnum":{"title":"Type of background blur","enum":["regular","lens"],"type":"string","description":"Selects the type of blur: \n\n| Value | Description |\n| --- | --- |\n| `\"regular\"` | Gaussian blur. Creates an effect of laying a translucent material like vellum on top of the image background.|\n| `\"lens\"` | Lens blur with linear focus. Mimics the blur applied to a photo when a wide aperture is used to achieve a narrow depth of field, so that the foreground objects stands out.|\n"},"BackgroundBlurLevelEnum":{"title":"Background blur strength level","enum":["low","medium","high"],"type":"string","description":"Selects the level of blur strength: \n\n| Value | Description |\n| --- | --- |\n| `\"low\"` | Low blur strength.|\n| `\"medium\"` | Medium blur strength.|\n| `\"high\"` | High blur strength.|\n"},"ResizingOptions":{"title":"resizing options","type":"object","properties":{"width":{"title":"Width","anyOf":[{"type":"integer","title":"Pixels","description":"Width in pixels."},{"$ref":"#/components/schemas/SizesEnum"},{"type":"string","title":"Percentage","description":"Percentage as a string. E.g. `\"200%\"` means that the `width` will double relative to the input image.\nIf you express `width` as a percentage, `height` must have the same value or set to `\"auto\"`. Examples: `\"60%\"`, `\"40%\"`"}],"description":"Width of output image. Should be of the same type as `height`, or `\"auto\"`.","default":"auto"},"height":{"title":"Height","anyOf":[{"type":"integer","title":"Pixels","description":"Height in pixels."},{"$ref":"#/components/schemas/SizesEnum"},{"type":"string","title":"Percentage","description":"Percentage as a string. E.g. `\"200%\"` means that the `height` will double relatively to the input image.\nIf you express `height` as a percentage, `width` must have the same value or set to `\"auto\"`. Examples: `\"60%\"`, `\"40%\"`"}],"description":"Height of output image. Should be of the same type as `width`, or `\"auto\"`.","default":"auto"},"fit":{"title":"Fit","anyOf":[{"$ref":"#/components/schemas/FitEnum"},{"$ref":"#/components/schemas/CropOptions"},{"$ref":"#/components/schemas/CoverOptions"},{"$ref":"#/components/schemas/BoundsOptions"},{"$ref":"#/components/schemas/CanvasOptions"},{"$ref":"#/components/schemas/OutpaintOptions"}],"description":"The fit parameter controls how the image will be constrained within the provided size, relative to the `width` and `height`. By default, `fit` mode is `\"crop\"`.","default":"crop"}},"additionalProperties":false},"SizesEnum":{"title":"Auto","enum":["auto"],"type":"string","description":"`width` will have the same value as `height`, if `height` is defined in pixels or percentages; and vice versa."},"FitEnum":{"title":"Fit","enum":["crop","cover","bounds","canvas","outpaint"],"type":"string","description":"Selects the fit mode: \n(Note: All fit modes preserve the original image aspect ratio. Meaning, the image can be cropped but it won't be stretched or squeezed.)\n\n| Value | Description |\n| --- | --- |\n| `\"crop\"` | Scales an image until it fully covers the specified dimensions, the rest gets cropped. Fit `crop` support `\"center\"` and `\"smart\"` modes for cropping.|\n| `\"cover\"` | Resize the image to entirely cover the specified region, making one dimension larger if needed.|\n| `\"bounds\"` | Resize the image to fit entirely within the specified region, making one dimension smaller if needed. |\n| `\"canvas\"` | Input image will be placed on the canvas established by `width` and `height`. Extra space will be filled with the background `color`.|\n| `\"outpaint\"` | Extra space will be generated with the coherent background.|"},"CropOptions":{"title":"crop options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["crop"],"type":"string"},"crop":{"title":"Crop mode","allOf":[{"$ref":"#/components/schemas/FitCropEnum"}],"description":"Selects the crop mode: \n\n| Value | Description |\n| --- | --- |\n| `\"center\"` | Cropping relative to the center of the image.|\n| `\"smart\"` | Content aware image cropping.|\n","default":"center"}},"additionalProperties":false},"FitCropEnum":{"title":"Crop","enum":["center","smart"],"type":"string","description":"Selects the crop mode: \n\n| Value | Description |\n| --- | --- |\n| `\"center\"` | Cropping relative to the center of the image.|\n| `\"smart\"` | Content aware image cropping.|\n"},"CoverOptions":{"title":"cover options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["cover"],"type":"string"}},"additionalProperties":false},"BoundsOptions":{"title":"bounds options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["bounds"],"type":"string"}},"additionalProperties":false},"CanvasOptions":{"title":"canvas options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["canvas"],"type":"string"}},"additionalProperties":false},"OutpaintOptions":{"title":"outpaint options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["outpaint"],"type":"string"},"feathering":{"title":"Feathering","pattern":"^[1-9][0-9]+[%]$|^[0-9][%]$","type":"string","description":"Percentage in string format. Examples: `\"60%\"`, `\"200%\"`","default":"15%"},"outpaint_by":{"title":"Outpaint By","type":"string","description":"The amount of outpainting to be applied to the image. Should be a string with one or two values separated by space. Each value can be in pixels (e.g. `\"100px\"`) or in percentages (e.g. `\"20%\"`).\nIf two values are provided, the first value is for the width and the second value is for the height.\nIf only one value is provided, it will be applied to both width and height.\nIf not provided, the outpainting will be applied in one direction only based on `fit.width` and `fit.height`.\nExamples: `\"10%\"`, `\"5% 15%\"`, `\"5% 0%\"`, `\"1024px\"`, `\"1024px 512px\"`, `\"0px 1024px\"`."}},"additionalProperties":false},"PrivacyOptions":{"title":"PrivacyOptions","type":"object","properties":{"blur_car_plate":{"title":"Blur Car Plate","type":"boolean","description":"If `true`, blurs car plate.","default":false},"identity_crop":{"title":"Identity Crop","type":"boolean","description":"Removes a person's face from the image by cutting everything above the mouth.","default":false}},"additionalProperties":false},"GenerativeOptions":{"title":"generative transformations options","type":"object","properties":{"style_transfer":{"title":"Style Transfer","allOf":[{"$ref":"#/components/schemas/StyleTransferOptions"}],"description":"Apply style from a reference image."}},"additionalProperties":false},"StyleTransferOptions":{"title":"style transfer options","required":["style_reference_image"],"type":"object","properties":{"style_reference_image":{"title":"Style Reference Image","type":"string","description":"URL of the image to be used as a style reference."},"prompt":{"title":"Prompt","maxLength":1024,"minLength":3,"type":"string","description":"Text prompt to adjust the style transfer output."},"depth_strength":{"title":"Depth Strength","maximum":1,"minimum":0,"type":"number","description":"The denoising strength determines the degree of overall composition and shape preservation.","default":1},"denoising_strength":{"title":"Denoising Strength","maximum":1,"minimum":0,"type":"number","description":"The denoising strength determines the degree of color and texture modification.","default":0.75},"style_strength":{"title":"Style Strength","maximum":1,"minimum":0,"type":"number","description":"The style strength determines the degree of overall style intensity as taken from the reference.","default":0.75}},"additionalProperties":false},"ImageOutputOptions":{"title":"image output options","type":"object","properties":{"format":{"title":"Format","anyOf":[{"$ref":"#/components/schemas/FormatEnum"},{"$ref":"#/components/schemas/FormatJpegOptions"},{"$ref":"#/components/schemas/FormatPngOptions"},{"$ref":"#/components/schemas/FormatWebpOptions"},{"$ref":"#/components/schemas/FormatAvifOptions"},{"$ref":"#/components/schemas/FormatTiffOptions"}],"description":"Converts an image to one of the following formats: `\"jpeg\"`, `\"png\"`, `\"webp\"`, `\"avif\"`. Selecting *Jpeg Options* allows to specify quality.","default":"jpeg"},"destination":{"title":"Output URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the output image. If `output` is not defined, we store the output image on our bucket and return the temporary URL. The name of the output file remains the same as the input file. Images are stored for one day.","format":"uri"},"metadata":{"title":"Metadata","allOf":[{"$ref":"#/components/schemas/MetadataOptions"}],"description":"Defines characteristics of the output image, e.g. DPI."}},"additionalProperties":false},"FormatEnum":{"title":"Format","enum":["jpeg","png","webp","avif","tiff"],"type":"string","description":"Converts the image into specified format. Examples: `\"jpeg\"`, `\"png\"`."},"FormatJpegOptions":{"title":"jpeg options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["jpeg"],"type":"string","description":"Must have value `\"jpeg\"`"},"quality":{"title":"Quality","maximum":100,"minimum":1,"type":"integer","default":85},"progressive":{"title":"Progressive","type":"boolean","description":"Progressive JPEG loads in a browser in successive waves until a clear picture is formed. This improves image's loading speed.","default":true}},"additionalProperties":false},"FormatPngOptions":{"title":"png options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["png"],"type":"string","description":"Must have value `\"png\"`"},"compression":{"allOf":[{"$ref":"#/components/schemas/FormatCompressionLevelEnum"}],"description":"Specifies compression effort that will be applied during the PNG image encoding. Should have one of values: `\"fast\"`, `\"best\"`, or `\"optimal\"`. Defaults to `\"optimal\"`.","default":"optimal"}},"additionalProperties":false},"FormatCompressionLevelEnum":{"title":"Compression","enum":["fast","best","optimal"],"type":"string","description":"Indicates compression effort. \n\n| Value | Description |\n| --- | --- |\n| `\"fast\"` |  Used to apply minimum compression resulting in a bigger image size but less processing time.|\n| `\"best\"` | Used to apply maximum compression resulting in a smaller image size but more processing time.|\n| `\"optimal\"` | DEFAULT. Used to balance between compression effort and the processing time.|\n"},"FormatWebpOptions":{"title":"webp options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["webp"],"type":"string","description":"Must have value `\"webp\"`"},"compression":{"title":"Compression","anyOf":[{"$ref":"#/components/schemas/WebpCompressionEnum"},{"$ref":"#/components/schemas/WebpLossyCompressionOptions"},{"$ref":"#/components/schemas/WebpLosslessCompressionOptions"}],"description":"The WEBP codec supports both lossless and lossy modes of operation, so you can select the one that is appropriate for your goals. Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image. You can specify the amount of loss you are willing to accept. By default it's set to to 75. Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.","default":{"type":"lossy","quality":75}}},"additionalProperties":false},"WebpCompressionEnum":{"title":"WEBP Compression","enum":["lossy","lossless"],"type":"string","description":"Selects the WEBP compression type: \n\n| Value | Description |\n| --- | --- |\n| `\"lossy\"` | Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image.|\n| `\"lossless\"` | Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.|\n"},"WebpLossyCompressionOptions":{"title":"WebpLossyCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossy"],"type":"string","description":"Must have value `\"lossy\"`"},"quality":{"title":"Quality","maximum":100,"minimum":1,"type":"integer","default":75}},"additionalProperties":false},"WebpLosslessCompressionOptions":{"title":"WebpLosslessCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossless"],"type":"string","description":"Must have value `\"lossless\"`"}},"additionalProperties":false},"FormatAvifOptions":{"title":"avif options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["avif"],"type":"string","description":"Must have value `\"avif\"`"},"compression":{"title":"Compression","anyOf":[{"$ref":"#/components/schemas/AvifCompressionEnum"},{"$ref":"#/components/schemas/AvifLossyCompressionOptions"},{"$ref":"#/components/schemas/AvifLosslessCompressionOptions"}],"description":"The AVIF codec supports both lossless and lossy modes of operation, so you can select the one that is appropriate for your goals. Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image. You can specify the amount of loss you are willing to accept. Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.","default":{"type":"lossy","quality":50}}},"additionalProperties":false},"AvifCompressionEnum":{"title":"AVIF Compression","enum":["lossy","lossless"],"type":"string","description":"Selects the AVIF compression type: \n\n| Value | Description |\n| --- | --- |\n| `\"lossy\"` | Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image.|\n| `\"lossless\"` | Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.|\n"},"AvifLossyCompressionOptions":{"title":"AvifLossyCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossy"],"type":"string","description":"Must have value `\"lossy\"`"},"quality":{"title":"Quality","maximum":100,"minimum":1,"type":"integer","default":50}},"additionalProperties":false},"AvifLosslessCompressionOptions":{"title":"AvifLosslessCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossless"],"type":"string","description":"Must have value `\"lossless\"`"}},"additionalProperties":false},"FormatTiffOptions":{"title":"FormatTiffOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["tiff"],"type":"string","description":"Must have value `\"tiff\"`"},"compression":{"title":"Compression","anyOf":[{"$ref":"#/components/schemas/TiffCompressionEnum"},{"$ref":"#/components/schemas/TiffLossyCompressionOptions"},{"$ref":"#/components/schemas/TiffLosslessCompressionOptions"}],"description":"The TIFF codec supports both lossless and lossy modes of operation, so you can select the one that is appropriate for your goals. Lossy JPEG compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image. You can specify the amount of loss you are willing to accept. By default it's set to to 75. Lossless LZW (Lempel-Ziv-Welch) compression allows you to save maximum image details in exchange for a significantly increased file size.","default":{"type":"lossless"}}},"additionalProperties":false},"TiffCompressionEnum":{"title":"TIFF Compression","enum":["lossy","lossless"],"type":"string","description":"Selects the TIFF compression type: \n\n| Value | Description |\n| --- | --- |\n| `\"lossy\"` | Lossy JPEG compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image.|\n| `\"lossless\"` | Lossless LZW (Lempel-Ziv-Welch) compression allows you to save maximum image details in exchange for a significantly increased file size.|\n"},"TiffLossyCompressionOptions":{"title":"TiffLossyCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossy"],"type":"string","description":"Must have value `\"lossy\"`"},"quality":{"title":"Quality","maximum":100,"minimum":1,"type":"integer","default":75}},"additionalProperties":false},"TiffLosslessCompressionOptions":{"title":"TiffLosslessCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossless"],"type":"string","description":"Must have value `\"lossless\"`"}},"additionalProperties":false},"MetadataOptions":{"title":"image color space options","type":"object","properties":{"dpi":{"title":"DPI","type":"integer","description":"Dots per inch."},"color_space":{"title":"Color Space","anyOf":[{"$ref":"#/components/schemas/ColorSpaceEnum"},{"$ref":"#/components/schemas/RGBColorSpaceOptions"},{"$ref":"#/components/schemas/CMYKColorSpaceOptions"}],"description":"Specifies desirable color space of the output image. By default, preserves the color space of the original image."}},"additionalProperties":false},"ColorSpaceEnum":{"title":"Type of color space","enum":["RGB","CMYK"],"type":"string","description":"Selects the type of color space: \n\n| Value | Description |\n| --- | --- |\n| `\"RGB\"` | Is the color space for digital images. Use the RGB color mode if your image is supposed to be displayed on any kind of screen.|\n| `\"CMYK\"` | Is the color space for printed materials. Use CMYK for any image that will be physically printed, not viewed on a screen.|\n"},"RGBColorSpaceOptions":{"title":"RGBColorSpaceOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["RGB"],"type":"string"}},"additionalProperties":false},"CMYKColorSpaceOptions":{"title":"CMYKColorSpaceOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["CMYK"],"type":"string"},"color_profile":{"allOf":[{"$ref":"#/components/schemas/CMYKColorProfileEnum"}],"description":"Specifies color profile that will be used for color space. \n\nSelects the type of color space profile: \n\n| Value | Description | Paper | Max. total ink (TAC) | Characterisation data | \n| --- | --- | --- | --- | --- |\n| `\"ISO_Coated\"` | (Coated FOGRA39, ISO 12647-2:2004) Is used by default. Standard for glossy and matte coated paper. | Grades 1 and 2, gloss and matte coated. | 330% | FOGRA39 |\n| `\"ISO_Uncoated\"` | (Uncoated FOGRA29, ISO 12647-2:2004) Standard for uncoated white natural paper. | Grade 4, uncoated white offset. | 300% | FOGRA29 |\n| `\"USWeb_Coated\"` | (SWOP2006_Coated3v2) Standard for glossy and matte coated paper in the United States. | Grades 1, 2 and 3 gloss coated, matte coated and uncoated paper. | 300% | CGATS TR003 |\n| `\"USWeb_Uncoated\"` | (GRACoL 2013 Uncoated) Standard for uncoated white natural paper in the United States. | Grade 4, uncoated white offset. | 260% |  CGATS21-2-CRPC3 |\n","default":"USWeb_Coated"}},"additionalProperties":false},"CMYKColorProfileEnum":{"title":"Type of color space","enum":["ISO_Coated","ISO_Uncoated","USWeb_Coated","USWeb_Uncoated"],"type":"string","description":"Selects the type of color space profile: \n\n| Value | Description | Paper | Max. total ink (TAC) | Characterisation data | \n| --- | --- | --- | --- | --- |\n| `\"ISO_Coated\"` | (Coated FOGRA39, ISO 12647-2:2004) Is used by default. Standard for glossy and matte coated paper. | Grades 1 and 2, gloss and matte coated. | 330% | FOGRA39 |\n| `\"ISO_Uncoated\"` | (Uncoated FOGRA29, ISO 12647-2:2004) Standard for uncoated white natural paper. | Grade 4, uncoated white offset. | 300% | FOGRA29 |\n| `\"USWeb_Coated\"` | (SWOP2006_Coated3v2) Standard for glossy and matte coated paper in the United States. | Grades 1, 2 and 3 gloss coated, matte coated and uncoated paper. | 300% | CGATS TR003 |\n| `\"USWeb_Uncoated\"` | (GRACoL 2013 Uncoated) Standard for uncoated white natural paper in the United States. | Grade 4, uncoated white offset. | 260% |  CGATS21-2-CRPC3 |\n"},"AsyncEditRequest":{"title":"AsyncEditRequest","required":["input","operations"],"type":"object","properties":{"input":{"title":"Input URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the input image. Should be from 1 to 512 characters. Image must be accessible by our system.","format":"uri"},"operations":{"title":"Operations","allOf":[{"$ref":"#/components/schemas/ImageOperations"}],"description":"Customize the editing workflow so that the output images meet your requirements."},"output":{"title":"Output","anyOf":[{"$ref":"#/components/schemas/ImageOutputOptions"},{"type":"string","minLength":1,"maxLength":4096,"format":"uri"}],"description":"Customize the result output.","default":{"format":"jpeg"}}},"additionalProperties":false},"BatchPipelineError":{"title":"BatchPipelineError","required":["error","created_at"],"type":"object","properties":{"error":{"title":"Error","type":"string"},"created_at":{"title":"Created At","type":"string"},"input_object":{"$ref":"#/components/schemas/PipelineInputObjectInError"}}},"PipelineInputObjectInError":{"title":"PipelineInputObjectInError","required":["ext","mps","mime","format","width","height"],"type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension. Can have values: `\"jpg\"`, `\"png\"`, `\"avif\"`"},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as ‘media type’)"},"format":{"title":"Format","type":"string","description":"File format. Can have values: `\"jpeg\"`, `\"png\"`, `\"avif\"`"},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"}}},"AsyncPipelineResultItem":{"title":"AsyncPipelineResultItem","required":["input_object","output_object"],"type":"object","properties":{"input_object":{"$ref":"#/components/schemas/PipelineInputObject"},"output_object":{"$ref":"#/components/schemas/PipelineOutputObject"}}},"PipelineInputObject":{"title":"PipelineInputObject","required":["ext","mps","mime","format","width","height"],"type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension. Can have values: `\"jpg\"`, `\"png\"`, `\"avif\"`"},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as ‘media type’)"},"format":{"title":"Format","type":"string","description":"File format. Can have values: `\"jpeg\"`, `\"png\"`, `\"avif\"`"},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"}}},"PipelineOutputObject":{"title":"PipelineOutputObject","required":["ext","mps","mime","format","width","height"],"type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension. Can have values: `\"jpg\"`, `\"png\"`, `\"avif\"`"},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as ‘media type’)"},"format":{"title":"Format","type":"string","description":"File format. Can have values: `\"jpeg\"`, `\"png\"`, `\"avif\"`"},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"},"tmp_url":{"title":"Tmp Url","type":"string","description":"Temporal URL of a processed image"},"object_key":{"title":"Object Key","type":"string","description":"Path to a processed image in a bucket"},"object_bucket":{"title":"Object Bucket","type":"string","description":"Bucket name"},"object_uri":{"title":"Object Uri","type":"string","description":"URI of a processed image in a bucket"},"claid_storage_uri":{"title":"Claid Storage Uri","type":"string","description":"URI of a processed image in a storage"}}},"HttpErrorDetails":{"title":"HttpErrorDetails","required":["error_code","error_type","error_message"],"type":"object","properties":{"error_code":{"title":"Error Code","type":"string"},"error_type":{"$ref":"#/components/schemas/ErrorType"},"error_message":{"title":"Error Message","type":"string"},"error_details":{"title":"Error Details","type":"object","default":{}}}},"ErrorType":{"title":"ErrorType","enum":["auth","dlvr","general","le","survey","storage","image","user_settings","user","validation","analytics","scene","billing","web","runtime_settings","animation","custom_models"],"type":"string","description":"An enumeration."}}},"paths":{"/v1/image/edit/async/{task_id}":{"get":{"tags":["Image"],"summary":"Async Image Edit Result","operationId":"async_image_edit_result_v1_image_edit_async__task_id__get","parameters":[{"required":true,"schema":{"title":"Task Id","type":"integer"},"name":"task_id","in":"path"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response_AsyncResultResponse_"}}}},"401":{"description":"Authorization is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"403":{"description":"Not enough permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"404":{"description":"Batch image edit pipeline not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"422":{"description":"Unprocessable Entity.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}}}}}}}
```

#### **Request**

{% tabs %}
{% tab title="HTTP" %}

```http
GET /v1/image/edit/async/1 HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl -X GET --location "https://api.claid.ai/v1/image/edit/async/1" --http1.1 \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}"
```

{% endtab %}
{% endtabs %}

#### **Read a response**

Once you have made the request to <mark style="color:purple;">`https://api.claid.ai/v1/image/edit/async/<task_id>`</mark> you will get a response with information about the request, input and output images.

Image information shown in the response:

<table><thead><tr><th width="153">Parameter</th><th width="109.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>integer</td><td>Task ID.</td></tr><tr><td>status</td><td>string</td><td>Request processing status. Can have values: <mark style="color:purple;"><code>ACCEPTED</code></mark>, <mark style="color:purple;"><code>PROCESSING</code></mark>, <mark style="color:purple;"><code>ERROR</code></mark>, <mark style="color:purple;"><code>DONE</code></mark>.</td></tr><tr><td>created_at</td><td>string</td><td>Exact time when the processing was requested.</td></tr><tr><td>request</td><td>object</td><td>The body of the request that was used for processing.</td></tr><tr><td>errors</td><td>list </td><td>List of errors, if any are occurred during image processing (<mark style="color:purple;"><code>status</code></mark> will have <mark style="color:purple;"><code>ERROR</code></mark> value), in other cases - will be empty.</td></tr><tr><td>result</td><td>object</td><td>Result object that is contain 2 properties <mark style="color:purple;"><code>input_object</code></mark> and <mark style="color:purple;"><code>output_object</code></mark>, in case of processing errors - will be empty. Details are listed below.</td></tr></tbody></table>

Read a <mark style="color:purple;">`input_object`</mark> and <mark style="color:purple;">`output_object`</mark> properties of response <mark style="color:purple;">`result`</mark> property:

<table><thead><tr><th width="151">Parameter</th><th width="112.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>ext</td><td>string</td><td>File extension. Can have values: <mark style="color:purple;"><code>jpg</code></mark>, <mark style="color:purple;"><code>png</code></mark>, <mark style="color:purple;"><code>webp</code></mark>, <mark style="color:purple;"><code>av1</code></mark>.</td></tr><tr><td>mps</td><td>float</td><td>Megapixel count.</td></tr><tr><td>mime</td><td>string</td><td>MIME type (also known as ‘media type’).</td></tr><tr><td>width</td><td>integer</td><td>Image width in pixels.</td></tr><tr><td>height</td><td>integer</td><td>Image height in pixels.</td></tr><tr><td>format</td><td>string</td><td>File format. Can have values: <mark style="color:purple;"><code>jpeg</code></mark>, <mark style="color:purple;"><code>png</code></mark>, <mark style="color:purple;"><code>webp</code></mark>, <mark style="color:purple;"><code>avif</code></mark>.</td></tr><tr><td>tmp_url</td><td>string</td><td>Temporary URL of a processed image. Is available only for <mark style="color:purple;"><code>output_object</code></mark>.</td></tr></tbody></table>

Read an item from <mark style="color:purple;">`errors`</mark> property:

<table><thead><tr><th width="151">Parameter</th><th width="112.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>error</td><td>string</td><td>Error message in text.</td></tr><tr><td>created_at</td><td>integer</td><td>Exact time when the error was catched.</td></tr><tr><td>input_object</td><td>object</td><td>Same as <mark style="color:purple;"><code>input_object</code></mark> from <mark style="color:purple;"><code>result</code></mark> property. For some errors can be <mark style="color:purple;"><code>null</code></mark>.</td></tr></tbody></table>

#### **Response body**

```json
{
  "data": {
    "id": 1,
    "status": "DONE",
    "created_at": "2023-03-13T11:37:09.160554+00:00",
    "request": {
      "input": "https://picsum.photos/200.jpg",
      "operations": {
        "resizing": {
            "width": 1000
        },
        "background": {
            "remove": false
        }
      }
    },
    "errors": [],
    "result": {
      "input_object": {
        "ext": "pnj",
        "mps": 0.016384,
        "mime": "image/jpeg",
        "format": "JPEG",
        "width": 128,
        "height": 128
      },
      "output_object": {
        "ext": "jpeg",
        "mps": 1.0,
        "mime": "image/jpeg",
        "format": "JPEG",
        "width": 1000,
        "height": 1000,
        "tmp_url": "https://storage.googleapis.com/production-leapi-tmp-public/000/200.jpeg"
      }
    }
  }
}
```

See [Response headers](/image-editing-api/api-reference#response-headers) to learn about headers.


# Batch API Reference

## Batch image edit contract

Batch endpoint allows batch processing of images by specifying a cloud Storage directory as input. See [Storage overview](/storage-connectors/overview) for more info.

In other aspects, the Batch endpoint behaves like the [Async endpoint](/image-editing-api/async-api-reference), returning a response without waiting for an actual result that should be queried with another request.

{% hint style="info" %}
By default, it is expected that the images will be located in the root of the cloud directory that is specified in the `input` field. To retrieve all images from subdirectories recursively, the `input` field should have the `recursive` parameter as following:

```json
{
  "input": {
    "source": "storage://storage_1/input_folder/",
    "recursive": true
  },
  ...
}
```

{% endhint %}

{% hint style="info" %}
In the Batch endpoint you could also set input as list of publicly accessible URLs, so our service can fetch and process them:

```json
{
  "input": ["https://image.site/image.png", "https://image.site/image.png"],
  ...
}
```

{% endhint %}

### Request image processing

The request body for Batch endpoint is the same as for regular image edit operation, except Storage directories are allowed for `input` and `output` parameters. See [Image edit contract](/image-editing-api/api-reference#image-edit-contract) for more info.&#x20;

## Process Batch Image Edit

> Specifies: \
> \- what images will be processed (\`input\`)\
> \- how they will be processed (\`operations\`)\
> \- where they will be stored (\`output\`)

```json
{"openapi":"3.1.0","info":{"title":"Claid REST API","version":"v1"},"tags":[{"name":"Image","description":"Encompasses operations with images."}],"security":[{"OAuth2PasswordBearer":[]},{"OAuth2PasswordBearer":["image_editing"]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}},"description":"To work with the Claid API, send requests over HTTPS and authenticate using the `Authorization` header in the following format:`Authorization: Bearer <YOUR_API_KEY>`. You do not need to provide a password.\n\nTo get your API key, [sign in to your Claid account](https://claid.ai/login) and click ***Create API key*** button from the ***Overview*** or ***API keys*** pages.\n\nClaid API’s base URL is `https://api.claid.ai/v1/`. All available endpoints are listed in the [Storage](#tag/Storage) and [Image](#tag/Image) sections. \n\n## Bearer\n\nThis API uses OAuth 2.0 [bearer token](https://datatracker.ietf.org/doc/html/rfc6750) (API key) to authorize requests."}},"schemas":{"BatchEditRequest":{"title":"BatchEditRequest","required":["input","operations"],"type":"object","properties":{"input":{"title":"Input folder URL or list of image URLs","anyOf":[{"$ref":"#/components/schemas/BatchEditInputOptions"},{"type":"string","minLength":1,"maxLength":4096,"format":"uri"},{"type":"array","items":{"type":"string","minLength":1,"maxLength":4096,"format":"uri"},"minItems":1}],"description":"URL of the input file or folder. Should be from 1 to 512 characters. Must be accessible by our system."},"operations":{"title":"Operations","allOf":[{"$ref":"#/components/schemas/ImageOperations"}],"description":"Customize the editing workflow so that the output images meet your requirements."},"output":{"title":"Output folder URL","anyOf":[{"$ref":"#/components/schemas/ImageOutputOptions"},{"type":"string","minLength":1,"maxLength":4096,"format":"uri"}],"description":"URL of the output folder. If `output` is not defined, we store the output image on our bucket and return the temporary URL. The name of the output file remains the same as the input file. Images are stored for one day.","default":{"format":"jpeg"}}},"additionalProperties":false},"BatchEditInputOptions":{"title":"image input options","required":["source"],"type":"object","properties":{"source":{"title":"Input folder URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the input file or folder. Should be from 1 to 512 characters. Must be accessible by our system.","format":"uri"},"recursive":{"title":"Recursive","type":"boolean","description":"If `true`, recursively processes all images in subfolders as well, works only if source is folder. ","default":false}},"additionalProperties":false},"ImageOperations":{"title":"image operations options","type":"object","properties":{"restorations":{"title":"Restorations","allOf":[{"$ref":"#/components/schemas/RestorationsOptions"}],"description":"Restore lost details and decompress image with a wide range of AI-powered neural networks. By default, both operations is turned off.","default":{"polish":false}},"adjustments":{"title":"Adjustments","allOf":[{"$ref":"#/components/schemas/AdjustmentsOptions"}],"description":"Change image histogram: set brightness, saturation, dynamic range, balance out colors and lighting. By default, no adjustments are made."},"background":{"title":"Background","allOf":[{"$ref":"#/components/schemas/BackgroundOptions"}],"description":"Remove the background and set a solid color. By default, no changes are made.","default":{"remove":false,"blur":false,"use_original_alpha":false}},"resizing":{"title":"Resizing","allOf":[{"$ref":"#/components/schemas/ResizingOptions"}],"description":"Set the final image size. Crop or fit image in canvas. By default, API will perform all calculations respecting the original image aspect ratio.","default":{"width":"auto","height":"auto","fit":"crop"}},"padding":{"title":"Padding","type":"string","description":"Add a space around the object equally to each of 4 sides, or for height&width separately. Can not be bigger than half of image width/height. By default, padding is not applied."},"privacy":{"title":"Privacy","allOf":[{"$ref":"#/components/schemas/PrivacyOptions"}],"description":"Manage sensitive information on the image.","default":{"blur_car_plate":false,"identity_crop":false}},"generative":{"title":"Generative","allOf":[{"$ref":"#/components/schemas/GenerativeOptions"}],"description":"Transform the image using generative models."}},"additionalProperties":false},"RestorationsOptions":{"title":"restorations options","type":"object","properties":{"decompress":{"allOf":[{"$ref":"#/components/schemas/DecompressEnum"}],"description":"The decompress operation allows you to remove distortion and artifacts caused by image compression methods. It can be used in conjunction with the upscale operation to prepare an image for upscaling.\n\n| Value | Description |\n| --- | --- |\n| null | DEFAULT. No restoration applied.|\n| `\"moderate\"` | Removes JPEG artifacts from the image.|\n| `\"strong\"` | Removes JPEG artifacts more aggressively than \"moderate\".|\n| `\"auto\"` | Automatically detects and remove JPEG artifacts if needed.|"},"upscale":{"title":"Upscale","anyOf":[{"$ref":"#/components/schemas/UpscaleEnum"},{"$ref":"#/components/schemas/UpscalePhotoOptions"}],"description":"The upscale operation allows you to improve the overall quality of an image by rendering out new pixels. The upscale operation works along with resizing through numeric or percentage values for upscaling."},"polish":{"title":"Polish image","type":"boolean","description":"If `true`, polishes an image","default":false}},"additionalProperties":false},"DecompressEnum":{"title":"Decompress","enum":["moderate","strong","auto"],"type":"string","description":"Selects the restoration mode.\n\n| Value | Description |\n| --- | --- |\n| `null` | DEFAULT. No restoration applied.|\n| `\"moderate\"` | Removes JPEG artifacts from the image.|\n| `\"strong\"` | Removes JPEG artifacts more aggressively than `\"moderate\"`.|\n| `\"auto\"` | Automatically detects and remove JPEG artifacts if needed.|"},"UpscaleEnum":{"title":"Upscale","enum":["smart_enhance","smart_resize","faces","digital_art","photo"],"type":"string","description":"Upscales the image with specified type of image upscaling neural network. \n\n| Value | Description |\n| --- | --- |\n| `null` | DEFAULT. Interpolation. Used when output image resolution is smaller than the input resolution.|\n| `\"smart_enhance\"` | Used for small low quality product, real estate and food images.|\n| `\"smart_resize\"` | Used for high quality images.|\n| `\"faces\"` | Used for images containing persons.|\n| `\"digital_art\"` | Used for drawings, illustrations, paintings, cartoons, anime, etc.|\n| `\"photo\"` | Used for images taken by mobile devices or digital camera of people, nature, architecture, etc.|"},"UpscalePhotoOptions":{"title":"photo upscale options","required":["type","version"],"type":"object","properties":{"type":{"title":"Type","enum":["photo"],"type":"string"},"version":{"title":"Version","allOf":[{"$ref":"#/components/schemas/PhotoVersionEnum"}],"description":"Upscales the image with specified version of photo upscaling neural network. \n\n| Value | Description |\n| --- | --- |\n| `\"1\"` | Is deprecated and not recommended.|\n| `\"2\"` | Used for restoring image quality that is taken by mobile devices or digital camera.|\n| `\"3\"` | Used for restoring image quality, a bit more aggressively than \"2\".|\n"}},"additionalProperties":false},"PhotoVersionEnum":{"title":"Version","enum":["1","2","3"],"type":"string","description":"Upscales the image with specified version of photo upscaling neural network. \n\n| Value | Description |\n| --- | --- |\n| `\"1\"` | Is deprecated and not recommended.|\n| `\"2\"` | Used for restoring image quality that is taken by mobile devices or digital camera.|\n| `\"3\"` | Used for restoring image quality, a bit more aggressively than `\"2\"`.|\n"},"AdjustmentsOptions":{"title":"adjustments options","type":"object","properties":{"hdr":{"title":"Hdr","anyOf":[{"type":"integer","description":"HDR effect intensity.","minimum":0,"maximum":100},{"$ref":"#/components/schemas/HdrOptions"}],"description":"Balances out colors and lighting. Allows to turn on `stitching` for stitched 360 photos.","default":0},"exposure":{"title":"Exposure","maximum":100,"minimum":-100,"type":"integer","description":"Decrease (negative integer) or increase (positive integer) exposure.","default":0},"saturation":{"title":"Saturation","maximum":100,"minimum":-100,"type":"integer","description":"Decrease (negative integer) or increase (positive integer) saturation.","default":0},"contrast":{"title":"Contrast","maximum":100,"minimum":-100,"type":"integer","description":"Decrease (negative integer) or increase (positive integer) contrast.","default":0},"sharpness":{"title":"Sharpness","maximum":100,"minimum":0,"type":"integer","description":"Increase sharpness.","default":0}},"additionalProperties":false},"HdrOptions":{"title":"hdr options","type":"object","properties":{"intensity":{"title":"Intensity","maximum":100,"minimum":0,"type":"integer","description":"HDR effect intensity.","default":100},"stitching":{"title":"Stitching","type":"boolean","description":"Set to true for seamless HDR effect on stitched 360 photos.","default":false}},"additionalProperties":false},"BackgroundOptions":{"title":"background options","type":"object","properties":{"remove":{"title":"Remove","anyOf":[{"type":"boolean","title":"Remove background","description":"If `true`, removes background"},{"$ref":"#/components/schemas/BackgroundRemovalOptions"}],"description":"Allows to turn on and configure image background removal.","default":false},"color":{"title":"Color","anyOf":[{"type":"string","title":"Color","description":"Color as a hexadecimal. Paints the background of the image. Examples: `\"#ffffff\"`, `\"#000000\"`."},{"$ref":"#/components/schemas/BackgroundEnum"}],"description":"Color as a hexadecimal. Sets a background color. Defaults to the `#ffffff` (white) color, or `transparent` if an input image has transparency."},"blur":{"title":"Blur","anyOf":[{"type":"boolean","title":"Blur background","description":"If `true`, blurs background. Defaults to `false`."},{"$ref":"#/components/schemas/BackgroundBlurOptions"}],"description":"Allows to turn on and configure image background blurring.","default":false}},"additionalProperties":false},"BackgroundRemovalOptions":{"title":"background removal options","type":"object","properties":{"clipping":{"title":"Clip to object","type":"boolean","description":"If `true` image will be cropped up to the edges of the foreground object.","default":false},"selective":{"title":"Selective","allOf":[{"$ref":"#/components/schemas/BackgroundSelectiveOptions"}],"description":"Allows to select an object to keep on the image and remove the background around it."},"category":{"title":"Category","allOf":[{"$ref":"#/components/schemas/BackgroundCategoryEnum"}],"description":"The background removal category hints the type of objects on the image."}},"additionalProperties":false},"BackgroundSelectiveOptions":{"title":"BackgroundSelectiveOptions","required":["object_to_keep"],"type":"object","properties":{"object_to_keep":{"title":"Object To Keep","maxLength":128,"minLength":3,"type":"string","description":"Specify an object to keep on the image."}},"additionalProperties":false},"BackgroundCategoryEnum":{"title":"Category of objects","enum":["general","cars","products"],"type":"string","description":"Selects the category of objects on the image: \n\n| Value | Description |\n| --- | --- |\n| `\"general\"` | The category that is suitable for all objects and is used by default.|\n| `\"cars\"` | The advanced category that will have better results for removing the background with cars on foreground.|\n| `\"products\"` | The advanced category that will have better results for background removal of various types of products and groceries.|\n"},"BackgroundEnum":{"title":"Transparent","enum":["transparent"],"type":"string","description":"Makes the background of the image transparent, only works for `\"png\"` output format."},"BackgroundBlurOptions":{"title":"background blur options","type":"object","properties":{"selective":{"title":"Selective","allOf":[{"$ref":"#/components/schemas/BackgroundSelectiveOptions"}],"description":"Allows to select an object to keep on the image and blur the background around it."},"category":{"allOf":[{"$ref":"#/components/schemas/BackgroundCategoryEnum"}],"description":"Selects the category of objects on the image: \n\n| Value | Description |\n| --- | --- |\n| `\"general\"` | The category that is suitable for all objects and is used by default.|\n| `\"cars\"` | The advanced category that will have better results for removing the background with cars on foreground.|\n| `\"products\"` | The advanced category that will have better results for background removal of various types of products and groceries.|\n"},"type":{"allOf":[{"$ref":"#/components/schemas/BackgroundBlurTypeEnum"}],"description":"Selects the type of blur to be applied to the background: \n\n| Value | Description |\n| --- | --- |\n| `\"regular\"` | Gaussian blur. Creates an effect of laying a translucent material like vellum on top of the image background, is used by default.|\n| `\"lens\"` | Lens blur with linear focus. Mimics the blur applied to a photo when a wide aperture is used to achieve a narrow depth of field, so that the foreground objects stands out.|\n","default":"regular"},"level":{"allOf":[{"$ref":"#/components/schemas/BackgroundBlurLevelEnum"}],"description":"Selects the level of blur strength to be applied to the background: \n\n| Value | Description |\n| --- | --- |\n| `\"low\"` | Low blur strength.|\n| `\"medium\"` | Medium blur strength, is used by default.|\n| `\"high\"` | High blur strength.|\n","default":"medium"}},"additionalProperties":false},"BackgroundBlurTypeEnum":{"title":"Type of background blur","enum":["regular","lens"],"type":"string","description":"Selects the type of blur: \n\n| Value | Description |\n| --- | --- |\n| `\"regular\"` | Gaussian blur. Creates an effect of laying a translucent material like vellum on top of the image background.|\n| `\"lens\"` | Lens blur with linear focus. Mimics the blur applied to a photo when a wide aperture is used to achieve a narrow depth of field, so that the foreground objects stands out.|\n"},"BackgroundBlurLevelEnum":{"title":"Background blur strength level","enum":["low","medium","high"],"type":"string","description":"Selects the level of blur strength: \n\n| Value | Description |\n| --- | --- |\n| `\"low\"` | Low blur strength.|\n| `\"medium\"` | Medium blur strength.|\n| `\"high\"` | High blur strength.|\n"},"ResizingOptions":{"title":"resizing options","type":"object","properties":{"width":{"title":"Width","anyOf":[{"type":"integer","title":"Pixels","description":"Width in pixels."},{"$ref":"#/components/schemas/SizesEnum"},{"type":"string","title":"Percentage","description":"Percentage as a string. E.g. `\"200%\"` means that the `width` will double relative to the input image.\nIf you express `width` as a percentage, `height` must have the same value or set to `\"auto\"`. Examples: `\"60%\"`, `\"40%\"`"}],"description":"Width of output image. Should be of the same type as `height`, or `\"auto\"`.","default":"auto"},"height":{"title":"Height","anyOf":[{"type":"integer","title":"Pixels","description":"Height in pixels."},{"$ref":"#/components/schemas/SizesEnum"},{"type":"string","title":"Percentage","description":"Percentage as a string. E.g. `\"200%\"` means that the `height` will double relatively to the input image.\nIf you express `height` as a percentage, `width` must have the same value or set to `\"auto\"`. Examples: `\"60%\"`, `\"40%\"`"}],"description":"Height of output image. Should be of the same type as `width`, or `\"auto\"`.","default":"auto"},"fit":{"title":"Fit","anyOf":[{"$ref":"#/components/schemas/FitEnum"},{"$ref":"#/components/schemas/CropOptions"},{"$ref":"#/components/schemas/CoverOptions"},{"$ref":"#/components/schemas/BoundsOptions"},{"$ref":"#/components/schemas/CanvasOptions"},{"$ref":"#/components/schemas/OutpaintOptions"}],"description":"The fit parameter controls how the image will be constrained within the provided size, relative to the `width` and `height`. By default, `fit` mode is `\"crop\"`.","default":"crop"}},"additionalProperties":false},"SizesEnum":{"title":"Auto","enum":["auto"],"type":"string","description":"`width` will have the same value as `height`, if `height` is defined in pixels or percentages; and vice versa."},"FitEnum":{"title":"Fit","enum":["crop","cover","bounds","canvas","outpaint"],"type":"string","description":"Selects the fit mode: \n(Note: All fit modes preserve the original image aspect ratio. Meaning, the image can be cropped but it won't be stretched or squeezed.)\n\n| Value | Description |\n| --- | --- |\n| `\"crop\"` | Scales an image until it fully covers the specified dimensions, the rest gets cropped. Fit `crop` support `\"center\"` and `\"smart\"` modes for cropping.|\n| `\"cover\"` | Resize the image to entirely cover the specified region, making one dimension larger if needed.|\n| `\"bounds\"` | Resize the image to fit entirely within the specified region, making one dimension smaller if needed. |\n| `\"canvas\"` | Input image will be placed on the canvas established by `width` and `height`. Extra space will be filled with the background `color`.|\n| `\"outpaint\"` | Extra space will be generated with the coherent background.|"},"CropOptions":{"title":"crop options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["crop"],"type":"string"},"crop":{"title":"Crop mode","allOf":[{"$ref":"#/components/schemas/FitCropEnum"}],"description":"Selects the crop mode: \n\n| Value | Description |\n| --- | --- |\n| `\"center\"` | Cropping relative to the center of the image.|\n| `\"smart\"` | Content aware image cropping.|\n","default":"center"}},"additionalProperties":false},"FitCropEnum":{"title":"Crop","enum":["center","smart"],"type":"string","description":"Selects the crop mode: \n\n| Value | Description |\n| --- | --- |\n| `\"center\"` | Cropping relative to the center of the image.|\n| `\"smart\"` | Content aware image cropping.|\n"},"CoverOptions":{"title":"cover options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["cover"],"type":"string"}},"additionalProperties":false},"BoundsOptions":{"title":"bounds options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["bounds"],"type":"string"}},"additionalProperties":false},"CanvasOptions":{"title":"canvas options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["canvas"],"type":"string"}},"additionalProperties":false},"OutpaintOptions":{"title":"outpaint options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["outpaint"],"type":"string"},"feathering":{"title":"Feathering","pattern":"^[1-9][0-9]+[%]$|^[0-9][%]$","type":"string","description":"Percentage in string format. Examples: `\"60%\"`, `\"200%\"`","default":"15%"},"outpaint_by":{"title":"Outpaint By","type":"string","description":"The amount of outpainting to be applied to the image. Should be a string with one or two values separated by space. Each value can be in pixels (e.g. `\"100px\"`) or in percentages (e.g. `\"20%\"`).\nIf two values are provided, the first value is for the width and the second value is for the height.\nIf only one value is provided, it will be applied to both width and height.\nIf not provided, the outpainting will be applied in one direction only based on `fit.width` and `fit.height`.\nExamples: `\"10%\"`, `\"5% 15%\"`, `\"5% 0%\"`, `\"1024px\"`, `\"1024px 512px\"`, `\"0px 1024px\"`."}},"additionalProperties":false},"PrivacyOptions":{"title":"PrivacyOptions","type":"object","properties":{"blur_car_plate":{"title":"Blur Car Plate","type":"boolean","description":"If `true`, blurs car plate.","default":false},"identity_crop":{"title":"Identity Crop","type":"boolean","description":"Removes a person's face from the image by cutting everything above the mouth.","default":false}},"additionalProperties":false},"GenerativeOptions":{"title":"generative transformations options","type":"object","properties":{"style_transfer":{"title":"Style Transfer","allOf":[{"$ref":"#/components/schemas/StyleTransferOptions"}],"description":"Apply style from a reference image."}},"additionalProperties":false},"StyleTransferOptions":{"title":"style transfer options","required":["style_reference_image"],"type":"object","properties":{"style_reference_image":{"title":"Style Reference Image","type":"string","description":"URL of the image to be used as a style reference."},"prompt":{"title":"Prompt","maxLength":1024,"minLength":3,"type":"string","description":"Text prompt to adjust the style transfer output."},"depth_strength":{"title":"Depth Strength","maximum":1,"minimum":0,"type":"number","description":"The denoising strength determines the degree of overall composition and shape preservation.","default":1},"denoising_strength":{"title":"Denoising Strength","maximum":1,"minimum":0,"type":"number","description":"The denoising strength determines the degree of color and texture modification.","default":0.75},"style_strength":{"title":"Style Strength","maximum":1,"minimum":0,"type":"number","description":"The style strength determines the degree of overall style intensity as taken from the reference.","default":0.75}},"additionalProperties":false},"ImageOutputOptions":{"title":"image output options","type":"object","properties":{"format":{"title":"Format","anyOf":[{"$ref":"#/components/schemas/FormatEnum"},{"$ref":"#/components/schemas/FormatJpegOptions"},{"$ref":"#/components/schemas/FormatPngOptions"},{"$ref":"#/components/schemas/FormatWebpOptions"},{"$ref":"#/components/schemas/FormatAvifOptions"},{"$ref":"#/components/schemas/FormatTiffOptions"}],"description":"Converts an image to one of the following formats: `\"jpeg\"`, `\"png\"`, `\"webp\"`, `\"avif\"`. Selecting *Jpeg Options* allows to specify quality.","default":"jpeg"},"destination":{"title":"Output URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the output image. If `output` is not defined, we store the output image on our bucket and return the temporary URL. The name of the output file remains the same as the input file. Images are stored for one day.","format":"uri"},"metadata":{"title":"Metadata","allOf":[{"$ref":"#/components/schemas/MetadataOptions"}],"description":"Defines characteristics of the output image, e.g. DPI."}},"additionalProperties":false},"FormatEnum":{"title":"Format","enum":["jpeg","png","webp","avif","tiff"],"type":"string","description":"Converts the image into specified format. Examples: `\"jpeg\"`, `\"png\"`."},"FormatJpegOptions":{"title":"jpeg options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["jpeg"],"type":"string","description":"Must have value `\"jpeg\"`"},"quality":{"title":"Quality","maximum":100,"minimum":1,"type":"integer","default":85},"progressive":{"title":"Progressive","type":"boolean","description":"Progressive JPEG loads in a browser in successive waves until a clear picture is formed. This improves image's loading speed.","default":true}},"additionalProperties":false},"FormatPngOptions":{"title":"png options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["png"],"type":"string","description":"Must have value `\"png\"`"},"compression":{"allOf":[{"$ref":"#/components/schemas/FormatCompressionLevelEnum"}],"description":"Specifies compression effort that will be applied during the PNG image encoding. Should have one of values: `\"fast\"`, `\"best\"`, or `\"optimal\"`. Defaults to `\"optimal\"`.","default":"optimal"}},"additionalProperties":false},"FormatCompressionLevelEnum":{"title":"Compression","enum":["fast","best","optimal"],"type":"string","description":"Indicates compression effort. \n\n| Value | Description |\n| --- | --- |\n| `\"fast\"` |  Used to apply minimum compression resulting in a bigger image size but less processing time.|\n| `\"best\"` | Used to apply maximum compression resulting in a smaller image size but more processing time.|\n| `\"optimal\"` | DEFAULT. Used to balance between compression effort and the processing time.|\n"},"FormatWebpOptions":{"title":"webp options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["webp"],"type":"string","description":"Must have value `\"webp\"`"},"compression":{"title":"Compression","anyOf":[{"$ref":"#/components/schemas/WebpCompressionEnum"},{"$ref":"#/components/schemas/WebpLossyCompressionOptions"},{"$ref":"#/components/schemas/WebpLosslessCompressionOptions"}],"description":"The WEBP codec supports both lossless and lossy modes of operation, so you can select the one that is appropriate for your goals. Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image. You can specify the amount of loss you are willing to accept. By default it's set to to 75. Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.","default":{"type":"lossy","quality":75}}},"additionalProperties":false},"WebpCompressionEnum":{"title":"WEBP Compression","enum":["lossy","lossless"],"type":"string","description":"Selects the WEBP compression type: \n\n| Value | Description |\n| --- | --- |\n| `\"lossy\"` | Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image.|\n| `\"lossless\"` | Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.|\n"},"WebpLossyCompressionOptions":{"title":"WebpLossyCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossy"],"type":"string","description":"Must have value `\"lossy\"`"},"quality":{"title":"Quality","maximum":100,"minimum":1,"type":"integer","default":75}},"additionalProperties":false},"WebpLosslessCompressionOptions":{"title":"WebpLosslessCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossless"],"type":"string","description":"Must have value `\"lossless\"`"}},"additionalProperties":false},"FormatAvifOptions":{"title":"avif options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["avif"],"type":"string","description":"Must have value `\"avif\"`"},"compression":{"title":"Compression","anyOf":[{"$ref":"#/components/schemas/AvifCompressionEnum"},{"$ref":"#/components/schemas/AvifLossyCompressionOptions"},{"$ref":"#/components/schemas/AvifLosslessCompressionOptions"}],"description":"The AVIF codec supports both lossless and lossy modes of operation, so you can select the one that is appropriate for your goals. Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image. You can specify the amount of loss you are willing to accept. Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.","default":{"type":"lossy","quality":50}}},"additionalProperties":false},"AvifCompressionEnum":{"title":"AVIF Compression","enum":["lossy","lossless"],"type":"string","description":"Selects the AVIF compression type: \n\n| Value | Description |\n| --- | --- |\n| `\"lossy\"` | Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image.|\n| `\"lossless\"` | Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.|\n"},"AvifLossyCompressionOptions":{"title":"AvifLossyCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossy"],"type":"string","description":"Must have value `\"lossy\"`"},"quality":{"title":"Quality","maximum":100,"minimum":1,"type":"integer","default":50}},"additionalProperties":false},"AvifLosslessCompressionOptions":{"title":"AvifLosslessCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossless"],"type":"string","description":"Must have value `\"lossless\"`"}},"additionalProperties":false},"FormatTiffOptions":{"title":"FormatTiffOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["tiff"],"type":"string","description":"Must have value `\"tiff\"`"},"compression":{"title":"Compression","anyOf":[{"$ref":"#/components/schemas/TiffCompressionEnum"},{"$ref":"#/components/schemas/TiffLossyCompressionOptions"},{"$ref":"#/components/schemas/TiffLosslessCompressionOptions"}],"description":"The TIFF codec supports both lossless and lossy modes of operation, so you can select the one that is appropriate for your goals. Lossy JPEG compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image. You can specify the amount of loss you are willing to accept. By default it's set to to 75. Lossless LZW (Lempel-Ziv-Welch) compression allows you to save maximum image details in exchange for a significantly increased file size.","default":{"type":"lossless"}}},"additionalProperties":false},"TiffCompressionEnum":{"title":"TIFF Compression","enum":["lossy","lossless"],"type":"string","description":"Selects the TIFF compression type: \n\n| Value | Description |\n| --- | --- |\n| `\"lossy\"` | Lossy JPEG compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image.|\n| `\"lossless\"` | Lossless LZW (Lempel-Ziv-Welch) compression allows you to save maximum image details in exchange for a significantly increased file size.|\n"},"TiffLossyCompressionOptions":{"title":"TiffLossyCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossy"],"type":"string","description":"Must have value `\"lossy\"`"},"quality":{"title":"Quality","maximum":100,"minimum":1,"type":"integer","default":75}},"additionalProperties":false},"TiffLosslessCompressionOptions":{"title":"TiffLosslessCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossless"],"type":"string","description":"Must have value `\"lossless\"`"}},"additionalProperties":false},"MetadataOptions":{"title":"image color space options","type":"object","properties":{"dpi":{"title":"DPI","type":"integer","description":"Dots per inch."},"color_space":{"title":"Color Space","anyOf":[{"$ref":"#/components/schemas/ColorSpaceEnum"},{"$ref":"#/components/schemas/RGBColorSpaceOptions"},{"$ref":"#/components/schemas/CMYKColorSpaceOptions"}],"description":"Specifies desirable color space of the output image. By default, preserves the color space of the original image."}},"additionalProperties":false},"ColorSpaceEnum":{"title":"Type of color space","enum":["RGB","CMYK"],"type":"string","description":"Selects the type of color space: \n\n| Value | Description |\n| --- | --- |\n| `\"RGB\"` | Is the color space for digital images. Use the RGB color mode if your image is supposed to be displayed on any kind of screen.|\n| `\"CMYK\"` | Is the color space for printed materials. Use CMYK for any image that will be physically printed, not viewed on a screen.|\n"},"RGBColorSpaceOptions":{"title":"RGBColorSpaceOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["RGB"],"type":"string"}},"additionalProperties":false},"CMYKColorSpaceOptions":{"title":"CMYKColorSpaceOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["CMYK"],"type":"string"},"color_profile":{"allOf":[{"$ref":"#/components/schemas/CMYKColorProfileEnum"}],"description":"Specifies color profile that will be used for color space. \n\nSelects the type of color space profile: \n\n| Value | Description | Paper | Max. total ink (TAC) | Characterisation data | \n| --- | --- | --- | --- | --- |\n| `\"ISO_Coated\"` | (Coated FOGRA39, ISO 12647-2:2004) Is used by default. Standard for glossy and matte coated paper. | Grades 1 and 2, gloss and matte coated. | 330% | FOGRA39 |\n| `\"ISO_Uncoated\"` | (Uncoated FOGRA29, ISO 12647-2:2004) Standard for uncoated white natural paper. | Grade 4, uncoated white offset. | 300% | FOGRA29 |\n| `\"USWeb_Coated\"` | (SWOP2006_Coated3v2) Standard for glossy and matte coated paper in the United States. | Grades 1, 2 and 3 gloss coated, matte coated and uncoated paper. | 300% | CGATS TR003 |\n| `\"USWeb_Uncoated\"` | (GRACoL 2013 Uncoated) Standard for uncoated white natural paper in the United States. | Grade 4, uncoated white offset. | 260% |  CGATS21-2-CRPC3 |\n","default":"USWeb_Coated"}},"additionalProperties":false},"CMYKColorProfileEnum":{"title":"Type of color space","enum":["ISO_Coated","ISO_Uncoated","USWeb_Coated","USWeb_Uncoated"],"type":"string","description":"Selects the type of color space profile: \n\n| Value | Description | Paper | Max. total ink (TAC) | Characterisation data | \n| --- | --- | --- | --- | --- |\n| `\"ISO_Coated\"` | (Coated FOGRA39, ISO 12647-2:2004) Is used by default. Standard for glossy and matte coated paper. | Grades 1 and 2, gloss and matte coated. | 330% | FOGRA39 |\n| `\"ISO_Uncoated\"` | (Uncoated FOGRA29, ISO 12647-2:2004) Standard for uncoated white natural paper. | Grade 4, uncoated white offset. | 300% | FOGRA29 |\n| `\"USWeb_Coated\"` | (SWOP2006_Coated3v2) Standard for glossy and matte coated paper in the United States. | Grades 1, 2 and 3 gloss coated, matte coated and uncoated paper. | 300% | CGATS TR003 |\n| `\"USWeb_Uncoated\"` | (GRACoL 2013 Uncoated) Standard for uncoated white natural paper in the United States. | Grade 4, uncoated white offset. | 260% |  CGATS21-2-CRPC3 |\n"},"Response_BatchAcceptedResponse_":{"title":"Response[BatchAcceptedResponse]","type":"object","properties":{"data":{"$ref":"#/components/schemas/BatchAcceptedResponse"}},"description":"Wrapper for responses"},"BatchAcceptedResponse":{"title":"BatchAcceptedResponse","required":["id","status","created_at","request"],"type":"object","properties":{"id":{"title":"Id","type":"integer"},"status":{"$ref":"#/components/schemas/APIV1Status"},"result_url":{"title":"Result Url","maxLength":65536,"minLength":1,"type":"string","format":"uri"},"created_at":{"title":"Created At","type":"string","format":"date-time"},"request":{"title":"Request","anyOf":[{"$ref":"#/components/schemas/BatchEditRequest"},{"$ref":"#/components/schemas/AsyncEditRequest"},{"type":"object"}]},"errors":{"title":"Errors","type":"array","items":{"$ref":"#/components/schemas/BatchPipelineError"},"default":[]},"results":{"title":"Results","type":"array","items":{"$ref":"#/components/schemas/BatchPipelineResultItem"},"default":[]}}},"APIV1Status":{"title":"APIV1Status","enum":["ACCEPTED","WAITING","PROCESSING","DONE","ERROR","CANCELLED","PAUSED"],"type":"string","description":"An enumeration."},"AsyncEditRequest":{"title":"AsyncEditRequest","required":["input","operations"],"type":"object","properties":{"input":{"title":"Input URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the input image. Should be from 1 to 512 characters. Image must be accessible by our system.","format":"uri"},"operations":{"title":"Operations","allOf":[{"$ref":"#/components/schemas/ImageOperations"}],"description":"Customize the editing workflow so that the output images meet your requirements."},"output":{"title":"Output","anyOf":[{"$ref":"#/components/schemas/ImageOutputOptions"},{"type":"string","minLength":1,"maxLength":4096,"format":"uri"}],"description":"Customize the result output.","default":{"format":"jpeg"}}},"additionalProperties":false},"BatchPipelineError":{"title":"BatchPipelineError","required":["error","created_at"],"type":"object","properties":{"error":{"title":"Error","type":"string"},"created_at":{"title":"Created At","type":"string"},"input_object":{"$ref":"#/components/schemas/PipelineInputObjectInError"}}},"PipelineInputObjectInError":{"title":"PipelineInputObjectInError","required":["ext","mps","mime","format","width","height"],"type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension. Can have values: `\"jpg\"`, `\"png\"`, `\"avif\"`"},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as ‘media type’)"},"format":{"title":"Format","type":"string","description":"File format. Can have values: `\"jpeg\"`, `\"png\"`, `\"avif\"`"},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"}}},"BatchPipelineResultItem":{"title":"BatchPipelineResultItem","required":["input_object","output_object"],"type":"object","properties":{"input_object":{"$ref":"#/components/schemas/PipelineInputObject"},"output_object":{"$ref":"#/components/schemas/BatchPipelineOutputObject"}}},"PipelineInputObject":{"title":"PipelineInputObject","required":["ext","mps","mime","format","width","height"],"type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension. Can have values: `\"jpg\"`, `\"png\"`, `\"avif\"`"},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as ‘media type’)"},"format":{"title":"Format","type":"string","description":"File format. Can have values: `\"jpeg\"`, `\"png\"`, `\"avif\"`"},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"}}},"BatchPipelineOutputObject":{"title":"BatchPipelineOutputObject","required":["ext","mps","mime","format","width","height"],"type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension. Can have values: `\"jpg\"`, `\"png\"`, `\"avif\"`"},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as ‘media type’)"},"format":{"title":"Format","type":"string","description":"File format. Can have values: `\"jpeg\"`, `\"png\"`, `\"avif\"`"},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"},"tmp_url":{"title":"Tmp Url","type":"string","description":"Temporal URL of a processed image"},"object_key":{"title":"Object Key","type":"string","description":"Path to a processed image in a bucket"},"object_bucket":{"title":"Object Bucket","type":"string","description":"Bucket name"},"object_uri":{"title":"Object Uri","type":"string","description":"URI of a processed image in a bucket"},"claid_storage_uri":{"title":"Claid Storage Uri","type":"string","description":"URI of a processed image in a storage"},"gcs_key":{"title":"Gcs Key","type":"string"},"gcs_bucket":{"title":"Gcs Bucket","type":"string"}}},"HttpErrorDetails":{"title":"HttpErrorDetails","required":["error_code","error_type","error_message"],"type":"object","properties":{"error_code":{"title":"Error Code","type":"string"},"error_type":{"$ref":"#/components/schemas/ErrorType"},"error_message":{"title":"Error Message","type":"string"},"error_details":{"title":"Error Details","type":"object","default":{}}}},"ErrorType":{"title":"ErrorType","enum":["auth","dlvr","general","le","survey","storage","image","user_settings","user","validation","analytics","scene","billing","web","runtime_settings","animation","custom_models"],"type":"string","description":"An enumeration."}}},"paths":{"/v1/image/edit/batch":{"post":{"tags":["Image"],"summary":"Process Batch Image Edit","description":"Specifies: \n- what images will be processed (`input`)\n- how they will be processed (`operations`)\n- where they will be stored (`output`)","operationId":"process_batch_image_edit_v1_image_edit_batch_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchEditRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response_BatchAcceptedResponse_"}}}},"401":{"description":"Authorization is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"402":{"description":"No API calls left.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"403":{"description":"Not enough permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"422":{"description":"Unprocessable Entity.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}}}}}}}
```

#### **Request**

{% tabs %}
{% tab title="HTTP" %}

```http
POST /v1/image/edit/batch HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
Content-Type: application/json

{
  "input": "storage://storage_1/input_folder/",
  "operations": {
    "resizing": {
      "width": 1000
    },
    "background": {
      "remove": false
    }
  },
  "output": "storage://storage_1/output_folder/"
}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl -X POST --location "https://api.claid.ai/v1/image/edit/batch" --http1.1 \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}" \
    -H "Content-Type: application/json" \
    -d "{
          \"input\": \"storage://storage_1/input_folder/\",
          \"operations\": {
            \"resizing\": {
              \"width\": 1000
            },
            \"background\": {
              \"remove\": false
            }
          },
          \"output\": \"storage://storage_1/output_folder/\"
        }"    -H "Authorization: Bearer {YOUR_API_KEY}"
```

{% endtab %}
{% endtabs %}

#### **Read a response**

Once you have made the request to <mark style="color:purple;">`https://api.claid.ai/v1/image/edit/batch`</mark> you will get a response with information about request status and other details, see the [Read a response](/image-editing-api/async-api-reference#read-a-response) part of the [Async endpoint](/image-editing-api/async-api-reference) page for more info.&#x20;

#### **Response body**

```json
{
  "data": {
    "id": 1,
    "status": "ACCEPTED",
    "result_url": "https://api.claid.ai/v1/image/edit/batch/1",
    "created_at": "2023-03-13T11:37:09.160554+00:00",
    "request": {
      "input": "storage://storage_1/input_folder/",
      "operations": {
        "resizing": {
            "width": 1000
        },
        "background": {
            "remove": false
        }
      },
      "output": "storage://storage_1/output_folder/"
    }
  }
}
```

See the [Request Headers](/image-editing-api/api-reference#request-headers) and [Response Headers](/image-editing-api/api-reference#response-headers) to learn about headers.

### Result of request processing contract

To get Batch image editing result, you need to know the ID of the processing request. Or you can take a ready-to-use link from the <mark style="color:purple;">`result_url`</mark> property of the response body described above.

## GET /v1/image/edit/batch/{task\_id}

> Image Edit Batch Async Results

```json
{"openapi":"3.1.0","info":{"title":"Claid REST API","version":"v1"},"tags":[{"name":"Image","description":"Encompasses operations with images."}],"security":[{"OAuth2PasswordBearer":["image_editing"]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}},"description":"To work with the Claid API, send requests over HTTPS and authenticate using the `Authorization` header in the following format:`Authorization: Bearer <YOUR_API_KEY>`. You do not need to provide a password.\n\nTo get your API key, [sign in to your Claid account](https://claid.ai/login) and click ***Create API key*** button from the ***Overview*** or ***API keys*** pages.\n\nClaid API’s base URL is `https://api.claid.ai/v1/`. All available endpoints are listed in the [Storage](#tag/Storage) and [Image](#tag/Image) sections. \n\n## Bearer\n\nThis API uses OAuth 2.0 [bearer token](https://datatracker.ietf.org/doc/html/rfc6750) (API key) to authorize requests."}},"schemas":{"Response_BatchResultResponse_":{"title":"Response[BatchResultResponse]","type":"object","properties":{"data":{"$ref":"#/components/schemas/BatchResultResponse"}},"description":"Wrapper for responses"},"BatchResultResponse":{"title":"BatchResultResponse","required":["id","status","created_at","request"],"type":"object","properties":{"id":{"title":"Id","type":"integer"},"status":{"$ref":"#/components/schemas/APIV1Status"},"result_url":{"title":"Result Url","maxLength":65536,"minLength":1,"type":"string","format":"uri"},"created_at":{"title":"Created At","type":"string","format":"date-time"},"request":{"title":"Request","anyOf":[{"$ref":"#/components/schemas/BatchEditRequest"},{"$ref":"#/components/schemas/AsyncEditRequest"},{"type":"object"}]},"errors":{"title":"Errors","type":"array","items":{"$ref":"#/components/schemas/BatchPipelineError"},"default":[]},"results":{"title":"Results","type":"array","items":{"$ref":"#/components/schemas/AsyncPipelineResultItem"},"default":[]}}},"APIV1Status":{"title":"APIV1Status","enum":["ACCEPTED","WAITING","PROCESSING","DONE","ERROR","CANCELLED","PAUSED"],"type":"string","description":"An enumeration."},"BatchEditRequest":{"title":"BatchEditRequest","required":["input","operations"],"type":"object","properties":{"input":{"title":"Input folder URL or list of image URLs","anyOf":[{"$ref":"#/components/schemas/BatchEditInputOptions"},{"type":"string","minLength":1,"maxLength":4096,"format":"uri"},{"type":"array","items":{"type":"string","minLength":1,"maxLength":4096,"format":"uri"},"minItems":1}],"description":"URL of the input file or folder. Should be from 1 to 512 characters. Must be accessible by our system."},"operations":{"title":"Operations","allOf":[{"$ref":"#/components/schemas/ImageOperations"}],"description":"Customize the editing workflow so that the output images meet your requirements."},"output":{"title":"Output folder URL","anyOf":[{"$ref":"#/components/schemas/ImageOutputOptions"},{"type":"string","minLength":1,"maxLength":4096,"format":"uri"}],"description":"URL of the output folder. If `output` is not defined, we store the output image on our bucket and return the temporary URL. The name of the output file remains the same as the input file. Images are stored for one day.","default":{"format":"jpeg"}}},"additionalProperties":false},"BatchEditInputOptions":{"title":"image input options","required":["source"],"type":"object","properties":{"source":{"title":"Input folder URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the input file or folder. Should be from 1 to 512 characters. Must be accessible by our system.","format":"uri"},"recursive":{"title":"Recursive","type":"boolean","description":"If `true`, recursively processes all images in subfolders as well, works only if source is folder. ","default":false}},"additionalProperties":false},"ImageOperations":{"title":"image operations options","type":"object","properties":{"restorations":{"title":"Restorations","allOf":[{"$ref":"#/components/schemas/RestorationsOptions"}],"description":"Restore lost details and decompress image with a wide range of AI-powered neural networks. By default, both operations is turned off.","default":{"polish":false}},"adjustments":{"title":"Adjustments","allOf":[{"$ref":"#/components/schemas/AdjustmentsOptions"}],"description":"Change image histogram: set brightness, saturation, dynamic range, balance out colors and lighting. By default, no adjustments are made."},"background":{"title":"Background","allOf":[{"$ref":"#/components/schemas/BackgroundOptions"}],"description":"Remove the background and set a solid color. By default, no changes are made.","default":{"remove":false,"blur":false,"use_original_alpha":false}},"resizing":{"title":"Resizing","allOf":[{"$ref":"#/components/schemas/ResizingOptions"}],"description":"Set the final image size. Crop or fit image in canvas. By default, API will perform all calculations respecting the original image aspect ratio.","default":{"width":"auto","height":"auto","fit":"crop"}},"padding":{"title":"Padding","type":"string","description":"Add a space around the object equally to each of 4 sides, or for height&width separately. Can not be bigger than half of image width/height. By default, padding is not applied."},"privacy":{"title":"Privacy","allOf":[{"$ref":"#/components/schemas/PrivacyOptions"}],"description":"Manage sensitive information on the image.","default":{"blur_car_plate":false,"identity_crop":false}},"generative":{"title":"Generative","allOf":[{"$ref":"#/components/schemas/GenerativeOptions"}],"description":"Transform the image using generative models."}},"additionalProperties":false},"RestorationsOptions":{"title":"restorations options","type":"object","properties":{"decompress":{"allOf":[{"$ref":"#/components/schemas/DecompressEnum"}],"description":"The decompress operation allows you to remove distortion and artifacts caused by image compression methods. It can be used in conjunction with the upscale operation to prepare an image for upscaling.\n\n| Value | Description |\n| --- | --- |\n| null | DEFAULT. No restoration applied.|\n| `\"moderate\"` | Removes JPEG artifacts from the image.|\n| `\"strong\"` | Removes JPEG artifacts more aggressively than \"moderate\".|\n| `\"auto\"` | Automatically detects and remove JPEG artifacts if needed.|"},"upscale":{"title":"Upscale","anyOf":[{"$ref":"#/components/schemas/UpscaleEnum"},{"$ref":"#/components/schemas/UpscalePhotoOptions"}],"description":"The upscale operation allows you to improve the overall quality of an image by rendering out new pixels. The upscale operation works along with resizing through numeric or percentage values for upscaling."},"polish":{"title":"Polish image","type":"boolean","description":"If `true`, polishes an image","default":false}},"additionalProperties":false},"DecompressEnum":{"title":"Decompress","enum":["moderate","strong","auto"],"type":"string","description":"Selects the restoration mode.\n\n| Value | Description |\n| --- | --- |\n| `null` | DEFAULT. No restoration applied.|\n| `\"moderate\"` | Removes JPEG artifacts from the image.|\n| `\"strong\"` | Removes JPEG artifacts more aggressively than `\"moderate\"`.|\n| `\"auto\"` | Automatically detects and remove JPEG artifacts if needed.|"},"UpscaleEnum":{"title":"Upscale","enum":["smart_enhance","smart_resize","faces","digital_art","photo"],"type":"string","description":"Upscales the image with specified type of image upscaling neural network. \n\n| Value | Description |\n| --- | --- |\n| `null` | DEFAULT. Interpolation. Used when output image resolution is smaller than the input resolution.|\n| `\"smart_enhance\"` | Used for small low quality product, real estate and food images.|\n| `\"smart_resize\"` | Used for high quality images.|\n| `\"faces\"` | Used for images containing persons.|\n| `\"digital_art\"` | Used for drawings, illustrations, paintings, cartoons, anime, etc.|\n| `\"photo\"` | Used for images taken by mobile devices or digital camera of people, nature, architecture, etc.|"},"UpscalePhotoOptions":{"title":"photo upscale options","required":["type","version"],"type":"object","properties":{"type":{"title":"Type","enum":["photo"],"type":"string"},"version":{"title":"Version","allOf":[{"$ref":"#/components/schemas/PhotoVersionEnum"}],"description":"Upscales the image with specified version of photo upscaling neural network. \n\n| Value | Description |\n| --- | --- |\n| `\"1\"` | Is deprecated and not recommended.|\n| `\"2\"` | Used for restoring image quality that is taken by mobile devices or digital camera.|\n| `\"3\"` | Used for restoring image quality, a bit more aggressively than \"2\".|\n"}},"additionalProperties":false},"PhotoVersionEnum":{"title":"Version","enum":["1","2","3"],"type":"string","description":"Upscales the image with specified version of photo upscaling neural network. \n\n| Value | Description |\n| --- | --- |\n| `\"1\"` | Is deprecated and not recommended.|\n| `\"2\"` | Used for restoring image quality that is taken by mobile devices or digital camera.|\n| `\"3\"` | Used for restoring image quality, a bit more aggressively than `\"2\"`.|\n"},"AdjustmentsOptions":{"title":"adjustments options","type":"object","properties":{"hdr":{"title":"Hdr","anyOf":[{"type":"integer","description":"HDR effect intensity.","minimum":0,"maximum":100},{"$ref":"#/components/schemas/HdrOptions"}],"description":"Balances out colors and lighting. Allows to turn on `stitching` for stitched 360 photos.","default":0},"exposure":{"title":"Exposure","maximum":100,"minimum":-100,"type":"integer","description":"Decrease (negative integer) or increase (positive integer) exposure.","default":0},"saturation":{"title":"Saturation","maximum":100,"minimum":-100,"type":"integer","description":"Decrease (negative integer) or increase (positive integer) saturation.","default":0},"contrast":{"title":"Contrast","maximum":100,"minimum":-100,"type":"integer","description":"Decrease (negative integer) or increase (positive integer) contrast.","default":0},"sharpness":{"title":"Sharpness","maximum":100,"minimum":0,"type":"integer","description":"Increase sharpness.","default":0}},"additionalProperties":false},"HdrOptions":{"title":"hdr options","type":"object","properties":{"intensity":{"title":"Intensity","maximum":100,"minimum":0,"type":"integer","description":"HDR effect intensity.","default":100},"stitching":{"title":"Stitching","type":"boolean","description":"Set to true for seamless HDR effect on stitched 360 photos.","default":false}},"additionalProperties":false},"BackgroundOptions":{"title":"background options","type":"object","properties":{"remove":{"title":"Remove","anyOf":[{"type":"boolean","title":"Remove background","description":"If `true`, removes background"},{"$ref":"#/components/schemas/BackgroundRemovalOptions"}],"description":"Allows to turn on and configure image background removal.","default":false},"color":{"title":"Color","anyOf":[{"type":"string","title":"Color","description":"Color as a hexadecimal. Paints the background of the image. Examples: `\"#ffffff\"`, `\"#000000\"`."},{"$ref":"#/components/schemas/BackgroundEnum"}],"description":"Color as a hexadecimal. Sets a background color. Defaults to the `#ffffff` (white) color, or `transparent` if an input image has transparency."},"blur":{"title":"Blur","anyOf":[{"type":"boolean","title":"Blur background","description":"If `true`, blurs background. Defaults to `false`."},{"$ref":"#/components/schemas/BackgroundBlurOptions"}],"description":"Allows to turn on and configure image background blurring.","default":false}},"additionalProperties":false},"BackgroundRemovalOptions":{"title":"background removal options","type":"object","properties":{"clipping":{"title":"Clip to object","type":"boolean","description":"If `true` image will be cropped up to the edges of the foreground object.","default":false},"selective":{"title":"Selective","allOf":[{"$ref":"#/components/schemas/BackgroundSelectiveOptions"}],"description":"Allows to select an object to keep on the image and remove the background around it."},"category":{"title":"Category","allOf":[{"$ref":"#/components/schemas/BackgroundCategoryEnum"}],"description":"The background removal category hints the type of objects on the image."}},"additionalProperties":false},"BackgroundSelectiveOptions":{"title":"BackgroundSelectiveOptions","required":["object_to_keep"],"type":"object","properties":{"object_to_keep":{"title":"Object To Keep","maxLength":128,"minLength":3,"type":"string","description":"Specify an object to keep on the image."}},"additionalProperties":false},"BackgroundCategoryEnum":{"title":"Category of objects","enum":["general","cars","products"],"type":"string","description":"Selects the category of objects on the image: \n\n| Value | Description |\n| --- | --- |\n| `\"general\"` | The category that is suitable for all objects and is used by default.|\n| `\"cars\"` | The advanced category that will have better results for removing the background with cars on foreground.|\n| `\"products\"` | The advanced category that will have better results for background removal of various types of products and groceries.|\n"},"BackgroundEnum":{"title":"Transparent","enum":["transparent"],"type":"string","description":"Makes the background of the image transparent, only works for `\"png\"` output format."},"BackgroundBlurOptions":{"title":"background blur options","type":"object","properties":{"selective":{"title":"Selective","allOf":[{"$ref":"#/components/schemas/BackgroundSelectiveOptions"}],"description":"Allows to select an object to keep on the image and blur the background around it."},"category":{"allOf":[{"$ref":"#/components/schemas/BackgroundCategoryEnum"}],"description":"Selects the category of objects on the image: \n\n| Value | Description |\n| --- | --- |\n| `\"general\"` | The category that is suitable for all objects and is used by default.|\n| `\"cars\"` | The advanced category that will have better results for removing the background with cars on foreground.|\n| `\"products\"` | The advanced category that will have better results for background removal of various types of products and groceries.|\n"},"type":{"allOf":[{"$ref":"#/components/schemas/BackgroundBlurTypeEnum"}],"description":"Selects the type of blur to be applied to the background: \n\n| Value | Description |\n| --- | --- |\n| `\"regular\"` | Gaussian blur. Creates an effect of laying a translucent material like vellum on top of the image background, is used by default.|\n| `\"lens\"` | Lens blur with linear focus. Mimics the blur applied to a photo when a wide aperture is used to achieve a narrow depth of field, so that the foreground objects stands out.|\n","default":"regular"},"level":{"allOf":[{"$ref":"#/components/schemas/BackgroundBlurLevelEnum"}],"description":"Selects the level of blur strength to be applied to the background: \n\n| Value | Description |\n| --- | --- |\n| `\"low\"` | Low blur strength.|\n| `\"medium\"` | Medium blur strength, is used by default.|\n| `\"high\"` | High blur strength.|\n","default":"medium"}},"additionalProperties":false},"BackgroundBlurTypeEnum":{"title":"Type of background blur","enum":["regular","lens"],"type":"string","description":"Selects the type of blur: \n\n| Value | Description |\n| --- | --- |\n| `\"regular\"` | Gaussian blur. Creates an effect of laying a translucent material like vellum on top of the image background.|\n| `\"lens\"` | Lens blur with linear focus. Mimics the blur applied to a photo when a wide aperture is used to achieve a narrow depth of field, so that the foreground objects stands out.|\n"},"BackgroundBlurLevelEnum":{"title":"Background blur strength level","enum":["low","medium","high"],"type":"string","description":"Selects the level of blur strength: \n\n| Value | Description |\n| --- | --- |\n| `\"low\"` | Low blur strength.|\n| `\"medium\"` | Medium blur strength.|\n| `\"high\"` | High blur strength.|\n"},"ResizingOptions":{"title":"resizing options","type":"object","properties":{"width":{"title":"Width","anyOf":[{"type":"integer","title":"Pixels","description":"Width in pixels."},{"$ref":"#/components/schemas/SizesEnum"},{"type":"string","title":"Percentage","description":"Percentage as a string. E.g. `\"200%\"` means that the `width` will double relative to the input image.\nIf you express `width` as a percentage, `height` must have the same value or set to `\"auto\"`. Examples: `\"60%\"`, `\"40%\"`"}],"description":"Width of output image. Should be of the same type as `height`, or `\"auto\"`.","default":"auto"},"height":{"title":"Height","anyOf":[{"type":"integer","title":"Pixels","description":"Height in pixels."},{"$ref":"#/components/schemas/SizesEnum"},{"type":"string","title":"Percentage","description":"Percentage as a string. E.g. `\"200%\"` means that the `height` will double relatively to the input image.\nIf you express `height` as a percentage, `width` must have the same value or set to `\"auto\"`. Examples: `\"60%\"`, `\"40%\"`"}],"description":"Height of output image. Should be of the same type as `width`, or `\"auto\"`.","default":"auto"},"fit":{"title":"Fit","anyOf":[{"$ref":"#/components/schemas/FitEnum"},{"$ref":"#/components/schemas/CropOptions"},{"$ref":"#/components/schemas/CoverOptions"},{"$ref":"#/components/schemas/BoundsOptions"},{"$ref":"#/components/schemas/CanvasOptions"},{"$ref":"#/components/schemas/OutpaintOptions"}],"description":"The fit parameter controls how the image will be constrained within the provided size, relative to the `width` and `height`. By default, `fit` mode is `\"crop\"`.","default":"crop"}},"additionalProperties":false},"SizesEnum":{"title":"Auto","enum":["auto"],"type":"string","description":"`width` will have the same value as `height`, if `height` is defined in pixels or percentages; and vice versa."},"FitEnum":{"title":"Fit","enum":["crop","cover","bounds","canvas","outpaint"],"type":"string","description":"Selects the fit mode: \n(Note: All fit modes preserve the original image aspect ratio. Meaning, the image can be cropped but it won't be stretched or squeezed.)\n\n| Value | Description |\n| --- | --- |\n| `\"crop\"` | Scales an image until it fully covers the specified dimensions, the rest gets cropped. Fit `crop` support `\"center\"` and `\"smart\"` modes for cropping.|\n| `\"cover\"` | Resize the image to entirely cover the specified region, making one dimension larger if needed.|\n| `\"bounds\"` | Resize the image to fit entirely within the specified region, making one dimension smaller if needed. |\n| `\"canvas\"` | Input image will be placed on the canvas established by `width` and `height`. Extra space will be filled with the background `color`.|\n| `\"outpaint\"` | Extra space will be generated with the coherent background.|"},"CropOptions":{"title":"crop options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["crop"],"type":"string"},"crop":{"title":"Crop mode","allOf":[{"$ref":"#/components/schemas/FitCropEnum"}],"description":"Selects the crop mode: \n\n| Value | Description |\n| --- | --- |\n| `\"center\"` | Cropping relative to the center of the image.|\n| `\"smart\"` | Content aware image cropping.|\n","default":"center"}},"additionalProperties":false},"FitCropEnum":{"title":"Crop","enum":["center","smart"],"type":"string","description":"Selects the crop mode: \n\n| Value | Description |\n| --- | --- |\n| `\"center\"` | Cropping relative to the center of the image.|\n| `\"smart\"` | Content aware image cropping.|\n"},"CoverOptions":{"title":"cover options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["cover"],"type":"string"}},"additionalProperties":false},"BoundsOptions":{"title":"bounds options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["bounds"],"type":"string"}},"additionalProperties":false},"CanvasOptions":{"title":"canvas options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["canvas"],"type":"string"}},"additionalProperties":false},"OutpaintOptions":{"title":"outpaint options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["outpaint"],"type":"string"},"feathering":{"title":"Feathering","pattern":"^[1-9][0-9]+[%]$|^[0-9][%]$","type":"string","description":"Percentage in string format. Examples: `\"60%\"`, `\"200%\"`","default":"15%"},"outpaint_by":{"title":"Outpaint By","type":"string","description":"The amount of outpainting to be applied to the image. Should be a string with one or two values separated by space. Each value can be in pixels (e.g. `\"100px\"`) or in percentages (e.g. `\"20%\"`).\nIf two values are provided, the first value is for the width and the second value is for the height.\nIf only one value is provided, it will be applied to both width and height.\nIf not provided, the outpainting will be applied in one direction only based on `fit.width` and `fit.height`.\nExamples: `\"10%\"`, `\"5% 15%\"`, `\"5% 0%\"`, `\"1024px\"`, `\"1024px 512px\"`, `\"0px 1024px\"`."}},"additionalProperties":false},"PrivacyOptions":{"title":"PrivacyOptions","type":"object","properties":{"blur_car_plate":{"title":"Blur Car Plate","type":"boolean","description":"If `true`, blurs car plate.","default":false},"identity_crop":{"title":"Identity Crop","type":"boolean","description":"Removes a person's face from the image by cutting everything above the mouth.","default":false}},"additionalProperties":false},"GenerativeOptions":{"title":"generative transformations options","type":"object","properties":{"style_transfer":{"title":"Style Transfer","allOf":[{"$ref":"#/components/schemas/StyleTransferOptions"}],"description":"Apply style from a reference image."}},"additionalProperties":false},"StyleTransferOptions":{"title":"style transfer options","required":["style_reference_image"],"type":"object","properties":{"style_reference_image":{"title":"Style Reference Image","type":"string","description":"URL of the image to be used as a style reference."},"prompt":{"title":"Prompt","maxLength":1024,"minLength":3,"type":"string","description":"Text prompt to adjust the style transfer output."},"depth_strength":{"title":"Depth Strength","maximum":1,"minimum":0,"type":"number","description":"The denoising strength determines the degree of overall composition and shape preservation.","default":1},"denoising_strength":{"title":"Denoising Strength","maximum":1,"minimum":0,"type":"number","description":"The denoising strength determines the degree of color and texture modification.","default":0.75},"style_strength":{"title":"Style Strength","maximum":1,"minimum":0,"type":"number","description":"The style strength determines the degree of overall style intensity as taken from the reference.","default":0.75}},"additionalProperties":false},"ImageOutputOptions":{"title":"image output options","type":"object","properties":{"format":{"title":"Format","anyOf":[{"$ref":"#/components/schemas/FormatEnum"},{"$ref":"#/components/schemas/FormatJpegOptions"},{"$ref":"#/components/schemas/FormatPngOptions"},{"$ref":"#/components/schemas/FormatWebpOptions"},{"$ref":"#/components/schemas/FormatAvifOptions"},{"$ref":"#/components/schemas/FormatTiffOptions"}],"description":"Converts an image to one of the following formats: `\"jpeg\"`, `\"png\"`, `\"webp\"`, `\"avif\"`. Selecting *Jpeg Options* allows to specify quality.","default":"jpeg"},"destination":{"title":"Output URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the output image. If `output` is not defined, we store the output image on our bucket and return the temporary URL. The name of the output file remains the same as the input file. Images are stored for one day.","format":"uri"},"metadata":{"title":"Metadata","allOf":[{"$ref":"#/components/schemas/MetadataOptions"}],"description":"Defines characteristics of the output image, e.g. DPI."}},"additionalProperties":false},"FormatEnum":{"title":"Format","enum":["jpeg","png","webp","avif","tiff"],"type":"string","description":"Converts the image into specified format. Examples: `\"jpeg\"`, `\"png\"`."},"FormatJpegOptions":{"title":"jpeg options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["jpeg"],"type":"string","description":"Must have value `\"jpeg\"`"},"quality":{"title":"Quality","maximum":100,"minimum":1,"type":"integer","default":85},"progressive":{"title":"Progressive","type":"boolean","description":"Progressive JPEG loads in a browser in successive waves until a clear picture is formed. This improves image's loading speed.","default":true}},"additionalProperties":false},"FormatPngOptions":{"title":"png options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["png"],"type":"string","description":"Must have value `\"png\"`"},"compression":{"allOf":[{"$ref":"#/components/schemas/FormatCompressionLevelEnum"}],"description":"Specifies compression effort that will be applied during the PNG image encoding. Should have one of values: `\"fast\"`, `\"best\"`, or `\"optimal\"`. Defaults to `\"optimal\"`.","default":"optimal"}},"additionalProperties":false},"FormatCompressionLevelEnum":{"title":"Compression","enum":["fast","best","optimal"],"type":"string","description":"Indicates compression effort. \n\n| Value | Description |\n| --- | --- |\n| `\"fast\"` |  Used to apply minimum compression resulting in a bigger image size but less processing time.|\n| `\"best\"` | Used to apply maximum compression resulting in a smaller image size but more processing time.|\n| `\"optimal\"` | DEFAULT. Used to balance between compression effort and the processing time.|\n"},"FormatWebpOptions":{"title":"webp options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["webp"],"type":"string","description":"Must have value `\"webp\"`"},"compression":{"title":"Compression","anyOf":[{"$ref":"#/components/schemas/WebpCompressionEnum"},{"$ref":"#/components/schemas/WebpLossyCompressionOptions"},{"$ref":"#/components/schemas/WebpLosslessCompressionOptions"}],"description":"The WEBP codec supports both lossless and lossy modes of operation, so you can select the one that is appropriate for your goals. Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image. You can specify the amount of loss you are willing to accept. By default it's set to to 75. Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.","default":{"type":"lossy","quality":75}}},"additionalProperties":false},"WebpCompressionEnum":{"title":"WEBP Compression","enum":["lossy","lossless"],"type":"string","description":"Selects the WEBP compression type: \n\n| Value | Description |\n| --- | --- |\n| `\"lossy\"` | Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image.|\n| `\"lossless\"` | Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.|\n"},"WebpLossyCompressionOptions":{"title":"WebpLossyCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossy"],"type":"string","description":"Must have value `\"lossy\"`"},"quality":{"title":"Quality","maximum":100,"minimum":1,"type":"integer","default":75}},"additionalProperties":false},"WebpLosslessCompressionOptions":{"title":"WebpLosslessCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossless"],"type":"string","description":"Must have value `\"lossless\"`"}},"additionalProperties":false},"FormatAvifOptions":{"title":"avif options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["avif"],"type":"string","description":"Must have value `\"avif\"`"},"compression":{"title":"Compression","anyOf":[{"$ref":"#/components/schemas/AvifCompressionEnum"},{"$ref":"#/components/schemas/AvifLossyCompressionOptions"},{"$ref":"#/components/schemas/AvifLosslessCompressionOptions"}],"description":"The AVIF codec supports both lossless and lossy modes of operation, so you can select the one that is appropriate for your goals. Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image. You can specify the amount of loss you are willing to accept. Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.","default":{"type":"lossy","quality":50}}},"additionalProperties":false},"AvifCompressionEnum":{"title":"AVIF Compression","enum":["lossy","lossless"],"type":"string","description":"Selects the AVIF compression type: \n\n| Value | Description |\n| --- | --- |\n| `\"lossy\"` | Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image.|\n| `\"lossless\"` | Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.|\n"},"AvifLossyCompressionOptions":{"title":"AvifLossyCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossy"],"type":"string","description":"Must have value `\"lossy\"`"},"quality":{"title":"Quality","maximum":100,"minimum":1,"type":"integer","default":50}},"additionalProperties":false},"AvifLosslessCompressionOptions":{"title":"AvifLosslessCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossless"],"type":"string","description":"Must have value `\"lossless\"`"}},"additionalProperties":false},"FormatTiffOptions":{"title":"FormatTiffOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["tiff"],"type":"string","description":"Must have value `\"tiff\"`"},"compression":{"title":"Compression","anyOf":[{"$ref":"#/components/schemas/TiffCompressionEnum"},{"$ref":"#/components/schemas/TiffLossyCompressionOptions"},{"$ref":"#/components/schemas/TiffLosslessCompressionOptions"}],"description":"The TIFF codec supports both lossless and lossy modes of operation, so you can select the one that is appropriate for your goals. Lossy JPEG compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image. You can specify the amount of loss you are willing to accept. By default it's set to to 75. Lossless LZW (Lempel-Ziv-Welch) compression allows you to save maximum image details in exchange for a significantly increased file size.","default":{"type":"lossless"}}},"additionalProperties":false},"TiffCompressionEnum":{"title":"TIFF Compression","enum":["lossy","lossless"],"type":"string","description":"Selects the TIFF compression type: \n\n| Value | Description |\n| --- | --- |\n| `\"lossy\"` | Lossy JPEG compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image.|\n| `\"lossless\"` | Lossless LZW (Lempel-Ziv-Welch) compression allows you to save maximum image details in exchange for a significantly increased file size.|\n"},"TiffLossyCompressionOptions":{"title":"TiffLossyCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossy"],"type":"string","description":"Must have value `\"lossy\"`"},"quality":{"title":"Quality","maximum":100,"minimum":1,"type":"integer","default":75}},"additionalProperties":false},"TiffLosslessCompressionOptions":{"title":"TiffLosslessCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossless"],"type":"string","description":"Must have value `\"lossless\"`"}},"additionalProperties":false},"MetadataOptions":{"title":"image color space options","type":"object","properties":{"dpi":{"title":"DPI","type":"integer","description":"Dots per inch."},"color_space":{"title":"Color Space","anyOf":[{"$ref":"#/components/schemas/ColorSpaceEnum"},{"$ref":"#/components/schemas/RGBColorSpaceOptions"},{"$ref":"#/components/schemas/CMYKColorSpaceOptions"}],"description":"Specifies desirable color space of the output image. By default, preserves the color space of the original image."}},"additionalProperties":false},"ColorSpaceEnum":{"title":"Type of color space","enum":["RGB","CMYK"],"type":"string","description":"Selects the type of color space: \n\n| Value | Description |\n| --- | --- |\n| `\"RGB\"` | Is the color space for digital images. Use the RGB color mode if your image is supposed to be displayed on any kind of screen.|\n| `\"CMYK\"` | Is the color space for printed materials. Use CMYK for any image that will be physically printed, not viewed on a screen.|\n"},"RGBColorSpaceOptions":{"title":"RGBColorSpaceOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["RGB"],"type":"string"}},"additionalProperties":false},"CMYKColorSpaceOptions":{"title":"CMYKColorSpaceOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["CMYK"],"type":"string"},"color_profile":{"allOf":[{"$ref":"#/components/schemas/CMYKColorProfileEnum"}],"description":"Specifies color profile that will be used for color space. \n\nSelects the type of color space profile: \n\n| Value | Description | Paper | Max. total ink (TAC) | Characterisation data | \n| --- | --- | --- | --- | --- |\n| `\"ISO_Coated\"` | (Coated FOGRA39, ISO 12647-2:2004) Is used by default. Standard for glossy and matte coated paper. | Grades 1 and 2, gloss and matte coated. | 330% | FOGRA39 |\n| `\"ISO_Uncoated\"` | (Uncoated FOGRA29, ISO 12647-2:2004) Standard for uncoated white natural paper. | Grade 4, uncoated white offset. | 300% | FOGRA29 |\n| `\"USWeb_Coated\"` | (SWOP2006_Coated3v2) Standard for glossy and matte coated paper in the United States. | Grades 1, 2 and 3 gloss coated, matte coated and uncoated paper. | 300% | CGATS TR003 |\n| `\"USWeb_Uncoated\"` | (GRACoL 2013 Uncoated) Standard for uncoated white natural paper in the United States. | Grade 4, uncoated white offset. | 260% |  CGATS21-2-CRPC3 |\n","default":"USWeb_Coated"}},"additionalProperties":false},"CMYKColorProfileEnum":{"title":"Type of color space","enum":["ISO_Coated","ISO_Uncoated","USWeb_Coated","USWeb_Uncoated"],"type":"string","description":"Selects the type of color space profile: \n\n| Value | Description | Paper | Max. total ink (TAC) | Characterisation data | \n| --- | --- | --- | --- | --- |\n| `\"ISO_Coated\"` | (Coated FOGRA39, ISO 12647-2:2004) Is used by default. Standard for glossy and matte coated paper. | Grades 1 and 2, gloss and matte coated. | 330% | FOGRA39 |\n| `\"ISO_Uncoated\"` | (Uncoated FOGRA29, ISO 12647-2:2004) Standard for uncoated white natural paper. | Grade 4, uncoated white offset. | 300% | FOGRA29 |\n| `\"USWeb_Coated\"` | (SWOP2006_Coated3v2) Standard for glossy and matte coated paper in the United States. | Grades 1, 2 and 3 gloss coated, matte coated and uncoated paper. | 300% | CGATS TR003 |\n| `\"USWeb_Uncoated\"` | (GRACoL 2013 Uncoated) Standard for uncoated white natural paper in the United States. | Grade 4, uncoated white offset. | 260% |  CGATS21-2-CRPC3 |\n"},"AsyncEditRequest":{"title":"AsyncEditRequest","required":["input","operations"],"type":"object","properties":{"input":{"title":"Input URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the input image. Should be from 1 to 512 characters. Image must be accessible by our system.","format":"uri"},"operations":{"title":"Operations","allOf":[{"$ref":"#/components/schemas/ImageOperations"}],"description":"Customize the editing workflow so that the output images meet your requirements."},"output":{"title":"Output","anyOf":[{"$ref":"#/components/schemas/ImageOutputOptions"},{"type":"string","minLength":1,"maxLength":4096,"format":"uri"}],"description":"Customize the result output.","default":{"format":"jpeg"}}},"additionalProperties":false},"BatchPipelineError":{"title":"BatchPipelineError","required":["error","created_at"],"type":"object","properties":{"error":{"title":"Error","type":"string"},"created_at":{"title":"Created At","type":"string"},"input_object":{"$ref":"#/components/schemas/PipelineInputObjectInError"}}},"PipelineInputObjectInError":{"title":"PipelineInputObjectInError","required":["ext","mps","mime","format","width","height"],"type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension. Can have values: `\"jpg\"`, `\"png\"`, `\"avif\"`"},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as ‘media type’)"},"format":{"title":"Format","type":"string","description":"File format. Can have values: `\"jpeg\"`, `\"png\"`, `\"avif\"`"},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"}}},"AsyncPipelineResultItem":{"title":"AsyncPipelineResultItem","required":["input_object","output_object"],"type":"object","properties":{"input_object":{"$ref":"#/components/schemas/PipelineInputObject"},"output_object":{"$ref":"#/components/schemas/PipelineOutputObject"}}},"PipelineInputObject":{"title":"PipelineInputObject","required":["ext","mps","mime","format","width","height"],"type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension. Can have values: `\"jpg\"`, `\"png\"`, `\"avif\"`"},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as ‘media type’)"},"format":{"title":"Format","type":"string","description":"File format. Can have values: `\"jpeg\"`, `\"png\"`, `\"avif\"`"},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"}}},"PipelineOutputObject":{"title":"PipelineOutputObject","required":["ext","mps","mime","format","width","height"],"type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension. Can have values: `\"jpg\"`, `\"png\"`, `\"avif\"`"},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as ‘media type’)"},"format":{"title":"Format","type":"string","description":"File format. Can have values: `\"jpeg\"`, `\"png\"`, `\"avif\"`"},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"},"tmp_url":{"title":"Tmp Url","type":"string","description":"Temporal URL of a processed image"},"object_key":{"title":"Object Key","type":"string","description":"Path to a processed image in a bucket"},"object_bucket":{"title":"Object Bucket","type":"string","description":"Bucket name"},"object_uri":{"title":"Object Uri","type":"string","description":"URI of a processed image in a bucket"},"claid_storage_uri":{"title":"Claid Storage Uri","type":"string","description":"URI of a processed image in a storage"}}},"HttpErrorDetails":{"title":"HttpErrorDetails","required":["error_code","error_type","error_message"],"type":"object","properties":{"error_code":{"title":"Error Code","type":"string"},"error_type":{"$ref":"#/components/schemas/ErrorType"},"error_message":{"title":"Error Message","type":"string"},"error_details":{"title":"Error Details","type":"object","default":{}}}},"ErrorType":{"title":"ErrorType","enum":["auth","dlvr","general","le","survey","storage","image","user_settings","user","validation","analytics","scene","billing","web","runtime_settings","animation","custom_models"],"type":"string","description":"An enumeration."}}},"paths":{"/v1/image/edit/batch/{task_id}":{"get":{"tags":["Image"],"summary":"Image Edit Batch Async Results","operationId":"image_edit_batch_async_results_v1_image_edit_batch__task_id__get","parameters":[{"required":true,"schema":{"title":"Task Id","type":"integer"},"name":"task_id","in":"path"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response_BatchResultResponse_"}}}},"401":{"description":"Authorization is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"403":{"description":"Not enough permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"404":{"description":"Batch image edit pipeline not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"422":{"description":"Unprocessable Entity.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}}}}}}}
```

#### **Request**

{% tabs %}
{% tab title="HTTP" %}

```http
GET /v1/image/edit/batch/1 HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl -X GET --location "https://api.claid.ai/v1/image/edit/batch/1" --http1.1 \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}"
```

{% endtab %}
{% endtabs %}

#### **Read a response**

Once you have made the request to <mark style="color:purple;">`https://api.claid.ai/v1/image/edit/batch/<task_id>`</mark> you will get a response with information about the request, input, and output images.

Image information shown in the response:

<table><thead><tr><th width="153">Parameter</th><th width="109.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>integer</td><td>Task ID.</td></tr><tr><td>status</td><td>string</td><td>Request processing status. Can have values: <mark style="color:purple;"><code>ACCEPTED</code></mark>, <mark style="color:purple;"><code>PROCESSING</code></mark>, <mark style="color:purple;"><code>ERROR</code></mark>, <mark style="color:purple;"><code>DONE</code></mark>.</td></tr><tr><td>created_at</td><td>string</td><td>Exact time when the processing was requested.</td></tr><tr><td>request</td><td>object</td><td>The body of the request that was used for processing.</td></tr><tr><td>errors</td><td>list </td><td>List of errors, if any are occurred during image processing (<mark style="color:purple;"><code>status</code></mark> will have <mark style="color:purple;"><code>ERROR</code></mark> value), in other cases - will be empty.</td></tr><tr><td>results</td><td>list</td><td>List of results in form of <mark style="color:purple;"><code>input_object</code></mark> and <mark style="color:purple;"><code>output_object</code></mark> pairs, in case of processing errors - will be empty. Details are listed below.</td></tr></tbody></table>

See <mark style="color:purple;">`input_object`</mark> and <mark style="color:purple;">`output_object`</mark> properties description at the [Read a response](/image-editing-api/async-api-reference#read-a-response-1) part of the [Async endpoint](/image-editing-api/async-api-reference) page.&#x20;

#### **Response body**

```json
{
  "data": {
    "id": 1,
    "status": "DONE",
    "created_at": "2023-03-13T11:37:09.160554+00:00",
    "request": {
      "input": "storage://storage_1/input_folder/",
      "operations": {
        "resizing": {
            "width": 1000
        },
        "background": {
            "remove": false
        }
      },
      "output": "storage://storage_1/output_folder/"
    },
    "errors": [],
    "results": [
      {
        "input_object": {
          "ext": "pnj",
          "mps": 0.04,
          "mime": "image/jpeg",
          "format": "JPEG",
          "width": 200,
          "height": 200
        },
        "output_object": {
          "ext": "jpeg",
          "mps": 1.0,
          "mime": "image/jpeg",
          "format": "JPEG",
          "width": 1000,
          "height": 1000
        }
      },
      {
        "input_object": {
          "ext": "pnj",
          "mps": 0.09,
          "mime": "image/jpeg",
          "format": "JPEG",
          "width": 300,
          "height": 300
        },
        "output_object": {
          "ext": "jpeg",
          "mps": 1.0,
          "mime": "image/jpeg",
          "format": "JPEG",
          "width": 1000,
          "height": 1000
        }
      }
    ]
  }
}
```

See [Response headers](/image-editing-api/api-reference#response-headers) to learn about headers.


# Upload API Reference

This section explains how to upload an image for editing by sending a direct request to our API.

## Uploading an image for editing via API

Image upload endpoint allows you to upload an image directly from your computer or server for editing, instead of providing an image URL.

To upload an image, attach an image file as body part of <mark style="color:purple;">`multipart/form-data`</mark>. The other body part of <mark style="color:purple;">`multipart/form-data`</mark> should be the same as JSON for a regular image editing request, except there is no <mark style="color:purple;">`input`</mark> image URL option there. See [Image edit contract](/image-editing-api/api-reference#image-edit-contract) for more info.

## Image Edit Upload

> Specifies: \
> \- how the image will be processed (\`operations\`)\
> \- where it will be stored (\`output\`)

```json
{"openapi":"3.1.0","info":{"title":"Claid REST API","version":"v1"},"tags":[{"name":"Image","description":"Encompasses operations with images."}],"security":[{"OAuth2PasswordBearer":[]},{"OAuth2PasswordBearer":["image_editing"]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}},"description":"To work with the Claid API, send requests over HTTPS and authenticate using the `Authorization` header in the following format:`Authorization: Bearer <YOUR_API_KEY>`. You do not need to provide a password.\n\nTo get your API key, [sign in to your Claid account](https://claid.ai/login) and click ***Create API key*** button from the ***Overview*** or ***API keys*** pages.\n\nClaid API’s base URL is `https://api.claid.ai/v1/`. All available endpoints are listed in the [Storage](#tag/Storage) and [Image](#tag/Image) sections. \n\n## Bearer\n\nThis API uses OAuth 2.0 [bearer token](https://datatracker.ietf.org/doc/html/rfc6750) (API key) to authorize requests."}},"schemas":{"Body_image_edit_upload_v1_image_edit_upload_post":{"title":"Body_image_edit_upload_v1_image_edit_upload_post","required":["file","data"],"type":"object","properties":{"file":{"title":"File","type":"string","format":"binary"},"data":{"title":"Data","type":"string"}}},"Response_EditResponse_":{"title":"Response[EditResponse]","type":"object","properties":{"data":{"$ref":"#/components/schemas/EditResponse"}},"description":"Wrapper for responses"},"EditResponse":{"title":"EditResponse","required":["input","output"],"type":"object","properties":{"input":{"$ref":"#/components/schemas/PipelineInputObject"},"output":{"$ref":"#/components/schemas/PipelineOutputObject"},"profiling":{"title":"Profiling","type":"object"}}},"PipelineInputObject":{"title":"PipelineInputObject","required":["ext","mps","mime","format","width","height"],"type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension. Can have values: `\"jpg\"`, `\"png\"`, `\"avif\"`"},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as ‘media type’)"},"format":{"title":"Format","type":"string","description":"File format. Can have values: `\"jpeg\"`, `\"png\"`, `\"avif\"`"},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"}}},"PipelineOutputObject":{"title":"PipelineOutputObject","required":["ext","mps","mime","format","width","height"],"type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension. Can have values: `\"jpg\"`, `\"png\"`, `\"avif\"`"},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as ‘media type’)"},"format":{"title":"Format","type":"string","description":"File format. Can have values: `\"jpeg\"`, `\"png\"`, `\"avif\"`"},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"},"tmp_url":{"title":"Tmp Url","type":"string","description":"Temporal URL of a processed image"},"object_key":{"title":"Object Key","type":"string","description":"Path to a processed image in a bucket"},"object_bucket":{"title":"Object Bucket","type":"string","description":"Bucket name"},"object_uri":{"title":"Object Uri","type":"string","description":"URI of a processed image in a bucket"},"claid_storage_uri":{"title":"Claid Storage Uri","type":"string","description":"URI of a processed image in a storage"}}},"HttpErrorDetails":{"title":"HttpErrorDetails","required":["error_code","error_type","error_message"],"type":"object","properties":{"error_code":{"title":"Error Code","type":"string"},"error_type":{"$ref":"#/components/schemas/ErrorType"},"error_message":{"title":"Error Message","type":"string"},"error_details":{"title":"Error Details","type":"object","default":{}}}},"ErrorType":{"title":"ErrorType","enum":["auth","dlvr","general","le","survey","storage","image","user_settings","user","validation","analytics","scene","billing","web","runtime_settings","animation","custom_models"],"type":"string","description":"An enumeration."}}},"paths":{"/v1/image/edit/upload":{"post":{"tags":["Image"],"summary":"Image Edit Upload","description":"Specifies: \n- how the image will be processed (`operations`)\n- where it will be stored (`output`)","operationId":"image_edit_upload_v1_image_edit_upload_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_image_edit_upload_v1_image_edit_upload_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response_EditResponse_"}}}},"401":{"description":"Authorization is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"402":{"description":"No API calls left.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"403":{"description":"Not enough permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"422":{"description":"Unprocessable Entity.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}}}}}}}
```

#### **Request**

{% tabs %}
{% tab title="HTTP" %}

```http
POST /v1/image/edit/upload HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
Content-Type: multipart/form-data; boundary="boundary"

--boundary
Content-Disposition: form-data; name="file"; filename="the_image"

< ./the_image.jpg

--boundary
Content-Disposition: form-data; name="data"
Content-Type: application/json

{
  "operations": {
    "resizing": {
      "width": 1000
    },
    "background": {
      "remove": false
    }
  }
}

--boundary--
```

{% endtab %}

{% tab title="cURL" %}

<pre class="language-shell"><code class="lang-shell"><strong>curl -X POST --location "https://api.claid.ai/v1/image/edit/upload" --http1.1 \
</strong>    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}" \
    -H "Content-Type:multipart/form-data" \
    -F "file=@./the_image.jpg;filename=the_image.jpg" \
    -F "data={\"operations\":{\"resizing\":{\"width\":1000},\"background\":{\"remove\":false}}};type=application/json"
</code></pre>

{% endtab %}
{% endtabs %}

#### Request headers

```http
Content-Type: multipart/form-data; boundary="boundary"
Authorization: Bearer {YOUR_API_KEY}
```

In order to send a request, you should set a <mark style="color:purple;">`Content-Type`</mark> header to let our system know that you are providing a valid form data payload and an <mark style="color:purple;">`Authorization`</mark> header with a generated API key to [identify yourself](/authentication) as a Claid user.

The form data payload should have two blocks of data (body parts), with a delimiter (boundary) separating each block.

The block with an image file should have a <mark style="color:purple;">`Content-Disposition`</mark> header equal to <mark style="color:purple;">`form-data`</mark> with two required keys: a <mark style="color:purple;">`name`</mark> key with a value equal to <mark style="color:purple;">`file`</mark> and a <mark style="color:purple;">`filename`</mark> key that will be assigned to an output result image (it is better not to include the extension in a <mark style="color:purple;">`filename`</mark>, as it can be overwritten by [Output options](/image-editing-api/image-i-o#output-image-file-types)).

```http
Content-Disposition: form-data; name="file"; filename="the_image"
```

The block with edit operations should have two headers: a <mark style="color:purple;">`Content-Disposition`</mark> header equal to <mark style="color:purple;">`form-data`</mark> with a <mark style="color:purple;">`name`</mark> key with a value equal to <mark style="color:purple;">`data`</mark> and a <mark style="color:purple;">`Content-Type`</mark> header to let our system know that you are providing a valid JSON payload.

```http
Content-Disposition: form-data; name="data"
Content-Type: application/json
```

#### **Response body and headers**

The response body and headers is equal to response body and headers of regular image edit request. See the [Read a response](/image-editing-api/api-reference#read-a-response) and [Response Headers](/image-editing-api/api-reference#response-headers) to learn more.


# Image AI Edit I/O

### Intro

With the Image AI Edit API, you can alter an image with just a single prompt.

**Cost**

* 2 credits per 1 output image.

**Rate limits**

* 1 generation per 1 second.
* 60 generations per 1 minute.

### Input

Our API supports several options to provide source images that need to be processed.

#### HTTP(S) URL

URL of the input image should be from 1 to 512 characters. The image must be accessible by our system.

```json
{
    "input": "https://letsenhance.io/docs/assets/samples/burger.jpg"
}
```

#### Connected storage

You can connect [Cloud Storage](/storage-connectors/overview) and use it as a source for images. Currently, our API supports AWS S3 and Google Cloud Storage.

After connecting your Cloud Storage, you can refer the storage name as an input.

```json
{
    "input": "storage://storage-name/path/image-name.jpg"
}
```

#### Input image file types

Our API supports the following image formats as inputs: JPEG, PNG, WEBP, AVIF and HEIC.

### Output

Configuration of result output is optional.&#x20;

By default, you may omit the output option from the request payload. In this case, our system stores the result in a temporary bucket with a lifespan of 24 hours and provides a public URL to the image.

Alternatively, you can use a connected [Cloud Storage](/storage-connectors/overview): just configure the path to the folder where you want to store results.

#### Output image file types

The following image formats are supported for the output: JPEG and PNG. Default is PNG.

#### Output number of images

The API supports from 1 to 4 output images. Default is 1 image per request.

#### Basic and advanced output options

{% tabs %}
{% tab title="Basic Usage" %}

```json
{
    "output": "storage://storage-name/result-path/image-name.jpg"
}
```

{% endtab %}

{% tab title="Advanced Usage" %}

<pre class="language-json"><code class="lang-json">{
    "output": {
<strong>        "destination": "storage://storage-name/result-path/image-name.jpg",
</strong>        "format": "jpeg",
        "number_of_images": 1
    }
}
</code></pre>

{% endtab %}
{% endtabs %}


# Image AI Edit Options

Modify images using natural language instructions.

### Model

The API offers two models. We recommend `v2` for most production use cases due to its superior quality and speed.

<table><thead><tr><th width="112.3333740234375">Model</th><th>Description</th></tr></thead><tbody><tr><td><code>v2</code></td><td><strong>Recommended</strong>. Our latest model: native 2K resolution, faster, more accurate prompt following, better texture realism and product preservation.</td></tr><tr><td><code>v1</code></td><td>Older model retained for workflows requiring custom aspect ratio.</td></tr></tbody></table>

`v2` model is used by default.

```json
"options": {
  "model": "v2",
  "prompt": "add a duck"
}
```

### Prompt <a href="#upscale" id="upscale"></a>

The prompt is a text description that guides the AI on how to edit the image. It tells the AI what new elements to add or what changes to make.

```json
"options": {
  "prompt": "add a duck"
}
```

### Inference Steps

{% hint style="warning" %}
The choice of inference steps is only supported for the `v1` model.
{% endhint %}

Inference steps controls the number of steps the AI takes to refine the image. A higher number of steps can produce more detailed and higher-quality images but will also increase the processing time.

<pre class="language-json"><code class="lang-json">"options": {
<strong>  "model": "v1",
</strong>  "prompt": "add a duck",
  "inference_steps": 50
}
</code></pre>

### Guidance Scale

{% hint style="warning" %}
The choice of guidance scale is only supported for the `v1` model.
{% endhint %}

The guidance scale determines how closely the AI should follow the instructions in your prompt. A higher value means the AI will stick more strictly to your prompt, while a lower value allows the AI to be more creative and generate a more diverse result.

```json
"options": {
  "model": "v1",
  "prompt": "add a duck",
  "guidance_scale": 4.0
}
```

### Aspect Ratio

{% hint style="warning" %}
The choice of aspect ratio is only supported for the `v1` model.
{% endhint %}

The aspect ratio defines the final dimensions of the edited image. This parameter is used to crop and resize the output to a specific width-to-height ratio. The API supports various common aspect ratios.

```json
"options": {
  "model": "v1",
  "prompt": "add a duck",
  "aspect_ratio": "1:1"
}
```

By default, the aspect ratio is the same as an input image. But you can change it to any of the following values:

| Aspect ratio | Output size |
| ------------ | ----------- |
| 1:1          | 1024x1024px |
| 2:3          | 832x1248px  |
| 3:2          | 1248x832px  |
| 3:4          | 880x1168px  |
| 4:3          | 1168x880px  |
| 9:16         | 768x1360px  |
| 16:9         | 1360x768px  |
| 9:21         | 656x1552px  |
| 21:9         | 1552x656px  |

### Possible values

| Parameter         | Type    | Range           | Default value      |
| ----------------- | ------- | --------------- | ------------------ |
| `model`           | string  | `"v1"` , `"v2"` | `"v2"`             |
| `prompt`          | string  | 3-5000          | **required**       |
| `inference_steps` | integer | 1-50            | depends on a model |
| `guidance_scale`  | float   | 1.0-10.0        | depends on a model |
| `aspect_ratio`    | string  | "1:1".."21:9"   | same as input      |


# Async API Reference

### Image AI Edit contract

This endpoint is asynchronous, it returns a response without waiting for an actual result. The actual result should be queried with another request. Or received by a webhook notification, see [Webhook notification](/image-editing-api/async-api-reference#webhook-notification) for more info.

```json
{
  "input": "storage://storage-name/input-path/input.png",
  "output": {
    "destination": "storage://storage-name/result-path/image-name.jpg",
    "format": "png",
    "number_of_images": 1
  },
  "options": {
    "model": "v1" | "v2",
    "prompt": "add a duck",
    "inference_steps": 50,
    "guidance_scale": 4.0,
    "aspect_ratio": "1:1"
  }
}
```

See [Image AI Edit I/O](/image-ai-edit-api/image-ai-edit-i-o) and [Image AI Edit Options](/image-ai-edit-api/image-ai-edit-options) learn about request data.

## Async Ai Edit Generation Api

> AI Edit

```json
{"openapi":"3.1.0","info":{"title":"Claid REST API","version":"v1"},"tags":[{"name":"Image","description":"Encompasses operations with images."}],"security":[{"OAuth2PasswordBearer":["image_editing"]},{"OAuth2PasswordBearer":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}},"description":"To work with the Claid API, send requests over HTTPS and authenticate using the `Authorization` header in the following format:`Authorization: Bearer <YOUR_API_KEY>`. You do not need to provide a password.\n\nTo get your API key, [sign in to your Claid account](https://claid.ai/login) and click ***Create API key*** button from the ***Overview*** or ***API keys*** pages.\n\nClaid API’s base URL is `https://api.claid.ai/v1/`. All available endpoints are listed in the [Storage](#tag/Storage) and [Image](#tag/Image) sections. \n\n## Bearer\n\nThis API uses OAuth 2.0 [bearer token](https://datatracker.ietf.org/doc/html/rfc6750) (API key) to authorize requests."}},"schemas":{"AiEditAPIRequest":{"title":"AiEditAPIRequest","required":["input","options"],"type":"object","properties":{"output":{"title":"Output","anyOf":[{"$ref":"#/components/schemas/AIEditRequestOutputObject"},{"type":"string","minLength":1,"maxLength":4096,"format":"uri"}],"description":"Customize output format, destination and number of images.","default":{"number_of_images":1,"format":"png"}},"input":{"title":"Input URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the input image. Image must be accessible by our system.","format":"uri"},"options":{"title":"Options","allOf":[{"$ref":"#/components/schemas/AiEditRequestOptionsObject"}],"description":"Customize the generation."}},"additionalProperties":false},"AIEditRequestOutputObject":{"title":"AIEditRequestOutputObject","type":"object","properties":{"number_of_images":{"title":"Number of images","maximum":4,"minimum":1,"type":"integer","description":"Number of output images.","default":1},"destination":{"title":"Destination","maxLength":4096,"minLength":1,"type":"string","description":"Customize the result output.","format":"uri"},"format":{"allOf":[{"$ref":"#/components/schemas/AiEditFormatEnum"}],"description":"Output image format.","default":"png"}},"additionalProperties":false},"AiEditFormatEnum":{"title":"AiEditFormatEnum","enum":["jpeg","png"],"type":"string","description":"An enumeration."},"AiEditRequestOptionsObject":{"title":"AiEditRequestOptionsObject","required":["prompt"],"type":"object","properties":{"model":{"allOf":[{"$ref":"#/components/schemas/AIEditModelAPI"}],"description":"Model to be used for generation.","default":"v2"},"prompt":{"title":"Prompt","maxLength":5000,"minLength":3,"type":"string","description":"Prompt for the generation."},"aspect_ratio":{"allOf":[{"$ref":"#/components/schemas/AiEditAspectRatio"}],"description":"Aspect ratio of the generated images."},"inference_steps":{"title":"Inference Steps","maximum":50,"minimum":1,"type":"integer","description":"Number of inference steps."},"guidance_scale":{"title":"Guidance Scale","maximum":10,"minimum":1,"type":"number","description":"Guidance scale for the generation."}},"additionalProperties":false},"AIEditModelAPI":{"title":"AIEditModelAPI","enum":["v1","v2"],"type":"string","description":"An enumeration."},"AiEditAspectRatio":{"title":"AiEditAspectRatio","enum":["1:1","2:3","3:2","3:4","4:3","9:16","16:9","9:21","21:9"],"type":"string","description":"An enumeration."},"Response_AiEditAcceptedResponse_":{"title":"Response[AiEditAcceptedResponse]","type":"object","properties":{"data":{"$ref":"#/components/schemas/AiEditAcceptedResponse"}},"description":"Wrapper for responses"},"AiEditAcceptedResponse":{"title":"AiEditAcceptedResponse","required":["id","status","created_at","request","result_url"],"type":"object","properties":{"id":{"title":"Id","type":"integer"},"status":{"$ref":"#/components/schemas/APIV1Status"},"created_at":{"title":"Created At","type":"string","format":"date-time"},"request":{"title":"Request","type":"object"},"result_url":{"title":"Result Url","maxLength":65536,"minLength":1,"type":"string","format":"uri"}}},"APIV1Status":{"title":"APIV1Status","enum":["ACCEPTED","WAITING","PROCESSING","DONE","ERROR","CANCELLED","PAUSED"],"type":"string","description":"An enumeration."},"HttpErrorDetails":{"title":"HttpErrorDetails","required":["error_code","error_type","error_message"],"type":"object","properties":{"error_code":{"title":"Error Code","type":"string"},"error_type":{"$ref":"#/components/schemas/ErrorType"},"error_message":{"title":"Error Message","type":"string"},"error_details":{"title":"Error Details","type":"object","default":{}}}},"ErrorType":{"title":"ErrorType","enum":["auth","dlvr","general","le","survey","storage","image","user_settings","user","validation","analytics","scene","billing","web","runtime_settings","animation","custom_models"],"type":"string","description":"An enumeration."}}},"paths":{"/v1/image/ai-edit":{"post":{"tags":["Image"],"summary":"Async Ai Edit Generation Api","description":"AI Edit","operationId":"async_ai_edit_generation_api_v1_image_ai_edit_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiEditAPIRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response_AiEditAcceptedResponse_"}}}},"401":{"description":"Authorization is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"402":{"description":"No API calls left.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"403":{"description":"Not enough permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"422":{"description":"Unprocessable Entity.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}}}}}}}
```

#### **Request**

{% tabs %}
{% tab title="HTTP" %}

```http
POST /v1/image/ai-edit HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
Content-Type: application/json

{
  "input": "https://picsum.photos/500",
  "options": {
    "prompt": "add a duck"
  }
}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl -X POST --location "https://api.claid.ai/v1/image/ai-edit" --http1.1 \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}" \
    -H "Content-Type: application/json" \
    -d "{
          \"input\": \"https://picsum.photos/500\",
          \"options\": {
            \"prompt\": \"add a duck\"
          }
        }"
```

{% endtab %}
{% endtabs %}

#### **Read a response**

Once you have made the request to <mark style="color:purple;">`https://api.claid.ai/v1/image/ai-edit`</mark> you will get a response with information about request status and some other details (listed below).

Request information shown in the response:

<table><thead><tr><th width="154">Parameter</th><th width="109.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>integer</td><td>Task ID.</td></tr><tr><td>status</td><td>string</td><td>Request processing status. For a valid request can only have one value: <mark style="color:purple;"><code>ACCEPTED</code></mark>.</td></tr><tr><td>result_url</td><td>string</td><td>URL of GET endpoint that can be used to get the result manually and get request status while it is still in process.</td></tr><tr><td>created_at</td><td>string</td><td>Exact time when the processing was requested.</td></tr><tr><td>request</td><td>object</td><td>The body of the request that was used for processing.</td></tr></tbody></table>

#### **Response body**

```json
{
  "data": {
    "id": 1,
    "status": "ACCEPTED",
    "result_url": "https://api.claid.ai/v1/image/ai-edit/1",
    "created_at": "2025-03-13T11:37:09.160554+00:00",
    "request": {
      "input": "https://picsum.photos/500",
      "options": {
        "prompt": "add a duck"
      }
    }
  }
}
```

See the [Request Headers](/image-editing-api/api-reference#request-headers) and [Response Headers](/image-editing-api/api-reference#response-headers) to learn about headers.

### Webhook notification

See [Webhook notification](/image-editing-api/async-api-reference#webhook-notification) to learn about webhook handling.

### Result of request processing contract

To get image editing result, you need to know the ID of the processing request. Or you can take a ready-to-use link from the <mark style="color:purple;">`result_url`</mark> property of the response body described above.

## Async Ai Edit Generation Api Status

> Get AI Edit generation result

```json
{"openapi":"3.1.0","info":{"title":"Claid REST API","version":"v1"},"tags":[{"name":"Image","description":"Encompasses operations with images."}],"security":[{"OAuth2PasswordBearer":["image_editing"]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}},"description":"To work with the Claid API, send requests over HTTPS and authenticate using the `Authorization` header in the following format:`Authorization: Bearer <YOUR_API_KEY>`. You do not need to provide a password.\n\nTo get your API key, [sign in to your Claid account](https://claid.ai/login) and click ***Create API key*** button from the ***Overview*** or ***API keys*** pages.\n\nClaid API’s base URL is `https://api.claid.ai/v1/`. All available endpoints are listed in the [Storage](#tag/Storage) and [Image](#tag/Image) sections. \n\n## Bearer\n\nThis API uses OAuth 2.0 [bearer token](https://datatracker.ietf.org/doc/html/rfc6750) (API key) to authorize requests."}},"schemas":{"Response_AiEditResultResponse_":{"title":"Response[AiEditResultResponse]","type":"object","properties":{"data":{"$ref":"#/components/schemas/AiEditResultResponse"}},"description":"Wrapper for responses"},"AiEditResultResponse":{"title":"AiEditResultResponse","required":["id","status","created_at","request"],"type":"object","properties":{"id":{"title":"Id","type":"integer"},"status":{"$ref":"#/components/schemas/APIV1Status"},"created_at":{"title":"Created At","type":"string","format":"date-time"},"request":{"title":"Request","type":"object"},"errors":{"title":"Errors","type":"array","items":{"$ref":"#/components/schemas/AiEditError"}},"result":{"$ref":"#/components/schemas/AiEditResult"}}},"APIV1Status":{"title":"APIV1Status","enum":["ACCEPTED","WAITING","PROCESSING","DONE","ERROR","CANCELLED","PAUSED"],"type":"string","description":"An enumeration."},"AiEditError":{"title":"AiEditError","required":["error","created_at"],"type":"object","properties":{"error":{"title":"Error","type":"string"},"created_at":{"title":"Created At","type":"string","format":"date-time"}}},"AiEditResult":{"title":"AiEditResult","required":["input_object","output_objects"],"type":"object","properties":{"input_object":{"$ref":"#/components/schemas/AiEditImageObject"},"output_objects":{"title":"Output Objects","type":"array","items":{"$ref":"#/components/schemas/AiEditOutputImageObject"}}}},"AiEditImageObject":{"title":"AiEditImageObject","type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension."},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as 'media type')"},"format":{"title":"Format","type":"string","description":"File format."},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"}}},"AiEditOutputImageObject":{"title":"AiEditOutputImageObject","type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension."},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as 'media type')"},"format":{"title":"Format","type":"string","description":"File format."},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"},"tmp_url":{"title":"Tmp Url","type":"string","description":"Temporal URL of a processed image"},"object_key":{"title":"Object Key","type":"string","description":"Path to a processed image in a bucket"},"object_bucket":{"title":"Object Bucket","type":"string","description":"Bucket name"},"object_uri":{"title":"Object Uri","type":"string","description":"URI of a processed image in a bucket"},"claid_storage_uri":{"title":"Claid Storage Uri","type":"string","description":"URI of a processed image in a storage"}}},"HttpErrorDetails":{"title":"HttpErrorDetails","required":["error_code","error_type","error_message"],"type":"object","properties":{"error_code":{"title":"Error Code","type":"string"},"error_type":{"$ref":"#/components/schemas/ErrorType"},"error_message":{"title":"Error Message","type":"string"},"error_details":{"title":"Error Details","type":"object","default":{}}}},"ErrorType":{"title":"ErrorType","enum":["auth","dlvr","general","le","survey","storage","image","user_settings","user","validation","analytics","scene","billing","web","runtime_settings","animation","custom_models"],"type":"string","description":"An enumeration."},"HTTPValidationError":{"title":"HTTPValidationError","type":"object","properties":{"detail":{"title":"Detail","type":"array","items":{"$ref":"#/components/schemas/ValidationError"}}}},"ValidationError":{"title":"ValidationError","required":["loc","msg","type"],"type":"object","properties":{"loc":{"title":"Location","type":"array","items":{"type":"string"}},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}}}}},"paths":{"/v1/image/ai-edit/{ai_edit_id}":{"get":{"tags":["Image"],"summary":"Async Ai Edit Generation Api Status","description":"Get AI Edit generation result","operationId":"async_ai_edit_generation_api_status_v1_image_ai_edit__ai_edit_id__get","parameters":[{"required":true,"schema":{"title":"Ai Edit Id","type":"integer"},"name":"ai_edit_id","in":"path"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response_AiEditResultResponse_"}}}},"401":{"description":"Authorization is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"403":{"description":"Not enough permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"404":{"description":"Web image not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

#### **Request**

{% tabs %}
{% tab title="HTTP" %}

```http
GET /v1/image/ai-edit/1 HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl -X GET --location "https://api.claid.ai/v1/image/ai-edit/1" --http1.1 \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}"
```

{% endtab %}
{% endtabs %}

#### **Read a response**

Once you have made the request to <mark style="color:purple;">`https://api.claid.ai/v1/image/ai-edit/<task_id>`</mark> you will get a response with information about the request, input and output images.

Image information shown in the response:

<table><thead><tr><th width="153">Parameter</th><th width="109.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>integer</td><td>Task ID.</td></tr><tr><td>status</td><td>string</td><td>Request processing status. Can have values: <mark style="color:purple;"><code>ACCEPTED</code></mark>, <mark style="color:purple;"><code>PROCESSING</code></mark>, <mark style="color:purple;"><code>ERROR</code></mark>, <mark style="color:purple;"><code>DONE</code></mark>.</td></tr><tr><td>created_at</td><td>string</td><td>Exact time when the processing was requested.</td></tr><tr><td>request</td><td>object</td><td>The body of the request that was used for processing.</td></tr><tr><td>errors</td><td>list </td><td>List of errors, if any are occurred during image processing (<mark style="color:purple;"><code>status</code></mark> will have <mark style="color:purple;"><code>ERROR</code></mark> value), in other cases - will be empty.</td></tr><tr><td>result</td><td>object</td><td>Result object that is contain 2 properties <mark style="color:purple;"><code>input_object</code></mark> and <mark style="color:purple;"><code>output_objects</code></mark>, in case of processing errors - will be empty. Details are listed below.</td></tr></tbody></table>

Read a <mark style="color:purple;">`input_object`</mark> and <mark style="color:purple;">`output_objects`</mark> properties of response <mark style="color:purple;">`result`</mark> property:

<table><thead><tr><th width="151">Parameter</th><th width="112.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>ext</td><td>string</td><td>File extension. Can have values: <mark style="color:purple;"><code>jpg</code></mark>, <mark style="color:purple;"><code>png</code></mark>.</td></tr><tr><td>mps</td><td>float</td><td>Megapixel count.</td></tr><tr><td>mime</td><td>string</td><td>MIME type (also known as ‘media type’).</td></tr><tr><td>width</td><td>integer</td><td>Image width in pixels.</td></tr><tr><td>height</td><td>integer</td><td>Image height in pixels.</td></tr><tr><td>format</td><td>string</td><td>File format. Can have values: <mark style="color:purple;"><code>jpeg</code></mark>, <mark style="color:purple;"><code>png</code></mark>.</td></tr><tr><td>tmp_url</td><td>string</td><td>Temporary URL of a processed image. Is available only for <mark style="color:purple;"><code>output_objects</code></mark>.</td></tr></tbody></table>

Read an item from <mark style="color:purple;">`errors`</mark> property:

<table><thead><tr><th width="151">Parameter</th><th width="112.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>error</td><td>string</td><td>Error message in text.</td></tr><tr><td>created_at</td><td>integer</td><td>Exact time when the error was catched.</td></tr></tbody></table>

#### **Response body**

```json
{
  "data": {
    "id": 1,
    "status": "DONE",
    "created_at": "2025-03-13T11:37:09.160554+00:00",
    "request": {
      "input": "https://picsum.photos/500",
      "options": {
        "prompt": "add a duck"
      }
    },
    "errors": [],
    "result": {
      "input_object": {
        "ext": "jpeg",
        "mps": 0.5,
        "mime": "image/jpeg",
        "format": "JPEG",
        "width": 500,
        "height": 500
      },
      "output_objects": [
        {
          "ext": "jpeg",
          "mps": 1.0,
          "mime": "image/jpeg",
          "format": "JPEG",
          "width": 1024,
          "height": 1024,
          "tmp_url": "https://dl.claid.ai/path-to-output/image-name.png"
        }
      ]
    }
  }
}
```

See [Response headers](/image-editing-api/api-reference#response-headers) to learn about headers.


# AI Fashion Models I/O

### Intro

The API takes flat-lay or mannequin garment photos and generates images with fashion models wearing your products.

**Cost**

* 2 credits per 1 output image.

**Rate limits**

* 1 generation per 1 second.
* 60 generations per 1 minute.

### Input

#### Clothing

Provide garment images as URLs; you can pass multiple URLs or submit a complete look as a full outfit. You can pass up to 5 garment images via `input.clothing`.

{% hint style="warning" %}
Swimwear and lingerie may be flagged by safety filters. Contact support if you experience issues.
{% endhint %}

```json
    "input": {
        "clothing": [
            "https://images.claid.ai/photoshoot-templates/assets/images/f4945a28e9874eaa89fd43313f373040.png",
            "https://images.claid.ai/photoshoot-templates/assets/images/b63641ea19dd4dac8fdc02a6195873f0.jpeg"
        ]
    }
}
```

By default, we treat the input as a full outfit and render it as-is; if any part is missing, auto-completion applies. When a full outfit is provided, no defaults are added.

**Auto-completion:**

* Bottoms only → adds a **plain white T-shirt**.
* Top only → adds **neutral blue jeans**.
* No shoes → generates **matching shoes**.

#### Model

You can also specify a model image via URL.

By default, a random suitable model will be chosen.

```json
{
    "input": {
        "model": "https://images.claid.ai/models/ai-fashion-model/d0ad3dafbd1d4fcfac4012ee810e7463.jpg",
        "clothing": [
            "https://images.claid.ai/photoshoot-templates/assets/images/f4945a28e9874eaa89fd43313f373040.png",
            "https://images.claid.ai/photoshoot-templates/assets/images/b63641ea19dd4dac8fdc02a6195873f0.jpeg"
        ]
    }
}
```

#### Storage URLs

You can connect [Cloud Storage](/storage-connectors/overview) and use it as a source for images. Currently, our API supports AWS S3 and Google Cloud Storage.

After connecting your Cloud Storage, you can refer the storage name as an input.

```json
{
    "input": {
        "model": "storage://storage-name/path/model.jpg",
        "clothing": [
            "storage://storage-name/path/clothing-top.jpg",
            "storage://storage-name/path/clothing-bottom.jpg"
        ]
    }
}
```

#### Input image file types

Our API supports the following image formats as inputs: JPEG, PNG, WEBP, AVIF and HEIC.

### Output

Configuration of result output is optional.&#x20;

By default, you may omit the output option from the request payload. In this case, our system stores the result in a temporary bucket with a lifespan of 24 hours and provides a public URL to the image.

Alternatively, you can use a connected [Cloud Storage](/storage-connectors/overview): just configure the path to the folder where you want to store results.

#### Output image file types

The following image formats are supported for the output: JPEG and PNG. Default is PNG.

#### Output number of images

The API supports from 1 to 4 output images. Default is 1 image per request.

#### Basic and advanced output options

{% tabs %}
{% tab title="Basic Usage" %}

```json
{
    "output": "storage://storage-name/result-path/image-name.jpg"
}
```

{% endtab %}

{% tab title="Advanced Usage" %}

<pre class="language-json"><code class="lang-json">{
    "output": {
<strong>        "destination": "storage://storage-name/result-path/image-name.jpg",
</strong>        "format": "jpeg",
        "number_of_images": 1
    }
}
</code></pre>

{% endtab %}
{% endtabs %}


# AI Fashion Models Options

Learn how to control AI Fashion Models generation.

### Pose <a href="#upscale" id="upscale"></a>

The `pose` parameter is a text description of a requested model pose.

```json
"options": {
  "pose": "full body, front view, neutral stance, arms relaxed"
}
```

### Background

The `background` parameter lets you describe a background.

```json
"options": {
  "background": "minimalistic studio background"
}
```

### Aspect Ratio

The `aspect_ratio` defines the final dimensions of the output image. The API supports various common aspect ratios.

```json
"options": {
  "aspect_ratio": "1:1"
}
```

By default, the aspect ratio matches the model image, or one of the clothing images if no model is provided. You can change it to any of the following values:

| Aspect ratio |
| ------------ |
| 1:1          |
| 2:3          |
| 3:2          |
| 3:4          |
| 4:3          |
| 4:5          |
| 5:4          |
| 9:16         |
| 16:9         |
| 21:9         |

### Possible values

| Parameter      | Type   | Range         | Default value                                                                 |
| -------------- | ------ | ------------- | ----------------------------------------------------------------------------- |
| `pose`         | string | 3-5000        | `full body, front view, neutral stance, arms relaxed`                         |
| `background`   | string | 3-5000        | `minimalistic studio background`                                              |
| `aspect_ratio` | string | "1:1".."21:9" | same as model, or same as one of the clothing images, if no model is provided |


# Async API Reference

### Image AI Fashion Models contract

This endpoint is asynchronous, it returns a response without waiting for an actual result. The actual result should be queried with another request. Or received by a webhook notification, see [Webhook notification](/image-editing-api/async-api-reference#webhook-notification) for more info.

```json
{
  "input": {
    "model": "https://images.claid.ai/models/ai-fashion-model/d0ad3dafbd1d4fcfac4012ee810e7463.jpg",
    "clothing": [
      "https://images.claid.ai/photoshoot-templates/assets/images/f4945a28e9874eaa89fd43313f373040.png",
      "https://images.claid.ai/photoshoot-templates/assets/images/b63641ea19dd4dac8fdc02a6195873f0.jpeg"
    ]
  },
  "output": {
    "destination": "storage://storage-name/result-path/image-name.jpg",
    "format": "png",
    "number_of_images": 1
  },
  "options": {
    "pose": "full body, front view, neutral stance, arms relaxed",
    "background": "minimalistic studio background",
    "aspect_ratio": "3:4"
  }
}
```

See [AI Fashion Models I/O](/ai-fashion-models-api/ai-fashion-models-i-o) and [AI Fashion Models Options](/ai-fashion-models-api/ai-fashion-models-options) learn about request data.

## Async Try On Generation Api

> AI Fashion Models generation

```json
{"openapi":"3.1.0","info":{"title":"Claid REST API","version":"v1"},"tags":[{"name":"Image","description":"Encompasses operations with images."}],"security":[{"OAuth2PasswordBearer":["image_editing"]},{"OAuth2PasswordBearer":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}},"description":"To work with the Claid API, send requests over HTTPS and authenticate using the `Authorization` header in the following format:`Authorization: Bearer <YOUR_API_KEY>`. You do not need to provide a password.\n\nTo get your API key, [sign in to your Claid account](https://claid.ai/login) and click ***Create API key*** button from the ***Overview*** or ***API keys*** pages.\n\nClaid API’s base URL is `https://api.claid.ai/v1/`. All available endpoints are listed in the [Storage](#tag/Storage) and [Image](#tag/Image) sections. \n\n## Bearer\n\nThis API uses OAuth 2.0 [bearer token](https://datatracker.ietf.org/doc/html/rfc6750) (API key) to authorize requests."}},"schemas":{"TryOnAPIRequest":{"title":"TryOnAPIRequest","required":["input","options"],"type":"object","properties":{"output":{"title":"Output","anyOf":[{"$ref":"#/components/schemas/TryOnAPIRequestOutputObject"},{"type":"string","minLength":1,"maxLength":4096,"format":"uri"}],"description":"Customize output format, destination and number of images.","default":{"number_of_images":1,"format":"png"}},"input":{"title":"Input","allOf":[{"$ref":"#/components/schemas/TryOnAPIRequestInputOptions"}],"description":"Input model and clothing images for the generation."},"options":{"title":"Options","allOf":[{"$ref":"#/components/schemas/TryOnAPIRequestOptionsObject"}],"description":"Customize the generation."}},"additionalProperties":false},"TryOnAPIRequestOutputObject":{"title":"TryOnAPIRequestOutputObject","type":"object","properties":{"number_of_images":{"title":"Number of images","maximum":4,"minimum":1,"type":"integer","description":"Number of output images.","default":1},"destination":{"title":"Destination","maxLength":4096,"minLength":1,"type":"string","description":"Customize the result output.","format":"uri"},"format":{"allOf":[{"$ref":"#/components/schemas/TryOnAPIFormatEnum"}],"description":"Output image format.","default":"png"}},"additionalProperties":false},"TryOnAPIFormatEnum":{"title":"TryOnAPIFormatEnum","enum":["jpeg","png"],"type":"string","description":"An enumeration."},"TryOnAPIRequestInputOptions":{"title":"TryOnAPIRequestInputOptions","required":["clothing"],"type":"object","properties":{"model":{"title":"Input model URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the human model image. Image must be accessible by our system.","format":"uri"},"clothing":{"title":"Clothing images URLs","maxItems":5,"minItems":1,"type":"array","items":{"type":"string","minLength":1,"maxLength":4096,"format":"uri"},"description":"List of clothing images URLs. Images must be accessible by our system."}},"additionalProperties":false},"TryOnAPIRequestOptionsObject":{"title":"TryOnAPIRequestOptionsObject","type":"object","properties":{"pose":{"title":"Pose","maxLength":5000,"minLength":3,"type":"string","description":"Pose prompt for the generation.","default":"full body, front view, neutral stance, arms relaxed"},"background":{"title":"Background","maxLength":5000,"minLength":3,"type":"string","description":"Background prompt for the generation.","default":"minimalistic studio background"},"aspect_ratio":{"allOf":[{"$ref":"#/components/schemas/TryOnAPIAspectRatio"}],"description":"Aspect ratio of the generated images."}},"additionalProperties":false},"TryOnAPIAspectRatio":{"title":"TryOnAPIAspectRatio","enum":["1:1","2:3","3:2","3:4","4:3","9:16","16:9","21:9","4:5","5:4"],"type":"string","description":"An enumeration."},"Response_TryOnAPIAcceptedResponse_":{"title":"Response[TryOnAPIAcceptedResponse]","type":"object","properties":{"data":{"$ref":"#/components/schemas/TryOnAPIAcceptedResponse"}},"description":"Wrapper for responses"},"TryOnAPIAcceptedResponse":{"title":"TryOnAPIAcceptedResponse","required":["id","status","created_at","request","result_url"],"type":"object","properties":{"id":{"title":"Id","type":"integer"},"status":{"$ref":"#/components/schemas/APIV1Status"},"created_at":{"title":"Created At","type":"string","format":"date-time"},"request":{"title":"Request","type":"object"},"result_url":{"title":"Result Url","maxLength":65536,"minLength":1,"type":"string","format":"uri"}}},"APIV1Status":{"title":"APIV1Status","enum":["ACCEPTED","WAITING","PROCESSING","DONE","ERROR","CANCELLED","PAUSED"],"type":"string","description":"An enumeration."},"HttpErrorDetails":{"title":"HttpErrorDetails","required":["error_code","error_type","error_message"],"type":"object","properties":{"error_code":{"title":"Error Code","type":"string"},"error_type":{"$ref":"#/components/schemas/ErrorType"},"error_message":{"title":"Error Message","type":"string"},"error_details":{"title":"Error Details","type":"object","default":{}}}},"ErrorType":{"title":"ErrorType","enum":["auth","dlvr","general","le","survey","storage","image","user_settings","user","validation","analytics","scene","billing","web","runtime_settings","animation","custom_models"],"type":"string","description":"An enumeration."}}},"paths":{"/v1/image/ai-fashion-models":{"post":{"tags":["Image"],"summary":"Async Try On Generation Api","description":"AI Fashion Models generation","operationId":"async_try_on_generation_api_v1_image_ai_fashion_models_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TryOnAPIRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response_TryOnAPIAcceptedResponse_"}}}},"401":{"description":"Authorization is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"402":{"description":"No API calls left.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"403":{"description":"Not enough permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"422":{"description":"Unprocessable Entity.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}}}}}}}
```

#### **Request**

{% tabs %}
{% tab title="HTTP" %}

```http
POST /v1/image/ai-fashion-models HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
Content-Type: application/json

{
  "input": {
   "clothing": [
      "https://images.claid.ai/photoshoot-templates/assets/images/b63641ea19dd4dac8fdc02a6195873f0.jpeg"
    ]
  },
  "options": {
    "pose": "full body, front view, neutral stance, arms relaxed",
  }
}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl -X POST --location "https://api.claid.ai/v1/image/ai-fashion-models" --http1.1 \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}" \
    -H "Content-Type: application/json" \
    -d "{
          \"input\": {
            \"clothing\": [
              \"https://images.claid.ai/photoshoot-templates/assets/images/b63641ea19dd4dac8fdc02a6195873f0.jpeg\"
            ]
          },
          \"options\": {
            \"pose\": \"full body, front view, neutral stance, arms relaxed\"
          }
        }"
```

{% endtab %}
{% endtabs %}

#### **Read a response**

Once you have made the request to <mark style="color:purple;">`https://api.claid.ai/v1/image/ai-fashion-models`</mark> you will get a response with information about request status and some other details (listed below).

Request information shown in the response:

<table><thead><tr><th width="154">Parameter</th><th width="109.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>integer</td><td>Task ID.</td></tr><tr><td>status</td><td>string</td><td>Request processing status. For a valid request can only have one value: <mark style="color:purple;"><code>ACCEPTED</code></mark>.</td></tr><tr><td>result_url</td><td>string</td><td>URL of GET endpoint that can be used to get the result manually and get request status while it is still in process.</td></tr><tr><td>created_at</td><td>string</td><td>Exact time when the processing was requested.</td></tr><tr><td>request</td><td>object</td><td>The body of the request that was used for processing.</td></tr></tbody></table>

#### **Response body**

```json
{
  "data": {
    "id": 1,
    "status": "ACCEPTED",
    "result_url": "https://api.claid.ai/v1/image/ai-fashion-models/1",
    "created_at": "2025-03-13T11:37:09.160554+00:00",
    "request": {
      "input": {
        "clothing": [
          "https://images.claid.ai/photoshoot-templates/assets/images/b63641ea19dd4dac8fdc02a6195873f0.jpeg"
        ]
      },
      "options": {
        "pose": "full body, front view, neutral stance, arms relaxed"
      }
    }
  }
}
```

See the [Request Headers](/image-editing-api/api-reference#request-headers) and [Response Headers](/image-editing-api/api-reference#response-headers) to learn about headers.

### Webhook notification

See [Webhook notification](/image-editing-api/async-api-reference#webhook-notification) to learn about webhook handling.

### Result of request processing contract

To get result, you need to know the ID of the processing request. Or you can take a ready-to-use link from the <mark style="color:purple;">`result_url`</mark> property of the response body described above.

## Async Try On Generation Async Status

> AI Fashion Models generation result

```json
{"openapi":"3.1.0","info":{"title":"Claid REST API","version":"v1"},"tags":[{"name":"Image","description":"Encompasses operations with images."}],"security":[{"OAuth2PasswordBearer":["image_editing"]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}},"description":"To work with the Claid API, send requests over HTTPS and authenticate using the `Authorization` header in the following format:`Authorization: Bearer <YOUR_API_KEY>`. You do not need to provide a password.\n\nTo get your API key, [sign in to your Claid account](https://claid.ai/login) and click ***Create API key*** button from the ***Overview*** or ***API keys*** pages.\n\nClaid API’s base URL is `https://api.claid.ai/v1/`. All available endpoints are listed in the [Storage](#tag/Storage) and [Image](#tag/Image) sections. \n\n## Bearer\n\nThis API uses OAuth 2.0 [bearer token](https://datatracker.ietf.org/doc/html/rfc6750) (API key) to authorize requests."}},"schemas":{"Response_TryOnAPIResultResponse_":{"title":"Response[TryOnAPIResultResponse]","type":"object","properties":{"data":{"$ref":"#/components/schemas/TryOnAPIResultResponse"}},"description":"Wrapper for responses"},"TryOnAPIResultResponse":{"title":"TryOnAPIResultResponse","required":["id","status","created_at","request"],"type":"object","properties":{"id":{"title":"Id","type":"integer"},"status":{"$ref":"#/components/schemas/APIV1Status"},"created_at":{"title":"Created At","type":"string","format":"date-time"},"request":{"title":"Request","type":"object"},"errors":{"title":"Errors","type":"array","items":{"$ref":"#/components/schemas/TryOnAPIError"}},"result":{"$ref":"#/components/schemas/TryOnAPIResult"}}},"APIV1Status":{"title":"APIV1Status","enum":["ACCEPTED","WAITING","PROCESSING","DONE","ERROR","CANCELLED","PAUSED"],"type":"string","description":"An enumeration."},"TryOnAPIError":{"title":"TryOnAPIError","required":["error","created_at"],"type":"object","properties":{"error":{"title":"Error","type":"string"},"created_at":{"title":"Created At","type":"string","format":"date-time"}}},"TryOnAPIResult":{"title":"TryOnAPIResult","required":["input_objects","output_objects"],"type":"object","properties":{"input_objects":{"title":"Input Objects","type":"array","items":{"$ref":"#/components/schemas/TryOnAPIImageObject"}},"output_objects":{"title":"Output Objects","type":"array","items":{"$ref":"#/components/schemas/TryOnAPIOutputImageObject"}}}},"TryOnAPIImageObject":{"title":"TryOnAPIImageObject","type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension."},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as 'media type')"},"format":{"title":"Format","type":"string","description":"File format."},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"}}},"TryOnAPIOutputImageObject":{"title":"TryOnAPIOutputImageObject","type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension."},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as 'media type')"},"format":{"title":"Format","type":"string","description":"File format."},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"},"tmp_url":{"title":"Tmp Url","type":"string","description":"Temporal URL of a processed image"},"object_key":{"title":"Object Key","type":"string","description":"Path to a processed image in a bucket"},"object_bucket":{"title":"Object Bucket","type":"string","description":"Bucket name"},"object_uri":{"title":"Object Uri","type":"string","description":"URI of a processed image in a bucket"},"claid_storage_uri":{"title":"Claid Storage Uri","type":"string","description":"URI of a processed image in a storage"}}},"HttpErrorDetails":{"title":"HttpErrorDetails","required":["error_code","error_type","error_message"],"type":"object","properties":{"error_code":{"title":"Error Code","type":"string"},"error_type":{"$ref":"#/components/schemas/ErrorType"},"error_message":{"title":"Error Message","type":"string"},"error_details":{"title":"Error Details","type":"object","default":{}}}},"ErrorType":{"title":"ErrorType","enum":["auth","dlvr","general","le","survey","storage","image","user_settings","user","validation","analytics","scene","billing","web","runtime_settings","animation","custom_models"],"type":"string","description":"An enumeration."},"HTTPValidationError":{"title":"HTTPValidationError","type":"object","properties":{"detail":{"title":"Detail","type":"array","items":{"$ref":"#/components/schemas/ValidationError"}}}},"ValidationError":{"title":"ValidationError","required":["loc","msg","type"],"type":"object","properties":{"loc":{"title":"Location","type":"array","items":{"type":"string"}},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}}}}},"paths":{"/v1/image/ai-fashion-models/{processing_request_id}":{"get":{"tags":["Image"],"summary":"Async Try On Generation Async Status","description":"AI Fashion Models generation result","operationId":"async_try_on_generation_async_status_v1_image_ai_fashion_models__processing_request_id__get","parameters":[{"required":true,"schema":{"title":"Processing Request Id","type":"integer"},"name":"processing_request_id","in":"path"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response_TryOnAPIResultResponse_"}}}},"401":{"description":"Authorization is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"403":{"description":"Not enough permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"404":{"description":"Web image not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

#### **Request**

{% tabs %}
{% tab title="HTTP" %}

```http
GET /v1/image/ai-fashion-models/1 HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl -X GET --location "https://api.claid.ai/v1/image/ai-fashion-models/1" --http1.1 \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}"
```

{% endtab %}
{% endtabs %}

#### **Read a response**

Once you have made the request to <mark style="color:purple;">`https://api.claid.ai/v1/image/`</mark><mark style="color:purple;">`ai-fashion-models/<task_id>`</mark> you will get a response with information about the request, input and output images.

Image information shown in the response:

<table><thead><tr><th width="153">Parameter</th><th width="109.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>integer</td><td>Task ID.</td></tr><tr><td>status</td><td>string</td><td>Request processing status. Can have values: <mark style="color:purple;"><code>ACCEPTED</code></mark>, <mark style="color:purple;"><code>PROCESSING</code></mark>, <mark style="color:purple;"><code>ERROR</code></mark>, <mark style="color:purple;"><code>DONE</code></mark>.</td></tr><tr><td>created_at</td><td>string</td><td>Exact time when the processing was requested.</td></tr><tr><td>request</td><td>object</td><td>The body of the request that was used for processing.</td></tr><tr><td>errors</td><td>list </td><td>List of errors, if any are occurred during image processing (<mark style="color:purple;"><code>status</code></mark> will have <mark style="color:purple;"><code>ERROR</code></mark> value), in other cases - will be empty.</td></tr><tr><td>result</td><td>object</td><td>Result object that is contain 2 properties <mark style="color:purple;"><code>input_objects</code></mark> and <mark style="color:purple;"><code>output_objects</code></mark>, in case of processing errors - will be empty. Details are listed below.</td></tr></tbody></table>

Read a <mark style="color:purple;">`input_objects`</mark> and <mark style="color:purple;">`output_objects`</mark> properties of response <mark style="color:purple;">`result`</mark> property:

<table><thead><tr><th width="151">Parameter</th><th width="112.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>ext</td><td>string</td><td>File extension. Can have values: <mark style="color:purple;"><code>jpg</code></mark>, <mark style="color:purple;"><code>png</code></mark>.</td></tr><tr><td>mps</td><td>float</td><td>Megapixel count.</td></tr><tr><td>mime</td><td>string</td><td>MIME type (also known as ‘media type’).</td></tr><tr><td>width</td><td>integer</td><td>Image width in pixels.</td></tr><tr><td>height</td><td>integer</td><td>Image height in pixels.</td></tr><tr><td>format</td><td>string</td><td>File format. Can have values: <mark style="color:purple;"><code>jpeg</code></mark>, <mark style="color:purple;"><code>png</code></mark>.</td></tr><tr><td>tmp_url</td><td>string</td><td>Temporary URL of a processed image. Is available only for <mark style="color:purple;"><code>output_objects</code></mark>.</td></tr></tbody></table>

Read an item from <mark style="color:purple;">`errors`</mark> property:

<table><thead><tr><th width="151">Parameter</th><th width="112.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>error</td><td>string</td><td>Error message in text.</td></tr><tr><td>created_at</td><td>integer</td><td>Exact time when the error was caught.</td></tr></tbody></table>

#### **Response body**

```json
{
  "data": {
    "id": 1,
    "status": "DONE",
    "created_at": "2025-03-13T11:37:09.160554+00:00",
    "request": {
      "input": {
        "clothing": [
          "https://images.claid.ai/photoshoot-templates/assets/images/b63641ea19dd4dac8fdc02a6195873f0.jpeg"
        ]
      },
      "options": {
        "pose": "full body, front view, neutral stance, arms relaxed"
      }
    },
    "errors": [],
    "result": {
      "input_objects": [
        {
          "ext": "jpeg",
          "mps": 0.5,
          "mime": "image/jpeg",
          "format": "JPEG",
          "width": 500,
          "height": 500
        }
      ],
      "output_objects": [
        {
          "ext": "jpeg",
          "mps": 1.0,
          "mime": "image/jpeg",
          "format": "JPEG",
          "width": 1024,
          "height": 1024,
          "tmp_url": "https://dl.claid.ai/path-to-output/image-name.png"
        }
      ]
    }
  }
}
```

See [Response headers](/image-editing-api/api-reference#response-headers) to learn about headers.


# Image Generation I/O

Learn how to configure input and output to generate images with Claid API.

### Intro

The Image Generation Endpoint enables you to generate unique images based on text descriptions (prompts). The generated images have a size of 1024x1024 pixels. You can further improve their resolution and quality using our Image Editing API (see the Resizing and Upscale sections).

### Input

Our image generation API accepts text prompts as inputs. The prompt must be between 3 and 1024 characters.

{% hint style="info" %}
Provide a detailed prompt to increase the likelihood of achieving the desired result.
{% endhint %}

```json
{
    "input": "A delicious ceviche cheesecake slice"
}
```

#### Limitations

Our system has a built-in filter that removes NSFW content. If you receive a plain black image as an output, it's possible that the content filter detected an NSFW result. If you believe this was a mistake, you can try adjusting the prompt.

### Output

Configuring output is optional. You may configure the output or omit it for default settings. If you omit the output, the API stores the result in a temporary bucket for 24 hours and provides you with a public URL to the image.

#### Connected storage

Alternatively, you can use a connected Cloud Storage. Once connected, you can refer to the storage directory as an output path. The output path must always end with a <mark style="color:purple;">`/`</mark> character.

{% hint style="info" %}
Currently, our API supports AWS S3 and Google Cloud Storage.
{% endhint %}

```json
{
    "output": "storage://storage-name/path/"
}
```


# Image Generation Options

Learn how to control the quality and speed of image generation.

### Number of images

With our image generation API, you can generate up to 4 images with one request.

```json
{
    "options": {
        "number_of_images": 4
    }
}
```

{% hint style="info" %}
Every generated image charges 1 credit. So, setting <mark style="color:purple;">`number_of_images`</mark> to 4 will charge 4 credits per request.
{% endhint %}

### Guidance scale

The guidance scale controls how closely the generated images match your prompt. You may adjust this scale to gain more control over the output.

{% hint style="info" %}
Values between 5 and 7 usually provide good results, but a value of 12 may offer greater precision.
{% endhint %}

Note that adjusting this scale may affect image quality and diversity.

```json
{
    "options": {
        "guidance_scale": 5.0
    }
}
```

### Possible values

<table><thead><tr><th width="244">Parameter</th><th>Type</th><th>Range</th><th>Default value</th></tr></thead><tbody><tr><td><mark style="color:purple;"><code>number_of_images</code></mark></td><td>int</td><td>1 - 4</td><td>4</td></tr><tr><td><mark style="color:purple;"><code>guidance_scale</code></mark></td><td>float</td><td>1.0 - 49.99</td><td>5.0</td></tr></tbody></table>


# API Reference

request and response description

### Image generation contract

Below you can see all possible options for the request body. See the Image Generation Options and Image Generation I/O sections to learn more about image operations.

```json
{
    "input": "A delicious ceviche cheesecake slice",
    "options": {
        "number_of_images": 1,
        "guidance_scale": 5.0
    },
    "output": "storage://{storage_name}/{image_folder}/" 
}
```

## Image Generate

> Specifies: \
> \- text prompt for image generation (\`input\`)\
> \- image generation options (\`options\`)\
> \- where results will be stored (\`output\`)

```json
{"openapi":"3.1.0","info":{"title":"Claid REST API","version":"v1"},"tags":[{"name":"Image","description":"Encompasses operations with images."}],"security":[{"OAuth2PasswordBearer":[]},{"OAuth2PasswordBearer":["image_editing"]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}},"description":"To work with the Claid API, send requests over HTTPS and authenticate using the `Authorization` header in the following format:`Authorization: Bearer <YOUR_API_KEY>`. You do not need to provide a password.\n\nTo get your API key, [sign in to your Claid account](https://claid.ai/login) and click ***Create API key*** button from the ***Overview*** or ***API keys*** pages.\n\nClaid API’s base URL is `https://api.claid.ai/v1/`. All available endpoints are listed in the [Storage](#tag/Storage) and [Image](#tag/Image) sections. \n\n## Bearer\n\nThis API uses OAuth 2.0 [bearer token](https://datatracker.ietf.org/doc/html/rfc6750) (API key) to authorize requests."}},"schemas":{"GenerateRequest":{"title":"GenerateRequest","required":["input"],"type":"object","properties":{"input":{"title":"Text prompt for image generation","maxLength":1024,"minLength":3,"type":"string","description":"Text prompt that will be used to generate image(s). Should be from 3 to 1024 characters. "},"options":{"title":"Image generate options","allOf":[{"$ref":"#/components/schemas/ImageGenerateOptions"}],"description":"Customize the image generation process so that the output images meet your requirements.","default":{"number_of_images":4,"guidance_scale":5}},"output":{"title":"Output folder URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the output folder. If `output` is not defined, we store the output image on our bucket and return the temporary URL, in this case images are stored for one day.","format":"uri"}},"additionalProperties":false},"ImageGenerateOptions":{"title":"ImageGenerateOptions","type":"object","properties":{"number_of_images":{"title":"Number of images","maximum":4,"minimum":1,"type":"integer","description":"Number of images to generate. By default 4 images will be generated.","default":4},"guidance_scale":{"title":"Guidance scale","exclusiveMaximum":50,"minimum":1,"type":"number","description":"Guidance scale is used to make the generation better match the prompt potentially at the cost of image quality or diversity. Values between 5 and 7 are usually good choices, but sometimes more control is achieved with values such as 12. By default the pipeline uses a guidance scale of 5.","default":5}},"additionalProperties":false},"Response_GenerateResponse_":{"title":"Response[GenerateResponse]","type":"object","properties":{"data":{"$ref":"#/components/schemas/GenerateResponse"}},"description":"Wrapper for responses"},"GenerateResponse":{"title":"GenerateResponse","required":["input","output"],"type":"object","properties":{"input":{"$ref":"#/components/schemas/GeneratePipelineInputObject"},"output":{"title":"Output","type":"array","items":{"$ref":"#/components/schemas/PipelineOutputObject"}},"profiling":{"title":"Profiling","type":"object"}}},"GeneratePipelineInputObject":{"title":"GeneratePipelineInputObject","required":["text"],"type":"object","properties":{"text":{"title":"Text","type":"string","description":"Text prompt for image generation"}}},"PipelineOutputObject":{"title":"PipelineOutputObject","required":["ext","mps","mime","format","width","height"],"type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension. Can have values: `\"jpg\"`, `\"png\"`, `\"avif\"`"},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as ‘media type’)"},"format":{"title":"Format","type":"string","description":"File format. Can have values: `\"jpeg\"`, `\"png\"`, `\"avif\"`"},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"},"tmp_url":{"title":"Tmp Url","type":"string","description":"Temporal URL of a processed image"},"object_key":{"title":"Object Key","type":"string","description":"Path to a processed image in a bucket"},"object_bucket":{"title":"Object Bucket","type":"string","description":"Bucket name"},"object_uri":{"title":"Object Uri","type":"string","description":"URI of a processed image in a bucket"},"claid_storage_uri":{"title":"Claid Storage Uri","type":"string","description":"URI of a processed image in a storage"}}},"HttpErrorDetails":{"title":"HttpErrorDetails","required":["error_code","error_type","error_message"],"type":"object","properties":{"error_code":{"title":"Error Code","type":"string"},"error_type":{"$ref":"#/components/schemas/ErrorType"},"error_message":{"title":"Error Message","type":"string"},"error_details":{"title":"Error Details","type":"object","default":{}}}},"ErrorType":{"title":"ErrorType","enum":["auth","dlvr","general","le","survey","storage","image","user_settings","user","validation","analytics","scene","billing","web","runtime_settings","animation","custom_models"],"type":"string","description":"An enumeration."}}},"paths":{"/v1/image/generate":{"post":{"tags":["Image"],"summary":"Image Generate","description":"Specifies: \n- text prompt for image generation (`input`)\n- image generation options (`options`)\n- where results will be stored (`output`)","operationId":"image_generate_v1_image_generate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response_GenerateResponse_"}}}},"401":{"description":"Authorization is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"402":{"description":"No API calls left.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"403":{"description":"Not enough permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"422":{"description":"Unprocessable Entity.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}}}}}}}
```

**Request**

{% tabs %}
{% tab title="HTTP" %}

<pre class="language-http"><code class="lang-http">POST /v1/image/generate HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
Content-Type: application/json
<strong>
</strong>{
    "input": "A delicious ceviche cheesecake slice",
    "options": {
        "number_of_images": 2,
        "guidance_scale": 5
    }
}
</code></pre>

{% endtab %}

{% tab title="cURL" %}

```shell
curl -X POST --location "https://api.claid.ai/v1/image/generate" --http1.1 \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}" \
    -H "Content-Type: application/json" \
    -d "{
            \"input\": \"A delicious ceviche cheesecake slice\",
            \"options\": {
                \"number_of_images\": 2,
                \"guidance_scale\": 5
            }
        }"
```

{% endtab %}
{% endtabs %}

#### Request headers:

In order to send a request, you should set `Content-Type` header to let our system know that you provide a valid JSON payload and `Authorization` header with a generated API key to identify yourself as a Claid user.

```http
Content-Type: application/json
Authorization: Bearer {YOUR_API_KEY}
```

#### **Read a response**

Once you have made the request to `https://api.claid.ai/v1/image/generate` you will get a response with information about input text and output images.

Image information is shown in the response:

| Parameter | Type    | Description                                                                |
| --------- | ------- | -------------------------------------------------------------------------- |
| ext       | string  | File extension. Will have `png` value                                      |
| mps       | integer | Megapixel count                                                            |
| mime      | string  | MIME type (also known as ‘media type’)                                     |
| width     | integer | Image width in pixels                                                      |
| height    | integer | Image height in pixels                                                     |
| format    | string  | File format. Will have `png` value                                         |
| tmp\_url  | string  | Temporary URL of a processed image. Will be empty if `output` is specified |

**Response body**

```json
{
    "data": {
        "input": {
            "text": "A delicious ceviche cheesecake slice"
            }  
        },
        "output": [
            {
                "ext": "png",
                "mps": 1.048576,
                "mime": "image/png",
                "format": "PNG",
                "width": 1024,
                "height": 1024,
                "tmp_url": "https://storage.googleapis.com/production-leapi-tmp-public/733a7c8f-1fea-4097-8fd4-17f54c94d998/eyXNp9_1.png"
            },
            {
               "ext": "png",
                "mps": 1.048576,
                "mime": "image/png",
                "format": "PNG",
                "width": 1024,
                "height": 1024,
                "tmp_url": "https://storage.googleapis.com/production-leapi-tmp-public/733a7c8f-1fea-4097-8fd4-17f54c94d998/eyXNp9_2.png"
            },
        ]
    }
}
```

#### Response headers:

[Rate limit](/rate-limits) headers will help you understand what number of requests you are able to send according to the current limits on your account:

```http
ratelimit-limit: 120, 120;w=60, 4;w=1
ratelimit-remaining: 119
ratelimit-reset: 34
```

Request ID header allows to identify your request during image processing, so we are able to help you with troubleshooting and profiling your request if needed.

```http
x-request-id: 9b321763-1d09-4072-932b-ff031475affa
```


# AI Background  I/O

Learn how to configure input and output to use the AI Background API.

### Intro

The AI Background Endpoint allows you to turn simple product photos into beautiful visual assets. In just a few seconds, you can get up to 4 options and select the images that work best for you.

The generated images have a size of 1024×1024 pixels. You can further improve their resolution and quality using our Image Editing API, see the [Resizing](/image-editing-api/image-operations/resizing) and [Upscale](/image-editing-api/image-operations/restorations#upscale) sections for more info.

#### Limitations

Only one product image can be processed per request.

### Output

Configuring output is optional. By default, you may omit the output option from the request payload. In this case, our system stores the result in a temporary bucket with a lifespan of 24 hours and provides a public URL to the image.

Alternatively, you can use a connected [Cloud Storage](/storage-connectors/overview): just configure the path to the folder where you want to store results.

#### Output image file types

The following image formats are supported for the output: JPEG, PNG, WEBP, and AVIF.

#### Basic and advanced output options

You may also specify advanced output, like number of images to generate, image format, and format-specific options like PNG compression level, JPEG quality, or using JPEG progressive display type.

{% tabs %}
{% tab title="Basic Usage" %}

```json
{
    "output": "storage://storage-name/result-path/image-name.jpg"
}
```

{% endtab %}

{% tab title="Advanced Usage" %}

```json
"output": {
    "destination": "storage://storage-name/result-path/image-name.jpg",
    "format": "jpeg",
    "number_of_images": 1
}
```

{% endtab %}

{% tab title="Advanced Format Usage" %}

```json
"output": {
    "destination": "storage://storage-name/result-path/image-name.jpg",
    "format": {
        "type": "jpeg",
        "quality": 85,
        "progressive": true
    },
    "number_of_images": 1
}

```

{% endtab %}
{% endtabs %}

&#x20;See the full list of the advanced format-specific options at [Image I/O](/image-editing-api/image-i-o#basic-and-advanced-output-options) for more info.

#### Number of images

With AI Background API, you can generate up to 4 images with one request.

{% hint style="danger" %}
Every generated image charges 2 credit.&#x20;

Setting <mark style="color:purple;">`number_of_images`</mark> to <mark style="color:purple;">4</mark> will charge 8 credits per request.

The <mark style="color:purple;">`number_of_images`</mark> option **defaults** to <mark style="color:purple;">4</mark>.
{% endhint %}

```json
{
    "output": {
        "number_of_images": 2
    }
}
```


# AI Background Options

AI Background API Options allow you to specify where your product will be placed on the processed image and how the background will look like.

<div data-full-width="false"><figure><img src="https://claid.ai/static/00118bd630ec7e16f57ad5ab886e894c/13762/header-perfume.webp" alt=""><figcaption></figcaption></figure></div>


# Object

Learn how to control the positioning of your product images.

## Product image

AI Background API supports several options to provide source images that need to be processed.

{% hint style="info" %}
You have to upload **only** **images** **without background**, so you can use Claid API [Background Removal](/image-editing-api/image-operations/background#background-removal).&#x20;

If you choose to upload an image with a background, the scene will be created around the entire image.
{% endhint %}

#### HTTP(S) URL

URL of the input image should be from 1 to 4096 characters. The image must be accessible by our system.

```json
{
    "object": {
        "image_url": "https://images.claid.ai/photoshoot-templates/docs/product.png"
    }
}
```

#### Connected storage

You can connect [Cloud Storage](/storage-connectors/overview) and use it as a source for images. Currently, our API supports AWS S3 and Google Cloud Storage.

After connecting your Cloud Storage, you can refer the storage name as an input.

```json
{
    "object": {
        "image_url": "storage://storage-name/path/image.png"
    }
}
```

#### Input image file types

The API supports the following image formats as inputs: BMP, GIF, JPEG, PNG, TIFF, WEBP, AVIF, and HEIC.&#x20;

{% hint style="info" %}
JPEG does not support background transparency, so you will probably want to select another image format.
{% endhint %}

## Placement

There are several placement types that can be used to position an object in a scene. Some of them allow additional parameters for a more accurate positioning.

<table data-full-width="false"><thead><tr><th width="239">Placement type</th><th>Description</th></tr></thead><tbody><tr><td><code>"absolute"</code></td><td><a data-mention href="#absolute-placement">#absolute-placement</a> type allows to manually define a product position based on dependent parameters such as <code>position</code>, <code>scale</code>, and <code>rotation_degree</code>. It is used <strong>by default</strong>.</td></tr><tr><td><code>"original"</code></td><td><a data-mention href="#original-placement">#original-placement</a> type keeps the product's position on the generated images the same as it was on the input images.</td></tr></tbody></table>

### Absolute placement

Absolute placement is a method to manually tune an object position using one or multiple dependent fields: [#position](#position "mention"), [#scale](#scale "mention"), and [#rotation-degree](#rotation-degree "mention"). It is used by default so that `placement_type` field can be omitted or specified explicitly.

```json
{
    "object": {
        "image_url": "storage://storage-name/path/image.png",
        "placement_type": "absolute",
        "position": {
            "x":0.6, 
            "y":0.4
        },
        "scale": 0.4,
        "rotation_degree": 90.0
    }
}
```

#### Rotation degree

You can do 360-degree rotation of the object by specifying the `rotation_degree` option.

The object will rotate in a clockwise direction from `0` to `360` degrees.

```json
{
    "object": {
        "image_url": "storage://storage-name/path/image.png",
        "rotation_degree": 90.0
    }
}
```

#### Scale

You can change the size of the object in relation to the background by specifying the `scale` option.

By default, the object is scaled to the edges of the generated background, which is equivalent to setting `scale` to `1.0`.

If you wish, the object can be scaled down to 10% of the total width and height of the generated background, which is equivalent to setting `scale` to `0.1`.

```json
{
    "object": {
        "image_url": "storage://storage-name/path/image.png",
        "scale": 0.4
    }
}
```

#### Position

You can move the object around the image by specifying relative object position with `position` option.

By default, the object is positioned at the center of the image, which corresponds to `{"x":0.5, "y":0.5}`.

Positioning is not an intuitive concept, so below is a reference table for positioning the object:

| <p>left top corner:</p><p><code>"x":</code><strong><code>0.0</code></strong><code>, "y":</code><strong><code>0.0</code></strong></p>    | <p>top edge:</p><p><code>"x":</code><strong><code>0.5</code></strong><code>, "y":</code><strong><code>0.0</code></strong></p>    | <p>right top corner:</p><p><code>"x":</code><strong><code>1.0</code></strong><code>, "y":</code><strong><code>0.0</code></strong></p>    |
| --------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| <p>left edge:</p><p><code>"x":</code><strong><code>0.0</code></strong><code>, "y":</code><strong><code>0.5</code></strong></p>          | <p>center:</p><p><code>"x":</code><strong><code>0.5</code></strong><code>, "y":</code><strong><code>0.5</code></strong></p>      | <p>right edge:</p><p><code>"x":</code><strong><code>1.0</code></strong><code>, "y":</code><strong><code>0.5</code></strong></p>          |
| <p>left bottom corner:</p><p><code>"x":</code><strong><code>0.0</code></strong><code>, "y":</code><strong><code>1.0</code></strong></p> | <p>bottom edge:</p><p><code>"x":</code><strong><code>0.5</code></strong><code>, "y":</code><strong><code>1.0</code></strong></p> | <p>right bottom corner:</p><p><code>"x":</code><strong><code>1.0</code></strong><code>, "y":</code><strong><code>1.0</code></strong></p> |

```json
{
    "object": {
        "image_url": "storage://storage-name/path/image.png",
        "position": {
            "x":0.6, 
            "y":0.4
        }
    }
}
```

#### Possible values

<table><thead><tr><th width="244">Parameter</th><th>Type</th><th>Range</th><th>Default value</th></tr></thead><tbody><tr><td><code>image_url</code></td><td>str</td><td>1 - 4096</td><td><strong>is required</strong></td></tr><tr><td><code>rotation_degree</code></td><td>float</td><td>0.0 - 360.0</td><td>0.0</td></tr><tr><td><code>scale</code></td><td>float</td><td>0.0 - 1.0</td><td>1.0</td></tr><tr><td><code>position.x</code></td><td>float</td><td>0.0 - 1.0</td><td>0.5</td></tr><tr><td><code>position.y</code></td><td>float</td><td>0.0 - 1.0</td><td>0.5</td></tr></tbody></table>

### Original placement

Original placement is a choice when a product on the original image with a transparent background is already has a desired position. Meaning, background will be generated, while the product will remain in the same place as it was on the original image.

This placement type doesn't require any additional fields.

```json
{
    "object": {
        "image_url": "storage://storage-name/path/image.png",
        "placement_type": "original"
    }
}
```


# Scene

Learn how to control the quality and speed of image generation.

AI Background API provides you with three ways to create a background for your product:

* Template-free approach
* Template-based approach
* Solid color background with product shadow only

## Models

The template-free approach supports several background generation models. Available models are listed below:

<table><thead><tr><th width="138">Model</th><th>Description</th></tr></thead><tbody><tr><td><code>v1</code></td><td>A stable, production-ready model optimized for product photography. Provides consistent results with fast processing times. Requires specific prompt formatting for best results. See <a href="#tips-for-effective-custom-prompts">Tips</a> for more info.</td></tr><tr><td><code>v2</code></td><td>Advanced model with improved photorealism. Processes natural language prompts more effectively and works with diverse subjects (products, people, etc.). Slightly slower processing time due to enhanced quality algorithms.</td></tr></tbody></table>

`v1` model is used by default.

{% hint style="success" %}
We recommend starting with the `v2` model as it is a flagship model.
{% endhint %}

## Template-free approach

In the template-free approach, only text prompts are used for background generation. You can either generate prompts automatically with Autoprompt AI or write them manually for more control.

## Template-free v2 model options

`v2` model supports the following options:

### Prompt

The AI Background API accepts text prompts to define the background. Prompts can be generated automatically using Autoprompt AI or provided manually.

**Autoprompt AI: Automatic prompt generation**

Autoprompt AI analyzes the input product image and generates a text prompt tailored to create a contextually relevant background. This is useful for automating background generation, especially with large batches of images.

{% hint style="info" %}
Generating a prompt with Autoprompt AI costs an additional 0.5 credits per request. Factor this into your usage planning.
{% endhint %}

**How to use it:** Set the `generate` parameter to `true` within the `prompt` object in the `scene` section of your API request.

```json
{
    "scene": {
        "model": "v2",
        "prompt": {
            "generate": true
        }
    }
}
```

You can influence Autoprompt AI by providing guidelines. Guidelines can be specific keywords (e.g., "seaside, sunset, ocean") or more abstract concepts (e.g., "summer vibes," "pink monochromatic environment," "real life setting").

```json
{
    "scene": {
        "model": "v2",
        "prompt": {
            "generate": true,
            "guidelines": "seaside, sunset, ocean, beach, sand, waves"
        }
    }
}
```

{% hint style="info" %}
Including humans in the `guidelines` is only supported with the `v2` model.
{% endhint %}

**Custom prompts: Manual control**

For even more precise control over the background, you can provide your own prompt. Custom prompts must be between 3 and 2048 characters.

**Example:**

{% code overflow="wrap" %}

```json
{
    "scene": {
        "model": "v2",
        "prompt": "Professional photo of a product. The background features a serene spa environment with natural wooden textures, soft white towels, and smooth pebbles. Lavender plants add to the calming ambiance. The lighting is soft and natural, coming from the left, creating a tranquil and inviting atmosphere perfect for wellness and relaxation. The setting exudes a sense of luxury and care, aligning with the product's high-end aesthetic."
    }
}
```

{% endcode %}

### Negative prompt

The negative prompt parameter specifies elements to exclude from the generated background. The model will avoid including content matching this text. The `negative_prompt` must be between 3 and 2048 characters.

{% code overflow="wrap" %}

```json
{
    "scene": {
        "model": "v2",
        "prompt": "Professional photo of a product. The background features a serene spa environment with natural wooden textures, soft white towels, and smooth pebbles. Lavender plants add to the calming ambiance. The lighting is soft and natural, coming from the left, creating a tranquil and inviting atmosphere perfect for wellness and relaxation. The setting exudes a sense of luxury and care, aligning with the product's high-end aesthetic.",
        "negative_prompt": "pixelated, low quality"
    }
}
```

{% endcode %}

### Aspect ratio

By default, the aspect ratio is 1:1 with dimensions of 1024x1024px. But you can change it to any of the following values, listed from wider to taller:

| Aspect ratio | Output size |
| ------------ | ----------- |
| 12:5         | 1536x640px  |
| 16:9         | 1312x736px  |
| 7:4          | 1344x768px  |
| 19:13        | 1216x832px  |
| 9:7          | 1152x896px  |
| 1:1          | 1024x1024px |
| 4:5          | 896x1120px  |
| 7:9          | 896x1152px  |
| 4:7          | 768x1344px  |
| 9:16         | 736x1312px  |
| 5:12         | 640x1536px  |

{% hint style="info" %}
If you need a size larger than the generation result, you can upscale. See [Upscale](/image-editing-api/image-operations/restorations#upscale) for more info.
{% endhint %}

{% code overflow="wrap" %}

```json
{
    "scene": {
        "model": "v2",
        "prompt": "Professional photo of a product. The background features a serene spa environment with natural wooden textures, soft white towels, and smooth pebbles. Lavender plants add to the calming ambiance. The lighting is soft and natural, coming from the left, creating a tranquil and inviting atmosphere perfect for wellness and relaxation. The setting exudes a sense of luxury and care, aligning with the product's high-end aesthetic.",
        "negative_prompt": "pixelated, low quality",
        "aspect_ratio": "16:9"
    }
}
```

{% endcode %}

### Preference

Easy to use parameter to configure model settings to achieve the desired balance between generation speed and output image quality.&#x20;

Can be set to `"fast"`, `"optimal"`, or `"best"`.&#x20;

If no preference is specified, `"optimal"` is used by default. If `negative_prompt` is specified, however, only `"optimal"` or `"best"` are allowed.

{% code overflow="wrap" %}

```json
{
    "scene": {
        "model": "v2",
        "prompt": "Professional photo of a product. The background features a serene spa environment with natural wooden textures, soft white towels, and smooth pebbles. Lavender plants add to the calming ambiance. The lighting is soft and natural, coming from the left, creating a tranquil and inviting atmosphere perfect for wellness and relaxation. The setting exudes a sense of luxury and care, aligning with the product's high-end aesthetic.",
        "negative_prompt": "pixelated, low quality",
        "aspect_ratio": "16:9",
        "preference": "fast"
    }
}
```

{% endcode %}

### Possible values

<table><thead><tr><th width="202">Parameter</th><th width="95">Type</th><th width="145">Range</th><th>Default value</th></tr></thead><tbody><tr><td><code>prompt</code></td><td><em>string, object</em></td><td>3 - 2048</td><td><strong>is required</strong></td></tr><tr><td><code>negative_prompt</code></td><td><em>string</em></td><td>3 - 2048</td><td>text, watermark, man, woman, child, overlay text, cartoon, pixelated, illustration, ugly, painting, cropped, lowres, low quality, jpeg artifacts, signature, logo</td></tr><tr><td><code>aspect_ratio</code></td><td><em>string</em></td><td>12:5 - 5:12</td><td>1:1</td></tr><tr><td><code>preference</code></td><td><em>string</em></td><td><code>"fast"</code>, <code>"optimal"</code>, <code>"best"</code></td><td><code>"optimal"</code></td></tr></tbody></table>

## Template-free v1 model options

`v1` model also supports:&#x20;

### [Prompt](#prompt)

**Custom prompts: Manual control**

For more control over the background, provide your own prompt. Custom prompts must be between 3 and 2048 characters.

**Example:**

{% code overflow="wrap" %}

```json
{
    "scene": {
        "model": "v1",
        "prompt": "on a rugged mountain trail, scattered rocks, moss-covered ground, sunlight filtering through pine trees, rich earthy colors, warm light, dynamic perspective, high quality, professional product photography"
    }
}
```

{% endcode %}

#### Tips for effective custom prompts

* **Structure:** Include place (surface), background, lighting, and mood for control.
* **Detail:** Specify materials, textures, and context clearly (e.g., "rustic wooden table").
* **Clarity:** Use precise terms—avoid vague words like "nice" or "pretty."

For more, see [How to write prompts for AI product photos](https://claid.ai/blog/article/prompt-guide/).

### [Negative prompt](#negative-prompt)

### [Aspect ratio](#aspect-ratio)&#x20;

In addition it supports the following options:

### Color

If you want to change the color of the background, you can specify the desired color in hexadecimal format. The color parameter defines the main color theme for the generated background scene.

{% code overflow="wrap" %}

```json
{
    "scene": {
        "model": "v1",
        "prompt": "on a rugged mountain trail, scattered rocks, moss-covered ground, sunlight filtering through pine trees, rich earthy colors, warm light, dynamic perspective, high quality, professional product photography",
        "negative_prompt": "pixelated, low quality",
        "aspect_ratio": "16:9",
        "color": "#8fa782"
    }
}
```

{% endcode %}

### Inference steps

The inference steps parameter controls the number of iterations the model uses for generation. Increasing the steps value generally improves image quality and detail but also increases processing time. Conversely, decreasing steps speeds up generation, potentially at the cost of some quality.

{% code overflow="wrap" %}

```json
{
    "scene": {
        "model": "v1",
        "prompt": "on a rugged mountain trail, scattered rocks, moss-covered ground, sunlight filtering through pine trees, rich earthy colors, warm light, dynamic perspective, high quality, professional product photography",
        "negative_prompt": "pixelated, low quality",
        "aspect_ratio": "16:9",
        "color": "#8fa782",
        "steps": 20
    }
}
```

{% endcode %}

### Possible values

<table><thead><tr><th width="202">Parameter</th><th width="95">Type</th><th width="145">Range</th><th>Default value</th></tr></thead><tbody><tr><td><code>prompt</code></td><td><em>string, object</em></td><td>3 - 2048</td><td><strong>is required</strong></td></tr><tr><td><code>negative_prompt</code></td><td><em>string</em></td><td>3 - 2048</td><td>text, watermark, man, woman, child, overlay text, cartoon, pixelated, illustration, ugly, painting, cropped, lowres, low quality, jpeg artifacts, signature, logo</td></tr><tr><td><code>aspect_ratio</code></td><td><em>string</em></td><td>12:5 - 5:12</td><td>1:1</td></tr><tr><td><code>color</code></td><td><em>string</em></td><td><code>#000000</code> - <code>#ffffff</code></td><td></td></tr><tr><td><code>steps</code></td><td>integer</td><td>1-49</td><td>15</td></tr></tbody></table>

## Template-based approach

In the template-based approach, you can use a sample image that will be used to generate a background similar to the image, and you can also use prompts to increase the likelihood of achieving the desired result.

## Template-based v2 model options

`v2` model supports the following options:

### Template image

AI Background API supports several options to provide sample images that will be used to generate background.

{% hint style="info" %}
If you upload a non-square image, it will be scaled and cropped to fit a square.
{% endhint %}

#### HTTP(S) URL

URL of the input image should be from 1 to 4096 characters. The image must be accessible by our system.

```json
{
    "scene": {
        "model": "v2",
        "template_url": "https://images.claid.ai/photoshoot-templates/docs/scene.png"
    }
}
```

#### Connected storage

You can connect [Cloud Storage](/storage-connectors/overview) and use it as a source for images. Currently, our API supports AWS S3 and Google Cloud Storage.

After connecting your Cloud Storage, you can refer the storage name as an input.

```json
{
    "scene": {
        "model": "v2",
        "template_url": "storage://storage-name/path/scene.png"
    }
}
```

#### Input image file types

The API supports the following image formats as inputs: BMP, GIF, JPEG, PNG, TIFF, WEBP, AVIF, and HEIC.&#x20;

### Template mode

The template mode enables you to determine the degree of similarity between the background and the template image. You can select between `lock` mode to preserve maximum details, `adjust` mode to slightly adjust the background to better match the product, or `transform` mode to freely transform the background with `prompt` and `color` parameters. See [Color](#color) and [Prompts](#prompts) for more info.

{% hint style="info" %}
`prompt`, `color` and `steps` are unavailable for `lock` template mode.\
\
`color` is unavailable for `adjust` template mode.
{% endhint %}

<table><thead><tr><th width="153">Viewpoint</th><th></th></tr></thead><tbody><tr><td><code>transform</code></td><td>Template is transformed according to the <code>prompt</code> and <code>color</code>.</td></tr><tr><td><code>adjust</code></td><td>Template is slightly adjusted to the product and <code>prompt</code>.</td></tr><tr><td><code>lock</code></td><td>Template is preserved with maximum detail.</td></tr></tbody></table>

`transform` template mode is used by default.

<pre class="language-json"><code class="lang-json"><strong>{
</strong>    "scene": {
        "model": "v2",
        "template_url": "storage://storage-name/path/scene.png",
        "template_mode": "lock"
    }
}
</code></pre>

### Template viewpoint

The template viewpoint describes the camera position and tilt angle from which the photo was taken. Available viewpoints are listed below:

<table><thead><tr><th width="139">Viewpoint</th><th></th></tr></thead><tbody><tr><td><code>top</code></td><td>The view is top-down, looking down on the subject from above.</td></tr><tr><td><code>front</code></td><td>The view is horizontal, looking directly on the subject.</td></tr></tbody></table>

`front` viewpoint is used by default.

```json
{
    "scene": {
        "model": "v2",
        "template_url": "storage://storage-name/path/scene.png",
        "view": "top"
    }
}
```

### Prompt

You can use `prompt` in the same way as in the template-free approach, but `prompt` is not a required parameter for template-based approach.

{% hint style="info" %}
`generate` parameters is available only for `transform` and `adjust` modes.

`guidelines` parameter is available only for  `transform` mode.
{% endhint %}

### Inference steps

You can use `steps`  in the same way as in the template-free approach, and again, `steps` is not a required parameter for the template-based approach. By default, each `template_mode` has an optimal `steps` value. And `steps` is not available for `lock` mode.

### Possible values

<table><thead><tr><th width="212">Parameter</th><th width="75">Type</th><th width="139">Range</th><th>Default value</th></tr></thead><tbody><tr><td><code>template_url</code></td><td><em>string</em></td><td>1 - 4096</td><td><strong>is required</strong></td></tr><tr><td><code>view</code></td><td><em>string</em></td><td><code>top</code>, <code>front</code></td><td><code>front</code></td></tr><tr><td><code>prompt</code></td><td><em>string, object</em></td><td>3 - 2048</td><td></td></tr><tr><td><code>steps</code></td><td><em>integer</em></td><td>1-49</td><td>depends on <code>template_mode</code></td></tr></tbody></table>

## Template-based v1 model options

`v1` model also supports:&#x20;

### Color

You can use `color`  in the same way as in the template-free approach, and `color` is not a required parameter for template-based approach as well. If specified, color will be used as the main color of the image sample-based background.

### Negative prompt

The negative prompt parameter specifies elements to exclude from the generated background. The model will avoid including content matching this text. The `negative_prompt` must be between 3 and 2048 characters.

### Possible values

<table><thead><tr><th width="212">Parameter</th><th width="75">Type</th><th width="139">Range</th><th>Default value</th></tr></thead><tbody><tr><td><code>template_url</code></td><td><em>string</em></td><td>1 - 4096</td><td><strong>is required</strong></td></tr><tr><td><code>view</code></td><td><em>string</em></td><td><code>top</code>, <code>front</code></td><td><code>front</code></td></tr><tr><td><code>color</code></td><td><em>string</em></td><td><code>#000000</code> - <code>#ffffff</code></td><td></td></tr><tr><td><code>prompt</code></td><td><em>string</em></td><td>3 - 2048</td><td></td></tr><tr><td><code>negative_prompt</code></td><td><em>string</em></td><td>3 - 2048</td><td>text, watermark, man, woman, child, overlay text, cartoon, pixelated, illustration, ugly, painting, cropped, lowres, low quality, jpeg artifacts, signature, logo</td></tr><tr><td><code>steps</code></td><td><em>integer</em></td><td>1-49</td><td>depends on <code>template_mode</code></td></tr></tbody></table>

### Limitations

The template image viewpoint (camera position and tilt angle from which the photo was taken) should match the viewpoint of the product image.

## Product Shadows v2 model options

Shadows generation mode covers the straightforward yet highly popular scenario in product photography. Creating a shadow effect for a product on transparent or on a solid [Color](#color) can enhance its appearance. A product on a white background, for instance, looks better with a shadow.

```json
{
    "scene": {
        "effect": "shadows",
        "model": "v2",
        "color": "#d3d3d3",
        "view": "top",
        "aspect_ratio": "1:1"
    }
}

```

[Color](#color) and [Aspect ratio](#aspect-ratio) parameters are optional and omitting it will leave the background of the result image transparent and with a 1:1 aspect ratio.

### Viewpoint

The viewpoint describes the camera position and tilt angle from which the photo was taken. Available viewpoints are listed below:

<table><thead><tr><th width="139">Viewpoint</th><th></th></tr></thead><tbody><tr><td><code>auto</code></td><td>The shadows will be generated for the most common copyspace arrangement depending on the product.</td></tr><tr><td><code>top</code></td><td>The shadows will be generated for a copyspace photographed from above, with shadows around the product.</td></tr><tr><td><code>front</code></td><td>The shadows will be generated for a copyspace photographed frontally, with shadows under the product.</td></tr></tbody></table>

`auto` viewpoint is used by default.

### Possible values

<table><thead><tr><th width="212">Parameter</th><th width="75">Type</th><th width="139">Range</th><th>Default value</th></tr></thead><tbody><tr><td><code>effect</code></td><td><em>string</em></td><td><code>shadows</code></td><td><strong>is required</strong></td></tr><tr><td><code>model</code></td><td><em>string</em></td><td><code>v2</code></td><td><strong>is required</strong></td></tr><tr><td><code>view</code></td><td><em>string</em></td><td><code>auto,</code> <code>top</code>, <code>front</code></td><td><code>auto</code></td></tr><tr><td><code>color</code></td><td><em>string</em></td><td><code>#000000</code> - <code>#ffffff</code>, <code>"transparent"</code> </td><td></td></tr><tr><td><code>aspect_ratio</code></td><td><em>string</em></td><td>12:5 - 5:12</td><td></td></tr></tbody></table>

## Product Shadows v1 model options

Shadows generation mode covers the straightforward yet highly popular scenario in product photography. Creating a shadow effect for a product on transparent or on a solid [Color](#color) can enhance its appearance. A product on a white background, for instance, looks better with a shadow.

```json
{
    "scene": {
        "model": "v1",
        "effect": "shadows",
        "color": "#d3d3d3",
        "view": "top"
    }
}

```

&#x20;[Color](#color) parameter is optional and omitting it will leave the background of the result image transparent.

### Model v1 limitations

* Requires [Viewpoint](#viewpoint) parameter with either `front` or `top` values, `auto` is not supported.
* Does not support  [Aspect ratio](#aspect-ratio) parameter.
* Does not support placement for the [Object](/ai-background-api/ai-background-options/object), so you don't need to pass any of placement related parameters in request payload. Object payload should be:

```json
{
    "object": {
        "image_url": "https://images.claid.ai/photoshoot-templates/docs/product.png"
    }
}
```

### Possible values

<table><thead><tr><th width="212">Parameter</th><th width="75">Type</th><th width="139">Range</th><th>Default value</th></tr></thead><tbody><tr><td><code>effect</code></td><td><em>string</em></td><td><code>shadows</code></td><td><strong>is required</strong></td></tr><tr><td><code>model</code></td><td><em>string</em></td><td><code>v1-v2</code></td><td><code>v1</code></td></tr><tr><td><code>view</code></td><td><em>string</em></td><td><code>top</code>, <code>front</code></td><td><strong>is required</strong></td></tr><tr><td><code>color</code></td><td><em>string</em></td><td><code>#000000</code> - <code>#ffffff</code>, <code>"transparent"</code> </td><td></td></tr></tbody></table>


# API Reference

request and response description

### Background Generation contract

Below, you can see all possible options for the request body. See the [AI Background Options](/ai-background-api/ai-background-options) and [Image generation I/O](https://docs.claid.ai/image-generation-api/image-generation-i-o) sections to learn more about Background Generation options.

```json
{
  "output": {
    "destination": "storage://storage-name/path/"
    "number_of_images": 4,
    "format": "png" | "jpeg" | "webp" | "avif"
  },
  "object": {
    "image_url": "storage://storage-name/path/image.png",
    "placement_type": "absolute" | "original",
    "rotation_degree": 0,
    "scale": 1,
    "position": {
      "x": 0.5,
      "y": 0.5
    }
  },
  "scene": {
    "model": "v1" | "v2",
    "template_url": "storage://storage-name/path/template.png",
    "template_mode": "transform" | "adjust" | "lock",
    "color": "#aece8c",
    "view": "top" | "front",
    "prompt": "on the wooden table in the dark room" | 
      {
        "generate": true
      } |
      {
        "generate": true,
        "guidelines": "real life setting"
      },
    "negative_prompt": "watermark, low quality",
    "steps": 25,
    "aspect_ratio": "4:7" | "7:9" | "4:5" | "1:1" | "9:7" | "19:13" | "7:4" | "16:9" | "12:5",
    "preference": "fast" | "optimal" | "best"
  }
}
```

## Create Scene Api

> Specifies: \
> \- object to place on the scene and its properties (\`object\`)\
> \- scene properties (\`scene\`)\
> \- how many images will be created and where they will be stored (\`output\`)

```json
{"openapi":"3.1.0","info":{"title":"Claid REST API","version":"v1"},"tags":[{"name":"Image","description":"Encompasses operations with images."}],"security":[{"OAuth2PasswordBearer":["image_generation"]},{"OAuth2PasswordBearer":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}},"description":"To work with the Claid API, send requests over HTTPS and authenticate using the `Authorization` header in the following format:`Authorization: Bearer <YOUR_API_KEY>`. You do not need to provide a password.\n\nTo get your API key, [sign in to your Claid account](https://claid.ai/login) and click ***Create API key*** button from the ***Overview*** or ***API keys*** pages.\n\nClaid API’s base URL is `https://api.claid.ai/v1/`. All available endpoints are listed in the [Storage](#tag/Storage) and [Image](#tag/Image) sections. \n\n## Bearer\n\nThis API uses OAuth 2.0 [bearer token](https://datatracker.ietf.org/doc/html/rfc6750) (API key) to authorize requests."}},"schemas":{"SceneCreateAPIIn":{"title":"scene creation options","required":["object","scene"],"type":"object","properties":{"output":{"title":"Output URL","anyOf":[{"$ref":"#/components/schemas/SceneCreateAPIOutputIn"},{"type":"string","minLength":1,"maxLength":4096,"format":"uri"}],"description":"URL of the output images. If `output` is not defined, we store the output image on our bucket and return the temporary URL. Images are stored for one day.","default":{"number_of_images":4,"format":"png","resolution":"1MP"}},"object":{"title":"Object manipulation","anyOf":[{"$ref":"#/components/schemas/SceneCreateAPIObjectAbsoluteIn"},{"$ref":"#/components/schemas/SceneCreateAPIObjectOriginalIn"},{"$ref":"#/components/schemas/SceneCreateAPIObjectPaddingIn"}],"description":"Manipulate object on the scene so that the output images meet your requirements."},"scene":{"title":"Scene customization","anyOf":[{"$ref":"#/components/schemas/SceneCreateAPISceneBackgroundEffectIn"},{"$ref":"#/components/schemas/SceneCreateAPIScenePromptIn"},{"$ref":"#/components/schemas/SceneCreateAPISceneTemplateIn"}],"description":"Customize the scene so that the output images meet your requirements."}},"additionalProperties":false},"SceneCreateAPIOutputIn":{"title":"Output customization","type":"object","properties":{"number_of_images":{"title":"Number of images","maximum":4,"minimum":1,"type":"integer","description":"Number of images to create. By default 4 images will be created.","default":4},"destination":{"title":"Output URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the output images. If `output` is not defined, we store the output image on our bucket and return the temporary URL. Images are stored for one day.","format":"uri"},"format":{"title":"Format","anyOf":[{"$ref":"#/components/schemas/FormatEnum"},{"$ref":"#/components/schemas/FormatJpegOptions"},{"$ref":"#/components/schemas/FormatPngOptions"},{"$ref":"#/components/schemas/FormatWebpOptions"},{"$ref":"#/components/schemas/FormatAvifOptions"}],"description":"Converts images to one of the following formats: `\"jpeg\"`, `\"png\"`, `\"webp\"`, `\"avif\"`. Selecting *Jpeg Options* allows to specify quality.","default":"png"},"resolution":{"title":"Output resolution","allOf":[{"$ref":"#/components/schemas/SceneResolutionEnum"}],"description":"Total number of pixels of the output images. The scene aspect ratio is preserved, only the pixel budget changes.\n\n| Value | Description |\n| --- | --- |\n| `\"1MP\"` | DEFAULT. About 1 megapixel, e.g. 1024x1024 for a 1:1 scene.|\n| `\"2MP\"` | About 2 megapixels, e.g. 1440x1440 for a 1:1 scene. Only available when `scene.model` is `\"v2\"` and `scene.effect` is not used.|","default":"1MP"}},"additionalProperties":false},"FormatEnum":{"title":"Format","enum":["jpeg","png","webp","avif","tiff"],"type":"string","description":"Converts the image into specified format. Examples: `\"jpeg\"`, `\"png\"`."},"FormatJpegOptions":{"title":"jpeg options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["jpeg"],"type":"string","description":"Must have value `\"jpeg\"`"},"quality":{"title":"Quality","maximum":100,"minimum":1,"type":"integer","default":85},"progressive":{"title":"Progressive","type":"boolean","description":"Progressive JPEG loads in a browser in successive waves until a clear picture is formed. This improves image's loading speed.","default":true}},"additionalProperties":false},"FormatPngOptions":{"title":"png options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["png"],"type":"string","description":"Must have value `\"png\"`"},"compression":{"allOf":[{"$ref":"#/components/schemas/FormatCompressionLevelEnum"}],"description":"Specifies compression effort that will be applied during the PNG image encoding. Should have one of values: `\"fast\"`, `\"best\"`, or `\"optimal\"`. Defaults to `\"optimal\"`.","default":"optimal"}},"additionalProperties":false},"FormatCompressionLevelEnum":{"title":"Compression","enum":["fast","best","optimal"],"type":"string","description":"Indicates compression effort. \n\n| Value | Description |\n| --- | --- |\n| `\"fast\"` |  Used to apply minimum compression resulting in a bigger image size but less processing time.|\n| `\"best\"` | Used to apply maximum compression resulting in a smaller image size but more processing time.|\n| `\"optimal\"` | DEFAULT. Used to balance between compression effort and the processing time.|\n"},"FormatWebpOptions":{"title":"webp options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["webp"],"type":"string","description":"Must have value `\"webp\"`"},"compression":{"title":"Compression","anyOf":[{"$ref":"#/components/schemas/WebpCompressionEnum"},{"$ref":"#/components/schemas/WebpLossyCompressionOptions"},{"$ref":"#/components/schemas/WebpLosslessCompressionOptions"}],"description":"The WEBP codec supports both lossless and lossy modes of operation, so you can select the one that is appropriate for your goals. Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image. You can specify the amount of loss you are willing to accept. By default it's set to to 75. Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.","default":{"type":"lossy","quality":75}}},"additionalProperties":false},"WebpCompressionEnum":{"title":"WEBP Compression","enum":["lossy","lossless"],"type":"string","description":"Selects the WEBP compression type: \n\n| Value | Description |\n| --- | --- |\n| `\"lossy\"` | Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image.|\n| `\"lossless\"` | Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.|\n"},"WebpLossyCompressionOptions":{"title":"WebpLossyCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossy"],"type":"string","description":"Must have value `\"lossy\"`"},"quality":{"title":"Quality","maximum":100,"minimum":1,"type":"integer","default":75}},"additionalProperties":false},"WebpLosslessCompressionOptions":{"title":"WebpLosslessCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossless"],"type":"string","description":"Must have value `\"lossless\"`"}},"additionalProperties":false},"FormatAvifOptions":{"title":"avif options","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["avif"],"type":"string","description":"Must have value `\"avif\"`"},"compression":{"title":"Compression","anyOf":[{"$ref":"#/components/schemas/AvifCompressionEnum"},{"$ref":"#/components/schemas/AvifLossyCompressionOptions"},{"$ref":"#/components/schemas/AvifLosslessCompressionOptions"}],"description":"The AVIF codec supports both lossless and lossy modes of operation, so you can select the one that is appropriate for your goals. Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image. You can specify the amount of loss you are willing to accept. Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.","default":{"type":"lossy","quality":50}}},"additionalProperties":false},"AvifCompressionEnum":{"title":"AVIF Compression","enum":["lossy","lossless"],"type":"string","description":"Selects the AVIF compression type: \n\n| Value | Description |\n| --- | --- |\n| `\"lossy\"` | Lossy compression allows you to reduce the size of the image significantly in exchange for some loss of data, reducing the quality of an image.|\n| `\"lossless\"` | Lossless compression allows you to save maximum image details in exchange for a significantly increased file size.|\n"},"AvifLossyCompressionOptions":{"title":"AvifLossyCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossy"],"type":"string","description":"Must have value `\"lossy\"`"},"quality":{"title":"Quality","maximum":100,"minimum":1,"type":"integer","default":50}},"additionalProperties":false},"AvifLosslessCompressionOptions":{"title":"AvifLosslessCompressionOptions","required":["type"],"type":"object","properties":{"type":{"title":"Type","enum":["lossless"],"type":"string","description":"Must have value `\"lossless\"`"}},"additionalProperties":false},"SceneResolutionEnum":{"title":"SceneResolutionEnum","enum":["1MP","2MP"],"type":"string","description":"Output resolution presets: the total number of pixels of the generated images"},"SceneCreateAPIObjectAbsoluteIn":{"title":"SceneCreateAPIObjectAbsoluteIn","required":["image_url"],"type":"object","properties":{"image_url":{"title":"Object image file URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the input image. Should be from 1 to 4096 characters. Image must be accessible by our system. For better results, the background of the image should be transparent.","format":"uri"},"placement_type":{"title":"Placement Type","enum":["absolute"],"type":"string","description":"`\"absolute\"` placement type allows to manually specify the absolute position, scale, and rotation degree of the object on a scene.","default":"absolute"},"rotation_degree":{"title":"Degree of object rotation","anyOf":[{"type":"number","minimum":0,"maximum":360},{"type":"integer","minimum":0,"maximum":360}],"description":"Degree of object rotation on the scene. By default, the object is not rotated. (i.e. 0.0).","default":0},"scale":{"title":"Relative object scale","anyOf":[{"type":"integer","minimum":0,"maximum":1},{"type":"number","minimum":0.01,"maximum":1}],"description":"Relative object scale in relation to the scene. By default, the object is scaled to the scene edges. (i.e. 1.0).","default":1},"position":{"title":"Relative object position","allOf":[{"$ref":"#/components/schemas/ObjectPosition"}],"description":"Relative object position on the scene. By default, the object is positioned at the center of the scene (i.e. x=0.5, y=0.5).","default":{"x":0.5,"y":0.5}}},"additionalProperties":false},"ObjectPosition":{"title":"ObjectPosition","type":"object","properties":{"x":{"title":"Horizontal position","maximum":1,"minimum":0,"type":"number","description":"Relative position on the scene, where 0 is the left edge of the image and 1 is the right edge of the image.","default":0.5},"y":{"title":"Vertical position","maximum":1,"minimum":0,"type":"number","description":"Relative position on the scene, where 0 is the bottom edge of the image and 1 is the top edge of the image.","default":0.5}},"additionalProperties":false},"SceneCreateAPIObjectOriginalIn":{"title":"SceneCreateAPIObjectOriginalIn","required":["image_url","placement_type"],"type":"object","properties":{"image_url":{"title":"Object image file URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the input image. Should be from 1 to 4096 characters. Image must be accessible by our system. For better results, the background of the image should be transparent.","format":"uri"},"placement_type":{"title":"Placement Type","enum":["original"],"type":"string","description":"`\"original\"` placement type instructs to use an object position and scale from the input image, meaning this placement method is fully automated and does not require any additional parameters."}},"additionalProperties":false},"SceneCreateAPIObjectPaddingIn":{"title":"SceneCreateAPIObjectPaddingIn","required":["image_url","placement_type","padding"],"type":"object","properties":{"image_url":{"title":"Object image file URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the input image. Should be from 1 to 4096 characters. Image must be accessible by our system. For better results, the background of the image should be transparent.","format":"uri"},"placement_type":{"title":"Placement Type","enum":["padding"],"type":"string","description":"`\"padding\"` placement type allows to add a space around the object equally to each of 4 sides, or for height&width separately."},"padding":{"title":"Padding around the object","type":"string","description":"Add a space around the object equally to each of 4 sides, or for height&width separately. Can not be bigger than half of image width/height."}},"additionalProperties":false},"SceneCreateAPISceneBackgroundEffectIn":{"title":"Scene background effect","required":["effect"],"type":"object","properties":{"model":{"title":"Scene creation model","allOf":[{"$ref":"#/components/schemas/SceneCreateModelEnum"}],"description":"Selects the scene creation model. By default, the model is 'v1'.","default":"v1"},"effect":{"$ref":"#/components/schemas/SceneEffectEnum"},"color":{"title":"Product background coloring","anyOf":[{"type":"string","title":"Color","description":"Color as a hexadecimal. Examples: `\"#ffffff\"`, `\"#000000\"`."},{"$ref":"#/components/schemas/ColorEnum"}],"description":"Color as a hexadecimal."},"view":{"title":"Product viewpoint","allOf":[{"$ref":"#/components/schemas/TemplateViewAutoEnum"}],"description":"The position of the viewpoint relative to the scene\n\n| Value | Description |\n| --- | --- |\n| `\"top\"` | The view is top-down, looking down on the scene from above.|\n| `\"front\"` | The view is horizontal, looking directly on the scene.|\n| `\"auto\"` | The view is automatically selected.|","default":"auto"},"aspect_ratio":{"title":"Scene aspect ratio","allOf":[{"$ref":"#/components/schemas/SceneAspectRatioEnum"}],"description":"Aspect ratio of the scene. By default, the aspect ratio is 1:1.","default":"1:1"}},"additionalProperties":false},"SceneCreateModelEnum":{"title":"SceneCreateModelEnum","enum":["v1","v2-beta","v2"],"type":"string","description":"An enumeration."},"SceneEffectEnum":{"title":"Additional scene effect","enum":["shadows"],"type":"string","description":"Selects the scene effect.\n\n| Value | Description |\n| --- | --- |\n| `\"shadows\"` | Apply shadow generation on the image.|\n"},"ColorEnum":{"title":"Transparent","enum":["transparent"],"type":"string","description":"Makes the background of the image transparent, only works for `\"png\"` output format."},"TemplateViewAutoEnum":{"title":"Template view direction","enum":["auto","top","front"],"type":"string","description":"Selects the template view direction.\n\n| Value | Description |\n| --- | --- |\n| `\"top\"` | The view is top-down, looking down on the scene from above.|\n| `\"front\"` | The view is horizontal, looking directly on the scene.|\n| `\"auto\"` | The view is automatically selected.|"},"SceneAspectRatioEnum":{"title":"SceneAspectRatioEnum","enum":["21:9","1:1","4:3","3:2","2:3","5:4","4:5","3:4","16:9","9:16"],"type":"string","description":"Aspect ratios supported by scene generation (both creative and high-precision modes)"},"SceneCreateAPIScenePromptIn":{"title":"Template-free scene","required":["prompt"],"type":"object","properties":{"model":{"title":"Scene creation model","allOf":[{"$ref":"#/components/schemas/SceneCreateModelEnum"}],"description":"Selects the scene creation model. By default, the model is 'v1'.","default":"v1"},"prompt":{"title":"Text prompt for scene creation","anyOf":[{"type":"string","minLength":3,"maxLength":2048},{"$ref":"#/components/schemas/ScenePromptAdvancedIn"}],"description":"Text prompt that will be used to create the scene. Should be from 3 to 2048 characters."},"negative_prompt":{"title":"Negative text prompt for scene creation","maxLength":2048,"minLength":3,"type":"string","description":"Text prompt that will exclude things from the scene. Should be from 3 to 2048 characters. "},"steps":{"title":"Number of inference steps","exclusiveMaximum":50,"minimum":1,"type":"integer","description":"The more inference steps you use, the better the results, but the more steps, the longer it takes to generate. If you want faster results, you can use fewer steps. If you want higher-quality results, you can use more steps. By default each `template_mode` has an optimal `steps` value."},"color":{"title":"Color","type":"string","description":"Color as a hexadecimal. Examples: `\"#ffffff\"`, `\"#000000\"`."},"aspect_ratio":{"title":"Scene aspect ratio","allOf":[{"$ref":"#/components/schemas/SceneAspectRatioEnum"}],"description":"Aspect ratio of the scene. By default, the aspect ratio is 1:1.","default":"1:1"},"preference":{"title":"Preference control","allOf":[{"$ref":"#/components/schemas/PreferenceEnum"}],"description":"Preference control allows you to balance between generation speed and output image quality. Higher speed decreases image quality but enables quicker experimentation to find the best parameters for your background.\n\n| Value | Description |\n| --- | --- |\n| `\"fast\"` | Faster generation, lower quality.|\n| `\"optimal\"` | Balance between speed and quality.|| `\"best\"` | Highest quality, slower generation.|","default":"optimal"}},"additionalProperties":false},"ScenePromptAdvancedIn":{"title":"ScenePromptAdvancedIn","type":"object","properties":{"text":{"title":"Text prompt for scene creation","maxLength":2048,"minLength":3,"type":"string","description":"Text prompt that will be used to create the scene. Should be from 3 to 2048 characters."},"generate":{"title":"Auto-generate prompt","type":"boolean","description":"If `true`, the prompt will be generated automatically based on the input image.By default, the prompt is not auto-generated. If `true`, the `text` is not allowed.","default":false},"guidelines":{"title":"Guidelines","maxLength":1000,"minLength":3,"type":"string","description":"Guidelines for prompt generation. Only available when `generate` is `true`."}},"additionalProperties":false},"PreferenceEnum":{"title":"Preference control","enum":["fast","optimal","best"],"type":"string","description":"Preference control allows you to balance between generation speed and output image quality. Higher speed decreases image quality but enables quicker experimentation to find the best parameters for your background.\n\n| Value | Description |\n| --- | --- |\n| `\"fast\"` | Faster generation, lower quality.|\n| `\"optimal\"` | Balance between speed and quality.|| `\"best\"` | Highest quality, slower generation.|"},"SceneCreateAPISceneTemplateIn":{"title":"Template-based scene","required":["template_url","view"],"type":"object","properties":{"model":{"title":"Scene creation model","allOf":[{"$ref":"#/components/schemas/SceneCreateModelEnum"}],"description":"Selects the scene creation model. By default, the model is 'v1'.","default":"v1"},"template_mode":{"title":"Template mode","allOf":[{"$ref":"#/components/schemas/TemplateModeEnum"}],"description":"Selects how closely the result should match the template.\n\n| Value | Description |\n| --- | --- |\n| `\"transform\"` | Template is transformed according to the prompt and color.|\n| `\"adjust\"` | Template is slightly adjusted to the product and prompt.|| `\"lock\"` | Template is preserved with maximum detail.|","default":"transform"},"template_url":{"title":"Template image file URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the input image. Should be from 1 to 4096 characters. Image must be accessible by our system. Is optional, if `prompt` is specified.","format":"uri"},"color":{"title":"Color","type":"string","description":"Color as a hexadecimal. Examples: `\"#ffffff\"`, `\"#000000\"`."},"view":{"title":"Template viewpoint","allOf":[{"$ref":"#/components/schemas/TemplateViewEnum"}],"description":"The position of the viewpoint relative to the scene\n\n| Value | Description |\n| --- | --- |\n| `\"top\"` | The view is top-down, looking down on the scene from above.|\n| `\"front\"` | The view is horizontal, looking directly on the scene.|"},"prompt":{"title":"Text prompt for scene creation","anyOf":[{"type":"string","minLength":3,"maxLength":2048},{"$ref":"#/components/schemas/ScenePromptAdvancedIn"}],"description":"Text prompt that will be used to create the scene. Should be from 3 to 2048 characters. "},"negative_prompt":{"title":"Negative text prompt for scene creation","maxLength":2048,"minLength":3,"type":"string","description":"Text prompt that will exclude things from the scene. Should be from 3 to 2048 characters. "},"steps":{"title":"Number of inference steps","exclusiveMaximum":50,"minimum":1,"type":"integer","description":"The more inference steps you use, the better the results, but the more steps, the longer it takes to generate. If you want faster results, you can use fewer steps. If you want higher-quality results, you can use more steps. By default each `template_mode` has an optimal `steps` value."}},"additionalProperties":false},"TemplateModeEnum":{"title":"Template mode","enum":["transform","lock","adjust"],"type":"string","description":"Selects how closely the result should match the template.\n\n| Value | Description |\n| --- | --- |\n| `\"transform\"` | Template is transformed according to the prompt and color.|\n| `\"adjust\"` | Template is slightly adjusted to the product and prompt.|| `\"lock\"` | Template is preserved with maximum detail.|"},"TemplateViewEnum":{"title":"Template view direction","enum":["top","front"],"type":"string","description":"Selects the template view direction.\n\n| Value | Description |\n| --- | --- |\n| `\"top\"` | The view is top-down, looking down on the scene from above.|\n| `\"front\"` | The view is horizontal, looking directly on the scene.|"},"Response_ScenePipelineResponseOut_":{"title":"Response[ScenePipelineResponseOut]","type":"object","properties":{"data":{"$ref":"#/components/schemas/ScenePipelineResponseOut"}},"description":"Wrapper for responses"},"ScenePipelineResponseOut":{"title":"ScenePipelineResponseOut","required":["input","output"],"type":"object","properties":{"input":{"$ref":"#/components/schemas/PipelineInputObject"},"output":{"title":"Output","type":"array","items":{"$ref":"#/components/schemas/PipelineOutputObject"}},"profiling":{"title":"Profiling","type":"object"}}},"PipelineInputObject":{"title":"PipelineInputObject","required":["ext","mps","mime","format","width","height"],"type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension. Can have values: `\"jpg\"`, `\"png\"`, `\"avif\"`"},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as ‘media type’)"},"format":{"title":"Format","type":"string","description":"File format. Can have values: `\"jpeg\"`, `\"png\"`, `\"avif\"`"},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"}}},"PipelineOutputObject":{"title":"PipelineOutputObject","required":["ext","mps","mime","format","width","height"],"type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension. Can have values: `\"jpg\"`, `\"png\"`, `\"avif\"`"},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as ‘media type’)"},"format":{"title":"Format","type":"string","description":"File format. Can have values: `\"jpeg\"`, `\"png\"`, `\"avif\"`"},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"},"tmp_url":{"title":"Tmp Url","type":"string","description":"Temporal URL of a processed image"},"object_key":{"title":"Object Key","type":"string","description":"Path to a processed image in a bucket"},"object_bucket":{"title":"Object Bucket","type":"string","description":"Bucket name"},"object_uri":{"title":"Object Uri","type":"string","description":"URI of a processed image in a bucket"},"claid_storage_uri":{"title":"Claid Storage Uri","type":"string","description":"URI of a processed image in a storage"}}},"HttpErrorDetails":{"title":"HttpErrorDetails","required":["error_code","error_type","error_message"],"type":"object","properties":{"error_code":{"title":"Error Code","type":"string"},"error_type":{"$ref":"#/components/schemas/ErrorType"},"error_message":{"title":"Error Message","type":"string"},"error_details":{"title":"Error Details","type":"object","default":{}}}},"ErrorType":{"title":"ErrorType","enum":["auth","dlvr","general","le","survey","storage","image","user_settings","user","validation","analytics","scene","billing","web","runtime_settings","animation","custom_models"],"type":"string","description":"An enumeration."}}},"paths":{"/v1/scene/create":{"post":{"tags":["Image"],"summary":"Create Scene Api","description":"Specifies: \n- object to place on the scene and its properties (`object`)\n- scene properties (`scene`)\n- how many images will be created and where they will be stored (`output`)","operationId":"create_scene_api_v1_scene_create_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SceneCreateAPIIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response_ScenePipelineResponseOut_"}}}},"401":{"description":"Authorization is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"402":{"description":"No API calls left.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"403":{"description":"Not enough permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"422":{"description":"Unprocessable Entity.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}}}}}}}
```

**Request**

{% tabs %}
{% tab title="HTTP" %}

```http
POST /v1/scene/create HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
Content-Type: application/json

{
  "object": {
    "image_url": "https://images.claid.ai/photoshoot-templates/docs/product.png",
    "rotation_degree": 0.0,
    "scale": 0.55,
    "position": {
      "x": 0.35,
      "y": 0.5
    }
  },
  "scene": {
    "template_url": "https://images.claid.ai/photoshoot-templates/docs/scene.png",
    "template_mode": "transform",
    "view": "front",
    "prompt": "marble countertop, marble wall background, monochromatic, bokeh, closeup, professional product photography"
  },
  "output": {
    "number_of_images": 1,
    "format": "png"
  }
}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl -X POST --location "https://api.claid.ai/v1/scene/create" --http1.1 \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}" \
    -H "Content-Type: application/json" \
    -d "{
      \"object\": {
        \"image_url\": \"https://images.claid.ai/photoshoot-templates/docs/product.png\",
        \"rotation_degree\": 0.0,
        \"scale\": 0.55,
        \"position\": {
          \"x\": 0.35,
          \"y\": 0.5
        }
      },
      \"scene\": {
        \"template_url\": \"https://images.claid.ai/photoshoot-templates/docs/scene.png\",
        \"template_mode\": \"transform\",
        \"view\": \"front\",
        \"prompt\": \"marble countertop, marble wall background, monochromatic, bokeh, closeup, professional product photography\"
      },
      \"output\": {
        \"number_of_images\": 1,
        \"format\": \"png\"
      }
    }"
```

{% endtab %}
{% endtabs %}

#### **Read a response**

Once you have made the request to `https://api.claid.ai/v1/scene/create` you will get a response with information about input text and output images.

Image information is shown in the response:

| Parameter | Type    | Description                                                                |
| --------- | ------- | -------------------------------------------------------------------------- |
| ext       | string  | File extension. Will have `png` value                                      |
| mps       | integer | Megapixel count                                                            |
| mime      | string  | MIME type (also known as ‘media type’)                                     |
| width     | integer | Image width in pixels                                                      |
| height    | integer | Image height in pixels                                                     |
| format    | string  | File format. Will have `png` value                                         |
| tmp\_url  | string  | Temporary URL of a processed image. Will be empty if `output` is specified |

**Response body**

```json
{
    "data": {
        "input": {
                "ext": "png",
		"mps": 1.817323,
		"mime": "image/png",
		"format": "PNG",
		"width": 773,
		"height": 2351
        },
        "output": [
            {
                "ext": "png",
                "mps": 1.048576,
                "mime": "image/png",
                "format": "PNG",
                "width": 1024,
                "height": 1024,
                "tmp_url": "https://dl.claid.ai/efca3eae-2eb5-4952-ae83-b300ce41ab90/4bede5530f994346a3ca52d4ae6631a0.png"
            },
            {
               "ext": "png",
                "mps": 1.048576,
                "mime": "image/png",
                "format": "PNG",
                "width": 1024,
                "height": 1024,
                "tmp_url": "https://dl.claid.ai/72226dad-8311-4927-9879-8bb4f3ca38c4/55ccc333e60e463d820e908c899348df.png"
            },
        ]
    }
}
```

#### Headers:

See the [Request Headers](/image-editing-api/api-reference#request-headers) and [Response Headers](/image-editing-api/api-reference#response-headers) to learn about headers.


# Image to Video I/O

Learn how to configure input and output to use the Image to Video API.

### Intro

The Image to Video API allows you to turn a simple product photo into an animated visual asset.

#### Cost

* 35 credits per 5 second video.
* 70 credits per 10 second video.

#### Rate limits

* 1 generation per 1 second.
* 15 generations per 1 minute.

#### Limitations

* Only one input image can be processed per request.
* Only one video can be generated per request.
* Each side of the input image should be greater than or equal to 300px.
* Input image format should be JPG, PNG, WEBP, HEIC or HEIF.

### Input

URL of the input image should be from 1 to 512 characters. The image must be accessible by our system.

```json
{
    "input": "https://letsenhance.io/docs/assets/samples/burger.jpg"
}
```

#### Connected storage

You can connect [Cloud Storage](/storage-connectors/overview) and use it as a source for images. Currently, our API supports AWS S3 and Google Cloud Storage.

After connecting your Cloud Storage, you can refer the storage name as an input.

```json
{
    "input": "storage://storage-name/input-path/input.png"
}
```

### Output

Configuring output is optional. By default, you may omit the output option from the request payload. In this case, our system stores the result in a temporary bucket with a lifespan of 24 hours and provides a public URL to the video.

Alternatively, you can use a connected [Cloud Storage](/storage-connectors/overview): just configure the path to the folder where you want to store results.

```json
{
    "output": "storage://storage-name/output-path/output.mp4"
}
```

You can also specify a folder output, in this case a unique filename will be generated for the output.

```json
{
    "output": "storage://storage-name/output-path/"
}
```


# Image to Video Options

Learn how to control Image to Video generation.

### Prompt

The Image to Video API accepts text prompts to define the result. Prompts can be generated automatically using Autoprompt AI or provided manually.

**Autoprompt AI: Automatic prompt generation**

Autoprompt AI analyzes the input product image and generates a text prompt tailored to create a contextually relevant video. This is useful for automating image to video generation, especially with large batches of images.

**How to use it:** Set the `generate` parameter to `true` within the `prompt` object in the `options` section of your API request.

```json
{
    "options": {
        "prompt": {
            "generate": true
        }
    }
}
```

You can influence Autoprompt AI by providing guidelines:

```json
{
    "options": {
        "prompt": {
            "generate": true,
            "guidelines": "zoom out, glitter particles"
        }
    }
}
```

**Custom prompts: Manual control**

For even more precise control over the animation and visual elements, provide your own prompt. Custom prompts must be between 3 and 5000 characters.

**Example:**

{% code overflow="wrap" %}

```json
{
    "options": {
        "prompt": "The camera slowly rotates left to right around the burger with natural and realistic motion. Steam rises gently from the top, drifting upward. Bacon edges shift slightly from the heat. Melted cheese softens and begins to drip slowly. A thick drop of sauce slides down the side. The grilled patty glistens as it turns, showing juicy texture. Lettuce and tomato stay fresh and still. The bun gives off a soft heat shimmer. As the camera moves, the full burger looks hot, fresh, and ready to eat. The background shifts gently with it, keeping the burger centered. Soft, out-of-focus lighting moves across the backdrop, creating a rich, appetizing atmosphere."
    }
}
```

{% endcode %}

#### Sound

Generated videos include an audio track. The video model creates sound together with the visuals: ambience, sound effects, and speech when the prompt calls for them. Audio generation cannot be disabled at the model level, and every output file contains an audio stream.

**Default behavior with Autoprompt AI**

When you use automatic prompt generation (`"prompt": {"generate": true}`), Autoprompt keeps audio to a near-silent minimum unless your `guidelines` ask for sound. To get a rich sound layer, describe it in the guidelines, for example: `"slow push-in with a soft fabric rustle"` or `"she says: this serum changed my routine"`.

**Minimizing sound in custom prompts**

If you provide your own prompt and it says nothing about audio, the model improvises its own sound, which may include music or speech. To keep a clip quiet, append this to your prompt:

{% code overflow="wrap" %}

```
AUDIO: Near-total silence. Barely audible neutral room tone at extremely low volume. No dialogue, voices, music, sound effects, footsteps, wind, or environmental sounds.
```

{% endcode %}

This reliably minimizes audible content, but it is best effort: it does not guarantee a silent result, and the file still contains an audio track.

**Guaranteed silence**

For guaranteed-silent output, remove the audio stream after downloading the video:

```
ffmpeg -i video.mp4 -c:v copy -an video_silent.mp4
```

This copies the video stream without re-encoding, so it's lossless and takes a fraction of a second per clip.

Generating silent videos at scale? We can handle audio stripping inside a managed pipeline as part of an enterprise plan. \[[Contact us →](https://claid.ai/contact-sales)]

### Duration

The duration parameter controls how long the generated video will be. It can be set to 5 seconds or 10 seconds.

```json
{
    "options": {
        "prompt": {"generate": true},
        "duration": 5
    }
}
```

### Possible values

<table><thead><tr><th width="244">Parameter</th><th>Type</th><th>Range</th><th>Default value</th></tr></thead><tbody><tr><td><mark style="color:purple;"><code>prompt</code></mark></td><td>string or object</td><td>3 - 5000</td><td><strong>is required</strong></td></tr><tr><td><mark style="color:purple;"><code>duration</code></mark></td><td>integer</td><td><code>5</code>, <code>10</code></td><td>5</td></tr></tbody></table>


# Async API Reference

Request and response description.

### Image to Video contract

This endpoint is asynchronous, it returns a response without waiting for an actual result. The actual result should be queried with another request. So you can request Image to Video generation and separately get the result after it's ready. See [Image to Video Options](/image-to-video-api/image-to-video-options) and [Image to Video I/O](/image-to-video-api/image-to-video-i-o) to learn about request data.

```json
{
  "input": "storage://storage-name/input-path/input.png",
  "output": "storage://storage-name/output-path/",
  "options": {
    "prompt": "A subtle animation for a product-centered setting, camera zoom out" | 
      {
        "generate": true
      } | 
      {
        "generate": true,
        "guidelines": "zoom out, glitter particles"
      },
    "duration": 5 | 10
  }
}
```

## Video Generate Api

> Generate an animation asynchronously

```json
{"openapi":"3.1.0","info":{"title":"Claid REST API","version":"v1"},"tags":[{"name":"Video","description":"Encompasses operations with videos."}],"security":[{"OAuth2PasswordBearer":["video_generation"]},{"OAuth2PasswordBearer":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}},"description":"To work with the Claid API, send requests over HTTPS and authenticate using the `Authorization` header in the following format:`Authorization: Bearer <YOUR_API_KEY>`. You do not need to provide a password.\n\nTo get your API key, [sign in to your Claid account](https://claid.ai/login) and click ***Create API key*** button from the ***Overview*** or ***API keys*** pages.\n\nClaid API’s base URL is `https://api.claid.ai/v1/`. All available endpoints are listed in the [Storage](#tag/Storage) and [Image](#tag/Image) sections. \n\n## Bearer\n\nThis API uses OAuth 2.0 [bearer token](https://datatracker.ietf.org/doc/html/rfc6750) (API key) to authorize requests."}},"schemas":{"ImageVideoRequest":{"title":"ImageVideoRequest","required":["input","options"],"type":"object","properties":{"output":{"title":"Output","maxLength":4096,"minLength":1,"type":"string","description":"Customize the result output.","format":"uri"},"input":{"title":"Input URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the input image. Image must be accessible by our system.","format":"uri"},"options":{"title":"Options","allOf":[{"$ref":"#/components/schemas/VideoOptionsObject"}],"description":"Customize the video."}},"additionalProperties":false},"VideoOptionsObject":{"title":"VideoOptionsObject","required":["prompt"],"type":"object","properties":{"prompt":{"title":"Prompt","anyOf":[{"type":"string","minLength":3,"maxLength":5000},{"$ref":"#/components/schemas/VideoPromptObject"}],"description":"Prompt for the video."},"negative_prompt":{"title":"Negative Prompt","maxLength":5000,"minLength":3,"type":"string","description":"Negative prompt for the video."},"duration":{"allOf":[{"$ref":"#/components/schemas/DurationEnum"}],"description":"Duration of the video.","default":"5"},"guidance_scale":{"title":"Guidance Scale","maximum":1,"minimum":0,"type":"number","description":"Guidance scale for the video.","default":0.5}},"additionalProperties":false},"VideoPromptObject":{"title":"VideoPromptObject","type":"object","properties":{"text":{"title":"Text","maxLength":5000,"minLength":3,"type":"string","description":"Prompt for the video."},"generate":{"title":"Generate","type":"boolean","description":"If `true`, the prompt will be generated automatically based on the input image.By default, the prompt is not auto-generated. If `true`, the `text` is not allowed.","default":false},"guidelines":{"title":"Guidelines","maxLength":1000,"minLength":3,"type":"string","description":"Guidelines for prompt generation. Only available when `generate` is `true`."}}},"DurationEnum":{"title":"DurationEnum","enum":["5","10"],"type":"string","description":"An enumeration."},"Response_VideoAcceptedResponse_":{"title":"Response[VideoAcceptedResponse]","type":"object","properties":{"data":{"$ref":"#/components/schemas/VideoAcceptedResponse"}},"description":"Wrapper for responses"},"VideoAcceptedResponse":{"title":"VideoAcceptedResponse","required":["id","status","created_at","request","result_url"],"type":"object","properties":{"id":{"title":"Id","type":"integer"},"status":{"$ref":"#/components/schemas/APIV1Status"},"created_at":{"title":"Created At","type":"string","format":"date-time"},"request":{"$ref":"#/components/schemas/VideoRequestInResponse"},"result_url":{"title":"Result Url","maxLength":65536,"minLength":1,"type":"string","format":"uri"}}},"APIV1Status":{"title":"APIV1Status","enum":["ACCEPTED","WAITING","PROCESSING","DONE","ERROR","CANCELLED","PAUSED"],"type":"string","description":"An enumeration."},"VideoRequestInResponse":{"title":"VideoRequestInResponse","required":["input","options"],"type":"object","properties":{"output":{"title":"Output","maxLength":4096,"minLength":1,"type":"string","description":"Customize the result output.","format":"uri"},"input":{"title":"Input URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the input image. Image must be accessible by our system.","format":"uri"},"options":{"title":"Options","allOf":[{"$ref":"#/components/schemas/VideoOptionsObject"}],"description":"Customize the video."}},"additionalProperties":false},"HttpErrorDetails":{"title":"HttpErrorDetails","required":["error_code","error_type","error_message"],"type":"object","properties":{"error_code":{"title":"Error Code","type":"string"},"error_type":{"$ref":"#/components/schemas/ErrorType"},"error_message":{"title":"Error Message","type":"string"},"error_details":{"title":"Error Details","type":"object","default":{}}}},"ErrorType":{"title":"ErrorType","enum":["auth","dlvr","general","le","survey","storage","image","user_settings","user","validation","analytics","scene","billing","web","runtime_settings","animation","custom_models"],"type":"string","description":"An enumeration."}}},"paths":{"/v1/video/generate":{"post":{"tags":["Video"],"summary":"Video Generate Api","description":"Generate an animation asynchronously","operationId":"video_generate_api_v1_video_generate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageVideoRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response_VideoAcceptedResponse_"}}}},"401":{"description":"Authorization is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"402":{"description":"No API calls left.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"403":{"description":"Not enough permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"422":{"description":"Unprocessable Entity.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"429":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}}}}}}}
```

**Request**

{% tabs %}
{% tab title="HTTP" %}

```http
POST https://api.claid.ai/v1/video/generate HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
Content-Type: application/json

{
  "input": "storage://storage-name/input-path/input.png",
  "output": "storage://storage-name/output-path/",
  "options": {
    "prompt": {
      "generate": true
    },
    "duration": 5
  }
}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl -X POST --location "https://api.claid.ai/v1/video/generate" --http1.1 \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}" \
    -H "Content-Type: application/json" \
    -d "{
      \"input\": \"storage://storage-name/input-path/input.png\",
      \"output\": \"storage://storage-name/output-path/\",
      \"options\": {
        \"prompt\": {
          \"generate\": true,
        }
        \"duration\": 5
      }
    }"
```

{% endtab %}
{% endtabs %}

#### **Read a response**

Once you have made the request to <mark style="color:purple;">`https://api.claid.ai/v1/video/generate`</mark> you will get a response with information about request status and some other details (listed below).

Request information shown in the response:

<table><thead><tr><th width="154">Parameter</th><th width="109.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>integer</td><td>Task ID.</td></tr><tr><td>status</td><td>string</td><td>Request processing status. For a valid request can only have one value: <mark style="color:purple;"><code>PROCESSING</code></mark>.</td></tr><tr><td>result_url</td><td>string</td><td>URL of GET endpoint that can be used to get the result manually and get request status while it is still in process.</td></tr><tr><td>created_at</td><td>string</td><td>Exact time when the processing was requested.</td></tr><tr><td>request</td><td>object</td><td>The body of the request that was used for processing.</td></tr></tbody></table>

#### **Response body**

```json
{
  "data": {
    "id": 1,
    "status": "PROCESSING",
    "created_at": "2025-05-12T15:10:21.517229+00:00",
    "request": {
      "output": "storage://storage-name/output-path/",
      "input": "storage://storage-name/input-path/input.png",
      "options": {
        "prompt": {
          "generate": true
        },
        "duration": "5"
      }
    },
    "result_url": "http://api.claid.ai/v1/video/generate/1"
  }
}
```

See the [Request Headers](/image-editing-api/api-reference#request-headers) and [Response Headers](/image-editing-api/api-reference#response-headers) to learn about headers.

### Result of request processing contract

To get the result, you need to know the ID of the processing request. Or you can take a ready-to-use link from the <mark style="color:purple;">`result_url`</mark> property of the response body described above.

## Video Generate Api Status

> Get the status of the animation generation task

```json
{"openapi":"3.1.0","info":{"title":"Claid REST API","version":"v1"},"tags":[{"name":"Video","description":"Encompasses operations with videos."}],"security":[{"OAuth2PasswordBearer":["video_generation"]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}},"description":"To work with the Claid API, send requests over HTTPS and authenticate using the `Authorization` header in the following format:`Authorization: Bearer <YOUR_API_KEY>`. You do not need to provide a password.\n\nTo get your API key, [sign in to your Claid account](https://claid.ai/login) and click ***Create API key*** button from the ***Overview*** or ***API keys*** pages.\n\nClaid API’s base URL is `https://api.claid.ai/v1/`. All available endpoints are listed in the [Storage](#tag/Storage) and [Image](#tag/Image) sections. \n\n## Bearer\n\nThis API uses OAuth 2.0 [bearer token](https://datatracker.ietf.org/doc/html/rfc6750) (API key) to authorize requests."}},"schemas":{"Response_VideoStatusResponse_":{"title":"Response[VideoStatusResponse]","type":"object","properties":{"data":{"$ref":"#/components/schemas/VideoStatusResponse"}},"description":"Wrapper for responses"},"VideoStatusResponse":{"title":"VideoStatusResponse","required":["id","status","created_at","request"],"type":"object","properties":{"id":{"title":"Id","type":"integer"},"status":{"$ref":"#/components/schemas/APIV1Status"},"created_at":{"title":"Created At","type":"string","format":"date-time"},"request":{"$ref":"#/components/schemas/VideoRequestInResponse"},"errors":{"title":"Errors","type":"array","items":{"$ref":"#/components/schemas/VideoError"}},"result":{"$ref":"#/components/schemas/VideoResult"}}},"APIV1Status":{"title":"APIV1Status","enum":["ACCEPTED","WAITING","PROCESSING","DONE","ERROR","CANCELLED","PAUSED"],"type":"string","description":"An enumeration."},"VideoRequestInResponse":{"title":"VideoRequestInResponse","required":["input","options"],"type":"object","properties":{"output":{"title":"Output","maxLength":4096,"minLength":1,"type":"string","description":"Customize the result output.","format":"uri"},"input":{"title":"Input URL","maxLength":4096,"minLength":1,"type":"string","description":"URL of the input image. Image must be accessible by our system.","format":"uri"},"options":{"title":"Options","allOf":[{"$ref":"#/components/schemas/VideoOptionsObject"}],"description":"Customize the video."}},"additionalProperties":false},"VideoOptionsObject":{"title":"VideoOptionsObject","required":["prompt"],"type":"object","properties":{"prompt":{"title":"Prompt","anyOf":[{"type":"string","minLength":3,"maxLength":5000},{"$ref":"#/components/schemas/VideoPromptObject"}],"description":"Prompt for the video."},"negative_prompt":{"title":"Negative Prompt","maxLength":5000,"minLength":3,"type":"string","description":"Negative prompt for the video."},"duration":{"allOf":[{"$ref":"#/components/schemas/DurationEnum"}],"description":"Duration of the video.","default":"5"},"guidance_scale":{"title":"Guidance Scale","maximum":1,"minimum":0,"type":"number","description":"Guidance scale for the video.","default":0.5}},"additionalProperties":false},"VideoPromptObject":{"title":"VideoPromptObject","type":"object","properties":{"text":{"title":"Text","maxLength":5000,"minLength":3,"type":"string","description":"Prompt for the video."},"generate":{"title":"Generate","type":"boolean","description":"If `true`, the prompt will be generated automatically based on the input image.By default, the prompt is not auto-generated. If `true`, the `text` is not allowed.","default":false},"guidelines":{"title":"Guidelines","maxLength":1000,"minLength":3,"type":"string","description":"Guidelines for prompt generation. Only available when `generate` is `true`."}}},"DurationEnum":{"title":"DurationEnum","enum":["5","10"],"type":"string","description":"An enumeration."},"VideoError":{"title":"VideoError","required":["error","created_at"],"type":"object","properties":{"error":{"title":"Error","type":"string"},"created_at":{"title":"Created At","type":"string","format":"date-time"}}},"VideoResult":{"title":"VideoResult","required":["input_object","output_object"],"type":"object","properties":{"input_object":{"$ref":"#/components/schemas/VideoInputObject"},"output_object":{"$ref":"#/components/schemas/VideoOutputObject"}}},"VideoInputObject":{"title":"VideoInputObject","type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension."},"mps":{"title":"Mps","type":"number","description":"Megapixel count"},"mime":{"title":"Mime","type":"string","description":"MIME type (also known as ‘media type’)"},"format":{"title":"Format","type":"string","description":"File format."},"width":{"title":"Width","type":"integer","description":"Image width in pixels"},"height":{"title":"Height","type":"integer","description":"Image height in pixels"},"generated_prompt":{"title":"Generated Prompt","type":"string","description":"Generated prompt for the video."}}},"VideoOutputObject":{"title":"VideoOutputObject","type":"object","properties":{"ext":{"title":"Ext","type":"string","description":"File extension.","default":"mp4"},"mime":{"title":"Mime","type":"string","default":"video/mp4"},"format":{"title":"Format","type":"string","description":"File format.","default":"mp4"},"tmp_url":{"title":"Tmp Url","type":"string","description":"Temporal URL of a processed image"},"object_key":{"title":"Object Key","type":"string","description":"Path to a processed image in a bucket"},"object_bucket":{"title":"Object Bucket","type":"string","description":"Bucket name"},"object_uri":{"title":"Object Uri","type":"string","description":"URI of a processed image in a bucket"},"claid_storage_uri":{"title":"Claid Storage Uri","type":"string","description":"URI of a processed image in a storage"}}},"HttpErrorDetails":{"title":"HttpErrorDetails","required":["error_code","error_type","error_message"],"type":"object","properties":{"error_code":{"title":"Error Code","type":"string"},"error_type":{"$ref":"#/components/schemas/ErrorType"},"error_message":{"title":"Error Message","type":"string"},"error_details":{"title":"Error Details","type":"object","default":{}}}},"ErrorType":{"title":"ErrorType","enum":["auth","dlvr","general","le","survey","storage","image","user_settings","user","validation","analytics","scene","billing","web","runtime_settings","animation","custom_models"],"type":"string","description":"An enumeration."},"HTTPValidationError":{"title":"HTTPValidationError","type":"object","properties":{"detail":{"title":"Detail","type":"array","items":{"$ref":"#/components/schemas/ValidationError"}}}},"ValidationError":{"title":"ValidationError","required":["loc","msg","type"],"type":"object","properties":{"loc":{"title":"Location","type":"array","items":{"type":"string"}},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}}}}},"paths":{"/v1/video/generate/{animation_id}":{"get":{"tags":["Video"],"summary":"Video Generate Api Status","description":"Get the status of the animation generation task","operationId":"video_generate_api_status_v1_video_generate__animation_id__get","parameters":[{"required":true,"schema":{"title":"Animation Id","type":"integer"},"name":"animation_id","in":"path"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response_VideoStatusResponse_"}}}},"401":{"description":"Authorization is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"403":{"description":"Not enough permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"404":{"description":"Web image not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

#### **Request**

{% tabs %}
{% tab title="HTTP" %}

```http
GET https://api.claid.ai/v1/video/generate/1 HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl -X GET --location "https://api.claid.ai/v1/video/generate/1" --http1.1 \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}"
```

{% endtab %}
{% endtabs %}

#### **Read a response**

Once you have made the request to <mark style="color:purple;">`https://api.claid.ai/v1/video/generate/<task_id>`</mark> you will get a response with information about the status of your request. As soon as the processing is done, output video data will appear in the response.

Response data:

<table><thead><tr><th width="153">Parameter</th><th width="109.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>integer</td><td>Task ID.</td></tr><tr><td>status</td><td>string</td><td>Request processing status. Can have values: <mark style="color:purple;"><code>PROCESSING</code></mark>, <mark style="color:purple;"><code>ERROR</code></mark>, <mark style="color:purple;"><code>DONE</code></mark>.</td></tr><tr><td>created_at</td><td>string</td><td>Exact time when the processing was requested.</td></tr><tr><td>request</td><td>object</td><td>The body of the request that was used for processing.</td></tr><tr><td>errors</td><td>list </td><td>List of errors, if any are occurred during image processing (<mark style="color:purple;"><code>status</code></mark> will have <mark style="color:purple;"><code>ERROR</code></mark> value), in other cases - will be empty.</td></tr><tr><td>result</td><td>object</td><td>Result object that is contain 2 properties <mark style="color:purple;"><code>input_object</code></mark> and <mark style="color:purple;"><code>output_object</code></mark>, in case of processing errors - will be empty. Details are listed below.</td></tr></tbody></table>

Video data shown in the response at <mark style="color:purple;">`data.result.output_object`</mark>:

<table><thead><tr><th width="173">Parameter</th><th width="105.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>ext</td><td>string</td><td>File extension. Will have <code>mp4</code> value</td></tr><tr><td>mime</td><td>string</td><td>MIME type (also known as ‘media type’)</td></tr><tr><td>format</td><td>string</td><td>File format. Will have <code>mp4</code> value</td></tr><tr><td>tmp_url</td><td>string</td><td>Temporary URL of a processed video. Will be empty if <code>output</code> is specified</td></tr><tr><td>object_key</td><td>string</td><td>Video file path on the bucket. Will be empty if <code>output</code> is not specified</td></tr><tr><td>object_bucket</td><td>string</td><td>Bucket where the video file is saved. Will be empty if <code>output</code> is not specified</td></tr><tr><td>object_uri</td><td>string</td><td>S3/GCS video file identifier. Will be empty if <code>output</code> is not specified</td></tr><tr><td>claid_storage_uri</td><td>string</td><td>Claid Storage file identifier. Will be empty if <code>output</code> is not specified</td></tr></tbody></table>

<mark style="color:purple;">`errors`</mark> property item data:

<table><thead><tr><th width="151">Parameter</th><th width="112.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>error</td><td>string</td><td>Error message in text.</td></tr><tr><td>created_at</td><td>string</td><td>Exact time when the error was catched.</td></tr></tbody></table>

**Response body**

```json
{
  "data": {
    "id": 1,
    "status": "DONE",
    "created_at": "2025-05-12T15:10:21.517229+00:00",
    "request": {
      "output": "storage://storage-name/output-path/",
      "input": "storage://storage-name/input-path/input.png",
      "options": {
        "prompt": {
          "generate": true
        },
        "duration": "5"
      }
    },
    "errors": [],
    "result": {
      "input_object": {
        "ext": "webp",
        "mps": 0.3456,
        "mime": "image/webp",
        "format": "WEBP",
        "width": 720,
        "height": 480,
        "generated_prompt": "The camera begins with a steady, close-up view from behind, focusing on the ..."
      },
      "output_object": {
        "ext": "mp4",
        "mime": "video/mp4",
        "format": "mp4",
        "tmp_url": null,
        "object_key": "output-path/85f2690ba2f64fb8a0c51029c589b271.mp4",
        "object_bucket": "gcs-claid-bucket",
        "object_uri": "gs://gcs-claid-bucket/output-path/85f2690ba2f64fb8a0c51029c589b271.mp4",
        "claid_storage_uri": "storage://storage-name/output-path/85f2690ba2f64fb8a0c51029c589b271.mp4"
      }
    }
  }
}
```

#### Headers:

See the [Request Headers](/image-editing-api/api-reference#request-headers) and [Response Headers](/image-editing-api/api-reference#response-headers) to learn about headers.


# Overview

Claid API Storages provide a convenient and secure mechanism to work with images directly in your object storage without having to expose Image URLs publicly, or using uploads.

Currently, Claid supports [AWS S3](/storage-connectors/aws-s3) and [Google Cloud Storage](/storage-connectors/google-cloud-storage). [Web Folder](/storage-connectors/web-folder) is a convenience mechanism to register a URL prefix of a publicly accessible image location, e.g. images hosted on CDN.

The default way to add a storage is via the [Storage page](https://claid.ai/account/storage) of Claid.ai user dashboard. We also expose the [Storage API](/storage-connectors/api-reference) in case you will need to add storages programmatically.

You can find details on how to reference images in Storages in [Image I/O](/image-editing-api/image-i-o) section.


# AWS S3

How to add AWS S3 external storage

1. Go to [Storages](https://claid.ai/account/storage) dashboard page and click "Connect your storage"
2. Select "AWS S3" Storage type

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FvFOg4pm0D4IC2HTm494K%2Fimage.png?alt=media\&token=fd34a71c-a541-4580-945b-850e85a6304a)

3\. Fill in the details for the Amazon S3 Storage. The parameters are:

* **Access Key ID**: The access key of the AWS credentials.
* **Secret access key**: The secret key of the AWS credentials.
* **Bucket**: The name of the bucket containing the images which you want to process with Claid API.
* **Storage name:** storage identifier which will be used in image URL when creating image processing request.
* **Path (optional)**: The S3 prefix (folder) under which images are stored. This prefix is prepended to the image path before accessing the image in S3 storage. By default the path is `/`.

4\. Click "Add storage" button. Your storage is now ready to accept requests.

{% hint style="danger" %}
We **strongly recommend** creating an Amazon IAM account specifically for Claid with a limited set of permissions. You may get advice on IAM permissions for your specific case from your Customer Success Manager. All AWS credentials are stored in a secure encrypted secrets storage.
{% endhint %}


# Google Cloud Storage

How to add GCS external storage

1. Go to [Storages](https://claid.ai/account/storage) dashboard page and click "Connect your storage"
2. Select "Google Cloud" Storage type

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FXC0e4psdNpT2RKmEn4tR%2Fimage.png?alt=media\&token=cd1c1df5-9c11-464d-ab26-9ebe7f1fa938)

3\. Fill in the options for the Google Cloud Storage. The parameters are:

* **Access Key**: The Interoperable access key for your project.
* **Secret**: The secret key of the GCS credentials.
* **Bucket**: The name of the bucket containing the images which you want to process with Claid API.
* **Storage name:** storage identifier which will be used in image URL when creating image processing request.
* **Path (optional)**: The Google Storage prefix(folder) under which images are stored. This prefix is prepended to the image path before accessing the image in GCS storage. By default the path is `/`.

4\. Click "Add storage" button. Your storage is now ready to accept requests.

### How to create a keypair in Google Cloud Console

1. To create the access key and secret, go to the [Settings page](https://console.cloud.google.com/storage/settings?__hstc=158051173.a88e8e824aa71eca7a6042bf21bdf687.1651686309204.1651845468074.1651852669919.3&__hssc=158051173.1.1651852669919&__hsfp=669506594) in your console and click the **Interoperability** tab.
2. Choose the project you want to connect to Claid from the dropdown.
3. Under "Interoperable storage access keys", click **Create a new key**.


# Web Folder

How to add Web Folder storage

1. Go to [Storages](https://claid.ai/account/storage) dashboard page and click "Connect your storage"
2. Select "Web Folder" Storage type

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FfhbxJ4wnCDWes63Bp7tk%2Fimage.png?alt=media\&token=cbffddb9-2936-4ce8-8206-510a7a822577)

3\. Fill in the options for the Web Folder Storage. The parameters are:

* **URL address:** the URL prefix which will be prepended to the image path when Claid API requests images from the storage.
* **Storage name**: storage identifier which will be used in image URL when creating image processing request.

{% hint style="info" %}
We advise using a URL prefix that is fully resolved and won't redirect, this will speed up the image fetch on Claid side.
{% endhint %}

4\. Click "Add storage" button. Your storage is now ready to accept requests.


# API Reference

### Get Storage types

## List Storage Types

> Retrieves a list of storage types supported by Claid.

```json
{"openapi":"3.1.0","info":{"title":"Claid REST API","version":"v1"},"tags":[{"name":"Storage","description":"Perform operations with storage: check supported storage types, safely connect your cloud buckets and more."}],"security":[{"OAuth2PasswordBearer":["storage"]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}},"description":"To work with the Claid API, send requests over HTTPS and authenticate using the `Authorization` header in the following format:`Authorization: Bearer <YOUR_API_KEY>`. You do not need to provide a password.\n\nTo get your API key, [sign in to your Claid account](https://claid.ai/login) and click ***Create API key*** button from the ***Overview*** or ***API keys*** pages.\n\nClaid API’s base URL is `https://api.claid.ai/v1/`. All available endpoints are listed in the [Storage](#tag/Storage) and [Image](#tag/Image) sections. \n\n## Bearer\n\nThis API uses OAuth 2.0 [bearer token](https://datatracker.ietf.org/doc/html/rfc6750) (API key) to authorize requests."}},"schemas":{"Response_List_apps.storage.models.StorageType__":{"title":"Response[List[apps.storage.models.StorageType]]","type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/StorageType"}}},"description":"Wrapper for responses"},"StorageType":{"title":"StorageType","enum":["web_folder","s3","gcs"],"type":"string","description":"An enumeration."},"HttpErrorDetails":{"title":"HttpErrorDetails","required":["error_code","error_type","error_message"],"type":"object","properties":{"error_code":{"title":"Error Code","type":"string"},"error_type":{"$ref":"#/components/schemas/ErrorType"},"error_message":{"title":"Error Message","type":"string"},"error_details":{"title":"Error Details","type":"object","default":{}}}},"ErrorType":{"title":"ErrorType","enum":["auth","dlvr","general","le","survey","storage","image","user_settings","user","validation","analytics","scene","billing","web","runtime_settings","animation","custom_models"],"type":"string","description":"An enumeration."}}},"paths":{"/v1/storage/storage-types":{"get":{"tags":["Storage"],"summary":"List Storage Types","description":"Retrieves a list of storage types supported by Claid.","operationId":"list_storage_types_v1_storage_storage_types_get","responses":{"200":{"description":"List of storage types.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response_List_apps.storage.models.StorageType__"}}}},"401":{"description":"Authorization is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"403":{"description":"Not enough permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}}}}}}}
```

**Request**

{% tabs %}
{% tab title="HTTP" %}

```http
GET /v1/storage/storage-types HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl -X GET --location "https://api.claid.ai/v1/storage/storage-types" --http1.1 \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}"
```

{% endtab %}
{% endtabs %}

#### Response body

```json
{
  "data": [
    "web_folder",
    "s3",
    "gcs"
  ]
}
```

### Get Connected Storages

## List Storages

> Retrieves a list of storages connected to your Claid account, as well as their \`id\`, \`name\`, \`type\`, and \`parameters\`.

```json
{"openapi":"3.1.0","info":{"title":"Claid REST API","version":"v1"},"tags":[{"name":"Storage","description":"Perform operations with storage: check supported storage types, safely connect your cloud buckets and more."}],"security":[{"OAuth2PasswordBearer":["storage"]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}},"description":"To work with the Claid API, send requests over HTTPS and authenticate using the `Authorization` header in the following format:`Authorization: Bearer <YOUR_API_KEY>`. You do not need to provide a password.\n\nTo get your API key, [sign in to your Claid account](https://claid.ai/login) and click ***Create API key*** button from the ***Overview*** or ***API keys*** pages.\n\nClaid API’s base URL is `https://api.claid.ai/v1/`. All available endpoints are listed in the [Storage](#tag/Storage) and [Image](#tag/Image) sections. \n\n## Bearer\n\nThis API uses OAuth 2.0 [bearer token](https://datatracker.ietf.org/doc/html/rfc6750) (API key) to authorize requests."}},"schemas":{"Response_List_apps.storage.serializers.StorageOut_Pydantic__":{"title":"Response[List[apps.storage.serializers.StorageOut_Pydantic]]","type":"object","properties":{"data":{"title":"Data","type":"array","items":{"$ref":"#/components/schemas/StorageOut_Pydantic"}}},"description":"Wrapper for responses"},"StorageOut_Pydantic":{"title":"storage","required":["id","name","type","parameters","created_at"],"type":"object","properties":{"id":{"title":"Id","type":"integer"},"name":{"title":"The unique name of storage","maxLength":50,"type":"string"},"type":{"$ref":"#/components/schemas/StorageType"},"parameters":{"title":"Parameters","anyOf":[{"$ref":"#/components/schemas/CloudBaseStorage"},{"$ref":"#/components/schemas/WebFolderParameters_Pydantic"}]},"created_at":{"title":"Created At","type":"string","format":"date-time"}}},"StorageType":{"title":"StorageType","enum":["web_folder","s3","gcs"],"type":"string","description":"An enumeration."},"CloudBaseStorage":{"title":"cloud Storage","required":["bucket"],"type":"object","properties":{"path":{"title":"Path","type":"string","description":"An optional relative path that is prepended to the image request path when building the image's path.","default":""},"bucket":{"title":"Bucket","type":"string"}},"additionalProperties":false},"WebFolderParameters_Pydantic":{"title":"web folder parameters","required":["base_url"],"type":"object","properties":{"base_url":{"title":"Base Url","type":"string"}}},"HttpErrorDetails":{"title":"HttpErrorDetails","required":["error_code","error_type","error_message"],"type":"object","properties":{"error_code":{"title":"Error Code","type":"string"},"error_type":{"$ref":"#/components/schemas/ErrorType"},"error_message":{"title":"Error Message","type":"string"},"error_details":{"title":"Error Details","type":"object","default":{}}}},"ErrorType":{"title":"ErrorType","enum":["auth","dlvr","general","le","survey","storage","image","user_settings","user","validation","analytics","scene","billing","web","runtime_settings","animation","custom_models"],"type":"string","description":"An enumeration."}}},"paths":{"/v1/storage/storages":{"get":{"tags":["Storage"],"summary":"List Storages","description":"Retrieves a list of storages connected to your Claid account, as well as their `id`, `name`, `type`, and `parameters`.","operationId":"list_storages_v1_storage_storages_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response_List_apps.storage.serializers.StorageOut_Pydantic__"}}}},"401":{"description":"Authorization is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"403":{"description":"Not enough permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}}}}}}}
```

**Request**

{% tabs %}
{% tab title="HTTP" %}

```http
GET /v1/storage/storages HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl -X GET --location "https://api.claid.ai/v1/storage/storages" --http1.1 \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}"
```

{% endtab %}
{% endtabs %}

#### Response body

```json
{
  "data": [
    {
      "id": 1,
      "name": "s3-playground",
      "type": "s3",
      "parameters": {
        "path": "/input/",
        "bucket": "playground"
      },
      "created_at": "2022-01-10T18:27:16.362118+00:00"
    },
    {
      "id": 2,
      "name": "designer-uploads",
      "type": "gcs",
      "parameters": {
        "path": "",
        "bucket": "image-uploads"
      },
      "created_at": "2022-01-10T18:28:22.100041+00:00"
    }
  ]
}
```

### Create a new Claid Storage

## Create Storage

> Connects storage to Claid. You can connect your AWS S3 or GCP bucket, or your own web folder.

```json
{"openapi":"3.1.0","info":{"title":"Claid REST API","version":"v1"},"tags":[{"name":"Storage","description":"Perform operations with storage: check supported storage types, safely connect your cloud buckets and more."}],"security":[{"OAuth2PasswordBearer":["storage"]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}},"description":"To work with the Claid API, send requests over HTTPS and authenticate using the `Authorization` header in the following format:`Authorization: Bearer <YOUR_API_KEY>`. You do not need to provide a password.\n\nTo get your API key, [sign in to your Claid account](https://claid.ai/login) and click ***Create API key*** button from the ***Overview*** or ***API keys*** pages.\n\nClaid API’s base URL is `https://api.claid.ai/v1/`. All available endpoints are listed in the [Storage](#tag/Storage) and [Image](#tag/Image) sections. \n\n## Bearer\n\nThis API uses OAuth 2.0 [bearer token](https://datatracker.ietf.org/doc/html/rfc6750) (API key) to authorize requests."}},"schemas":{"StorageIn_Pydantic":{"title":"storage","required":["name","type","parameters"],"type":"object","properties":{"name":{"title":"The unique name of storage","maxLength":50,"type":"string","description":"The name of storage in Claid. Note: it doesn't have to be the same as a global name of a bucket."},"type":{"$ref":"#/components/schemas/StorageType"},"parameters":{"title":"Parameters","anyOf":[{"$ref":"#/components/schemas/S3Parameters_Pydantic"},{"$ref":"#/components/schemas/GCSParameters_Pydantic"},{"$ref":"#/components/schemas/WebFolderParameters_Pydantic"}],"description":"Global parameters of storage (as opposed to Claid's internal properties, such as `name` and `type`)"}},"additionalProperties":false},"StorageType":{"title":"StorageType","enum":["web_folder","s3","gcs"],"type":"string","description":"An enumeration."},"S3Parameters_Pydantic":{"title":"S3 parameters","required":["bucket","credentials"],"type":"object","properties":{"path":{"title":"Path","type":"string","description":"An optional relative path that is prepended to the image request path when building the image's path.","default":""},"bucket":{"title":"Bucket","minLength":1,"type":"string","description":"A global Amazon S3 bucket name."},"credentials":{"$ref":"#/components/schemas/AWSCredentials"}},"additionalProperties":false},"AWSCredentials":{"title":"AWSCredentials","required":["access_key","secret_access_key"],"type":"object","properties":{"access_key":{"title":"Access Key","minLength":1,"type":"string","description":"Access Key"},"secret_access_key":{"title":"Secret Access Key","minLength":1,"type":"string","description":"Secret Access Key"}},"additionalProperties":false,"description":"Check [AWS security credentials docs](https://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html)\nto learn how to get your access keys."},"GCSParameters_Pydantic":{"title":"GCS parameters","required":["bucket","credentials"],"type":"object","properties":{"path":{"title":"Path","type":"string","description":"An optional relative path that is prepended to the image request path when building the image's path.","default":""},"bucket":{"title":"Bucket","minLength":1,"type":"string","description":"A global GCS bucket name."},"credentials":{"$ref":"#/components/schemas/GCPCredentials"}},"additionalProperties":false},"GCPCredentials":{"title":"GCPCredentials","required":["access_key","secret_access_key"],"type":"object","properties":{"access_key":{"title":"Access Key","minLength":1,"type":"string","description":"Access Key"},"secret_access_key":{"title":"Secret Access Key","minLength":1,"type":"string","description":"Secret Access Key"}},"additionalProperties":false,"description":"Check [GCP documentation](https://cloud.google.com/iam/docs/creating-managing-service-account-keys)\nto learn how to get your access keys."},"WebFolderParameters_Pydantic":{"title":"web folder parameters","required":["base_url"],"type":"object","properties":{"base_url":{"title":"Base Url","type":"string"}}},"Response_StorageOutDetailed_Pydantic_":{"title":"Response[StorageOutDetailed_Pydantic]","type":"object","properties":{"data":{"$ref":"#/components/schemas/StorageOutDetailed_Pydantic"}},"description":"Wrapper for responses"},"StorageOutDetailed_Pydantic":{"title":"storage","required":["id","name","type","parameters","created_at"],"type":"object","properties":{"id":{"title":"Id","type":"integer"},"name":{"title":"The unique name of storage","maxLength":50,"type":"string"},"type":{"$ref":"#/components/schemas/StorageType"},"parameters":{"title":"Parameters","anyOf":[{"$ref":"#/components/schemas/CloudDetailedBaseStorage"},{"$ref":"#/components/schemas/WebFolderParameters_Pydantic"}]},"created_at":{"title":"Created At","type":"string","format":"date-time"}}},"CloudDetailedBaseStorage":{"title":"cloud Storage","required":["bucket","credentials"],"type":"object","properties":{"path":{"title":"Path","type":"string","description":"An optional relative path that is prepended to the image request path when building the image's path.","default":""},"bucket":{"title":"Bucket","type":"string"},"credentials":{"$ref":"#/components/schemas/CredentialsOut"}},"additionalProperties":false},"CredentialsOut":{"title":"CredentialsOut","required":["access_key"],"type":"object","properties":{"access_key":{"title":"Access Key","type":"string"}},"additionalProperties":false},"HttpErrorDetails":{"title":"HttpErrorDetails","required":["error_code","error_type","error_message"],"type":"object","properties":{"error_code":{"title":"Error Code","type":"string"},"error_type":{"$ref":"#/components/schemas/ErrorType"},"error_message":{"title":"Error Message","type":"string"},"error_details":{"title":"Error Details","type":"object","default":{}}}},"ErrorType":{"title":"ErrorType","enum":["auth","dlvr","general","le","survey","storage","image","user_settings","user","validation","analytics","scene","billing","web","runtime_settings","animation","custom_models"],"type":"string","description":"An enumeration."}}},"paths":{"/v1/storage/storages":{"post":{"tags":["Storage"],"summary":"Create Storage","description":"Connects storage to Claid. You can connect your AWS S3 or GCP bucket, or your own web folder.","operationId":"create_storage_v1_storage_storages_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorageIn_Pydantic"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response_StorageOutDetailed_Pydantic_"}}}},"401":{"description":"Authorization is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"403":{"description":"Not enough permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"422":{"description":"Unprocessable Entity.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}}}}}}}
```

Here is an example of creating AWS storage via API:

**Request**

{% tabs %}
{% tab title="HTTP" %}

```http
POST /v1/storage/storages
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
Content-Type: application/json

{
  "name": "s3-playground",
  "type": "s3",
  "parameters": {
    "bucket": "playground",
    "credentials": {
      "access_key": "AKIAXXXXXXX",
      "secret_access_key": "YourSecretAccessKey"
    }
  }
}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl -X POST --location "https://api.claid.ai/v1/storage/storages" \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}" \
    -H "Content-Type: application/json" \
    -d "{
          \"name\": \"s3-playground\",
          \"type\": \"s3\",
          \"parameters\": {
            \"bucket\": \"playground\",
            \"credentials\": {
              \"access_key\": \"AKIAXXXXXXX\",
              \"secret_access_key\": \"YourSecretAccessKey\"
            }
          }
        }"
```

{% endtab %}
{% endtabs %}

#### Response body

```json
{
  "data": {
    "id": 1,
    "name": "s3-playground",
    "type": "s3",
    "parameters": {
      "path": "",
      "bucket": "playground"
    },
    "created_at": "2022-05-10T10:29:12.754824+00:00"
  }
}
```

`parameters` supported by the AWS S3 storage:&#x20;

<table><thead><tr><th width="237">Parameter</th><th width="152.1413969335605">Type</th></tr></thead><tbody><tr><td><code>name</code></td><td>string</td></tr><tr><td><code>bucket</code></td><td>string</td></tr><tr><td><code>prefix</code></td><td>string</td></tr><tr><td><code>credentials.access_key</code></td><td>string</td></tr><tr><td><code>credentials.secret_access_key</code></td><td>string</td></tr></tbody></table>

`parameters` supported by the [GCS storage](/storage-connectors/google-cloud-storage): <mark style="color:red;">#todo</mark>

<table data-header-hidden><thead><tr><th width="237">Parameter</th><th width="152.1413969335605">Type</th></tr></thead><tbody><tr><td><code>name</code></td><td>string</td></tr><tr><td><code>bucket</code></td><td>string</td></tr><tr><td><code>prefix</code></td><td>string</td></tr><tr><td><code>credentials.access_key</code></td><td>string</td></tr><tr><td><code>credentials.secret_access_key</code></td><td>string</td></tr></tbody></table>

`parameters` supported by the [Web Folder storage](/storage-connectors/web-folder):&#x20;

<table data-header-hidden><thead><tr><th width="237">Parameter</th><th width="152.1413969335605">Type</th></tr></thead><tbody><tr><td><code>name</code></td><td>string</td></tr><tr><td><code>base_url</code></td><td>string</td></tr></tbody></table>

### Describe storage by id&#x20;

## Get Storage

> Retrieves information about particular storage, including its \`id\`, \`name\`, \`type\`, and \`parameters\`.

```json
{"openapi":"3.1.0","info":{"title":"Claid REST API","version":"v1"},"tags":[{"name":"Storage","description":"Perform operations with storage: check supported storage types, safely connect your cloud buckets and more."}],"security":[{"OAuth2PasswordBearer":["storage"]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}},"description":"To work with the Claid API, send requests over HTTPS and authenticate using the `Authorization` header in the following format:`Authorization: Bearer <YOUR_API_KEY>`. You do not need to provide a password.\n\nTo get your API key, [sign in to your Claid account](https://claid.ai/login) and click ***Create API key*** button from the ***Overview*** or ***API keys*** pages.\n\nClaid API’s base URL is `https://api.claid.ai/v1/`. All available endpoints are listed in the [Storage](#tag/Storage) and [Image](#tag/Image) sections. \n\n## Bearer\n\nThis API uses OAuth 2.0 [bearer token](https://datatracker.ietf.org/doc/html/rfc6750) (API key) to authorize requests."}},"schemas":{"Response_StorageOutDetailed_Pydantic_":{"title":"Response[StorageOutDetailed_Pydantic]","type":"object","properties":{"data":{"$ref":"#/components/schemas/StorageOutDetailed_Pydantic"}},"description":"Wrapper for responses"},"StorageOutDetailed_Pydantic":{"title":"storage","required":["id","name","type","parameters","created_at"],"type":"object","properties":{"id":{"title":"Id","type":"integer"},"name":{"title":"The unique name of storage","maxLength":50,"type":"string"},"type":{"$ref":"#/components/schemas/StorageType"},"parameters":{"title":"Parameters","anyOf":[{"$ref":"#/components/schemas/CloudDetailedBaseStorage"},{"$ref":"#/components/schemas/WebFolderParameters_Pydantic"}]},"created_at":{"title":"Created At","type":"string","format":"date-time"}}},"StorageType":{"title":"StorageType","enum":["web_folder","s3","gcs"],"type":"string","description":"An enumeration."},"CloudDetailedBaseStorage":{"title":"cloud Storage","required":["bucket","credentials"],"type":"object","properties":{"path":{"title":"Path","type":"string","description":"An optional relative path that is prepended to the image request path when building the image's path.","default":""},"bucket":{"title":"Bucket","type":"string"},"credentials":{"$ref":"#/components/schemas/CredentialsOut"}},"additionalProperties":false},"CredentialsOut":{"title":"CredentialsOut","required":["access_key"],"type":"object","properties":{"access_key":{"title":"Access Key","type":"string"}},"additionalProperties":false},"WebFolderParameters_Pydantic":{"title":"web folder parameters","required":["base_url"],"type":"object","properties":{"base_url":{"title":"Base Url","type":"string"}}},"HttpErrorDetails":{"title":"HttpErrorDetails","required":["error_code","error_type","error_message"],"type":"object","properties":{"error_code":{"title":"Error Code","type":"string"},"error_type":{"$ref":"#/components/schemas/ErrorType"},"error_message":{"title":"Error Message","type":"string"},"error_details":{"title":"Error Details","type":"object","default":{}}}},"ErrorType":{"title":"ErrorType","enum":["auth","dlvr","general","le","survey","storage","image","user_settings","user","validation","analytics","scene","billing","web","runtime_settings","animation","custom_models"],"type":"string","description":"An enumeration."}}},"paths":{"/v1/storage/storages/{storage_id}":{"get":{"tags":["Storage"],"summary":"Get Storage","description":"Retrieves information about particular storage, including its `id`, `name`, `type`, and `parameters`.","operationId":"get_storage_v1_storage_storages__storage_id__get","parameters":[{"required":true,"schema":{"title":"Storage Id","type":"integer"},"name":"storage_id","in":"path"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response_StorageOutDetailed_Pydantic_"}}}},"401":{"description":"Authorization is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"403":{"description":"Not enough permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"404":{"description":"Storage not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"422":{"description":"Unprocessable Entity.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}}}}}}}
```

**Request**

{% tabs %}
{% tab title="HTTP" %}

```http
GET /v1/storage/storages/1 HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl -X GET --location "https://api.claid.ai/v1/storage/storages/1" --http1.1 \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}"
```

{% endtab %}
{% endtabs %}

#### Response body

```json
{
  "data": {
    "id": 1,
    "name": "s3-playground",
    "type": "s3",
    "parameters": {
      "path": "",
      "bucket": "playground"
    },
    "created_at": "2022-05-10T10:29:12.754824+00:00"
  }
}
```

### **Delete storage by id**

## Delete Storage

> Disconnects storage from Claid. Note: It doesn't delete your bucket on your cloud platform.

```json
{"openapi":"3.1.0","info":{"title":"Claid REST API","version":"v1"},"tags":[{"name":"Storage","description":"Perform operations with storage: check supported storage types, safely connect your cloud buckets and more."}],"security":[{"OAuth2PasswordBearer":["storage"]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}},"description":"To work with the Claid API, send requests over HTTPS and authenticate using the `Authorization` header in the following format:`Authorization: Bearer <YOUR_API_KEY>`. You do not need to provide a password.\n\nTo get your API key, [sign in to your Claid account](https://claid.ai/login) and click ***Create API key*** button from the ***Overview*** or ***API keys*** pages.\n\nClaid API’s base URL is `https://api.claid.ai/v1/`. All available endpoints are listed in the [Storage](#tag/Storage) and [Image](#tag/Image) sections. \n\n## Bearer\n\nThis API uses OAuth 2.0 [bearer token](https://datatracker.ietf.org/doc/html/rfc6750) (API key) to authorize requests."}},"schemas":{"Response":{"title":"Response","type":"object","properties":{"data":{"title":"Data"}},"description":"Wrapper for responses"},"HttpErrorDetails":{"title":"HttpErrorDetails","required":["error_code","error_type","error_message"],"type":"object","properties":{"error_code":{"title":"Error Code","type":"string"},"error_type":{"$ref":"#/components/schemas/ErrorType"},"error_message":{"title":"Error Message","type":"string"},"error_details":{"title":"Error Details","type":"object","default":{}}}},"ErrorType":{"title":"ErrorType","enum":["auth","dlvr","general","le","survey","storage","image","user_settings","user","validation","analytics","scene","billing","web","runtime_settings","animation","custom_models"],"type":"string","description":"An enumeration."}}},"paths":{"/v1/storage/storages/{storage_id}":{"delete":{"tags":["Storage"],"summary":"Delete Storage","description":"Disconnects storage from Claid. Note: It doesn't delete your bucket on your cloud platform.","operationId":"delete_storage_v1_storage_storages__storage_id__delete","parameters":[{"required":true,"schema":{"title":"Storage Id","type":"integer"},"name":"storage_id","in":"path"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response"}}}},"401":{"description":"Authorization is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"403":{"description":"Not enough permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"404":{"description":"Storage not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"422":{"description":"Unprocessable Entity.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}}}}}}}
```

**Request**

{% tabs %}
{% tab title="HTTP" %}

```http
DELETE /v1/storage/storages/1 HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl -X DELETE --location "https://api.claid.ai/v1/storage/storages/1" --http1.1 \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}"
```

{% endtab %}
{% endtabs %}

### **Update storage by id**

## Patch Storage

> Changes storage \`name\`, \`type\`, and/or \`parameters\`.

```json
{"openapi":"3.1.0","info":{"title":"Claid REST API","version":"v1"},"tags":[{"name":"Storage","description":"Perform operations with storage: check supported storage types, safely connect your cloud buckets and more."}],"security":[{"OAuth2PasswordBearer":["storage"]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}},"description":"To work with the Claid API, send requests over HTTPS and authenticate using the `Authorization` header in the following format:`Authorization: Bearer <YOUR_API_KEY>`. You do not need to provide a password.\n\nTo get your API key, [sign in to your Claid account](https://claid.ai/login) and click ***Create API key*** button from the ***Overview*** or ***API keys*** pages.\n\nClaid API’s base URL is `https://api.claid.ai/v1/`. All available endpoints are listed in the [Storage](#tag/Storage) and [Image](#tag/Image) sections. \n\n## Bearer\n\nThis API uses OAuth 2.0 [bearer token](https://datatracker.ietf.org/doc/html/rfc6750) (API key) to authorize requests."}},"schemas":{"StorageInUpdate_Pydantic":{"title":"update storage","type":"object","properties":{"name":{"title":"The unique name of storage","maxLength":50,"type":"string"},"type":{"$ref":"#/components/schemas/StorageType"},"parameters":{"title":"Parameters","anyOf":[{"$ref":"#/components/schemas/S3ParametersUpdate_Pydantic"},{"$ref":"#/components/schemas/GCSParametersUpdate_Pydantic"},{"$ref":"#/components/schemas/WebFolderParameters_Pydantic"}]}},"additionalProperties":false},"StorageType":{"title":"StorageType","enum":["web_folder","s3","gcs"],"type":"string","description":"An enumeration."},"S3ParametersUpdate_Pydantic":{"title":"S3ParametersUpdate_Pydantic","type":"object","properties":{"path":{"title":"Path","type":"string","description":"An optional relative path that is prepended to the image request path when building the image's path."},"bucket":{"title":"Bucket","minLength":1,"type":"string","description":"An optional global Amazon S3 bucket name."},"credentials":{"$ref":"#/components/schemas/AWSCredentialsUpdate"}},"additionalProperties":false},"AWSCredentialsUpdate":{"title":"AWSCredentialsUpdate","type":"object","properties":{"access_key":{"title":"Access Key","minLength":1,"type":"string","description":"An optional Access Key"},"secret_access_key":{"title":"Secret Access Key","minLength":1,"type":"string","description":"An optional Secret Access Key"}},"additionalProperties":false},"GCSParametersUpdate_Pydantic":{"title":"GCSParametersUpdate_Pydantic","type":"object","properties":{"path":{"title":"Path","type":"string","description":"An optional relative path that is prepended to the image request path when building the image's path."},"bucket":{"title":"Bucket","minLength":1,"type":"string","description":"An optional global GCS bucket name."},"credentials":{"$ref":"#/components/schemas/GCPCredentialsUpdate"}},"additionalProperties":false},"GCPCredentialsUpdate":{"title":"GCPCredentialsUpdate","type":"object","properties":{"access_key":{"title":"Access Key","minLength":1,"type":"string","description":"An optional Access Key"},"secret_access_key":{"title":"Secret Access Key","minLength":1,"type":"string","description":"An optional Secret Access Key"}},"additionalProperties":false},"WebFolderParameters_Pydantic":{"title":"web folder parameters","required":["base_url"],"type":"object","properties":{"base_url":{"title":"Base Url","type":"string"}}},"Response_StorageOutDetailed_Pydantic_":{"title":"Response[StorageOutDetailed_Pydantic]","type":"object","properties":{"data":{"$ref":"#/components/schemas/StorageOutDetailed_Pydantic"}},"description":"Wrapper for responses"},"StorageOutDetailed_Pydantic":{"title":"storage","required":["id","name","type","parameters","created_at"],"type":"object","properties":{"id":{"title":"Id","type":"integer"},"name":{"title":"The unique name of storage","maxLength":50,"type":"string"},"type":{"$ref":"#/components/schemas/StorageType"},"parameters":{"title":"Parameters","anyOf":[{"$ref":"#/components/schemas/CloudDetailedBaseStorage"},{"$ref":"#/components/schemas/WebFolderParameters_Pydantic"}]},"created_at":{"title":"Created At","type":"string","format":"date-time"}}},"CloudDetailedBaseStorage":{"title":"cloud Storage","required":["bucket","credentials"],"type":"object","properties":{"path":{"title":"Path","type":"string","description":"An optional relative path that is prepended to the image request path when building the image's path.","default":""},"bucket":{"title":"Bucket","type":"string"},"credentials":{"$ref":"#/components/schemas/CredentialsOut"}},"additionalProperties":false},"CredentialsOut":{"title":"CredentialsOut","required":["access_key"],"type":"object","properties":{"access_key":{"title":"Access Key","type":"string"}},"additionalProperties":false},"HttpErrorDetails":{"title":"HttpErrorDetails","required":["error_code","error_type","error_message"],"type":"object","properties":{"error_code":{"title":"Error Code","type":"string"},"error_type":{"$ref":"#/components/schemas/ErrorType"},"error_message":{"title":"Error Message","type":"string"},"error_details":{"title":"Error Details","type":"object","default":{}}}},"ErrorType":{"title":"ErrorType","enum":["auth","dlvr","general","le","survey","storage","image","user_settings","user","validation","analytics","scene","billing","web","runtime_settings","animation","custom_models"],"type":"string","description":"An enumeration."}}},"paths":{"/v1/storage/storages/{storage_id}":{"patch":{"tags":["Storage"],"summary":"Patch Storage","description":"Changes storage `name`, `type`, and/or `parameters`.","operationId":"patch_storage_v1_storage_storages__storage_id__patch","parameters":[{"required":true,"schema":{"title":"Storage Id","type":"integer"},"name":"storage_id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorageInUpdate_Pydantic"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response_StorageOutDetailed_Pydantic_"}}}},"401":{"description":"Authorization is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"403":{"description":"Not enough permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"404":{"description":"Storage not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}},"422":{"description":"Unprocessable Entity.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HttpErrorDetails"}}}}}}}}}
```

**Request**

{% tabs %}
{% tab title="HTTP" %}

```http
PATCH /v1/storage/storages/1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
Content-Type: application/json

{
  "name": "s3-playground",
  "type": "s3",
  "parameters": {
    "bucket": "playground",
    "credentials": {
      "access_key": "AKIAXXXXXXX",
      "secret_access_key": "YourSecretAccessKey"
    }
  }
}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl -X PATCH --location "https://api.claid.ai/v1/storage/storages/1" \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}" \
    -H "Content-Type: application/json" \
    -d "{
          \"name\": \"s3-playground\",
          \"type\": \"s3\",
          \"parameters\": {
            \"bucket\": \"playground\",
            \"credentials\": {
              \"access_key\": \"AKIAXXXXXXX\",
              \"secret_access_key\": \"YourSecretAccessKey\"
            }
          }
        }"
```

{% endtab %}
{% endtabs %}

#### Response body

```json
{
  "data": {
    "id": 1,
    "name": "s3-playground",
    "type": "s3",
    "parameters": {
      "path": "",
      "bucket": "playground"
    },
    "created_at": "2022-05-10T10:29:12.754824+00:00"
  }
}
```


# E-commerce

### Introduction

Photos are an integral part of any customer’s experience. [Multiple studies](https://claid.ai/blog/article/photos-impact-conversions/) have shown that having high-quality images improves conversion, allowing the customer to see what exactly they are ordering and giving greater confidence in the platform and goods offered.

Online businesses spend a lot of resources working with digital assets like product photos. This is especially true for marketplaces that rely on user-generated content(UGC). UGC often needs to be moderated and edited due to quality reasons; there's very little control over image quality, more specifically image dimensions, compression, inconsistent backgrounds, varying aspect ratios, and light conditions.&#x20;

As a result, platforms often develop their own image guidelines. They often have the following points:

* Minimum image resolution or exact resolution which platform expects
* Required aspect ratio (eg 16:9)
* Entire object is fully visible and well-lit
* Background is white and the object is centered
* Number of platform-specific points may follow

![Typical image moderation scenario](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FBqWy0uo9temHe8sEIA3p%2Fimage.png?alt=media\&token=f5a79021-0db0-4739-9f94-41ad1ef22951)

### How Claid API can help

Claid API helps you to automatically edit every product image so it has the same look and feel, no matter what the original images look like: whether they're centered and perfectly aligned, vertical or horizontal, large or small, lossless or highly compressed.&#x20;

Using Claid's declarative syntax you can encode your platform guidelines, and our AI will do the hard editing work automatically for you at any scale.

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FWIuWoMbqXJxE7vua3pwF%2Fimage.png?alt=media\&token=0d0859ec-922e-4de0-9eaf-1dfc6ebb387e)

In the next section, we will dive deeper into the API request which processed this product collection.

### API guide

Let's see an example of how Claid API helps to produce images matching your platform guidelines. Following is a sample of a product shot in a non-professional "white box" setup.

![Original image (3024x4032, iPhone photo)](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2F5S2pxYgBPBjXlbbZn1dQ%2Fpaprika-input.jpeg?alt=media\&token=7bea2981-809e-49cf-863b-566ca7a26c66) ![Claid API result(2688x1512, Web-ready)](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FXBgSVsRgsnzhy7bjyViZ%2Fpaprika-canvas.jpeg?alt=media\&token=8a9118f0-6c57-495f-a4a8-b8af1ef98e44)

And following is a Claid API request which produces this result. We will show the request, and further explain the options used to obtain this result. Please visit [Image Processing API](/image-editing-api/image-i-o) for a full reference on Claid API parameters.&#x20;

{% tabs %}
{% tab title="HTTP" %}

```http
POST /v1/image/edit
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
Content-Type: application/json

{
  "input": "https://claid.ai/doc-samples/paprika.jpg",
  "operations": {
    "resizing": {
      "fit": "canvas",
      "width": 2688,
      "height": 1512
    },
    "adjustments": {
      "hdr": {
        "intensity": 100
      },
      "sharpness": 25
    },
    "padding": "20%",
    "restorations": {
      "upscale": "smart_enhance"
    },
    "background": {
      "remove": {
        "clipping": true
      }
    }
  },
  "output": {
    "format": {
      "type": "jpeg",
      "quality": 85,
      "progressive": true
    }
  }
}
```

{% endtab %}

{% tab title="cURL" %}

```shell
curl -X POST --location "https://api.claid.ai/v1/image/edit" \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}" \
    -H "Content-Type: application/json" \
    -d "{
          \"input\": \"https://claid.ai/doc-samples/paprika.jpg\",
          \"operations\": {
            \"resizing\": {
              \"fit\": \"canvas\",
              \"width\": 2688,
              \"height\": 1512
            },
            \"adjustments\": {
              \"hdr\": {
                \"intensity\": 100
              },
              \"sharpness\": 25
            },
            \"padding\": \"20%\",
            \"restorations\": {
              \"upscale\": \"smart_enhance\"
            },
            \"background\": {
              \"remove\": {
                \"clipping\": true
              }
            }
          },
          \"output\": {
            \"format\": {
              \"type\": \"jpeg\",
              \"quality\": 85,
              \"progressive\": true
            }
          }
        }"
```

{% endtab %}
{% endtabs %}

`input` is an original image url. `output` block states that we want to create a progressive JPEG with a pretty high-quality factor. In the API response we will receive a temporary URL of a resulting image. Please consult [Image I/O](/image-editing-api/image-i-o) for explanation of this block, and [Storages](/storage-connectors/overview) section if you want to connect Claid API directly with your Cloud Storage in a secure way.

`resizing` block describes the image size which is set according to the platform guidelines. Here we specify that we want to have an image with 2688x1512px resolution, which is placed on a canvas. See [Resizing](/image-editing-api/image-operations/resizing) section to learn about this and other supported options.

`adjustments` specifies color adjustments applied to an image. Here we have an ML-powered `hdr` algorithm applied with 100% intensity which intelligently tunes colors and shadows, and we also manually increased `sharpness` a bit. [Color Adjustments](/image-editing-api/image-operations/color-adjustments) section describes this in detail.

`background` block specifies that the object in the image should be separated from the background, and `clipping: true` states that we should clip using object bounds. The new image canvas is set using the `resizing` block described above.

`padding` sets amount of space around the object expressed as a percentage of the overall canvas. See the [Padding](/image-editing-api/image-operations/padding) section.

`restorations` block switches on the enhancement algorithm called `smart_resize` which is a  great option for the majority of e-commerce use cases. Another good option to try would be `smart_enhance` algorithm which can produce sharper images in some cases.


# Real Estate

### How improving images benefits real estate and rental websites

Properties with high-quality images on the listing sell faster and bring more income.

Studies show that fixing different aspects of the listing's image, such as brightness, color balance and clarity, helps increase demand for the property.

![Zhang, Shunyuan (2019): A Structural Analysis of Sharing Economy Leveraging Location and Image Analytics Using Deep Learning. Carnegie Mellon University. \*Based on analysis of over 510,000 AirBnB pictures ](https://lh5.googleusercontent.com/g0SsmrYJRImf01y0ADdLdd0o_YGgBaFSoabGW7OpGoQvvGDB5XxI8RPekyZr5tSoifSqfGoZNChJJVzvFZVp8we6h-6joHAv-uFQx4Mx92kemp0H0-S8t-cywFL-W8ucDBXL6a-iYPZEilyWSg)

With better images, your agents, hosts and owners will sell faster and earn more. And your buyers will get a more satisfying visual experience from using your platform.

### The problem with poor-quality images and how to solve it

Real estate websites often get photos directly from agents and home owners. Unfortunately, non-professional photographers lack the equipment and skills to produce high-quality photos.

Organizing photoshoots is one way to improve the quality of visuals. But it increases costs and time-to-market.

Another option is automated image editing. It cannot completely replace professional photoshoots. But it can do the bulk of the job in a fraction of a time — especially if it's powered by AI trained on large datasets.

### How Claid API can help

For best results, you should make property photos bright, vibrant and clear.  And this is exactly what Claid does.

With Claid, you can:

* Make images clear and sharp by increasing their resolution to your requirements. Eg, Zillow recommends using the 2048 x 1536 size.
* Clean up photos from noise and compression artifacts
* Fix colors, lighting and white balance with content-aware HDR filter that adapts to each photo
* Enhance 360-photos for seamless stitching
* Optimize images for fast page loading by converting them to modern formats, such as progressive JPEG, WebP and AVIF

Most of these features are powered by machine learning. This means, they are on par with manual editing and in some cases, such as lossless upscaling, simply don’t have alternatives.

#### Fix dark or overexposed pictures

Interior photos taken without lighting equipment are often dark and pale. Exterior images have the opposite problem: a lot of them are too bright and overlit. Claid fixes both of these problems. It applies intelligent HDR filter based on the content of each photo.&#x20;

#### Enhance 360-photos for virtual tours

3D property tours became a must for real estate websites. Claid API enables you to enhance panoramic photos without worrying about inconsistent stitching that often occurs when editing 360 pictures.

#### Enhance images without over-editing

Image editing can change things to the point when they almost no longer represent reality. That's why many real estate platforms forbid over-processing. Claid enhances photos without changing their content. So you don't have to worry about misleading your customers due to excessive image manipulations.

#### Increase the resolution of aerial photos

Drone photography is a great way to showcase the location of a property. By upscaling such photos with AI you'll enable your users to zoom in and inspect images in greater detail.&#x20;

#### Achieve consistent style

When photos come from different sources they vary not only in quality but also in the editing style. Claid allows you to process images in a uniform manner and secure a consistent style of imagery across your platform.

#### Transform photos in a single API call

Claid API supports stacking up different operations to make every photo meet your requirements in  a single call. In the next section, you'll learn how to do it.

### API guide

Check out how Claid API can enhance images to meet the standards of your real estate site or mobile app.

Below, you can see an example of a virtual property tour photo taken without professional equipment (top) and the same photo processed with Claid API (bottom).

<div align="left"><img src="https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FjsmP3Sdfqi0iMCG6ojel%2Fimage.png?alt=media&amp;token=c5748e9f-3e7b-43a1-bedb-74d20f211acf" alt="Original 360 image (1920 x 960)"></div>

<div align="right"><img src="https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FjV0nmkelUJgmIlph5UYg%2Frealestate360.jpeg?alt=media&amp;token=875719de-80a2-467d-80e2-cac8caf782d3" alt="360 image processed with Claid API (2880 x 1440)"></div>

And following is a Claid API request which produces this result. Below, we explain the options used to get this result. Please visit [Image Processing API](https://docs.claid.ai/image-editing-api) for a full reference on Claid API parameters.

{% tabs %}
{% tab title="HTTP" %}

```http
POST /v1/image/edit
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
Content-Type: application/json

{
  "input": "https://claid.ai/doc-samples/realestate360.jpeg",
  "operations": {
    "restorations": {
      "upscale": "photo"
    },
    "resizing": {
      "fit": "bounds",
      "width": "150%",
      "height": "150%"
    },
    "adjustments": {
      "hdr": {
        "intensity": 100,
        "stitching": true
      }
    }
  },
  "output": {
    "format": {
      "type": "jpeg",
      "quality": 85
    }
  }
}
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl -X POST --location "https://api.claid.ai/v1/image/edit" \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}" \
    -H "Content-Type: application/json" \
    -d "{
          \"input\": \"https://claid.ai/doc-samples/realestate360.jpeg\",
          \"operations\": {
            \"restorations\": {
              \"upscale\": \"photo\"
            },
            \"resizing\": {
              \"fit\": \"bounds\",
              \"width\": \"150%\",
              \"height\": \"150%\"
            },
            \"adjustments\": {
              \"hdr\": {
                \"intensity\": 100,
                \"stitching\": true
              }
            }
          },
          \"output\": {
            \"format\": {
              \"type\": \"jpeg\",
              \"quality\": 85
            }
          }
        }"
```

{% endtab %}
{% endtabs %}

`input` is an original image url. Go to [Image I/O](/image-editing-api/image-i-o) to learn more.

`restorations` allows choosing from a wide range of neural networks to decompress and upscale images. Here, we went with "photo" as an upscaling mode. This network works well with pictures taken with phones and digital cameras alike. Go to [Restorations](/image-editing-api/image-operations/restorations) section to learn more about how Claid can restore image quality.

`resizing` block describes the image size. It can define the exact resolution or an upscaling factor according to the platform guidelines. In our case, we specify that we want to increase image resolution by 150% or 1.5 times, which is a popular choice among our real estate clients. See [Resizing](/image-editing-api/image-operations/resizing) section to learn about this and other supported options.

`adjustments` specifies color adjustments applied to an image. Here, we have an ML-powered hdr algorithm applied with 100% intensity which intelligently tunes colors and shadows. `stitching: true` means that virtual tour photos will be processed to achieve seamless stitching after enhancement. [Color Adjustments](/image-editing-api/image-operations/color-adjustments) section describes this in detail.

`output` block states that we want to create a JPEG with a quality of 85. In the API response, we will receive a temporary URL of a resulting image. Please consult [Image I/O](/image-editing-api/image-i-o) for an explanation of this block, and [Storages](/storage-connectors/overview) section if you want to connect Claid API directly with your Cloud Storage in a secure way.


# Printing

### When printing businesses need better images

Image quality is the cornerstone of printing. But there’re at least 2 scenarios where the need for better digital images is particularly high:

* when working with user-provided pictures
* when printing on large canvases

In the first case, photos are often compressed and resized by social media and messenger apps. While these pictures might look perfectly fine on screen, their quality isn’t suitable for printing, even in smaller formats.

If you do large-size printing, you have the same struggle amplified. Even photos in their original size might be too small. Everything from posters and banners to exhibition graphics and billboards needs high-resolution images to print at a sufficient DPI.

### How Claid API can help

With Claid, you can restore the quality of user-uploaded images and prepare photos for printing at any size.

#### Restore the quality of user-generated images

Printing marketplaces and POD startups can use Claid API to:

* Increase resolution and detail with a neural network trained for low-res pictures.
* Remove compression artifacts.
* Make pixelated or blurry images sharp and clean.
* Fix colors and lighting.
* Get the aspect ratio you need. Crop, fit and place images into 16:9, 4:3 and other frames. See the [Fit](https://docs.claid.ai/image-editing-api/image-operations/resizing#fit) section to learn more.

#### Prepare for large-size prints with AI

Large-size printing services can:

* Use Claid to enhance images and make them ready for large format printing. Exhibitions, wall art, posters — print at any size at 300 DPI or other pixel density.
* Leverage true upscaling. Unlike basic interpolation methods, our AI adds missing pixels based on image content. It increases image resolution while improving quality and detail.
* Blow up photos up to 16x and 500 MP.

### How printing companies use Claid API

[Mixtiles](https://www.mixtiles.com/), a POD company, upsizes users’ images that don’t meet target resolution with Claid. This helps Mixtiles always deliver crisp and clear prints to their customers no matter how badly the input pictures were compressed.

> *“Using Claid API, we’ve basically taken a shortcut. We don't have to worry about image quality. We've solved a common problem we faced with user-generated content. This part is also fully automated.”*
>
> — Ido Grosberg, Engineering Team Lead at Mixtiles

Some raw numbers:

* On average, Mixtites upscales pictures from 0.7 to 3.5 MP. This means 5 times higher pixel density.
* The company also simplified its minimum requirements. It dropped from 800 x 800 to 499 x 499 pixels, allowing Mixtiles to reject fewer photos.

Read [the full case study here](https://claid.ai/customers/case-study/mixtiles/).

### API guide

Check out how Claid API helps to prepare digital images for printing. Following is an example of a photo in quality that users often upload to web-to-print services.&#x20;

**Tip:** click on the image to see it in full size.

<div align="center"><img src="https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2F7RhYQRjIHIBZiOMvUPh6%2Fprinting_portrait_6x4.jpg?alt=media&amp;token=3e0148d0-da97-4098-a9f1-07570ce76234" alt="Input image (445x667, compressed for web)"> <img src="https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FHmtuOXWq9Dn5tkDnI8JH%2Fprinting_portrait_6x4_ee34b24ce1.jpeg?alt=media&amp;token=2cd5785b-ef7c-4603-bbc0-662d58bda337" alt="Claid API result (890x1334, print-ready)"></div>

Claid restored image quality, increased the resolution, cleaned up some artifacts and slightly enhanced colors. We effectively went from 111 DPI to 222 DPI for a 6x4 inch print.

Below is an API Claid request that gives this result. We will show the request and further explain the options used to get this result. For complete information on the Claid API parameters, please visit the [Image Processing API](https://docs.claid.ai/image-editing-api/image-i-o) section.

{% tabs %}
{% tab title="HTTP" %}

```http
POST /v1/image/edit
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
Content-Type: application/json

{
  "input": "{YOUR IMAGE URL}",
  "operations": {
    "resizing": {
      "width": "200%",
      "height": "200%"
    },
    "adjustments": {
      "hdr": {
        "intensity": 20
      }
    },
    "restorations": {
      "upscale": "faces"
    }
  },
  "output": {
    "metadata": {
      "dpi": 300
    },
    "format": {
      "type": "jpeg",
      "quality": 90
    }
  }
}
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl -X POST --location "https://api.claid.ai/v1/image/edit" \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}" \
    -H "Content-Type: application/json" \
    -d "{
          \"input\": \"{YOUR IMAGE URL}\",
          \"operations\": {
            \"resizing\": {
              \"width\": \"200%\",
              \"height\": \"200%\"
            },
            \"adjustments\": {
              \"hdr\": {
                \"intensity\": 20
              }
            },
            \"restorations\": {
              \"upscale\": \"faces\"
            }
          },
          \"output\": {
            \"metadata\": {
              \"dpi\": 300
            },
            \"format\": {
              \"type\": \"jpeg\",
              \"quality\": 90
            }
          }
        }"
```

{% endtab %}
{% endtabs %}

`input` is an original image URL. Go to [Image I/O](/image-editing-api/image-i-o) to learn more.

`resizing` block describes the image size. It can define the exact resolution or an upscaling factor. In our case, the width and height of the image will be increased by `200%`. In this way, we preserve the aspect ratio and double the resolution and the PPI for the print. See [Resizing](/image-editing-api/image-operations/resizing) section to learn about this and other supported options.

`adjustments` specifies color adjustments applied to an image. Here, we have an ML-powered HDR algorithm applied with `20`% intensity that intelligently tunes colors and shadows. [Color Adjustments](/image-editing-api/image-operations/color-adjustments) section describes this in detail.

`restorations` block allows choosing from a wide range of neural networks to decompress and upscale images. Here, we went with "faces" as an upscaling mode. This network is trained to preserve facial features when upsizing portraits. Go to [Restorations](/image-editing-api/image-operations/restorations) section to learn more about how Claid can restore image quality.

`output` block states that we want to create a JPEG with a quality of `90` and DPI of `300`. In the API response, we will receive a temporary URL of a resulting image. Please consult [Image I/O](/image-editing-api/image-i-o) for an explanation of this block, and [Storages](/storage-connectors/overview) section if you want to connect Claid API directly with your Cloud Storage in a secure way.


