Skip to main content

CredentialOrderV1

Issues a new Credential for a person based on a Credential Template.

When to use

Call this after fetching your Template ID and required fields from CredentialTemplatesV2. On success the Credential is created and follows the Tenant's configured production flow — no further call is needed. See status for what happens next.

Required roles

user

All requests must be authenticated — see Authentication.

Operation

mutation OrderCredential($credential: CredentialOrderInput!, $tenantId: ID, $userId: ID) {
CredentialOrderV1(
credential: $credential
tenantId: $tenantId
userId: $userId
) {
_id
credential_number
status
created
}
}

Arguments

Top-level

NameTypeRequiredDescription
credentialCredentialOrderInput!YesThe Credential data. See CredentialOrderInput below.
tenantIdIDNoIssue the Credential under a specific Tenant. Defaults to the API user's primary Tenant. The API user must have access to that Tenant.
userIdIDNoIssue the Credential on behalf of another user. That user must have allow_api enabled in Breeze.

CredentialOrderInput

NameTypeRequiredDescription
template_idID!YesID of the Credential Template to use. Get this from CredentialTemplatesV2.
data[CredentialOrderDataFieldInput]!YesArray of field values. One entry per field. See CredentialOrderDataFieldInput below.
external_idStringNoYour system's identifier for this Credential. Stored on the Credential and available in lookups.
order_referenceStringNoReference string added to the invoice for this order.
object_idIDNoLinks the Credential to an existing object in Breeze.
quantityIntNoNumber of Credentials to order. Only valid for batch-type Templates. Defaults to 1.

CredentialOrderDataFieldInput

Each entry in data provides a value for one field. Use exactly one value key matching the field's field_type.

NameTypeRequiredDescription
data_fieldString!YesField name. Must match a name from all_used_fields on the Template.
string_valueStringNoUse when field_type is string.
number_valueIntNoUse when field_type is number.
bool_valueBooleanNoUse when field_type is boolean.
date_valueDateNoUse when field_type is date. ISO 8601 format: 2035-12-31T12:00:00.000Z.
base64_valueStringNoUse when field_type is buffer. Base64-encoded image string. Max 5 MB.
url_valueStringNoUse when field_type is buffer. Publicly accessible image URL. The server downloads and stores the image. Max 5 MB.

Only fields where manual_input: true need to be included. Fields where manual_input: false are populated automatically by the system — values you provide for them are ignored, with one exception: image fields such as personPhoto1 accept base64_value or url_value even though they are not manual input. See Data fields for the full field list and the image exception.

Response

FieldTypeDescription
_idIDThe Credential's unique ID. Use this to look up or reference the Credential later.
credential_numberIntHuman-readable Credential number visible in the Breeze UI. May be null if the Template does not assign a number at order time.
statusStringStatus immediately after ordering — depends on the Tenant's checkout-flow configuration. See below.
createdDateISO 8601 timestamp of when the order was placed.

Status values

StatusMeaning
in_queueSent directly to the production queue (On-the-Fly checkout flow).
requestedAdded to the Tenant's order and checkout process (Default or Scheduled checkout flow).
waiting_for_approvalAn approver must approve the Credential before it moves to production.

Which status you get depends on how the Tenant's checkout flow and approval rules are configured — ask the Tenant administrator which flow applies. No further API call is needed in any case; the Credential proceeds through the configured flow automatically.

Example

mutation OrderCredential($credential: CredentialOrderInput!) {
CredentialOrderV1(credential: $credential) {
_id
credential_number
status
created
}
}

Variables:

{
"credential": {
"template_id": "template_card123",
"external_id": "EMP-00412",
"data": [
{ "data_field": "personFirstName", "string_value": "Jane" },
{ "data_field": "personLastName", "string_value": "Smith" },
{ "data_field": "cardValidUntilDate", "date_value": "2029-12-31T12:00:00.000Z" },
{ "data_field": "personPhoto1", "url_value": "https://hr.example.com/photos/jane_smith.jpg" }
]
}
}

Error cases

CodeCauseResolution
UNAUTHENTICATEDToken missing or expiredRequest a new token — see Authentication
FORBIDDENNo access to the target Tenant, or userId does not have allow_api enabledVerify the Tenant is within your API user's scope; confirm the target user has API access enabled in Breeze
BAD_USER_INPUTInvalid template_id, missing required field, wrong value type for a field, or image URL unreachableCheck message for the specific field; verify field names and types against Data fields; confirm image URLs are publicly accessible
NOT_FOUNDTemplate not found or not accessible to the TenantVerify template_id using CredentialTemplatesV2

See also