Skip to main content

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.

OpenAPI document (JSON)

Base address

Base address

https://easyimage.ae/v1

Authentication

Send your key as Authorization: Bearer followed by the key. Never put it in an address.

Authentication

Authorization: Bearer $EASYIMAGE_API_KEY

Asynchronous 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

  • id string Required The id of this event. The same event is always sent with the same id, so use it to ignore repeats.

  • type string Required One of: job.succeeded.

  • created_at integer Required

  • data object Required

    • job object Required The job object as a webhook carries it: the same fields, without links.

      • id string Required

      • object string Required One of: job.

      • operation string Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.

      • status string Required One of: queued, running, succeeded, failed, refused, canceled, expired.

      • progress object Required Where a job is: the step it is on and how many steps it has.

        • step integer Required

        • step_total integer Required

      • created_at integer Required

      • finished_at integer or null Required

      • credits integer Required

      • error object or null Required

        • code string Required One of: try_again, content_refused, output_refused, unavailable.

        • message string Required

      • result object or null Required

        • images list of object Required

          • id string Required

          • width integer Required at least 1.

          • height integer Required at least 1.

          • content_type string Required

job.failed

A job failed or was refused

Payload

  • id string Required The id of this event. The same event is always sent with the same id, so use it to ignore repeats.

  • type string Required One of: job.failed.

  • created_at integer Required

  • data object Required

    • job object Required The job object as a webhook carries it: the same fields, without links.

      • id string Required

      • object string Required One of: job.

      • operation string Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.

      • status string Required One of: queued, running, succeeded, failed, refused, canceled, expired.

      • progress object Required Where a job is: the step it is on and how many steps it has.

        • step integer Required

        • step_total integer Required

      • created_at integer Required

      • finished_at integer or null Required

      • credits integer Required

      • error object or null Required

        • code string Required One of: try_again, content_refused, output_refused, unavailable.

        • message string Required

      • result object or null Required

        • images list of object Required

          • id string Required

          • width integer Required at least 1.

          • height integer Required at least 1.

          • content_type string Required

job.canceled

A job was canceled

Payload

  • id string Required The id of this event. The same event is always sent with the same id, so use it to ignore repeats.

  • type string Required One of: job.canceled.

  • created_at integer Required

  • data object Required

    • job object Required The job object as a webhook carries it: the same fields, without links.

      • id string Required

      • object string Required One of: job.

      • operation string Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.

      • status string Required One of: queued, running, succeeded, failed, refused, canceled, expired.

      • progress object Required Where a job is: the step it is on and how many steps it has.

        • step integer Required

        • step_total integer Required

      • created_at integer Required

      • finished_at integer or null Required

      • credits integer Required

      • error object or null Required

        • code string Required One of: try_again, content_refused, output_refused, unavailable.

        • message string Required

      • result object or null Required

        • images list of object Required

          • id string Required

          • width integer Required at least 1.

          • height integer Required at least 1.

          • content_type string Required

webhook.test

A test event

Payload

  • id string Required The id of this event. The same event is always sent with the same id, so use it to ignore repeats.

  • type string Required One of: webhook.test.

  • created_at integer Required

  • data object Required

Errors

Every error has the same shape. The code says what to do next.

CodeStatusTypeMessage
api_disabled403permission_errorThe developer API is not open yet. Try again once it has been opened for your account.
key_in_query400invalid_request_errorA 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_key401authentication_errorThe key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header.
key_revoked401authentication_errorThis key has been revoked. Make a new key on the Developer API page.
key_expired401authentication_errorThis key has expired. Make a new key on the Developer API page.
plan_required403permission_errorYour plan does not include the developer API. Move to a plan that does, then try again.
missing_scope403permission_errorThis key is not allowed to do that. Use a key that has the scope this route needs.
wrong_key_type403permission_errorThis key cannot be used here.
foreign_origin403permission_errorRequests from other websites are not accepted.
not_verified403permission_errorVerify your email address before you use this feature.
account_on_hold403permission_errorThis account has a safety hold, so new requests are not accepted. Open your account page to see what to do next.
invalid_request400invalid_request_errorThe request could not be used. Check the field named in param and the documentation, then try again.
unsupported_parameter400invalid_request_errorThe request has a field or value that this API does not support. Remove it or change it, then try again.
unknown_model400invalid_request_errorThat model name is not known. Use a name from the list in the documentation.
too_many_images400invalid_request_errorThe request has more images than this route accepts. Send one image.
mask_unreadable400invalid_request_errorThe mask could not be read. Send a non-interlaced PNG with an alpha channel.
mask_size_mismatch400invalid_request_errorThe mask must have the same proportions as the image. Resize the mask and try again.
mask_too_complex400invalid_request_errorThe mask is too detailed to use. Send a smaller or simpler mask.
image_not_found404not_found_errorNo available image matches that id. Check the id, or send the image itself.
image_url_refused400invalid_request_errorThe image address could not be used. It must be a public https address that returns a picture.
image_refused400invalid_request_errorThe image was not accepted. Send a JPEG, PNG or WebP picture that is not too large.
body_too_large413invalid_request_errorThe request is larger than this route accepts. Send a smaller request.
not_found404not_found_errorNothing was found for that id. Check the id and try again.
rate_limited429rate_limit_errorToo many requests. Wait for the time in the Retry-After header, then try again.
daily_line_reached429quota_errorThe daily limit for your plan has been reached. Try again after the time in reset_at.
period_pool_used429quota_errorThe credits for this plan period have been used. Try again after the time in reset_at.
class_limit_reached429quota_errorThe limit for this kind of picture has been reached. Try again after the time in reset_at.
free_budget_spent429quota_errorThe free allowance has been used. Try again after the time in reset_at, or move to a paid plan.
key_budget_reached429quota_errorThis 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_credits402quota_errorThis request would cost more credits than max_credits allows. Raise max_credits or change the request.
quote_changed409conflict_errorThe price changed while the request was being made. Send the request again.
idempotency_conflict409conflict_errorThat Idempotency-Key was already used for a different request. Use a new key, or repeat the first request exactly.
content_refused400content_policy_errorThe request was refused by the content rules. Change the request and try again.
class_not_in_plan403permission_errorYour plan does not include this kind of picture. Move to a plan that does, or choose another operation.
operation_unavailable503api_errorThis operation is not available right now. Try again later.
try_again503api_errorThe 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

