Skip to main content

Python SDK for Auth0 MyOrganization

pypi License fern shield

📚 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.10

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

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:

  • 408 (Timeout)
  • 429 (Too Many Requests)
  • 5XX (Internal Server Errors)

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 Logo

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

Metadata

Release files for myorganization-python 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for myorganization-python 2.0.0
File Size Uploaded
myorganization_python-2.0.0.tar.gz 110.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for myorganization-python 2.0.0
File Interpreter ABI Platform
myorganization_python-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 362.8 kB

Release files / myorganization_python-2.0.0.tar.gz

Download URL myorganization_python-2.0.0.tar.gz
Size 110.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7ad1de8139693a2dd0f5c360624846ab6589a08c4c8075ea44fff3e71539cff4
BLAKE2b-256 checksum
How to use checksums
b42cca18e3ec09e50afdad20bf05731a2d6620cf310dd89a89b462c62c3bbc5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release files / myorganization_python-2.0.0-py3-none-any.whl

Download URL myorganization_python-2.0.0-py3-none-any.whl
Size 252.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4166595c5e9bb9b25982771605f53c020a512b8a7bd3103169656e85942e3dd5
BLAKE2b-256 checksum
How to use checksums
7d41ebcf4f4c0ad95faf300d90274674a6d1f43dcb85258fad8a53e70869629e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page