Search for a Credential in the Registry

Overview

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

Obtain Registry content

GET https://tenant.platform.mattr.global/v1/credentials

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.

GET https://tenant.platform.mattr.global/v1/credentials?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.

GET https://tenant.platform.mattr.global/v1/credentials?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

{
"nextCursor": "Y3JlYXRlZEF0PTIwMjAtMTAtMDhUMjMlM0ExMyUzQTE3Ljg5NtZGUxZWEyNzQ4MWI4",
"data": [
{
"id": "03bb9930-eb18-11ea-a057-530317397ea3",
"tag": "external-identifier",
"credential": {
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://schema.org"
],
"type": [
"VerifiableCredential",
"Course"
],
"issuer": {
"id": "did:key:z6MkndAHigYrXNpape7jgaC7jHiWwxzB3chuKUGXJg2b5RSj",
"name": "tenant"
},
"issuanceDate": "2020-08-30T23:24:54.876Z",
"credentialSubject": {
"id": "did:key:z6MkfxQU7dy8eKxyHpG267FV23agZQu9zmokd8BprepfHALi",
"givenName": "Chris",
"familyName": "Shin",
"educationalCredentialAwarded": "Certificate Name"
},
"proof": {
"type": "Ed25519Signature2018",
"created": "2020-08-30T23:24:55Z",
"jws": "eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..BSHdalZrYml0slwgAXFVF5uAcg2DbPMfwatturKs8TnuxBxylQDnS3JkORORVmO73Ruh7h8KJvVvHO4pE5NsCQ",
"proofPurpose": "assertionMethod",
"verificationMethod": "did:key:z6MkndAHigYrXNpape7jgaC7jHiWwxzB3chuKUGXJg2b5RSj#z6MkndAHigYrXNpape7jgaC7jHiWwxzB3chuKUGXJg2b5RSj"
}
},
"issuanceDate": "2020-08-30T23:24:54.876Z"
}
]
}

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.

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

{
"nextCursor": "Y3JlYXRlZEF0PTIwMjAtMTAtMDhUMjMlM0ExMyUzQTE3Ljg5NtZGUxZWEyNzQ4MWI4",
"data": [
{
"id": "03bb9930-eb18-11ea-a057-530317397ea3",
"tag": "external-identifier",
"issuanceDate": "2020-08-30T23:24:54.876Z"
}
]
}

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.

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.

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

GET https://tenant.platform.mattr.global/v1/credentials
?tag=external-identifier
&type=Course
&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.

{
"nextCursor": "Y3JlYXRlZEF0PTIwMjAtMTAtMDhUMjMlM0ExMyUzQTE3Ljg5NtZGUxZWEyNzQ4MWI4",
"data": [
{
"id": "03bb9930-eb18-11ea-a057-530317397ea3",
"tag": "external-identifier",
"issuanceDate": "2020-08-30T23:24:54.876Z"
}
]
}

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

GET https://tenant.platform.mattr.global/v1/credentials
?tag=external-identifier
&type=Course
&limit=100
&cursor=Y3JlYXRlZEF0PTIwMjAtMTAtMDhUMjMlM0ExMyUzQTE3Ljg5NtZGUxZWEyNzQ4MWI4

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

{
"data": []
}