Search…
API Reference
request and response description

Image edit contract

Here is the all possible options for the request body, more information about operations you can find at Image Operations and Image I/O sections.
1
{
2
"input": "http(s)://{public_url}/image.png" |
3
"storage://{storage_name}/{image_folder}/image.png",
4
"operations": {
5
"restorations": {
6
"decompress": null |
7
"moderate" | "strong",
8
"upscale": null |
9
"smart_enhance" | "smart_resize" | "faces" |
10
"digital_art" | "photo"
11
},
12
"resizing": null | {
13
"width": null | "auto" | 500 | "150%",
14
"height": null | "auto" | 500 | "150%",
15
"fit": "bounds" | "cover" | "canvas" | "crop" |
16
{"crop": "center" | "smart"}
17
},
18
"adjustments": null | {
19
"hdr": 0 | {"intensity": 0, "stitching": true | false},
20
"exposure": 0,
21
"saturation": 0,
22
"contrast": 0,
23
"sharpness": 0
24
},
25
"background": null | {
26
"remove": false | true | {"clipping": false | true},
27
"color": "#ffffff" | "<color-hex>" | "transparent"
28
},
29
"padding": null | "10%"
30
},
31
"output": null | "storage://{storage_name}/{image_folder}/image.jpeg" | {
32
"destination": null | "storage://{storage_name}/{image_folder}/image.jpeg",
33
"format": "jpeg" | "png" | "webp" | "avif" | {
34
"type": "jpeg",
35
"quality": 85,
36
"progressive": true | false
37
}
38
}
39
}
Copied!
post
/v1-beta1/image/edit
Image Edit
Request body
1
POST /v1/pipeline HTTP/1.1
2
Host: api.claid.ai
3
Authorization: Bearer 12354567890
4
Content-Type: application/json
5
Content-Length: 174
6
7
{
8
"input": "https://staging.claid.ai/assets/cms/shoe_example_05fb154a3a/shoe_example_05fb154a3a.png",
9
"operations": {
10
"resizing": {
11
"width": 1000
12
},
13
"background": {
14
"remove": false
15
}
16
}
17
}
Copied!

Request headers:

In order to send request you will require to set Content-Type header to let our system know that you providing valid json payload and Authorization header with generated API key to identify yourself as Claid user.
1
Content-Type: application/json
2
Authorization: Bearer {{api_key}}
Copied!

Read a response

Once you have made the request to https://api.claid.ai/v1-beta1/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, 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, avif
tmp_url
string
Temporary URL of a processed image.*
Response body
1
{
2
"data": {
3
"input": {
4
"ext": "png",
5
"mps": 0.125,
6
"mime": "image/png",
7
"width": 500,
8
"format": "PNG",
9
"height": 250
10
},
11
"output": {
12
"ext": "png",
13
"mps": 0.431,
14
"mime": "image/jpeg",
15
"width": 1000,
16
"format": "JPEG",
17
"height": 431,
18
"tmp_url": "https://storage.googleapis.com/production-leapi-tmp-public/733a7c8f-1fea-4097-8fd4-17f54c94d998/shoe_example_05fb154a3a.png"
19
}
20
}
21
}
Copied!

Response headers:

Rate limit headers will help you to understand what number of request you are able to send according to current limits on your account:
1
ratelimit-limit: 120, 120;w=60, 4;w=1
2
ratelimit-remaining: 119
3
ratelimit-reset: 34
Copied!
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.
1
x-request-id: 9b321763-1d09-4072-932b-ff031475affa
Copied!
Copy link
Edit on GitHub