File Operations

Manage files within your buckets — upload, download, list, and delete — all through the dashboard or API.

Uploading Files

Via Dashboard

  1. Select a bucket from the list
  2. Drag and drop files onto the upload zone, or click to browse
  3. Files upload immediately with a progress indicator
Supported file types are detected automatically by MIME type: images (PNG, JPG, GIF, SVG), documents (PDF, TXT, JSON), archives (ZIP), audio (MP3), and video (MP4).

Via API

curl
curl -X POST https://api.sparkdb.pro/api/v1/buckets/1/files \
  -H "x-api-key: spk_your_api_key" \
  -F "file=@./screenshot.png"
The file field must be a multipart form-data upload. Single file per request.

Storage Limit Check

Before uploading, the system checks your plan’s storage limit. If the upload would exceed the limit, the API returns:
HTTP 409 Conflict
{
  "error": "Storage limit exceeded",
  "message": "Storage limit exceeded: 1 GB. Upgrade to increase your limit."
}

Downloading Files

Public Buckets

Files in public buckets are accessible directly via their S3 URL:
https://bucket.sparkdb.pro/spark-{userId}-{name}-{rand4}/{filename}
No authentication required.

Private Buckets

Files in private buckets are served through the API:
https://api.sparkdb.pro/api/v1/buckets/{bucketId}/files/{filename}
Requires authentication via API key header.

Via Dashboard

Click the copy icon next to any file in the dashboard to copy its URL to your clipboard.

Listing Files

Via Dashboard

Select a bucket to see all its files in a table with filename, size, content type, and action buttons.

Via API

curl
curl https://api.sparkdb.pro/api/v1/buckets/1/files \
  -H "x-api-key: spk_your_api_key"
JSON Response
{
  "data": [
    {
      "id": "1/avatar.png",
      "bucket_id": 1,
      "filename": "avatar.png",
      "size": 245760,
      "content_type": "image/png",
      "url": "https://bucket.sparkdb.pro/.../avatar.png",
      "created_at": "2025-06-15T10:30:00Z"
    }
  ]
}

Deleting Files

Via Dashboard

Click the trash icon next to any file to delete it immediately — no confirmation dialog.

Via API

curl
curl -X DELETE https://api.sparkdb.pro/api/v1/buckets/1/files/avatar.png \
  -H "x-api-key: spk_your_api_key"
JSON Response
{
  "message": "File deleted successfully"
}
After deletion, the bucket’s storage bytes and object count are recalculated automatically.

File URLs Explained

Public Bucket URL Pattern

https://bucket.sparkdb.pro/{s3_bucket_name}/{filename}
  • bucket.sparkdb.pro — public S3 endpoint
  • {s3_bucket_name} — auto-generated MinIO bucket name (e.g., spark-42-my-assets-a1b2)
  • {filename} — original uploaded filename

Private Bucket URL Pattern

https://api.sparkdb.pro/buckets/{bucketId}/files/{filename}
  • {bucketId} — numeric SparkDB bucket ID
  • {filename} — original uploaded filename

MIME Type Detection

SparkDB auto-detects content types for common file extensions:
ExtensionContent Type
.pngimage/png
.jpg, .jpegimage/jpeg
.gifimage/gif
.svgimage/svg+xml
.pdfapplication/pdf
.txttext/plain
.jsonapplication/json
.zipapplication/zip
.mp3audio/mpeg
.mp4video/mp4