API Reference

request and response description

Image edit contract

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

{
    "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" | {
            "type": "jpeg",
            "quality": 85, // format-specific options
            "progressive": true | false
        } | {
            "type": "png",
            "compression": "fast" | "best" | "optimal"
        } | {
            "type": "webp" | "avif",
            "compression": {
                "type": "lossy" | "lossless",  
                "quality": 90
            }
        }
    }
}

Request

POST /v1-beta1/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
        }
    }
}

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 as a Claid user.

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

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, 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

{
    "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 headers will help you to understand what number of requests you are able to send according to the current limits on your account:

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.

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

Last updated