t11nupload

REST API Reference

Welcome to the T11N Upload REST API documentation. This API allows developers to easily integrate image upload and delete capabilities (supporting single or bulk actions) directly into their own applications. All endpoints return standard JSON responses and support CORS.

ℹ️ Authentication: No API key required for public use.
POST
/api.php?action=upload
Upload one or multiple images at once. Supports formats: JPG, PNG, GIF, WEBP, and AVIF. Maximum size limit is 50MB per file.
Request Headers
Header Value Description
Content-Type multipart/form-data Required for file transmission.
Parameters (Form Data)
Field Type Required Description
files[] file[] Yes* An array of image files to upload. Brackets [] are mandatory for uploading multiple files.
file file Yes* A single image file (fallback option if not using array field).

💡 Field Name Flexibility

While files[] and file are standard, the API automatically scans all fields inside the upload payload. However, using files[] is highly recommended for bulk uploads.

cURL Examples
cURL — Bulk Upload
curl -X POST "http://up.t11n.dev/api.php?action=upload" \
  -F "files[][email protected]" \
  -F "files[][email protected]"
cURL — Single Upload
curl -X POST "http://up.t11n.dev/api.php?action=upload" \
  -F "[email protected]"
Success Response (200 OK)
JSON Response
{
  "success": true,
  "data": [
    {
      "name": "a1b2c3d4..._1739245678_image1.jpg",
      "original_name": "image1.jpg",
      "status": "success",
      "url": "http://up.t11n.dev/uploads/a1b2c3d4..._1739245678_image1.jpg",
      "size": 123456,
      "mime": "image/jpeg",
      "width": 1920,
      "height": 1080
    }
  ]
}
POST
/api.php?action=delete
Delete one or multiple image files previously uploaded to the server.
Request Headers
Header Value Description
Content-Type application/json Required for transmitting request body.
JSON Body Parameters
Field Type Required Description
names string[] Yes* Array of filenames to delete (e.g. ["a1b2..._image1.jpg", "x1y2..._image2.png"]).
name string Yes* Single filename to delete (fallback if names array is not provided).
cURL Example
cURL — Delete Files
curl -X POST "http://up.t11n.dev/api.php?action=delete" \
  -H "Content-Type: application/json" \
  -d '{"names": ["a1b2c3d4e5f678901234567890abcdef_1739245678_image1.jpg"]}'
Response (200 OK)
JSON Response
{
  "success": true,
  "data": [
    {
      "name": "a1b2c3d4e5f678901234567890abcdef_1739245678_image1.jpg",
      "status": "success"
    }
  ]
}
API Response Codes
HTTP Code Meaning Description
200 OK Request succeeded. The detailed status of each file is in the response body.
400 Bad Request Missing parameters, invalid file format, or improper request payload.
405 Method Not Allowed The request method is invalid (only POST is supported).
500 Internal Server Error The server encountered an error saving or deleting files on disk.