Developer API

Welcome to the CloudFam API. This documentation provides all the information you need to integrate with our services and manage your files programmatically.

Authentication

All API requests must be authenticated using your unique API key. The key must be included as an X-API-Key header in every request.

X-API-Key: YOUR_API_KEY

API Tester

We provide a live environment where you can test your API calls. This is a great way to understand how the API works before integrating it into your application.

Launch API Tester

Endpoints

Upload File (Direct Upload)

Uploading is a two-step process for maximum speed and reliability.

Step 1: Create an Upload URL

First, request a secure, one-time URL to upload your file to.

GET /api.php?action=create_upload_url

Success Response (200 OK)
{
    "success": true,
    "uploadURL": "https://your-r2-presigned-url.com/...",
    "key": "temp-uploads/USER_ID/UNIQUE_ID"
}

Step 2: Upload the File

Perform a PUT request to the uploadURL with the raw file data as the body.

curl --request PUT "THE_UPLOAD_URL_FROM_STEP_1" \
--header 'Content-Type: your_file_mime_type' \
--data-binary '@/path/to/your/file.zip'

Step 3: Finalize the Upload

After the upload is complete, tell our server to process the file and create a download link.

POST /api.php?action=finalize_upload

Request Body
{
    "key": "THE_KEY_FROM_STEP_1",
    "original_filename": "my-awesome-file.zip"
}
Success Response (201 Created)
{
    "success": true,
    "message": "File finalized successfully.",
    "download_link": "https://cloudfam.io/a1b2c3d4e5f6"
}

View Files

Retrieve a list of all your active files.

GET /api.php?action=view_files

Success Response (200 OK)

{
    "success": true,
    "files": [
        {
            "id": 1,
            "original_filename": "document.pdf",
            "file_size_bytes": 102400,
            "download_count": 150,
            "uploaded_at": "2025-08-14 10:00:00"
        }
    ]
}

Delete Files

Move one or more files to the trash.

POST /api.php?action=delete_files

Request Body

{
    "file_ids": [1, 2, 3]
}

Success Response (200 OK)

{
    "success": true,
    "message": "3 file(s) moved to trash."
}

See Traffic Quality

Retrieve your current traffic quality score.

GET /api.php?action=traffic_quality

Success Response (200 OK)

{
    "success": true,
    "traffic_quality_score": 85
}