MBD CDN API Documentation

Welcome to the official documentation for the MBD CDN API. This API allows file uploads, statistics retrieval, and regional content serving.

All API routes are found at https://cdn.madebydanny.uk/

1. Upload Files

Endpoint: POST /upload

Description: Upload a file to all regions. Maximum file size: 100 MB.

Form data parameter:

Response: JSON with a universal URL and file key.

{
  "url": "https://cdn.madebydanny.uk/user-content/2025-10-18/123456_file.png",
  "key": "user-content/2025-10-18/123456_file.png"
}

2. Retrieve Stats

Endpoint: GET /stats

Description: Fetch global statistics about uploaded files and bandwidth.

Response: JSON object:

{
  "filesUploaded": 10,
  "totalBandwidth": 1.23,  // in GB
  "regionsSupported": 6
}

3. Serve Content

Endpoint: GET /user-content/{path}

Description: Redirects to the nearest regional copy of the file based on the user's location.

Example:

GET /user-content/2025-10-18/123456_file.png
Redirects to:
https://asia-public-cdn.madebydanny.uk/user-content/2025-10-18/123456_file.png

4. CORS Support

All endpoints support CORS. Preflight requests (OPTIONS) are handled automatically.

5. Error Responses

6. Example Upload Request (JavaScript)

const fileInput = document.querySelector('#file');
const formData = new FormData();
formData.append('file', fileInput.files[0]);

fetch('https://cdn.madebydanny.uk/upload', {
  method: 'POST',
  body: formData
})
.then(res => res.json())
.then(console.log)
.catch(console.error);