Return All Clusters in One Project
Deprecated
Returns the details for all clusters in the specific project to which you have access. Clusters contain a group of hosts that maintain the same data set. The response includes clusters with asymmetrically-sized shards. To use this resource, the requesting API Key must have the Project Read Only role. This feature is not available for serverless clusters.
Path parameters
-
Unique 24-hexadecimal digit string that identifies your project. Use the /groups endpoint to retrieve all projects to which the authenticated user has access.
NOTE: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.
Minimum length is
24
, maximum length is24
. Format should match the following pattern:^([a-f0-9]{24})$
.
Query parameters
-
Flag that indicates whether Application wraps the response in an
envelope
JSON object. Some API clients cannot access the HTTP response headers or status code. To remediate this, set envelope=true in the query. Endpoints that return a list of results use the results object as an envelope. Application adds the status parameter to the response body.Default value is
false
. -
Flag that indicates whether the response returns the total number of items (totalCount) in the response.
Default value is
true
. -
Number of items that the response returns per page.
Minimum value is
1
, maximum value is500
. Default value is100
. -
Number of the page that displays the current set of the total objects that the response returns.
Minimum value is
1
. Default value is1
. -
Flag that indicates whether the response body should be in the prettyprint format.
Default value is
false
. -
Flag that indicates whether to return Clusters with retain backups.
Default value is
false
.
atlas api clusters listClusters --help
import (
"os"
"context"
"log"
sdk "go.mongodb.org/atlas-sdk/v20230101001/admin"
)
func main() {
ctx := context.Background()
clientID := os.Getenv("MONGODB_ATLAS_CLIENT_ID")
clientSecret := os.Getenv("MONGODB_ATLAS_CLIENT_SECRET")
// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth
client, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))
if err != nil {
log.Fatalf("Error: %v", err)
}
params = &sdk.ListClustersApiParams{}
sdkResp, httpResp, err := client.ClustersApi.
ListClustersWithParams(ctx, params).
Execute()
}
curl --include --header "Authorization: Bearer ${ACCESS_TOKEN}" \
--header "Accept: application/vnd.atlas.2023-01-01+json" \
-X GET "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/clusters?pretty=true"
curl --user "${PUBLIC_KEY}:${PRIVATE_KEY}" \
--digest --include \
--header "Accept: application/vnd.atlas.2023-01-01+json" \
-X GET "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/clusters?pretty=true"
{
"links": [
{
"href": "https://cloud.mongodb.com/api/atlas",
"rel": "self"
}
],
"results": [
{
"acceptDataRisksAndForceReplicaSetReconfig": "2025-05-04T09:42:00Z",
"autoScaling": {
"compute": {
"enabled": true,
"scaleDownEnabled": true
},
"diskGBEnabled": true
},
"backupEnabled": true,
"biConnector": {
"enabled": true,
"readPreference": "PRIMARY"
},
"clusterType": "REPLICASET",
"connectionStrings": {
"awsPrivateLink": {
"additionalProperty1": "string",
"additionalProperty2": "string"
},
"awsPrivateLinkSrv": {
"additionalProperty1": "string",
"additionalProperty2": "string"
},
"private": "string",
"privateEndpoint": [
{
"connectionString": "string",
"endpoints": [
{
"endpointId": "string",
"providerName": "AWS",
"region": "string"
}
],
"srvConnectionString": "string",
"srvShardOptimizedConnectionString": "string",
"type": "MONGOD"
}
],
"privateSrv": "string",
"standard": "string",
"standardSrv": "string"
},
"createDate": "2025-05-04T09:42:00Z",
"diskSizeGB": 42.0,
"diskWarmingMode": "FULLY_WARMED",
"encryptionAtRestProvider": "NONE",
"globalClusterSelfManagedSharding": true,
"groupId": "32b6e34b3d91647abb20e7b8",
"id": "32b6e34b3d91647abb20e7b8",
"labels": [
{
"key": "string",
"value": "string"
}
],
"links": [
{
"href": "https://cloud.mongodb.com/api/atlas",
"rel": "self"
}
],
"mongoDBMajorVersion": "string",
"mongoDBVersion": "string",
"mongoURI": "string",
"mongoURIUpdated": "2025-05-04T09:42:00Z",
"mongoURIWithOptions": "string",
"name": "string",
"numShards": 1,
"paused": true,
"pitEnabled": true,
"providerBackupEnabled": true,
"providerSettings": {
"providerName": "AWS",
"autoScaling": {
"compute": {
"maxInstanceSize": "M10",
"minInstanceSize": "M10"
}
},
"diskIOPS": 42,
"encryptEBSVolume": true,
"instanceSizeName": "M10",
"regionName": "US_GOV_WEST_1",
"volumeType": "STANDARD"
},
"replicationFactor": 3,
"replicationSpec": {
"additionalProperty1": {
"analyticsNodes": 42,
"electableNodes": 0,
"priority": 42,
"readOnlyNodes": 42
},
"additionalProperty2": {
"analyticsNodes": 42,
"electableNodes": 0,
"priority": 42,
"readOnlyNodes": 42
}
},
"replicationSpecs": [
{
"id": "32b6e34b3d91647abb20e7b8",
"numShards": 1,
"regionsConfig": {
"additionalProperty1": {
"analyticsNodes": 42,
"electableNodes": 0,
"priority": 42,
"readOnlyNodes": 42
},
"additionalProperty2": {
"analyticsNodes": 42,
"electableNodes": 0,
"priority": 42,
"readOnlyNodes": 42
}
},
"zoneName": "string"
}
],
"rootCertType": "ISRGROOTX1",
"srvAddress": "string",
"stateName": "IDLE",
"tags": [
{
"key": "string",
"value": "string"
}
],
"terminationProtectionEnabled": false,
"versionReleaseSystem": "LTS"
}
],
"totalCount": 42
}
{
"error": 401,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Unauthorized",
"errorCode": "NOT_ORG_GROUP_CREATOR"
}
{
"error": 500,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Internal Server Error",
"errorCode": "UNEXPECTED_ERROR"
}