Skip to main content
The Python SDK includes 489 Pydantic models and 29 enumeration classes auto-generated from the Kodexa API OpenAPI specification using datamodel-codegen. These models provide full type safety when working with the platform API.

How They’re Generated

The models in kodexa_document.model._generated are produced by running datamodel-codegen against the api-docs.yaml OpenAPI specification from kodexa-api. This happens as part of the CI pipeline and ensures the Python models always match the API.

Importing Models

Key Model Categories

Organizations & Projects

Assistants & Execution

Documents & Storage

Knowledge System

Tasks & Workflow

Users & Access

Request Models

Alongside the response model for each resource, the generated module contains a <Entity>CreateRequest and an <Entity>UpdateRequest, so a create or update payload can be built from a model that holds only the fields the server accepts:
  • <Entity> — the response shape, everything the API returns.
  • <Entity>CreateRequest — for POST bodies. Server-generated fields (id, uuid, createdOn, updatedOn, changeSequence) are absent, so they cannot be sent by accident.
  • <Entity>UpdateRequest — for PUT bodies. Keeps changeSequence for optimistic locking and omits the ownership fields an update never writes (for example projectId on a task).
Which fields the server requires is described by the API specification served at GET /v3/api-docs; the generated Python models leave every field optional so that partial payloads remain expressible.

Enumerations

Enumeration classes take their names from the API specification rather than from generator-invented ones, so each enum has one stable name across every generated client. They are StrEnum subclasses, so a member compares equal to its wire string.

Renamed enumerations

If you import enum classes by their old generated names, update the imports: ExecutionStatus is also exported from the top level, so from kodexa_document.model import ExecutionStatus works. The values on the wire are unchanged — only the Python type names are.

Task Status

Task carries the status as status_slug only. Resolve the label, color and status_type through the organization’s task statuses:
To move a task to another status, pass the TaskStatus to the task endpoint’s update_status(), which sends the slug for you.

KodexaBaseModel

All generated models inherit from KodexaBaseModel, which extends Pydantic’s BaseModel with:

camelCase / snake_case Support

Models accept both camelCase (matching the JSON API) and snake_case (Pythonic) field names:

Dict-like Access

Models support dict-style bracket access and get():

Extra Fields

The extra='allow' configuration means models accept fields not in the schema without raising errors. This handles forward-compatibility when the API adds new fields.

Taxonomy and Taxon Extensions

The SDK extends the generated TaxonomyBase and TaxonBase models with navigation methods. These are imported from the top-level package, not from _generated:

Taxon Methods

Taxonomy Methods

Deserializing API Responses

The models integrate naturally with API response data:
For the full platform client experience with pagination, authentication, and endpoint helpers, see the Platform Client page.

DateTime Handling

KodexaBaseModel uses a custom StandardDateTime type that serializes datetimes to millisecond-precision ISO 8601 strings with Z suffix (e.g., 2026-01-15T10:30:00.000Z). This matches the Java/Go API format.