Skip to main content

Python client for the Distyra Transaction Enrichment API (enrichment + SME underwriting)

Project description

distyra

Python client for the Distyra Transaction Enrichment API: transaction enrichment and SME cash-flow underwriting for EU lenders.

pip install distyra

Base URL: https://api.distyra.com (the SDK default). The API and CDN stay on .com; only the Distyra website and customer portal use .eu.

Quick start

import os
from distyra import Distyra

client = Distyra(api_key=os.environ["DISTYRA_API_KEY"])

result = client.enrich(
    descriptor="ALBERT HEIJN 1234 AMSTERDAM NL",
    amount=-12.34,
    currency="EUR",
    mcc="5411",
)
print(result.merchant.name)        # "Albert Heijn"
print(result.category.primary)     # "Retail & E-commerce"
print(result.category.source)      # "catalog" (curated) or "llm" (model-proposed)

Batch enrichment

batch = client.enrich_batch([
    {"descriptor": "ALBERT HEIJN 1234 AMSTERDAM NL", "amount": -12.34, "currency": "EUR"},
    {"descriptor": "NS GROEP B.V.", "amount": -4.50, "currency": "EUR"},
    {"descriptor": "NETFLIX.COM", "amount": -13.99, "currency": "EUR"},
])
for item in batch.items:
    print(item)

Up to 100 items per call; a failed item occupies its slot with an error envelope, the batch itself never fails.

Underwriting

Statement files in, one consolidated analysis out. Multiple files for the same applicant (the "last 6 months as 6 monthly PDFs" case) consolidate into one analysis over the merged window:

analysis = client.analyze_statement(
    ["jan.pdf", "feb.pdf", "mar.pdf"],
    applicant_id="loan-2026-0142",
    input_mode="statement_pdf",     # one format per analysis
    enrich=True,                    # optional: enrich every transaction
)
print(analysis.id, analysis.features)

JSON mode, when transactions are already on hand:

analysis = client.analyze(
    applicant_id="loan-2026-0142",
    input_mode="raw",
    accounts=[{
        "account_id": "main",
        "currency": "EUR",
        "opening_balance": 1500.0,
        "transactions": [
            {"date": "2026-05-01", "amount": 2500.0, "descriptor_raw": "INVOICE 1001 ACME BV"},
            {"date": "2026-05-15", "amount": -1200.0, "descriptor_raw": "RENT MAY OFFICE"},
        ],
    }],
)

Fetch a stored analysis later with client.get_analysis(analysis_id).

Note: enrichment is self-serve; underwriting endpoints are enabled per organization. Contact sales for access.

Errors

Every non-2xx raises DistyraError with the parsed envelope:

from distyra import Distyra, DistyraError

try:
    client.enrich(descriptor="...")
except DistyraError as e:
    print(e.status_code, e.error, e.detail)

Beyond the wrapper

The full generated client (every endpoint, typed models) ships in the same distribution as distyra_api_client. The wrapper's .raw attribute is a ready-authenticated instance:

from distyra_api_client.api.catalog import get_categories

categories = get_categories.sync(client=client.raw)

Development

This package lives in the Distyra monorepo at packages/saas-sdk-python/. The distyra_api_client package is generated from the committed OpenAPI snapshot — do not edit it by hand:

npm run snapshot -w @brightfield/saas-api   # refresh openapi.json from source
bash scripts/generate-python-sdk.sh         # regenerate distyra_api_client
bash scripts/test-python-sdk.sh             # build wheel + smoke

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

distyra-0.4.0.tar.gz (154.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

distyra-0.4.0-py3-none-any.whl (585.0 kB view details)

Uploaded Python 3

File details

Details for the file distyra-0.4.0.tar.gz.

File metadata

  • Download URL: distyra-0.4.0.tar.gz
  • Upload date:
  • Size: 154.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for distyra-0.4.0.tar.gz
Algorithm Hash digest
SHA256 b6feea508c4e7a97eaec5e87b2b1b01bf4a9546d95010bb75895b50ab96ce872
MD5 048fd60dea165d393a732ca0efc0e674
BLAKE2b-256 62a3a952fa09c5b928ee06c3b5ffbf28066517a6b69a3294b96d33bcbad27d71

See more details on using hashes here.

File details

Details for the file distyra-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: distyra-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 585.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for distyra-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3bda2b53228677c2716975edef4d68eebadb56dd30e5cf0e60d3ccc453138d45
MD5 6ae8c4cf49115f030c2d8a2743b62935
BLAKE2b-256 8203af7372e11d9b701b4de7ab77f46e097442aab6f982e0c034dc5d76af871d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page