Return One Shard Key Analysis Operation for One Cluster

GET /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/shardKeyAnalyses/operations/{operationId}

Returns the progress of one shard key analysis for the specified cluster. Poll this resource until status reaches a terminal value. On success it carries resultHref, the URI of the analysis it created; on failure it carries error. While the status is not terminal it carries retryAfterSeconds, how long to wait before polling again. MongoDB Cloud retains an operation for 30 days past its terminal state.

Role requirements
  • Project Data Access Admin
  • Project Data Access Read Only
  • Project Data Access Read Write
  • Project Stream Processing Owner

Path parameters

  • groupId string Required

    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.

    Format should match the following pattern: ^([a-f0-9]{24})$.

  • clusterName string Required

    Human-readable label that identifies the cluster with the shard key analysis operation you want to return.

    Format should match the following pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$.

  • operationId string Required

    Unique 24-hexadecimal digit string that identifies the shard key analysis operation to return.

    Format should match the following pattern: ^([a-f0-9]{24})$.

Query parameters

  • envelope boolean

    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.

  • pretty boolean

    Flag that indicates whether the response body should be in the prettyprint format.

    Default value is false.

    Prettyprint

Responses

  • 200 application/vnd.atlas.2025-03-12+json

    OK

    Hide headers attributes Show headers attributes
    • RateLimit-Limit

      The maximum number of requests that a user can make within a specific time window.

    • RateLimit-Remaining

      The number of requests remaining in the current rate limit window before the limit is reached.

    Hide response attributes Show response attributes object
    • createdAt string(date-time) Required

      Date and time when MongoDB Cloud accepted this operation (ISO 8601 format in UTC).

    • error object

      Details of the failure that ended the shard key analysis operation.

      Hide error attributes Show error attributes object
      • code string Required

        Reason that the shard key analysis failed. MongoDB Cloud may report additional values in the future without a new resource version, so treat a value this description does not list as a generic failure.

        Values are NAMESPACE_NOT_FOUND, COLLECTION_EMPTY, SHARD_KEY_MISSING_SUPPORTING_INDEX, INSUFFICIENT_CARDINALITY_FOR_DISTRIBUTION, SHARD_KEY_CONTAINS_ARRAY_FIELD, SUPPORTING_INDEX_NOT_ASCENDING, SUPPORTING_INDEX_AMBIGUOUS, SHARD_KEY_ANALYSIS_TIMED_OUT, or SHARD_KEY_ANALYSIS_FAILED.

      • message string Required

        Human-readable explanation of the failure. This message describes the classified failure and is not the raw error text from the cluster.

      • retryStrategy string

        How to retry a failed shard key analysis. BACKOFF indicates that resubmitting the same request after a delay may succeed. NONE indicates that the failure describes the collection or the candidate shard key and that resubmitting the same request will fail the same way.

        Values are BACKOFF or NONE.

      • retryable boolean Required

        Flag that indicates whether submitting the same request again may succeed. This flag is false when the failure describes the collection or the candidate shard key, because the same request then fails the same way.

    • expiresAt string(date-time) Required

      Date and time when MongoDB Cloud stops returning this operation (ISO 8601 format in UTC). Reads after this time return an HTTP 404 status. This value derives from updatedAt, so it advances with each state change while the operation is running and settles only once the operation is terminal.

    • operationId string Required

      Unique 24-hexadecimal digit string that identifies this operation. When the operation succeeds, the analysis it created carries the same identifier.

      Format should match the following pattern: ^([a-f0-9]{24})$.

    • operationType string Required

      Kind of change the operation makes. Submitting a shard key analysis creates an analysis resource, so the operation type is always CREATE.

      Value is CREATE.

    • resultHref string

      URI of the analysis this operation created. MongoDB Cloud returns this parameter only when status is SUCCEEDED.

    • retryAfterSeconds integer(int32)

      Number of seconds to wait before polling this operation again. MongoDB Cloud returns this parameter only while status is not terminal.

      Minimum value is 1.

    • status string Required

      State of the shard key analysis operation. PENDING and IN_PROGRESS are non-terminal; SUCCEEDED, FAILED, CANCELED and SUPERSEDED are terminal. MongoDB Cloud currently reports only PENDING, SUCCEEDED and FAILED. The remaining values are reserved and may be reported in the future without a new resource version.

      Values are PENDING, IN_PROGRESS, SUCCEEDED, FAILED, CANCELED, or SUPERSEDED.

    • updatedAt string(date-time) Required

      Date and time when this operation last changed state (ISO 8601 format in UTC). Once the operation is terminal, this is when it finished.

  • 400 application/json

    Bad Request.

    Hide response attributes Show response attributes object
    • badRequestDetail object

      Bad request detail.

      Hide badRequestDetail attribute Show badRequestDetail attribute object
      • fields array[object]

        Describes all violations in a client request.

        Hide fields attributes Show fields attributes object
        • description string Required

          A description of why the request element is bad.

        • field string Required

          A path that leads to a field in the request body.

    • detail string | null

      Describes the specific conditions or reasons that cause each type of error.

    • error integer(int32) Required

      HTTP status code returned with this error.

      External documentation
    • errorCode string Required

      Application error code returned with this error.

    • parameters array[object]

      Parameters used to give more information about the error.

    • reason string | null

      Application error message returned with this error.

  • 401 application/json

    Unauthorized.

    Hide response attributes Show response attributes object
    • badRequestDetail object

      Bad request detail.

      Hide badRequestDetail attribute Show badRequestDetail attribute object
      • fields array[object]

        Describes all violations in a client request.

        Hide fields attributes Show fields attributes object
        • description string Required

          A description of why the request element is bad.

        • field string Required

          A path that leads to a field in the request body.

    • detail string | null

      Describes the specific conditions or reasons that cause each type of error.

    • error integer(int32) Required

      HTTP status code returned with this error.

      External documentation
    • errorCode string Required

      Application error code returned with this error.

    • parameters array[object]

      Parameters used to give more information about the error.

    • reason string | null

      Application error message returned with this error.

  • 403 application/json

    Forbidden.

    Hide response attributes Show response attributes object
    • badRequestDetail object

      Bad request detail.

      Hide badRequestDetail attribute Show badRequestDetail attribute object
      • fields array[object]

        Describes all violations in a client request.

        Hide fields attributes Show fields attributes object
        • description string Required

          A description of why the request element is bad.

        • field string Required

          A path that leads to a field in the request body.

    • detail string | null

      Describes the specific conditions or reasons that cause each type of error.

    • error integer(int32) Required

      HTTP status code returned with this error.

      External documentation
    • errorCode string Required

      Application error code returned with this error.

    • parameters array[object]

      Parameters used to give more information about the error.

    • reason string | null

      Application error message returned with this error.

  • 404 application/json

    Not Found.

    Hide response attributes Show response attributes object
    • badRequestDetail object

      Bad request detail.

      Hide badRequestDetail attribute Show badRequestDetail attribute object
      • fields array[object]

        Describes all violations in a client request.

        Hide fields attributes Show fields attributes object
        • description string Required

          A description of why the request element is bad.

        • field string Required

          A path that leads to a field in the request body.

    • detail string | null

      Describes the specific conditions or reasons that cause each type of error.

    • error integer(int32) Required

      HTTP status code returned with this error.

      External documentation
    • errorCode string Required

      Application error code returned with this error.

    • parameters array[object]

      Parameters used to give more information about the error.

    • reason string | null

      Application error message returned with this error.

  • 429 application/json

    Too Many Requests.

    Hide headers attributes Show headers attributes
    • RateLimit-Limit

      The maximum number of requests that a user can make within a specific time window.

    • RateLimit-Remaining

      The number of requests remaining in the current rate limit window before the limit is reached.

    • Retry-After

      The minimum time you should wait, in seconds, before retrying the API request. This header might be returned for 429 or 503 error responses.

    Hide response attributes Show response attributes object
    • badRequestDetail object

      Bad request detail.

      Hide badRequestDetail attribute Show badRequestDetail attribute object
      • fields array[object]

        Describes all violations in a client request.

        Hide fields attributes Show fields attributes object
        • description string Required

          A description of why the request element is bad.

        • field string Required

          A path that leads to a field in the request body.

    • detail string | null

      Describes the specific conditions or reasons that cause each type of error.

    • error integer(int32) Required

      HTTP status code returned with this error.

      External documentation
    • errorCode string Required

      Application error code returned with this error.

    • parameters array[object]

      Parameters used to give more information about the error.

    • reason string | null

      Application error message returned with this error.

  • 500 application/json

    Internal Server Error.

    Hide response attributes Show response attributes object
    • badRequestDetail object

      Bad request detail.

      Hide badRequestDetail attribute Show badRequestDetail attribute object
      • fields array[object]

        Describes all violations in a client request.

        Hide fields attributes Show fields attributes object
        • description string Required

          A description of why the request element is bad.

        • field string Required

          A path that leads to a field in the request body.

    • detail string | null

      Describes the specific conditions or reasons that cause each type of error.

    • error integer(int32) Required

      HTTP status code returned with this error.

      External documentation
    • errorCode string Required

      Application error code returned with this error.

    • parameters array[object]

      Parameters used to give more information about the error.

    • reason string | null

      Application error message returned with this error.

