Format Compact Credential as a QR Code

Introduction

Compact or semantic compact credentials through MATTR VII are defined as representations of verifiable data that can be wholly represented in a 2D barcode, such as a QR code. This guide will step through how to generate a QR code, which can be presented to a verifier app, or as a file uploaded to the verifier API. 

Prerequisites

You need the following in order to proceed with this tutorial: 

  • Access to the MATTR VII APIs

  • A signed compact or semantic compact credential issued by your organization 

If you’re experiencing any difficulties, contact us

Generate a QR code

The desired width of the output QR code can be specified using the optional width parameter. The maximum size of the width is 1000px. If the width is not specified, the QR code library will generate a QR code with optimized width based on the size of the payload in the request.  

Compact Credential 

Request 

http
Copy to clipboard.
1POST https://YOUR_TENANT_SUBDOMAIN.vii.mattr.global/core/v2/credentials/compact/qrcode
json
Copy to clipboard.
1{
2  "payload": "CSC:/1/2KCE3IQEJB5DCMSMGZDHUUYBE2QFSAL5VMAXQNDENFSDU53FMI5G2YLUORZC2ZDJMR3WKYRNORSXG5BONZSXI3DJMZ4S4YLQOA5EIRKWHJWG6YLEORSXG5DFOICBVFP2YYZAKGS2L74K4ZDOMFWWK32FNVWWCICKMFXGKICUMFZW2YLEMNXWIZLGJBJS4MRXHBYWGZLSORUWM2LDMF2GS33OJZQW2ZLSK5XXE23JNZTSAYLUEBEGK2LHNB2HG4TDMVZHI2LGNFRWC5DJN5XEYZLWMVWGOTDFOZSWYIBUNJUXG43VMVZE4YLNMV4BQQLEOZQW4Y3FMQQFGYLGMV2HSICUOJQWS3TJNZTWMZLYOBUXE6LKGIYDENRNGAYS2MBRHIAACAAAUIBBSAS4AN4IA2DUORYHGORPF5WG6YLEFV2GK43UNFXGOLTQNRQXIZTPOJWS4ZDFOYXG2YLUORZGYYLCOMXGS3ZPMNXXEZJPOYZC6Y3SMVSGK3TUNFQWY4ZPMNXW24DBMN2C64TFOZXWGYLUNFXW4LLMNFZXI4ZPMMYGEY3GMMZDALJRGUYTILJUHA4TSLLBGQ2TCLJZGNRGGY3GHFQTON3BHED5QQCQGNQJXK7NYZDAXN3JOR6WEYYHOBMEBAUOXZHFGWFPR4LR6V3KLIFH25CNPBZB5LH2AW42YW3KSNPD2DPBKSWN3CLVMOZOJGUKNCNDSHR6X5RRGRJ562P3HEMXUQK367MBGPYA",
3  "width": 800
4}

Semantic Compact Credential 

Request 

http
Copy to clipboard.
1POST https://YOUR_TENANT_SUBDOMAIN.vii.mattr.global/core/v2/credentials/compact-semantic/qrcode
json
Copy to clipboard.
1{
2  "payload": "CSS:/1/2KCE3IQEJB5DCMSLO5CVQ2YBE2QFSAKTUUAXQNDENFSDU53FMI5G2YLUORZC2ZDJMR3WKYRNORSXG5BONZSXI3DJMZ4S4YLQOA5EIRKWHJVWK3TIHJWG6Y3BNRRHMY5DNBAGG33OORSXQ5EBPATGQ5DUOBZTULZPO53XOLTXGMXG64THF4ZDAMJYF5RXEZLEMVXHI2LBNRZS65RRMR2HS4DFQF2FMZLSNFTGSYLCNRSUG4TFMRSW45DJMFWHCY3SMVSGK3TUNFQWYU3VMJVGKY3UUFTGG3DBNFWTCZTDNRQWS3JRHIAACAAAUJSWS3TEMV4AAY3VOJWHQ7DIOR2HA4Z2F4XTMOLGHEWTGLJSGQWTCNBQFU4DILTOM5ZG62ZONFXS6Y3POJSS65RSF5RXEZLEMVXHI2LBNRZS6Y3PNVYGCY3UFVZWK3LBNZ2GSYZPOJSXM33DMF2GS33OFVWGS43UOMXWINTGHFTDEM3BFVRWEOJUFU2GCNJXFU4TKOJRFVSDCY3BGQ2TONRQGI3GIB6YIBINRB4HSIVBUTOCTS5I7MVTEPXUSBI2MJ3AG22YIAOU3RQSKPRMW2UDKRMX2PDWCGIHMTHVL3EVFSAIBDXXHE6BJZJTSUAUZTIGSZCXQVO2KF5AYL6AA7SNZ3PEXT7XYGPM6UVNG6PFXBJZ",
3  "width": 800
4}

Response 

The returned QR Code/PNG containing the encoded credential can then be used in a paper-based or digital setting to allow someone to hold the credential and later present it for scanning by verification capability. 

Errors

If the provided payload is invalid, the API will return an error, examples include:  

  • 400 Payload is not a string 

  • 400 Payload does not belong to the Compact Credential profile 

  • 400 The generated QR code is larger than the provided width 

  • 413 The payload is too large to be stored in a QR code