Powerful file storage and delivery API with resumable uploads
https://cdn-625414.cmapps.eu
Use this URL as the base for all API requests.
All API requests require authentication using an API key. Include your API key in the request header:
X-API-Key: your_api_key_here
Contact your system administrator to request an API key for your application. Each API key is unique and provides access to your own isolated storage space.
API Key Format:
TUS protocol enables resumable file uploads. Perfect for large files and unstable connections.
import * as tus from 'tus-js-client';
const file = document.getElementById('file-input').files[0];
const upload = new tus.Upload(file, {
endpoint: 'https://cdn-625414.cmapps.eu/tus/',
headers: {
'X-API-Key': 'cdn_xxxxxxxxxxxxxxxxxxxxxx' // Your API key from admin panel
},
metadata: {
filename: file.name,
filetype: file.type,
originalName: file.name
},
chunkSize: 5 * 1024 * 1024, // 5MB chunks
retryDelays: [0, 1000, 3000, 5000],
onError: (error) => {
console.error('Upload failed:', error);
},
onProgress: (bytesUploaded, bytesTotal) => {
const percentage = ((bytesUploaded / bytesTotal) * 100).toFixed(2);
console.log(`Progress: ${percentage}%`);
},
onSuccess: () => {
console.log('Upload completed!');
console.log('File ID:', upload.url.split('/').pop());
}
});
upload.start();
from tusclient import client
my_client = client.TusClient('https://cdn-625414.cmapps.eu/tus/')
uploader = my_client.uploader(
'path/to/file.mp4',
headers={'X-API-Key': 'cdn_xxxxxxxxxxxxxxxxxxxxxx'},
metadata={
'filename': 'file.mp4',
'filetype': 'video/mp4'
},
chunk_size=5242880 # 5MB
)
uploader.upload()
print(f"File ID: {uploader.url.split('/')[-1]}")
curl -X GET "https://cdn-625414.cmapps.eu/v1/files?page=1&page_size=20&type=image" \ -H "X-API-Key: cdn_xxxxxxxxxxxxxxxxxxxxxx"
{
"files": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"type": "image",
"originalName": "photo.jpg",
"ext": ".jpg",
"mime": "image/jpeg",
"sizeBytes": "2048576",
"sha256": "abc123...",
"storagePath": "tenant_xyz/2024/01/15/abc123.jpg",
"createdAt": "2024-01-15T10:30:00.000Z"
}
],
"pagination": {
"page": 1,
"pageSize": 20,
"total": 45,
"totalPages": 3
}
}
Create temporary signed URLs for secure file access. This is required to access your uploaded files.
curl -X POST "https://cdn-625414.cmapps.eu/v1/signed-url" \
-H "X-API-Key: cdn_xxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"fileId": "550e8400-e29b-41d4-a716-446655440000",
"expSeconds": 7200
}'
{
"url": "/cdn/550e8400-e29b-41d4-a716-446655440000.jpg?exp=1706180400&sig=abc123...",
"path": "/cdn/550e8400-e29b-41d4-a716-446655440000.jpg",
"exp": 1706180400,
"sig": "abc123def456...",
"expiresAt": "2024-01-25T12:00:00.000Z"
}
Use the signed URL to access your files. Supports range requests and video streaming.
<!-- Direct image display --> <img src="https://cdn-625414.cmapps.eu/cdn/file-id.jpg?exp=123456&sig=abc123" /> <!-- Video streaming with player --> <video controls> <source src="https://cdn-625414.cmapps.eu/cdn/file-id.mp4?exp=123456&sig=abc123" type="video/mp4"> </video> <!-- Direct download --> <a href="https://cdn-625414.cmapps.eu/cdn/file-id.pdf?exp=123456&sig=abc123" download> Download PDF </a>
API requests are rate-limited to ensure fair usage:
The API uses standard HTTP status codes and returns errors in JSON format:
{
"error": "File not found"
}
Copy and paste this complete example to upload a file and get its URL:
// 1. Upload file using TUS
import * as tus from 'tus-js-client';
const API_KEY = 'cdn_xxxxxxxxxxxxxxxxxxxxxx'; // Replace with your API key
const API_BASE = 'https://cdn-625414.cmapps.eu';
const uploadFile = async (file) => {
return new Promise((resolve, reject) => {
const upload = new tus.Upload(file, {
endpoint: `${API_BASE}/tus/`,
headers: {
'X-API-Key': API_KEY
},
metadata: {
filename: file.name,
filetype: file.type
},
onError: reject,
onSuccess: () => {
const fileId = upload.url.split('/').pop();
resolve(fileId);
}
});
upload.start();
});
};
// 2. Generate signed URL for the uploaded file
const getSignedUrl = async (fileId) => {
const response = await fetch(`${API_BASE}/v1/signed-url`, {
method: 'POST',
headers: {
'X-API-Key': API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
fileId: fileId,
expSeconds: 3600
})
});
return response.json();
};
// 3. Complete usage
const file = document.getElementById('file-input').files[0];
const fileId = await uploadFile(file);
console.log('Uploaded file ID:', fileId);
const signedUrl = await getSignedUrl(fileId);
const fullUrl = `${API_BASE}${signedUrl.url}`;
console.log('Full file URL:', fullUrl);
// Now use fullUrl in your <img>, <video>, or download link
For additional support or questions, please contact your administrator.