NameInRequiredDescription
Idempotency-KeyheaderOptionalA 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.
PreferheaderOptionalrespond-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

  • prompt string Required What the picture should show. Plain text, no control characters. 1 to 16000 characters.

  • model string Optional A model name from the list in the documentation. Leave it out for the default. 1 to 64 characters.

  • n integer Optional How many pictures, 1 to 4 and at most your plan's batch size. Default 1. 1 to 4.

  • size string Optional The size as WIDTHxHEIGHT, or auto. Only the sizes the chosen model offers are accepted.

  • quality string Optional The quality step. Refused when the chosen model has no such step. One of: auto, standard, hd, low, medium, high.

  • response_format string Optional Only url is supported. Pictures come as signed links. One of: url.

  • output_format string Optional Only png is supported. The result is a png file. One of: png.

  • user string Optional Accepted so existing clients work. It is ignored and never stored. at most 256 characters.

  • max_credits integer 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.

  • created integer Required

  • data list of object Required

    • url string Required

  • easyimage object Required

    • job_ids list of string Required

    • credits integer Required

    • expires_at integer Required When the links in data stop working.

    • failed list 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.

  • object string Required One of: list.

  • data list of object Required

    • id string Required

    • object string Required One of: job.

    • operation string Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.

    • status string Required One of: queued, running, succeeded, failed, refused, canceled, expired.

    • progress object Required Where a job is: the step it is on and how many steps it has.

      • step integer Required

      • step_total integer Required

    • created_at integer Required

    • finished_at integer or null Required

    • credits integer Required

    • error object or null Required

      • code string Required One of: try_again, content_refused, output_refused, unavailable.

      • message string Required

    • result object or null Required

      • images list of object Required

        • id string Required

        • url string Required

        • expires_at integer Required

        • width integer Required at least 1.

        • height integer Required at least 1.

        • content_type string Required

Errors

StatusCodeMessage
400key_in_queryA key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way.
400invalid_requestThe request could not be used. Check the field named in param and the documentation, then try again.
400unsupported_parameterThe request has a field or value that this API does not support. Remove it or change it, then try again.
400unknown_modelThat model name is not known. Use a name from the list in the documentation.
400content_refusedThe request was refused by the content rules. Change the request and try again.
401invalid_keyThe key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header.
401key_revokedThis key has been revoked. Make a new key on the Developer API page.
401key_expiredThis key has expired. Make a new key on the Developer API page.
402over_max_creditsThis request would cost more credits than max_credits allows. Raise max_credits or change the request.
403api_disabledThe developer API is not open yet. Try again once it has been opened for your account.
403plan_requiredYour plan does not include the developer API. Move to a plan that does, then try again.
403missing_scopeThis key is not allowed to do that. Use a key that has the scope this route needs.
403wrong_key_typeThis key cannot be used here.
403not_verifiedVerify your email address before you use this feature.
403account_on_holdThis account has a safety hold, so new requests are not accepted. Open your account page to see what to do next.
403class_not_in_planYour plan does not include this kind of picture. Move to a plan that does, or choose another operation.
409quote_changedThe price changed while the request was being made. Send the request again.
409idempotency_conflictThat Idempotency-Key was already used for a different request. Use a new key, or repeat the first request exactly.
413body_too_largeThe request is larger than this route accepts. Send a smaller request.
429rate_limitedToo many requests. Wait for the time in the Retry-After header, then try again.
429daily_line_reachedThe daily limit for your plan has been reached. Try again after the time in reset_at.
429period_pool_usedThe credits for this plan period have been used. Try again after the time in reset_at.
429class_limit_reachedThe limit for this kind of picture has been reached. Try again after the time in reset_at.
429free_budget_spentThe free allowance has been used. Try again after the time in reset_at, or move to a paid plan.
429key_budget_reachedThis key's monthly credit budget has been reached. Raise the budget or use another key, or wait for the time in reset_at.
503operation_unavailableThis operation is not available right now. Try again later.
503try_againThe 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

