Dokumentasi

Apa yang berjalan di mana, dan apa yang akan datang.

Cara kerja swapfile.io

Konverter dan pembersih metadata berjalan sepenuhnya di browser kamu memakai File API dan canvas. File kamu dibaca ke memori di perangkatmu, diproses di sana, dan diunduh dari sana. Untuk format yang tidak bisa dibaca browser (seperti HEIC di luar Safari), pipeline sisi server sedang disiapkan; pekerjaan itu akan dihapus dari penyimpanan dalam satu jam.

Alur data

alat lokalfile → browser kamu → folder unduhanmu
alat server (segera)file → unggahan presigned → worker → tautan unduhan → hapus otomatis ≤ 1 jam

API

Convert files from your own code with a REST API. It runs the same server pipeline as the site: you register an upload, send the bytes, start a conversion job, then download the result — all authenticated with an API key.

Create an API key in your account

Authentication

Every request carries your key in the Authorization header (Bearer), or an X-API-Key header. Treat it like a password — it spends your account's conversion quota.

https://api.swapfile.ioLive
curl https://api.swapfile.io/v1/jobs/{id} \
    -H "Authorization: Bearer sf_live_..."

Converting a file

heic → jpeg
# 1 · register the upload → presigned URL
curl -X POST https://api.swapfile.io/v1/uploads \
    -H "Authorization: Bearer sf_live_..." \
    -H "Content-Type: application/json" \
    -d '{"size": 48213}'
→ {"file_id":"9f2c…","upload_url":"https://…"}

# 2 · send the raw bytes to that URL
curl -X PUT --upload-file photo.heic "$UPLOAD_URL"

# 3 · start the conversion
curl -X POST https://api.swapfile.io/v1/jobs \
    -H "Authorization: Bearer sf_live_..." \
    -H "Content-Type: application/json" \
    -d '{"file_id":"9f2c…","operation":"convert:jpeg","params":{"quality":"82"}}'
→ 202 {"id":"7ab1…","status":"queued"}

# 4 · poll until done, then download
curl https://api.swapfile.io/v1/jobs/7ab1… \
    -H "Authorization: Bearer sf_live_..."
→ {"status":"done","download_url":"https://…"}

Endpoints

POST/v1/uploadsRegister an upload; returns a presigned PUT URL.
PUT{upload_url}Send the raw file bytes (max 100 MB).
POST/v1/jobsStart a conversion job for an uploaded file.
GET/v1/jobs/{id}Job status; includes download_url once done.
DELETE/v1/jobs/{id}Delete the file and job immediately.

Operations

Pass one of these as the operation. Accepted inputs include JPEG, PNG, WebP, GIF, BMP, HEIC, AVIF and TIFF.

convert:jpeg→ JPEG · params: quality (1–100)
convert:png→ PNG (lossless)
convert:webp→ WebP · params: quality (1–100)

Limits

  • 100 MB max upload
  • 30 conversions / day (free)
  • 60 requests / minute per key
  • Files auto-deleted within 1 hour

Errors

Failures return RFC 9457 problem+json with a stable code field — for example unauthorized, unsupported_format, file_too_large, quota_exceeded or rate_limited.

Buktikan sendiri

Buka developer tools di browser kamu, pantau tab network, lalu konversi sebuah file. Kamu tidak akan melihat satu pun request yang membawa file kamu.