> 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/nodejs/dbaas-postgres/api/usersapi.md).

# UsersApi

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

| Method                          | HTTP request                                      | Description   |
| ------------------------------- | ------------------------------------------------- | ------------- |
| [**usersDelete**](#usersdelete) | **DELETE** /clusters/{clusterId}/users/{username} | Delete user   |
| [**usersGet**](#usersget)       | **GET** /clusters/{clusterId}/users/{username}    | Get user      |
| [**usersList**](#userslist)     | **GET** /clusters/{clusterId}/users               | List users    |
| [**usersPatch**](#userspatch)   | **PATCH** /clusters/{clusterId}/users/{username}  | Patch user    |
| [**usersPost**](#userspost)     | **POST** /clusters/{clusterId}/users              | Create a user |

## usersDelete

> usersDelete(clusterId, username)

Delete user

Deletes a single user

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs-dbaas-postgres');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.UsersApi(config);
// Delete user
api_instance
  .usersDelete({
    clusterId: 498ae72f-411f-11eb-9d07-046c59cc737e,
    username: benjamin
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name          | Type       | Description                   | Notes                   |
| ------------- | ---------- | ----------------------------- | ----------------------- |
| **clusterId** | **string** | The unique ID of the cluster. | \[default to undefined] |
| **username**  | **string** | The authentication username.  | \[default to undefined] |

### Return type

nil (empty response body)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

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

## usersGet

> usersGet(clusterId, username)

Get user

Retrieves a single user

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs-dbaas-postgres');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.UsersApi(config);
// Get user
api_instance
  .usersGet({
    clusterId: 498ae72f-411f-11eb-9d07-046c59cc737e,
    username: benjamin
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name          | Type       | Description                   | Notes                   |
| ------------- | ---------- | ----------------------------- | ----------------------- |
| **clusterId** | **string** | The unique ID of the cluster. | \[default to undefined] |
| **username**  | **string** | The authentication username.  | \[default to undefined] |

### Return type

[**UserResource**](https://docs.ionos.com/cloud/nodejs/dbaas-postgres/models/userresource.md)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

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

## usersList

> usersList(clusterId, opts)

List users

Retrieves a list of users

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs-dbaas-postgres');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.UsersApi(config);
// List users
api_instance
  .usersList({
    clusterId: 498ae72f-411f-11eb-9d07-046c59cc737e,
    limit: 100,
    offset: 200,
    system: true, 
    options: {}
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name          | Type        | Description                                                                                                           | Notes                              |
| ------------- | ----------- | --------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| **clusterId** | **string**  | The unique ID of the cluster.                                                                                         | \[default to undefined]            |
| **limit**     | **number**  | The maximum number of elements to return. Use together with \&#39;offset\&#39; for pagination.                        | \[optional]\[default to 100]       |
| **offset**    | **number**  | The first element to return. Use together with \&#39;limit\&#39; for pagination.                                      | \[optional]\[default to 0]         |
| **system**    | **boolean** | If set to \&#39;true\&#39; all users, including system users are returned. System users cannot be deleted or updated. | \[optional]\[default to undefined] |

### Return type

[**UserList**](https://docs.ionos.com/cloud/nodejs/dbaas-postgres/models/userlist.md)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

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

## usersPatch

> usersPatch(clusterId, username, usersPatchRequest)

Patch user

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

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs-dbaas-postgres');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.UsersApi(config);
// Patch user
api_instance
  .usersPatch({
    clusterId: 498ae72f-411f-11eb-9d07-046c59cc737e,
    username: benjamin,
    usersPatchRequest: usersPatchRequest_example
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name                  | Type                                                                                                    | Description                                            | Notes                   |
| --------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | ----------------------- |
| **clusterId**         | **string**                                                                                              | The unique ID of the cluster.                          | \[default to undefined] |
| **username**          | **string**                                                                                              | The authentication username.                           | \[default to undefined] |
| **usersPatchRequest** | [**UsersPatchRequest**](https://docs.ionos.com/cloud/nodejs/dbaas-postgres/models/userspatchrequest.md) | Patch containing all properties that should be updated |                         |

### Return type

[**UserResource**](https://docs.ionos.com/cloud/nodejs/dbaas-postgres/models/userresource.md)

### Authorization

basicAuth, tokenAuth

### HTTP request headers

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

## usersPost

> usersPost(clusterId, user)

Create a user

Create a new Postgres User

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs-dbaas-postgres');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.UsersApi(config);
// Create a user
api_instance
  .usersPost({
    clusterId: 498ae72f-411f-11eb-9d07-046c59cc737e,
    user: user_example
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name          | Type                                                                          | Description                   | Notes                   |
| ------------- | ----------------------------------------------------------------------------- | ----------------------------- | ----------------------- |
| **clusterId** | **string**                                                                    | The unique ID of the cluster. | \[default to undefined] |
| **user**      | [**User**](https://docs.ionos.com/cloud/nodejs/dbaas-postgres/models/user.md) |                               |                         |

### Return type

[**UserResource**](https://docs.ionos.com/cloud/nodejs/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/nodejs/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.