NameInRequiredDescription
Idempotency-KeyheaderOptionalA 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.
PreferheaderOptionalrespond-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 file Required The picture to change: one JPEG, PNG or WebP file. image[] with exactly one file is accepted too.

  • prompt string Required What to change or show, as plain text.

  • mask file Optional A PNG with an alpha channel. Transparent pixels are edited. Without a mask the whole picture is edited.

  • n string Optional How many results. Only 1 is supported.

  • size string Optional auto, or the size of the source picture as WIDTHxHEIGHT.

  • response_format string Optional Only url is supported.

  • model string Optional A model name from the list in the documentation. Leave it out for the default.

  • max_credits string 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.

  • created integer Required

  • data list of object Required

    • url string Required

  • easyimage object Required

    • job_ids list of string Required

    • credits integer Required

    • expires_at integer Required When the links in data stop working.

    • failed list 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.

  • object string Required One of: list.

  • data list of object Required

    • id string Required

    • object string Required One of: job.

    • operation string Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.

    • status string Required One of: queued, running, succeeded, failed, refused, canceled, expired.

    • progress object Required Where a job is: the step it is on and how many steps it has.

      • step integer Required

      • step_total integer Required

    • created_at integer Required

    • finished_at integer or null Required

    • credits integer Required

    • error object or null Required

      • code string Required One of: try_again, content_refused, output_refused, unavailable.

      • message string Required

    • result object or null Required

      • images list of object Required

        • id string Required

        • url string Required

        • expires_at integer Required

        • width integer Required at least 1.

        • height integer Required at least 1.

        • content_type string Required

Errors

StatusCodeMessage
400key_in_queryA key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way.
400invalid_requestThe request could not be used. Check the field named in param and the documentation, then try again.
400unsupported_parameterThe request has a field or value that this API does not support. Remove it or change it, then try again.
400unknown_modelThat model name is not known. Use a name from the list in the documentation.
400too_many_imagesThe request has more images than this route accepts. Send one image.
400mask_unreadableThe mask could not be read. Send a non-interlaced PNG with an alpha channel.
400mask_size_mismatchThe mask must have the same proportions as the image. Resize the mask and try again.
400mask_too_complexThe mask is too detailed to use. Send a smaller or simpler mask.
400image_refusedThe image was not accepted. Send a JPEG, PNG or WebP picture that is not too large.
400content_refusedThe request was refused by the content rules. Change the request and try again.
401invalid_keyThe key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header.
401key_revokedThis key has been revoked. Make a new key on the Developer API page.
401key_expiredThis key has expired. Make a new key on the Developer API page.
402over_max_creditsThis request would cost more credits than max_credits allows. Raise max_credits or change the request.
403api_disabledThe developer API is not open yet. Try again once it has been opened for your account.
403plan_requiredYour plan does not include the developer API. Move to a plan that does, then try again.
403missing_scopeThis key is not allowed to do that. Use a key that has the scope this route needs.
403wrong_key_typeThis key cannot be used here.
403not_verifiedVerify your email address before you use this feature.
403account_on_holdThis account has a safety hold, so new requests are not accepted. Open your account page to see what to do next.
403class_not_in_planYour plan does not include this kind of picture. Move to a plan that does, or choose another operation.
409quote_changedThe price changed while the request was being made. Send the request again.
409idempotency_conflictThat Idempotency-Key was already used for a different request. Use a new key, or repeat the first request exactly.
413body_too_largeThe request is larger than this route accepts. Send a smaller request.
429rate_limitedToo many requests. Wait for the time in the Retry-After header, then try again.
429daily_line_reachedThe daily limit for your plan has been reached. Try again after the time in reset_at.
429period_pool_usedThe credits for this plan period have been used. Try again after the time in reset_at.
429class_limit_reachedThe limit for this kind of picture has been reached. Try again after the time in reset_at.
429free_budget_spentThe free allowance has been used. Try again after the time in reset_at, or move to a paid plan.
429key_budget_reachedThis key's monthly credit budget has been reached. Raise the budget or use another key, or wait for the time in reset_at.
503operation_unavailableThis operation is not available right now. Try again later.
503try_againThe 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

NameInRequiredDescription
Idempotency-KeyheaderOptionalA 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.
PreferheaderOptionalrespond-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_id string Optional The id of one of your library images.

  • image_url string Optional A public https address that returns a JPEG, PNG or WebP picture. 1 to 2000 characters.

  • max_credits integer 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.

  • id string Required

  • object string Required One of: job.

  • operation string Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.

  • status string Required One of: queued, running, succeeded, failed, refused, canceled, expired.

  • progress object Required Where a job is: the step it is on and how many steps it has.

    • step integer Required

    • step_total integer Required

  • created_at integer Required

  • finished_at integer or null Required

  • credits integer Required

  • error object or null Required

    • code string Required One of: try_again, content_refused, output_refused, unavailable.

    • message string Required

  • result object or null Required

    • images list of object Required

      • id string Required

      • url string Required

      • expires_at integer Required

      • width integer Required at least 1.

      • height integer Required at least 1.

      • content_type string Required

202 The job was accepted and is still running. Poll it, or wait for a webhook. The Location header names the job.

  • id string Required

  • object string Required One of: job.

  • operation string Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.

  • status string Required One of: queued, running, succeeded, failed, refused, canceled, expired.

  • progress object Required Where a job is: the step it is on and how many steps it has.

    • step integer Required

    • step_total integer Required

  • created_at integer Required

  • finished_at integer or null Required

  • credits integer Required

  • error object or null Required

    • code string Required One of: try_again, content_refused, output_refused, unavailable.

    • message string Required

  • result object or null Required

    • images list of object Required

      • id string Required

      • url string Required

      • expires_at integer Required

      • width integer Required at least 1.

      • height integer Required at least 1.

      • content_type string Required

Errors

