zitadel-client


Namezitadel-client JSON
Version 4.1.0b1 PyPI version JSON
download
home_pageNone
SummaryOfficial Zitadel SDK for Python. Authenticate and access Zitadel's authentication and management APIs in Python.
upload_time2025-07-09 10:12:59
maintainerNone
docs_urlNone
authorMridang Agarwalla
requires_python!=3.9.0,!=3.9.1,>=3.9
licenseApache-2.0
keywords sdk iam client-lib client-library sdk-python zitadel zitadel-sdk
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python SDK for Zitadel

This is the Zitadel Python SDK, designed to provide a convenient and idiomatic
way to interact with the Zitadel APIs in Python. The SDK provides a seamless
wrapping of the Zitadel API, making it easy to authenticate service users and
perform API operations.

The SDK enables efficient integration with the Zitadel API, allowing you to
manage resources and execute actions. However, it's important to note that
this SDK is tailored for service users and is not intended for user
authentication scenarios. It does not support authentication mechanisms
like OAuth2, OIDC, or SAML for client applications, including web, mobile,
or other environments. For these types of user authentication, you should
use other libraries that are designed for the specific platform and
authentication method.

**Disclaimer**: This SDK is not suitable for implementing user authentication.
It does not handle authentication for client applications using OAuth2, OIDC,
or SAML and should not be used for scenarios requiring such functionality.
For those use cases, consider using other solutions that are designed for
user authentication across various platforms like web, mobile, or other
client environments.

> [!IMPORTANT]
> Please be aware that this SDK is currently in an incubating stage. We are releasing it to the community to gather feedback and learn how it is being used. While you are welcome to use it, please note that the API and functionality may evolve based on community input. We encourage you to try it out and share your experiences, but advise caution when considering it for production environments as future updates may introduce changes.

## Getting Started

### Sign up for Zitadel

To use this SDK, you need a Zitadel account. Sign up at the official
Zitadel website and obtain the necessary credentials to access the API.

### Minimum Requirements

Ensure you have Python 3 or higher installed. You also need Poetry to
install dependencies.

## Using the SDK

### Installation

Install the SDK by running one of the following commands:

```bash
pip install zitadel_client
```

## Authentication Methods

Your SDK offers three ways to authenticate with Zitadel. Each method has its
own benefits—choose the one that fits your situation best.

#### 1. Private Key JWT Authentication

**What is it?**
You use a JSON Web Token (JWT) that you sign with a private key stored in a
JSON file. This process creates a secure token.

**When should you use it?**

- **Best for production:** It offers strong security.
- **Advanced control:** You can adjust token settings like expiration.

**How do you use it?**

1. Save your private key in a JSON file.
2. Use the provided method to load this key and create a JWT-based
   authenticator.

**Example:**

```python
import zitadel_client as zitadel
from zitadel_client.exceptions import ApiError
from zitadel_client.models import (
    UserServiceAddHumanUserRequest,
    UserServiceSetHumanEmail,
    UserServiceSetHumanProfile,
)

zitadel = zitadel.Zitadel.with_private_key("https://example.us1.zitadel.cloud", "path/to/jwt-key.json")

try:
    request = UserServiceAddHumanUserRequest(
        username="john.doe",
        profile=UserServiceSetHumanProfile(
            givenName="John",
            familyName="Doe"
        ),
        email=UserServiceSetHumanEmail(
            email="john@doe.com"
        ),
    )
    response = zitadel.users.add_human_user(request)
    print("User created:", response)
except ApiError as e:
    print("Error:", e)
```

#### 2. Client Credentials Grant

**What is it?**
This method uses a client ID and client secret to get a secure access token,
which is then used to authenticate.

**When should you use it?**

- **Simple and straightforward:** Good for server-to-server communication.
- **Trusted environments:** Use it when both servers are owned or trusted.

**How do you use it?**

1. Provide your client ID and client secret.
2. Build the authenticator

**Example:**

```python
import zitadel_client as zitadel
from zitadel_client.exceptions import ApiError
from zitadel_client.models import (
    UserServiceAddHumanUserRequest,
    UserServiceSetHumanEmail,
    UserServiceSetHumanProfile,
)

zitadel = zitadel.Zitadel.with_client_credentials("https://example.us1.zitadel.cloud", "id", "secret")

try:
    request = UserServiceAddHumanUserRequest(
        username="john.doe",
        profile=UserServiceSetHumanProfile(
            givenName="John",
            familyName="Doe"
        ),
        email=UserServiceSetHumanEmail(
            email="john@doe.com"
        ),
    )
    response = zitadel.users.add_human_user(request)
    print("User created:", response)
except ApiError as e:
    print("Error:", e)
```

#### 3. Personal Access Tokens (PATs)

