Create a Compact or Compact Semantic Credential configuration

You can also create a Compact or Compact Semantic Credential configuration via our Self service portal.

Request

Make a request of the following structure to create a new Compact Credential configuration:

http
Copy to clipboard.
1POST https://YOUR_TENANT_URL/v2/credentials/compact/configurations

You can make a similar request to a different endpoint to create a new Compact Semantic Credential configuration:

http
Copy to clipboard.
1POST https://YOUR_TENANT_URL/v2/credentials/compact-semantic/configurations

Request body

json
Copy to clipboard.
1{
2    "type": "CourseCredential",
3    "claimMappings": {
4        "email": {
5            "mapFrom": "claims.email"
6        },
7        "firstName": {
8            "mapFrom": "claims.given_name"
9        },
10        "lastName": {
11            "mapFrom": "claims.lastName"
12        },
13        "addressRegion": {
14            "mapFrom": "claims.addressRegion",
15            "required": true,
16            "defaultValue": "Kakapo"
17        },
18        "providerUrl": {
19            "mapFrom": "authenticationProvider.url",
20            "required": true
21        },
22        "providersubjectId": {
23            "mapFrom": "authenticationProvider.subjectId",
24            "required": true
25        }
26    },
27    "revocable": true,
28    "expiresIn": {
29        "years": 1
30    },
31    "claimSourceId": "945214ad-3635-4aff-b51d-61d69a3c8eee"
32}
  • type (required): Used to differentiate between different Compact/Compact Semantic Credential configurations on your tenant. Thus, its value must:

    • Be unique across all Compact/Compact Semantic Credential configurations on your tenant.

    • Not be VerifiableCredential.

  • claimMappings: This is where you specify how to map claims (user attributes) into issued credentials. Each field in the object corresponds to a claim in the issued credential, and contains one or more from the following attributes:

    • mapFrom: References the path in the user object where the claim is available.

      • When using a URL as a claims namespace identifier, use bracket notation to access the claim value (e.g. mapFrom: "claims['https://example.com/claim-name']").

      • mapFrom is optional when defaultValue is provided, as the latter will be used for all issued credentials. This is referred to as a static claim.

    • defaultValue: Indicates what value is used if required is set to false (field is optional) and no value is provided by the claims source. When defaultValue is provided, mapFrom is optional.

    • required: Indicates whether the claim is required (default: false). When a required claim cannot be retrieved and no defaultValue is available, credential issuance will fail.

    Refer to Credential configuration claims to learn more about how this object is created and handled.

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

  • claimSourceId (optional): References the unique identifier of a claims source that can be used to retrieve claims and include them in the issued credential.

  • expiresIn (optional): Used to determine when will issued credentials expire. Can include any combination of years, months, weeks, days, hours, minutes and seconds.

Response

json
Copy to clipboard.
1{
2    "id": "8fda86fc-781d-4401-80d7-eaa43efafad9",
3    "type": "CourseCredential",
4   //... rest of your credential configuration
5}
  • id: Uniquely identifies the created credential configuration. This identifier can be used to create an offer based on this credential configuration, or to retrieve, update or remove the credential configuration.

What's next?

Now that you have created a credential configuration, you can proceed to create a credential offer based on this configuration.