The Auth0 Teams SDK for Python provides convenient access to the Auth0 Teams API from Python.
- Installation
- Reference
- Usage
- Async Client
- Exception Handling
- Pagination
- Advanced
- Feedback
- What is Auth0?
pip install auth0-teams-pythonRequirements:
- Python ≥3.10
A full reference for this library is available here.
The client supports two authentication modes. With an existing token (a static string, or a callable that returns one from your own auth flow):
from auth0.teams import Teams
client = Teams(
team_slug="acme",
tenant_domain="acme.us.auth0.com",
token="<token>",
)For backend scripts or admin tooling, pass client credentials and the SDK acquires and refreshes the token for you via the OAuth 2.0 client credentials grant:
from auth0.teams import Teams
client = Teams(
team_slug="acme",
tenant_domain="acme.us.auth0.com",
client_id="YOUR_CLIENT_ID",
client_secret="YOUR_CLIENT_SECRET",
)Then call the API:
client.members.invite(
email="jane.smith@company.com",
role="teams_contributor",
tenant_ids=[
"538c9e21-e3d5-4ad6-b3d0-352c62369fb0",
"b1c9e21e-1234-4ad6-b3d0-352c6236abcd"
],
tenant_roles=[
"owner",
"editor-users"
],
client_ids=[
"client_123",
"client_456"
],
)The API base URL and audience are derived from team_slug
(https://{team_slug}.teams.auth0.com). Override either with the base_url or
audience parameters when needed.
The SDK also exports an async client so that you can make non-blocking calls to our API. Note that if you are constructing an Async httpx client class to pass into this client, use httpx.AsyncClient() instead of httpx.Client() (e.g. for the httpx_client parameter of this client).
import asyncio
from auth0.teams import AsyncTeams
client = AsyncTeams(
team_slug="acme",
tenant_domain="acme.us.auth0.com",
token="<token>",
)
async def main() -> None:
await client.members.invite(
email="jane.smith@company.com",
role="teams_contributor",
tenant_ids=[
"538c9e21-e3d5-4ad6-b3d0-352c62369fb0",
"b1c9e21e-1234-4ad6-b3d0-352c6236abcd"
],
tenant_roles=[
"owner",
"editor-users"
],
client_ids=[
"client_123",
"client_456"
],
)
asyncio.run(main())When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error will be thrown.
from auth0.teams.core.api_error import ApiError
try:
client.members.invite(...)
except ApiError as e:
print(e.status_code)
print(e.body)Paginated requests will return a SyncPager or AsyncPager, which can be used as generators for the underlying object.
from auth0.teams import Teams
client = Teams(
team_slug="acme",
tenant_domain="acme.us.auth0.com",
token="<token>",
)
client.members.list(
take=1,
from_="from",
)# You can also iterate through pages and access the typed response per page
pager = client.members.list(...)
for page in pager.iter_pages():
print(page.response) # access the typed response for each page
for item in page:
print(item)The SDK provides access to raw response data, including headers, through the .with_raw_response property.
The .with_raw_response property returns a "raw" client that can be used to access the .headers and .data attributes.
from auth0.teams import Teams
client = Teams(...)
response = client.members.with_raw_response.invite(...)
print(response.headers) # access the response headers
print(response.status_code) # access the response status code
print(response.data) # access the underlying objectThe SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2).
A request is deemed retryable when any of the following HTTP status codes is returned:
Use the max_retries request option to configure this behavior.
client.members.invite(..., request_options={
"max_retries": 1
})The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
from auth0.teams import Teams
client = Teams(..., timeout=20.0)
# Override timeout for a specific method
client.members.invite(..., request_options={
"timeout_in_seconds": 1
})If you would like to send additional headers as part of the request, use the headers parameter:
from auth0.teams import Teams
client = Teams(
team_slug="acme",
tenant_domain="acme.us.auth0.com",
token="<token>",
headers={"X-Custom-Header": "custom value"},
)The SDK includes built-in logging that can help with debugging. You can enable it by passing a logging configuration when creating the client:
from auth0.teams import Teams
client = Teams(
team_slug="acme",
tenant_domain="acme.us.auth0.com",
token="<token>",
logging={"level": "debug"},
)When enabled at debug level, the SDK logs HTTP request and response details including method, URL, status code, and headers. Sensitive information (authorization headers, API keys) is automatically redacted.
The SDK sends an Auth0-Client header identifying the SDK name, version, and Python
runtime. If you are building an SDK or tool on top of this client, override that header
with your own attribution using client_info:
from auth0.teams import Teams
client = Teams(
team_slug="acme",
tenant_domain="acme.us.auth0.com",
token="<token>",
client_info={"name": "my-wrapper", "version": "1.0.0"},
)You can override the httpx client to customize it for your use-case. Some common use-cases include support for proxies
and transports.
import httpx
from auth0.teams import Teams
client = Teams(
...,
httpx_client=httpx.Client(
proxy="http://my.test.proxy.example.com",
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
),
)We appreciate feedback and contribution to this repo! Before you get started, please see the following:
While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!
On the other hand, contributions to the README are always very welcome!
To provide feedback or report a bug, please raise an issue on our issue tracker.
Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.

Auth0 is an easy to implement, adaptable authentication and authorization platform. To learn more checkout Why Auth0?
Copyright 2026 Okta, Inc. This project is licensed under the Apache License 2.0. See the LICENSE file for details.