API reference
QR images endpoints
Download the QR image for a QR code or a digital business card.
Download a QR image
Returns the rendered QR image for a QR code or a digital business card.
API key required. Scope: qr:read or cards:read. Campaign-scoped keys are refused. Plan: Pro, or the Business card plan.
Request
| Header | Required | Value |
|---|---|---|
Authorization | Required | Bearer YOUR_API_KEY. X-API-Key: YOUR_API_KEY is accepted instead. |
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | A QR code id or a card id. |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
format | string | Optional | File format. svg and pdf stay sharp at any print size. One of png, svg, pdf, jpeg, webp. Default: png. |
size | integer | Optional | Width in pixels, 128 to 4096. A framed code is taller than it is wide. pdf is one page at 300 dpi. Default: 512. |
transparent | boolean | Optional | true leaves the background clear. png, webp and svg only. Default: false. |
download | boolean | Optional | true answers with Content-Disposition: attachment so a browser saves the file. Default: false. |
Example request
curl "https://api.qrbold.com/api/public/v1/qr-codes/cmf3k2a9x0001/image?format=png&size=1024" \
-H "Authorization: Bearer $QRBOLD_API_KEY" \
--output qr.pngResponse
200 The image bytes, with a matching Content-Type and a suggested filename. Cached privately for an hour.
Errors
| Status | Code | When | Retry? |
|---|---|---|---|
422 | validation_failed | The request body or the query string did not pass validation. | Only after changing the request or the account |
404 | resource_not_found | Nothing with that id exists in this account. | No |
Every endpoint can also answer 401 invalid_api_key, 403 forbidden, 403 upgrade_required_api, 404 unknown_endpoint, 429 rate limited and 500 internal_error. One failing response is shown below.
422 response
{
"error": {
"type": "invalid_request",
"code": "validation_failed",
"message": "One or more fields are invalid.",
"details": [
{
"field": "fields.links.0.type",
"message": "Invalid enum value",
"code": "invalid_enum_value"
},
{
"field": "shortCode",
"message": "Slugs can only contain letters, numbers, and hyphens",
"code": "invalid_string"
}
]
}
}Good to know
- The image encodes exactly the url reported by the card or QR code object, drawn with the design saved in the dashboard.
- This link needs your API key, so it cannot be used as an image address in a web page or an email. Download the file and host it, or generate the image yourself from url.