Docs › Money and business
QR codes and barcodes API
QR codes, UPI payment QR codes and barcodes as SVG or PNG.
Generates codes; it does not read them. What you encode is never logged or kept, and the images are not cached by shared caches.
QR code for any text
GET/v1/qrPOST
Returns the image itself. Text up to about 2,900 bytes at error correction L.
Also takes POST: The text to encode. Send it as text/plain, or as JSON {"text": "..."} with the other options beside it, up to 256 KB.
What you send here is never written to the log, and the answer is not cached.
| Parameter | Description |
|---|---|
textquery | Text to encode (or POST it). |
eccquery | Error correction: how much damage the code survives. Default M. One of: L, M, Q, H. |
formatquery | Image format. Default svg. One of: svg, png. |
sizequery | 2D codes: width in pixels to stay within, 32 to 2048. Default 256. |
marginquery | Light border (quiet zone), in modules, 0 to 16. Default 4. |
fgquery | Dark colour, hex such as 000000. Default black. |
bgquery | Light colour, hex, or transparent. Default white. |
curl
curl -o picture.png "https://api.dharun.dev/v1/qr?text=https://api.dharun.dev&format=png&size=256"HTML
<img src="https://api.dharun.dev/v1/qr?text=https://api.dharun.dev&format=png&size=256" alt="QR code for any text">Result
UPI payment QR code
GET/v1/upi-qr
A QR code any UPI app can scan to pay, built to NPCI's upi://pay link format. format=json returns the link instead of the image. Nothing is checked with a bank.
What you send here is never written to the log, and the answer is not cached.
| Parameter | Description |
|---|---|
paquery, required | Payee UPI ID, such as shop@okaxis. |
pnquery | Payee name shown in the app. |
amquery | Amount in rupees, up to two decimals. Leave out to let the payer type it. |
tnquery | Note shown with the payment, up to 80 characters. |
trquery | Your reference for the transaction. |
mcquery | Merchant category code, four digits. |
formatquery | Image format. Default svg. One of: svg, png. |
sizequery | 2D codes: width in pixels to stay within, 32 to 2048. Default 256. |
marginquery | Light border (quiet zone), in modules, 0 to 16. Default 4. |
fgquery | Dark colour, hex such as 000000. Default black. |
bgquery | Light colour, hex, or transparent. Default white. |
curl
curl -o picture.svg "https://api.dharun.dev/v1/upi-qr?pa=shop@okaxis&pn=Sri%20Murugan%20Stores&am=250&tn=Order%2042"HTML
<img src="https://api.dharun.dev/v1/upi-qr?pa=shop@okaxis&pn=Sri%20Murugan%20Stores&am=250&tn=Order%2042" alt="UPI payment QR code">Result
Barcode
GET/v1/barcode/{type}POST
Linear barcodes (code128, code39, code93, ean13, ean8, itf, codabar) and 2D codes (datamatrix, pdf417, aztec). Linear codes are sized with scale and height, 2D codes with size. No human-readable text is printed under the bars.
Also takes POST: The text to encode. Send it as text/plain, or as JSON {"text": "..."} with the other options beside it, up to 256 KB.
What you send here is never written to the log, and the answer is not cached.
| Parameter | Description |
|---|---|
typepath, required | Kind of barcode. One of: code128, code39, code93, ean13, ean8, itf, codabar, datamatrix, pdf417, aztec. |
textquery | Text to encode (or POST it). |
scalequery | Linear codes: pixels per bar module, 1 to 10. Default 2. |
heightquery | Linear codes: bar height in pixels, 10 to 600. Default 80. |
formatquery | Image format. Default svg. One of: svg, png. |
sizequery | 2D codes: width in pixels to stay within, 32 to 2048. Default 256. |
marginquery | Light border, in modules, 0 to 16. The default depends on the code. |
fgquery | Dark colour, hex such as 000000. Default black. |
bgquery | Light colour, hex, or transparent. Default white. |
curl
curl -o picture.svg "https://api.dharun.dev/v1/barcode/ean13?text=890123456789"HTML
<img src="https://api.dharun.dev/v1/barcode/ean13?text=890123456789" alt="Barcode">Result
Guides
Using an AI assistant? Connect the MCP server and it can call this API by itself.