> For the complete documentation index, see [llms.txt](https://docs.ionos.com/cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ionos.com/cloud/python/dbaas-postgres/api/usersapi.md).

# UsersApi

## UsersApi

All URIs are relative to *<https://api.ionos.com/databases/postgresql>*

| Method                             | HTTP request                                      | Description   |
| ---------------------------------- | ------------------------------------------------- | ------------- |
| [**users\_delete**](#users_delete) | **DELETE** /clusters/{clusterId}/users/{username} | Delete user   |
| [**users\_get**](#users_get)       | **GET** /clusters/{clusterId}/users/{username}    | Get user      |
| [**users\_list**](#users_list)     | **GET** /clusters/{clusterId}/users               | List users    |
| [**users\_patch**](#users_patch)   | **PATCH** /clusters/{clusterId}/users/{username}  | Patch user    |
| [**users\_post**](#users_post)     | **POST** /clusters/{clusterId}/users              | Create a user |

## **users\_delete**

> users\_delete(cluster\_id, username)

Delete user

Deletes a single user

#### Example

```python
from __future__ import print_function
import time
import ionoscloud_dbaas_postgres
from ionoscloud_dbaas_postgres.rest import ApiException

# Defining the host is optional and defaults to https://api.ionos.com/databases/postgresql
configuration = ionoscloud_dbaas_postgres.Configuration(
    host = 'https://api.ionos.com/databases/postgresql',
)

# Example of configuring HTTP Basic Authorization
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

with ionoscloud_dbaas_postgres.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ionoscloud_dbaas_postgres.UsersApi(api_client)
    cluster_id = '498ae72f-411f-11eb-9d07-046c59cc737e' # str | The unique ID of the cluster.
    username = 'benjamin' # str | The authentication username.
    try:
        # Delete user
        api_instance.users_delete(cluster_id, username)
    except ApiException as e:
        print('Exception when calling UsersApi.users_delete: %s\n' % e)
```

#### Parameters

| Name            | Type    | Description                   | Notes |
| --------------- | ------- | ----------------------------- | ----- |
| **cluster\_id** | **str** | The unique ID of the cluster. |       |
| **username**    | **str** | The authentication username.  |       |

#### Return type

void (empty response body)

#### Authorization

basicAuth, tokenAuth

#### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

## **users\_get**

> UserResource users\_get(cluster\_id, username)

Get user

Retrieves a single user

#### Example

```python
from __future__ import print_function
import time
import ionoscloud_dbaas_postgres
from ionoscloud_dbaas_postgres.rest import ApiException

# Defining the host is optional and defaults to https://api.ionos.com/databases/postgresql
configuration = ionoscloud_dbaas_postgres.Configuration(
    host = 'https://api.ionos.com/databases/postgresql',
)

# Example of configuring HTTP Basic Authorization
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

with ionoscloud_dbaas_postgres.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ionoscloud_dbaas_postgres.UsersApi(api_client)
    cluster_id = '498ae72f-411f-11eb-9d07-046c59cc737e' # str | The unique ID of the cluster.
    username = 'benjamin' # str | The authentication username.
    try:
        # Get user
        api_response = api_instance.users_get(cluster_id, username)
        print(api_response)
    except ApiException as e:
        print('Exception when calling UsersApi.users_get: %s\n' % e)
```

#### Parameters

| Name            | Type    | Description                   | Notes |
| --------------- | ------- | ----------------------------- | ----- |
| **cluster\_id** | **str** | The unique ID of the cluster. |       |
| **username**    | **str** | The authentication username.  |       |

#### Return type

[**UserResource**](/cloud/python/dbaas-postgres/models/userresource.md)

#### Authorization

basicAuth, tokenAuth

#### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

## **users\_list**

> UserList users\_list(cluster\_id, limit=limit, offset=offset, system=system)

List users

Retrieves a list of users

#### Example

```python
from __future__ import print_function
import time
import ionoscloud_dbaas_postgres
from ionoscloud_dbaas_postgres.rest import ApiException

# Defining the host is optional and defaults to https://api.ionos.com/databases/postgresql
configuration = ionoscloud_dbaas_postgres.Configuration(
    host = 'https://api.ionos.com/databases/postgresql',
)

# Example of configuring HTTP Basic Authorization
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

with ionoscloud_dbaas_postgres.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ionoscloud_dbaas_postgres.UsersApi(api_client)
    cluster_id = '498ae72f-411f-11eb-9d07-046c59cc737e' # str | The unique ID of the cluster.
    try:
        # List users
        api_response = api_instance.users_list(cluster_id)
        print(api_response)
    except ApiException as e:
        print('Exception when calling UsersApi.users_list: %s\n' % e)
```

#### Parameters

| Name            | Type     | Description                                                                                                 | Notes                         |
| --------------- | -------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------- |
| **cluster\_id** | **str**  | The unique ID of the cluster.                                                                               |                               |
| **limit**       | **int**  | The maximum number of elements to return. Use together with 'offset' for pagination.                        | \[optional] \[default to 100] |
| **offset**      | **int**  | The first element to return. Use together with 'limit' for pagination.                                      | \[optional] \[default to 0]   |
| **system**      | **bool** | If set to 'true' all users, including system users are returned. System users cannot be deleted or updated. | \[optional]                   |

#### Return type

[**UserList**](/cloud/python/dbaas-postgres/models/userlist.md)

#### Authorization

basicAuth, tokenAuth

#### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

## **users\_patch**

> UserResource users\_patch(cluster\_id, username, users\_patch\_request)

Patch user

Patches a single user. Only changing the password is supported. System users cannot be patched.

#### Example

```python
from __future__ import print_function
import time
import ionoscloud_dbaas_postgres
from ionoscloud_dbaas_postgres.rest import ApiException

# Defining the host is optional and defaults to https://api.ionos.com/databases/postgresql
configuration = ionoscloud_dbaas_postgres.Configuration(
    host = 'https://api.ionos.com/databases/postgresql',
)

# Example of configuring HTTP Basic Authorization
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

with ionoscloud_dbaas_postgres.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ionoscloud_dbaas_postgres.UsersApi(api_client)
    cluster_id = '498ae72f-411f-11eb-9d07-046c59cc737e' # str | The unique ID of the cluster.
    username = 'benjamin' # str | The authentication username.
    users_patch_request = ionoscloud_dbaas_postgres.UsersPatchRequest() # UsersPatchRequest | Patch containing all properties that should be updated
    try:
        # Patch user
        api_response = api_instance.users_patch(cluster_id, username, users_patch_request)
        print(api_response)
    except ApiException as e:
        print('Exception when calling UsersApi.users_patch: %s\n' % e)
```

#### Parameters

| Name                      | Type                                                                              | Description                                            | Notes |
| ------------------------- | --------------------------------------------------------------------------------- | ------------------------------------------------------ | ----- |
| **cluster\_id**           | **str**                                                                           | The unique ID of the cluster.                          |       |
| **username**              | **str**                                                                           | The authentication username.                           |       |
| **users\_patch\_request** | [**UsersPatchRequest**](/cloud/python/dbaas-postgres/models/userspatchrequest.md) | Patch containing all properties that should be updated |       |

#### Return type

[**UserResource**](/cloud/python/dbaas-postgres/models/userresource.md)

#### Authorization

basicAuth, tokenAuth

#### HTTP request headers

* **Content-Type**: application/json
* **Accept**: application/json

## **users\_post**

> UserResource users\_post(cluster\_id, user)

Create a user

Create a new Postgres User

#### Example

```python
from __future__ import print_function
import time
import ionoscloud_dbaas_postgres
from ionoscloud_dbaas_postgres.rest import ApiException

# Defining the host is optional and defaults to https://api.ionos.com/databases/postgresql
configuration = ionoscloud_dbaas_postgres.Configuration(
    host = 'https://api.ionos.com/databases/postgresql',
)

# Example of configuring HTTP Basic Authorization
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

with ionoscloud_dbaas_postgres.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ionoscloud_dbaas_postgres.UsersApi(api_client)
    cluster_id = '498ae72f-411f-11eb-9d07-046c59cc737e' # str | The unique ID of the cluster.
    user = ionoscloud_dbaas_postgres.User() # User | 
    try:
        # Create a user
        api_response = api_instance.users_post(cluster_id, user)
        print(api_response)
    except ApiException as e:
        print('Exception when calling UsersApi.users_post: %s\n' % e)
```

#### Parameters

| Name            | Type                                                    | Description                   | Notes |
| --------------- | ------------------------------------------------------- | ----------------------------- | ----- |
| **cluster\_id** | **str**                                                 | The unique ID of the cluster. |       |
| **user**        | [**User**](/cloud/python/dbaas-postgres/models/user.md) |                               |       |

#### Return type

[**UserResource**](/cloud/python/dbaas-postgres/models/userresource.md)

#### Authorization

basicAuth, tokenAuth

#### HTTP request headers

* **Content-Type**: application/json
* **Accept**: application/json


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ionos.com/cloud/python/dbaas-postgres/api/usersapi.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
