Skip to main content

Credential Templates

Credential templates define reusable structures for issuing verifiable credentials across multiple ecosystems (OpenID, Privado ID, Indicio, Cheqd). These templates support formats such as AnonCreds and JSON-LD, allowing customization of attributes, schemas, and themes. This section covers methods to retrieve, create, update, delete, and import credential templates.

Get All Credential Templates

Retrieves a list of credential templates associated with the authenticated API key, with an optional filter by template ID.

import { OpenIDEcosystem } from '@openid/core-sdk';

const openid = new OpenIDEcosystem({
apiKey: 'your-ecosystem-api-key',
});

const templates = await openid.getAllCredentialTemplates({
tenantId: 'your-tenant-id',
});

Params

ParameterTypeDescription
tenantIdstring (Required)The ID of the tenant to query.
credentialTemplateIdstring (Optional)The ID of a specific credential template to retrieve (if omitted, returns all templates for the tenant).
note
  • Use the credentialTemplateId filter to retrieve a single template or omit it for a full list.
  • Responses may include metadata; check GetCredentialTemplatesResponse for full structure.

Get Tenant Credential Templates

Retrieves credential templates specific to a tenant, with an optional filter by template ID.

import { OpenIDEcosystem } from '@openid/core-sdk';

const openid = new OpenIDEcosystem({
apiKey: 'your-ecosystem-api-key',
});

const tenantTemplates = await openid.getTenantCredentialTemplates({
tenantId: 'your-tenant-id',
});

Params

ParameterTypeDescription
tenantIdstring (Required)The ID of the tenant to query.
credentialTemplateIdstring (Optional)The ID of a specific credential template to retrieve (if omitted, returns all templates for the tenant).
note
  • Similar to getAllCredentialTemplates, but scoped to tenant-specific templates.
    • Use this for tenant-specific auditing or management.

Create Credential Template (JSON-LD)

Creates a new JSON-LD credential template.

import { OpenIDEcosystem } from '@openid/core-sdk';

const openid = new OpenIDEcosystem({
apiKey: 'your-ecosystem-api-key',
});

