Skip to main content

Quick Start

This guide will help you upload your first image and serve it with transformations.

Prerequisites

Step 1: Get Your API Key

  1. Go to img-src.io/settings
  2. Click Create API Key
  3. 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
}

Step 3: Serve with Transformations

Now you can request the image with transformation parameters:
<img src="https://img-src.io/i/username/photos/vacation.jpg" />

Transformation Parameters

ParameterDescriptionExample
wWidth in pixelsw=800
hHeight in pixelsh=600
fitFit modefit=cover
qQuality (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:
  1. Go to img-src.io
  2. Sign in with your account
  3. Drag and drop images to upload
  4. Click on an image to copy its URL
  5. Use the URL builder to add transformations

Next Steps