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 size429Rate limit exceeded500Server error