Documentation / ConvertConvert image by providing URL
This is a REST API provided by passing the URL of the original image to convert an image in AVIF format.Request
curl -x POST
https://avif-service-api.kokoon.cloud/avif/convert
-H "Authorization: <api_key>"
-d '{
"file_type": "url",
"file" : "https://www.example.com/gallery/example.jpg,
"compression_ratios" : ["level0", "level1", "level2", "level3"]
}'
List of request parameters
Parameter name | Type | Description |
---|
file_type | string | type of original image (URL) |
file | string | If file_type is url, the original image url must be passed to this parameter. Only jpeg, png, gif, webp format files are accepted. |
compression_ratios | level0, level1, level2, level3 | This is a list of options when converting to avif. Up to 4, level0/level1/level2/level3 are the possible options, and if the compression_ratios parameter is not included in the request, ["level1"] is applied as default.
Regarding the value of levelN, the smaller the N, the lower the compression rate, but the better the image quality. |
Response
{
"id": "823f2450-2323-ds3f-ff3242ddsv2"
}
List of response parameters
Response field | Type | Description |
---|
id | string | conversion id |
Response error
Error name | Status | Description |
---|
Insufficient storage | 507 | If the quota assigned to user (api-key) is exceeded. |
Too many request | 429 | In case the number of concurrent avif-converts in the entire server is exceeded. |
Forbidden | 403 | - 1. When providing images outside the range of 64x64<= size <= 8192x8192
- 2. When providing image files with extensions other than supported
- 3. This error occurs when other invalid options are provided.
|