Skip to main content

Credential templates

A credential template describes a credential you issue: its name, format and attributes. The formats you can use depend on the ecosystem (see Compatibility):

FormatEcosystemsMethod
JSON-LDEU Digital Identity, cheqd, Indicio, PolygoncreateCredentialTemplateJsonld
SD-JWTEU Digital IdentitycreateCredentialTemplateSdJwt
mDocEU Digital IdentitycreateCredentialTemplateMdoc
JWT-VCMicrosoft EntracreateCredentialTemplateJwtVc
AnonCredscheqd, IndiciocreateCredentialTemplateAnoncreds

Get all credential templates​

Lists the credential templates in your ecosystem. To list only one organization's templates, use Get organization credential templates.

import { OpenIdEcosystem } from '@hovi/core-sdk';

const openid = new OpenIdEcosystem({
apiKey: '<YOUR_API_KEY>',
});

const templates = await openid.getAllCredentialTemplates({
organizationId: '<ORGANIZATION_ID>',
});

Params​

ParameterTypeDescription
organizationIdstring (Required)Your organization ID.
credentialTemplateIdstring (Optional)Return only this template.

Get organization credential templates​

Lists the credential templates of one organization.

import { OpenIdEcosystem } from '@hovi/core-sdk';

const openid = new OpenIdEcosystem({
apiKey: '<YOUR_API_KEY>',
});

const templates = await openid.getOrganizationCredentialTemplates({
organizationId: '<ORGANIZATION_ID>',
});

Params​

ParameterTypeDescription
organizationIdstring (Required)Your organization ID.
credentialTemplateIdstring (Optional)Return only this template.

Create credential template (JSON-LD)​

Creates a JSON-LD (W3C) credential template.

import { OpenIdEcosystem } from '@hovi/core-sdk';

const openid = new OpenIdEcosystem({
apiKey: '<YOUR_API_KEY>',
});

const template = await openid.createCredentialTemplateJsonld({
organizationId: '<ORGANIZATION_ID>',
name: 'Employee ID',
version: '1.0.0',
description: 'Employee ID card',
schemaType: 'EmployeeID',
attributes: [
{ name: 'firstName', label: 'First name', type: 'string', description: 'Given name', required: true },
{ name: 'lastName', label: 'Last name', type: 'string', description: 'Family name', required: true },
],
});

Params​

ParameterTypeDescription
organizationIdstring (Required)Your organization ID.
namestring (Required)The name of the template.
versionstring (Required)The version of the template, for example 1.0.0.
descriptionstring (Required)A description of the template.
schemaTypestring (Required)The credential type, for example EmployeeID.
attributesCredentialTemplateAttribute[] (Required)The attributes the credential holds. Each has a name, label, type, description and required flag.
imagestring (Optional)A URL of the template's image.
categoryIdstring (Optional)The ID of a category for the template.
credentialThemeCredentialTheme (Optional)How the credential card looks: title, description, colours, background image and logo.
privadoCredentialTypestring (Optional)Polygon only: the Polygon credential type.

Create credential template (SD-JWT)​

Creates an SD-JWT credential template. With SD-JWT, the holder can share only some of the credential's attributes.

import { OpenIdEcosystem } from '@hovi/core-sdk';

const openid = new OpenIdEcosystem({
apiKey: '<YOUR_API_KEY>',
});

const template = await openid.createCredentialTemplateSdJwt({
organizationId: '<ORGANIZATION_ID>',
name: 'Employee ID',
version: '1.0.0',
description: 'Employee ID card',
schemaType: 'EmployeeID',
attributes: [
{ name: 'firstName', label: 'First name', type: 'string', description: 'Given name', required: true },
{ name: 'lastName', label: 'Last name', type: 'string', description: 'Family name', required: true },
],
});

Params​

ParameterTypeDescription
organizationIdstring (Required)Your organization ID.
namestring (Required)The name of the template.
versionstring (Required)The version of the template, for example 1.0.0.
descriptionstring (Required)A description of the template.
schemaTypestring (Required)The credential type, for example EmployeeID.
attributesCredentialTemplateAttribute[] (Required)The attributes the credential holds. Each has a name, label, type, description and required flag.
imagestring (Optional)A URL of the template's image.
categoryIdstring (Optional)The ID of a category for the template.
credentialThemeCredentialTheme (Optional)How the credential card looks: title, description, colours, background image and logo.
supportRevocationboolean (Optional)Lets you revoke credentials issued from this template. You revoke them through the API.
sdJwtHeaderstring (Optional)A custom SD-JWT header value.

Create credential template (mDoc)​

Creates an mDoc (ISO 18013-5) credential template.

import { OpenIdEcosystem } from '@hovi/core-sdk';

const openid = new OpenIdEcosystem({
apiKey: '<YOUR_API_KEY>',
});

const template = await openid.createCredentialTemplateMdoc({
organizationId: '<ORGANIZATION_ID>',
name: 'Employee ID',
version: '1.0.0',
description: 'Employee ID card',
docType: 'com.example.employee.1',
attributes: [
{ name: 'firstName', label: 'First name', type: 'string', description: 'Given name', required: true },
{ name: 'lastName', label: 'Last name', type: 'string', description: 'Family name', required: true },
],
});

Params​

ParameterTypeDescription
organizationIdstring (Required)Your organization ID.
namestring (Required)The name of the template.
versionstring (Required)The version of the template, for example 1.0.0.
descriptionstring (Required)A description of the template.
docTypestring (Required)The mDoc document type.
attributesCredentialTemplateAttribute[] (Required)The attributes the credential holds. Each has a name, label, type, description and required flag.
imagestring (Optional)A URL of the template's image.
categoryIdstring (Optional)The ID of a category for the template.
credentialThemeCredentialTheme (Optional)How the credential card looks: title, description, colours, background image and logo.
namespacestring (Optional)The mDoc namespace for the attributes.