StatusCodeMessage
400key_in_queryA key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way.
400invalid_requestThe request could not be used. Check the field named in param and the documentation, then try again.
400unsupported_parameterThe request has a field or value that this API does not support. Remove it or change it, then try again.
400image_url_refusedThe image address could not be used. It must be a public https address that returns a picture.
400image_refusedThe image was not accepted. Send a JPEG, PNG or WebP picture that is not too large.
400content_refusedThe request was refused by the content rules. Change the request and try again.
401invalid_keyThe key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header.
401key_revokedThis key has been revoked. Make a new key on the Developer API page.
401key_expiredThis key has expired. Make a new key on the Developer API page.
402over_max_creditsThis request would cost more credits than max_credits allows. Raise max_credits or change the request.
403api_disabledThe developer API is not open yet. Try again once it has been opened for your account.
403plan_requiredYour plan does not include the developer API. Move to a plan that does, then try again.
403missing_scopeThis key is not allowed to do that. Use a key that has the scope this route needs.
403wrong_key_typeThis key cannot be used here.
403not_verifiedVerify your email address before you use this feature.
403account_on_holdThis account has a safety hold, so new requests are not accepted. Open your account page to see what to do next.
403class_not_in_planYour plan does not include this kind of picture. Move to a plan that does, or choose another operation.
404image_not_foundNo available image matches that id. Check the id, or send the image itself.
409quote_changedThe price changed while the request was being made. Send the request again.
409idempotency_conflictThat Idempotency-Key was already used for a different request. Use a new key, or repeat the first request exactly.
413body_too_largeThe request is larger than this route accepts. Send a smaller request.
429rate_limitedToo many requests. Wait for the time in the Retry-After header, then try again.
429daily_line_reachedThe daily limit for your plan has been reached. Try again after the time in reset_at.
429period_pool_usedThe credits for this plan period have been used. Try again after the time in reset_at.
429class_limit_reachedThe limit for this kind of picture has been reached. Try again after the time in reset_at.
429free_budget_spentThe free allowance has been used. Try again after the time in reset_at, or move to a paid plan.
429key_budget_reachedThis key's monthly credit budget has been reached. Raise the budget or use another key, or wait for the time in reset_at.
503operation_unavailableThis operation is not available right now. Try again later.
503try_againThe 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

NameInRequiredDescription
Idempotency-KeyheaderOptionalA 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.
PreferheaderOptionalrespond-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_id string Optional The id of one of your library images.

  • image_url string Optional A public https address that returns a JPEG, PNG or WebP picture. 1 to 2000 characters.

  • mode string Required How much larger. One of: 2x, 4x.

  • max_credits integer 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.

  • id string Required

  • object string Required One of: job.

  • operation string Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.

  • status string Required One of: queued, running, succeeded, failed, refused, canceled, expired.

  • progress object Required Where a job is: the step it is on and how many steps it has.

    • step integer Required

    • step_total integer Required

  • created_at integer Required

  • finished_at integer or null Required

  • credits integer Required

  • error object or null Required

    • code string Required One of: try_again, content_refused, output_refused, unavailable.

    • message string Required

  • result object or null Required

    • images list of object Required

      • id string Required

      • url string Required

      • expires_at integer Required

      • width integer Required at least 1.

      • height integer Required at least 1.

      • content_type string Required

202 The job was accepted and is still running. Poll it, or wait for a webhook. The Location header names the job.

  • id string Required

  • object string Required One of: job.

  • operation string Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.

  • status string Required One of: queued, running, succeeded, failed, refused, canceled, expired.

  • progress object Required Where a job is: the step it is on and how many steps it has.

    • step integer Required

    • step_total integer Required

  • created_at integer Required

  • finished_at integer or null Required

  • credits integer Required

  • error object or null Required

    • code string Required One of: try_again, content_refused, output_refused, unavailable.

    • message string Required

  • result object or null Required

    • images list of object Required

      • id string Required

      • url string Required

      • expires_at integer Required

      • width integer Required at least 1.

      • height integer Required at least 1.

      • content_type string Required

Errors

StatusCodeMessage
400key_in_queryA key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way.
400invalid_requestThe request could not be used. Check the field named in param and the documentation, then try again.
400unsupported_parameterThe request has a field or value that this API does not support. Remove it or change it, then try again.
400image_url_refusedThe image address could not be used. It must be a public https address that returns a picture.
400image_refusedThe image was not accepted. Send a JPEG, PNG or WebP picture that is not too large.
400content_refusedThe request was refused by the content rules. Change the request and try again.
401invalid_keyThe key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header.
401key_revokedThis key has been revoked. Make a new key on the Developer API page.
401key_expiredThis key has expired. Make a new key on the Developer API page.
402over_max_creditsThis request would cost more credits than max_credits allows. Raise max_credits or change the request.
403api_disabledThe developer API is not open yet. Try again once it has been opened for your account.
403plan_requiredYour plan does not include the developer API. Move to a plan that does, then try again.
403missing_scopeThis key is not allowed to do that. Use a key that has the scope this route needs.
403wrong_key_typeThis key cannot be used here.
403not_verifiedVerify your email address before you use this feature.
403account_on_holdThis account has a safety hold, so new requests are not accepted. Open your account page to see what to do next.
403class_not_in_planYour plan does not include this kind of picture. Move to a plan that does, or choose another operation.
404image_not_foundNo available image matches that id. Check the id, or send the image itself.
409quote_changedThe price changed while the request was being made. Send the request again.
409idempotency_conflictThat Idempotency-Key was already used for a different request. Use a new key, or repeat the first request exactly.
413body_too_largeThe request is larger than this route accepts. Send a smaller request.
429rate_limitedToo many requests. Wait for the time in the Retry-After header, then try again.
429daily_line_reachedThe daily limit for your plan has been reached. Try again after the time in reset_at.
429period_pool_usedThe credits for this plan period have been used. Try again after the time in reset_at.
429class_limit_reachedThe limit for this kind of picture has been reached. Try again after the time in reset_at.
429free_budget_spentThe free allowance has been used. Try again after the time in reset_at, or move to a paid plan.
429key_budget_reachedThis key's monthly credit budget has been reached. Raise the budget or use another key, or wait for the time in reset_at.
503operation_unavailableThis operation is not available right now. Try again later.
503try_againThe 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

