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 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)
POST/v1-beta1/image/edit/async
Authorization
Body
input*Input URL
URL of the input image. Should be from 1 to 512 characters. Image must be accessible by our system.
Example: "storage://storage_1/path/image.jpg"
operations*Operations
Customize the editing workflow so that the output images meet your requirements.
Once you have made the request to https://api.claid.ai/v1-beta1/image/edit/async you will get a response with information about request status and some other details (listed below).
Request information shown in the response:
Parameter
Type
Description
id
integer
Task ID.
status
string
Request processing status. For a valid requst can only have one value: ACCEPTED.
result_url
string
URL of GET endpoint that can be used to get the result manually and get request status while it is still in process.
created_at
string
Exact time when the processing was requested.
request
object
The body of the request that was used for processing.
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 result_url property of the response body described above.
Once you have made the request to https://api.claid.ai/v1-beta1/image/edit/async/<task_id> you will get a response with information about the request, input and output images.
Image information shown in the response:
Parameter
Type
Description
id
integer
Task ID.
status
string
Request processing status. Can have values: ACCEPTED, PROCESSING, ERROR, DONE.
created_at
string
Exact time when the processing was requested.
request
object
The body of the request that was used for processing.
errors
list
List of errors, if any are occurred during image processing (status will have ERROR value), in other cases - will be empty.
result
object
Result object that is contain 2 properties input_object and output_object, in case of processing errors - will be empty. Details are listed below.
Read a input_object and output_object properties of response result property:
Parameter
Type
Description
ext
string
File extension. Can have values: jpg, png, webp, av1.
mps
float
Megapixel count.
mime
string
MIME type (also known as ‘media type’).
width
integer
Image width in pixels.
height
integer
Image height in pixels.
format
string
File format. Can have values: jpeg, png, webp, avif.
tmp_url
string
Temporary URL of a processed image. Is available only for output_object.
Read an item from errors property:
Parameter
Type
Description
error
string
Error message in text.
created_at
integer
Exact time when the error was catched.
input_object
object
Same as input_object from result property. For some errors can be null.