# 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](https://docs.claid.ai/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](https://docs.claid.ai/api-reference#request-headers) and [Response Headers](https://docs.claid.ai/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](#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](https://docs.claid.ai/api-reference#response-headers) to learn about headers.
