Create SwissQR Bill API
What this endpoint does
PDF4me Create SwissQR Bill generates Swiss QR payment slips that comply with the Swiss QR-bill standard (Swiss Payment Standards, SPS) through a single REST call. Send creditor and ultimate debtor details, IBAN, amount, currency, reference type, language, separator style, and output format. Optionally include a source document as Base64, blob id, or URL to overlay the slip on an existing PDF. The API returns PDF, PNG, JPEG, or TIFF depending on formatType.
Authenticating Your API Request
Every PDF4me REST API call must include your API key in the Authorization header. Create or select a key from the developer dashboard and keep it secret.
Endpoint
/api/v2/CreateSwissQrBillImportant Facts You Should Not Miss
iban must start with CH followed by 19 digits. An invalid IBAN returns an error.crAddressType and udAddressType to S so street, house number, postal code, and city are stored separately. This layout is required for most automated Swiss bank reconciliation. Use K (Combined) only when you cannot split address components.NON for payments without a structured reference. QRR for a 27-digit numeric reference on domestic Swiss bills. SCOR for ISO 11649 creditor references. Include reference in the body when using QRR or SCOR.REST API endpoint
Method: POST
URL: https://api.pdf4me.com/api/v2/CreateSwissQrBill
Set IsAsync to true (PascalCase) for 202 Accepted and poll the Location URL with GET until you receive 200 and the file in JSON. Use false for a synchronous 200 response.
Postman request setup
| Setting | Value |
|---|---|
| Method | POST |
| URL | https://api.pdf4me.com/api/v2/CreateSwissQrBill |
| Headers | Content-Type: application/json |
| Authorization | Basic Auth with your API key, or header Authorization: Basic YOUR_API_KEY |
| Async | If the response is 202, poll the URL in the Location header (GET) until you get 200 and the file bytes (or JSON with document fields, depending on API version). |
Parameters
Always required: iban, crName, crAddressType, crStreetOrAddressLine1, crStreetOrAddressLine2, crPostalCode, crCity, amount, currency, udName, udAddressType, udStreetOrAddressLine1, udStreetOrAddressLine2, udPostalCode, udCity, referenceType, languageType, seperatorLine, formatType, and IsAsync.
Conditional: docContent and docName when overlaying on a PDF; reference when referenceType is QRR or SCOR; pagingOptions and pageNumber when formatType is pdf.
Optional: unstructuredMessage, billingInfo, av1, av2, profiles.
| Parameter | Required | Applies when | What it does | Example |
|---|---|---|---|---|
docContent | Conditional | Overlay on existing PDF | Omit or empty string = standalone QR slip only. Otherwise Base64 PDF/image bytes (no data: prefix), blob id from POST /api/v2/UploadBlob, or HTTPS URL to the source file. | "" |
docName | Conditional | With docContent | File name for input/output context. Omit or empty when no source document. | invoice.pdf |
iban | Yes | Every request | Creditor Swiss IBAN. | CH0200700110003765824 |
crName | Yes | Every request | Creditor name or company as registered with the bank. | Test AG |
crAddressType | Yes | Every request | S = structured (street + building) or K = combined address lines. | S |
crStreetOrAddressLine1 | Yes | Every request | If S: street name (max ~70 chars). If K: first address line. | Test Strasse |
crStreetOrAddressLine2 | Yes | Every request | If S: house number (max ~16). If K: second address line. | 1 |
crPostalCode | Yes | Every request | Creditor postal code (max ~16). | 8000 |
crCity | Yes | Every request | Creditor city (max ~35). | Zurich |
amount | Yes | Every request | Payment amount without leading zeros (string). Example: "1000" = 1000.00. | 1000 |
currency | Yes | Every request | CHF or EUR. | CHF |
udName | Yes | Every request | Ultimate debtor name or company (required by API; may be empty strings if unused). | Test Debt AG |
udAddressType | Yes | Every request | S or K; same rules as crAddressType. | S |
udStreetOrAddressLine1 | Yes | Every request | Debtor street or address line 1. | Test Deb Strasse |
udStreetOrAddressLine2 | Yes | Every request | Debtor street number or address line 2. | 2 |
udPostalCode | Yes | Every request | Debtor postal code. | 8000 |
udCity | Yes | Every request | Debtor city. | Zurich |
referenceType | Yes | Every request | NON = no reference, QRR = QR reference, SCOR = creditor reference. | NON |
reference | Conditional | referenceType = QRR or SCOR | Required for QRR or SCOR; max 27 characters. Omit for NON. | 21000000000313947143000017 |
languageType | Yes | Every request | English, German, French, or Italian. | English |
seperatorLine | Yes | Every request | API spelling is seperatorLine (one a). LineWithScissor, DottedLine, or SolidLine. | LineWithScissor |
formatType | Yes | Every request | Output format: pdf, png, jpeg, tiff, or null (default PDF behavior). | pdf |
pagingOptions | Conditional | formatType = pdf | first, last, AddPageAtEnd, or custom. Omit or null for non-PDF formats. | first |
pageNumber | Conditional | pagingOptions = custom | Integer >= 1; single page index when pagingOptions is custom. | 1 |
unstructuredMessage | No | Optional | Free-form payment note. Max 140 characters. | Thank you for your business |
billingInfo | No | Optional | Customer billing information. | Invoice for services rendered |
av1 | No | Optional | Alternative scheme parameter 1. | |
av2 | No | Optional | Alternative scheme parameter 2. | |
profiles | No | Optional | Custom API profile JSON string. See API documentation for profile options. | { "someOption": true } |
IsAsync | Yes | Every request | PascalCase IsAsync. true = HTTP 202 and poll Location. false = synchronous HTTP 200. | true |
Address type options
Applies to crAddressType and udAddressType.
S (Structured)Recommended for automated reconciliationK (Combined)Two free-form address linesSeparator line options (seperatorLine)
LineWithScissorDottedLineSolidLineReference type options
NONNo structured referenceunstructuredMessage for a free-form note instead of reference.QRR27-digit QR referencereference as a 27-digit numeric string.SCORISO 11649 creditor referencereference in ISO 11649 format (starts with RF).Output format (formatType) and PDF paging
When formatType is pdf, set pagingOptions to control where the QR slip is placed. For image output, omit pagingOptions or set it to null.
formatType: pdfpagingOptions: firstformatType: pdfpagingOptions: lastformatType: pdfpagingOptions: AddPageAtEndformatType: pdfpagingOptions: custom + pageNumberformatType: png | jpeg | tiffpagingOptions: nullOutput fields
| Field | Type | What it contains |
|---|---|---|
docName | String | Output file name. |
docContent | Base64 | Generated file (PDF or image per formatType). Decode before saving or streaming. |
Request examples
Example A: Standalone QR bill (no input PDF)
Omit docContent or send an empty string to generate only the QR payment slip.
{
"docContent": "",
"docName": "",
"iban": "CH0200700110003765824",
"crName": "Test AG",
"crAddressType": "S",
"crStreetOrAddressLine1": "Test Strasse",
"crStreetOrAddressLine2": "1",
"crPostalCode": "8000",
"crCity": "Zurich",
"amount": "1000",
"currency": "CHF",
"udName": "Test Debt AG",
"udAddressType": "S",
"udStreetOrAddressLine1": "Test Deb Strasse",
"udStreetOrAddressLine2": "2",
"udPostalCode": "8000",
"udCity": "Zurich",
"referenceType": "NON",
"languageType": "English",
"seperatorLine": "LineWithScissor",
"formatType": "pdf",
"pagingOptions": "first",
"IsAsync": true
}
Example B: Overlay QR on an existing PDF (Base64)
Replace docContent with your PDF as Base64 (no data: prefix).
{
"docContent": "JVBERi0xLjQKJeLjz9MKMy...",
"docName": "invoice.pdf",
"iban": "CH0200700110003765824",
"crName": "Test AG",
"crAddressType": "S",
"crStreetOrAddressLine1": "Test Strasse",
"crStreetOrAddressLine2": "1",
"crPostalCode": "8000",
"crCity": "Zurich",
"amount": "1000",
"currency": "CHF",
"udName": "Test Debt AG",
"udAddressType": "S",
"udStreetOrAddressLine1": "Test Deb Strasse",
"udStreetOrAddressLine2": "2",
"udPostalCode": "8000",
"udCity": "Zurich",
"referenceType": "NON",
"languageType": "English",
"seperatorLine": "LineWithScissor",
"formatType": "pdf",
"pagingOptions": "custom",
"pageNumber": 1,
"IsAsync": true
}
Example C: Copy-paste valid JSON
{
"docContent": "",
"docName": "",
"iban": "CH0200700110003765824",
"crName": "Test AG",
"crAddressType": "S",
"crStreetOrAddressLine1": "Test Strasse",
"crStreetOrAddressLine2": "1",
"crPostalCode": "8000",
"crCity": "Zurich",
"amount": "1000",
"currency": "CHF",
"udName": "Test Debt AG",
"udAddressType": "S",
"udStreetOrAddressLine1": "Test Deb Strasse",
"udStreetOrAddressLine2": "2",
"udPostalCode": "8000",
"udCity": "Zurich",
"referenceType": "NON",
"languageType": "English",
"seperatorLine": "LineWithScissor",
"formatType": "pdf",
"pagingOptions": "first",
"IsAsync": true
}
Reference type payloads
No reference (NON):
{ "referenceType": "NON" }
QR reference (QRR):
{
"referenceType": "QRR",
"reference": "21000000000313947143000017"
}
Creditor reference (SCOR, ISO 11649):
{
"referenceType": "SCOR",
"reference": "RF18539007547034"
}
formatType and pagingOptions snippets
{ "formatType": "png", "pagingOptions": null }
{ "formatType": "pdf", "pagingOptions": "last" }
{ "formatType": "pdf", "pagingOptions": "AddPageAtEnd" }
{ "formatType": "pdf", "pagingOptions": "custom", "pageNumber": 1 }
Code samples
Integration examples
Common REST integration patternsTypical ways developers call Create SwissQR Bill.
- Your ERP exports invoice data and a PDF.
- Base64-encode the PDF into
docContent. - POST payment fields with
referenceTypeQRR and a 27-digitreference. - Decode
docContentfrom the response and store or email the QR bill PDF.
- For a tear-off slip only, POST with empty
docContentandformatTypepdf or png. - For invoices from a webhook, Base64-encode the PDF into
docContent, setpagingOptionstolastorcustom, and POST payment fields. - Decode the response
docContentand upload to object storage or attach to an email API.