> 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/clustersapi.md).

# ClustersApi

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

| Method                                                        | HTTP request                                   | Description              |
| ------------------------------------------------------------- | ---------------------------------------------- | ------------------------ |
| [**clusterPostgresVersionsGet**](#clusterpostgresversionsget) | **GET** /clusters/{clusterId}/postgresversions | List PostgreSQL versions |
| [**clustersDelete**](#clustersdelete)                         | **DELETE** /clusters/{clusterId}               | Delete a cluster         |
| [**clustersFindById**](#clustersfindbyid)                     | **GET** /clusters/{clusterId}                  | Fetch a cluster          |
| [**clustersGet**](#clustersget)                               | **GET** /clusters                              | List clusters            |
| [**clustersPatch**](#clusterspatch)                           | **PATCH** /clusters/{clusterId}                | Patch a cluster          |
| [**clustersPost**](#clusterspost)                             | **POST** /clusters                             | Create a cluster         |
| [**postgresVersionsGet**](#postgresversionsget)               | **GET** /clusters/postgresversions             | List PostgreSQL versions |

## clusterPostgresVersionsGet

> clusterPostgresVersionsGet(clusterId)

List PostgreSQL versions

Retrieves a list of all PostgreSQL versions available for this cluster including the current version.

### 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.ClustersApi(config);
// List PostgreSQL versions
api_instance
  .clusterPostgresVersionsGet({
    clusterId: 498ae72f-411f-11eb-9d07-046c59cc737e
  })
  .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] |

### Return type

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

### Authorization

basicAuth, tokenAuth

### HTTP request headers

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

## clustersDelete

> clustersDelete(clusterId)

Delete a cluster

Delete a PostgreSQL cluster.

### 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.ClustersApi(config);
// Delete a cluster
api_instance
  .clustersDelete({
    clusterId: 498ae72f-411f-11eb-9d07-046c59cc737e
  })
  .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] |

### Return type

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

### Authorization

basicAuth, tokenAuth

### HTTP request headers

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

## clustersFindById

> clustersFindById(clusterId)

Fetch a cluster

You can retrieve a PostgreSQL cluster by using its ID. This value can be found in the response body when a PostgreSQL cluster is created or when you GET a list of PostgreSQL clusters.

### 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.ClustersApi(config);
// Fetch a cluster
api_instance
  .clustersFindById({
    clusterId: 498ae72f-411f-11eb-9d07-046c59cc737e
  })
  .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] |

### Return type

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

### Authorization

basicAuth, tokenAuth

### HTTP request headers

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

## clustersGet

> clustersGet(opts)

List clusters

Retrieves a list of PostgreSQL clusters.

### 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.ClustersApi(config);
// List clusters
api_instance
  .clustersGet({
    limit: 100,
    offset: 200,
    filterName: filterName_example
    options: {}
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name           | Type       | Description                                                                                                                                                           | Notes                              |
| -------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| **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]         |
| **filterName** | **string** | Response filter to list only the PostgreSQL clusters that contain the specified name. The value is case insensitive and matched on the \&#39;displayName\&#39; field. | \[optional]\[default to undefined] |

### Return type

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

### Authorization

basicAuth, tokenAuth

### HTTP request headers

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

## clustersPatch

> clustersPatch(clusterId, patchClusterRequest)

Patch a cluster

Patch attributes of a PostgreSQL cluster.

### 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.ClustersApi(config);
// Patch a cluster
api_instance
  .clustersPatch({
    clusterId: 498ae72f-411f-11eb-9d07-046c59cc737e,
    patchClusterRequest: patchClusterRequest_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] |
| **patchClusterRequest** | [**PatchClusterRequest**](https://docs.ionos.com/cloud/nodejs/dbaas-postgres/models/patchclusterrequest.md) | Part of the cluster which should be modified. |                         |

### Return type

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

### Authorization

basicAuth, tokenAuth

### HTTP request headers

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

## clustersPost

> clustersPost(createClusterRequest)

Create a cluster

Creates a new PostgreSQL cluster. If the `fromBackup` field is populated, the new cluster will be created based on the given backup.

### 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.ClustersApi(config);
// Create a cluster
api_instance
  .clustersPost({
    createClusterRequest: createClusterRequest_example
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name                     | Type                                                                                                          | Description                | Notes |
| ------------------------ | ------------------------------------------------------------------------------------------------------------- | -------------------------- | ----- |
| **createClusterRequest** | [**CreateClusterRequest**](https://docs.ionos.com/cloud/nodejs/dbaas-postgres/models/createclusterrequest.md) | The cluster to be created. |       |

### Return type

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

### Authorization

basicAuth, tokenAuth

### HTTP request headers

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

## postgresVersionsGet

> postgresVersionsGet

List PostgreSQL versions

Retrieves a list of all available PostgreSQL versions.

### 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.ClustersApi(config);
// List PostgreSQL versions
api_instance
  .postgresVersionsGet()
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

This endpoint does not need any parameter.

### Return type

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

### Authorization

basicAuth, tokenAuth

### HTTP request headers

* **Content-Type**: Not defined
* **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/clustersapi.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.
