Access to MongoDB cluster via Atlas Administrator API

Is it possible to gain access to a MongoDB cluster using the Atlas Administrator API?
I would like to programmatically access all the clusters inside an organization. For that I would have to manually create a user for each of the projects and store the credentials in order to access the MongoDB clusters. Is there a simpler way? Ideally I would like to be able to use the Atlas API (given sufficient permissions) to get credentials for accessing the clusters.

1 Like

Hi @Aleksandar_Jelic - Welcome to the community.

Just to clarify, what do you mean by gain access to the MongoDB cluster? Do you mean configuring the cluster itself or modifying / reading the data within the cluster?

Is “user” in this context a Database User?

You could possibly use the Return All Database Users from One Project request.

The requested information is just so that I can get a better understanding of the context since there are multiple API’s.

Look forward to hearing from you.



Hi @Jason_Tran, thank you for your reply.

Let me add some context.
I’m using GitHub - mongodb/mongo-go-driver: The Official Golang driver for MongoDB to extract some data (database names, roles,…) from a MongoDB cluster. I’m connecting to the cluster via username and password. My goal is to extract data from all the clusters in the organization (in all the projects).

Connecting to all the clusters in projects of all the organizations can be a bit cumbersome as I’d need to create a database user for each of the projects and store the credentials. Is there an easier way to connect to the clusters? As mentioned in the previous post, ideally I would like to be able to use the Atlas API to somehow connect to the clusters inside a project.

You mentioned the Return All Database Users from One Project endpoint, but it doesn’t return the user’s password (which is perfectly reasonable, I would never expect it to).

I’d really appreciate your input.
Thank you and best regards,

1 Like

Thanks for providing those details / context. Just for clarity, it sounds like you are after accessing the data within each of the clusters inside each project for an organization rather than information about the cluster(s) but correct me if I am wrong here. In saying so, the Atlas Administration API’s available allow you to perform administrative tasks for the Atlas organization rather than accessing the data inside each of the clusters.

You can read and write data using the Data API if it suits your use case but as per the documentation:

The Data API uses project-level API keys to manage access and prevent unauthorized requests. Every request must include a valid Data API key.

A Data API key grants full read and write access every collection in a cluster and can access any enabled cluster in the project.

Is this something you’ve looked into to see if it suits your use case?


1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.