Skip to main content
The official Didit library for Python. It needs Python 3.10 or later and offers a synchronous client, Didit, and an asynchronous one, AsyncDidit, with the same methods. See the server SDKs overview for what every SDK shares.

Install

The package is didit-sdk on PyPI. Its source and changelog are in didit-protocol/sdk-python on GitHub. To verify Authentication tokens, install the extra that adds the signature check:

Configure the client

Didit() reads DIDIT_API_KEY from the environment. Pass options to override it, or to set the organization and application ids that application-scoped calls (cases, networks, regulatory reports) need.

Create a session

Create a verification session for a workflow and send your user to its URL.

Read the decision

When the user finishes (or when the webhook arrives), read the decision. Every feature result is a list with one entry per workflow node.

Verify a webhook

Pass the exact raw body bytes and the request headers. verify raises WebhookVerificationError for anything that is not a valid, fresh delivery, so catching that one class is enough.
In Flask that is handle_webhook(request.get_data(), dict(request.headers)); in FastAPI, handle_webhook(await request.body(), request.headers). While you rotate the secret, pass both: [new_secret, old_secret]. See Webhooks for the events and the signature scheme.

Screen a transaction

Submit a payment, withdrawal or crypto transfer to transaction monitoring; the response carries its status and risk score.

Verify Authentication tokens

didit.authentication checks the access tokens your Authentication issuer signs, in your backend, without calling Didit for each request. It also exchanges codes, refreshes tokens, checks and revokes sessions, and runs step-ups.
Token verification makes the checks in Verify a token on your server, against your application’s issuer and signing keys.

Errors

Lists, files and async

Server endpoint pages of the API reference have a Python sample for their operation, except for the endpoints and fields that no 1.0.1 release has yet, named in the overview.