> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/m/mongodb-atlas-administration.md).

# MongoDB Atlas Administration

MongoDB Atlas is the managed MongoDB service. This adapter reads the organization users of Atlas (the people who sign in to Atlas), with their teams and roles, through the Atlas Administration API. For database users, use the MongoDB Atlas Database Users adapter.

## Use cases

* List the Atlas organization users.

```
Adapters = mongodb-atlas-administration
```

* Find Atlas organization users who have not authenticated for 90 days.

```
Adapters = mongodb-atlas-administration AND NOT LastLogOnTime last now-90d/d
```

## Before you begin

### Network

| Source              | Destination                                                                      | Port | Protocol |
| ------------------- | -------------------------------------------------------------------------------- | ---- | -------- |
| OctoXLabs connector | `cloud.mongodb.com` (default) or `cloud.mongodbgov.com` for Atlas for Government | 443  | HTTPS    |

### Required permissions

| Scope or role                           | Permission | Needed for                                  |
| --------------------------------------- | ---------- | ------------------------------------------- |
| Organization Member (organization role) | Read       | Organizations, organization users and teams |

The service account needs at least Organization Member in every organization whose users you want. If the organization requires an IP access list for the Atlas Administration API, add the IP address of the OctoXLabs server to the access list of the service account.

## Create credentials in MongoDB Atlas Administration

{% stepper %}
{% step %}

### Open Organization Access Manager

Log in to MongoDB Atlas and open the Organization Access Manager page of your organization.
{% endstep %}

{% step %}

### Create a service account

Open the Applications tab and create a new Service Account.
{% endstep %}

{% step %}

### Name it and set the role

Give it a descriptive name and assign the Organization Member role.
{% endstep %}

{% step %}

### Copy the credentials

After you select create, copy the Client ID and Client Secret. The secret is shown only once.
{% endstep %}

{% step %}

### Update the access list

If required, add the IP address of the OctoXLabs server to the access list of the service account.
{% endstep %}
{% endstepper %}

## Connection parameters

| Parameter                       | Required | Type    | Default           | Description                                                                           |
| ------------------------------- | -------- | ------- | ----------------- | ------------------------------------------------------------------------------------- |
| Domain (`domain`)               | No       | String  | cloud.mongodb.com | Atlas Administration API domain. Use `cloud.mongodbgov.com` for Atlas for Government. |
| Client ID (`client_id`)         | Yes      | String  |                   | Client ID of the service account.                                                     |
| Client Secret (`client_secret`) | Yes      | String  |                   | Client Secret of the service account.                                                 |
| Proxy (`proxy`)                 | No       | String  |                   | Proxy host and port, sent as an `http://` proxy URL.                                  |
| Timeout (`timeout`)             | No       | Integer | 30                | Seconds to wait for API responses.                                                    |

## Troubleshooting

| Error message                          | Cause                                                            | Fix                                                                          |
| -------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| Max retries exceeded for               | The API kept returning 401 or 429 after retries.                 | Check the service account credentials and wait for the rate limit.           |
| Skipping users of Atlas organization : | The users call failed for one organization. Logged as a warning. | Check that the service account has Organization Member in that organization. |

## Change history

{% hint style="info" %}
Available starting from version 6.9.1.
{% endhint %}