const template = await openid.createCredentialTemplateJsonld({
tenantId: 'your-tenant-id',
name: 'Employee ID',
version: '1.0.0',
description: 'JSON-LD template for employee IDs',
schemaType: 'EmployeeSchema',
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
tenantIdstring (Required)The ID of the tenant to associate the template with.
namestring (Required)The name of the template.
versionstring (Required)The version of the template (e.g., `1.0.0`).
descriptionstring (Required)A description of the template.
schemaTypestring (Required)The schema type for the credential (e.g., `EmployeeSchema`).
attributesCredentialTemplateAttribute[] (Required)Array of attribute definitions.
imagestring (Optional)A URL for the template’s image.
categoryIdstring (Optional)The ID of a category to associate with the template.
credentialThemeCredentialTheme (Optional)Custom theme settings.
privadoCredentialTypestring (Optional)Specific type for Privado integration.
note
  • schemaType must match a supported JSON-LD context.
  • Use credentialTheme for custom branding if needed.

Create Credential Template (AnonCreds)

Creates a new AnonCreds credential template.

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

const indicio = new IndicioEcosystem({
apiKey: 'your-ecosystem-api-key',
});

const template = await indicio.createCredentialTemplateAnoncreds({
tenantId: 'your-tenant-id',
name: 'Employee ID',
version: '1.0.0',
description: 'AnonCreds template for employee IDs',
tag: 'emp-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
tenantIdstring (Required)The ID of the tenant to associate the template with.
namestring (Required)The name of the template.
versionstring (Required)The version of the template (e.g., `1.0.0`).
descriptionstring (Required)A description of the template.
tagstring (Required)A unique tag for the template.
attributesCredentialTemplateAttribute[] (Required)Array of attribute definitions.
imagestring (Optional)A URL for the template’s image.
categoryIdstring (Optional)The ID of a category to associate with the template.
note
  • The tag must be unique within the tenant to avoid conflicts.
  • Use attributes to define the schema for AnonCreds credentials.

Create Credential Template (mDoc)

Creates a new mDoc credential template.

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

const openid = new OpenIDEcosystem({
apiKey: 'your-ecosystem-api-key',
});

const template = await openid.createCredentialTemplateAnoncreds({
tenantId: 'your-tenant-id',
name: 'Employee ID',
version: '1.0.0',
description: 'AnonCreds template for employee IDs',
tag: 'emp-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
tenantIdstring (Required)The ID of the tenant to associate the template with.
namestring (Required)The name of the template.
versionstring (Required)The version of the template (e.g., `1.0.0`).
descriptionstring (Required)A description of the template.
tagstring (Required)A unique tag for the template.
attributesCredentialTemplateAttribute[] (Required)Array of attribute definitions.
imagestring (Optional)A URL for the template’s image.
categoryIdstring (Optional)The ID of a category to associate with the template.
note
  • The tag must be unique within the tenant to avoid conflicts.
  • Use attributes to define the schema for AnonCreds credentials.

Create Credential Template (SD-JWT)

Creates a new mDoc credential template.

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

const openid = new OpenIDEcosystem({
apiKey: 'your-ecosystem-api-key',
});

const template = await openid.createCredentialTemplateAnoncreds({
tenantId: 'your-tenant-id',
name: 'Employee ID',
version: '1.0.0',
description: 'AnonCreds template for employee IDs',
tag: 'emp-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
tenantIdstring (Required)The ID of the tenant to associate the template with.
namestring (Required)The name of the template.
versionstring (Required)The version of the template (e.g., `1.0.0`).
descriptionstring (Required)A description of the template.
tagstring (Required)A unique tag for the template.
attributesCredentialTemplateAttribute[] (Required)Array of attribute definitions.
imagestring (Optional)A URL for the template’s image.
categoryIdstring (Optional)The ID of a category to associate with the template.
note
  • The tag must be unique within the tenant to avoid conflicts.
  • Use attributes to define the schema for AnonCreds credentials.

Update Credential Template

Updates an existing credential template with new details.

import { OpenIDEcosystem } from '@openid/core-sdk';

const openid = new OpenIDEcosystem({
apiKey: 'your-ecosystem-api-key',
});

const result = await openid.updateCredentialTemplate({
tenantId: 'your-tenant-id',
credentialTemplateId: 'your-credential-template-id',
});

Params

ParameterTypeDescription
tenantIdstring (Required)The ID of the tenant owning the template.
credentialTemplateIdstring (Required)The ID of the credential template to update.
categoryIdstring (Optional)The ID of a category to associate with the template.
imagestring (Optional)A new URL for the template’s image.
note
  • Only provided fields are updated; others remain unchanged.
  • Use this to refresh metadata like images or categories.

Delete Credential Template

Deletes a credential template from a tenant.

import { OpenIDEcosystem } from '@openid/core-sdk';

const openid = new OpenIDEcosystem({
apiKey: 'your-ecosystem-api-key',
});

const result = await openid.deleteCredentialTemplate({
tenantId: 'your-tenant-id',
credentialTemplateId: 'your-credential-template-id',
});

Params

ParameterTypeDescription
tenantIdstring (Required)The ID of the tenant owning the template.
credentialTemplateIdstring (Required)The ID of the credential template to delete.
note
  • This action is irreversible and removes the template and its associated data.
  • Ensure no active credentials rely on the template before deletion.

Import Credential Template (JSON-LD)

Imports an existing JSON-LD credential template using a schema URL.

import { OpenIDEcosystem } from '@openid/core-sdk';

const openid = new OpenIDEcosystem({
apiKey: 'your-ecosystem-api-key',
});

const template = await openid.importCredentialTemplateJsonld({
tenantId: 'your-tenant-id',
schemaUrl: 'https://example.com/schemas/employee-schema.jsonld',
});

Params

ParameterTypeDescription
tenantIdstring (Required)The ID of the tenant to associate the template with.
schemaUrlstring (Required)The URL of the existing JSON-LD schema.
categoryIdstring (Optional)The ID of a category to associate with the template.
imagestring (Optional)A URL for the template’s image.
note
  • Requires a valid schemaUrl pointing to a JSON-LD context.
  • Use this to integrate external JSON-LD schemas into your tenant.

Import Credential Template (AnonCreds)

Imports an existing AnonCreds credential template using a schema ID.

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

const indicio = new IndicioEcosystem({
apiKey: 'your-ecosystem-api-key',
});

const template = await indicio.importCredentialTemplateAnoncreds({
tenantId: 'your-tenant-id',
schemaId: 'schema-789',
tag: 'imp-emp-id-v1',
description: 'Imported AnonCreds template for employee IDs',
});

Params

ParameterTypeDescription
tenantIdstring (Required)The ID of the tenant to associate the template with.
schemaIdstring (Required)The ID of the existing AnonCreds schema.
tagstring (Required)A unique tag for the imported template.
descriptionstring (Required)A description of the template.
imagestring (Optional)A URL for the template’s image.
categoryIdstring (Optional)The ID of a category to associate with the template.
note
  • The schemaId must reference a valid AnonCreds schema on the ledger.
  • The tag must be unique within the tenant.