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 | What it does | Example |
|---|---|---|---|
| jobIdExt | Optional | Your own reference for this call. It is stored with the API call log so you can correlate calls with your jobs. Type: string. | |
| integrations | Optional | Integration identifiers, forwarded unchanged with the job's notification settings. Type: array. | |
| isAsync | Optional | Set to `true` to process the action asynchronously and get a job to poll at `/api/v2/GetActionStatus`. Only honoured by actions that support asynchronous processing. Type: boolean. | true |
| docName | Optional | Source file name including its extension. Several actions dispatch on the extension, so it should always be set; when omitted a per-action default is used. Type: string. | invoice.pdf |
| docContent | Required | The source file. Accepts the base64-encoded file content, a `pdf4meblobid://<id>` reference to a previously uploaded blob, or an `https` URL to the source document. Required: an empty value fails with `File is empty`. Type: string. | "" |
| docContentBytes | Optional | Alternative raw byte payload for the source file. Type: string. | |
| callBackUrl | Optional | Optional URL notified when an asynchronous job completes. Type: string. | |
| iban | Optional | IBAN or QR-IBAN of the creditor. Spaces and hyphens are removed. Type: string. | CH0200700110003765824 |
| crName | Optional | Name of the creditor (payee). Type: string. | Test AG |
| crAddressType | Optional | Matched case-insensitively; an unrecognised value falls back to the first entry. Type: string. | S |
| crStreetOrAddressLine1 | Optional | Creditor street (address type `S`) or first address line (address type `K`). Type: string. | Test Strasse |
| crStreetOrAddressLine2 | Optional | Creditor building number (address type `S`) or second address line with postal code and town (address type `K`). Type: string. | 1 |
| crPostalCode | Optional | Creditor postal code. Used with address type `S`. Type: string. | 8000 |
| crCity | Optional | Creditor town. Used with address type `S`. Type: string. | Zurich |
| amount | Optional | Amount to pay, e.g. `199.95`. Type: string. | 1000 |
| currency | Optional | Matched case-insensitively; an unrecognised value falls back to the first entry. Type: string. | CHF |
| udName | Optional | Name of the ultimate debtor (payer). Type: string. | Test Debt AG |
| udAddressType | Optional | Matched case-insensitively; an unrecognised value falls back to the first entry. Type: string. | S |
| udStreetOrAddressLine1 | Optional | Debtor street (address type `S`) or first address line (address type `K`). Type: string. | Test Deb Strasse |
| udStreetOrAddressLine2 | Optional | Debtor building number (address type `S`) or second address line with postal code and town (address type `K`). Type: string. | 2 |
| udPostalCode | Optional | Debtor postal code. Used with address type `S`. Type: string. | 8000 |
| udCity | Optional | Debtor town. Used with address type `S`. Type: string. | Zurich |
| referenceType | Optional | Matched case-insensitively; an unrecognised value falls back to the first entry. Type: string. | NON |
| reference | Optional | Payment reference matching `referenceType`. Spaces and hyphens are removed. Type: string. | 21000000000313947143000017 |
| unstructuredMessage | Optional | Free-text message to the creditor. Type: string. | Thank you for your business |
| billingInfo | Optional | Structured billing information for the creditor. Type: string. | Invoice for services rendered |
| av1Parameters | Optional | First alternative procedure parameter. Type: string. | |
| av2Parameters | Optional | Second alternative procedure parameter. Type: string. | |
| languageType | Optional | Matched case-insensitively; an unrecognised value falls back to the first entry. Type: string. | English |
| seperatorLine | Optional | Matched case-insensitively; an unrecognised value falls back to the first entry. Type: string. | LineWithScissor |
| pageNumber | Optional | Page of the input PDF that receives the QR bill. Overridden when `pagingOptions` is `last` or `AddPageAtEnd`. Setting it without `docContent` fails with `File is empty`. Type: integer. | 1 |
| formatType | Optional | Output format: `PDF`, `PNG`, `JPEG`, `Tiff`, `SVG` or `AddPageAtEnd` (adds a new last page to the input PDF for the bill). Defaults to `PDF`. With `PDF` and a `docContent`, the bill is placed on the input PDF; without one, a standalone bill is produced. Type: string. | pdf |
| pagingOptions | Optional | Matched case-insensitively; an unrecognised value falls back to the first entry. Type: string. | first |
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: nullRequest 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.