Python SDK

Install and start using the Python SDK.

Intro

The Decionis APIs SDK provides access to the Decionis APIs REST APIs.

Decionis evaluates captured execution intent against versioned policies before the caller performs the action. SDKs delegate policy judgment to this service and locally enforce the signed decision. New SDK API keys can be associated with an industry so Decionis provisions a starter encoded policy binding server-side; applications do not receive or implement policy logic., Ask a user's Shield for authority before an application or AI agent spends money.

Applications MUST request authorization before executing the consequential action. ALLOW authorizes only the exact request evaluated. ASK means hold until approval is complete. BLOCK means do not execute. A transport or API error is never permission.

Sandbox responses are simulations labelled sandbox_fixture and cannot move money.

Installation

Add the SDK to your project from its folder, with whichever package manager your project uses. Give each tool a path containing a slash, such as ../decionis-apis — a bare folder name is looked up on PyPI instead, and resolves to whatever project holds that name there:

Terminal
pip install <path-to-sdk>
Terminal
uv add <path-to-sdk>
Terminal
poetry add <path-to-sdk>

Quick Start

Synchronous client

Construct DecionisApisClient with keyword arguments, and call close() when you are done. Every argument is optional.

Python
from decionis_apis import DecionisApisClient

client = DecionisApisClient(
    api_key_auth="YOUR_BEARER_TOKEN",
    operator_entra_auth="YOUR_BEARER_TOKEN",
    account_session_cookie="YOUR_API_KEY",
    hosted_gateway_tcp_route_credential="YOUR_BEARER_TOKEN",
    hosted_gateway_tcp_broker_auth="YOUR_BEARER_TOKEN",
    hosted_gateway_worker_auth="YOUR_BEARER_TOKEN",
    protocol_service_auth="YOUR_BEARER_TOKEN",
    commerce_accounts_o_auth="YOUR_BEARER_TOKEN",
    commerce_connected_transport="YOUR_BEARER_TOKEN",
    accounts_workspace_credential_service="YOUR_BEARER_TOKEN",
    accounts_native_enrollment_service="YOUR_BEARER_TOKEN",
    drupal_site_key="YOUR_BEARER_TOKEN",
)

client.close()

Alternatively, scope it — with DecionisApisClient(...) as client: closes the pool on exit.

Asynchronous client

AsyncDecionisApisClient mirrors DecionisApisClient with identical method names, and every endpoint method is a coroutine. It takes the same arguments, with some differences — for example, the transport argument is custom_async_http_client.

Python
from asyncio import run

from decionis_apis import AsyncDecionisApisClient


async def main() -> None:
    client = AsyncDecionisApisClient(
        api_key_auth="YOUR_BEARER_TOKEN",
        operator_entra_auth="YOUR_BEARER_TOKEN",
        account_session_cookie="YOUR_API_KEY",
        hosted_gateway_tcp_route_credential="YOUR_BEARER_TOKEN",
        hosted_gateway_tcp_broker_auth="YOUR_BEARER_TOKEN",
        hosted_gateway_worker_auth="YOUR_BEARER_TOKEN",
        protocol_service_auth="YOUR_BEARER_TOKEN",
        commerce_accounts_o_auth="YOUR_BEARER_TOKEN",
        commerce_connected_transport="YOUR_BEARER_TOKEN",
        accounts_workspace_credential_service="YOUR_BEARER_TOKEN",
        accounts_native_enrollment_service="YOUR_BEARER_TOKEN",
        drupal_site_key="YOUR_BEARER_TOKEN",
    )
    await client.aclose()


run(main())

Alternatively, scope it — async with AsyncDecionisApisClient(...) as client: closes the pool on exit.

On this page