Documentation

Everything you need to upload, host, and embed images, videos, and files.

Quick start

Upload a file and get a permanent URL in one request.

curl -X POST https://blazeimg.pignatiello.online/api/upload \
  -F "file=@photo.png"

Response: { "url": "https://blazeimg.pignatiello.online/api/file/users/.../photo.png", "key": "...", "size": 12345, "type": "image/png" }

API Reference

POST/api/upload

Upload a file. Returns a permanent URL.

Auth: optional (associates with user if signed in, otherwise "anonymous")

Body: multipart/form-data with field file, or url to fetch a remote file

Limits: images 10MB, videos 50MB, code files 5MB

Supported: PNG, JPG, WebP, GIF, AVIF, SVG, MP4, WebM, MOV, HTML, CSS, JS, TS, JSX, TSX, JSON, XML, TXT

GET/api/images

List your uploaded images.

Auth: required

DELETE/api/images

Delete an image by key.

Auth: required

Body: { "key": "users/.../file.png" }

GET/api/file/{key}

Serve any uploaded file with correct Content-Type and CORS headers.

Cache: public, max-age=31536000, immutable

CORS: Access-Control-Allow-Origin: *

POST/api/remove-bg

Remove image background via API4AI. Returns PNG.

Auth: required

Body: multipart/form-data with field file

GET/api/health

Health check.

Image transforms

Append query params to any file URL to resize or convert on the fly.

/api/file/users/.../photo.png?w=400&h=300&fit=cover&f=webp&q=80

Params: w, h, fit (cover/contain/fill/inside/outside), f (webp/avif/jpeg/png), q (1-100). Format auto-negotiates from the Accept header when f is omitted.

React components

Drop-in components for uploading and displaying files.

// 1. Copy src/components/blazeimg-uploader.tsx and blazeimg-media.tsx into your project.

// Upload
<BlazeImgUploader apiKey="blz_..." folder="videos" onUpload={(r) => setVideoUrl(r.url)}>
  Upload video
</BlazeImgUploader>

// Display with transforms
<BlazeImgMedia src={videoUrl} width={640} format="webp" quality={80} />

// 2. Or use the vanilla SDK via script tag:
// <script src="https://blazeimg.pignatiello.online/sdk.js"></script>
// BlazeImg.upload(file, { apiKey: "blz_..." }).then(r => console.log(r.url));
// BlazeImg.transformUrl(url, { width: 640, format: "webp" });

Uploader calls /api/upload and returns { url, key, size, type }. Media applies transform params automatically. Vanilla SDK exposes BlazeImg.upload, transformUrl, signUrl.

Downloads: blazeimg-uploader.tsx · blazeimg-media.tsx · sdk.js

Embeddable uploader

Embed a file uploader in any app. The widget communicates via postMessage.

<iframe src="https://blazeimg.pignatiello.online/embed/uploader" width="100%" height="300" style="border:none"></iframe>

Messages sent to parent:

  • { type: "blazeimg:ready" }: widget loaded
  • { type: "blazeimg:upload", url, key, size, mimeType }: upload success
  • { type: "blazeimg:error", error }: upload failed

Framework examples

HTML

<img src=".../photo.png" />
<video src=".../clip.mp4" controls />

React

const url = ".../photo.png";
<img src={url} alt="x" />

Angular

imageUrl = ".../photo.png";
<img [src]="imageUrl" />