Document Numbering Queries

Query document numbering sequences and formats.

DocumentNumberingContext

Returns the effective numbering context for a document type, including whether manual override is allowed, shared sequences, and date constraints.

Parameters:

ParameterTypeDescription
document_typeString!Document type (e.g., invoice, estimate).
dated_atStringDate for context (format: YYYY-MM-DD).

Example Query:

query GetDocumentNumberingContext($document_type: String!, $dated_at: String) {
  DocumentNumberingContext(document_type: $document_type, dated_at: $dated_at) {
    manual_override_allowed_effective
    shared_sequence_with
    preview
    min_date
    max_date
  }
}

Example Variables:

{
  "document_type": "invoice",
  "dated_at": "2026-01-15"
}
FieldTypeDescription
manual_override_allowed_effectiveBoolean!Whether manual number override is currently allowed.
shared_sequence_withStringDocument type sharing the same sequence, if any.
previewString!Preview of the next document number.
min_dateStringMinimum allowed date for this document type.
max_dateStringMaximum allowed date for this document type.

DocumentSequencePreview

Returns a preview of the next document number for a given document type and date.

Parameters:

ParameterTypeDescription
document_typeString!Document type (e.g., invoice, estimate).
dated_atStringDate for the preview (format: YYYY-MM-DD).

Example Query:

query GetDocumentSequencePreview($document_type: String!, $dated_at: String) {
  DocumentSequencePreview(document_type: $document_type, dated_at: $dated_at)
}

Example Variables:

{
  "document_type": "invoice",
  "dated_at": "2026-01-15"
}
Return TypeDescription
String!Preview of the next document number.

DocumentFinalizationDateConstraints

Returns the minimum and maximum allowed dates for finalizing a document of a given type.

Parameters:

ParameterTypeDescription
document_typeString!Document type (e.g., invoice, estimate).

Example Query:

query GetDocumentFinalizationDateConstraints($document_type: String!) {
  DocumentFinalizationDateConstraints(document_type: $document_type) {
    min_date
    max_date
  }
}

Example Variables:

{
  "document_type": "invoice"
}
FieldTypeDescription
min_dateStringMinimum allowed finalization date.
max_dateStringMaximum allowed finalization date.

DocumentSequenceConfigs

Returns the list of document sequence configurations for the company. Requires the company_update permission.

Example Query:

query GetDocumentSequenceConfigs(
  $where: QueryDocumentSequenceConfigsWhereWhereConditions,
  $orderBy: [QueryDocumentSequenceConfigsOrderByOrderByClause!]
) {
  DocumentSequenceConfigs(
    where: $where,
    orderBy: $orderBy
  ) {
    id
    document_type
    format_mode
    manual_override_allowed
    prefix
    next_number
    padding_length
    reset_policy
    can_apply_now
  }
}

Filters: id, document_type, format_mode, manual_override_allowed, reset_policy.

DocumentSequenceConfig type

FieldTypeDescription
idInt!Configuration ID.
company_idInt!Company ID.
document_typeString!Document type (e.g., invoice, estimate).
format_modeString!Numbering format mode.
manual_override_allowedBoolean!Whether manual override is allowed.
prefixStringNumber prefix.
next_numberIntNext number in the sequence.
padding_lengthIntZero-padding length.
reset_policyStringReset policy (e.g., monthly, yearly).
current_period_keyStringCurrent period key.
shared_sequence_withStringDocument type sharing the sequence.
can_apply_nowBoolean!Whether pending settings can be applied now.
pending_settingsJSONPending settings to apply.
pending_activation_period_keyStringPeriod key for pending activation.
created_atDateTimeCreation time.
updated_atDateTimeLast update time.