Foundry Platform SDK

raw JSON →
1.82.0 verified Fri May 01 auth: no python

The official Python library for the Palantir Foundry API. Version 1.82.0, requires Python >=3.10, <4.0. Rapid release cadence (weekly).

pip install foundry-platform-sdk
error ModuleNotFoundError: No module named 'foundry_platform_sdk'
cause User installed the package but tried to import with the PyPI name instead of the correct module name 'foundry'.
fix
Change import to 'from foundry import FoundryClient'.
error TypeError: Client.__init__() got an unexpected keyword argument 'client_id'
cause Older authentication methods using client_id/client_secret are no longer supported.
fix
Use token-based auth: FoundryClient(hostname=..., token=...).
error httpx.HTTPStatusError: 401 Unauthorized
cause Invalid or missing FOUNDRY_TOKEN environment variable.
fix
Set FOUNDRY_TOKEN to a valid API token, or pass token parameter to FoundryClient.
breaking The SDK requires Python >=3.10. Installations on Python 3.9 or lower will fail.
fix Upgrade Python to 3.10 or later.
deprecated Authentication via foundry_client_id and foundry_client_secret environment variables is deprecated in favor of token-based auth using FOUNDRY_TOKEN.
fix Switch to using FOUNDRY_TOKEN or FoundryClient(token=...).
gotcha The correct import is from foundry import FoundryClient, NOT from foundry_platform_sdk. Many users mistakenly use the PyPI package name as import root.
fix Use 'from foundry import FoundryClient'.
gotcha List methods return a paginated object, not a plain list. Access .data to get items.
fix Use users.data instead of users directly.

Initialize client with hostname and token from environment variables.

from foundry import FoundryClient
from foundry import os

client = FoundryClient(
    hostname=os.environ.get('FOUNDRY_HOSTNAME', ''),
    token=os.environ.get('FOUNDRY_TOKEN', ''),
)

# List users
users = client.admin.User.list()
for user in users.data[:5]:
    print(user.email)