NameInRequiredDescription
Idempotency-KeyheaderOptionalA 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.
PreferheaderOptionalrespond-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_id string Optional The id of one of your library images.

  • image_url string Optional A public https address that returns a JPEG, PNG or WebP picture. 1 to 2000 characters.

  • frame object Required How far each edge grows, in ten-thousandths of the picture: left and right of its width, top and bottom of its height.

    • left integer Required 0 to 10000.

    • top integer Required 0 to 10000.

    • right integer Required 0 to 10000.

    • bottom integer Required 0 to 10000.

  • prompt string Optional What the new area should show. Leave it out to continue the picture. 1 to 1000 characters.

  • max_credits integer 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.

  • id string Required

  • object string Required One of: job.

  • operation string Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.

  • status string Required One of: queued, running, succeeded, failed, refused, canceled, expired.

  • progress object Required Where a job is: the step it is on and how many steps it has.

    • step integer Required

    • step_total integer Required

  • created_at integer Required

  • finished_at integer or null Required

  • credits integer Required

  • error object or null Required

    • code string Required One of: try_again, content_refused, output_refused, unavailable.

    • message string Required

  • result object or null Required

    • images list of object Required

      • id string Required

      • url string Required

      • expires_at integer Required

      • width integer Required at least 1.

      • height integer Required at least 1.

      • content_type string Required

202 The job was accepted and is still running. Poll it, or wait for a webhook. The Location header names the job.

  • id string Required

  • object string Required One of: job.

  • operation string Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.

  • status string Required One of: queued, running, succeeded, failed, refused, canceled, expired.

  • progress object Required Where a job is: the step it is on and how many steps it has.

    • step integer Required

    • step_total integer Required

  • created_at integer Required

  • finished_at integer or null Required

  • credits integer Required

  • error object or null Required

    • code string Required One of: try_again, content_refused, output_refused, unavailable.

    • message string Required

  • result object or null Required

    • images list of object Required

      • id string Required

      • url string Required

      • expires_at integer Required

      • width integer Required at least 1.

      • height integer Required at least 1.

      • content_type string Required

Errors

StatusCodeMessage
400key_in_queryA key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way.
400invalid_requestThe request could not be used. Check the field named in param and the documentation, then try again.
400unsupported_parameterThe request has a field or value that this API does not support. Remove it or change it, then try again.
400image_url_refusedThe image address could not be used. It must be a public https address that returns a picture.
400image_refusedThe image was not accepted. Send a JPEG, PNG or WebP picture that is not too large.
400content_refusedThe request was refused by the content rules. Change the request and try again.
401invalid_keyThe key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header.
401key_revokedThis key has been revoked. Make a new key on the Developer API page.
401key_expiredThis key has expired. Make a new key on the Developer API page.
402over_max_creditsThis request would cost more credits than max_credits allows. Raise max_credits or change the request.
403api_disabledThe developer API is not open yet. Try again once it has been opened for your account.
403plan_requiredYour plan does not include the developer API. Move to a plan that does, then try again.
403missing_scopeThis key is not allowed to do that. Use a key that has the scope this route needs.
403wrong_key_typeThis key cannot be used here.
403not_verifiedVerify your email address before you use this feature.
403account_on_holdThis account has a safety hold, so new requests are not accepted. Open your account page to see what to do next.
403class_not_in_planYour plan does not include this kind of picture. Move to a plan that does, or choose another operation.
404image_not_foundNo available image matches that id. Check the id, or send the image itself.
409quote_changedThe price changed while the request was being made. Send the request again.
409idempotency_conflictThat Idempotency-Key was already used for a different request. Use a new key, or repeat the first request exactly.
413body_too_largeThe request is larger than this route accepts. Send a smaller request.
429rate_limitedToo many requests. Wait for the time in the Retry-After header, then try again.
429daily_line_reachedThe daily limit for your plan has been reached. Try again after the time in reset_at.
429period_pool_usedThe credits for this plan period have been used. Try again after the time in reset_at.
429class_limit_reachedThe limit for this kind of picture has been reached. Try again after the time in reset_at.
429free_budget_spentThe free allowance has been used. Try again after the time in reset_at, or move to a paid plan.
429key_budget_reachedThis key's monthly credit budget has been reached. Raise the budget or use another key, or wait for the time in reset_at.
503operation_unavailableThis operation is not available right now. Try again later.
503try_againThe 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

NameInRequiredDescription
Idempotency-KeyheaderOptionalA 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.
PreferheaderOptionalrespond-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_id string Optional The id of one of your library images.

  • image_url string Optional A public https address that returns a JPEG, PNG or WebP picture. 1 to 2000 characters.

  • mask object Optional A mask as a short list of brush strokes and rectangles in ten-thousandths of the picture. White (painted) means edit.

    • v string Required One of: 1.

    • ops list of one of Required

  • mask_png_base64 string 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_credits integer 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.

  • id string Required

  • object string Required One of: job.

  • operation string Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.

  • status string Required One of: queued, running, succeeded, failed, refused, canceled, expired.

  • progress object Required Where a job is: the step it is on and how many steps it has.

    • step integer Required

    • step_total integer Required

  • created_at integer Required

  • finished_at integer or null Required

  • credits integer Required

  • error object or null Required

    • code string Required One of: try_again, content_refused, output_refused, unavailable.

    • message string Required

  • result object or null Required

    • images list of object Required

      • id string Required

      • url string Required

      • expires_at integer Required

      • width integer Required at least 1.

      • height integer Required at least 1.

      • content_type string Required

