Format Compact Credential as a PDF
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. Credentials can be presented in the form of a paper-based or digital PDF file. This guide will step through how to create a PDF containing a Compact Credential, 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 and encoded compact or semantic compact credential issued by your organization
A PDF template
If you’re experiencing any difficulties, contact us.
Generate a PDF
This API creates a PDF file based on:
a provided credential payload as the encoded string, and
a selected templateId, which is returned in a response when a PDF template bundle is successfully uploaded.
Compact Credential
Request
1POST https://YOUR_TENANT_URL/v2/credentials/compact/pdf
1{
2 "templateId": "ccad3b98-7086-4556-9e19-9e2aa6ca5c5b",
3 "payload": "CSC:/1/2KCE3IQEJB5DCMSMGZDHUUYBE2QFSAL5VMAXQNDENFSDU53FMI5G2YLUORZC2ZDJMR3WKYRNORSXG5BONZSXI3DJMZ4S4YLQOA5EIRKWHJWG6YLEORSXG5DFOICBVFP2YYZAKGS2L74K4ZDOMFWWK32FNVWWCICKMFXGKICUMFZW2YLEMNXWIZLGJBJS4MRXHBYWGZLSORUWM2LDMF2GS33OJZQW2ZLSK5XXE23JNZTSAYLUEBEGK2LHNB2HG4TDMVZHI2LGNFRWC5DJN5XEYZLWMVWGOTDFOZSWYIBUNJUXG43VMVZE4YLNMV4BQQLEOZQW4Y3FMQQFGYLGMV2HSICUOJQWS3TJNZTWMZLYOBUXE6LKGIYDENRNGAYS2MBRHIAACAAAUIBBSAS4AN4IA2DUORYHGORPF5WG6YLEFV2GK43UNFXGOLTQNRQXIZTPOJWS4ZDFOYXG2YLUORZGYYLCOMXGS3ZPMNXXEZJPOYZC6Y3SMVSGK3TUNFQWY4ZPMNXW24DBMN2C64TFOZXWGYLUNFXW4LLMNFZXI4ZPMMYGEY3GMMZDALJRGUYTILJUHA4TSLLBGQ2TCLJZGNRGGY3GHFQTON3BHED5QQCQGNQJXK7NYZDAXN3JOR6WEYYHOBMEBAUOXZHFGWFPR4LR6V3KLIFH25CNPBZB5LH2AW42YW3KSNPD2DPBKSWN3CLVMOZOJGUKNCNDSHR6X5RRGRJ562P3HEMXUQK367MBGPYA"
4}
Response
The returned PDF file 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.
Semantic Compact Credential
Request
1POST https://YOUR_TENANT_URL/v2/credentials/compact-semantic/pdf
1{
2 "templateId": "6f1e20c2-f74b-4608-8dd3-3fa61d5defb6",
3 "payload": "CSS:/1/2KCE3IQEJB5DCMSMGZDHUUYBE2QFSAPOU4AXQNDENFSDU53FMI5G2YLUORZC2ZDJMR3WKYRNORSXG5BONZSXI3DJMZ4S4YLQOA5EIRKWHJWG6YLEORSXG5DFOICBVFP2YYZAKGS2L74K4Y3KORU7OB6YIBIC4L6VUL3MWR4TXVYGTLFKBBZDWYTWMORWQQDDN5XHIZLYOSAXQJTIOR2HA4Z2F4XXO53XFZ3TGLTPOJTS6MRQGE4C6Y3SMVSGK3TUNFQWY4ZPOYYWI5DZOBSYC5CWMVZGSZTJMFRGYZKDOJSWIZLOORUWC3DRMNZGKZDFNZ2GSYLMKN2WE2TFMN2KMZDOMFWWK32FNVWWCICKMFXGKICUMFZW2YLEMNXWIZLGJBJS4MRXHBYWGZLSORUWM2LDMF2GS33OJZQW2ZLSK5XXE23JNZTSAYLUEBEGK2LHNB2HG4TDMVZHI2LGNFRWC5DJN5XEYZLWMVWGOTDFOZSWYIBUNJUXG43VMVZE4YLNMV4BQQLEOZQW4Y3FMQQFGYLGMV2HSICUOJQWS3TJNZTWMZLYOBUXE6LKGIYDENRNGAYS2MBRHIAACAAAUIBBQRIDPCEWQ5DUOBZTULZPNRXWCZBNORSXG5DJNZTS44DMMF2GM33SNUXGIZLWFZWWC5DUOJWGCYTTFZUW6L3DN5ZGKL3WGIXWG4TFMRSW45DJMFWHGL3DN5WXAYLDOQWXGZLNMFXHI2LDF5ZGK5TPMNQXI2LPNYWWY2LTORZS6ZLFME4DOZLGMQWTCZTDGEWTIY3DGMWTQNLDGAWTEZTEGQ4TAY3GGU2GCNSYIDOEQ7VGMYLTMHDQ662S44UAKVWTCCS5NI5GJAAOT2LSMVKLZP2MIK6UA5F5UWUIN4XYDCKIEDVEAXLCRQ2TCBRKP5ZQYW3W3W3DB4WJ"
4}
Response
The returned PDF file 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.
A PDF will fail to be generated if the credential being used can’t be validated, or the credential itself has expired.
Possible Errors
Errors may occur in the following scenarios:
unable to validate or decode the payload
the template does not exist
the provided template.pdf file doesn’t contain a QR code button field
the decoded payload doesn't include a claim required as a field value in config.json