The Public Upload Service provides endpoints for uploading files and making them publicly accessible through URLs. This service is designed for storing images, documents, and other media that need to be easily referenced and accessed by users.

Authentication

The upload endpoint requires a valid Bearer token in the Authorization header.

Base URL

/api/public_upload

Endpoints

Upload File

Upload a file to make it publicly accessible.

curl -X POST {{baseUrl}}/api/public_upload \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F "file=@/path/to/your/file.png"

Endpoint: POST /api/public_upload

Form Data:

FieldTypeRequiredDescription
filefileYesThe file to upload

Response:

FieldTypeDescription
filenamestringThe generated filename for the uploaded file
content_typestringThe MIME type of the uploaded file
size_bytesintegerThe size of the file in bytes
public_urlstringThe public URL where the file can be accessed

Supported File Types

The service supports uploading the following file types:

  • Images: PNG, JPEG, GIF, SVG, WebP
  • Documents: PDF, TXT, DOC, DOCX, XLS, XLSX, PPT, PPTX
  • Media: MP3, MP4, WAV, AVI
  • Other: JSON, CSV, XML, ZIP

File Size Limits

  • Maximum file size: 10 MB per file
  • Total storage quota may apply based on your account tier

Error Responses

Status CodeDescription
400Bad Request - Invalid file type or file exceeds size limit
401Unauthorized - Invalid or missing token
403Forbidden - Insufficient permissions to upload files
413Payload Too Large - File size exceeds the maximum allowed limit
500Internal Server Error - Server-side error

Security Considerations

Files uploaded through this service are publicly accessible without authentication. Do not upload sensitive or confidential information. The service performs the following security measures:

  • File content scanning for malware
  • File type validation to prevent malicious file uploads
  • Randomized filenames to prevent guessing
  • CDN integration for distributed content delivery

Implementation Notes

  • Files are stored in a cloud storage bucket
  • Public URLs are generated automatically upon successful upload
  • Files may be cached by CDN for faster delivery
  • There are no automatic expiration policies for uploaded files
  • To remove a file, contact your system administrator