Quick Start
This guide will help you upload your first image and serve it with transformations.
Prerequisites
Step 1: Get Your API Key
- Go to img-src.io/settings
- Click Create API Key
- Give it a name and copy the key (it won’t be shown again)
Keep your API key secure. Don’t commit it to version control or expose it in client-side code.
Step 2: Upload an Image
curl -X POST https://api.img-src.io/api/v1/images \
-H "Authorization: Bearer imgsrc_YOUR_API_KEY" \
-F "[email protected]" \
-F "path=photos/vacation.jpg"
The response includes your CDN URL:
{
"id": "img_abc123",
"url": "https://img-src.io/i/username/photos/vacation.jpg",
"paths": ["photos/vacation.jpg"],
"content_type": "image/jpeg",
"size": 1234567,
"width": 4000,
"height": 3000,
"created_at": 1704067200
}
Now you can request the image with transformation parameters:
<img src="https://img-src.io/i/username/photos/vacation.jpg" />
| Parameter | Description | Example |
|---|
w | Width in pixels | w=800 |
h | Height in pixels | h=600 |
fit | Fit mode | fit=cover |
q | Quality (1-100) | q=85 |
Output format is determined by the file extension in the URL. Change .jpg to .webp or .avif to convert formats.
Fit Modes
- cover - Fill the dimensions, cropping if needed
- contain - Fit within dimensions, preserving aspect ratio
- fill - Stretch to fill dimensions exactly
- scale-down - Like contain, but never upscale
Step 4: List Your Images
curl https://api.img-src.io/api/v1/images \
-H "Authorization: Bearer imgsrc_YOUR_API_KEY"
Step 5: Delete an Image
curl -X DELETE https://api.img-src.io/api/v1/images/img_abc123 \
-H "Authorization: Bearer imgsrc_YOUR_API_KEY"
Using the Dashboard
You can also manage images through the web dashboard:
- Go to img-src.io
- Sign in with your account
- Drag and drop images to upload
- Click on an image to copy its URL
- Use the URL builder to add transformations
Next Steps