Create credential template (JWT-VC)​

Creates a Microsoft Entra Verified ID credential template. Use credentialTheme to set how the card looks in Microsoft Authenticator.

import { EntraEcosystem } from '@hovi/core-sdk';

const entra = new EntraEcosystem({
apiKey: '<YOUR_API_KEY>',
});

const template = await entra.createCredentialTemplateJwtVc({
organizationId: '<ORGANIZATION_ID>',
name: 'Employee ID',
version: '1.0.0',
description: 'Employee ID card',
schemaType: 'EmployeeID',
attributes: [
{ name: 'firstName', label: 'First name', type: 'string', description: 'Given name', required: true },
{ name: 'lastName', label: 'Last name', type: 'string', description: 'Family name', required: true },
],
credentialTheme: {
backgroundColor: '#1F3A93',
textColor: '#FFFFFF',
logoUrl: 'https://example.com/logo.png',
logoAlt: 'Acme University logo',
},
});

Params​

ParameterTypeDescription
organizationIdstring (Required)Your organization ID.
namestring (Required)The name of the template.
versionstring (Required)The version of the template, for example 1.0.0.
descriptionstring (Required)A description of the template.
schemaTypestring (Required)The credential type, for example EmployeeID.
attributesCredentialTemplateAttribute[] (Required)The attributes the credential holds. Each has a name, label, type, description and required flag.
imagestring (Optional)A URL of the template's image.
categoryIdstring (Optional)The ID of a category for the template.
credentialThemeCredentialTheme (Optional)How the credential card looks: title, description, colours, background image and logo.

Create credential template (AnonCreds)​

Creates an AnonCreds credential template.

import { CheqdEcosystem } from '@hovi/core-sdk';

const cheqd = new CheqdEcosystem({
apiKey: '<YOUR_API_KEY>',
});

const template = await cheqd.createCredentialTemplateAnoncreds({
organizationId: '<ORGANIZATION_ID>',
name: 'Employee ID',
version: '1.0.0',
description: 'Employee ID card',
tag: 'employee-id-v1',
attributes: [
{ name: 'firstName', label: 'First name', type: 'string', description: 'Given name', required: true },
{ name: 'lastName', label: 'Last name', type: 'string', description: 'Family name', required: true },
],
});

Params​

ParameterTypeDescription
organizationIdstring (Required)Your organization ID.
namestring (Required)The name of the template.
versionstring (Required)The version of the template, for example 1.0.0.
descriptionstring (Required)A description of the template.
tagstring (Required)A tag for the template.
attributesCredentialTemplateAttribute[] (Required)The attributes the credential holds. Each has a name, label, type, description and required flag.
imagestring (Optional)A URL of the template's image.
categoryIdstring (Optional)The ID of a category for the template.

Update credential template​

Changes a template's image or category. Only the fields you pass are changed.

import { OpenIdEcosystem } from '@hovi/core-sdk';

const openid = new OpenIdEcosystem({
apiKey: '<YOUR_API_KEY>',
});

const result = await openid.updateCredentialTemplate({
organizationId: '<ORGANIZATION_ID>',
credentialTemplateId: '<CREDENTIAL_TEMPLATE_ID>',
image: 'https://example.com/new-image.png',
});

Params​

ParameterTypeDescription
organizationIdstring (Required)Your organization ID.
credentialTemplateIdstring (Required)The ID of the template to update.
categoryIdstring (Optional)The ID of a category for the template.
imagestring (Optional)A new URL of the template's image.

Delete credential template​

Deletes a credential template.

import { OpenIdEcosystem } from '@hovi/core-sdk';

const openid = new OpenIdEcosystem({
apiKey: '<YOUR_API_KEY>',
});

const result = await openid.deleteCredentialTemplate({
organizationId: '<ORGANIZATION_ID>',
credentialTemplateId: '<CREDENTIAL_TEMPLATE_ID>',
});

Params​

ParameterTypeDescription
organizationIdstring (Required)Your organization ID.
credentialTemplateIdstring (Required)The ID of the template to delete.
note
  • This can't be undone. Make sure you no longer issue credentials from this template.

Import credential template (JSON-LD)​

Creates a JSON-LD credential template from an existing schema URL.

import { OpenIdEcosystem } from '@hovi/core-sdk';

const openid = new OpenIdEcosystem({
apiKey: '<YOUR_API_KEY>',
});

const template = await openid.importCredentialTemplateJsonld({
organizationId: '<ORGANIZATION_ID>',
schemaUrl: 'https://example.com/schemas/employee-id.json',
});

Params​

ParameterTypeDescription
organizationIdstring (Required)Your organization ID.
schemaUrlstring (Required)The URL of the existing JSON-LD schema.
categoryIdstring (Optional)The ID of a category for the template.
imagestring (Optional)A URL of the template's image.

Import credential template (AnonCreds)​

Creates an AnonCreds credential template from a schema that already exists on the ledger.

import { CheqdEcosystem } from '@hovi/core-sdk';

const cheqd = new CheqdEcosystem({
apiKey: '<YOUR_API_KEY>',
});

const template = await cheqd.importCredentialTemplateAnoncreds({
organizationId: '<ORGANIZATION_ID>',
schemaId: '<SCHEMA_ID>',
tag: 'employee-id-v1',
description: 'Employee ID card',
});

Params​

ParameterTypeDescription
organizationIdstring (Required)Your organization ID.
schemaIdstring (Required)The ID of the existing AnonCreds schema.
tagstring (Required)A tag for the imported template.
descriptionstring (Required)A description of the template.
imagestring (Optional)A URL of the template's image.
categoryIdstring (Optional)The ID of a category for the template.