API Documentation
Programmatic access to Akane CDN. This documentation covers authentication, endpoints, request/response formats, and practical code examples.
Overview
The Akane CDN API lets you upload files, retrieve them via short IDs, fetch file metadata, and list stored files. Base URL: https://cdn.akane.web.id
Authentication
The upload endpoint requires a Bearer token. Set the Authorization header to your SECRET_TOKEN value.
# Replace placeholders with your actual values
curl -X POST "https://cdn.akane.web.id/upload" \
-H "Authorization: Bearer <SECRET_TOKEN>" \
-F "file=@/path/to/your/file.png" \
-F "isPermanent=true"
Note: Other endpoints (GET /:id, GET /info/:id, GET /list) are public unless you add additional protections.
POST /upload
Upload a file via multipart/form-data. Supports optional expiration.
curl -X POST "https://cdn.akane.web.id/upload" \
-H "Authorization: Bearer <SECRET_TOKEN>" \
-F "file=@/path/to/your/file.png" \
-F "isPermanent=false" \
-F "expirationHours=24"
const token = process.env.SECRET_TOKEN // set in your env
const form = new FormData()
form.append('file', new Blob([/* file Buffer */]), 'file.png')
form.append('isPermanent', 'false')
form.append('expirationHours', '24')
const res = await fetch('https://cdn.akane.web.id/upload', {
method: 'POST',
headers: { Authorization: `Bearer ${token}` },
body: form
})
const json = await res.json()
console.log(json)
{
"success": true,
"file": {
"id": "aB3xY12",
"filename": "1723206123-abc123.png",
"originalFilename": "file.png",
"mimetype": "image/png",
"size": 123456,
"url": "https://cdn.akane.web.id/aB3xY12",
"directUrl": "https://ik.imagekit.io/.../file.png",
"isPermanent": false,
"expiresAt": "2025-08-10T12:34:56.000Z"
}
}
GET /:id
Fetches the file by its short ID. Streams the content and forwards Content-Type and Content-Length from the origin.
curl -i "https://cdn.akane.web.id/aB3xY12"
GET /info/:id
Returns metadata for a given file ID.
curl "https://cdn.akane.web.id/info/aB3xY12"
{
"success": true,
"file": {
"id": "aB3xY12",
"filename": "1723206123-abc123.png",
"originalFilename": "file.png",
"mimetype": "image/png",
"size": 123456,
"url": "https://cdn.akane.web.id/aB3xY12",
"directUrl": "https://ik.imagekit.io/.../file.png",
"uploadedAt": "2025-08-09T12:00:00.000Z",
"isPermanent": false,
"expiresAt": "2025-08-10T12:00:00.000Z",
"isExpired": false
}
}
GET /list
Lists files with pagination. Query params: page (default 1), limit (default 10).
curl "https://cdn.akane.web.id/list?page=1&limit=12"
{
"success": true,
"files": [
{
"id": "aB3xY12",
"filename": "1723206123-abc123.png",
"originalFilename": "file.png",
"mimetype": "image/png",
"size": 123456,
"url": "https://cdn.akane.web.id/aB3xY12",
"directUrl": "https://ik.imagekit.io/.../file.png",
"uploadedAt": "2025-08-09T12:00:00.000Z",
"isPermanent": false,
"expiresAt": "2025-08-10T12:00:00.000Z",
"isExpired": false
}
],
"pagination": { "page": 1, "limit": 12, "total": 12584, "totalPages": 1049 }
}
Web Endpoints
- GET / – Upload page (browser form)
- POST /web-upload – Upload via web form
- GET /files – File management UI
- GET /result/:fileId – Post-upload summary page
Errors
- 400 – No file provided (upload)
- 401/403 – Missing or invalid token (upload)
- 404 – File not found
- 410 – File has expired
- 500 – Internal server error
{
"error": "File not found"
}