API Documentation
Upload images programmatically using our API
The ImageUpload.app API enables you to integrate image upload functionality into your web applications, mobile apps, or backend systems. With our RESTful API, you can upload images in seconds and integrate quickly using our JavaScript SDK. Create your API key and start using it right away!
Getting Started
1. Get Your API Key
First, you need to create an account and generate an API token from your account page.
2. Make API Requests
Include your API key in one of the following ways:
- Authorization header: Authorization: Bearer YOUR_API_KEY
- Request body: key=YOUR_API_KEY
- Query parameter: ?key=YOUR_API_KEY
Upload Image
https://imageupload.app/api/1/upload
                Parameters
| Parameter | Type | Required | Description | 
|---|---|---|---|
| key | string | Yes | Your API key | 
| images | file | Yes | Image file(s) to upload (max 5 files, 4MB each) | 
Example Request (cURL)
curl -X POST "https://imageupload.app/api/1/upload" \ -H "Authorization: Bearer YOUR_API_KEY" \ -F "images=@/path/to/your/image.jpg"
Example Request (JavaScript)
const formData = new FormData();
formData.append('images', fileInput.files[0]);
formData.append('key', 'YOUR_API_KEY');
fetch('https://imageupload.app/api/1/upload', {
  method: 'POST',
  body: formData
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
                Response (Single Image)
{
  "status": 200,
  "success": true,
  "data": {
    "id": "abc123def456",
    "title": "image.jpg",
    "url_viewer": "https://imageupload.app/i/abc123def456",
    "url": "https://i.imageupload.app/abc123def456.jpg",
    "display_url": "https://i.imageupload.app/abc123def456.jpg",
    "size": 102400,
    "time": 1698765432,
    "image": {
      "filename": "abc123def456.jpg",
      "name": "abc123def456",
      "mime": "image/jpeg",
      "extension": "jpg",
      "url": "https://i.imageupload.app/abc123def456.jpg"
    }
  }
}
                Response (Multiple Images)
{
  "status": 200,
  "success": true,
  "data": {
    "images": [
      {
        "id": "abc123def456",
        "url": "https://i.imageupload.app/abc123def456.jpg",
        ...
      },
      {
        "id": "xyz789uvw012",
        "url": "https://i.imageupload.app/xyz789uvw012.jpg",
        ...
      }
    ],
    "count": 2
  }
}
                JavaScript SDK
We provide a simple JavaScript library for easy integration into your website.
Installation
<script src="https://imageupload.app/imageupload-sdk.min.js"></script>
Basic Usage
// Initialize the SDK
const uploader = new ImageUploadApp('YOUR_API_KEY');
// Upload a single file
uploader.upload(fileInput.files[0])
  .then(response => {
    console.log('Upload successful:', response.url);
  })
  .catch(error => {
    console.error('Upload failed:', error);
  });
                Upload Multiple Files
const uploader = new ImageUploadApp('YOUR_API_KEY');
uploader.uploadMultiple(fileInput.files)
  .then(response => {
    console.log('Uploads successful:', response);
  })
  .catch(error => {
    console.error('Upload failed:', error);
  });
                Create Upload Widget
const uploader = new ImageUploadApp('YOUR_API_KEY');
uploader.createUploadWidget({
  multiple: true,
  onStart: (files) => {
    console.log('Starting upload:', files.length, 'files');
  },
  onProgress: (percent) => {
    console.log('Upload progress:', percent + '%');
  },
  onSuccess: (response, files) => {
    console.log('Upload successful:', response);
  },
  onError: (error, files) => {
    console.error('Upload failed:', error);
  }
});
                Complete Example
<!DOCTYPE html>
<html>
<head>
    <title>Image Upload Example</title>
    <script src="https://imageupload.app/imageupload-sdk.min.js"></script>
</head>
<body>
    <button id="uploadBtn">Upload Image</button>
    <div id="result"></div>
    <script>
        const uploader = new ImageUploadApp('YOUR_API_KEY');
        
        document.getElementById('uploadBtn').addEventListener('click', function() {
            uploader.createUploadWidget({
                multiple: false,
                onSuccess: (response) => {
                    document.getElementById('result').innerHTML = 
                        '<img src="' + response.url + '" style="max-width: 300px;">';
                },
                onError: (error) => {
                    alert('Upload failed: ' + error.message);
                }
            });
        });
    </script>
</body>
</html>
                Error Codes
| Code | Message | Description | 
|---|---|---|
| 100 | No API key provided | API key is missing from the request | 
| 110 | Invalid API key | The provided API key is not valid | 
| 120 | User not found | The user associated with the API key was not found | 
| 130 | File size too large | File exceeds the maximum size limit of 4MB | 
| 131 | Too many files | Maximum of 5 files can be uploaded at once | 
| 140 | No image file provided | No image file was included in the request | 
| 150 | No files could be uploaded | All files failed to upload | 
Why Use ImageUpload.app API?
🚀 Fast & Reliable
Your images are uploaded instantly with our high-performance servers and remain accessible at all times.
🔒 Secure
Your API keys are stored securely and all requests are encrypted over HTTPS.
📱 Easy Integration
Easily integrate into any platform with our RESTful API and JavaScript SDK. Getting started is easy with detailed documentation and examples!