API Documentation

Simple image upload API with instant short links

๐Ÿ“ค Upload Endpoint

POST https://sodhi.vercel.app/api/upload

๐Ÿ“ฆ Request

Content-Type: multipart/form-data

Field name: image

Max size: 25MB

๐Ÿงช cURL Example

curl https://sodhi.vercel.app/api/upload \
  -F "image=@photo.jpg"

๐Ÿ“ฅ Response

{
  "url": "https://sodhi.vercel.app/i/abc12345",
  "shortId": "abc12345",
  "size": 245678,
  "filename": "photo.jpg"
}

๐Ÿ Python Example

import requests
import mimetypes

filename = 'photo.jpg'
mime_type = mimetypes.guess_type(filename)[0] or "image/jpeg"

with open(filename, 'rb') as f:
    files = {'image': (filename, f, mime_type)}
    response = requests.post(
        'https://sodhi.vercel.app/api/upload',
        files=files
    )
    
data = response.json()
print(f"Image URL: {data['url']}")

โšก JavaScript Example

const formData = new FormData();
formData.append('image', fileInput.files[0]);

const response = await fetch('/api/upload', {
  method: 'POST',
  body: formData
});

const data = await response.json();
console.log('Image URL:', data.url);

โฑ๏ธ Rate Limiting

Limit: 10 uploads per hour per IP address

If you exceed the rate limit, you'll receive a 429 status code.

๐ŸŽจ Supported Formats

JPG
PNG
GIF
WebP
BMP
SVG

โš ๏ธ Error Codes

400Invalid file type or size
429Rate limit exceeded
500Server error