Skip to main content Switch to mobile version aiveth 0.13.0 Official Aiveth SDK for Python: verify ID, access, machine and AI agent tokens, verify webhooks, and manage your organization's people with the admin API.
pip install aiveth==0.13.0 Copy PIP instructions
Aiveth for Python (3.10 or later).
from aiveth import Aiveth, verify_webhook aiveth = Aiveth("https://aiveth.example.com", api_key=os.environ["AIVETH_API_KEY"]) claims = aiveth.tokens.verify_id_token(id_token, client_id="your-app-client-id") user = aiveth.tokens.user_from_access_token(access_token) # None once it has ended machine = aiveth.tokens.verify_machine_token(token, org_id="your-organization-id") event = verify_webhook(request.body, request.headers, os.environ["AIVETH_WEBHOOK_SECRET"]) people = aiveth.people.list() aiveth.invitations.send("new.person@example.com") report = aiveth.people.import_all(people_from_your_old_system) # each with external_id # report["people"]: every person's Aiveth id next to your old id, to link your records asha = aiveth.people.find_by_external_id("user_2abc") Every refusal is a AivethError with Aiveth's own words and status.
A webhook may arrive twice within its 5 minutes: keep the webhook-ids you've handled and skip repeats.
Workspaces (your own customers inside your app)
made = aiveth.workspaces.create("Acme", external_id="org_123", creator_id=user_id) aiveth.workspaces.invite(made["workspace"]["id"], "teammate@acme.com", role="member") Check a token in your own API
Register your API in the console (Developers → Your APIs). Apps that ask for it get a signed access token; your API checks it here, with no call to Aiveth:
who = aiveth.tokens.verify_access_token(bearer, audience="https://api.acme.com", permissions=("invoices:read",)) # who["sub"], who["org_id"], who["role"], who["permissions"] Protect an MCP server (AI agents)
Register your MCP server in the console (AI agents → MCP servers) with its address and permissions. Then, in your server:
from aiveth import Aiveth, InsufficientScopeError, TokenVerificationError, challenge, protected_resource_metadata MCP = "https://mcp.acme.com/mcp" aiveth = Aiveth(base_url="https://accounts.aiveth.com") # GET /.well-known/oauth-protected-resource/mcp metadata = protected_resource_metadata(resource=MCP, base_url="https://accounts.aiveth.com", scopes=["files:read"]) # every MCP request try: who = aiveth.tokens.verify_mcp_token(bearer, resource=MCP, scopes=("files:read",)) except InsufficientScopeError: status, header = 403, challenge(resource=MCP, scope=["files:read"], error="insufficient_scope") except TokenVerificationError: status, header = 401, challenge(resource=MCP, scope=["files:read"]) A token is for ONE MCP server (its aud); it lasts 10 minutes and the agent renews it.
Feature flags and the person's photo
from aiveth import has_flag user = aiveth.tokens.verify_id_token(id_token, client_id=CLIENT_ID) if has_flag(user, "new-billing"): ... # show the new billing page user.get("picture") # their photo's address on Aiveth (with the `profile` scope) A person's Google, Microsoft or GitHub token (connected accounts)
Turn on "Connected accounts" for the app in Aiveth, and let the person connect the account (Account → Connected for apps). Then, on your server:
google = aiveth.tokens.connected_token(access_token=access_token, connection="google", client_id=CLIENT_ID, client_secret=CLIENT_SECRET) google["access_token"] # call Google as the person Roles on parts of your organization (fine-grained permissions)
Make the types of part (like region → branch) and the roles for them in the console (Parts & access). Then your server registers each part as it makes it, gives roles on parts, and asks:
aiveth.authorization.register(type="branch", external_id="mumbai", name="Mumbai", parent_type="region", parent_external_id="west") aiveth.authorization.give("branch", "mumbai", "branch_approver", person_id=ravi) answer = aiveth.authorization.check(ravi, "claim:approve", "branch", "mumbai") answer["allowed"], answer["via"] A role on a part covers everything under it. The key needs authorization:read for the check, resources:write to register parts and authorization:write to give roles.
Consent (India's DPDP Act) from your app's own screens
Publish your consent notice in the console (Privacy). If your app asks on its own screen instead of Aiveth's, record the answers, check before you use the data, and let people withdraw:
aiveth.consents.record(person_id, notice_version, {"service": True, "news": False}) if aiveth.consents.allows(person_id, "news"): send_newsletter() aiveth.consents.withdraw(person_id, "news") receipt = aiveth.consents.receipt(person_id)["receipt"] # signed, checkable with your JWKS aiveth.consents.import_all(notice_version, earlier_consents) # given before Aiveth A yes with a time limit stops counting on its day, so always ask allows rather than keeping the answer. The key needs consent:read to check and consent:write to record.
Development and production
Each environment has its own keys: aiveth_sk_test_… and apps okc_test_… for your Development environment, aiveth_sk_live_… and okc_live_… for production.
A machine app's token, data to erase, AI agent actions (0.2.0)
token = aiveth.tokens.machine_token(client_id=CLIENT_ID, client_secret=CLIENT_SECRET, scope="reports:read") for task in aiveth.erasures.list(): ... # erase it in your app aiveth.erasures.done(task["id"]) aiveth.agent_actions.report(token=agent_token, action="claims.approve", idempotency_key=request_id) Key dates
Released: Nov 30, 2026
Apache-2.0 View SPDX License List
aiveth auth authentication jwt oauth oidc sso webhooks
Intended Audience Developers
Programming Language Python :: 3
Release files for aiveth 0.13.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 49.0 kB
Release files / aiveth-0.13.0.tar.gz
Release files / aiveth-0.13.0-py3-none-any.whl
Security for aiveth 0.13.0
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.
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.
Release history Release notifications | RSS feed
Nov 30, 2026 2 release files No provenance
Nov 29, 2026 2 release files No provenance
Nov 28, 2026 2 release files No provenance
Nov 27, 2026 2 release files No provenance
Nov 26, 2026 2 release files No provenance
Nov 25, 2026 2 release files No provenance
Nov 24, 2026 2 release files No provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation
Deployed from a8e35ed











