Skip to main content

CredentialTemplatesV2

Returns a paginated list of Credential Templates available to the specified Tenants, including the data fields each Template requires.

When to use

Call this before ordering to discover which Templates are available and what data fields each one requires. Use the returned _id as the template_id in CredentialOrderV1.

Required roles

user

All requests must be authenticated — see Authentication.

Operation

query GetTemplates(
$tenantIds: [ID!]!
$credentialTemplateTypes: [CredentialTemplateTypes]
$pagination: PaginationOptions
) {
CredentialTemplatesV2(
tenantIds: $tenantIds
credentialTemplateTypes: $credentialTemplateTypes
pagination: $pagination
) {
docs {
_id
name
type_name
order_type
template_number
template_fields {
all_used_fields {
name
field_type
manual_input
}
}
}
totalDocs
page
totalPages
hasNextPage
}
}

Arguments

NameTypeRequiredDescription
tenantIds[ID!]!YesOne or more Tenant IDs to fetch Templates for. The API user must have access to each Tenant.
credentialTemplateTypes[CredentialTemplateTypes]NoFilter by Template type. See Template types below. Omit to return all types.
paginationPaginationOptionsNoPagination and filtering options. See Pagination below.

Template types

ValueDescription
TPL_CardCredentialPhysical card Credential (printed ID card, access card, etc.)
TPL_MobileCredentialMobile Credential delivered to a phone (Mobile ID, Duo ID)

Pagination

PaginationOptions controls paging, sorting, and filtering.

FieldTypeDescription
pageIntPage number (1-based). Default: 1.
limitIntResults per page. Default: 10.
offsetIntNumber of results to skip. Alternative to page.
sortStringSort specification (e.g., "name", "-name" for descending).
filter[PaginationFilter]Array of filter conditions. Each filter has field, value, and operator — one of eq (alias exact), ne, gt, gte, lt, lte, in, or like.

Response

docs[] fields

FieldTypeDescription
_idIDTemplate ID. Pass this as template_id when ordering.
nameStringHuman-readable Template name as shown in the Breeze UI.
type_nameCredentialTemplateTypesTemplate type — TPL_CardCredential or TPL_MobileCredential.
order_typeString"single" for single-Credential Templates (the default), "batch" for batch Templates. Batch Templates accept the quantity argument on CredentialOrderV1.
template_numberIntNumeric identifier for the Template within the Tenant.
template_fields.all_used_fields[DataField]All fields used by this Template, including type and whether the integrator provides them.

all_used_fields[] fields

FieldTypeDescription
nameStringField name. Use this as data_field in the order payload.
field_typeStringType of value the field holds: string, number, boolean, date, buffer. Determines which value key to use.
manual_inputBooleantrue — you must supply this field when ordering. false — the system populates it automatically; your value is ignored. Exception: image fields such as personPhoto1 can still be supplied via the API — see Data fields.

Pagination fields

FieldTypeDescription
totalDocsIntTotal number of Templates matching the query.
pageIntCurrent page number.
totalPagesIntTotal number of pages.
hasNextPageBooleanWhether a next page exists.

Example

query GetTemplates($tenantIds: [ID!]!) {
CredentialTemplatesV2(tenantIds: $tenantIds) {
docs {
_id
name
type_name
order_type
template_fields {
all_used_fields {
name
field_type
manual_input
}
}
}
totalDocs
page
totalPages
hasNextPage
}
}

Variables:

{ "tenantIds": ["tenant_abc123"] }

Error cases

CodeCauseResolution
UNAUTHENTICATEDToken missing or expiredRequest a new token — see Authentication
FORBIDDENNo access to one or more of the provided tenantIdsVerify the Tenants are within your API user's scope

See also