ThirdFactor Python SDK
Official server-side SDK for the ThirdFactor identity verification API.
Keep your ThirdFactor API key on the server. Never expose it in browser or mobile application code.
Installation
pip install thirdfactor-sdk
Python 3.9 or newer is supported. The SDK has no runtime dependencies.
Create a verification session
import os
from thirdfactor import ThirdFactor
tf = ThirdFactor(
api_key=os.environ["THIRDFACTOR_API_KEY"],
base_url="https://your-tenant.thirdfactor.ai",
)
session = tf.sessions.create(
vendor_data="user-42",
workflow_id="4c615aec-e173-450d-8089-30d4edc835f3",
callback_url="https://example.com/kyc/done",
idempotency_key="kyc-user-42",
)
print(session["url"])
decision = tf.sessions.decision(session["id"])
The workflow_id comes from GET /v3/workflows/:
workflows = tf.request("GET", "/v3/workflows/")
Verify webhooks
Webhook handlers must pass the untouched request bytes, before JSON parsing:
event = tf.webhooks.construct_event(raw_body, signature_header, "whsec_...")
Invalid or stale signatures raise SignatureError. The default replay window
is five minutes.
Handle API errors
from thirdfactor import APIError
try:
session = tf.sessions.retrieve("session-id")
except APIError as error:
print(error.status, error.body, error.request_id)
See the ThirdFactor documentation for API, workflow, decision, and webhook details.
Metadata
Release files for thirdfactor-sdk 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| thirdfactor_sdk-0.1.0.tar.gz | 6.0 kB | Without provenance | Details for thirdfactor_sdk-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| thirdfactor_sdk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for thirdfactor_sdk-0.1.0-py3-none-any.whl |
Total release size: 11.8 kB
Release files / thirdfactor_sdk-0.1.0.tar.gz
| Download URL | thirdfactor_sdk-0.1.0.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6f652dd5d6f61303987167d2ae2d316aeb0dec916cbb7a48999e7b3241aa11fd
|
|
BLAKE2b-256 checksum How to use checksums |
95f96a3c2980f06375228f9d152d8cc8c0c63c533801954331196ba84db421be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Release files / thirdfactor_sdk-0.1.0-py3-none-any.whl
| Download URL | thirdfactor_sdk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cdf546daf020773966dfe17945c0daf98b567886e9c88310612a072d6922eebc
|
|
BLAKE2b-256 checksum How to use checksums |
4154fcbdeccc8abc5108451b228b697183b4b22eb73564e1fe55779b19ea716d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Security for thirdfactor-sdk 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.