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.

cURL
# 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
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"
Node.js (fetch)
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)
Response (201)
{
  "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.

Example
curl -i "https://cdn.akane.web.id/aB3xY12"
404 if file not found. 410 if the file has expired.

GET /info/:id

Returns metadata for a given file ID.

Example
curl "https://cdn.akane.web.id/info/aB3xY12"
Response (200)
{
  "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).

Example
curl "https://cdn.akane.web.id/list?page=1&limit=12"
Response (200)
{
  "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 (JSON)
{
  "error": "File not found"
}