202 The job was accepted and is still running. Poll it, or wait for a webhook. The Location header names the job.

  • id string Required

  • object string Required One of: job.

  • operation string Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.

  • status string Required One of: queued, running, succeeded, failed, refused, canceled, expired.

  • progress object Required Where a job is: the step it is on and how many steps it has.

    • step integer Required

    • step_total integer Required

  • created_at integer Required

  • finished_at integer or null Required

  • credits integer Required

  • error object or null Required

    • code string Required One of: try_again, content_refused, output_refused, unavailable.

    • message string Required

  • result object or null Required

    • images list of object Required

      • id string Required

      • url string Required

      • expires_at integer Required

      • width integer Required at least 1.

      • height integer Required at least 1.

      • content_type string Required

Errors

StatusCodeMessage
400key_in_queryA key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way.
400invalid_requestThe request could not be used. Check the field named in param and the documentation, then try again.
400unsupported_parameterThe request has a field or value that this API does not support. Remove it or change it, then try again.
400mask_unreadableThe mask could not be read. Send a non-interlaced PNG with an alpha channel.
400mask_size_mismatchThe mask must have the same proportions as the image. Resize the mask and try again.
400mask_too_complexThe mask is too detailed to use. Send a smaller or simpler mask.
400image_url_refusedThe image address could not be used. It must be a public https address that returns a picture.
400image_refusedThe image was not accepted. Send a JPEG, PNG or WebP picture that is not too large.
400content_refusedThe request was refused by the content rules. Change the request and try again.
401invalid_keyThe key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header.
401key_revokedThis key has been revoked. Make a new key on the Developer API page.
401key_expiredThis key has expired. Make a new key on the Developer API page.
402over_max_creditsThis request would cost more credits than max_credits allows. Raise max_credits or change the request.
403api_disabledThe developer API is not open yet. Try again once it has been opened for your account.
403plan_requiredYour plan does not include the developer API. Move to a plan that does, then try again.
403missing_scopeThis key is not allowed to do that. Use a key that has the scope this route needs.
403wrong_key_typeThis key cannot be used here.
403not_verifiedVerify your email address before you use this feature.
403account_on_holdThis account has a safety hold, so new requests are not accepted. Open your account page to see what to do next.
403class_not_in_planYour plan does not include this kind of picture. Move to a plan that does, or choose another operation.
404image_not_foundNo available image matches that id. Check the id, or send the image itself.
409quote_changedThe price changed while the request was being made. Send the request again.
409idempotency_conflictThat Idempotency-Key was already used for a different request. Use a new key, or repeat the first request exactly.
413body_too_largeThe request is larger than this route accepts. Send a smaller request.
429rate_limitedToo many requests. Wait for the time in the Retry-After header, then try again.
429daily_line_reachedThe daily limit for your plan has been reached. Try again after the time in reset_at.
429period_pool_usedThe credits for this plan period have been used. Try again after the time in reset_at.
429class_limit_reachedThe limit for this kind of picture has been reached. Try again after the time in reset_at.
429free_budget_spentThe free allowance has been used. Try again after the time in reset_at, or move to a paid plan.
429key_budget_reachedThis key's monthly credit budget has been reached. Raise the budget or use another key, or wait for the time in reset_at.
503operation_unavailableThis operation is not available right now. Try again later.
503try_againThe 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

NameInRequiredDescription
cursorqueryOptionalThe next_cursor of the page before. Leave it out for the first page.
limitqueryOptionalHow many images, 1 to 20. Default 20.

Request

This route takes no body.

Answers

200 One page of your images.

  • object string Required One of: list.

  • data list of object Required

    • id string Required

    • object string Required One of: image.

    • operation string Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.

    • created_at integer Required

    • width integer Required at least 1.

    • height integer Required at least 1.

  • next_cursor object Required

Errors

StatusCodeMessage
400key_in_queryA key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way.
400invalid_requestThe request could not be used. Check the field named in param and the documentation, then try again.
400unsupported_parameterThe request has a field or value that this API does not support. Remove it or change it, then try again.
401invalid_keyThe key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header.
401key_revokedThis key has been revoked. Make a new key on the Developer API page.
401key_expiredThis key has expired. Make a new key on the Developer API page.
403api_disabledThe developer API is not open yet. Try again once it has been opened for your account.
403plan_requiredYour plan does not include the developer API. Move to a plan that does, then try again.
403missing_scopeThis key is not allowed to do that. Use a key that has the scope this route needs.
403wrong_key_typeThis key cannot be used here.
403not_verifiedVerify your email address before you use this feature.
403account_on_holdThis account has a safety hold, so new requests are not accepted. Open your account page to see what to do next.
429rate_limitedToo 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

NameInRequiredDescription
idpathRequiredThe id from the answer that created it.

Request

This route takes no body.

Answers