GET /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/shardKeyAnalyses/operations/{operationId}
atlas api shardKeyAnalyzer getAnalysisOperation --help
import (
	"os"
	"context"
	"log"
	sdk "go.mongodb.org/atlas-sdk/v20250312001/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.GetGroupClusterShardKeyAnalysisOperationApiParams{}
	sdkResp, httpResp, err := client.ShardKeyAnalyzerApi.
		GetGroupClusterShardKeyAnalysisOperationWithParams(ctx, params).
		Execute()
}
curl --include --header "Authorization: Bearer ${ACCESS_TOKEN}" \
  --header "Accept: application/vnd.atlas.2025-03-12+json" \
  -X GET "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/shardKeyAnalyses/operations/{operationId}?pretty=true"
curl --user "${PUBLIC_KEY}:${PRIVATE_KEY}" \
  --digest --include \
  --header "Accept: application/vnd.atlas.2025-03-12+json" \
  -X GET "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/shardKeyAnalyses/operations/{operationId}?pretty=true"
Response examples (200)
# Headers

# Payload
{
  "createdAt": "2026-05-04T09:42:00Z",
  "error": {
    "code": "NAMESPACE_NOT_FOUND",
    "message": "string",
    "retryStrategy": "BACKOFF",
    "retryable": true
  },
  "expiresAt": "2026-05-04T09:42:00Z",
  "operationId": "32b6e34b3d91647abb20e7b8",
  "operationType": "CREATE",
  "resultHref": "string",
  "retryAfterSeconds": 42,
  "status": "PENDING",
  "updatedAt": "2026-05-04T09:42:00Z"
}
Response examples (400)
{
  "detail": "(This is just an example, the exception may not be related to this endpoint) No provider AWS exists.",
  "error": 400,
  "errorCode": "VALIDATION_ERROR",
  "reason": "Bad Request"
}
Response examples (401)
{
  "detail": "(This is just an example, the exception may not be related to this endpoint)",
  "error": 401,
  "errorCode": "NOT_ORG_GROUP_CREATOR",
  "reason": "Unauthorized"
}
Response examples (403)
{
  "detail": "(This is just an example, the exception may not be related to this endpoint)",
  "error": 403,
  "errorCode": "CANNOT_CHANGE_GROUP_NAME",
  "reason": "Forbidden"
}
Response examples (404)
{
  "detail": "(This is just an example, the exception may not be related to this endpoint) Cannot find resource AWS",
  "error": 404,
  "errorCode": "RESOURCE_NOT_FOUND",
  "reason": "Not Found"
}
Response examples (429)
{
  "detail": "(This is just an example, the exception may not be related to this endpoint)",
  "error": 429,
  "errorCode": "RATE_LIMITED",
  "reason": "Too Many Requests"
}
Response examples (500)
{
  "detail": "(This is just an example, the exception may not be related to this endpoint)",
  "error": 500,
  "errorCode": "UNEXPECTED_ERROR",
  "reason": "Internal Server Error"
}