QR Code Generator API

Convert txt, md, csv, json, xml, url, log, text, html files to png, svg with a single POST request. Upload a file as multipart/form-data and the API returns a download URL for the converted file.

Input

txt, md, csv, json, xml, url, log, text, html

Output

png, svg (image/png)

Credit cost

1 per file

Max file size

Per plan (10–500 MB)

Endpoint

POSThttps://api.fileswitch.co/api/v1/converter/qr-generate

Authentication is optional for guests and recommended for production. Send either an API key or a JWT access token as a Bearer token. Authenticated requests deduct 1 credit from your balance; failed conversions are refunded. See Authentication for details.

Quick start

The same request in every supported language. Each example uploads a file and prints the downloadUrl from the response.

Example request
curl -X POST https://api.fileswitch.co/api/v1/converter/qr-generate \
  -H "Authorization: Bearer fc_YOUR_API_KEY" \
  -F "file=@input.txt" \
  -F "errorCorrectionLevel=M" \
  -F "size=400" \
  -F "margin=8" \
  -F "format=png" \
  -F "darkColor=#000000" \
  -F "lightColor=#ffffff" \
  -F "scale=0"

Parameters

Send file plus any optional options. Every option is optional and falls back to its default when omitted.

FieldTypeDefaultDescription
filebinaryThe file to convert. Accepts .txt , .md , .csv , .json , .xml , .url , .log , .text , .html
errorCorrectionLevelstringM

Error correction: L ~7%, M ~15%, Q ~25%, H ~30%.

Values: L, M, Q, H

sizenumber400

Width/height of the output image in pixels.

Range: 100 .. 4000

marginnumber8

Quiet-zone width in modules around the QR grid.

Range: 0 .. 64

formatstringpng

Output format.

Values: png, svg

darkColorstring#000000

Color of the dark modules.

lightColorstring#ffffff

Color of the background.

scalenumber0

Pixel size of each module; 0 = auto.

Range: 0 .. 20

Example request bodyjson
{
  "file": "input.txt",
  "errorCorrectionLevel": "M",
  "size": 400,
  "margin": 8,
  "format": "png",
  "darkColor": "#000000",
  "lightColor": "#ffffff",
  "scale": 0
}

Response

Every conversion endpoint returns the same success / message / data envelope. The data object is a Conversion record with a temporary downloadUrl.

Response bodyjson
{
  "success": true,
  "message": "Conversion completed",
  "data": {
    "id": "b10a5f2e-8c1e-4b3a-9c1d-2e3f4a5b6c7d",
    "inputFormat": "html",
    "outputFormat": "pdf",
    "inputFileName": "document.html",
    "outputFileName": "document.pdf",
    "inputFileSize": 45210,
    "outputFileSize": 88431,
    "status": "completed",
    "error": null,
    "creditCost": 2,
    "downloadUrl": "/api/v1/converter/download/conversions%2Fb10a5f2e-8c1e-4b3a-9c1d-2e3f4a5b6c7d%2Foutput.pdf",
    "createdAt": "2026-07-31T13:00:00.000Z",
    "completedAt": "2026-07-31T13:00:02.000Z"
  }
}

Prepend https://api.fileswitch.co/api/v1 to the downloadUrl and download with the same credentials. Files are retained temporarily and auto-deleted. See the full field reference in Response Schema.

Related conversions

Ready to convert txt, md, csv, json, xml, url, log, text, htmlpng, svg? Start free — no credit card required.