200 The job.

  • id string Required

  • object string Required One of: job.

  • operation string Required One of: generation, edit, background_removal, upscale, outpaint, erase, image_upload, other.

  • status string Required One of: queued, running, succeeded, failed, refused, canceled, expired.

  • progress object Required Where a job is: the step it is on and how many steps it has.

    • step integer Required

    • step_total integer Required

  • created_at integer Required

  • finished_at integer or null Required

  • credits integer Required

  • error object or null Required

    • code string Required One of: try_again, content_refused, output_refused, unavailable.

    • message string Required

  • result object or null Required

    • images list of object Required

      • id string Required

      • url string Required

      • expires_at integer Required

      • width integer Required at least 1.

      • height integer Required at least 1.

      • content_type string Required

Errors

StatusCodeMessage
400key_in_queryA key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way.
401invalid_keyThe key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header.
401key_revokedThis key has been revoked. Make a new key on the Developer API page.
401key_expiredThis key has expired. Make a new key on the Developer API page.
403api_disabledThe developer API is not open yet. Try again once it has been opened for your account.
403plan_requiredYour plan does not include the developer API. Move to a plan that does, then try again.
403missing_scopeThis key is not allowed to do that. Use a key that has the scope this route needs.
403wrong_key_typeThis key cannot be used here.
403not_verifiedVerify your email address before you use this feature.
403account_on_holdThis account has a safety hold, so new requests are not accepted. Open your account page to see what to do next.
404not_foundNothing was found for that id. Check the id and try again.
429rate_limitedToo 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

NameInRequiredDescription
idpathRequiredThe id from the answer that created it.

Request

This route takes no body.

Answers

200 What canceling did.

  • id string Required

  • object string Required One of: job.

  • outcome string Required One of: nothing_used, refunded, kept, requested, already_finished.

Errors

StatusCodeMessage
400key_in_queryA key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way.
401invalid_keyThe key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header.
401key_revokedThis key has been revoked. Make a new key on the Developer API page.
401key_expiredThis key has expired. Make a new key on the Developer API page.
403api_disabledThe developer API is not open yet. Try again once it has been opened for your account.
403plan_requiredYour plan does not include the developer API. Move to a plan that does, then try again.
403missing_scopeThis key is not allowed to do that. Use a key that has the scope this route needs.
403wrong_key_typeThis key cannot be used here.
403not_verifiedVerify your email address before you use this feature.
403account_on_holdThis account has a safety hold, so new requests are not accepted. Open your account page to see what to do next.
404not_foundNothing was found for that id. Check the id and try again.
429rate_limitedToo 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

NameInRequiredDescription
Idempotency-KeyheaderOptionalA 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

  • tool string Required One of: remove_background, resize, convert.

  • image_ids list of string Required Between 1 and the batch limit of your plan.

  • settings one of Optional The settings of the chosen tool: none for remove_background, a mode and output for resize, an output for convert.

    • one of 1 object Optional

    • one of 2 one of Optional

      • one of 1 object Optional

        • mode string Required One of: long_edge.

        • edge integer Required 16 to 16000.

        • neverEnlarge boolean Optional

        • output object Optional

          • format string Required One of: keep, png, jpg, webp.

          • fill string Optional

          • quality integer Optional 1 to 100.

      • one of 2 object Optional

        • mode string Required One of: fit.

        • width integer Required 1 to 16000.

        • height integer Required 1 to 16000.

        • neverEnlarge boolean Optional

        • output object Optional

          • format string Required One of: keep, png, jpg, webp.

          • fill string Optional

          • quality integer Optional 1 to 100.

      • one of 3 object Optional

        • mode string Required One of: percent.

        • percent integer Required 1 to 800.

        • neverEnlarge boolean Optional

        • output object Optional

          • format string Required One of: keep, png, jpg, webp.

          • fill string Optional

          • quality integer Optional 1 to 100.

    • one of 3 object Optional

      • output object Required

        • format string Required One of: png, jpg, webp.

        • fill string Optional

        • quality integer Optional 1 to 100.

  • max_credits integer 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.

  • id string Required

  • object string Required One of: batch.

  • tool string Required One of: remove_background, resize, convert.

  • created_at integer Required

  • stopped boolean Required

  • ended boolean Required

  • counts object Required How many files of a batch are in each state.

    • waiting integer Required

    • working integer Required

    • done integer Required

    • skipped integer Required

    • refused integer Required

    • failed integer Required

    • stopped integer Required

  • items list of object Required

    • position integer Required

    • state string Required One of: waiting, working, done, skipped, refused, failed, stopped.

    • reason string 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.

    • step integer Optional

    • step_total integer Optional

    • source_id string Optional

    • result_id string Optional

Errors

StatusCodeMessage
400key_in_queryA key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way.
400invalid_requestThe request could not be used. Check the field named in param and the documentation, then try again.
400unsupported_parameterThe request has a field or value that this API does not support. Remove it or change it, then try again.
400content_refusedThe request was refused by the content rules. Change the request and try again.
401invalid_keyThe key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header.
401key_revokedThis key has been revoked. Make a new key on the Developer API page.
401key_expiredThis key has expired. Make a new key on the Developer API page.
402over_max_creditsThis request would cost more credits than max_credits allows. Raise max_credits or change the request.
403api_disabledThe developer API is not open yet. Try again once it has been opened for your account.
403plan_requiredYour plan does not include the developer API. Move to a plan that does, then try again.
403missing_scopeThis key is not allowed to do that. Use a key that has the scope this route needs.
403wrong_key_typeThis key cannot be used here.
403not_verifiedVerify your email address before you use this feature.
403account_on_holdThis account has a safety hold, so new requests are not accepted. Open your account page to see what to do next.
403class_not_in_planYour plan does not include this kind of picture. Move to a plan that does, or choose another operation.
404image_not_foundNo available image matches that id. Check the id, or send the image itself.
409quote_changedThe price changed while the request was being made. Send the request again.
409idempotency_conflictThat Idempotency-Key was already used for a different request. Use a new key, or repeat the first request exactly.
413body_too_largeThe request is larger than this route accepts. Send a smaller request.
429rate_limitedToo many requests. Wait for the time in the Retry-After header, then try again.
429daily_line_reachedThe daily limit for your plan has been reached. Try again after the time in reset_at.
429period_pool_usedThe credits for this plan period have been used. Try again after the time in reset_at.
429class_limit_reachedThe limit for this kind of picture has been reached. Try again after the time in reset_at.
429free_budget_spentThe free allowance has been used. Try again after the time in reset_at, or move to a paid plan.
429key_budget_reachedThis key's monthly credit budget has been reached. Raise the budget or use another key, or wait for the time in reset_at.
503operation_unavailableThis operation is not available right now. Try again later.
503try_againThe 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

