Search for a credential in the Registry

Overview

This tutorial explains how to find credentials that are held in the Registry.

Obtain Registry content

http
Copy to clipboard.
1GET https://YOUR_TENANT_URL/v2/credentials/web-semantic

This will return a list of credentials and meta-data in the Registry.

Search by tag

When a tag is provided during the issuance of a credential, the value can be used as a filter by providing the external identifier as the tag query parameter.

http
Copy to clipboard.
1GET https://YOUR_TENANT_URL/v2/credentials/web-semantic?tag=external-identifier

This will return credentials that have that tag in their meta-data.

The tag is case-sensitive

Search by credential type

To filter on a certain type of credential, provide the credential type as the type query parameter.

http
Copy to clipboard.
1GET https://YOUR_TENANT_URL/v2/credentials/web-semantic?type=Course

This will return all credentials of that type.

Credential held in the Registry

When the persist flag was set to true during the issuance of a credential, the response contains both the credential and its meta-data.

Response

json
Copy to clipboard.
1{
2    "nextCursor": "Y3JlYXRlZEF0PTIwMjAtMTAtMDhUMjMlM0ExMyUzQTE3Ljg5NtZGUxZWEyNzQ4MWI4",
3    "data": [
4        {
5            "id": "03bb9930-eb18-11ea-a057-530317397ea3",
6            "tag": "external-identifier",
7            "credential": {
8                "@context": [
9                    "https://www.w3.org/2018/credentials/v1",
10                    "https://schema.org"
11                ],
12                "type": [
13                    "VerifiableCredential",
14                    "CourseCredential"
15                ],
16                "issuer": {
17                    "id": "did:web:organization.com",
18                    "name": "tenant"
19                },
20                "name": "Course credential",
21                "description": "Course credential description",
22                "issuanceDate": "2020-08-30T23:24:54.876Z",
23                "expirationDate": "2024-02-07T06:44:28.952Z""credentialSubject": {
24                    "id": "did:key:z6MkfxQU7dy8eKxyHpG267FV23agZQu9zmokd8BprepfHALi",
25                    "givenName": "Chris",
26                    "familyName": "Shin",
27                    "educationalCredentialAwarded": "Certificate Name"
28                },
29                "proof": {
30                    "type": "Ed25519Signature2018",
31                    "created": "2020-08-30T23:24:55Z",
32                    "jws": "eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..BSHdalZrYml0slwgAXFVF5uAcg2DbPMfwatturKs8TnuxBxylQDnS3JkORORVmO73Ruh7h8KJvVvHO4pE5NsCQ",
33                    "proofPurpose": "assertionMethod",
34                    "verificationMethod": "did:key:z6MkndAHigYrXNpape7jgaC7jHiWwxzB3chuKUGXJg2b5RSj#z6MkndAHigYrXNpape7jgaC7jHiWwxzB3chuKUGXJg2b5RSj"
35                }
36            },
37            "issuanceDate": "2020-08-30T23:24:54.876Z"
38        }
39    ]
40}

The id is the unique identifier of the credential.

The tag is the tag that was defined when creating the credential. In the case of an OIDC flow this is the sub value of the ID Token of the federated provider. If using the OpenID Credential Provisioning flow, the tag will be set to the userId.

credential contains the full credential.

issuanceDate is the timestamp of when the credential was created.

credentialStatus (in the case of Revocation)

Credential not held in Registry

When the persist flag was set to false during the issuance of a credential, the response only contains meta-data.

Response

json
Copy to clipboard.
1{
2    "nextCursor": "Y3JlYXRlZEF0PTIwMjAtMTAtMDhUMjMlM0ExMyUzQTE3Ljg5NtZGUxZWEyNzQ4MWI4",
3    "data": [
4        {
5            "id": "03bb9930-eb18-11ea-a057-530317397ea3",
6            "tag": "external-identifier",
7            "issuanceDate": "2020-08-30T23:24:54.876Z""expirationDate": "2024-02-07T06:44:28.952Z"
8        }
9    ]
10}

The id is the unique identifier of the credential.

The tag is the tag that was defined when creating the credential. In the case of an OIDC flow this is the sub value of the ID Token of the federated provider. If using the OpenID Credential Provisioning flow, the tag will be set to the userId.

issuanceDate is the timestamp of when the credential was created.

credentialStatus (in the case of Revocation)

Pagination

To limit the number of credentials that are being returned for a search, pagination is being applied for each search result.

limit query parameter can be provided to define the maximum number of returned credentials on a page.

http
Copy to clipboard.
1GET https://YOUR_TENANT_URL/core/v2/credentials/
2web-semantic
3?tag=external-identifier
4&type=CourseCredential
5&limit=100

The default limit size is 100, and the limit can be set to a maximum size of 1,000

The result of the first page includes a nextCursor attribute which can be used to obtain the next page.

json
Copy to clipboard.
1{
2    "nextCursor": "Y3JlYXRlZEF0PTIwMjAtMTAtMDhUMjMlM0ExMyUzQTE3Ljg5NtZGUxZWEyNzQ4MWI4",
3    "data": [
4        {
5            "id": "03bb9930-eb18-11ea-a057-530317397ea3",
6            "tag": "external-identifier",
7            "issuanceDate": "2020-08-30T23:24:54.876Z""expirationDate": "2024-02-07T06:44:28.952Z"
8        }
9    ]
10}

To obtain the next page, populate the cursor query parameter with value provided in the nextCursor.

http
Copy to clipboard.
1GET https://YOUR_TENANT_URL/core/v2/credentials/web-semantic
2?tag=external-identifier
3&type=CourseCredential
4&limit=100
5&cursor=Y3JlYXRlZEF0PTIwMjAtMTAtMDhUMjMlM0ExMyUzQTE3Ljg5NtZGUxZWEyNzQ4MWI4

When no more pages are found an empty data element will be returned.

{
  "data": []
}