# MongoDB Atlas

> Connect a MongoDB Atlas service account scoped to billing to LevelFour.

Source: https://docs.levelfour.ai/connectors/mongodb


## Prerequisites

* A MongoDB Atlas organization.
* Organization Owner access, to create the service account.
* If your organization enforces an API access list, ask your LevelFour contact for the addresses to allow.

## Connect

### Create a service account in MongoDB Atlas

As an Organization Owner, create a service account with the **Organization Billing Viewer** and **Organization Read Only** roles. Copy its client ID and secret.

### Add it to LevelFour

Open **Connect Providers**, select **MongoDB Atlas**, and paste the client ID, client secret, and your Organization ID. Click **Add Service account client ID**.

## Confirming it worked

The connection moves to **Connected**. Your first data appears within a day.

## Rotating or removing access

### Rotating the credential

Create a new service account in MongoDB Atlas, paste its credentials into **Connect Providers**, then delete the old service account.

### Removing access

Disconnect MongoDB Atlas under **Connect Providers**, then delete the service account from Atlas.

## Troubleshooting

| Symptom                                        | What to do                                                                                                              |
| ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| The connection is refused                      | Only an Organization Owner can create a service account with billing access. Confirm the creator's role                 |
| The connection fails behind an API access list | Your organization restricts API access by IP. Ask your LevelFour contact for the addresses to allow, then retry         |
| The current month's spend keeps changing       | Expected. The in-progress invoice is not final until it closes; a prior month stops changing once its invoice is issued |

## Next

* [Connect Providers](/connectors) lists every provider you can connect
