Render 2D barcode
curl --request POST \
--url https://api.thingidentity.com/codes/render \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/vnd.thingidentity.public.v1+json' \
--data '
{
"mode": "QR_GS1_DIGITAL_LINK_URI",
"digitalLinkStem": "https://gtin.at",
"primaryKey": {
"key": "01",
"value": "09521234543213"
},
"ais": [
{
"key": "10",
"value": "LOT42"
}
]
}
'const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/vnd.thingidentity.public.v1+json'
},
body: JSON.stringify({
mode: 'QR_GS1_DIGITAL_LINK_URI',
digitalLinkStem: 'https://gtin.at',
primaryKey: {key: '01', value: '09521234543213'},
ais: [{key: '10', value: 'LOT42'}]
})
};
fetch('https://api.thingidentity.com/codes/render', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.thingidentity.com/codes/render"
payload = {
"mode": "QR_GS1_DIGITAL_LINK_URI",
"digitalLinkStem": "https://gtin.at",
"primaryKey": {
"key": "01",
"value": "09521234543213"
},
"ais": [
{
"key": "10",
"value": "LOT42"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/vnd.thingidentity.public.v1+json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 18 18\"><metadata xmlns:dc=\"http://purl.org/dc/elements/1.1/\"><dc:creator>Thing Identity</dc:creator><dc:source>https://thingidentity.com</dc:source></metadata><rect width=\"18\" height=\"18\" fill=\"#FFFFFF\"/><path fill=\"#000000\" d=\"M1,1h1v1h-1zM3,1h1v1h-1zM5,1h1v1h-1zM7,1h1v1h-1zM9,1h1v1h-1zM11,1h1v1h-1zM13,1h1v1h-1zM15,1h1v1h-1zM1,2h2v1h-2zM5,2h4v1h-4zM10,2h2v1h-2zM15,2h2v1h-2zM1,3h1v2h-1zM5,3h1v1h-1zM7,3h2v2h-2zM12,3h1v1h-1zM3,4h2v1h-2zM10,4h1v1h-1zM12,4h2v1h-2zM16,4h1v1h-1zM1,5h3v1h-3zM5,5h2v1h-2zM9,5h1v1h-1zM12,5h4v1h-4zM1,6h1v2h-1zM3,6h1v2h-1zM6,6h2v1h-2zM9,6h2v1h-2zM12,6h5v1h-5zM6,7h3v1h-3zM11,7h1v1h-1zM14,7h1v1h-1zM1,8h4v1h-4zM7,8h5v1h-5zM16,8h1v1h-1zM1,9h1v1h-1zM9,9h1v1h-1zM11,9h1v1h-1zM13,9h3v1h-3zM1,10h2v1h-2zM6,10h2v1h-2zM10,10h1v2h-1zM13,10h4v1h-4zM1,11h1v1h-1zM4,11h1v1h-1zM8,11h1v1h-1zM14,11h1v1h-1zM1,12h5v1h-5zM7,12h1v1h-1zM9,12h1v1h-1zM11,12h2v1h-2zM15,12h2v1h-2zM1,13h2v1h-2zM5,13h3v1h-3zM9,13h2v1h-2zM14,13h1v1h-1zM1,14h1v1h-1zM4,14h3v1h-3zM10,14h5v1h-5zM16,14h1v1h-1zM1,15h2v1h-2zM8,15h2v1h-2zM12,15h1v1h-1zM15,15h1v1h-1zM1,16h16v1h-16z\"/></svg>"Render 2D barcode
Render one validated code definition as SVG.
POST
/
codes
/
render
Render 2D barcode
curl --request POST \
--url https://api.thingidentity.com/codes/render \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/vnd.thingidentity.public.v1+json' \
--data '
{
"mode": "QR_GS1_DIGITAL_LINK_URI",
"digitalLinkStem": "https://gtin.at",
"primaryKey": {
"key": "01",
"value": "09521234543213"
},
"ais": [
{
"key": "10",
"value": "LOT42"
}
]
}
'const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'Content-Type': 'application/vnd.thingidentity.public.v1+json'
},
body: JSON.stringify({
mode: 'QR_GS1_DIGITAL_LINK_URI',
digitalLinkStem: 'https://gtin.at',
primaryKey: {key: '01', value: '09521234543213'},
ais: [{key: '10', value: 'LOT42'}]
})
};
fetch('https://api.thingidentity.com/codes/render', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.thingidentity.com/codes/render"
payload = {
"mode": "QR_GS1_DIGITAL_LINK_URI",
"digitalLinkStem": "https://gtin.at",
"primaryKey": {
"key": "01",
"value": "09521234543213"
},
"ais": [
{
"key": "10",
"value": "LOT42"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/vnd.thingidentity.public.v1+json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 18 18\"><metadata xmlns:dc=\"http://purl.org/dc/elements/1.1/\"><dc:creator>Thing Identity</dc:creator><dc:source>https://thingidentity.com</dc:source></metadata><rect width=\"18\" height=\"18\" fill=\"#FFFFFF\"/><path fill=\"#000000\" d=\"M1,1h1v1h-1zM3,1h1v1h-1zM5,1h1v1h-1zM7,1h1v1h-1zM9,1h1v1h-1zM11,1h1v1h-1zM13,1h1v1h-1zM15,1h1v1h-1zM1,2h2v1h-2zM5,2h4v1h-4zM10,2h2v1h-2zM15,2h2v1h-2zM1,3h1v2h-1zM5,3h1v1h-1zM7,3h2v2h-2zM12,3h1v1h-1zM3,4h2v1h-2zM10,4h1v1h-1zM12,4h2v1h-2zM16,4h1v1h-1zM1,5h3v1h-3zM5,5h2v1h-2zM9,5h1v1h-1zM12,5h4v1h-4zM1,6h1v2h-1zM3,6h1v2h-1zM6,6h2v1h-2zM9,6h2v1h-2zM12,6h5v1h-5zM6,7h3v1h-3zM11,7h1v1h-1zM14,7h1v1h-1zM1,8h4v1h-4zM7,8h5v1h-5zM16,8h1v1h-1zM1,9h1v1h-1zM9,9h1v1h-1zM11,9h1v1h-1zM13,9h3v1h-3zM1,10h2v1h-2zM6,10h2v1h-2zM10,10h1v2h-1zM13,10h4v1h-4zM1,11h1v1h-1zM4,11h1v1h-1zM8,11h1v1h-1zM14,11h1v1h-1zM1,12h5v1h-5zM7,12h1v1h-1zM9,12h1v1h-1zM11,12h2v1h-2zM15,12h2v1h-2zM1,13h2v1h-2zM5,13h3v1h-3zM9,13h2v1h-2zM14,13h1v1h-1zM1,14h1v1h-1zM4,14h3v1h-3zM10,14h5v1h-5zM16,14h1v1h-1zM1,15h2v1h-2zM8,15h2v1h-2zM12,15h1v1h-1zM15,15h1v1h-1zM1,16h16v1h-16z\"/></svg>"Render one code as an SVG file. Send a single code definition, not a
For QR modes, optional
Success returns
The SVG is black on white, with quiet zones of four modules for QR and one for Data Matrix.
It contains no printed human-readable label.
Invalid requests or codes that cannot be rendered return
codes array.
The same GS1 validation used by POST /codes applies.
This operation requires write:codes and does not save a generated-code record or a file.
Barcode modes
mode | Encoded data |
|---|---|
GS1_DATAMATRIX | GS1 element string with FNC1, Data Matrix ECC 200. |
DATAMATRIX_GS1_DIGITAL_LINK_URI | GS1 Digital Link URI in Data Matrix. Requires digitalLinkStem. |
GS1_QR | GS1 element string with FNC1 in QR Code. |
QR_GS1_DIGITAL_LINK_URI | GS1 Digital Link URI in QR Code. Requires digitalLinkStem. |
errorCorrectionLevel accepts L, M, Q or H.
Omitting it or sending null selects L. The requested level is used without automatic upgrading.
Data Matrix uses fixed ECC 200: omit errorCorrectionLevel or send null; any other value is rejected.
ais and extensionParameters may be omitted or null for empty lists.
linkType and context are optional. Each response is a single file.
Download an SVG
curl --fail-with-body -X POST 'https://api.thingidentity.com/codes/render' \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H 'Content-Type: application/vnd.thingidentity.public.v1+json' \
-H 'Accept: image/svg+xml' \
--data '{
"mode": "QR_GS1_DIGITAL_LINK_URI",
"digitalLinkStem": "https://gtin.at",
"primaryKey": { "key": "01", "value": "09521234543213" },
"ais": [{ "key": "10", "value": "LOT42" }]
}' \
--output code.svg
200 OK with Content-Type: image/svg+xml.
Example response body, shown as SVG source:
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18"><metadata xmlns:dc="http://purl.org/dc/elements/1.1/"><dc:creator>Thing Identity</dc:creator><dc:source>https://thingidentity.com</dc:source></metadata><rect width="18" height="18" fill="#FFFFFF"/><path fill="#000000" d="M1,1h1v1h-1zM3,1h1v1h-1zM5,1h1v1h-1zM7,1h1v1h-1zM9,1h1v1h-1zM11,1h1v1h-1zM13,1h1v1h-1zM15,1h1v1h-1zM1,2h2v1h-2zM5,2h4v1h-4zM10,2h2v1h-2zM15,2h2v1h-2zM1,3h1v2h-1zM5,3h1v1h-1zM7,3h2v2h-2zM12,3h1v1h-1zM3,4h2v1h-2zM10,4h1v1h-1zM12,4h2v1h-2zM16,4h1v1h-1zM1,5h3v1h-3zM5,5h2v1h-2zM9,5h1v1h-1zM12,5h4v1h-4zM1,6h1v2h-1zM3,6h1v2h-1zM6,6h2v1h-2zM9,6h2v1h-2zM12,6h5v1h-5zM6,7h3v1h-3zM11,7h1v1h-1zM14,7h1v1h-1zM1,8h4v1h-4zM7,8h5v1h-5zM16,8h1v1h-1zM1,9h1v1h-1zM9,9h1v1h-1zM11,9h1v1h-1zM13,9h3v1h-3zM1,10h2v1h-2zM6,10h2v1h-2zM10,10h1v2h-1zM13,10h4v1h-4zM1,11h1v1h-1zM4,11h1v1h-1zM8,11h1v1h-1zM14,11h1v1h-1zM1,12h5v1h-5zM7,12h1v1h-1zM9,12h1v1h-1zM11,12h2v1h-2zM15,12h2v1h-2zM1,13h2v1h-2zM5,13h3v1h-3zM9,13h2v1h-2zM14,13h1v1h-1zM1,14h1v1h-1zM4,14h3v1h-3zM10,14h5v1h-5zM16,14h1v1h-1zM1,15h2v1h-2zM8,15h2v1h-2zM12,15h1v1h-1zM15,15h1v1h-1zM1,16h16v1h-16z"/></svg>
400 Bad Request with an empty body.
For GS1 validation details in JSON, submit the code definition to
POST /codes, wrapped in a codes array.Authorizations
The access_token from POST /oauth/token.
Body
application/vnd.thingidentity.public.v1+jsonapplication/json
Barcode type. Digital Link modes require digitalLinkStem.
Available options:
GS1_DATAMATRIX, DATAMATRIX_GS1_DIGITAL_LINK_URI, GS1_QR, QR_GS1_DIGITAL_LINK_URI Example:
"QR_GS1_DIGITAL_LINK_URI"
QR only: L, M, Q or H. Omitted or null selects L for QR. For Data Matrix omit or send null.
Available options:
L, M, Q, H, null Response
SVG barcode image.
The response is of type string.