Setup a Semantic Compact Credential Configuration

The following example shows a request to create a new Semantic Compact Credential configuration:

Request

http
Copy to clipboard.
1POST https://YOUR_TENANT_URL/v2/credentials/compact-semantic/configurations
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        "educationalCredentialAwarded": {
19            "mapFrom": "claims.educationalCredentialAwarded",
20            "required": true
21        },
22        "providerUrl": {
23            "mapFrom": "authenticationProvider.url",
24            "required": true
25        },
26        "providersubjectId": {
27            "mapFrom": "authenticationProvider.subjectId",
28            "required": true
29        }
30    },
31    "revocable": true,
32    "expiresIn": {
33        "days": 100
34    }
35}

type defines the type of the Semantic Compact Credential. This value must be unique across all of your Semantic Compact Credential configurations, and must not be VerifiableCredential.

claimMappings specifies which user attributes are included in an issued Semantic Compact Credential.

expiresIn is an optional object that defines how long after the issuance of a Semantic Compact Credential it expires. If no value is provided, the credential will never expire.

revocable is a boolean value which defines whether the credential can be revoked or not. The default value is true.

Response

json
Copy to clipboard.
1{
2    "id": "f06ff3b3-6ed5-4819-a2a5-cd5aebad64c4",
3    "type": "CourseCredential",
4    "revocable": true,
5    "expiresIn": {
6        "days": 100
7    },
8    "claimMappings": {
9        "email": {
10            "mapFrom": "claims.email"
11        },
12        "firstName": {
13            "mapFrom": "claims.given_name"
14        },
15        "lastName": {
16            "mapFrom": "claims.lastName"
17        },
18        "addressRegion": {
19            "mapFrom": "claims.addressRegion",
20            "required": true,
21            "defaultValue": "Kakapo"
22        },
23        "educationalCredentialAwarded": {
24            "mapFrom": "claims.educationalCredentialAwarded",
25            "required": true
26        },
27        "providerUrl": {
28            "mapFrom": "authenticationProvider.url",
29            "required": true
30        },
31        "providersubjectId": {
32            "mapFrom": "authenticationProvider.subjectId",
33            "required": true
34        }
35    }
36}

The successful response includes the new credential configuration with a unique id. This unique identifier is required for issuing a credential based on the created configuration, for updating the configuration or for deleting it.

To learn how to search and filter created credential configurations, refer to the API spec.

To learn about claim mappings, refer to the tutorial on setting up a credential configuration with OpenID Credential Provisioning.