Browse the API reference

Create Taxonomy Block

post/extensions/roboledger/{graph_id}/operations/create-taxonomy-block

Part of Extensions: RoboLedger.

Create a taxonomy block atomically: one envelope carrying the taxonomy row plus its structures, elements, associations, and rules. Dispatches by taxonomy_typechart_of_accounts (declarative tenant CoA), reporting_extension, and custom_ontology are supported; reporting_standard is library-origin (501). reporting_extension / custom_ontology authoring may be disabled per environment (TAXONOMY_AUTHORING_ENABLED) — disabled surfaces 403. NOT the path for a functional close schedule: a structure with block_type='schedule' here is a bare ontology row with none of the schedule machinery (per-period facts, schedule_entry_due obligations, closing-entry generator). To create a working schedule use create-information-block(block_type='schedule').

Idempotency: supply an Idempotency-Key header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.

Authentication

Authenticate in any one of these ways — not all of them:

  • API key in the X-API-Key header.
  • Bearer token in the Authorization header.

Path parameters

NameTypeDescription
graph_idrequiredstringGraph Id

Header parameters

NameTypeDescription
Idempotency-KeyoptionalstringIdempotency-Key

Request body

Required, application/json.

FieldTypeDescription
namerequiredstring

Taxonomy display name.

taxonomy_typerequiredstring

Block-type discriminator. ``chart_of_accounts`` and ``custom_ontology`` construct from scratch; ``reporting_extension`` extends an existing library ``reporting_standard``.

One of: reporting_standard, reporting_extension, custom_ontology, chart_of_accounts, schedule

parent_taxonomy_idoptionalstring

Required when ``taxonomy_type == 'reporting_extension'`` — the id of the library ``reporting_standard`` being extended.

versionoptionalstring
descriptionoptionalstring
standardoptionalstring
namespace_urioptionalstring
elementsoptionalTaxonomyBlockElementRequest[]

Element definition inside a Taxonomy Block envelope. ``qname`` is the envelope-local identifier — must be unique within the envelope's ``elements`` list and is used by association / rule / patch payloads as the reference token. ``parent_ref`` may reference another envelope-local qname or, for ``reporting_extension`` blocks, a library element qname.

TaxonomyBlockElementRequest fields
FieldTypeDescription
qnamerequiredstring

Envelope-local element identifier. Must be unique within the envelope's ``elements`` list. Used as the reference token for associations, rules, and update patches.

namerequiredstring

Human-readable element name (e.g. 'Total Assets').

traitoptionalstring

FASB metamodel trait for the element. Required for ``chart_of_accounts`` blocks; optional for ``custom_ontology``.

balance_typeoptionalstring

'debit' | 'credit' | null for non-monetary concepts.

element_typeoptionalstring

'concept' | 'abstract' | 'axis' | 'member' | 'hypercube'.

Default: concept

period_typeoptionalstring

'instant' | 'duration' | null (null = derive from classification during validation).

is_monetaryoptionalboolean

True for dollar-denominated concepts.

Default: true

descriptionoptionalstring
codeoptionalstring

Optional chart-of-accounts code (e.g. '1000', '4100-02'). Only meaningful for ``chart_of_accounts`` blocks.

sub_classificationoptionalstring
parent_refoptionalstring

qname of the parent element — either another envelope-local qname or, for ``reporting_extension`` blocks, a library element qname.

metadataoptionalobject
structuresoptionalTaxonomyBlockStructureRequest[]

Structure definition inside a Taxonomy Block envelope.

TaxonomyBlockStructureRequest fields
FieldTypeDescription
namerequiredstring

Envelope-local structure name (unique within envelope).

block_typerequiredstring

DB ``structures.block_type`` enum. CoA blocks use ``chart_of_accounts``; reporting extensions use the statement family, ``regulatory_disclosure`` (disclosure notes), or ``custom``; custom ontology uses ``custom``.

One of: chart_of_accounts, custom, balance_sheet, income_statement, cash_flow_statement, equity_statement, coa_mapping, schedule, rollforward, reconciliation, policy, metric, regulatory_disclosure

concept_arrangementoptionalstring

