Create QR codes with the API
Make a styled QR code from your own code, change its design later and download it as SVG.
Open the QR codes referenceWhen codes are made by the hundred, for table cards, packaging or event badges, a script is quicker than a form. The API creates the short link and its QR code in one call and returns the drawing.
Before you start
- An access token. Make your first API request shows how to get one from an API key.
Create a code for a URL
Post the long URL to
/api/v1/qr_codes. Lnki shortens it and makes the code for the new short link. The response is201 Createdwith the code, includingscan_url, the address it encodes, andsvg, the drawing itself.To choose the back-half yourself, create the link first and send its
link_idinstead ofdestination_url.Create a QR codecurl -X POST https://lnki.io/api/v1/qr_codes \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "destination_url": "https://example.com/menu/autumn", "name": "Autumn menu" }'Style it
Add a
designobject to control the drawing: colours, the shape of thepattern,eyesandcorners, thesizein pixels, alogoand alabelunder the code. Every field is optional.A field the API does not know, or a value out of range, is refused with
422and named inerrors, and nothing is created.With a designcurl -X POST https://lnki.io/api/v1/qr_codes \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "destination_url": "https://example.com/menu/autumn", "name": "Autumn menu", "design": { "foreground_color": "#6D28D9", "pattern": "dots", "eyes": "rounded", "size": 600, "label": { "text": "Scan for the menu" } } }'Keep strong contrast between the foreground and background colours, and scan the result with a phone before you print a batch.
Change the design later
A
PATCHchanges only the design fields you name and redraws the code. The code keeps pointing at the same short link, so copies already printed keep working.Update one fieldcurl -X PATCH https://lnki.io/api/v1/qr_codes/7315 \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "design": { "background_color": "#F5F3FF" } }'Download the image
/imagereturns the drawing as an SVG file, which stays sharp at any print size.Save the SVGcurl https://lnki.io/api/v1/qr_codes/7315/image \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ --output autumn-menu.svg
Find it in the dashboard
Codes made through the API are ordinary QR codes: they are listed under QR Codes, count their scans, and can be restyled there too.
What you have now
Your code can produce branded, trackable QR codes on demand. Every design field and its allowed values are in the API reference.
