{"id":18321122,"url":"https://github.com/workos/workos-python","last_synced_at":"2026-04-15T19:01:01.145Z","repository":{"id":38300075,"uuid":"226952859","full_name":"workos/workos-python","owner":"workos","description":"Official Python SDK for interacting with the WorkOS API","archived":false,"fork":false,"pushed_at":"2026-04-13T15:55:13.000Z","size":2082,"stargazers_count":95,"open_issues_count":1,"forks_count":30,"subscribers_count":15,"default_branch":"main","last_synced_at":"2026-04-13T17:22:27.246Z","etag":null,"topics":["adfs","audit-logs","azure-active-directory","directory-sync","gsuite-saml-apps","python-sdk","saml","scim","sso","sso-authentication"],"latest_commit_sha":null,"homepage":"https://workos.com/docs/sdk/python","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/workos.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-12-09T19:41:22.000Z","updated_at":"2026-04-13T15:54:58.000Z","dependencies_parsed_at":"2023-12-05T22:31:37.113Z","dependency_job_id":"2a3bb44b-49e2-4e42-92fa-4af7a2bb81bb","html_url":"https://github.com/workos/workos-python","commit_stats":null,"previous_names":["workos-inc/workos-python"],"tags_count":154,"template":false,"template_full_name":null,"purl":"pkg:github/workos/workos-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workos%2Fworkos-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workos%2Fworkos-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workos%2Fworkos-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workos%2Fworkos-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/workos","download_url":"https://codeload.github.com/workos/workos-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workos%2Fworkos-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31855432,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"ssl_error","status_checked_at":"2026-04-15T15:24:39.138Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adfs","audit-logs","azure-active-directory","directory-sync","gsuite-saml-apps","python-sdk","saml","scim","sso","sso-authentication"],"created_at":"2024-11-05T18:18:26.299Z","updated_at":"2026-04-15T19:01:01.140Z","avatar_url":"https://github.com/workos.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WorkOS Python Library\n\n![PyPI](https://img.shields.io/pypi/v/workos)\n[![Build Status](https://workos.semaphoreci.com/badges/workos-python/branches/main.svg?style=shields\u0026key=9e4cb5bb-86a4-4938-9ec2-fc9f9fc512be)](https://workos.semaphoreci.com/projects/workos-python)\n\nThe WorkOS library for Python provides convenient access to the WorkOS API from applications written in Python, [hosted on PyPI](https://pypi.org/project/workos/).\n\n## Documentation\n\nSee the [API Reference](https://workos.com/docs/reference/client-libraries) for Python usage examples.\n\n## Installation\n\n```bash\npip install workos\n```\n\n## Quick Start\n\n```python\nfrom workos import WorkOSClient\n\nclient = WorkOSClient(api_key=\"sk_1234\", client_id=\"client_1234\")\n\n# List organizations\npage = client.organizations.list_organizations()\nfor org in page.auto_paging_iter():\n    print(org.name)\n\n# Create an organization\norg = client.organizations.create_organizations(name=\"Acme Corp\")\nprint(org.id)\n```\n\n### Async Client\n\nEvery method has an identical async counterpart:\n\n```python\nfrom workos import AsyncWorkOSClient\n\nasync_client = AsyncWorkOSClient(api_key=\"sk_1234\", client_id=\"client_1234\")\n\npage = await async_client.organizations.list_organizations()\nasync for org in page.auto_paging_iter():\n    print(org.name)\n```\n\n### Environment Variables\n\nThe client reads credentials from the environment when not passed explicitly:\n\n| Variable | Description |\n|----------|-------------|\n| `WORKOS_API_KEY` | WorkOS API key |\n| `WORKOS_CLIENT_ID` | WorkOS client ID |\n| `WORKOS_BASE_URL` | Override the API base URL (defaults to `https://api.workos.com/`) |\n| `WORKOS_REQUEST_TIMEOUT` | HTTP timeout in seconds (defaults to `60`) |\n\n## Available Resources\n\nThe client exposes the full WorkOS API through typed namespace properties:\n\n| Property | Description |\n|----------|-------------|\n| `client.sso` | Single Sign-On connections and authorization |\n| `client.organizations` | Organization management |\n| `client.user_management` | Users, identities, auth methods, invitations |\n| `client.directory_sync` | Directory connections and directory users/groups |\n| `client.admin_portal` | Admin Portal link generation |\n| `client.audit_logs` | Audit log events, exports, and schemas |\n| `client.authorization` | Fine-Grained Authorization (FGA) resources, roles, permissions, and checks |\n| `client.webhooks` | Webhook event verification |\n| `client.feature_flags` | Feature flag evaluation |\n| `client.api_keys` | Organization API key management |\n| `client.connect` | OAuth application management |\n| `client.widgets` | Widget session tokens |\n| `client.multi_factor_auth` | MFA enrollment and verification (also available as `client.mfa`) |\n| `client.pipes` | Data Integrations |\n| `client.radar` | Radar risk scoring |\n| `client.passwordless` | Passwordless authentication sessions |\n| `client.vault` | Encrypted data vault |\n\n## Pagination\n\nPaginated endpoints return `SyncPage[T]` (or `AsyncPage[T]`) with built-in auto-pagination:\n\n```python\n# Iterate through all pages automatically\nfor user in client.user_management.list_users().auto_paging_iter():\n    print(user.email)\n\n# Or work with a single page\npage = client.user_management.list_users(limit=10)\nprint(page.data)        # List of items on this page\nprint(page.has_more())  # Whether more pages exist\nprint(page.after)       # Cursor for the next page\n```\n\n## Error Handling\n\nAll API errors map to typed exception classes with rich context:\n\n```python\nfrom workos._errors import NotFoundError, RateLimitExceededError\n\ntry:\n    client.organizations.get_organization(\"org_nonexistent\")\nexcept NotFoundError as e:\n    print(f\"Not found: {e.message}\")\n    print(f\"Request ID: {e.request_id}\")\nexcept RateLimitExceededError as e:\n    print(f\"Retry after: {e.retry_after} seconds\")\n```\n\n| Exception | Status Code |\n|-----------|-------------|\n| `BadRequestError` | 400 |\n| `AuthenticationError` | 401 |\n| `AuthorizationError` | 403 |\n| `NotFoundError` | 404 |\n| `ConflictError` | 409 |\n| `UnprocessableEntityError` | 422 |\n| `RateLimitExceededError` | 429 |\n| `ServerError` | 5xx |\n\n## Per-Request Options\n\nEvery method accepts `request_options` for per-call overrides:\n\n```python\nresult = client.organizations.list_organizations(\n    request_options={\n        \"timeout\": 10,\n        \"max_retries\": 5,\n        \"extra_headers\": {\"X-Custom\": \"value\"},\n        \"idempotency_key\": \"my-key\",\n        \"base_url\": \"https://staging.workos.com/\",\n    }\n)\n```\n\n## Type Safety\n\nThis SDK ships with full type annotations (`py.typed` / PEP 561) and works with mypy, pyright, and IDE autocompletion out of the box. All models are `@dataclass(slots=True)` classes with `from_dict()` / `to_dict()` for serialization.\n\n## SDK Versioning\n\nWorkOS follows [Semantic Versioning](https://semver.org/). Breaking changes are only released in major versions. We strongly recommend reading changelogs before making major version upgrades.\n\n## Beta Releases\n\nWorkOS has features in Beta that can be accessed via Beta releases. We would love for you to try these and share feedback with us before these features reach general availability (GA). To install a Beta version, please follow the [installation steps](#installation) above using the Beta release version.\n\n\u003e **Note:** there can be breaking changes between Beta versions. We recommend pinning the package version to a specific version.\n\n## More Information\n\n- [Single Sign-On Guide](https://workos.com/docs/sso/guide)\n- [User Management Guide](https://workos.com/docs/user-management)\n- [AuthKit Guide](https://workos.com/docs/authkit)\n- [Directory Sync Guide](https://workos.com/docs/directory-sync/guide)\n- [Admin Portal Guide](https://workos.com/docs/admin-portal/guide)\n- [Audit Logs Guide](https://workos.com/docs/audit-logs)\n- [Authorization (FGA) Guide](https://workos.com/docs/fga)\n- [Feature Flags Guide](https://workos.com/docs/feature-flags)\n- [Webhooks Guide](https://workos.com/docs/webhooks)\n- [Radar Guide](https://workos.com/docs/radar)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkos%2Fworkos-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fworkos%2Fworkos-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkos%2Fworkos-python/lists"}