ForUploads.com API Documentation

A robust file upload and management API service that allows users to securely upload, manage, and retrieve files.

Base URL: https://api.foruploads.com/v1

Features

Authentication

Authentication Types

1. JWT Authentication (for user management)

2. API Key Authentication (for file operations)

API Endpoints

Authentication Endpoints

Register User

POST /v1/auth/register

Request Body:

{
    "username": "string",
    "email": "string",
    "password": "string"
}

Response:

{
    "message": "Registration successful",
    "token": "jwt_token",
    "apiKey": "api_key",
    "user": {
        "id": "user_id",
        "username": "username",
        "email": "email"
    }
}

Login

POST /v1/auth/login

Request Body:

{
    "email": "string",
    "password": "string"
}

Get Current API Key

GET /v1/auth/api-key

Headers: token: jwt_token

Regenerate API Key

POST /v1/auth/regenerate-api-key

Headers: token: jwt_token

File Management

All file endpoints require the apiKey header.

Upload File

POST /v1/files/upload

Headers: apiKey: your_api_key

Content-Type: multipart/form-data

Body: file: [file]

Get All Files

GET /v1/files

Headers: apiKey: your_api_key

View Specific File

GET /v1/files/:fileId

Headers: apiKey: your_api_key

Delete File (Soft Delete)

DELETE /v1/files/:fileId

Headers: apiKey: your_api_key

Get Deleted Files

GET /v1/files/deleted

Headers: apiKey: your_api_key

Restore Deleted File

POST /v1/files/restore/:fileId

Headers: apiKey: your_api_key

Get Upload Statistics

GET /v1/files/stats

Headers: apiKey: your_api_key

Response:

{
    "totalFiles": 12340,
    "filesToday": 120,
    "filesThisMonth": 2340,
    "totalStorage": 51712000000,
    "storageUsed": 51712000000,
    "storageAvailable": 107374182400,
    "successRate": 99.2,
    "failedRate": 0.8,
    "retries": 25
}

Settings

Update Username

PUT /v1/settings/username

Headers: token: jwt_token

Request Body:

{
    "newUsername": "new_username"
}

Update Email

PUT /v1/settings/email

Headers: token: jwt_token

Request Body:

{
    "newEmail": "new.email@example.com"
}

Update Password

PUT /v1/settings/password

Headers: token: jwt_token

Request Body:

{
    "currentPassword": "current_password",
    "newPassword": "new_password"
}

File Types and Restrictions

Supported File Types

File Restrictions

Error Handling

Error Response Format:

{
    "error": "Error message",
    "details": "Additional error details (in development mode)"
}

Common Error Codes

Code Description
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error

Security Considerations