Manage Programmatic Access to a Project
On this page
- OAuth 2.0 authentication for programmatic access to Atlas is available as a Preview feature.
- The feature and the corresponding documentation might change at any time during the Preview period. To use OAuth 2.0 authentication, create a service account to use in your requests to the Atlas Administration API.
Use the following procedures to manage programmatic access to a project. To learn more, see Grant Programmatic Access to a Project.
Required Access
To perform any of the following actions, you must have
Project Owner
access to the project.
View Programmatic Access to a Project
You can view the details of all API keys or service accounts that have access to your project.
To list all API keys for your project using the Atlas CLI, run the following command:
atlas projects apiKeys list [options]
To learn more about the command syntax and parameters, see the Atlas CLI documentation for atlas projects apiKeys list.
You can view the API access list entries for a project
API key using an atlas organizations
command.
To list IP access list entries for your API key using the Atlas CLI, run the following command:
atlas organizations apiKeys accessLists list <apiKeyID> [options]
To learn more about the command syntax and parameters, see the Atlas CLI documentation for atlas organizations apiKeys accessLists list.
To view the details of an API key in a project using the Atlas UI:
In Atlas, go to the Project Access Manager page.
If it's not already displayed, select your desired organization from the Organizations menu in the navigation bar.
If it's not already displayed, select your desired project from the Projects menu in the navigation bar.
Do one of the following steps:
Select Project Access from the Access Manager menu in the navigation bar.
Next to the Projects menu, expand the Options menu, click Project Settings, and click Access Manager in the sidebar.
The Project Access Manager page displays.
View the Access List.
Click to the right of the API Key.
Click View Details.
The <Public Key> API Key Details modal displays the following information:
The obfuscated Private Key
The date the key was last used
The date the key was created
The IP address or addresses from which the API key can access the API
To view the details of a service account in a project using the Atlas UI:
In Atlas, go to the Project Access Manager page.
If it's not already displayed, select your desired organization from the Organizations menu in the navigation bar.
If it's not already displayed, select your desired project from the Projects menu in the navigation bar.
Do one of the following steps:
Select Project Access from the Access Manager menu in the navigation bar.
Next to the Projects menu, expand the Options menu, click Project Settings, and click Access Manager in the sidebar.
The Project Access Manager page displays.
Click Service Accounts.
All the service accounts with access to your project are listed.
Click the name of a service account to view its details, including:
The obfuscated client secret for the service account
The date the client secret was last used
The date the client secret was created
The IP addresses from which the service account can access the API
The roles the service account has been assigned
You can use the Atlas Administration API to list the names and details of the service accounts that have access to your project.
Change Programmatic Access Roles for a Project
In Atlas, go to the Project Access Manager page.
If it's not already displayed, select your desired organization from the Organizations menu in the navigation bar.
If it's not already displayed, select your desired project from the Projects menu in the navigation bar.
Do one of the following steps:
Select Project Access from the Access Manager menu in the navigation bar.
Next to the Projects menu, expand the Options menu, click Project Settings, and click Access Manager in the sidebar.
The Project Access Manager page displays.
Select the new role or roles for the API Key from the Project Permissions menu.
In Atlas, go to the Project Access Manager page.
If it's not already displayed, select your desired organization from the Organizations menu in the navigation bar.
If it's not already displayed, select your desired project from the Projects menu in the navigation bar.
Do one of the following steps:
Select Project Access from the Access Manager menu in the navigation bar.
Next to the Projects menu, expand the Options menu, click Project Settings, and click Access Manager in the sidebar.
The Project Access Manager page displays.
Edit the Project Permissions.
Click Edit Permissions.
From the Project Permissions menu, select the new role or roles for the service account.
Click Save and next.
Important
The service account credentials remain active until they expire or are revoked.
You can use the Atlas Administration API to update service account details for a project.
Edit Project Access List
You can edit the API access list entries for a project API
key using atlas organizations
commands.
Add an API Access List Entry for the API Key
To create an IP access list entry for your API key using the Atlas CLI, run the following command:
atlas organizations apiKeys accessLists create [options]
To learn more about the command syntax and parameters, see the Atlas CLI documentation for atlas organizations apiKeys accessLists create.
Delete an API Access List Entry for the API Key
To delete an IP access list entry for your API key using the Atlas CLI, run the following command:
atlas organizations apiKeys accessLists delete <entry> [options]
To learn more about the command syntax and parameters, see the Atlas CLI documentation for atlas organizations apiKeys accessLists delete.
In Atlas, go to the Project Access Manager page.
If it's not already displayed, select your desired organization from the Organizations menu in the navigation bar.
If it's not already displayed, select your desired project from the Projects menu in the navigation bar.
Do one of the following steps:
Select Project Access from the Access Manager menu in the navigation bar.
Next to the Projects menu, expand the Options menu, click Project Settings, and click Access Manager in the sidebar.
The Project Access Manager page displays.
Edit the API Access List.
You cannot modify an existing API Key access list entry. You must delete and re-create it.
Click to the right of the IP address to remove it.
Add the new IP address or CIDR block from which you want Atlas to accept API requests for this API Key. Use one of the two options:
Click Add access list Entry and type an IP address, or
Click Use Current IP Address if the host you are using to access Atlas will also make API requests using this API Key.
Click Save.
In Atlas, go to the Project Access Manager page.
If it's not already displayed, select your desired organization from the Organizations menu in the navigation bar.
If it's not already displayed, select your desired project from the Projects menu in the navigation bar.
Do one of the following steps:
Select Project Access from the Access Manager menu in the navigation bar.
Next to the Projects menu, expand the Options menu, click Project Settings, and click Access Manager in the sidebar.
The Project Access Manager page displays.
Edit the API Access List.
To add an IP address or CIDR block from which you want Atlas to accept API requests for this service account, click Add Access List Entry and type an IP address.
You can also click Use Current IP Address if the host you are using to access Atlas also will make API requests using this service account.
To remove an IP address from the access list, click to the right of the IP address.
Click Save.
You can use the Atlas Administration API to update service account details for a project.
Revoke Programmatic Access to a Project
To delete an API key for your project using the Atlas CLI, run the following command:
atlas projects apiKeys delete <ID> [options]
To learn more about the command syntax and parameters, see the Atlas CLI documentation for atlas projects apiKeys delete.
To delete an API key from a project using the Atlas UI:
In Atlas, go to the Project Access Manager page.
If it's not already displayed, select your desired organization from the Organizations menu in the navigation bar.
If it's not already displayed, select your desired project from the Projects menu in the navigation bar.
Do one of the following steps:
Select Project Access from the Access Manager menu in the navigation bar.
Next to the Projects menu, expand the Options menu, click Project Settings, and click Access Manager in the sidebar.
The Project Access Manager page displays.
In Atlas, go to the Project Access Manager page.
If it's not already displayed, select your desired organization from the Organizations menu in the navigation bar.
If it's not already displayed, select your desired project from the Projects menu in the navigation bar.
Do one of the following steps:
Select Project Access from the Access Manager menu in the navigation bar.
Next to the Projects menu, expand the Options menu, click Project Settings, and click Access Manager in the sidebar.
The Project Access Manager page displays.
You can use the Atlas Administration API to remove a service account from a project.