SVG to PDF API

Convert svg files to pdf with a single POST request. Upload a file as multipart/form-data and the API returns a download URL for the converted file.

Input

svg

Output

pdf (application/pdf)

Credit cost

2 per file

Max file size

Per plan (10–500 MB)

Endpoint

POSThttps://api.fileswitch.co/api/v1/converter/svg-to-pdf

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 2 credits 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/svg-to-pdf \
  -H "Authorization: Bearer fc_YOUR_API_KEY" \
  -F "file=@input.svg" \
  -F "pageSize=A4" \
  -F "marginMm=10" \
  -F "fit=contain" \
  -F "background=transparent" \
  -F "density=150"

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 .svg
pageSizestringA4

Output page size.

Values: A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, B0, B1, B2, B3, B4, B5, Letter, Legal, Ledger, Tabloid

landscapebooleanfalse

Place the image on a landscape page.

marginMmnumber10

Page margin around the image in millimeters.

Range: 0 .. 100

fitstringcontain

How the image fits on the page.

Values: contain, cover, fill

backgroundstringtransparent

Page background color (hex like #ffffff or "transparent").

densitynumber150

Rasterization density in DPI; only affects vector inputs such as SVG.

Range: 72 .. 1200

Example request bodyjson
{
  "file": "input.svg",
  "pageSize": "A4",
  "landscape": false,
  "marginMm": 10,
  "fit": "contain",
  "background": "transparent",
  "density": 150
}

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 svgpdf? Start free — no credit card required.