Skip to main content
This guide covers the essential operations for working with Kodexa Documents: creating, loading, manipulating, and saving documents.

Creating Documents

Empty Document

Create a new document and build its structure:

From Text

Automatically parse text into paragraphs:

With Metadata

Initialize documents with metadata:

Loading Documents

From KDDB File

Load an existing document:

From Bytes

Load from API responses or downloads:

From JSON

Load from JSON representation:

Working with Content Nodes

Traverse the document tree:

Content Access

Read and modify node content:

Querying with Selectors

Use XPath-like selectors to find nodes:

Common Selector Patterns

Adding Features

Attach metadata to nodes:

Adding Tags

Annotate nodes with tags:

Saving Documents

To KDDB File

Save to the native format:

To Bytes

Export for API responses:

To JSON

Export for debugging or interoperability:

Document Metadata

Setting Metadata

Labels

Categorize documents:

Error Handling

Handle common errors gracefully:

Complete Example

Here’s a full workflow combining the concepts:

Working with Accessors

Once a document has been processed and contains extracted data, you can use accessors to work with data objects and attributes programmatically.

Data Objects

Data Attributes

Audit Trail

Next Steps

Platform Models

Auto-generated Pydantic models from the OpenAPI spec

Platform Client

Connect to the Kodexa API

Extraction

Extract structured data using taxonomies

Processing

Track processing steps and knowledge items

LLM & Model Manager

Access large language models through the AI Gateway