NameInRequiredDescription
idpathRequiredThe id from the answer that created it.

Request

This route takes no body.

Answers

200 The batch.

  • id string Required

  • object string Required One of: batch.

  • tool string Required One of: remove_background, resize, convert.

  • created_at integer Required

  • stopped boolean Required

  • ended boolean Required

  • counts object Required How many files of a batch are in each state.

    • waiting integer Required

    • working integer Required

    • done integer Required

    • skipped integer Required

    • refused integer Required

    • failed integer Required

    • stopped integer Required

  • items list of object Required

    • position integer Required

    • state string Required One of: waiting, working, done, skipped, refused, failed, stopped.

    • reason string 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.

    • step integer Optional

    • step_total integer Optional

    • source_id string Optional

    • result_id string Optional

Errors

StatusCodeMessage
400key_in_queryA key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way.
401invalid_keyThe key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header.
401key_revokedThis key has been revoked. Make a new key on the Developer API page.
401key_expiredThis key has expired. Make a new key on the Developer API page.
403api_disabledThe developer API is not open yet. Try again once it has been opened for your account.
403plan_requiredYour plan does not include the developer API. Move to a plan that does, then try again.
403missing_scopeThis key is not allowed to do that. Use a key that has the scope this route needs.
403wrong_key_typeThis key cannot be used here.
403not_verifiedVerify your email address before you use this feature.
403account_on_holdThis account has a safety hold, so new requests are not accepted. Open your account page to see what to do next.
404not_foundNothing was found for that id. Check the id and try again.
429rate_limitedToo 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

NameInRequiredDescription
idpathRequiredThe id from the answer that created it.

Request

This route takes no body.

Answers

200 What stopping did.

  • id string Required

  • object string Required One of: batch.

  • stopped_now integer Required

  • stopping integer Required

  • finished integer Required

  • already_stopped boolean Required

Errors

StatusCodeMessage
400key_in_queryA key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way.
401invalid_keyThe key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header.
401key_revokedThis key has been revoked. Make a new key on the Developer API page.
401key_expiredThis key has expired. Make a new key on the Developer API page.
403api_disabledThe developer API is not open yet. Try again once it has been opened for your account.
403plan_requiredYour plan does not include the developer API. Move to a plan that does, then try again.
403missing_scopeThis key is not allowed to do that. Use a key that has the scope this route needs.
403wrong_key_typeThis key cannot be used here.
403not_verifiedVerify your email address before you use this feature.
403account_on_holdThis account has a safety hold, so new requests are not accepted. Open your account page to see what to do next.
404not_foundNothing was found for that id. Check the id and try again.
429rate_limitedToo 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.

  • source string Required One of: free, subscription, pass.

  • day object or null Required

    • kind string Required One of: day, month, pass.

    • used integer Required

    • limit integer Required

    • left integer Required

    • resets_at integer or null Required

    • ends_instead boolean Required

    • state string Required One of: normal, slowed, used_up.

  • period object or null Required

    • kind string Required One of: day, month, pass.

    • used integer Required

    • limit integer Required

    • left integer Required

    • resets_at integer or null Required

    • ends_instead boolean Required

    • state string Required One of: normal, slowed, used_up.

  • tools list of object Required

    • cost_class string Required One of: standard_generation, premium_generation, edit_inpaint, upscale, background_removal.

    • day_used integer Required

    • day_limit integer or null Required

    • period_used integer Required

    • period_limit integer or null Required

    • used_up boolean Required

  • slowed_by string or null Required

  • free_budget_spent boolean Required

  • slow_rule object Required

    • day_percent object Required

    • period_percent object Required

Errors

StatusCodeMessage
400key_in_queryA key was found in the address of the request. Send keys only in the Authorization header, and revoke any key you sent this way.
401invalid_keyThe key is missing or not recognised. Send a valid key as a Bearer token in the Authorization header.
401key_revokedThis key has been revoked. Make a new key on the Developer API page.
401key_expiredThis key has expired. Make a new key on the Developer API page.
403api_disabledThe developer API is not open yet. Try again once it has been opened for your account.
403plan_requiredYour plan does not include the developer API. Move to a plan that does, then try again.
403missing_scopeThis key is not allowed to do that. Use a key that has the scope this route needs.
403wrong_key_typeThis key cannot be used here.
403not_verifiedVerify your email address before you use this feature.
403account_on_holdThis account has a safety hold, so new requests are not accepted. Open your account page to see what to do next.
429rate_limitedToo 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.json

JavaScript

const response = await fetch("https://easyimage.ae/v1/openapi.json", {
  method: "GET",
});
console.log(await response.json());