Simple API for image optimization

Integrate compression, format conversion, smart resizing, and AI upscaling into your app. Use our REST API from any language, or start instantly with the official Node.js SDK.

Quick start

Process your first image in 4 simple steps using the npm SDK.

Get your API key

Register a free account and generate an API key in the dashboard. Free tier includes up to 1,000 compressions per month.

Initialize & Create Task

Install boost-image via npm. Initialize the client and start a new task specifying the tool (compress, convert, resize, upscale).

Upload Image

Upload the file to the task. You can pass configuration parameters like compression levels or resize dimensions here.

Process & Download

Trigger the processing engine. Once completed, download the result which returns an array of metadata and file buffers or links.

Node.js (SDK)
import BoostImage from "boost-image";
import { CompressionLevel } from "boost-image/dist/types";
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";

const __dirname = path.dirname(fileURLToPath(import.meta.url));

// 1. Initialize
const client = new BoostImage({
apiKey: "your-api-key",
});

// 2. Create Task
const task = await client.createTask("compress");

// 3. Upload — URL (works everywhere) or absolute path (Node.js only)
await client.upload(task, path.join(__dirname, "image.jpg"), {
compression_level: CompressionLevel.RECOMMENDED,
});

// 4. Process & Download
await client.process(task);
const results = await client.download(task);

if (results.length > 0) {
const first = results[0];
console.log("Compressed size:", first.size);

// In Node.js: save via buffer
const outputPath = path.join(__dirname, "compressed.jpg");
fs.writeFileSync(outputPath, first.buffer);
console.log("Saved to:", outputPath);
}

Code examples by operation

Each example follows the required flow: create a task, upload file(s), then call the operation using :task_id and :server_filename.

Compress an image

Reduce file size while preserving visual quality.

GET/v1/compress/:task_id/:server_filename

Parameters

  • compression_level

    Enum: low, recommended, extreme

  • rotate

    (Optional) Degrees to rotate

Response / Result Example (JSON)
[
  {
    "original_filename": "photo.jpg",
    "server_filename": "c186eedfbd4...",
    "size_before": 629370,
    "size": 89310,
    "width": 1920,
    "height": 1080,
    "extension": "jpg",
    "link": "/image/task-id/filename"
  }
]
import axios from 'axios';
import fs from 'fs';

// Create client with auth (once)
const api = axios.create({
baseURL: 'https://api.boost-image.online',
headers: { 'X-Api-Key': 'YOUR_API_KEY' }
});

// 1. Start a compression task
// Response: { id: "uuid", tool: "compress", status: "waiting" }
const { data: task } = await api.get('/v1/start/compress');
console.log('Task started:', task.id);

// 2. Upload your image
// Response: { id, server_filename, task_id, width, height }
const formData = new FormData();
formData.append('file', fs.createReadStream('example.jpg'));
formData.append('task', task.id);

const { data: upload } = await api.post('/v1/upload', formData);
console.log('Uploaded:', upload.server_filename);

// 3. Get compressed result
const { data: results } = await api.post('/v1/process', {
task: task.id,
tool: 'compress',
files: [{ server_filename: upload.server_filename, filename: upload.original_filename }],
compression_level: 'recommended',
})

// 4. Download result
// Option A: ZIP archive (all files)
const { data: zip } = await api.get(`/v1/download/${task.id}`, {
responseType: 'arraybuffer'
});
fs.writeFileSync('compressed.zip', zip);

// Option B: Single file (stream)
const result = results[0];
const writer = fs.createWriteStream('compressed.jpg')
const response = await api.get(result.link, { responseType: 'stream' })
response.data.pipe(writer)
GET

Batch Processing: For multiple files, it is highly recommended to use the POST /v1/process endpoint passing an array of files, rather than making multiple sequential GET requests.

Authentication

Authenticate requests by sending your API key in the X-Api-Key header. No Bearer token or prior login is required.

X-Api-Key: <YOUR_API_KEY>

Limits & Billing

API quotas depend on your active plan (Free, Pro, or Ultra). If you exceed your monthly limits, you can continue processing via On-Demand billing.

  • Free plan includes 1,000 actions/mo.
  • API access is available for all registered users.
View Pricing & Limits