API Documentation

Introduction

ImgNest provides a simple API for uploading and hosting images. This documentation covers the endpoints, request formats, and response structures for interacting with our service.

Our API is designed to be straightforward and easy to integrate into your applications, allowing you to quickly implement image upload functionality with direct URLs for sharing.

Base URL

All API requests should be made to:

https://i.rj1.dev

Authentication

Currently, the API is open and does not require authentication. However, we recommend using appropriate rate limiting in your applications to ensure fair usage.

Endpoints

POST

/upload

Upload a new image to the service.

Request

Send a multipart/form-data request with:

  • image (file) - The image file to upload (required)

Response

  • success (boolean) - Whether the upload was successful
  • direct_url (string) - Direct URL to access the uploaded image
  • message (string) - Result message

Example Response

{
  "success": true,
  "direct_url": "https://i.rj1.dev/abcDEfg",
  "message": "Image uploaded successfully"
}
GET

/images

List all uploaded images.

Response

  • success (boolean) - Whether the request was successful
  • images (array) - Array of image objects, each containing a direct URL

Example Response

{
  "success": true,
  "images": [
    { "direct_url": "https://i.rj1.dev/abcDEfg" },
    { "direct_url": "https://i.rj1.dev/hIjKlM" }
  ]
}

Error Handling

When an error occurs, the API will return a JSON response with success: false and an appropriate error message.

Common Error Responses

{
  "success": false,
  "message": "No image provided"
}
{
  "success": false,
  "message": "File too large (max 25MB)"
}

HTTP Status Codes

  • 200 OK - Request successful
  • 400 Bad Request - Invalid request (missing image, etc.)
  • 413 Payload Too Large - File exceeds size limit
  • 415 Unsupported Media Type - Unsupported file format
  • 429 Too Many Requests - Rate limit exceeded
  • 500 Internal Server Error - Server error

Code Examples

cURL

# Upload an image
curl -X POST https://i.rj1.dev/upload \
  -F "image=@/path/to/your/image.jpg"

# List all images
curl https://i.rj1.dev/images

JavaScript (Fetch API)

// Upload an image
const formData = new FormData();
formData.append('image', imageFile);

const uploadRes = await fetch('https://i.rj1.dev/upload', {
  method: 'POST',
  body: formData
});
const uploadData = await uploadRes.json();
console.log('Image URL:', uploadData.direct_url);

// List all images
const listRes = await fetch('https://i.rj1.dev/images');
const listData = await listRes.json();
console.log('Images:', listData.images);

Python (requests)

import requests

# Upload an image
files = {'image': open('image.jpg', 'rb')}
res = requests.post('https://i.rj1.dev/upload', files=files)
data = res.json()
print('Image URL:', data['direct_url'])

# List all images
res = requests.get('https://i.rj1.dev/images')
data = res.json()
print('Images:', data['images'])

Limitations

  • Maximum file size: 25MB
  • Supported formats: JPG, JPEG, PNG, GIF, WebP, BMP, SVG
  • Rate limit: 100 requests per hour per IP

Support

If you encounter any issues or have questions about the API, please contact us at support@img.rj1.dev