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
| Name | Type | Required | Description |
|---|---|---|---|
tenantIds | [ID!]! | Yes | One or more Tenant IDs to fetch Templates for. The API user must have access to each Tenant. |
credentialTemplateTypes | [CredentialTemplateTypes] | No | Filter by Template type. See Template types below. Omit to return all types. |
pagination | PaginationOptions | No | Pagination and filtering options. See Pagination below. |
Template types
| Value | Description |
|---|---|
TPL_CardCredential | Physical card Credential (printed ID card, access card, etc.) |
TPL_MobileCredential | Mobile Credential delivered to a phone (Mobile ID, Duo ID) |
Pagination
PaginationOptions controls paging, sorting, and filtering.
| Field | Type | Description |
|---|---|---|
page | Int | Page number (1-based). Default: 1. |
limit | Int | Results per page. Default: 10. |
offset | Int | Number of results to skip. Alternative to page. |
sort | String | Sort 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
| Field | Type | Description |
|---|---|---|
_id | ID | Template ID. Pass this as template_id when ordering. |
name | String | Human-readable Template name as shown in the Breeze UI. |
type_name | CredentialTemplateTypes | Template type — TPL_CardCredential or TPL_MobileCredential. |
order_type | String | "single" for single-Credential Templates (the default), "batch" for batch Templates. Batch Templates accept the quantity argument on CredentialOrderV1. |
template_number | Int | Numeric 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
| Field | Type | Description |
|---|---|---|
name | String | Field name. Use this as data_field in the order payload. |
field_type | String | Type of value the field holds: string, number, boolean, date, buffer. Determines which value key to use. |
manual_input | Boolean | true — 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
| Field | Type | Description |
|---|---|---|
totalDocs | Int | Total number of Templates matching the query. |
page | Int | Current page number. |
totalPages | Int | Total number of pages. |
hasNextPage | Boolean | Whether a next page exists. |
Example
- Request
- Success
- Error
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"] }
{
"data": {
"CredentialTemplatesV2": {
"docs": [
{
"_id": "template_card123",
"name": "Company ID Card",
"type_name": "TPL_CardCredential",
"order_type": "single",
"template_fields": {
"all_used_fields": [
{ "name": "personFirstName", "field_type": "string", "manual_input": true },
{ "name": "personLastName", "field_type": "string", "manual_input": true },
{ "name": "personPhoto1", "field_type": "buffer", "manual_input": false },
{ "name": "cardValidUntilDate", "field_type": "date", "manual_input": true },
{ "name": "cardNumber", "field_type": "string", "manual_input": false }
]
}
},
{
"_id": "template_mobile456",
"name": "Mobile Credential",
"type_name": "TPL_MobileCredential",
"order_type": "single",
"template_fields": {
"all_used_fields": [
{ "name": "personFirstName", "field_type": "string", "manual_input": true },
{ "name": "personLastName", "field_type": "string", "manual_input": true },
{ "name": "personEmail", "field_type": "string", "manual_input": true }
]
}
}
],
"totalDocs": 2,
"page": 1,
"totalPages": 1,
"hasNextPage": false
}
}
}
{
"errors": [
{
"message": "Token validation failed",
"extensions": { "code": "UNAUTHENTICATED" }
}
],
"data": null
}
Error cases
| Code | Cause | Resolution |
|---|---|---|
UNAUTHENTICATED | Token missing or expired | Request a new token — see Authentication |
FORBIDDEN | No access to one or more of the provided tenantIds | Verify the Tenants are within your API user's scope |
See also
- Order a Credential — use-case guide
CredentialOrderV1- Data fields