A Developer's Guide to the ImgLink API: Automate Your Image Uploads

2025-05-30 ImgLink Team

Integrate ImgLink into your application with our simple and free API. This guide shows you how to automate image uploads and get direct links back programmatically.

Automate Everything with the ImgLink API

For developers, efficiency and automation are key. Manually uploading images is fine for occasional use, but what if you need to integrate image hosting directly into your application, script, or workflow? That's where the ImgLink API comes in.

Our free, public API provides a simple yet powerful way to programmatically upload images and receive a direct link instantly. This guide will walk you through the basics.

The API Endpoint

The endpoint for uploading images is straightforward:

POST https://imglink.io/upload

The request must be a multipart/form-data request.

Parameters

The API accepts the following parameters in the request body: - file: The image file you want to upload. This is a required parameter. You can upload multiple files by using the same parameter name for each. - title (optional): A title for your image. - description (optional): A description for your image. - delete_after (optional): Set an expiration time in minutes. The image will be deleted after this period.

Example: Using cURL

The easiest way to test the API is with a cURL command in your terminal.

bash curl -F "file=@/path/to/your/image.jpg" https://imglink.io/upload Replace /path/to/your/image.jpg with the actual path to your file.

Example Response

The API will respond with a JSON object containing the details of the uploaded image(s). For a single file upload, the response will look like this:

json { "success": true, "images": [ { "id": 12345, "url": "https://imglink.io/image/12345", "direct_url": "https://imglink.io/i/your-image.jpg", "thumbnail_url": "https://imglink.io/t/your-image.jpg", "filename": "your-image.jpg", "size": "5.2 MB", "delete_url": "https://imglink.io/delete/some-secret-key" } ] }

The most important field here is direct_url, which is the clean, hotlinkable URL you can use in your application.

Example: Python Script

Here's a simple Python script to demonstrate how you can use the API in your code.

```python import requests

The path to the image you want to upload

image_path = 'path/to/your/photo.png'

The API endpoint

url = 'https://imglink.io/upload'

with open(image_path, 'rb') as f: files = {'file': (f.name, f, 'image/png')}

# Optional: add a title and description
payload = {
    'title': 'My Awesome Photo',
    'description': 'Uploaded via the ImgLink API'
}

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

if response.status_code == 200:
    data = response.json()
    if data.get('success'):
        image_info = data['images'][0]
        print(f"Upload successful!")
        print(f"Direct URL: {image_info['direct_url']}")
    else:
        print(f"Upload failed: {data.get('error')}")
else:
    print(f"Request failed with status code: {response.status_code}")

```

Start Building Today

The ImgLink API is free to use and requires no authentication key for anonymous uploads, making it incredibly easy to get started. Begin integrating fast, reliable image hosting into your projects today.