Create a Compact Semantic Credential

The Compact Semantic Credential represents the credential claims inside of a W3C Verifiable Credential data model which is then signed as a Compact Credential.  

If you need a credential that is more compact at the expense of not using a semantic data model, then look at the tutorial for issuing a Compact Credential.

Prerequisites

  • Access to MATTR VII APIs. If you’re experiencing any difficulties, contact us.

  • Issuer DID: This is a did:web that identifies the issuer who attests the claims in the credential are accurate. Refer to create a did:web if you need assistance in creating one. You can only sign Compact Credentials using DIDs with a P-256 key type. Note that MATTR VII creates did:webs with this key type by default.

  • Claim values: The claims you wish to include in the credential. This is the information attested by the issuer. Compact Semantic Credentials include two types of claims:

    • Standard claims: These must be in a specific structure and format for the credential to be valid. Refer to the example request below for more information. Standard claims are included in the credential top level.

    • Custom claims: These claims must comply with the W3C Verifiable Credentials Data Model 1.0 and its vocabulary context. Custom claims are included inside a vc object inside the credential.

Request

Make the following request to create and sign a Compact Semantic Credential:

http
Copy to clipboard.
1POST https://YOUR_TENANT_URL/v2/credentials/compact-semantic/sign
json
Copy to clipboard.
1{
2    "payload": {
3        "iss": "did:web:learn.vii.au01.mattr.global",
4        "nbf": 1704099600,
5        "exp": 1767258000,
6        "vc": {
7            "type": "Course Credential",
8            "credentialSubject": {
9                "name": "Emma Tasma",
10                "code": "HS.278",
11                "certificationName": "Working at Heights",
12                "certificationLevel": "Level 4",
13                "issuerName": "Advanced Safety Training",
14                "expiry": "2026-01-01"
15            }
16        }
17    },
18    "revocable": true
19}
  • iss: Use the DID that identifies the credential's issuer, which attests the claims in the credential. This must be a publicly available and resolvable did:web for the credential to be valid and verifiable.

  • nbf: Set the time and date the credential will be active from ( in Unix Epoch time) .

  • exp: Set the time and date the credential will expire (in Unix Epoch time).

  • vc: This object includes all custom claims in the credential, which must comply with the W3C Verifiable Credentials Data Model 1.0 and its vocabulary context.

  • revocable: When set to true, the created credential can later be revoked. When set to false, the credential cannot be revoked.

Response 

json
Copy to clipboard.
1{
2    "id": "urn:uuid:78e19496-8521-424b-8315-35fb1ecaf681",
3    "decoded": {
4        "iss": "did:web:learn.vii.au01.mattr.global",
5        "nbf": 1704099600,
6        "vc": {
7            "@context": [
8                "https://www.w3.org/2018/credentials/v1"
9            ],
10            "type": [
11                "VerifiableCredential",
12                "Course Credential"
13            ],
14            "credentialSubject": {
15                "name": "Emma Tasma",
16                "code": "HS.278",
17                "certificationName": "Working at Heights",
18                "certificationLevel": "Level 4",
19                "issuerName": "Advanced Safety Training",
20                "expiry": "2026-01-01"
21            }
22        },
23        "exp": 1767258000,
24        "status": {
25            "index": 0,
26            "url": "https://learn.vii.au01.mattr.global/core/v2/credentials/compact-semantic/revocation-lists/1fe00d6c-904f-497e-bbe1-a3cfdc0b8368"
27        },
28        "jti": "urn:uuid:78e19496-8521-424b-8315-35fb1ecaf681"
29    },
30    "encoded": "CSS:/1/2KCE3IQEJB5DCMSMGZITM5QBE2QFSAOZUYAXQI3ENFSDU53FMI5GYZLBOJXC45TJNEXGC5JQGEXG2YLUORZC4Z3MN5RGC3AFDJSZE7YQMJ3GHI3IIBRW63TUMV4HJALYEZUHI5DQOM5C6L3XO53S45ZTFZXXEZZPGIYDCOBPMNZGKZDFNZ2GSYLMOMXXMMLEOR4XAZMCORLGK4TJMZUWCYTMMVBXEZLEMVXHI2LBNRYUG33VOJZWKICDOJSWIZLOORUWC3DRMNZGKZDFNZ2GSYLMKN2WE2TFMN2KMZDOMFWWK2SFNVWWCICUMFZW2YLEMNXWIZLGJBJS4MRXHBYWGZLSORUWM2LDMF2GS33OJZQW2ZLSK5XXE23JNZTSAYLUEBEGK2LHNB2HG4TDMVZHI2LGNFRWC5DJN5XEYZLWMVWGOTDFOZSWYIBUNJUXG43VMVZE4YLNMV4BQQLEOZQW4Y3FMQQFGYLGMV2HSICUOJQWS3TJNZTWMZLYOBUXE6LKGIYDENRNGAYS2MBRAQNGSVRXSA5AAAIAACRAEAADPB7GQ5DUOBZTULZPNRSWC4TOFZ3GS2JOMF2TAMJONVQXI5DSFZTWY33CMFWC6Y3POJSS65RSF5RXEZLEMVXHI2LBNRZS6Y3PNVYGCY3UFVZWK3LBNZ2GSYZPOJSXM33DMF2GS33OFVWGS43UOMXTCZTFGAYGINTDFU4TANDGFU2DSN3FFVRGEZJRFVQTGY3GMRRTAYRYGM3DQB6YIBIHRYMUS2CSCQSLQMKTL6Y6ZL3ICWCAUPGIGEOOWODF77V7ZJPVLGAQC2ZUP7MASXIRTIRRPOIIBKNHKZ4LHROPWBPBCYTKA3GXWIRD736HIJNQENTSFUYIPQ77BG4ZPCTXYIY"
31}
  • id: Unique credential identifier. This is required when revoking a credential.

  • decoded: This is the decoded version of the credential. It includes all the information from the request above, with the addition of the following elements:

    • status: If revocable was set to true in the request, this object is used to provide information required for revocation:

      • index: This indicates the index of this specific credential within the revocation list.

      • url: Every revocable credential will reference a Revocation List that is automatically created and held on the issuer's tenant. This list can be used by external verifiers to validate the credential status. The status.url property references the Revocation List which holds the revocation status for this specific credential.

    • jti: This JWT ID identifies this credential and is identical to the id element. When revocable is set to true, this value is persisted on the tenant to enable revoking this specific credential.

  • encoded: The base32 encoded string representation of the Compact Semantic Credential. CSC stands for COSE_SIGN Compact profile. You will use this element to convert the credential into a format that can be shared with a holder.

What's next?

Now that you have created the credential, you can format it as a QR code, a PDF document, an Apple digital pass or a Google digital pass.