API Documentation
Integrate ImageSmith into your applications with our REST API.
File Size Limit
Maximum 3MB per request. For larger files, use our browser-based tools.
Rate Limiting
10 requests per minute per IP address.
No Auth Required
All endpoints are public. No API keys needed.
Quick Start
Example: Compress an image using cURL
curl -X POST https://imagesmith.labs.fakhrif.my.id/api/compress \ -F "file=@image.jpg" \ -F "quality=80" \ --output compressed.jpg
Endpoints
POST
/api/compress
Compress an image to reduce file size.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| file | File | Required | Image file to compress |
| quality | number | Optional | Quality 1-100 (default: 80) |
| format | string | Optional | Output format: jpeg, png, webp |
Example
curl -X POST https://imagesmith.labs.fakhrif.my.id/api/compress \ -F "file=@image.jpg" \ -F "quality=80" --output output.jpg
POST
/api/convert
Convert an image to a different format.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| file | File | Required | Image file to convert |
| format | string | Required | Target format: jpeg, png, webp, bmp, ico |
| quality | number | Optional | Quality 1-100 (default: 80) |
Example
curl -X POST https://imagesmith.labs.fakhrif.my.id/api/convert \ -F "file=@image.jpg" \ -F "format=value" --output output.jpg
POST
/api/resize
Resize an image to specific dimensions.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| file | File | Required | Image file to resize |
| width | number | Optional | Target width in pixels |
| height | number | Optional | Target height in pixels |
| fit | string | Optional | Fit mode: cover, contain, fill, inside, outside |
Example
curl -X POST https://imagesmith.labs.fakhrif.my.id/api/resize \ -F "file=@image.jpg" \ -F "width=80" --output output.jpg
POST
/api/crop
Crop an image to a specific region.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| file | File | Required | Image file to crop |
| left | number | Required | Left offset in pixels |
| top | number | Required | Top offset in pixels |
| width | number | Required | Crop width in pixels |
| height | number | Required | Crop height in pixels |
Example
curl -X POST https://imagesmith.labs.fakhrif.my.id/api/crop \ -F "file=@image.jpg" \ -F "left=80" --output output.jpg
POST
/api/rotate
Rotate or flip an image.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| file | File | Required | Image file to rotate |
| angle | number | Optional | Rotation angle: 90, 180, 270 |
| flipH | boolean | Optional | Flip horizontally |
| flipV | boolean | Optional | Flip vertically |
Example
curl -X POST https://imagesmith.labs.fakhrif.my.id/api/rotate \ -F "file=@image.jpg" \ -F "angle=80" --output output.jpg
POST
/api/watermark
Add a text watermark to an image.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| file | File | Required | Image file to watermark |
| text | string | Required | Watermark text |
| position | string | Optional | Position: center, top-left, bottom-right, etc. |
| opacity | number | Optional | Opacity 0-100 (default: 50) |
Example
curl -X POST https://imagesmith.labs.fakhrif.my.id/api/watermark \ -F "file=@image.jpg" \ -F "text=value" --output output.jpg
JavaScript Example
Using fetch API
const formData = new FormData();
formData.append('file', fileInput.files[0]);
formData.append('quality', '80');
const response = await fetch('/api/compress', {
method: 'POST',
body: formData,
});
const blob = await response.blob();
const url = URL.createObjectURL(blob);