Auth0 My Organization Python SDK
Project description
📚 Documentation • 🚀 Getting Started • 💬 Feedback
Documentation
- Docs Site - explore our docs site and learn more about Auth0
- API Reference - full reference for this library
Getting Started
Requirements
This library supports the following tooling versions:
- Python >= 3.9
Installation
pip install myorganization-python
Configure the SDK
The MyOrganizationClient is the recommended way to interact with the Auth0 My Organization API. It provides a simpler interface using just your Auth0 domain:
from auth0.myorganization import MyOrganizationClient
# With an access token (from your authentication flow)
client = MyOrganizationClient(
domain="your-tenant.auth0.com",
token=user_access_token,
)
For backend scripts or admin tooling, you can use client credentials with automatic token management:
# With client credentials (automatic token acquisition and refresh)
client = MyOrganizationClient(
domain="your-tenant.auth0.com",
client_id="YOUR_CLIENT_ID",
client_secret="YOUR_CLIENT_SECRET",
organization="YOUR_ORG_ID",
)
Then use the client to interact with the API:
# List organization domains
domains = client.organization.domains.list()
# Get organization details
details = client.organization_details.get()
Using the Base Client
For more control, you can use the Auth0 client directly with a full base URL:
from auth0.myorganization import Auth0
client = Auth0(
base_url="https://your-tenant.auth0.com/my-org",
token="YOUR_TOKEN",
)
client.organization.domains.create(
domain="acme.com",
)
Async Client
The SDK also exports async clients so that you can make non-blocking calls to the 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.myorganization import AsyncMyOrganizationClient
client = AsyncMyOrganizationClient(
domain="your-tenant.auth0.com",
token="YOUR_TOKEN",
)
async def main() -> None:
details = await client.organization_details.get()
print(details)
asyncio.run(main())
You can also use the base async client directly:
import asyncio
from auth0.myorganization import AsyncAuth0
client = AsyncAuth0(
base_url="https://your-tenant.auth0.com/my-org",
token="YOUR_TOKEN",
)
async def main() -> None:
await client.organization.domains.create(
domain="acme.com",
)
asyncio.run(main())
Request and Response Types
The SDK exports all request and response types as Pydantic models. You can import them directly:
from auth0.myorganization import MyOrganizationClient
from auth0.myorganization.types import GetOrganizationDetailsResponseContent
client = MyOrganizationClient(
domain="your-tenant.auth0.com",
token="YOUR_TOKEN",
)
details: GetOrganizationDetailsResponseContent = client.organization_details.get()
print(details.display_name)
API Reference
- Full Reference - complete API reference guide
Key Classes
- MyOrganizationClient - recommended client for managing organization details, domains, identity providers, and configuration
- AsyncMyOrganizationClient - async variant of the above
- TokenProvider - automatic token management via OAuth 2.0 client credentials grant
Exception Handling
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error will be thrown.
from auth0.myorganization.core.api_error import ApiError
try:
client.organization.domains.create(...)
except ApiError as e:
print(e.status_code)
print(e.body)
Advanced
Access Raw Response Data
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.myorganization import Auth0
client = Auth0(
base_url="https://your-tenant.auth0.com/my-org",
token="YOUR_TOKEN",
)
response = client.organization.domains.with_raw_response.create(...)
print(response.headers) # access the response headers
print(response.status_code) # access the response status code
print(response.data) # access the underlying object
Retries
The 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.organization.domains.create(..., request_options={
"max_retries": 1
})
Timeouts
The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
from auth0.myorganization import MyOrganizationClient
client = MyOrganizationClient(
domain="your-tenant.auth0.com",
token="YOUR_TOKEN",
timeout=20.0,
)
# Override timeout for a specific method
client.organization.domains.create(..., request_options={
"timeout_in_seconds": 1
})
Additional Headers
If you would like to send additional headers as part of the request, use the headers parameter:
client = MyOrganizationClient(
domain="your-tenant.auth0.com",
token="YOUR_TOKEN",
headers={"X-Custom-Header": "custom value"},
)
Logging
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.myorganization import Auth0
client = Auth0(
base_url="https://your-tenant.auth0.com/my-org",
token="YOUR_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.
Custom Client
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.myorganization import MyOrganizationClient
client = MyOrganizationClient(
domain="your-tenant.auth0.com",
token="YOUR_TOKEN",
httpx_client=httpx.Client(
proxy="http://my.test.proxy.example.com",
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
),
)
Feedback
Contributing
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!
Raise an issue
To provide feedback or report a bug, please raise an issue on our issue tracker.
Vulnerability Reporting
Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.
What is Auth0?
Auth0 is an easy to implement, adaptable authentication and authorization platform. To learn more checkout Why Auth0
Copyright 2026 Okta, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at: https://www.apache.org/licenses/LICENSE-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file myorganization_python-1.0.0b0.tar.gz.
File metadata
- Download URL: myorganization_python-1.0.0b0.tar.gz
- Upload date:
- Size: 93.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b67110cc313bf20c900ee6d6b5399355d1c9650ba9ccce36a137c358418cf3e8
|
|
| MD5 |
6076088b071bd771ee4f3324e9d0ced3
|
|
| BLAKE2b-256 |
d7af0a42a43bdfcae884c5f7487689dc5a8bb43092b97a0fbde9037632688b21
|
Provenance
The following attestation bundles were made for myorganization_python-1.0.0b0.tar.gz:
Publisher:
publish.yml on auth0/myorganization-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
myorganization_python-1.0.0b0.tar.gz -
Subject digest:
b67110cc313bf20c900ee6d6b5399355d1c9650ba9ccce36a137c358418cf3e8 - Sigstore transparency entry: 1264270462
- Sigstore integration time:
-
Permalink:
auth0/myorganization-python@814c929f697cd72efe0319025e3de9b9a83628da -
Branch / Tag:
refs/heads/main - Owner: https://github.com/auth0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@814c929f697cd72efe0319025e3de9b9a83628da -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file myorganization_python-1.0.0b0-py3-none-any.whl.
File metadata
- Download URL: myorganization_python-1.0.0b0-py3-none-any.whl
- Upload date:
- Size: 198.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f91d4abf9ef8e988976a25cccdc638a6ad417e6c8903617610957a53a82fcdd7
|
|
| MD5 |
d9aadc548a067a1e176aaa97deb5ba9c
|
|
| BLAKE2b-256 |
77527c45c408e80554adf18b1ecf0e43dbe6cc0506e3bd14a0bc73d48f986006
|
Provenance
The following attestation bundles were made for myorganization_python-1.0.0b0-py3-none-any.whl:
Publisher:
publish.yml on auth0/myorganization-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
myorganization_python-1.0.0b0-py3-none-any.whl -
Subject digest:
f91d4abf9ef8e988976a25cccdc638a6ad417e6c8903617610957a53a82fcdd7 - Sigstore transparency entry: 1264270582
- Sigstore integration time:
-
Permalink:
auth0/myorganization-python@814c929f697cd72efe0319025e3de9b9a83628da -
Branch / Tag:
refs/heads/main - Owner: https://github.com/auth0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@814c929f697cd72efe0319025e3de9b9a83628da -
Trigger Event:
workflow_dispatch
-
Statement type: