Docs

Ce qui s'exécute où, et ce qui arrive ensuite.

Comment fonctionne swapfile.io

Le convertisseur et le nettoyeur de métadonnées s'exécutent entièrement dans votre navigateur grâce à la File API et au canvas. Votre fichier est lu en mémoire sur votre appareil, traité sur place et téléchargé depuis là. Pour les formats qu'un navigateur ne peut pas décoder (comme le HEIC hors Safari), un pipeline côté serveur arrive ; ces travaux seront supprimés du stockage sous une heure.

Flux des données

outils locauxfichier → votre navigateur → votre dossier de téléchargements
outils serveur (bientôt)fichier → envoi présigné → worker → lien de téléchargement → suppression auto ≤ 1 h

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.

Vérifiez par vous-même

Ouvrez les outils de développement de votre navigateur, surveillez l'onglet réseau et convertissez un fichier. Vous verrez qu'aucune requête ne transporte votre fichier.