Concept Arrangement Pattern (CAP) — how the structure's concepts relate (mirrors the ``structures.concept_arrangement`` CHECK vocabulary). A disclosure note footing members to a total is ``roll_up``. Null leaves the pattern unset.

One of: set, roll_up, roll_forward, roll_forward_info, adjustment, variance, arithmetic, text_block, level1_textblock, level2_textblock, level3_textblock, level4_detail, table_equivalent_textblock, grid, compound_fact

descriptionoptionalstring
role_urioptionalstring
metadataoptionalobject
associationsoptionalTaxonomyBlockAssociationRequest[]

Association (arc) between two elements, scoped to a structure.

TaxonomyBlockAssociationRequest fields
FieldTypeDescription
structure_refrequiredstring

Envelope-local structure name (references a structure declared in the same envelope).

from_refrequiredstring

qname of the source element.

to_refrequiredstring

qname of the target element.

association_typerequiredstring

DB ``associations.association_type`` enum. ``presentation`` = parent-child hierarchy; ``calculation`` = summation arc.

One of: presentation, calculation, mapping, equivalence, general-special, essence-alias

order_valueoptionalnumber
arcroleoptionalstring
weightoptionalnumber

Calculation-arc coefficient (+1 / -1 for summation, other values for weighted rollups). Null for non-calculation arcs.

metadataoptionalobject
rulesoptionalTaxonomyBlockRuleRequest[]

Rule definition inside a Taxonomy Block envelope. Exactly one of ``target_structure_ref``, ``target_element_qname``, or ``target_taxonomy_self`` must be set (or all null for a global rule). The ``model_validator`` enforces this contract at the Pydantic layer. Only **arithmetic** rule patterns are user-creatable via this API (the ``rule_pattern`` Literal below). The 6 model-structure check kinds (``NoCycles``, ``NoOrphanArcs``, ``ParentBeforeChild``, ``LeafHasClassification``, ``LibraryOriginImmutability``, ``UniqueQNameInTaxonomy``) are system-managed — they're auto-emitted by :func:`emit_auto_rules` at taxonomy-block creation time and populate ``rules.rule_check_kind`` instead of ``rule_pattern``.

TaxonomyBlockRuleRequest fields
FieldTypeDescription
namerequiredstring

Rule identifier, unique within envelope.

descriptionoptionalstring
rule_categoryrequiredstring

One of 8 cm:VerificationRule subclasses.

One of: AutomatedAccountingAndReportingChecks, DisclosureMechanicsRule, FundamentalAccountingConceptRelation, PeerConsistencyRule, PriorPeriodConsistencyRule, ReportLevelModelStructureRule, ReportingSystemSpecificRule, ToDoManualTask, XBRLTechnicalSyntaxRule

rule_patternrequiredstring

One of the cm:BusinessRulePattern mechanisms. 'Derive' rules COMPUTE a value from bound operand facts (compute-metrics) rather than verify one — the tenant-authored-metric pattern.

One of: Adjustment, CoExists, Derive, EqualTo, Exists, GreaterThan, GreaterThanOrEqualToZero, LessThan, RollForward, RollUp, SumEquals, Variance

expressionrequiredstring

XPath-flavored predicate body (the rule expression).

variablesoptionalobject[]

``$Variable`` → qname bindings. Each entry is ``{'variable_name': str, 'variable_qname': str}``.

severityoptionalstring

One of: info, warning, error

Default: error

target_structure_refoptionalstring

Envelope-local structure name this rule targets (for structure-scoped rules). Mutually exclusive with the other target_* fields.

target_element_qnameoptionalstring

qname of the element this rule targets. Mutually exclusive with the other target_* fields.

target_taxonomy_selfoptionalboolean

True iff the rule targets the envelope's own taxonomy row (``target_kind='taxonomy'``). Mutually exclusive with the other target_* fields.

Default: false

messageoptionalstring
metadataoptionalobject
metadataoptionalobject

Example request

