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.

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 Format

Send a multipart/form-data request with the following parameter:

  • image - The image file to upload (required)

Response Format

The API returns a JSON object with the following properties:

  • success - Boolean indicating if the upload was successful
  • direct_url - The URL to access the uploaded image
  • message - A message describing the result of the operation

Example Response

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

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

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

JavaScript (Fetch API)

const formData = new FormData();
formData.append('image', imageFile); // imageFile is a File object

fetch('https://i.rj1.dev/upload', {
  method: 'POST',
  body: formData
})
.then(response => response.json())
.then(data => {
  if (data.success) {
    console.log('Image URL:', data.direct_url);
  } else {
    console.error('Upload failed:', data.message);
  }
})
.catch(error => {
  console.error('Error:', error);
});

Python (requests)

import requests

url = 'https://i.rj1.dev/upload'
files = {'image': open('image.jpg', 'rb')}

response = requests.post(url, files=files)
data = response.json()

if data['success']:
    print('Image URL:', data['direct_url'])
else:
    print('Upload failed:', data['message'])

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