Skip to main content

Rossum API

PyPI version Python versions Build Status Coverage Code style: Ruff Documentation MIT licence

rossum-api provides Python programmatic access to the Rossum API and other useful tooling enabling seamless integration of the Rossum platform into Python applications.

It is a replacement for Rossum package. In case of any missing functionality, please open an issue or a pull request.

For comprehensive API reference and detailed examples, visit our documentation.

Key Features

  • Minimal dependencies: Lightweight with minimal external dependencies

  • API-aligned naming: Method names map closely to the official API documentation

  • Dual API support: Choose between synchronous and asynchronous clients

  • Authentication: Built-in authentication handling

  • Retry mechanism: Built-in retry mechanism handling throttling API errors

  • Pagination handling: Automatically merges paginated results into one list

  • Rich methods: Includes methods for frequent API operations

  • Type-safe: Returns results as Python dataclasses with full type hints

Installation

The easiest way is to install the package from PyPI:

pip install rossum-api

or from the github repo:

pip install git+https://github.com/rossumai/rossum-sdk#egg=rossum-api

You can eventually download an installation file from GitHub releases and install it manually.

Usage

Python API

The rossum-api library can be used to communicate with Rossum API, instead of using requests library directly. The advantages of using rossum-api:

  • it contains a function that merges the paginated results into a single list so the user does not need to get results page by page and take care of their merging,

  • it comes with both synchronous and asynchronous API, so you can choose the approach you need,

  • it takes care of authenticating the user,

  • it includes many methods for common actions that you don’t need to write by yourself from scratch,

  • it returns the result as a Python first-class object (dataclass), so you don’t need to parse the JSON by yourself,

  • it maps method naming as close as possible to API docs,

  • in case the API version changes, the change will be implemented in the library by the Rossum team for all users.

  • it has minimal dependencies

Examples

You can choose between asynchronous and synchronous clients. Both are exactly the same in terms of features.

Async version

import asyncio
import os
from rossum_api import AsyncRossumAPIClient
from rossum_api.dtos import UserCredentials

WORKSPACE = {
    "name": "Rossum Client NG Test",
    "organization": "https://elis.rossum.ai/api/v1/organizations/116390",
}


async def main_with_async_client() -> None:
    client = AsyncRossumAPIClient(
        base_url="https://elis.rossum.ai/api/v1",
        credentials=UserCredentials(os.environ["ELIS_USERNAME"], os.environ["ELIS_PASSWORD"]),
    )
    ws = await client.create_new_workspace(data=WORKSPACE)
    workspace_id = ws.id
    ws = await client.retrieve_workspace(workspace_id)
    print("GET result:", ws)
    print("LIST results:")
    async for w in client.list_workspaces(ordering=["-id"], name=WORKSPACE["name"]):
        print(w)
    await client.delete_workspace(workspace_id)
    print(f"Workspace {workspace_id} deleted.")


asyncio.run(main_with_async_client())

Sync version

import os

from rossum_api import SyncRossumAPIClient
from rossum_api.dtos import UserCredentials

WORKSPACE = {
    "name": "Rossum Client NG Test",
    "organization": "https://elis.rossum.ai/api/v1/organizations/116390",
}


def main_with_sync_client() -> None:
    client = SyncRossumAPIClient(
        base_url="https://elis.rossum.ai/api/v1",
        credentials=UserCredentials(os.environ["ELIS_USERNAME"], os.environ["ELIS_PASSWORD"]),
    )
    ws = client.create_new_workspace(data=WORKSPACE)
    workspace_id = ws.id
    ws = client.retrieve_workspace(workspace_id)
    print("GET result:", ws)
    print("LIST results:")
    for w in client.list_workspaces(ordering=["-id"], name=WORKSPACE["name"]):
        print(w)
    client.delete_workspace(workspace_id)
    print(f"Workspace {workspace_id} deleted.")


main_with_sync_client()

Local development

Pull the repository, create a virtual environment, and install the package from the source with test dependencies:

# Create and activate virtual environment
python -m venv .env
source .env/bin/activate

# Install in editable mode with test dependencies
pip install -e .[tests]

We use ruff for linting and formatting. Run all pre-commit hooks with:

pre-commit run --all-files

Or run specific tools:

# Linting and formatting
pre-commit run ruff --all-files
pre-commit run ruff-format --all-files

# Type checking
pre-commit run ty --all-files

# Run tests
pytest

License

MIT

Metadata

Release files for rossum-api 3.16.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rossum-api 3.16.1
File Size Uploaded
rossum_api-3.16.1.tar.gz 170.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rossum-api 3.16.1
File Interpreter ABI Platform
rossum_api-3.16.1-py3-none-any.whl Python 3 none any Details

Total release size: 254.8 kB

Release files / rossum_api-3.16.1.tar.gz

Download URL rossum_api-3.16.1.tar.gz
Size 170.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6b4d833f969fde97f5c7005304e5d90121597f804978d134e9413215e250c401
BLAKE2b-256 checksum
How to use checksums
f0434f88135a8cf90110c129ce9503733fe8a9ef870f07de54bc0b47362bd360
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rossum_api-3.16.1-py3-none-any.whl

Download URL rossum_api-3.16.1-py3-none-any.whl
Size 84.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f90e5c2983ea44eb10f30c616520b69462742a6434b7daeecd69a18d0ca2bb4
BLAKE2b-256 checksum
How to use checksums
58ed67987cc421d074c5105457ec75bc7d92eee0d2ae764c105fab4d2dd8c948
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

3.16.1 This release

2 release files

3.16.0

2 release files

3.15.0

2 release files

3.14.0

2 release files

3.13.3

2 release files

3.13.2

2 release files

3.13.1

2 release files

3.13.0

2 release files

3.12.1

2 release files

3.12.0

2 release files

3.11.2

2 release files

3.11.1

2 release files

3.10.0

2 release files

3.9.1

2 release files

3.9.0

2 release files

3.8.0

2 release files

3.7.2

2 release files

3.7.1

2 release files

3.7.0

2 release files

3.6.1

2 release files

3.6.0

2 release files

3.5.2

2 release files

3.5.1

2 release files

3.5.0

2 release files

3.4.0

2 release files

3.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page