**What is it?**
A Personal Access Token (PAT) is a pre-generated token that you can use to
authenticate without exchanging credentials every time.

**When should you use it?**

- **Easy to use:** Great for development or testing scenarios.
- **Quick setup:** No need for dynamic token generation.

**How do you use it?**

1. Obtain a valid personal access token from your account.
2. Create the authenticator with: `PersonalAccessTokenAuthenticator`

**Example:**

```python
import zitadel_client as zitadel
from zitadel_client.exceptions import ApiError
from zitadel_client.models import (
    UserServiceAddHumanUserRequest,
    UserServiceSetHumanEmail,
    UserServiceSetHumanProfile,
)

zitadel = zitadel.Zitadel.with_access_token("https://example.us1.zitadel.cloud", "token")

try:
    request = UserServiceAddHumanUserRequest(
        username="john.doe",
        profile=UserServiceSetHumanProfile(
            givenName="John",
            familyName="Doe"
        ),
        email=UserServiceSetHumanEmail(
            email="john@doe.com"
        ),
    )
    response = zitadel.users.add_human_user(request)
    print("User created:", response)
except ApiError as e:
    print("Error:", e)
```

---

Choose the authentication method that best suits your needs based on your
environment and security requirements. For more details, please refer to the
[Zitadel documentation on authenticating service users](https://zitadel.com/docs/guides/integrate/service-users/authenticate-service-users).

## Design and Dependencies

This SDK is designed to be lean and efficient, focusing on providing a
streamlined way to interact with the Zitadel API. It relies on the commonly used
urllib3 HTTP transport for making requests, which ensures that
the SDK integrates well with other libraries and provides flexibility
in terms of request handling and error management.

## Versioning

A key aspect of our strategy is that the SDK's major version is synchronized with the ZITADEL core project's major version to ensure compatibility. For a detailed explanation of this policy and our release schedule, please see our [Versioning Guide](VERSIONING.md).

## Contributing

This repository is autogenerated. We do not accept direct contributions.
Instead, please open an issue for any bugs or feature requests.

## Reporting Issues

If you encounter any issues or have suggestions for improvements, please
open an issue in the [issue tracker](https://github.com/zitadel/client-python/issues).
When reporting an issue, please provide the following information to help
us address it more effectively:

- A detailed description of the problem or feature request
- Steps to reproduce the issue (if applicable)
- Any relevant error messages or logs
- Environment details (e.g., OS version, relevant configurations)

## Support

If you need help setting up or configuring the SDK (or anything
Zitadel), please head over to the [Zitadel Community on Discord](https://zitadel.com/chat).

There are many helpful people in our Discord community who are ready to
assist you.

Cloud and enterprise customers can additionally reach us privately via our
[support communication channels](https://zitadel.com/docs/legal/service-description/support-services).

## License

This SDK is distributed under the Apache 2.0 License.


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "zitadel-client",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "!=3.9.0,!=3.9.1,>=3.9",
    "maintainer_email": null,
    "keywords": "sdk, iam, client-lib, client-library, sdk-python, zitadel, zitadel-sdk",
    "author": "Mridang Agarwalla",
    "author_email": "mridang@zitadel.com",
    "download_url": "https://files.pythonhosted.org/packages/e3/14/82099fe49f2256967df9d1e10a4f87fdab41b939db83cdf903af929fb0a6/zitadel_client-4.1.0b1.tar.gz",
    "platform": null,
    "description": "# Python SDK for Zitadel\n\nThis is the Zitadel Python SDK, designed to provide a convenient and idiomatic\nway to interact with the Zitadel APIs in Python. The SDK provides a seamless\nwrapping of the Zitadel API, making it easy to authenticate service users and\nperform API operations.\n\nThe SDK enables efficient integration with the Zitadel API, allowing you to\nmanage resources and execute actions. However, it's important to note that\nthis SDK is tailored for service users and is not intended for user\nauthentication scenarios. It does not support authentication mechanisms\nlike OAuth2, OIDC, or SAML for client applications, including web, mobile,\nor other environments. For these types of user authentication, you should\nuse other libraries that are designed for the specific platform and\nauthentication method.\n\n**Disclaimer**: This SDK is not suitable for implementing user authentication.\nIt does not handle authentication for client applications using OAuth2, OIDC,\nor SAML and should not be used for scenarios requiring such functionality.\nFor those use cases, consider using other solutions that are designed for\nuser authentication across various platforms like web, mobile, or other\nclient environments.\n\n> [!IMPORTANT]\n> Please be aware that this SDK is currently in an incubating stage. We are releasing it to the community to gather feedback and learn how it is being used. While you are welcome to use it, please note that the API and functionality may evolve based on community input. We encourage you to try it out and share your experiences, but advise caution when considering it for production environments as future updates may introduce changes.\n\n## Getting Started\n\n### Sign up for Zitadel\n\nTo use this SDK, you need a Zitadel account. Sign up at the official\nZitadel website and obtain the necessary credentials to access the API.\n\n### Minimum Requirements\n\nEnsure you have Python 3 or higher installed. You also need Poetry to\ninstall dependencies.\n\n## Using the SDK\n\n### Installation\n\nInstall the SDK by running one of the following commands:\n\n```bash\npip install zitadel_client\n```\n\n## Authentication Methods\n\nYour SDK offers three ways to authenticate with Zitadel. Each method has its\nown benefits\u2014choose the one that fits your situation best.\n\n#### 1. Private Key JWT Authentication\n\n**What is it?**\nYou use a JSON Web Token (JWT) that you sign with a private key stored in a\nJSON file. This process creates a secure token.\n\n**When should you use it?**\n\n- **Best for production:** It offers strong security.\n- **Advanced control:** You can adjust token settings like expiration.\n\n**How do you use it?**\n\n1. Save your private key in a JSON file.\n2. Use the provided method to load this key and create a JWT-based\n   authenticator.\n\n**Example:**\n\n```python\nimport zitadel_client as zitadel\nfrom zitadel_client.exceptions import ApiError\nfrom zitadel_client.models import (\n    UserServiceAddHumanUserRequest,\n    UserServiceSetHumanEmail,\n    UserServiceSetHumanProfile,\n)\n\nzitadel = zitadel.Zitadel.with_private_key(\"https://example.us1.zitadel.cloud\", \"path/to/jwt-key.json\")\n\ntry:\n    request = UserServiceAddHumanUserRequest(\n        username=\"john.doe\",\n        profile=UserServiceSetHumanProfile(\n            givenName=\"John\",\n            familyName=\"Doe\"\n        ),\n        email=UserServiceSetHumanEmail(\n            email=\"john@doe.com\"\n        ),\n    )\n    response = zitadel.users.add_human_user(request)\n    print(\"User created:\", response)\nexcept ApiError as e:\n    print(\"Error:\", e)\n```\n\n#### 2. Client Credentials Grant\n\n**What is it?**\nThis method uses a client ID and client secret to get a secure access token,\nwhich is then used to authenticate.\n\n**When should you use it?**\n\n- **Simple and straightforward:** Good for server-to-server communication.\n- **Trusted environments:** Use it when both servers are owned or trusted.\n\n**How do you use it?**\n\n1. Provide your client ID and client secret.\n2. Build the authenticator\n\n**Example:**\n\n```python\nimport zitadel_client as zitadel\nfrom zitadel_client.exceptions import ApiError\nfrom zitadel_client.models import (\n    UserServiceAddHumanUserRequest,\n    UserServiceSetHumanEmail,\n    UserServiceSetHumanProfile,\n)\n\nzitadel = zitadel.Zitadel.with_client_credentials(\"https://example.us1.zitadel.cloud\", \"id\", \"secret\")\n\ntry:\n    request = UserServiceAddHumanUserRequest(\n        username=\"john.doe\",\n        profile=UserServiceSetHumanProfile(\n            givenName=\"John\",\n            familyName=\"Doe\"\n        ),\n        email=UserServiceSetHumanEmail(\n            email=\"john@doe.com\"\n        ),\n    )\n    response = zitadel.users.add_human_user(request)\n    print(\"User created:\", response)\nexcept ApiError as e:\n    print(\"Error:\", e)\n```\n\n#### 3. Personal Access Tokens (PATs)\n\n**What is it?**\nA Personal Access Token (PAT) is a pre-generated token that you can use to\nauthenticate without exchanging credentials every time.\n\n**When should you use it?**\n\n- **Easy to use:** Great for development or testing scenarios.\n- **Quick setup:** No need for dynamic token generation.\n\n**How do you use it?**\n\n1. Obtain a valid personal access token from your account.\n2. Create the authenticator with: `PersonalAccessTokenAuthenticator`\n\n**Example:**\n\n```python\nimport zitadel_client as zitadel\nfrom zitadel_client.exceptions import ApiError\nfrom zitadel_client.models import (\n    UserServiceAddHumanUserRequest,\n    UserServiceSetHumanEmail,\n    UserServiceSetHumanProfile,\n)\n\nzitadel = zitadel.Zitadel.with_access_token(\"https://example.us1.zitadel.cloud\", \"token\")\n\ntry:\n    request = UserServiceAddHumanUserRequest(\n        username=\"john.doe\",\n        profile=UserServiceSetHumanProfile(\n            givenName=\"John\",\n            familyName=\"Doe\"\n        ),\n        email=UserServiceSetHumanEmail(\n            email=\"john@doe.com\"\n        ),\n    )\n    response = zitadel.users.add_human_user(request)\n    print(\"User created:\", response)\nexcept ApiError as e:\n    print(\"Error:\", e)\n```\n\n---\n\nChoose the authentication method that best suits your needs based on your\nenvironment and security requirements. For more details, please refer to the\n[Zitadel documentation on authenticating service users](https://zitadel.com/docs/guides/integrate/service-users/authenticate-service-users).\n\n## Design and Dependencies\n\nThis SDK is designed to be lean and efficient, focusing on providing a\nstreamlined way to interact with the Zitadel API. It relies on the commonly used\nurllib3 HTTP transport for making requests, which ensures that\nthe SDK integrates well with other libraries and provides flexibility\nin terms of request handling and error management.\n\n## Versioning\n\nA key aspect of our strategy is that the SDK's major version is synchronized with the ZITADEL core project's major version to ensure compatibility. For a detailed explanation of this policy and our release schedule, please see our [Versioning Guide](VERSIONING.md).\n\n## Contributing\n\nThis repository is autogenerated. We do not accept direct contributions.\nInstead, please open an issue for any bugs or feature requests.\n\n## Reporting Issues\n\nIf you encounter any issues or have suggestions for improvements, please\nopen an issue in the [issue tracker](https://github.com/zitadel/client-python/issues).\nWhen reporting an issue, please provide the following information to help\nus address it more effectively:\n\n- A detailed description of the problem or feature request\n- Steps to reproduce the issue (if applicable)\n- Any relevant error messages or logs\n- Environment details (e.g., OS version, relevant configurations)\n\n## Support\n\nIf you need help setting up or configuring the SDK (or anything\nZitadel), please head over to the [Zitadel Community on Discord](https://zitadel.com/chat).\n\nThere are many helpful people in our Discord community who are ready to\nassist you.\n\nCloud and enterprise customers can additionally reach us privately via our\n[support communication channels](https://zitadel.com/docs/legal/service-description/support-services).\n\n## License\n\nThis SDK is distributed under the Apache 2.0 License.\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Official Zitadel SDK for Python. Authenticate and access Zitadel's authentication and management APIs in Python.",
    "version": "4.1.0b1",
    "project_urls": {
        "Bug Tracker": "https://github.com/zitadel/client-python/issues",
        "Documentation": "https://github.com/zitadel/client-python",
        "Homepage": "https://zitadel.com/",
        "Repository": "https://github.com/zitadel/client-python"
    },
    "split_keywords": [
        "sdk",
        " iam",
        " client-lib",
        " client-library",
        " sdk-python",
        " zitadel",
        " zitadel-sdk"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b2e891d1a766d067e01f15b4d6d7b9f0c370dde9bd4bc1cdff05616917fdf5c1",
                "md5": "2d00edc4ed7596e27bd8fb25402a4f65",
                "sha256": "19a12c6637b3f739c8a5d5453be8a158d0f52717c6f4421545eab12bb93c3ff1"
            },
            "downloads": -1,
            "filename": "zitadel_client-4.1.0b1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2d00edc4ed7596e27bd8fb25402a4f65",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "!=3.9.0,!=3.9.1,>=3.9",
            "size": 1830135,
            "upload_time": "2025-07-09T10:12:57",
            "upload_time_iso_8601": "2025-07-09T10:12:57.843923Z",
            "url": "https://files.pythonhosted.org/packages/b2/e8/91d1a766d067e01f15b4d6d7b9f0c370dde9bd4bc1cdff05616917fdf5c1/zitadel_client-4.1.0b1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e31482099fe49f2256967df9d1e10a4f87fdab41b939db83cdf903af929fb0a6",
                "md5": "5fd9f95fdb90a6520c77105b067b0868",
                "sha256": "0c651660386955dbf47519f33165b04668f4d382adfb6ceca138438988ad2c70"
            },
            "downloads": -1,
            "filename": "zitadel_client-4.1.0b1.tar.gz",
            "has_sig": false,
            "md5_digest": "5fd9f95fdb90a6520c77105b067b0868",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "!=3.9.0,!=3.9.1,>=3.9",
            "size": 371420,
            "upload_time": "2025-07-09T10:12:59",
            "upload_time_iso_8601": "2025-07-09T10:12:59.387391Z",
            "url": "https://files.pythonhosted.org/packages/e3/14/82099fe49f2256967df9d1e10a4f87fdab41b939db83cdf903af929fb0a6/zitadel_client-4.1.0b1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-09 10:12:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zitadel",
    "github_project": "client-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "zitadel-client"
}
        
Elapsed time: 0.41270s