Skip to main content

Set up Atlan SDK

Choose your preferred integration approach and follow the steps below. All SDK-based approaches use the same two environment variables for authentication.

Prerequisites

  • An Atlan API token with at least one persona assigned
  • Your Atlan tenant URL (for example, https://tenant.atlan.com)

Install and configure

GitHub repo · Release on PyPI

info

Walk through step-by-step in our intro to custom integration course (30 mins).

Install

Install the SDK
pip install pyatlan

Configure

Option 1—environment variables (recommended)

Set environment variables
export ATLAN_BASE_URL=https://tenant.atlan.com
export ATLAN_API_KEY="<your-api-token>"
main.py
from pyatlan.client.atlan import AtlanClient

client = AtlanClient()

You can also authenticate with OAuth credentials instead of an API token:

OAuth environment variables
export ATLAN_BASE_URL=https://tenant.atlan.com
export ATLAN_OAUTH_CLIENT_ID=<client-id>
export ATLAN_OAUTH_CLIENT_SECRET=<client-secret>

Option 2—client constructor

main.py
from pyatlan.client.atlan import AtlanClient

# Using API token
client = AtlanClient(
base_url="https://tenant.atlan.com",
api_key="<your-api-token>"
)

# Using OAuth credentials
client = AtlanClient(
base_url="https://tenant.atlan.com",
oauth_client_id="<client-id>",
oauth_client_secret="<client-secret>",
)
warning

Avoid hardcoding your API token in source files—you may accidentally commit it to a public repository.

Advanced configuration—logging, retries, timeouts, proxies, async

Logging

main.py
import logging
from pyatlan.client.atlan import AtlanClient

logging.basicConfig(level=logging.DEBUG)
client = AtlanClient()

Retries

The SDK retries automatically on 403, 429, and 5xx responses using exponential backoff. The default maximum is 5 retries.

Timeouts

Override default timeouts
from pyatlan.client.atlan import AtlanClient

client = AtlanClient()
client.read_timeout = 1800.0 # 30 minutes (default: 900s)
client.connect_timeout = 60.0 # 1 minute (default: 30s)

Proxies

Configure proxy via environment variables
export HTTPS_PROXY="http://user:[email protected]:1080"
export SSL_CERT_FILE="/path/to/corporate-ca-cert.pem"

Or programmatically:

Programmatic proxy
client = AtlanClient(proxy="http://10.10.1.10:3128")

Async client

Available from v8.0. Mirrors the synchronous API with async/await:

Async client
from pyatlan.client.aio import AsyncAtlanClient

client = AsyncAtlanClient(
base_url="https://tenant.atlan.com",
api_key="<your-api-token>"
)

Multi-tenant connectivity

Multiple tenants
from pyatlan.client.atlan import AtlanClient

client2 = AtlanClient(base_url="https://tenant2.atlan.com", api_key="...")
Atlan.set_default_client(client2)
Was this page helpful?