Skip to main content

onelogin-python-sdk

Official Python SDK for the OneLogin API. Manage users, roles, groups, apps, and authentication programmatically.

API reference: OneLogin API Documentation. Per-endpoint docs: see docs/ in this repo.

Support

OneLogin by One Identity open-source projects are supported through GitHub. For help, please open an issue: https://github.com/onelogin/onelogin-python-sdk/issues. Requests filed via official One Identity Support are redirected here so all users can benefit.

Requirements

  • Python 3.10+
  • Pydantic 2.11+ (enforced via pyproject.toml)

Installation

pip install onelogin

For development:

pip install -e ".[test,lint]"

Getting Started

import os
import onelogin
from pprint import pprint

configuration = onelogin.Configuration(
    host="https://your-subdomain.onelogin.com",
    username=os.environ["ONELOGIN_CLIENT_ID"],
    password=os.environ["ONELOGIN_CLIENT_SECRET"],
)

with onelogin.ApiClient(configuration) as api_client:
    # Exchange client credentials for an access token.
    token_api = onelogin.OAuth2Api(api_client)
    token = token_api.generate_token({"grant_type": "client_credentials"})
    configuration.access_token = token.access_token

    # Now make authenticated calls.
    users_api = onelogin.UsersV2Api(api_client)
    pprint(users_api.list_users2())

Authentication

OneLogin uses OAuth2 client credentials. Generate a Client ID + Client Secret under Security → API Credentials in the OneLogin admin portal, with one of:

  • Authentication Only — Verify Factor, Generate SAML Assertion, Create Session Login Token, Log User Out
  • Read UsersGET on User, Role, Group resources
  • Manage UsersGET/POST/PUT/DELETE on User, Role, Group (no password management or role assignment)
  • Read All — read-only across all resources
  • Manage All — full access including password management and role assignment

Tests

pip install -e ".[test]"
pytest

Troubleshooting

  • ImportError: cannot import name validate_call from pydantic — Pydantic <2.11 in your environment. Run pip install -U pydantic.
  • ValidationError on response deserialization — likely a server-returned null for a field the SDK still types as required. Open an issue with the endpoint and a redacted response sample; this class of fix is straightforward (see PR #126, #131 for examples).
  • Connection issues — confirm your subdomain in the host URL, that your credentials carry the right scope, and that your network can reach *.onelogin.com.

Release Process (Maintainers)

Releases ship to PyPI automatically when you publish a GitHub Release. The publish workflow runs sed -i against pyproject.toml and onelogin/__init__.py inside the CI runner to set the version from the tag — those edits are not committed back to main, so the source tree may lag the latest PyPI release. Reconcile periodically with a manual version bump PR.

  1. Open the Releases page and click Draft a new release
  2. Create a tag matching the version, e.g. 3.2.9 (no v prefix; matches releases 3.2.4 onward)
  3. Set title to the version and paste the CHANGELOG entry into the description
  4. Publish release.github/workflows/python-publish.yml builds and uploads to PyPI

If a release fails to upload, re-run the failed workflow from the Actions tab; the build is idempotent up to the point of twine upload.

Release files for onelogin 4.0.1

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

Source distribution (sdist)

Source distribution for onelogin 4.0.1
File Size Uploaded
onelogin-4.0.1.tar.gz 126.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for onelogin 4.0.1
File Interpreter ABI Platform
onelogin-4.0.1-py3-none-any.whl Python 3 none any Details

Total release size:402.1 kB

Release files / onelogin-4.0.1.tar.gz

Download URL onelogin-4.0.1.tar.gz
Size 126.6 kB
Tags Source
SHA-256 checksum
How to use checksums
05e168ca50a525fec6be931ddff65a775baf0ec995018d7b575a35d582d54c54
BLAKE2b-256 checksum
How to use checksums
8e77d69af5c61232bace55e1f0636e111a847f08c277ddb0bc1656b1260dad5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / onelogin-4.0.1-py3-none-any.whl

Download URL onelogin-4.0.1-py3-none-any.whl
Size 275.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cafa71a2284dfa242bc05a507750056eac2244d81082be203aa585427e58ee37
BLAKE2b-256 checksum
How to use checksums
e5be1a6c1ba365111f12c25c851f409c30edd11197b25d731ca43a288677a585
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

4.0.1 This release

2 release files

4.0.0

2 release files

3.2.9

2 release files

3.2.8

2 release files

3.2.7

2 release files

3.2.6

2 release files

3.2.5

2 release files

3.2.4

2 release files

3.2.3

2 release files

3.2.2

2 release files

3.2.1

2 release files

3.2.0

2 release files

3.1.6

2 release files

3.1.5

2 release files

3.1.4

2 release files

3.1.3

2 release files

3.1.2

2 release files

3.1.1

2 release files

3.1.0

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.0.4

3 release files

2.0.3

3 release files

2.0.2

3 release files

2.0.1

3 release files

2.0.0

2 release files

1.9.1

3 release files

1.9.0

3 release files

1.8.2

3 release files

1.8.1

3 release files

1.8.0

3 release files

1.7.0

3 release files

1.6.1

3 release files

1.6.0

3 release files

1.5.3

3 release files

1.5.2

3 release files

1.5.1

3 release files

1.5.0

3 release files

1.4.3

3 release files

1.4.2

3 release files

1.4.1

3 release files

1.4.0

3 release files

1.3.2

3 release files

1.3.1

3 release files

1.3.0

3 release files

1.2.1

3 release files

1.2.0

3 release files

1.1.0

3 release files

1.0.0

3 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