API Reference
Integrate ImageAI's editing models into your own products with a simple REST API.
Introduction
The ImageAI API lets you run our editing models programmatically. All endpoints are served over HTTPS from https://api.imageaiapp.top/v1 and accept and return JSON. Images can be supplied as a public URL or as a base64-encoded string.
Authentication
Authenticate every request with your secret key in the Authorization header as a bearer token. Keep your key server-side — never ship it in client code.
Authorization: Bearer sk_live_3f8c0a1d9b2e4c7a6f5d8e9b0c1a2d3e
Quickstart
Enhance an image with a single request:
curl https://api.imageaiapp.top/v1/enhance \
-H "Authorization: Bearer $IMAGEAI_KEY" \
-H "Content-Type: application/json" \
-d '{
"image_url": "https://example.com/photo.jpg",
"operations": ["auto", "denoise"],
"output_format": "png"
}'
And the same call from Node.js using the official SDK:
import ImageAI from "@imageai/sdk";
const client = new ImageAI(process.env.IMAGEAI_KEY);
const result = await client.enhance({
image_url: "https://example.com/photo.jpg",
operations: ["auto", "denoise"],
});
console.log(result.output_url);
Enhance
Applies automatic exposure, color and detail correction. Combine operations to chain effects in one pass.
| Parameter | Type | Description |
|---|---|---|
image_url required* | string | Public URL of the source image. *Provide either image_url or image_b64. |
image_b64 | string | Base64-encoded image data, up to 25 MB. |
operations | array | Any of auto, denoise, sharpen, color. Defaults to ["auto"]. |
output_format | string | png, jpg or webp. Defaults to png. |
Example response:
{
"id": "img_9f2a7c1e",
"status": "succeeded",
"output_url": "https://cdn.imageaiapp.top/o/9f2a7c1e.png",
"credits_used": 1
}
Remove background
Returns the subject on a transparent background, with per-pixel edge refinement for hair and soft edges.
| Parameter | Type | Description |
|---|---|---|
image_url required* | string | Source image URL. |
refine_edges | boolean | Enable hair-level edge refinement. Defaults to true. |
bg_color | string | Optional hex color to fill behind the subject, e.g. "#ffffff". |
Upscale
Increases resolution up to 4× with detail-preserving super-resolution.
| Parameter | Type | Description |
|---|---|---|
image_url required* | string | Source image URL. |
scale | integer | 2 or 4. Defaults to 2. |
Errors
The API uses conventional HTTP status codes. Errors include a machine-readable code and a human-readable message.
| Status | Code | Meaning |
|---|---|---|
400 | invalid_request | A parameter is missing or malformed. |
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_credits | Your account is out of image credits. |
429 | rate_limited | Too many requests — back off and retry. |
500 | internal_error | Something went wrong on our side. |
Rate limits
Team accounts may make up to 60 requests per minute and run 10 concurrent jobs. Every response includes X-RateLimit-Remaining and X-RateLimit-Reset headers. If you need higher limits, talk to us.
SDKs
Official libraries wrap the REST API with retries, typed responses and streaming uploads:
- JavaScript / TypeScript —
npm install @imageai/sdk - Python —
pip install imageai-sdk - Go —
go get github.com/imageai/imageai-go