# MongoDB v1 API

The MongoDB v1 API lets you manage MongoDB database clusters programmatically by using the conventional `HTTPS` requests. The creation of MongoDB cluster functionality that is available in the IONOS Cloud DCD is also available through the API.

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

Use the MongoDB v1 API to:

* Create and configure a MongoDB replica set and sharded clusters.
* Manage database users and access controls.
* Enable the BI Connector for analytics.
* Migrate data between clusters.
* Restore databases from backups.
* Access cluster logs for monitoring and troubleshooting.

## MongoDB v1 OpenAPI Specification

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

To make authenticated requests to the API, you need to include a few fields in the request headers. The following are the relevant request parameters and descriptions:

### 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 which contract it applies to.                                 |
| **Content-Type**      |    yes   |  string | Set this to `application/json`.                                                                                                   |

### Examples

We use `curl` in our examples because it is available on Windows 10, Linux and macOS. If you encounter any problems with `curl` on Linux or Windows, refer to the following:

{% 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>Create a MongoDB Cluster</strong></mark></td><td>Learn how to create a MongoDB cluster.</td><td><a href="v1-api/create-mongodb-cluster">create-mongodb-cluster</a></td></tr><tr><td><mark style="color:blue;"><strong>Create a Sharded Database Cluster</strong></mark></td><td>Learn how to create a MongoDB sharded cluster.</td><td><a href="v1-api/create-a-sharded-cluster">create-a-sharded-cluster</a></td></tr><tr><td><mark style="color:blue;"><strong>Modify Cluster Attributes</strong></mark></td><td>Learn how to modify a MongoDB cluster attributes.</td><td><a href="v1-api/modify-cluster-attributes">modify-cluster-attributes</a></td></tr><tr><td><mark style="color:blue;"><strong>Enable the BI Connector</strong></mark></td><td>Learn how to enable the BI Connector.</td><td><a href="v1-api/enable-the-biconnector">enable-the-biconnector</a></td></tr><tr><td><mark style="color:blue;"><strong>Users Management</strong></mark></td><td>Learn how to create, view, and delete users using MongoDB clusters.</td><td><a href="v1-api/users-management">users-management</a></td></tr><tr><td><mark style="color:blue;"><strong>Access Logs</strong></mark></td><td>Learn how to access the logs via the API.</td><td><a href="v1-api/access-logs">access-logs</a></td></tr><tr><td><mark style="color:blue;"><strong>Database Migration</strong></mark></td><td>Learn how to migrate your MongoDB data from one cluster to another one.</td><td><a href="v1-api/migration">migration</a></td></tr><tr><td><mark style="color:blue;"><strong>Restore a Database</strong></mark></td><td>Learn how to restore a database cluster.</td><td><a href="v1-api/restore-a-database">restore-a-database</a></td></tr><tr><td><mark style="color:blue;"><strong>Connect from Kubernetes</strong></mark></td><td>Learn how to connect to a MongoDB cluster 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>Connect to a MongoDB Instance</strong></mark></td><td>Learn how to connect to a MongoDB instance with the MongoDB Shell `mongosh`.</td><td><a href="v1-api/connect-to-mongodb-instance">connect-to-mongodb-instance</a></td></tr></tbody></table>
