Kodexa Python SDK Quick Start Guide

This guide will help you set up your environment and start using the Kodexa Python SDK to interact with Kodexa’s documents and platform features.

Prerequisites

Install Python 3.11

  1. Download Python 3.11 from python.org/downloads
  2. Run the installer
  3. Important: Check “Add Python 3.11 to PATH” during installation

Environment Setup

Create a Virtual Environment

# Navigate to your project directory
python -m venv kodexa_env

# Activate the environment
# Windows:
kodexa_env\Scripts\activate

# macOS/Linux:
source kodexa_env/bin/activate

Install the Kodexa SDK

pip install kodexa

Authentication

Generate an API Token

  1. Log in to kodexa.platform.ai
  2. Click your profile picture → Profile
  3. Navigate to “API Tokens” tab
  4. Click “New Access Token”
  5. Enter a name and click “Generate New Access Token”
  6. Copy the token immediately (it will only be shown once)

Your First Script

Create a file named kodexa_script.py:

import os
from kodexa import KodexaClient

# Set environment variables
os.environ['KODEXA_URL'] = 'https://your-kodexa-url.com'
os.environ['KODEXA_ACCESS_TOKEN'] = 'your-access-token'

# Initialize the client
client = KodexaClient(
    url=os.environ.get('KODEXA_URL'),
    access_token=os.environ.get('KODEXA_ACCESS_TOKEN')
)

# Verify connection
me = client.me
print(f"Logged in as: {me.email}")

# Ready to use the Kodexa platform!

Run Your Script

python kodexa_script.py

Best Practices

  • Store credentials as environment variables instead of hardcoding them
  • Keep your virtual environment activated while working with Kodexa
  • Replace the example URL and token with your actual values