# 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.md#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.md) and [AI Fashion Models Options](/ai-fashion-models-api/ai-fashion-models-options.md) 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.md#request-headers) and [Response Headers](/image-editing-api/api-reference.md#response-headers) to learn about headers.

### Webhook notification

See [Webhook notification](/image-editing-api/async-api-reference.md#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.md#response-headers) to learn about headers.


---

# Agent Instructions: Querying This Documentation

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

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

```
GET https://docs.claid.ai/ai-fashion-models-api/async-api-reference.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

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