REST API Reference

Stateless HTTP endpoints for binary ingestion, deterministic short_code allocation, and instant CDN-ready retrieval.

Architecture Flow

Client App
Laravel API
Disk Storage
Predictable Payloads

JSON responses for everything except successful file delivery (binary stream).

Deterministic URLs

Every upload returns a stable, CDN-friendly URL instantly.

Base URL

Derived from APP_URL. Ensure this is correct for link generation.

Base URL

Authentication

Authentication is currently disabled in this environment.

Operational Limits

Max Upload Size 20,480 KB
Allowed Extensions jpg, jpeg, png, gif, webp, pdf, zip, txt, csv, xlsx, doc, docx
Storage Disk public (mapped via storage:link)

Endpoints Summary

Method Endpoint Description
POST /api/upload Upload a new file
GET /file/{code} Retrieve file binary
GET /file/{code}/info Get metadata only
DELETE /api/file/{code} Delete file & meta
POST

Upload File

https://dochost.online/api/upload

Accepts multipart/form-data. The field name must be file.

Response (201 Created)
{
  "success": true,
  "id": 1,
  "original_name": "report.pdf",
  "size": 1024,
  "mime_type": "application/pdf",
  "short_code": "AbCd12",
  "url": "https://dochost.online/file/AbCd12",
  "delete_url": "https://dochost.online/api/file/AbCd12"
}
GET

Retrieve File

https://dochost.online/file/{short_code}
  • Returns the raw file content with correct Content-Type.
  • Increments the views counter.
  • Returns 404 if not found, 410 if expired.
GET

Get Metadata

https://dochost.online/file/{short_code}/info
{
  "success": true,
  "id": 1,
  "original_name": "report.pdf",
  "short_code": "AbCd12",
  "views": 42,
  "mime_type": "application/pdf",
  "exists_on_disk": true
}
DELETE

Delete File

https://dochost.online/api/file/{short_code}

Permanently removes the file from disk and the database record. Requires API Key if configured.

cURL Examples

Upload (Bash)
curl -X POST "https://dochost.online/api/upload" \
  -H "Accept: application/json" \
    -F "file=@/path/to/image.png"
Get Info
curl "https://dochost.online/file/SHORTCODE_HERE/info" \
  -H "Accept: application/json"
Documentation