API reference
Everything the API does, built from the same list as the routes.
Note: The API is not open yet. This page describes it.
The official OpenAI SDK works when its base URL points here.
There is no try-it console. Use a test key from your own terminal.
Base address
Base address
https://easyimage.ae/v1Authentication
Send your key as Authorization: Bearer followed by the key. Never put it in an address.
Authentication
Authorization: Bearer $EASYIMAGE_API_KEYAsynchronous calls and retries
Most calls answer with a job. Poll the job, or wait for a webhook.
Send Prefer: wait=30 to wait up to 30 seconds for the job to end. Use 1 to 60.
Send an Idempotency-Key header so a retry never makes a second job or charge.
Webhook events
A webhook is a signed message sent to your endpoint when a job ends.
Check each message signature with the secret before you trust it.
job.succeeded
A job delivered its pictures
Payload
idstring Required The id of this event. The same event is always sent with the same id, so use it to ignore repeats.typestring Required One of: job.succeeded.created_atinteger Requireddataobject Requiredjobobject Required The job object as a webhook carries it: the same fields, without links.idstring Requiredobjectstring Required One of: job.operationstring Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.statusstring Required One of: queued, running, succeeded, failed, refused, canceled, expired.progressobject Required Where a job is: the step it is on and how many steps it has.stepinteger Requiredstep_totalinteger Required
created_atinteger Requiredfinished_atinteger or null Requiredcreditsinteger Requirederrorobject or null Requiredcodestring Required One of: try_again, content_refused, output_refused, unavailable.messagestring Required
resultobject or null Requiredimageslist of object Requiredidstring Requiredwidthinteger Required at least 1.heightinteger Required at least 1.content_typestring Required
job.failed
A job failed or was refused
Payload
idstring Required The id of this event. The same event is always sent with the same id, so use it to ignore repeats.typestring Required One of: job.failed.created_atinteger Requireddataobject Requiredjobobject Required The job object as a webhook carries it: the same fields, without links.idstring Requiredobjectstring Required One of: job.operationstring Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.statusstring Required One of: queued, running, succeeded, failed, refused, canceled, expired.progressobject Required Where a job is: the step it is on and how many steps it has.stepinteger Requiredstep_totalinteger Required
created_atinteger Requiredfinished_atinteger or null Requiredcreditsinteger Requirederrorobject or null Requiredcodestring Required One of: try_again, content_refused, output_refused, unavailable.messagestring Required
resultobject or null Requiredimageslist of object Requiredidstring Requiredwidthinteger Required at least 1.heightinteger Required at least 1.content_typestring Required
job.canceled
A job was canceled
Payload
idstring Required The id of this event. The same event is always sent with the same id, so use it to ignore repeats.typestring Required One of: job.canceled.created_atinteger Requireddataobject Requiredjobobject Required The job object as a webhook carries it: the same fields, without links.idstring Requiredobjectstring Required One of: job.operationstring Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.statusstring Required One of: queued, running, succeeded, failed, refused, canceled, expired.progressobject Required Where a job is: the step it is on and how many steps it has.stepinteger Requiredstep_totalinteger Required
created_atinteger Requiredfinished_atinteger or null Requiredcreditsinteger Requirederrorobject or null Requiredcodestring Required One of: try_again, content_refused, output_refused, unavailable.messagestring Required
resultobject or null Requiredimageslist of object Requiredidstring Requiredwidthinteger Required at least 1.heightinteger Required at least 1.content_typestring Required
webhook.test
A test event
Payload
idstring Required The id of this event. The same event is always sent with the same id, so use it to ignore repeats.typestring Required One of: webhook.test.created_atinteger Requireddataobject Required
Errors
Every error has the same shape. The code says what to do next.
| Code | Status | Type | Message |
|---|---|---|---|
api_disabled | 403 | permission_error | The developer API is not open yet. Try again once it has been opened for your account. |
key_in_query | 400 | invalid_request_error | A key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way. |
invalid_key | 401 | authentication_error | The key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header. |
key_revoked | 401 | authentication_error | This key has been revoked. Make a new key on the Developer API page. |
key_expired | 401 | authentication_error | This key has expired. Make a new key on the Developer API page. |
plan_required | 403 | permission_error | Your plan does not include the developer API. Move to a plan that does, then try again. |
missing_scope | 403 | permission_error | This key is not allowed to do that. Use a key that has the scope this route needs. |
wrong_key_type | 403 | permission_error | This key cannot be used here. |
foreign_origin | 403 | permission_error | Requests from other websites are not accepted. |
not_verified | 403 | permission_error | Verify your email address before you use this feature. |
account_on_hold | 403 | permission_error | This account has a safety hold, so new requests are not accepted. Open your account page to see what to do next. |
invalid_request | 400 | invalid_request_error | The request could not be used. Check the field named in param and the documentation, then try again. |
unsupported_parameter | 400 | invalid_request_error | The request has a field or value that this API does not support. Remove it or change it, then try again. |
unknown_model | 400 | invalid_request_error | That model name is not known. Use a name from the list in the documentation. |
too_many_images | 400 | invalid_request_error | The request has more images than this route accepts. Send one image. |
mask_unreadable | 400 | invalid_request_error | The mask could not be read. Send a non-interlaced PNG with an alpha channel. |
mask_size_mismatch | 400 | invalid_request_error | The mask must have the same proportions as the image. Resize the mask and try again. |
mask_too_complex | 400 | invalid_request_error | The mask is too detailed to use. Send a smaller or simpler mask. |
image_not_found | 404 | not_found_error | No available image matches that id. Check the id, or send the image itself. |
image_url_refused | 400 | invalid_request_error | The image address could not be used. It must be a public https address that returns a picture. |
image_refused | 400 | invalid_request_error | The image was not accepted. Send a JPEG, PNG or WebP picture that is not too large. |
body_too_large | 413 | invalid_request_error | The request is larger than this route accepts. Send a smaller request. |
not_found | 404 | not_found_error | Nothing was found for that id. Check the id and try again. |
rate_limited | 429 | rate_limit_error | Too many requests. Wait for the time in the Retry-After header, then try again. |
daily_line_reached | 429 | quota_error | The daily limit for your plan has been reached. Try again after the time in reset_at. |
period_pool_used | 429 | quota_error | The credits for this plan period have been used. Try again after the time in reset_at. |
class_limit_reached | 429 | quota_error | The limit for this kind of picture has been reached. Try again after the time in reset_at. |
free_budget_spent | 429 | quota_error | The free allowance has been used. Try again after the time in reset_at, or move to a paid plan. |
key_budget_reached | 429 | quota_error | This key's monthly credit budget has been reached. Raise the budget or use another key, or wait for the time in reset_at. |
over_max_credits | 402 | quota_error | This request would cost more credits than max_credits allows. Raise max_credits or change the request. |
quote_changed | 409 | conflict_error | The price changed while the request was being made. Send the request again. |
idempotency_conflict | 409 | conflict_error | That Idempotency-Key was already used for a different request. Use a new key, or repeat the first request exactly. |
content_refused | 400 | content_policy_error | The request was refused by the content rules. Change the request and try again. |
class_not_in_plan | 403 | permission_error | Your plan does not include this kind of picture. Move to a plan that does, or choose another operation. |
operation_unavailable | 503 | api_error | This operation is not available right now. Try again later. |
try_again | 503 | api_error | The request could not be finished this time. Wait a few seconds and try again. |
Images
Make and change pictures. Every call starts a job.
POST /v1/images/generationsMake pictures from a description
Starts one job for each picture asked for. The request has the shape of the common image-generation API, so a client library for that API works when its base URL is this one. The call waits for the pictures, up to 60 seconds, and answers 200 with signed links. If they are not ready it answers 202 with the jobs. Send Prefer: respond-async to get the 202 at once.
Scopes
images
Parameters
| Name | In | Required | Description |
|---|---|---|---|
Idempotency-Key | header | Optional | A value you choose for this request. Send the same value to repeat the request after a timeout: you get the same jobs back and nothing is charged twice. A repeat waits at most 5 seconds for the jobs, and not at all while 2 other repeats of your account are waiting; it then answers 202 with the jobs, so poll the job. The same value with a different request is refused. |
Prefer | header | Optional | respond-async answers at once with the job. wait=N (N from 1 to 60) waits up to that many seconds for the job to end on the routes that answer with a job. |
Request
promptstring Required What the picture should show. Plain text, no control characters. 1 to 16000 characters.modelstring Optional A model name from the list in the documentation. Leave it out for the default. 1 to 64 characters.ninteger Optional How many pictures, 1 to 4 and at most your plan's batch size. Default 1. 1 to 4.sizestring Optional The size as WIDTHxHEIGHT, or auto. Only the sizes the chosen model offers are accepted.qualitystring Optional The quality step. Refused when the chosen model has no such step. One of: auto, standard, hd, low, medium, high.response_formatstring Optional Only url is supported. Pictures come as signed links. One of: url.output_formatstring Optional Only png is supported. The result is a png file. One of: png.userstring Optional Accepted so existing clients work. It is ignored and never stored. at most 256 characters.max_creditsinteger Optional Refuse the request, before anything starts, if it would cost more credits than this. 0 to 1000000.
Answers
200 The pictures are ready. data holds one signed link for each picture that was made.
createdinteger Requireddatalist of object Requiredurlstring Required
easyimageobject Requiredjob_idslist of string Requiredcreditsinteger Requiredexpires_atinteger Required When the links in data stop working.failedlist of string Optional The ids of pictures that failed or were refused. They are left out of data.
202 The pictures are not ready yet. data holds the jobs. Poll each one, or wait for a webhook.
objectstring Required One of: list.datalist of object Requiredidstring Requiredobjectstring Required One of: job.operationstring Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.statusstring Required One of: queued, running, succeeded, failed, refused, canceled, expired.progressobject Required Where a job is: the step it is on and how many steps it has.stepinteger Requiredstep_totalinteger Required
created_atinteger Requiredfinished_atinteger or null Requiredcreditsinteger Requirederrorobject or null Requiredcodestring Required One of: try_again, content_refused, output_refused, unavailable.messagestring Required
resultobject or null Requiredimageslist of object Requiredidstring Requiredurlstring Requiredexpires_atinteger Requiredwidthinteger Required at least 1.heightinteger Required at least 1.content_typestring Required
Errors
| Status | Code | Message |
|---|---|---|
| 400 | key_in_query | A key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way. |
| 400 | invalid_request | The request could not be used. Check the field named in param and the documentation, then try again. |
| 400 | unsupported_parameter | The request has a field or value that this API does not support. Remove it or change it, then try again. |
| 400 | unknown_model | That model name is not known. Use a name from the list in the documentation. |
| 400 | content_refused | The request was refused by the content rules. Change the request and try again. |
| 401 | invalid_key | The key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header. |
| 401 | key_revoked | This key has been revoked. Make a new key on the Developer API page. |
| 401 | key_expired | This key has expired. Make a new key on the Developer API page. |
| 402 | over_max_credits | This request would cost more credits than max_credits allows. Raise max_credits or change the request. |
| 403 | api_disabled | The developer API is not open yet. Try again once it has been opened for your account. |
| 403 | plan_required | Your plan does not include the developer API. Move to a plan that does, then try again. |
| 403 | missing_scope | This key is not allowed to do that. Use a key that has the scope this route needs. |
| 403 | wrong_key_type | This key cannot be used here. |
| 403 | not_verified | Verify your email address before you use this feature. |
| 403 | account_on_hold | This account has a safety hold, so new requests are not accepted. Open your account page to see what to do next. |
| 403 | class_not_in_plan | Your plan does not include this kind of picture. Move to a plan that does, or choose another operation. |
| 409 | quote_changed | The price changed while the request was being made. Send the request again. |
| 409 | idempotency_conflict | That Idempotency-Key was already used for a different request. Use a new key, or repeat the first request exactly. |
| 413 | body_too_large | The request is larger than this route accepts. Send a smaller request. |
| 429 | rate_limited | Too many requests. Wait for the time in the Retry-After header, then try again. |
| 429 | daily_line_reached | The daily limit for your plan has been reached. Try again after the time in reset_at. |
| 429 | period_pool_used | The credits for this plan period have been used. Try again after the time in reset_at. |
| 429 | class_limit_reached | The limit for this kind of picture has been reached. Try again after the time in reset_at. |
| 429 | free_budget_spent | The free allowance has been used. Try again after the time in reset_at, or move to a paid plan. |
| 429 | key_budget_reached | This key's monthly credit budget has been reached. Raise the budget or use another key, or wait for the time in reset_at. |
| 503 | operation_unavailable | This operation is not available right now. Try again later. |
| 503 | try_again | The request could not be finished this time. Wait a few seconds and try again. |
Example
curl
curl -X POST https://easyimage.ae/v1/images/generations \
-H "Authorization: Bearer $EASYIMAGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt":"A lighthouse on a cliff at dusk, soft light","size":"1024x1024","n":1}'JavaScript
const response = await fetch("https://easyimage.ae/v1/images/generations", {
method: "POST",
body: JSON.stringify({
"prompt": "A lighthouse on a cliff at dusk, soft light",
"size": "1024x1024",
"n": 1
}),
headers: {
Authorization: `Bearer ${process.env.EASYIMAGE_API_KEY}`,
"Content-Type": "application/json",
},
});
console.log(await response.json());SDK
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.EASYIMAGE_API_KEY,
baseURL: "https://easyimage.ae/v1",
});
const result = await client.images.generate({
"prompt": "A lighthouse on a cliff at dusk, soft light",
"size": "1024x1024",
"n": 1
});
console.log(result.data[0].url);POST /v1/images/editsChange a picture with words and an optional mask
A multipart form with one picture, a description and an optional mask. Without a mask the whole picture is changed. With a mask, transparent pixels are repainted. The call waits as the generation route does.
Scopes
images
Parameters
| Name | In | Required | Description |
|---|---|---|---|
Idempotency-Key | header | Optional | A value you choose for this request. Send the same value to repeat the request after a timeout: you get the same jobs back and nothing is charged twice. A repeat waits at most 5 seconds for the jobs, and not at all while 2 other repeats of your account are waiting; it then answers 202 with the jobs, so poll the job. The same value with a different request is refused. |
Prefer | header | Optional | respond-async answers at once with the job. wait=N (N from 1 to 60) waits up to that many seconds for the job to end on the routes that answer with a job. |
Request
imagefile Required The picture to change: one JPEG, PNG or WebP file. image[] with exactly one file is accepted too.promptstring Required What to change or show, as plain text.maskfile Optional A PNG with an alpha channel. Transparent pixels are edited. Without a mask the whole picture is edited.nstring Optional How many results. Only 1 is supported.sizestring Optional auto, or the size of the source picture as WIDTHxHEIGHT.response_formatstring Optional Only url is supported.modelstring Optional A model name from the list in the documentation. Leave it out for the default.max_creditsstring Optional Refuse the request, before anything starts, if it would cost more credits than this whole number.
Answers
200 The picture is ready. data holds one signed link.
createdinteger Requireddatalist of object Requiredurlstring Required
easyimageobject Requiredjob_idslist of string Requiredcreditsinteger Requiredexpires_atinteger Required When the links in data stop working.failedlist of string Optional The ids of pictures that failed or were refused. They are left out of data.
202 The picture is not ready yet. data holds the job. Poll it, or wait for a webhook.
objectstring Required One of: list.datalist of object Requiredidstring Requiredobjectstring Required One of: job.operationstring Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.statusstring Required One of: queued, running, succeeded, failed, refused, canceled, expired.progressobject Required Where a job is: the step it is on and how many steps it has.stepinteger Requiredstep_totalinteger Required
created_atinteger Requiredfinished_atinteger or null Requiredcreditsinteger Requirederrorobject or null Requiredcodestring Required One of: try_again, content_refused, output_refused, unavailable.messagestring Required
resultobject or null Requiredimageslist of object Requiredidstring Requiredurlstring Requiredexpires_atinteger Requiredwidthinteger Required at least 1.heightinteger Required at least 1.content_typestring Required
Errors
| Status | Code | Message |
|---|---|---|
| 400 | key_in_query | A key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way. |
| 400 | invalid_request | The request could not be used. Check the field named in param and the documentation, then try again. |
| 400 | unsupported_parameter | The request has a field or value that this API does not support. Remove it or change it, then try again. |
| 400 | unknown_model | That model name is not known. Use a name from the list in the documentation. |
| 400 | too_many_images | The request has more images than this route accepts. Send one image. |
| 400 | mask_unreadable | The mask could not be read. Send a non-interlaced PNG with an alpha channel. |
| 400 | mask_size_mismatch | The mask must have the same proportions as the image. Resize the mask and try again. |
| 400 | mask_too_complex | The mask is too detailed to use. Send a smaller or simpler mask. |
| 400 | image_refused | The image was not accepted. Send a JPEG, PNG or WebP picture that is not too large. |
| 400 | content_refused | The request was refused by the content rules. Change the request and try again. |
| 401 | invalid_key | The key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header. |
| 401 | key_revoked | This key has been revoked. Make a new key on the Developer API page. |
| 401 | key_expired | This key has expired. Make a new key on the Developer API page. |
| 402 | over_max_credits | This request would cost more credits than max_credits allows. Raise max_credits or change the request. |
| 403 | api_disabled | The developer API is not open yet. Try again once it has been opened for your account. |
| 403 | plan_required | Your plan does not include the developer API. Move to a plan that does, then try again. |
| 403 | missing_scope | This key is not allowed to do that. Use a key that has the scope this route needs. |
| 403 | wrong_key_type | This key cannot be used here. |
| 403 | not_verified | Verify your email address before you use this feature. |
| 403 | account_on_hold | This account has a safety hold, so new requests are not accepted. Open your account page to see what to do next. |
| 403 | class_not_in_plan | Your plan does not include this kind of picture. Move to a plan that does, or choose another operation. |
| 409 | quote_changed | The price changed while the request was being made. Send the request again. |
| 409 | idempotency_conflict | That Idempotency-Key was already used for a different request. Use a new key, or repeat the first request exactly. |
| 413 | body_too_large | The request is larger than this route accepts. Send a smaller request. |
| 429 | rate_limited | Too many requests. Wait for the time in the Retry-After header, then try again. |
| 429 | daily_line_reached | The daily limit for your plan has been reached. Try again after the time in reset_at. |
| 429 | period_pool_used | The credits for this plan period have been used. Try again after the time in reset_at. |
| 429 | class_limit_reached | The limit for this kind of picture has been reached. Try again after the time in reset_at. |
| 429 | free_budget_spent | The free allowance has been used. Try again after the time in reset_at, or move to a paid plan. |
| 429 | key_budget_reached | This key's monthly credit budget has been reached. Raise the budget or use another key, or wait for the time in reset_at. |
| 503 | operation_unavailable | This operation is not available right now. Try again later. |
| 503 | try_again | The request could not be finished this time. Wait a few seconds and try again. |
Example
curl
curl -X POST https://easyimage.ae/v1/images/edits \
-H "Authorization: Bearer $EASYIMAGE_API_KEY" \
-F 'image=@photo.png' \
-F 'prompt=Make the sky a warm evening orange'JavaScript
import { readFile } from "node:fs/promises";
const form = new FormData();
form.append("image", new Blob([await readFile("photo.png")]), "photo.png");
form.append("prompt", "Make the sky a warm evening orange");
const response = await fetch("https://easyimage.ae/v1/images/edits", {
method: "POST",
body: form,
headers: {
Authorization: `Bearer ${process.env.EASYIMAGE_API_KEY}`,
},
});
console.log(await response.json());SDK
import fs from "node:fs";
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.EASYIMAGE_API_KEY,
baseURL: "https://easyimage.ae/v1",
});
const result = await client.images.edit({
image: fs.createReadStream("photo.png"),
prompt: "Make the sky a warm evening orange",
});
console.log(result.data[0].url);POST /v1/images/background-removalRemove the background of a picture
Cuts out the subject and returns a picture with a transparent background. Send one of image_id and image_url.
Scopes
images
Parameters
| Name | In | Required | Description |
|---|---|---|---|
Idempotency-Key | header | Optional | A value you choose for this request. Send the same value to repeat the request after a timeout: you get the same jobs back and nothing is charged twice. A repeat waits at most 5 seconds for the jobs, and not at all while 2 other repeats of your account are waiting; it then answers 202 with the jobs, so poll the job. The same value with a different request is refused. |
Prefer | header | Optional | respond-async answers at once with the job. wait=N (N from 1 to 60) waits up to that many seconds for the job to end on the routes that answer with a job. |
Request
image_idstring Optional The id of one of your library images.image_urlstring Optional A public https address that returns a JPEG, PNG or WebP picture. 1 to 2000 characters.max_creditsinteger Optional Refuse the request, before anything starts, if it would cost more credits than this. 0 to 1000000.
Answers
200 The job ended inside the wait you asked for with Prefer: wait. The body is the finished job.
idstring Requiredobjectstring Required One of: job.operationstring Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.statusstring Required One of: queued, running, succeeded, failed, refused, canceled, expired.progressobject Required Where a job is: the step it is on and how many steps it has.stepinteger Requiredstep_totalinteger Required
created_atinteger Requiredfinished_atinteger or null Requiredcreditsinteger Requirederrorobject or null Requiredcodestring Required One of: try_again, content_refused, output_refused, unavailable.messagestring Required
resultobject or null Requiredimageslist of object Requiredidstring Requiredurlstring Requiredexpires_atinteger Requiredwidthinteger Required at least 1.heightinteger Required at least 1.content_typestring Required
202 The job was accepted and is still running. Poll it, or wait for a webhook. The Location header names the job.
idstring Requiredobjectstring Required One of: job.operationstring Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.statusstring Required One of: queued, running, succeeded, failed, refused, canceled, expired.progressobject Required Where a job is: the step it is on and how many steps it has.stepinteger Requiredstep_totalinteger Required
created_atinteger Requiredfinished_atinteger or null Requiredcreditsinteger Requirederrorobject or null Requiredcodestring Required One of: try_again, content_refused, output_refused, unavailable.messagestring Required
resultobject or null Requiredimageslist of object Requiredidstring Requiredurlstring Requiredexpires_atinteger Requiredwidthinteger Required at least 1.heightinteger Required at least 1.content_typestring Required
Errors
| Status | Code | Message |
|---|---|---|
| 400 | key_in_query | A key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way. |
| 400 | invalid_request | The request could not be used. Check the field named in param and the documentation, then try again. |
| 400 | unsupported_parameter | The request has a field or value that this API does not support. Remove it or change it, then try again. |
| 400 | image_url_refused | The image address could not be used. It must be a public https address that returns a picture. |
| 400 | image_refused | The image was not accepted. Send a JPEG, PNG or WebP picture that is not too large. |
| 400 | content_refused | The request was refused by the content rules. Change the request and try again. |
| 401 | invalid_key | The key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header. |
| 401 | key_revoked | This key has been revoked. Make a new key on the Developer API page. |
| 401 | key_expired | This key has expired. Make a new key on the Developer API page. |
| 402 | over_max_credits | This request would cost more credits than max_credits allows. Raise max_credits or change the request. |
| 403 | api_disabled | The developer API is not open yet. Try again once it has been opened for your account. |
| 403 | plan_required | Your plan does not include the developer API. Move to a plan that does, then try again. |
| 403 | missing_scope | This key is not allowed to do that. Use a key that has the scope this route needs. |
| 403 | wrong_key_type | This key cannot be used here. |
| 403 | not_verified | Verify your email address before you use this feature. |
| 403 | account_on_hold | This account has a safety hold, so new requests are not accepted. Open your account page to see what to do next. |
| 403 | class_not_in_plan | Your plan does not include this kind of picture. Move to a plan that does, or choose another operation. |
| 404 | image_not_found | No available image matches that id. Check the id, or send the image itself. |
| 409 | quote_changed | The price changed while the request was being made. Send the request again. |
| 409 | idempotency_conflict | That Idempotency-Key was already used for a different request. Use a new key, or repeat the first request exactly. |
| 413 | body_too_large | The request is larger than this route accepts. Send a smaller request. |
| 429 | rate_limited | Too many requests. Wait for the time in the Retry-After header, then try again. |
| 429 | daily_line_reached | The daily limit for your plan has been reached. Try again after the time in reset_at. |
| 429 | period_pool_used | The credits for this plan period have been used. Try again after the time in reset_at. |
| 429 | class_limit_reached | The limit for this kind of picture has been reached. Try again after the time in reset_at. |
| 429 | free_budget_spent | The free allowance has been used. Try again after the time in reset_at, or move to a paid plan. |
| 429 | key_budget_reached | This key's monthly credit budget has been reached. Raise the budget or use another key, or wait for the time in reset_at. |
| 503 | operation_unavailable | This operation is not available right now. Try again later. |
| 503 | try_again | The request could not be finished this time. Wait a few seconds and try again. |
Example
curl
curl -X POST https://easyimage.ae/v1/images/background-removal \
-H "Authorization: Bearer $EASYIMAGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"image_id":"0192f3a4-7b6c-7d2e-8f10-3a4b5c6d7e8f"}'JavaScript
const response = await fetch("https://easyimage.ae/v1/images/background-removal", {
method: "POST",
body: JSON.stringify({
"image_id": "0192f3a4-7b6c-7d2e-8f10-3a4b5c6d7e8f"
}),
headers: {
Authorization: `Bearer ${process.env.EASYIMAGE_API_KEY}`,
"Content-Type": "application/json",
},
});
console.log(await response.json());POST /v1/images/upscaleMake a picture larger
Enlarges a picture two or four times and keeps it sharp. Send one of image_id and image_url.
Scopes
images
Parameters
| Name | In | Required | Description |
|---|---|---|---|
Idempotency-Key | header | Optional | A value you choose for this request. Send the same value to repeat the request after a timeout: you get the same jobs back and nothing is charged twice. A repeat waits at most 5 seconds for the jobs, and not at all while 2 other repeats of your account are waiting; it then answers 202 with the jobs, so poll the job. The same value with a different request is refused. |
Prefer | header | Optional | respond-async answers at once with the job. wait=N (N from 1 to 60) waits up to that many seconds for the job to end on the routes that answer with a job. |
Request
image_idstring Optional The id of one of your library images.image_urlstring Optional A public https address that returns a JPEG, PNG or WebP picture. 1 to 2000 characters.modestring Required How much larger. One of: 2x, 4x.max_creditsinteger Optional Refuse the request, before anything starts, if it would cost more credits than this. 0 to 1000000.
Answers
200 The job ended inside the wait you asked for with Prefer: wait. The body is the finished job.
idstring Requiredobjectstring Required One of: job.operationstring Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.statusstring Required One of: queued, running, succeeded, failed, refused, canceled, expired.progressobject Required Where a job is: the step it is on and how many steps it has.stepinteger Requiredstep_totalinteger Required
created_atinteger Requiredfinished_atinteger or null Requiredcreditsinteger Requirederrorobject or null Requiredcodestring Required One of: try_again, content_refused, output_refused, unavailable.messagestring Required
resultobject or null Requiredimageslist of object Requiredidstring Requiredurlstring Requiredexpires_atinteger Requiredwidthinteger Required at least 1.heightinteger Required at least 1.content_typestring Required
202 The job was accepted and is still running. Poll it, or wait for a webhook. The Location header names the job.
idstring Requiredobjectstring Required One of: job.operationstring Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.statusstring Required One of: queued, running, succeeded, failed, refused, canceled, expired.progressobject Required Where a job is: the step it is on and how many steps it has.stepinteger Requiredstep_totalinteger Required
created_atinteger Requiredfinished_atinteger or null Requiredcreditsinteger Requirederrorobject or null Requiredcodestring Required One of: try_again, content_refused, output_refused, unavailable.messagestring Required
resultobject or null Requiredimageslist of object Requiredidstring Requiredurlstring Requiredexpires_atinteger Requiredwidthinteger Required at least 1.heightinteger Required at least 1.content_typestring Required
Errors
| Status | Code | Message |
|---|---|---|
| 400 | key_in_query | A key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way. |
| 400 | invalid_request | The request could not be used. Check the field named in param and the documentation, then try again. |
| 400 | unsupported_parameter | The request has a field or value that this API does not support. Remove it or change it, then try again. |
| 400 | image_url_refused | The image address could not be used. It must be a public https address that returns a picture. |
| 400 | image_refused | The image was not accepted. Send a JPEG, PNG or WebP picture that is not too large. |
| 400 | content_refused | The request was refused by the content rules. Change the request and try again. |
| 401 | invalid_key | The key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header. |
| 401 | key_revoked | This key has been revoked. Make a new key on the Developer API page. |
| 401 | key_expired | This key has expired. Make a new key on the Developer API page. |
| 402 | over_max_credits | This request would cost more credits than max_credits allows. Raise max_credits or change the request. |
| 403 | api_disabled | The developer API is not open yet. Try again once it has been opened for your account. |
| 403 | plan_required | Your plan does not include the developer API. Move to a plan that does, then try again. |
| 403 | missing_scope | This key is not allowed to do that. Use a key that has the scope this route needs. |
| 403 | wrong_key_type | This key cannot be used here. |
| 403 | not_verified | Verify your email address before you use this feature. |
| 403 | account_on_hold | This account has a safety hold, so new requests are not accepted. Open your account page to see what to do next. |
| 403 | class_not_in_plan | Your plan does not include this kind of picture. Move to a plan that does, or choose another operation. |
| 404 | image_not_found | No available image matches that id. Check the id, or send the image itself. |
| 409 | quote_changed | The price changed while the request was being made. Send the request again. |
| 409 | idempotency_conflict | That Idempotency-Key was already used for a different request. Use a new key, or repeat the first request exactly. |
| 413 | body_too_large | The request is larger than this route accepts. Send a smaller request. |
| 429 | rate_limited | Too many requests. Wait for the time in the Retry-After header, then try again. |
| 429 | daily_line_reached | The daily limit for your plan has been reached. Try again after the time in reset_at. |
| 429 | period_pool_used | The credits for this plan period have been used. Try again after the time in reset_at. |
| 429 | class_limit_reached | The limit for this kind of picture has been reached. Try again after the time in reset_at. |
| 429 | free_budget_spent | The free allowance has been used. Try again after the time in reset_at, or move to a paid plan. |
| 429 | key_budget_reached | This key's monthly credit budget has been reached. Raise the budget or use another key, or wait for the time in reset_at. |
| 503 | operation_unavailable | This operation is not available right now. Try again later. |
| 503 | try_again | The request could not be finished this time. Wait a few seconds and try again. |
Example
curl
curl -X POST https://easyimage.ae/v1/images/upscale \
-H "Authorization: Bearer $EASYIMAGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"image_id":"0192f3a4-7b6c-7d2e-8f10-3a4b5c6d7e8f","mode":"2x"}'JavaScript
const response = await fetch("https://easyimage.ae/v1/images/upscale", {
method: "POST",
body: JSON.stringify({
"image_id": "0192f3a4-7b6c-7d2e-8f10-3a4b5c6d7e8f",
"mode": "2x"
}),
headers: {
Authorization: `Bearer ${process.env.EASYIMAGE_API_KEY}`,
"Content-Type": "application/json",
},
});
console.log(await response.json());POST /v1/images/outpaintExtend a picture past its edges
Grows the canvas by the frame you give and fills the new area. The frame is in ten-thousandths of the picture. Send one of image_id and image_url.
Scopes
images
Parameters
| Name | In | Required | Description |
|---|---|---|---|
Idempotency-Key | header | Optional | A value you choose for this request. Send the same value to repeat the request after a timeout: you get the same jobs back and nothing is charged twice. A repeat waits at most 5 seconds for the jobs, and not at all while 2 other repeats of your account are waiting; it then answers 202 with the jobs, so poll the job. The same value with a different request is refused. |
Prefer | header | Optional | respond-async answers at once with the job. wait=N (N from 1 to 60) waits up to that many seconds for the job to end on the routes that answer with a job. |
Request
image_idstring Optional The id of one of your library images.image_urlstring Optional A public https address that returns a JPEG, PNG or WebP picture. 1 to 2000 characters.frameobject Required How far each edge grows, in ten-thousandths of the picture: left and right of its width, top and bottom of its height.leftinteger Required 0 to 10000.topinteger Required 0 to 10000.rightinteger Required 0 to 10000.bottominteger Required 0 to 10000.
promptstring Optional What the new area should show. Leave it out to continue the picture. 1 to 1000 characters.max_creditsinteger Optional Refuse the request, before anything starts, if it would cost more credits than this. 0 to 1000000.
Answers
200 The job ended inside the wait you asked for with Prefer: wait. The body is the finished job.
idstring Requiredobjectstring Required One of: job.operationstring Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.statusstring Required One of: queued, running, succeeded, failed, refused, canceled, expired.progressobject Required Where a job is: the step it is on and how many steps it has.stepinteger Requiredstep_totalinteger Required
created_atinteger Requiredfinished_atinteger or null Requiredcreditsinteger Requirederrorobject or null Requiredcodestring Required One of: try_again, content_refused, output_refused, unavailable.messagestring Required
resultobject or null Requiredimageslist of object Requiredidstring Requiredurlstring Requiredexpires_atinteger Requiredwidthinteger Required at least 1.heightinteger Required at least 1.content_typestring Required
202 The job was accepted and is still running. Poll it, or wait for a webhook. The Location header names the job.
idstring Requiredobjectstring Required One of: job.operationstring Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.statusstring Required One of: queued, running, succeeded, failed, refused, canceled, expired.progressobject Required Where a job is: the step it is on and how many steps it has.stepinteger Requiredstep_totalinteger Required
created_atinteger Requiredfinished_atinteger or null Requiredcreditsinteger Requirederrorobject or null Requiredcodestring Required One of: try_again, content_refused, output_refused, unavailable.messagestring Required
resultobject or null Requiredimageslist of object Requiredidstring Requiredurlstring Requiredexpires_atinteger Requiredwidthinteger Required at least 1.heightinteger Required at least 1.content_typestring Required
Errors
| Status | Code | Message |
|---|---|---|
| 400 | key_in_query | A key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way. |
| 400 | invalid_request | The request could not be used. Check the field named in param and the documentation, then try again. |
| 400 | unsupported_parameter | The request has a field or value that this API does not support. Remove it or change it, then try again. |
| 400 | image_url_refused | The image address could not be used. It must be a public https address that returns a picture. |
| 400 | image_refused | The image was not accepted. Send a JPEG, PNG or WebP picture that is not too large. |
| 400 | content_refused | The request was refused by the content rules. Change the request and try again. |
| 401 | invalid_key | The key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header. |
| 401 | key_revoked | This key has been revoked. Make a new key on the Developer API page. |
| 401 | key_expired | This key has expired. Make a new key on the Developer API page. |
| 402 | over_max_credits | This request would cost more credits than max_credits allows. Raise max_credits or change the request. |
| 403 | api_disabled | The developer API is not open yet. Try again once it has been opened for your account. |
| 403 | plan_required | Your plan does not include the developer API. Move to a plan that does, then try again. |
| 403 | missing_scope | This key is not allowed to do that. Use a key that has the scope this route needs. |
| 403 | wrong_key_type | This key cannot be used here. |
| 403 | not_verified | Verify your email address before you use this feature. |
| 403 | account_on_hold | This account has a safety hold, so new requests are not accepted. Open your account page to see what to do next. |
| 403 | class_not_in_plan | Your plan does not include this kind of picture. Move to a plan that does, or choose another operation. |
| 404 | image_not_found | No available image matches that id. Check the id, or send the image itself. |
| 409 | quote_changed | The price changed while the request was being made. Send the request again. |
| 409 | idempotency_conflict | That Idempotency-Key was already used for a different request. Use a new key, or repeat the first request exactly. |
| 413 | body_too_large | The request is larger than this route accepts. Send a smaller request. |
| 429 | rate_limited | Too many requests. Wait for the time in the Retry-After header, then try again. |
| 429 | daily_line_reached | The daily limit for your plan has been reached. Try again after the time in reset_at. |
| 429 | period_pool_used | The credits for this plan period have been used. Try again after the time in reset_at. |
| 429 | class_limit_reached | The limit for this kind of picture has been reached. Try again after the time in reset_at. |
| 429 | free_budget_spent | The free allowance has been used. Try again after the time in reset_at, or move to a paid plan. |
| 429 | key_budget_reached | This key's monthly credit budget has been reached. Raise the budget or use another key, or wait for the time in reset_at. |
| 503 | operation_unavailable | This operation is not available right now. Try again later. |
| 503 | try_again | The request could not be finished this time. Wait a few seconds and try again. |
Example
curl
curl -X POST https://easyimage.ae/v1/images/outpaint \
-H "Authorization: Bearer $EASYIMAGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"image_id":"0192f3a4-7b6c-7d2e-8f10-3a4b5c6d7e8f","frame":{"left":0,"top":0,"right":2500,"bottom":0},"prompt":"More of the same beach"}'JavaScript
const response = await fetch("https://easyimage.ae/v1/images/outpaint", {
method: "POST",
body: JSON.stringify({
"image_id": "0192f3a4-7b6c-7d2e-8f10-3a4b5c6d7e8f",
"frame": {
"left": 0,
"top": 0,
"right": 2500,
"bottom": 0
},
"prompt": "More of the same beach"
}),
headers: {
Authorization: `Bearer ${process.env.EASYIMAGE_API_KEY}`,
"Content-Type": "application/json",
},
});
console.log(await response.json());POST /v1/images/eraseRemove an object from a picture
Removes the marked area and fills it to match what is around it. Mark the area with a mask specification, or with a PNG whose transparent pixels are the area to remove.
Scopes
images
Parameters
| Name | In | Required | Description |
|---|---|---|---|
Idempotency-Key | header | Optional | A value you choose for this request. Send the same value to repeat the request after a timeout: you get the same jobs back and nothing is charged twice. A repeat waits at most 5 seconds for the jobs, and not at all while 2 other repeats of your account are waiting; it then answers 202 with the jobs, so poll the job. The same value with a different request is refused. |
Prefer | header | Optional | respond-async answers at once with the job. wait=N (N from 1 to 60) waits up to that many seconds for the job to end on the routes that answer with a job. |
Request
image_idstring Optional The id of one of your library images.image_urlstring Optional A public https address that returns a JPEG, PNG or WebP picture. 1 to 2000 characters.maskobject Optional A mask as a short list of brush strokes and rectangles in ten-thousandths of the picture. White (painted) means edit.vstring Required One of: 1.opslist of one of Required
mask_png_base64string Optional A PNG with an alpha channel as base64, at most 1,048,576 bytes once decoded. Transparent pixels are edited. 1 to 1398104 characters.max_creditsinteger Optional Refuse the request, before anything starts, if it would cost more credits than this. 0 to 1000000.
Answers
200 The job ended inside the wait you asked for with Prefer: wait. The body is the finished job.
idstring Requiredobjectstring Required One of: job.operationstring Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.statusstring Required One of: queued, running, succeeded, failed, refused, canceled, expired.progressobject Required Where a job is: the step it is on and how many steps it has.stepinteger Requiredstep_totalinteger Required
created_atinteger Requiredfinished_atinteger or null Requiredcreditsinteger Requirederrorobject or null Requiredcodestring Required One of: try_again, content_refused, output_refused, unavailable.messagestring Required
resultobject or null Requiredimageslist of object Requiredidstring Requiredurlstring Requiredexpires_atinteger Requiredwidthinteger Required at least 1.heightinteger Required at least 1.content_typestring Required
202 The job was accepted and is still running. Poll it, or wait for a webhook. The Location header names the job.
idstring Requiredobjectstring Required One of: job.operationstring Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.statusstring Required One of: queued, running, succeeded, failed, refused, canceled, expired.progressobject Required Where a job is: the step it is on and how many steps it has.stepinteger Requiredstep_totalinteger Required
created_atinteger Requiredfinished_atinteger or null Requiredcreditsinteger Requirederrorobject or null Requiredcodestring Required One of: try_again, content_refused, output_refused, unavailable.messagestring Required
resultobject or null Requiredimageslist of object Requiredidstring Requiredurlstring Requiredexpires_atinteger Requiredwidthinteger Required at least 1.heightinteger Required at least 1.content_typestring Required
Errors
| Status | Code | Message |
|---|---|---|
| 400 | key_in_query | A key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way. |
| 400 | invalid_request | The request could not be used. Check the field named in param and the documentation, then try again. |
| 400 | unsupported_parameter | The request has a field or value that this API does not support. Remove it or change it, then try again. |
| 400 | mask_unreadable | The mask could not be read. Send a non-interlaced PNG with an alpha channel. |
| 400 | mask_size_mismatch | The mask must have the same proportions as the image. Resize the mask and try again. |
| 400 | mask_too_complex | The mask is too detailed to use. Send a smaller or simpler mask. |
| 400 | image_url_refused | The image address could not be used. It must be a public https address that returns a picture. |
| 400 | image_refused | The image was not accepted. Send a JPEG, PNG or WebP picture that is not too large. |
| 400 | content_refused | The request was refused by the content rules. Change the request and try again. |
| 401 | invalid_key | The key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header. |
| 401 | key_revoked | This key has been revoked. Make a new key on the Developer API page. |
| 401 | key_expired | This key has expired. Make a new key on the Developer API page. |
| 402 | over_max_credits | This request would cost more credits than max_credits allows. Raise max_credits or change the request. |
| 403 | api_disabled | The developer API is not open yet. Try again once it has been opened for your account. |
| 403 | plan_required | Your plan does not include the developer API. Move to a plan that does, then try again. |
| 403 | missing_scope | This key is not allowed to do that. Use a key that has the scope this route needs. |
| 403 | wrong_key_type | This key cannot be used here. |
| 403 | not_verified | Verify your email address before you use this feature. |
| 403 | account_on_hold | This account has a safety hold, so new requests are not accepted. Open your account page to see what to do next. |
| 403 | class_not_in_plan | Your plan does not include this kind of picture. Move to a plan that does, or choose another operation. |
| 404 | image_not_found | No available image matches that id. Check the id, or send the image itself. |
| 409 | quote_changed | The price changed while the request was being made. Send the request again. |
| 409 | idempotency_conflict | That Idempotency-Key was already used for a different request. Use a new key, or repeat the first request exactly. |
| 413 | body_too_large | The request is larger than this route accepts. Send a smaller request. |
| 429 | rate_limited | Too many requests. Wait for the time in the Retry-After header, then try again. |
| 429 | daily_line_reached | The daily limit for your plan has been reached. Try again after the time in reset_at. |
| 429 | period_pool_used | The credits for this plan period have been used. Try again after the time in reset_at. |
| 429 | class_limit_reached | The limit for this kind of picture has been reached. Try again after the time in reset_at. |
| 429 | free_budget_spent | The free allowance has been used. Try again after the time in reset_at, or move to a paid plan. |
| 429 | key_budget_reached | This key's monthly credit budget has been reached. Raise the budget or use another key, or wait for the time in reset_at. |
| 503 | operation_unavailable | This operation is not available right now. Try again later. |
| 503 | try_again | The request could not be finished this time. Wait a few seconds and try again. |
Example
curl
curl -X POST https://easyimage.ae/v1/images/erase \
-H "Authorization: Bearer $EASYIMAGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"image_id":"0192f3a4-7b6c-7d2e-8f10-3a4b5c6d7e8f","mask":{"v":1,"ops":[{"op":"rect","mode":"paint","x":4000,"y":4000,"w":2000,"h":2000}]}}'JavaScript
const response = await fetch("https://easyimage.ae/v1/images/erase", {
method: "POST",
body: JSON.stringify({
"image_id": "0192f3a4-7b6c-7d2e-8f10-3a4b5c6d7e8f",
"mask": {
"v": 1,
"ops": [
{
"op": "rect",
"mode": "paint",
"x": 4000,
"y": 4000,
"w": 2000,
"h": 2000
}
]
}
}),
headers: {
Authorization: `Bearer ${process.env.EASYIMAGE_API_KEY}`,
"Content-Type": "application/json",
},
});
console.log(await response.json());GET /v1/imagesList your library images
Your saved library images, newest first, one page at a time. Each has the id to pass as image_id to a route that takes a picture. The list holds no links: read a job for those.
Scopes
images
Parameters
| Name | In | Required | Description |
|---|---|---|---|
cursor | query | Optional | The next_cursor of the page before. Leave it out for the first page. |
limit | query | Optional | How many images, 1 to 20. Default 20. |
Request
This route takes no body.
Answers
200 One page of your images.
objectstring Required One of: list.datalist of object Requiredidstring Requiredobjectstring Required One of: image.operationstring Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.created_atinteger Requiredwidthinteger Required at least 1.heightinteger Required at least 1.
next_cursorobject Required
Errors
| Status | Code | Message |
|---|---|---|
| 400 | key_in_query | A key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way. |
| 400 | invalid_request | The request could not be used. Check the field named in param and the documentation, then try again. |
| 400 | unsupported_parameter | The request has a field or value that this API does not support. Remove it or change it, then try again. |
| 401 | invalid_key | The key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header. |
| 401 | key_revoked | This key has been revoked. Make a new key on the Developer API page. |
| 401 | key_expired | This key has expired. Make a new key on the Developer API page. |
| 403 | api_disabled | The developer API is not open yet. Try again once it has been opened for your account. |
| 403 | plan_required | Your plan does not include the developer API. Move to a plan that does, then try again. |
| 403 | missing_scope | This key is not allowed to do that. Use a key that has the scope this route needs. |
| 403 | wrong_key_type | This key cannot be used here. |
| 403 | not_verified | Verify your email address before you use this feature. |
| 403 | account_on_hold | This account has a safety hold, so new requests are not accepted. Open your account page to see what to do next. |
| 429 | rate_limited | Too many requests. Wait for the time in the Retry-After header, then try again. |
Example
curl
curl https://easyimage.ae/v1/images \
-H "Authorization: Bearer $EASYIMAGE_API_KEY"JavaScript
const response = await fetch("https://easyimage.ae/v1/images", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.EASYIMAGE_API_KEY}`,
},
});
console.log(await response.json());Jobs
Read a job, wait for it, or cancel it.
GET /v1/jobs/{id}Read a job
The state of one of your jobs. When it has succeeded, result holds the pictures with fresh signed links that stop working at expires_at.
Scopes
jobs
Parameters
| Name | In | Required | Description |
|---|---|---|---|
id | path | Required | The id from the answer that created it. |
Request
This route takes no body.
Answers
200 The job.
idstring Requiredobjectstring Required One of: job.operationstring Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.statusstring Required One of: queued, running, succeeded, failed, refused, canceled, expired.progressobject Required Where a job is: the step it is on and how many steps it has.stepinteger Requiredstep_totalinteger Required
created_atinteger Requiredfinished_atinteger or null Requiredcreditsinteger Requirederrorobject or null Requiredcodestring Required One of: try_again, content_refused, output_refused, unavailable.messagestring Required
resultobject or null Requiredimageslist of object Requiredidstring Requiredurlstring Requiredexpires_atinteger Requiredwidthinteger Required at least 1.heightinteger Required at least 1.content_typestring Required
Errors
| Status | Code | Message |
|---|---|---|
| 400 | key_in_query | A key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way. |
| 401 | invalid_key | The key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header. |
| 401 | key_revoked | This key has been revoked. Make a new key on the Developer API page. |
| 401 | key_expired | This key has expired. Make a new key on the Developer API page. |
| 403 | api_disabled | The developer API is not open yet. Try again once it has been opened for your account. |
| 403 | plan_required | Your plan does not include the developer API. Move to a plan that does, then try again. |
| 403 | missing_scope | This key is not allowed to do that. Use a key that has the scope this route needs. |
| 403 | wrong_key_type | This key cannot be used here. |
| 403 | not_verified | Verify your email address before you use this feature. |
| 403 | account_on_hold | This account has a safety hold, so new requests are not accepted. Open your account page to see what to do next. |
| 404 | not_found | Nothing was found for that id. Check the id and try again. |
| 429 | rate_limited | Too many requests. Wait for the time in the Retry-After header, then try again. |
Example
curl
curl https://easyimage.ae/v1/jobs/JOB_ID \
-H "Authorization: Bearer $EASYIMAGE_API_KEY"JavaScript
const response = await fetch("https://easyimage.ae/v1/jobs/JOB_ID", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.EASYIMAGE_API_KEY}`,
},
});
console.log(await response.json());POST /v1/jobs/{id}/cancelCancel a job
Asks a job to stop. A job that had not started ends at once and answers nothing_used. A job that is under way answers requested: it stops at its next check, so poll the job. A job a cancel already ended answers how it settled: nothing_used, refunded (the credits were handed back) or kept. A job that ended without a cancel answers already_finished.
Scopes
jobs
Parameters
| Name | In | Required | Description |
|---|---|---|---|
id | path | Required | The id from the answer that created it. |
Request
This route takes no body.
Answers
200 What canceling did.
idstring Requiredobjectstring Required One of: job.outcomestring Required One of: nothing_used, refunded, kept, requested, already_finished.
Errors
| Status | Code | Message |
|---|---|---|
| 400 | key_in_query | A key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way. |
| 401 | invalid_key | The key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header. |
| 401 | key_revoked | This key has been revoked. Make a new key on the Developer API page. |
| 401 | key_expired | This key has expired. Make a new key on the Developer API page. |
| 403 | api_disabled | The developer API is not open yet. Try again once it has been opened for your account. |
| 403 | plan_required | Your plan does not include the developer API. Move to a plan that does, then try again. |
| 403 | missing_scope | This key is not allowed to do that. Use a key that has the scope this route needs. |
| 403 | wrong_key_type | This key cannot be used here. |
| 403 | not_verified | Verify your email address before you use this feature. |
| 403 | account_on_hold | This account has a safety hold, so new requests are not accepted. Open your account page to see what to do next. |
| 404 | not_found | Nothing was found for that id. Check the id and try again. |
| 429 | rate_limited | Too many requests. Wait for the time in the Retry-After header, then try again. |
Example
curl
curl -X POST https://easyimage.ae/v1/jobs/JOB_ID/cancel \
-H "Authorization: Bearer $EASYIMAGE_API_KEY"JavaScript
const response = await fetch("https://easyimage.ae/v1/jobs/JOB_ID/cancel", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.EASYIMAGE_API_KEY}`,
},
});
console.log(await response.json());Batches
Run one tool over several of your library images.
POST /v1/batchesRun one tool over several images
Starts one job for each of your library images, all or nothing: if the whole batch does not fit your limits, none of it starts. Pictures from addresses or uploads are not accepted here.
Scopes
images
Parameters
| Name | In | Required | Description |
|---|---|---|---|
Idempotency-Key | header | Optional | A value you choose for this request. Send the same value to repeat the request after a timeout: you get the same jobs back and nothing is charged twice. A repeat waits at most 5 seconds for the jobs, and not at all while 2 other repeats of your account are waiting; it then answers 202 with the jobs, so poll the job. The same value with a different request is refused. |
Request
toolstring Required One of: remove_background, resize, convert.image_idslist of string Required Between 1 and the batch limit of your plan.settingsone of Optional The settings of the chosen tool: none for remove_background, a mode and output for resize, an output for convert.one of 1object Optionalone of 2one of Optionalone of 1object Optionalmodestring Required One of: long_edge.edgeinteger Required 16 to 16000.neverEnlargeboolean Optionaloutputobject Optionalformatstring Required One of: keep, png, jpg, webp.fillstring Optionalqualityinteger Optional 1 to 100.
one of 2object Optionalmodestring Required One of: fit.widthinteger Required 1 to 16000.heightinteger Required 1 to 16000.neverEnlargeboolean Optionaloutputobject Optionalformatstring Required One of: keep, png, jpg, webp.fillstring Optionalqualityinteger Optional 1 to 100.
one of 3object Optionalmodestring Required One of: percent.percentinteger Required 1 to 800.neverEnlargeboolean Optionaloutputobject Optionalformatstring Required One of: keep, png, jpg, webp.fillstring Optionalqualityinteger Optional 1 to 100.
one of 3object Optionaloutputobject Requiredformatstring Required One of: png, jpg, webp.fillstring Optionalqualityinteger Optional 1 to 100.
max_creditsinteger Optional Refuse the request, before anything starts, if it would cost more credits than this. 0 to 1000000.
Answers
202 The batch started. Poll it to see each file.
idstring Requiredobjectstring Required One of: batch.toolstring Required One of: remove_background, resize, convert.created_atinteger Requiredstoppedboolean Requiredendedboolean Requiredcountsobject Required How many files of a batch are in each state.waitinginteger Requiredworkinginteger Requireddoneinteger Requiredskippedinteger Requiredrefusedinteger Requiredfailedinteger Requiredstoppedinteger Required
itemslist of object Requiredpositioninteger Requiredstatestring Required One of: waiting, working, done, skipped, refused, failed, stopped.reasonstring Optional One of: not_found, archived, credentials_restricted, too_large, nothing_to_do, duplicate, upload_refused, try_again, unavailable, no_subject, already_transparent, not_allowed, removed.stepinteger Optionalstep_totalinteger Optionalsource_idstring Optionalresult_idstring Optional
Errors
| Status | Code | Message |
|---|---|---|
| 400 | key_in_query | A key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way. |
| 400 | invalid_request | The request could not be used. Check the field named in param and the documentation, then try again. |
| 400 | unsupported_parameter | The request has a field or value that this API does not support. Remove it or change it, then try again. |
| 400 | content_refused | The request was refused by the content rules. Change the request and try again. |
| 401 | invalid_key | The key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header. |
| 401 | key_revoked | This key has been revoked. Make a new key on the Developer API page. |
| 401 | key_expired | This key has expired. Make a new key on the Developer API page. |
| 402 | over_max_credits | This request would cost more credits than max_credits allows. Raise max_credits or change the request. |
| 403 | api_disabled | The developer API is not open yet. Try again once it has been opened for your account. |
| 403 | plan_required | Your plan does not include the developer API. Move to a plan that does, then try again. |
| 403 | missing_scope | This key is not allowed to do that. Use a key that has the scope this route needs. |
| 403 | wrong_key_type | This key cannot be used here. |
| 403 | not_verified | Verify your email address before you use this feature. |
| 403 | account_on_hold | This account has a safety hold, so new requests are not accepted. Open your account page to see what to do next. |
| 403 | class_not_in_plan | Your plan does not include this kind of picture. Move to a plan that does, or choose another operation. |
| 404 | image_not_found | No available image matches that id. Check the id, or send the image itself. |
| 409 | quote_changed | The price changed while the request was being made. Send the request again. |
| 409 | idempotency_conflict | That Idempotency-Key was already used for a different request. Use a new key, or repeat the first request exactly. |
| 413 | body_too_large | The request is larger than this route accepts. Send a smaller request. |
| 429 | rate_limited | Too many requests. Wait for the time in the Retry-After header, then try again. |
| 429 | daily_line_reached | The daily limit for your plan has been reached. Try again after the time in reset_at. |
| 429 | period_pool_used | The credits for this plan period have been used. Try again after the time in reset_at. |
| 429 | class_limit_reached | The limit for this kind of picture has been reached. Try again after the time in reset_at. |
| 429 | free_budget_spent | The free allowance has been used. Try again after the time in reset_at, or move to a paid plan. |
| 429 | key_budget_reached | This key's monthly credit budget has been reached. Raise the budget or use another key, or wait for the time in reset_at. |
| 503 | operation_unavailable | This operation is not available right now. Try again later. |
| 503 | try_again | The request could not be finished this time. Wait a few seconds and try again. |
Example
curl
curl -X POST https://easyimage.ae/v1/batches \
-H "Authorization: Bearer $EASYIMAGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"tool":"remove_background","image_ids":["0192f3a4-7b6c-7d2e-8f10-3a4b5c6d7e8f","0192f3a4-7b6c-7d2e-8f10-3a4b5c6d7e90"]}'JavaScript
const response = await fetch("https://easyimage.ae/v1/batches", {
method: "POST",
body: JSON.stringify({
"tool": "remove_background",
"image_ids": [
"0192f3a4-7b6c-7d2e-8f10-3a4b5c6d7e8f",
"0192f3a4-7b6c-7d2e-8f10-3a4b5c6d7e90"
]
}),
headers: {
Authorization: `Bearer ${process.env.EASYIMAGE_API_KEY}`,
"Content-Type": "application/json",
},
});
console.log(await response.json());GET /v1/batches/{id}Read a batch
The state of every file of one of your batches, with the counts.
Scopes
jobs
Parameters
| Name | In | Required | Description |
|---|---|---|---|
id | path | Required | The id from the answer that created it. |
Request
This route takes no body.
Answers
200 The batch.
idstring Requiredobjectstring Required One of: batch.toolstring Required One of: remove_background, resize, convert.created_atinteger Requiredstoppedboolean Requiredendedboolean Requiredcountsobject Required How many files of a batch are in each state.waitinginteger Requiredworkinginteger Requireddoneinteger Requiredskippedinteger Requiredrefusedinteger Requiredfailedinteger Requiredstoppedinteger Required
itemslist of object Requiredpositioninteger Requiredstatestring Required One of: waiting, working, done, skipped, refused, failed, stopped.reasonstring Optional One of: not_found, archived, credentials_restricted, too_large, nothing_to_do, duplicate, upload_refused, try_again, unavailable, no_subject, already_transparent, not_allowed, removed.stepinteger Optionalstep_totalinteger Optionalsource_idstring Optionalresult_idstring Optional
Errors
| Status | Code | Message |
|---|---|---|
| 400 | key_in_query | A key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way. |
| 401 | invalid_key | The key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header. |
| 401 | key_revoked | This key has been revoked. Make a new key on the Developer API page. |
| 401 | key_expired | This key has expired. Make a new key on the Developer API page. |
| 403 | api_disabled | The developer API is not open yet. Try again once it has been opened for your account. |
| 403 | plan_required | Your plan does not include the developer API. Move to a plan that does, then try again. |
| 403 | missing_scope | This key is not allowed to do that. Use a key that has the scope this route needs. |
| 403 | wrong_key_type | This key cannot be used here. |
| 403 | not_verified | Verify your email address before you use this feature. |
| 403 | account_on_hold | This account has a safety hold, so new requests are not accepted. Open your account page to see what to do next. |
| 404 | not_found | Nothing was found for that id. Check the id and try again. |
| 429 | rate_limited | Too many requests. Wait for the time in the Retry-After header, then try again. |
Example
curl
curl https://easyimage.ae/v1/batches/BATCH_ID \
-H "Authorization: Bearer $EASYIMAGE_API_KEY"JavaScript
const response = await fetch("https://easyimage.ae/v1/batches/BATCH_ID", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.EASYIMAGE_API_KEY}`,
},
});
console.log(await response.json());POST /v1/batches/{id}/cancelStop the rest of a batch
Stops every file that has not finished. Files that already finished stay as they are.
Scopes
jobs
Parameters
| Name | In | Required | Description |
|---|---|---|---|
id | path | Required | The id from the answer that created it. |
Request
This route takes no body.
Answers
200 What stopping did.
idstring Requiredobjectstring Required One of: batch.stopped_nowinteger Requiredstoppinginteger Requiredfinishedinteger Requiredalready_stoppedboolean Required
Errors
| Status | Code | Message |
|---|---|---|
| 400 | key_in_query | A key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way. |
| 401 | invalid_key | The key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header. |
| 401 | key_revoked | This key has been revoked. Make a new key on the Developer API page. |
| 401 | key_expired | This key has expired. Make a new key on the Developer API page. |
| 403 | api_disabled | The developer API is not open yet. Try again once it has been opened for your account. |
| 403 | plan_required | Your plan does not include the developer API. Move to a plan that does, then try again. |
| 403 | missing_scope | This key is not allowed to do that. Use a key that has the scope this route needs. |
| 403 | wrong_key_type | This key cannot be used here. |
| 403 | not_verified | Verify your email address before you use this feature. |
| 403 | account_on_hold | This account has a safety hold, so new requests are not accepted. Open your account page to see what to do next. |
| 404 | not_found | Nothing was found for that id. Check the id and try again. |
| 429 | rate_limited | Too many requests. Wait for the time in the Retry-After header, then try again. |
Example
curl
curl -X POST https://easyimage.ae/v1/batches/BATCH_ID/cancel \
-H "Authorization: Bearer $EASYIMAGE_API_KEY"JavaScript
const response = await fetch("https://easyimage.ae/v1/batches/BATCH_ID/cancel", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.EASYIMAGE_API_KEY}`,
},
});
console.log(await response.json());Usage
The same numbers as the usage page in the studio.
GET /v1/usageRead your usage
What the account has used today and in its plan period, what is left and when it starts again. These are the same numbers as the usage page in the studio.
Scopes
usage
Parameters
No parameters.
Request
This route takes no body.
Answers
200 The usage.
sourcestring Required One of: free, subscription, pass.dayobject or null Requiredkindstring Required One of: day, month, pass.usedinteger Requiredlimitinteger Requiredleftinteger Requiredresets_atinteger or null Requiredends_insteadboolean Requiredstatestring Required One of: normal, slowed, used_up.
periodobject or null Requiredkindstring Required One of: day, month, pass.usedinteger Requiredlimitinteger Requiredleftinteger Requiredresets_atinteger or null Requiredends_insteadboolean Requiredstatestring Required One of: normal, slowed, used_up.
toolslist of object Requiredcost_classstring Required One of: standard_generation, premium_generation, edit_inpaint, upscale, background_removal.day_usedinteger Requiredday_limitinteger or null Requiredperiod_usedinteger Requiredperiod_limitinteger or null Requiredused_upboolean Required
slowed_bystring or null Requiredfree_budget_spentboolean Requiredslow_ruleobject Requiredday_percentobject Requiredperiod_percentobject Required
Errors
| Status | Code | Message |
|---|---|---|
| 400 | key_in_query | A key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way. |
| 401 | invalid_key | The key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header. |
| 401 | key_revoked | This key has been revoked. Make a new key on the Developer API page. |
| 401 | key_expired | This key has expired. Make a new key on the Developer API page. |
| 403 | api_disabled | The developer API is not open yet. Try again once it has been opened for your account. |
| 403 | plan_required | Your plan does not include the developer API. Move to a plan that does, then try again. |
| 403 | missing_scope | This key is not allowed to do that. Use a key that has the scope this route needs. |
| 403 | wrong_key_type | This key cannot be used here. |
| 403 | not_verified | Verify your email address before you use this feature. |
| 403 | account_on_hold | This account has a safety hold, so new requests are not accepted. Open your account page to see what to do next. |
| 429 | rate_limited | Too many requests. Wait for the time in the Retry-After header, then try again. |
Example
curl
curl https://easyimage.ae/v1/usage \
-H "Authorization: Bearer $EASYIMAGE_API_KEY"JavaScript
const response = await fetch("https://easyimage.ae/v1/usage", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.EASYIMAGE_API_KEY}`,
},
});
console.log(await response.json());Document
This API described as an OpenAPI 3.1 document.
GET /v1/openapi.jsonRead this API as an OpenAPI document
The OpenAPI 3.1 document of this API. It is public: no key is needed.
Scopes
No key needed.
Parameters
No parameters.
Request
This route takes no body.
Answers
200 The OpenAPI 3.1 document, as JSON.
Errors
This route answers with no errors.
Example
curl
curl https://easyimage.ae/v1/openapi.jsonJavaScript
const response = await fetch("https://easyimage.ae/v1/openapi.json", {
method: "GET",
});
console.log(await response.json());