Skip to content

Python SDK

Installation

bash
pip install tauth

Or install directly from the repo:

bash
pip install ./sdk/python

Quick example

python
from tauth import TauthClient

client = TauthClient(api_key="tauth_sk_live_xxxxxxxxxxxx")

result = client.sign("photo.jpg", creator="Alice Johnson")

print(result["tx_hash"])       # Ethereum transaction hash
print(result["download_url"])  # Link to the signed file

The API key is sent as an X-API-Key header on every request. You can also set it via environment variable:

bash
export TAUTH_API_KEY=tauth_sk_live_xxxxxxxxxxxx
python
client = TauthClient()  # picks up TAUTH_API_KEY automatically

Custom base URL

python
client = TauthClient(api_key="...", base_url="https://api.tauth.io")

Sign a file

python
result = client.sign(
    "photo.jpg",
    creator="Alice Johnson",
    description="Product shot for summer campaign",
)
print(result["asset_id"])
print(result["tx_hash"])

Verify a file

python
result = client.verify_file("photo.jpg")
print(result["valid"])    # True / False
print(result["manifest"]) # extracted C2PA manifest or None

Verify by URL:

python
result = client.verify_url("https://example.com/photo.jpg")

Verify by SHA-256 hash:

python
result = client.verify_hash("e3b0c44298fc1c149afb...")

List assets

python
assets = client.list_assets()
for asset in assets:
    print(asset["file_name"], asset["tx_hash"])

Batch signing

python
import glob

client = TauthClient(api_key="tauth_sk_live_xxxxxxxxxxxx")

for path in glob.glob("photos/*.jpg"):
    result = client.sign(path, creator="Alice")
    print(f"{path}: {result['tx_hash']}")

Error handling

python
from tauth import TauthClient, TauthError

try:
    result = client.sign("photo.jpg", creator="Alice")
except TauthError as e:
    print(f"Error {e.status}: {e}")

Built on C2PA · Secured by Azure Key Vault · Anchored on Ethereum