Upload.am API Documentation

Version 1.0.0 | Secure File Management for Web3

Overview

The Upload.am API is a modern RESTful API designed for secure file uploads, downloads, and management. Tailored for Web3 applications, it integrates with S3-compatible storage, supports JWT authentication, and offers features like password-protected downloads and file expiration. Perfect for developers and businesses aiming for top-tier file-sharing solutions in 2025.

Authentication

Protected endpoints require a JWT token obtained via /auth/login. Include it in the Authorization header:

Authorization: Bearer <your_jwt_token>

Tokens are valid for 1 hour. Refresh via /auth/login.

Endpoints

1. Precheck File Upload (POST /precheck)

Validates file metadata before upload, returning a fileId.

Authentication: Optional (JWT)

Content-Type: application/x-www-form-urlencoded

Parameters

Parameter Type Required Description
fileName String Yes File name (e.g., photo.jpg)
fileSize Integer Yes File size in bytes

Example Request

curl -X POST https://upload.am/api/v1/precheck \
  -d "fileName=photo.jpg" \
  -d "fileSize=1048576" \
  -H "Authorization: Bearer <your_jwt_token>"

Example Response

{
  "success": true,
  "data": {
    "fileId": "temp_68586xxxxxx"
  }
}

2. Upload File (POST /upload)

Uploads a file to S3 storage with validation.

Authentication: Optional (JWT)

Content-Type: multipart/form-data

Parameters

Parameter Type Required Description
file File Yes File to upload
fileId String Yes fileId from /precheck
expiry Integer No Expiration in days (default: 30)
password String No Download password

Example Request

curl -X POST https://upload.am/api/v1/upload \
  -F "file=@photo.jpg" \
  -F "fileId=temp_68586xxxxxx" \
  -F "expiry=7" \
  -F "password=secure123" \
  -H "Authorization: Bearer <your_jwt_token>"

Example Response

[{
  "success": true,
  "data": {
    "fileName": "photo.jpg",
    "fileSize": "218.94 KB",
    "fileLink": "https://upload.am/download.php?file=68586xxxxxx.jpg",
    "uploadDate": "2025-06-23 00:00:00",
    "expiresAt": "2025-06-30 00:00:00"
  }
}]

3. User Login (POST /auth/login)

Authenticates a user and returns a JWT token.

Authentication: None

Content-Type: application/x-www-form-urlencoded

Parameters

Parameter Type Required Description
login String Yes User login (e.g., example_user)
password String Yes User password

Example Request

curl -X POST https://upload.am/api/v1/auth/login \
  -d "login=example_user" \
  -d "password=example_password"

Example Response

{
  "success": true,
  "data": {
    "accessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
  }
}

4. Download File (GET /download)

Returns a presigned S3 URL for downloading a file.

Authentication: None

Content-Type: application/json

Parameters

Parameter Type Required Description
file String Yes File key (e.g., 68586xxxxxx.jpg)
password String No Download password

Example Request

curl -X GET "https://upload.am/api/v1/download?file=68586xxxxxx.jpg&password=secure123"

Example Response

{
  "success": true,
  "data": {
    "presignedUrl": "https://upload.de-fra.i3storage.com/2025/06/23/68586xxxxxx.jpg?...",
    "fileName": "68586xxxxxx.jpg",
    "fileSize": "218.94 KB",
    "expiresAt": "2025-06-30 00:00:00"
  }
}

5. List User Files (GET /files)

Lists files uploaded by the authenticated user.

Authentication: Required (JWT)

Content-Type: application/json

Example Request

curl -X GET https://upload.am/api/v1/files \
  -H "Authorization: Bearer <your_jwt_token>"

Example Response

{
  "success": true,
  "data": [{
    "id": 123,
    "fileName": "68586xxxxxx.jpg",
    "fileLink": "https://upload.am/download.php?file=68586xxxxxx.jpg",
    "uploadDate": "2025-06-23",
    "expiresAt": "2025-06-30 00:00:00",
    "fileSize": "218.94 KB"
  }]
}

6. Delete File (DELETE /file/{id})

Deletes a file by ID.

Authentication: Required (JWT)

Content-Type: application/json

Parameters

Parameter Type Required Description
id Integer Yes File ID

Example Request

curl -X DELETE https://upload.am/api/v1/file/123 \
  -H "Authorization: Bearer <your_jwt_token>"

Example Response

{
  "success": true
}

Error Codes

Code Description
200 Success
400 Bad request (e.g., missing parameters)
401 Unauthorized (invalid token or credentials)
404 Not found (file or endpoint)
410 File expired
429 Too many requests
500 Internal server error

Rate Limits

Rate limits ensure fair usage:

Exceeding limits returns 429 Too Many Requests.

Examples

Full Workflow

# Authenticate
curl -X POST https://upload.am/api/v1/auth/login \
  -d "login=example_user" \
  -d "password=example_password"

# Precheck
curl -X POST https://upload.am/api/v1/precheck \
  -d "fileName=photo.jpg" \
  -d "fileSize=1048576" \
  -H "Authorization: Bearer <your_jwt_token>"

# Upload
curl -X POST https://upload.am/api/v1/upload \
  -F "file=@photo.jpg" \
  -F "fileId=temp_68586xxxxxx" \
  -F "expiry=7" \
  -F "password=secure123" \
  -H "Authorization: Bearer <your_jwt_token>"

# List Files
curl -X GET https://upload.am/api/v1/files \
  -H "Authorization: Bearer <your_jwt_token>"

# Download
curl -X GET "https://upload.am/api/v1/download?file=68586xxxxxx.jpg&password=secure123"

# Delete
curl -X DELETE https://upload.am/api/v1/file/123 \
  -H "Authorization: Bearer <your_jwt_token>"

Support

Contact us for assistance: