Skip to main content

List credentials

Returns a list of credentials. Use the optional parameters to filter and sort.

Function

getCredentials(
query: CredentialListQuery
): Promise<ItemList<CredentialListItem>>

Parameters

export type CredentialListQuery = ListQuery & {
sort?: SortableCredentialColumnEnum;
sortDirection?: SortDirection;
exact?: CredentialListQueryExactColumnEnum[];
role?: CredentialRoleEnum;
ids?: Array<CredentialListItem["id"]>;
status?: CredentialStateEnum[];
include?: CredentialListIncludeEntityType[];
} & (
| { name?: string; searchType?: never; searchText?: never }
| {
searchText?: string;
searchType?: CredentialListSearchType[];
name?: never;
}
);
export interface ListQuery {
page: number;
pageSize: number;
organisationId: string;
}

Fields

  • page - Returns a specific page of the results. The first page is 0.

  • pageSize - Specify how many items appear on each page.

  • organisationId - Value from create organization.

  • sorting - If no sorting values are provided, CREATED_DATE + DESCENDING are used. If a value is passed for sort, the default direction becomes ASCENDING.

    • sort - Sort by certain values in the response body.

      • [CREATED_DATE, SCHEMA_NAME, ISSUER_DID, STATE]
    • sortDirection - Default value = DESCENDING.

      • [ASCENDING, DESCENDING]
  • name - (Deprecated) Return credentials whose credential schema's name starts with this string. Not case-sensitive.

  • Searching and filtering credentials:

    • searchType - Choose any combination of categories to search

      • CLAIM_NAME searches the claim keys of credentials, such as Name or Nationality
      • CLAIM_VALUE searches the claim values of credentials, such as John or USA
      • CREDENTIAL_SCHEMA_NAME searches the names of the credential schemas, such as Driver's License or Residence Permit
    • searchText - Full-text, case-sensitive search of the chosen categories. A credential will be returned if there is text match within the first 255 bytes in one of the chosen categories.

  • exact - Set which filters apply in an exact way.

    • [NAME]
  • role - In cases where the system is fulfilling more than one role, use this field to filter by a specific role. Typically for wallets all credentials are HOLDER.

    • [HOLDER, ISSUER, VERIFIER]
  • ids - Specify credentials to be returned.

  • status - Return credentials in the specified state.

    • [CREATED, PENDING, OFFERED, ACCEPTED, SUSPENDED, REJECTED, REVOKED, ERROR]
  • include - Include certain values in the return. Supported values:

    • Layout properties: return the design elements of credentials, so credentials can be displayed as intended

Return value

export interface ItemList<Item> {
totalItems: number;
totalPages: number;
values: Item[];
}
export interface CredentialListItem {
id: string;
createdDate: string;
issuanceDate: string;
lastModified: string;
revocationDate?: string | null;
issuerDid?: string | null;
state: CredentialStateEnum;
schema: CredentialSchemaListItem;
role: CredentialRoleEnum;
suspendEndDate?: string | null;
}

Fields

  • role - The role the system plays in relation to the credential.

    • [HOLDER, ISSUER, VERIFIER]
  • schema - Credential schema being used to issue the credential. This includes the layout properties of the credential, detailing how the credential should be displayed in the wallet. For details on credentials design, see the credentials designer guide.

  • state - Represents the state of the credential.

    • [CREATED, PENDING, OFFERED, ACCEPTED, SUSPENDED, REJECTED, REVOKED, ERROR]
  • suspendEndDate - When the suspension will end, if a date was set by the issuer.