curl
curl -X POST "https://api.robosystems.ai/extensions/roboledger/{graph_id}/operations/create-taxonomy-block" \
  -H "X-API-Key: $ROBOSYSTEMS_API_KEY" \
  -H "Idempotency-Key: <Idempotency-Key>" \
  -H "Content-Type: application/json" \
  -d '{
  "elements": [
    {
      "balance_type": "debit",
      "code": "1000",
      "name": "Cash",
      "qname": "acme:Cash",
      "trait": "asset"
    },
    {
      "balance_type": "credit",
      "code": "2000",
      "name": "Accounts Payable",
      "qname": "acme:AccountsPayable",
      "trait": "liability"
    }
  ],
  "name": "Acme CoA",
  "structures": [
    {
      "block_type": "chart_of_accounts",
      "name": "main"
    }
  ],
  "taxonomy_type": "chart_of_accounts"
}'

Responses

200 Successful Response

FieldTypeDescription
operationrequiredstring

Kebab-case operation name

operationIdrequiredstring

op_-prefixed ULID for audit and SSE correlation

statusrequiredstring

Operation lifecycle state

One of: completed, pending, failed

resultoptionalTaxonomyBlockEnvelope

Command-specific result payload

TaxonomyBlockEnvelope fields
FieldTypeDescription
idrequiredstring

Taxonomy row id.

namerequiredstring
taxonomy_typerequiredstring

Block-type discriminator — 'reporting_standard' | 'reporting_extension' | 'chart_of_accounts' | 'custom_ontology'.

display_namerequiredstring

Registry-sourced display label.

categoryrequiredstring

Registry-sourced sidebar grouping.

parent_taxonomy_idoptionalstring
parent_taxonomy_nameoptionalstring
versionoptionalstring
standardoptionalstring
namespace_urioptionalstring
is_lockedoptionalboolean

Default: false

elementsoptionalTaxonomyBlockElement[]

Element projection for the Taxonomy Block envelope.

TaxonomyBlockElement fields
FieldTypeDescription
idrequiredstring
qnameoptionalstring
namerequiredstring
traitoptionalstring
balance_typeoptionalstring
period_typeoptionalstring
element_typeoptionalstring

Default: concept

is_monetaryoptionalboolean

Default: true

parent_qnameoptionalstring
depthoptionalinteger
originrequiredstring

Provenance — 'library' if the element's taxonomy is locked (``is_locked=true``), else 'tenant'.

One of: library, tenant

structuresoptionalTaxonomyBlockStructure[]

Structure projection for the Taxonomy Block envelope.

TaxonomyBlockStructure fields
FieldTypeDescription
idrequiredstring
namerequiredstring
block_typerequiredstring
descriptionoptionalstring
role_urioptionalstring
associationsoptionalTaxonomyBlockAssociation[]

Association projection for the Taxonomy Block envelope.

TaxonomyBlockAssociation fields
FieldTypeDescription
idrequiredstring
structure_idrequiredstring
from_element_qnamerequiredstring
to_element_qnamerequiredstring
association_typerequiredstring
order_valueoptionalnumber
arcroleoptionalstring
weightoptionalnumber
rulesoptionalTaxonomyBlockRule[]

Rule projection for the Taxonomy Block envelope. Exactly one of ``rule_pattern`` (arithmetic) or ``rule_check_kind`` (model-structure) is non-null per row, enforced by the ``check_rule_pattern_kind_xor`` DB constraint.

TaxonomyBlockRule fields
FieldTypeDescription
idrequiredstring
namerequiredstring
rule_categoryrequiredstring
rule_patternoptionalstring
rule_check_kindoptionalstring
rule_expressionrequiredstring
severityoptionalstring

Default: error

originoptionalstring

'forked' | 'native' | 'auto' — matches DB CHECK.

Default: native

target_kindoptionalstring
target_refoptionalstring

Polymorphic display string — structure_id, element qname, association_id, or taxonomy_id depending on ``target_kind``.

verification_resultsoptionalobject[]
element_countoptionalinteger

Default: 0

structure_countoptionalinteger

Default: 0

association_countoptionalinteger

Default: 0

atrequiredstring

ISO-8601 UTC timestamp

createdByoptionalstring

User ID that initiated the operation (null for legacy callers)

idempotentReplayoptionalboolean

True when this envelope came from the idempotency cache — the underlying command did not execute again. False on fresh executions.

Default: false

StatusMeaning
400Invalid request
401Authentication required
403Access denied
404Resource not found
409Idempotency-Key conflict — key reused with different body
422Validation error
429Rate limit exceeded
500Internal server error