# PostgreSQL v1 API

The creation of PostgreSQL cluster functionality that is available in the IONOS Cloud DCD is also available through the API.

## What you can do with the PostgreSQL v1 API?

Use the PostgreSQL v1 API to:

* Create and manage PostgreSQL database clusters
* Manage database users and access controls
* Filter and paginate by cluster name
* Handle backups and restores
* Access cluster logs for monitoring and troubleshooting

## PostgreSQL v1 OpenAPI Specification

**Endpoint:** `https://api.ionos.com/databases/postgresql`

To make authenticated requests to the API, you must include a few fields in the request headers. Please find relevant descriptions below:

### Request parameter headers

| Header                | Required |   Type  | Description                                                                                                                       |
| --------------------- | :------: | :-----: | --------------------------------------------------------------------------------------------------------------------------------- |
| **Authorization**     |    yes   |  string | HTTP Basic authorization. A base64 encoded string of a username and password separated by a colon. `username@domain.tld:password` |
| **X-Contract-Number** |    no    | integer | Users with more than one contract may apply this header to indicate the applicable contract.                                      |
| **Content-Type**      |    yes   |  string | Set this to `application/json`.                                                                                                   |

### Examples

We use `curl` in our examples, as this tool is available on Windows 10, Linux and macOS. Please refer to our blogpost about `curl` on Windows if you encounter any problems:

{% embed url="<https://www.ionos.com/digitalguide/server/tools/introduction-to-curl-in-linux>" %}

{% embed url="<https://www.ionos.com/digitalguide/server/tools/introduction-to-curl-in-windows>" %}

## Quick Links

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><mark style="color:blue;"><strong>Set Up a PostgreSQL Cluster</strong></mark></td><td>Learn how to set up a PostgreSQL cluster using the API.</td><td><a href="v1-api/create-a-database">create-a-database</a></td></tr><tr><td><mark style="color:blue;"><strong>Modify Cluster Attributes</strong></mark></td><td>Learn how to modify attributes of an existing PostgreSQL cluster.</td><td><a href="v1-api/modify-cluster-attributes">modify-cluster-attributes</a></td></tr><tr><td><mark style="color:blue;"><strong>Manage Users and Databses</strong></mark></td><td>Learn how to manage users and database clusters of PostgreSQL.</td><td><a href="v1-api/users-and-databases">users-and-databases</a></td></tr><tr><td><mark style="color:blue;"><strong>Connect from Kubernetes</strong></mark></td><td>Learn how to connect to a database from your managed Kubernetes cluster.</td><td><a href="v1-api/connect-from-kubernetes">connect-from-kubernetes</a></td></tr><tr><td><mark style="color:blue;"><strong>View Cluster Metrics</strong></mark></td><td>Learn how to view metrics for your PostgreSQL cluster.</td><td><a href="v1-api/metrics">metrics</a></td></tr></tbody></table>
