API Referencev1

Python SDK

Install the Nexra Python SDK, sign in, start runs, follow cursor pages and verify event webhooks from Python.

Updated 14/10/2026

On this page

Install

The Python SDK is awaiting publication to PyPI. Registry installation will be available here once the release is verified.

For access to the prepared package, contact contact@amakoragroup.com. You can also use the REST API.

Create a client

python
from nexra import create_client

client = create_client(token="...", workspace_id="...")

Both default to NEXRA_TOKEN and NEXRA_WORKSPACE_ID. Get a token with nexra auth login.

Call the API

Operations live in nexra.api.<group>, named after the reference. Each has sync, sync_detailed, asyncio and asyncio_detailed.

python
from nexra import unwrap
from nexra.api.integrations import list_integrations
from nexra.api.flows import get_flow

integrations = list_integrations.sync(client=client)
flow = unwrap(get_flow.sync_detailed("cmflow01orders", client=client))

unwrap returns the result or raises NexraApiError with status, code, request_id and the message.

Start a run

python
from nexra import start_run

run = start_run(client, "cmflow01orders", environment="sandbox")
print(run.id, run.status)

start_run adds an idempotency key and correlation id, so a retry never starts a second run.

Retries

Requests are retried up to 3 times with backoff on network errors and on 408, 425, 429 and 5xx answers, honouring Retry-After. Requests that change data are only retried when they carry an idempotency key or were refused with 429. Use create_client(retry=RetryOptions(max_retries=5)) to change this, or retry=False to turn it off.

Cursor pages

python
from nexra import paginate
from nexra.api.governance import list_evidence

for entry in paginate(lambda cursor: list_evidence.sync_detailed(client=client, cursor=cursor)):
    print(entry.sequence, entry.event_type)

Verify event webhooks

python
from nexra import construct_event, WebhookVerificationError

try:
    event = construct_event(raw_body, headers["X-Amakora-Signature"], secret)
except WebhookVerificationError:
    ...  # answer 400
if event["type"] == "flow.run.failed":
    print(event["data"]["run"]["id"])

Use the raw request body, before JSON parsing. Signatures more than 5 minutes old are refused.

Send events to a webhook trigger

python
import json, httpx
from nexra import sign_trigger_request

body = json.dumps({"orderId": "1001"})
headers = sign_trigger_request(body, trigger_secret, "order-1001-0001")
httpx.post(trigger_url, content=body, headers=headers)

Need a hand?

Ask Nexra Agent for implementation steps or error guidance.

Ask Nexra Agent