MongoDB Collection Level Metrics API

Returns, adds, and edits pinned namespaces for the specified cluster or process. Also returns collection level latency metric data.

OpenAPI Specification

mongodb-collection-level-metrics-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  description: "The MongoDB Atlas Administration API allows developers to manage all components in MongoDB Atlas.\n\nThe Atlas Administration API supports OAuth2 Service Accounts and HTTP Digest-based API keys. Service accounts are the recommended authentication method and API keys are considered a legacy option.\n\nTo authenticate with a Service Account, first exchange its client ID and secret for an access token using the OAuth 2.0 Client Credentials flow. Atlas provides a token endpoint at `POST https://cloud.mongodb.com/api/oauth/token`, which returns a Bearer token that is reusable and valid for 1 hour (3600 seconds).\n\nFor example, to [return a list of your organizations](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-listorgs) with [cURL](https://en.wikipedia.org/wiki/CURL), first generate an access token and then use that token to call the same Atlas Administration API endpoint shown in the current example:\n\n```\nACCESS_TOKEN=$(curl -fsS --request POST https://cloud.mongodb.com/api/oauth/token \\\n  --header \"Authorization: Basic $(printf '%s' \"${CLIENT_ID}:${CLIENT_SECRET}\" | base64 | tr -d '\\n')\" \\\n  --header \"Content-Type: application/x-www-form-urlencoded\" \\\n  --header \"Accept: application/json\" \\\n  --data \"grant_type=client_credentials\" | jq -r '.access_token')\n\ncurl --header \"Authorization: Bearer ${ACCESS_TOKEN}\" \\\n  --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n  -X GET \"https://cloud.mongodb.com/api/atlas/v2/orgs?pretty=true\"\n```\n\nIf your organization requires an IP access list for the Atlas Administration API, the token can be created from any IP address, but the API call that uses the token must originate from an allowed IP.\n\nTo learn more, see [Get Started with the Atlas Administration API](https://www.mongodb.com/docs/atlas/configure-api-access/). For support, see [MongoDB Support](https://www.mongodb.com/support/get-started).\n\nYou can also explore the various endpoints available through the Atlas Administration API in MongoDB's [Postman workspace](https://www.postman.com/mongodb-devrel/workspace/mongodb-atlas-administration-apis/) (requires a Postman account)."
  license:
    name: CC BY-NC-SA 3.0 US
    url: https://creativecommons.org/licenses/by-nc-sa/3.0/us/
  termsOfService: https://www.mongodb.com/mongodb-management-service-terms-and-conditions
  title: MongoDB Atlas Administration Access Tracking Collection Level Metrics API
  version: '2.0'
  x-xgen-sha: 3d70e065843c008b9871ea7836c98c9de6f202f9
servers:
- url: https://cloud.mongodb.com
security:
- ServiceAccounts: []
- DigestAuth: []
tags:
- description: Returns, adds, and edits pinned namespaces for the specified cluster or process. Also returns collection level latency metric data.
  name: Collection Level Metrics
paths:
  /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/collStats/pinned:
    get:
      description: Returns a list of given cluster's pinned namespaces, a set of namespaces manually selected by users to collect query latency metrics on.
      operationId: listGroupClusterCollStatPinnedNamespaces
      parameters:
      - $ref: '#/components/parameters/groupId'
      - $ref: '#/components/parameters/envelope'
      - description: Human-readable label that identifies the cluster to retrieve pinned namespaces for.
        in: path
        name: clusterName
        required: true
        schema:
          pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$
          type: string
      responses:
        '200':
          content:
            application/vnd.atlas.2023-11-15+json:
              schema:
                $ref: '#/components/schemas/PinnedNamespaces'
              x-xgen-version: '2023-11-15'
          description: OK
          headers:
            RateLimit-Limit:
              $ref: '#/components/headers/HeaderRateLimitLimit'
            RateLimit-Remaining:
              $ref: '#/components/headers/HeaderRateLimitRemaining'
        '400':
          $ref: '#/components/responses/badRequest'
        '401':
          $ref: '#/components/responses/unauthorized'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components/responses/notFound'
        '429':
          $ref: '#/components/responses/tooManyRequests'
        '500':
          $ref: '#/components/responses/internalServerError'
      summary: Return Pinned Namespaces
      tags:
      - Collection Level Metrics
      x-codeSamples:
      - lang: cURL
        label: Atlas CLI
        source: atlas api collectionLevelMetrics listPinnedNamespaces --help
      - lang: go
        label: Go
        source: "import (\n\t\"os\"\n\t\"context\"\n\t\"log\"\n\tsdk \"go.mongodb.org/atlas-sdk/v20250312001/admin\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tclientID := os.Getenv(\"MONGODB_ATLAS_CLIENT_ID\")\n\tclientSecret := os.Getenv(\"MONGODB_ATLAS_CLIENT_SECRET\")\n\n\t// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth\n\tclient, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error: %v\", err)\n\t}\n\n\tparams = &sdk.ListGroupClusterCollStatPinnedNamespacesApiParams{}\n\tsdkResp, httpResp, err := client.CollectionLevelMetricsApi.\n\t\tListGroupClusterCollStatPinnedNamespacesWithParams(ctx, params).\n\t\tExecute()\n}\n"
      - lang: cURL
        label: curl (Service Accounts)
        source: "curl --include --header \"Authorization: Bearer ${ACCESS_TOKEN}\" \\\n  --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n  -X GET \"https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/collStats/pinned?pretty=true\""
      - lang: cURL
        label: curl (Digest)
        source: "curl --user \"${PUBLIC_KEY}:${PRIVATE_KEY}\" \\\n  --digest --include \\\n  --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n  -X GET \"https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/collStats/pinned?pretty=true\""
      x-rolesRequirements:
      - Project Read Only
      x-xgen-docs-url: https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Collection-Level-Metrics/operation/listGroupClusterCollStatPinnedNamespaces
      x-xgen-method-verb-override:
        customMethod: true
        verb: listNamespaces
      x-xgen-operation-id-override: listPinnedNamespaces
    patch:
      description: Add provided list of namespaces to existing pinned namespaces list for collection-level latency metrics collection for the given Group and Cluster.
      operationId: updateGroupClusterCollStatPinnedNamespaces
      parameters:
      - $ref: '#/components/parameters/groupId'
      - $ref: '#/components/parameters/envelope'
      - description: Human-readable label that identifies the cluster to pin namespaces to.
        in: path
        name: clusterName
        required: true
        schema:
          pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$
          type: string
      requestBody:
        content:
          application/vnd.atlas.2023-11-15+json:
            schema:
              $ref: '#/components/schemas/NamespacesRequest'
        description: List of namespace strings (combination of database and collection name) to pin for query latency metric collection.
        required: true
      responses:
        '200':
          content:
            application/vnd.atlas.2023-11-15+json:
              schema:
                $ref: '#/components/schemas/PinnedNamespaces'
              x-xgen-version: '2023-11-15'
          description: OK
          headers:
            RateLimit-Limit:
              $ref: '#/components/headers/HeaderRateLimitLimit'
            RateLimit-Remaining:
              $ref: '#/components/headers/HeaderRateLimitRemaining'
        '201':
          content:
            application/vnd.atlas.2023-11-15+json:
              schema:
                $ref: '#/components/schemas/PinnedNamespaces'
              x-xgen-version: '2023-11-15'
          description: Created
          headers:
            RateLimit-Limit:
              $ref: '#/components/headers/HeaderRateLimitLimit'
            RateLimit-Remaining:
              $ref: '#/components/headers/HeaderRateLimitRemaining'
        '400':
          $ref: '#/components/responses/badRequest'
        '401':
          $ref: '#/components/responses/unauthorized'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components/responses/notFound'
        '429':
          $ref: '#/components/responses/tooManyRequests'
        '500':
          $ref: '#/components/responses/internalServerError'
      summary: Add Pinned Namespaces
      tags:
      - Collection Level Metrics
      x-codeSamples:
      - lang: cURL
        label: Atlas CLI
        source: atlas api collectionLevelMetrics updatePinnedNamespaces --help
      - lang: go
        label: Go
        source: "import (\n\t\"os\"\n\t\"context\"\n\t\"log\"\n\tsdk \"go.mongodb.org/atlas-sdk/v20250312001/admin\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tclientID := os.Getenv(\"MONGODB_ATLAS_CLIENT_ID\")\n\tclientSecret := os.Getenv(\"MONGODB_ATLAS_CLIENT_SECRET\")\n\n\t// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth\n\tclient, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error: %v\", err)\n\t}\n\n\tparams = &sdk.UpdateGroupClusterCollStatPinnedNamespacesApiParams{}\n\tsdkResp, httpResp, err := client.CollectionLevelMetricsApi.\n\t\tUpdateGroupClusterCollStatPinnedNamespacesWithParams(ctx, params).\n\t\tExecute()\n}\n"
      - lang: cURL
        label: curl (Service Accounts)
        source: "curl --include --header \"Authorization: Bearer ${ACCESS_TOKEN}\" \\\n  --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n  --header \"Content-Type: application/json\" \\\n  -X PATCH \"https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/collStats/pinned\" \\\n  -d '{ <Payload> }'"
      - lang: cURL
        label: curl (Digest)
        source: "curl --user \"${PUBLIC_KEY}:${PRIVATE_KEY}\" \\\n  --digest --include \\\n  --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n  --header \"Content-Type: application/json\" \\\n  -X PATCH \"https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/collStats/pinned\" \\\n  -d '{ <Payload> }'"
      x-rolesRequirements:
      - Project Read Only
      x-xgen-docs-url: https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Collection-Level-Metrics/operation/updateGroupClusterCollStatPinnedNamespaces
      x-xgen-method-verb-override:
        customMethod: 'True'
        verb: updateNamespaces
      x-xgen-operation-id-override: updatePinnedNamespaces
    put:
      description: Pin provided list of namespaces for collection-level latency metrics collection for the given Group and Cluster. This initializes a pinned namespaces list or replaces any existing pinned namespaces list for the Group and Cluster.
      operationId: pinGroupClusterCollStatPinnedNamespaces
      parameters:
      - $ref: '#/components/parameters/groupId'
      - $ref: '#/components/parameters/envelope'
      - description: Human-readable label that identifies the cluster to pin namespaces to.
        in: path
        name: clusterName
        required: true
        schema:
          pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$
          type: string
      requestBody:
        content:
          application/vnd.atlas.2023-11-15+json:
            schema:
              $ref: '#/components/schemas/NamespacesRequest'
        description: List of namespace strings (combination of database and collection name) to pin for query latency metric collection.
        required: true
      responses:
        '200':
          content:
            application/vnd.atlas.2023-11-15+json:
              schema:
                $ref: '#/components/schemas/PinnedNamespaces'
              x-xgen-version: '2023-11-15'
          description: OK
          headers:
            RateLimit-Limit:
              $ref: '#/components/headers/HeaderRateLimitLimit'
            RateLimit-Remaining:
              $ref: '#/components/headers/HeaderRateLimitRemaining'
        '201':
          content:
            application/vnd.atlas.2023-11-15+json:
              schema:
                $ref: '#/components/schemas/PinnedNamespaces'
              x-xgen-version: '2023-11-15'
          description: Created
          headers:
            RateLimit-Limit:
              $ref: '#/components/headers/HeaderRateLimitLimit'
            RateLimit-Remaining:
              $ref: '#/components/headers/HeaderRateLimitRemaining'
        '400':
          $ref: '#/components/responses/badRequest'
        '401':
          $ref: '#/components/responses/unauthorized'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components/responses/notFound'
        '429':
          $ref: '#/components/responses/tooManyRequests'
        '500':
          $ref: '#/components/responses/internalServerError'
      summary: Pin Namespaces
      tags:
      - Collection Level Metrics
      x-codeSamples:
      - lang: cURL
        label: Atlas CLI
        source: atlas api collectionLevelMetrics pinNamespaces --help
      - lang: go
        label: Go
        source: "import (\n\t\"os\"\n\t\"context\"\n\t\"log\"\n\tsdk \"go.mongodb.org/atlas-sdk/v20250312001/admin\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tclientID := os.Getenv(\"MONGODB_ATLAS_CLIENT_ID\")\n\tclientSecret := os.Getenv(\"MONGODB_ATLAS_CLIENT_SECRET\")\n\n\t// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth\n\tclient, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error: %v\", err)\n\t}\n\n\tparams = &sdk.PinGroupClusterCollStatPinnedNamespacesApiParams{}\n\tsdkResp, httpResp, err := client.CollectionLevelMetricsApi.\n\t\tPinGroupClusterCollStatPinnedNamespacesWithParams(ctx, params).\n\t\tExecute()\n}\n"
      - lang: cURL
        label: curl (Service Accounts)
        source: "curl --include --header \"Authorization: Bearer ${ACCESS_TOKEN}\" \\\n  --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n  --header \"Content-Type: application/json\" \\\n  -X PUT \"https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/collStats/pinned\" \\\n  -d '{ <Payload> }'"
      - lang: cURL
        label: curl (Digest)
        source: "curl --user \"${PUBLIC_KEY}:${PRIVATE_KEY}\" \\\n  --digest --include \\\n  --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n  --header \"Content-Type: application/json\" \\\n  -X PUT \"https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/collStats/pinned\" \\\n  -d '{ <Payload> }'"
      x-rolesRequirements:
      - Project Read Only
      x-xgen-docs-url: https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Collection-Level-Metrics/operation/pinGroupClusterCollStatPinnedNamespaces
      x-xgen-method-verb-override:
        customMethod: 'True'
        verb: pinNamespaces
      x-xgen-operation-id-override: pinNamespaces
  /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/collStats/unpin:
    patch:
      description: Unpin provided list of namespaces for collection-level latency metrics collection for the given Group and Cluster.
      operationId: unpinGroupClusterCollStatUnpinNamespaces
      parameters:
      - $ref: '#/components/parameters/groupId'
      - $ref: '#/components/parameters/envelope'
      - description: Human-readable label that identifies the cluster to unpin namespaces from.
        in: path
        name: clusterName
        required: true
        schema:
          pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$
          type: string
      requestBody:
        content:
          application/vnd.atlas.2023-11-15+json:
            schema:
              $ref: '#/components/schemas/NamespacesRequest'
        description: List of namespace strings (combination of database and collection name) to pin for query latency metric collection.
        required: true
      responses:
        '200':
          content:
            application/vnd.atlas.2023-11-15+json:
              schema:
                $ref: '#/components/schemas/PinnedNamespaces'
              x-xgen-version: '2023-11-15'
          description: OK
          headers:
            RateLimit-Limit:
              $ref: '#/components/headers/HeaderRateLimitLimit'
            RateLimit-Remaining:
              $ref: '#/components/headers/HeaderRateLimitRemaining'
        '400':
          $ref: '#/components/responses/badRequest'
        '401':
          $ref: '#/components/responses/unauthorized'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components/responses/notFound'
        '429':
          $ref: '#/components/responses/tooManyRequests'
        '500':
          $ref: '#/components/responses/internalServerError'
      summary: Unpin Namespaces
      tags:
      - Collection Level Metrics
      x-codeSamples:
      - lang: cURL
        label: Atlas CLI
        source: atlas api collectionLevelMetrics unpinNamespaces --help
      - lang: go
        label: Go
        source: "import (\n\t\"os\"\n\t\"context\"\n\t\"log\"\n\tsdk \"go.mongodb.org/atlas-sdk/v20250312001/admin\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tclientID := os.Getenv(\"MONGODB_ATLAS_CLIENT_ID\")\n\tclientSecret := os.Getenv(\"MONGODB_ATLAS_CLIENT_SECRET\")\n\n\t// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth\n\tclient, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error: %v\", err)\n\t}\n\n\tparams = &sdk.UnpinGroupClusterCollStatUnpinNamespacesApiParams{}\n\tsdkResp, httpResp, err := client.CollectionLevelMetricsApi.\n\t\tUnpinGroupClusterCollStatUnpinNamespacesWithParams(ctx, params).\n\t\tExecute()\n}\n"
      - lang: cURL
        label: curl (Service Accounts)
        source: "curl --include --header \"Authorization: Bearer ${ACCESS_TOKEN}\" \\\n  --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n  --header \"Content-Type: application/json\" \\\n  -X PATCH \"https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/collStats/unpin\" \\\n  -d '{ <Payload> }'"
      - lang: cURL
        label: curl (Digest)
        source: "curl --user \"${PUBLIC_KEY}:${PRIVATE_KEY}\" \\\n  --digest --include \\\n  --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n  --header \"Content-Type: application/json\" \\\n  -X PATCH \"https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/collStats/unpin\" \\\n  -d '{ <Payload> }'"
      x-rolesRequirements:
      - Project Read Only
      x-xgen-docs-url: https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Collection-Level-Metrics/operation/unpinGroupClusterCollStatUnpinNamespaces
      x-xgen-method-verb-override:
        customMethod: 'True'
        verb: unpinNamespaces
      x-xgen-operation-id-override: unpinNamespaces
  /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/{clusterView}/collStats/namespaces:
    get:
      description: Return the subset of namespaces from the given cluster sorted by highest total execution time (descending) within the given time window.
      operationId: getGroupClusterCollStatNamespaces
      parameters:
      - $ref: '#/components/parameters/groupId'
      - description: Human-readable label that identifies the cluster to pin namespaces to.
        in: path
        name: clusterName
        required: true
        schema:
          pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$
          type: string
      - description: Human-readable label that identifies the cluster topology to retrieve metrics for.
        in: path
        name: clusterView
        required: true
        schema:
          enum:
          - PRIMARY
          - SECONDARY
          - INDIVIDUAL_PROCESS
          type: string
      - $ref: '#/components/parameters/envelope'
      - $ref: '#/components/parameters/start'
      - $ref: '#/components/parameters/end'
      - $ref: '#/components/parameters/period'
      responses:
        '200':
          content:
            application/vnd.atlas.2023-11-15+json:
              schema:
                $ref: '#/components/schemas/CollStatsRankedNamespacesView'
              x-xgen-version: '2023-11-15'
          description: Succeeded
          headers:
            RateLimit-Limit:
              $ref: '#/components/headers/HeaderRateLimitLimit'
            RateLimit-Remaining:
              $ref: '#/components/headers/HeaderRateLimitRemaining'
        '401':
          $ref: '#/components/responses/unauthorized'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components/responses/notFound'
        '429':
          $ref: '#/components/responses/tooManyRequests'
        '500':
          $ref: '#/components/responses/internalServerError'
      summary: Return Ranked Namespaces from One Cluster
      tags:
      - Collection Level Metrics
      x-codeSamples:
      - lang: cURL
        label: Atlas CLI
        source: atlas api collectionLevelMetrics getClusterNamespaces --help
      - lang: go
        label: Go
        source: "import (\n\t\"os\"\n\t\"context\"\n\t\"log\"\n\tsdk \"go.mongodb.org/atlas-sdk/v20250312001/admin\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tclientID := os.Getenv(\"MONGODB_ATLAS_CLIENT_ID\")\n\tclientSecret := os.Getenv(\"MONGODB_ATLAS_CLIENT_SECRET\")\n\n\t// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth\n\tclient, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error: %v\", err)\n\t}\n\n\tparams = &sdk.GetGroupClusterCollStatNamespacesApiParams{}\n\tsdkResp, httpResp, err := client.CollectionLevelMetricsApi.\n\t\tGetGroupClusterCollStatNamespacesWithParams(ctx, params).\n\t\tExecute()\n}\n"
      - lang: cURL
        label: curl (Service Accounts)
        source: "curl --include --header \"Authorization: Bearer ${ACCESS_TOKEN}\" \\\n  --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n  -X GET \"https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/{clusterView}/collStats/namespaces?pretty=true\""
      - lang: cURL
        label: curl (Digest)
        source: "curl --user \"${PUBLIC_KEY}:${PRIVATE_KEY}\" \\\n  --digest --include \\\n  --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n  -X GET \"https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/{clusterView}/collStats/namespaces?pretty=true\""
      x-rolesRequirements:
      - Project Read Only
      x-xgen-docs-url: https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Collection-Level-Metrics/operation/getGroupClusterCollStatNamespaces
      x-xgen-method-verb-override:
        customMethod: false
        verb: get
      x-xgen-operation-id-override: getClusterNamespaces
  /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/{clusterView}/{databaseName}/{collectionName}/collStats/measurements:
    get:
      description: Get a list of the Coll Stats Latency cluster-level measurements for the given namespace.
      operationId: listGroupClusterCollStatMeasurements
      parameters:
      - $ref: '#/components/parameters/groupId'
      - description: Human-readable label that identifies the cluster to retrieve metrics for.
        in: path
        name: clusterName
        required: true
        schema:
          pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$
          type: string
      - description: Human-readable label that identifies the cluster topology to retrieve metrics for.
        in: path
        name: clusterView
        required: true
        schema:
          enum:
          - PRIMARY
          - SECONDARY
          - INDIVIDUAL_PROCESS
          type: string
      - $ref: '#/components/parameters/databaseName'
      - $ref: '#/components/parameters/collectionName'
      - $ref: '#/components/parameters/envelope'
      - description: List that contains the metrics that you want to retrieve for the associated data series. If you don't set this parameter, this resource returns data series for all Coll Stats Latency metrics.
        explode: true
        in: query
        name: metrics
        schema:
          items:
            description: Metric requested for the given cluster
            enum:
            - READS_OPS
            - READS_LATENCY
            - AVERAGE_READS_LATENCY
            - READS_P50_VALUE
            - READS_P95_VALUE
            - READS_P99_VALUE
            - WRITES_OPS
            - WRITES_LATENCY
            - AVERAGE_WRITES_LATENCY
            - WRITES_P50_VALUE
            - WRITES_P95_VALUE
            - WRITES_P99_VALUE
            - COMMANDS_OPS
            - COMMANDS_LATENCY
            - AVERAGE_COMMANDS_LATENCY
            - COMMANDS_P50_VALUE
            - COMMANDS_P95_VALUE
            - COMMANDS_P99_VALUE
            - TOTAL_OPS
            - TOTAL_LATENCY
            - AVERAGE_TOTAL_OPS_LATENCY
            - TOTAL_OPS_P50_VALUE
            - TOTAL_OPS_P95_VALUE
            - TOTAL_OPS_P99_VALUE
            type: string
          type: array
          uniqueItems: true
        style: form
      - $ref: '#/components/parameters/start'
      - $ref: '#/components/parameters/end'
      - $ref: '#/components/parameters/period'
      responses:
        '200':
          content:
            application/vnd.atlas.2023-11-15+json:
              schema:
                $ref: '#/components/schemas/MeasurementsCollStatsLatencyCluster'
              x-xgen-version: '2023-11-15'
          description: Succeeded
          headers:
            RateLimit-Limit:
              $ref: '#/components/headers/HeaderRateLimitLimit'
            RateLimit-Remaining:
              $ref: '#/components/headers/HeaderRateLimitRemaining'
        '400':
          $ref: '#/components/responses/badRequest'
        '401':
          $ref: '#/components/responses/unauthorized'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components/responses/notFound'
        '429':
          $ref: '#/components/responses/tooManyRequests'
        '500':
          $ref: '#/components/responses/internalServerError'
      summary: Return Cluster-Level Query Latency
      tags:
      - Collection Level Metrics
      x-codeSamples:
      - lang: cURL
        label: Atlas CLI
        source: atlas api collectionLevelMetrics listCollStatMeasurements --help
      - lang: go
        label: Go
        source: "import (\n\t\"os\"\n\t\"context\"\n\t\"log\"\n\tsdk \"go.mongodb.org/atlas-sdk/v20250312001/admin\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tclientID := os.Getenv(\"MONGODB_ATLAS_CLIENT_ID\")\n\tclientSecret := os.Getenv(\"MONGODB_ATLAS_CLIENT_SECRET\")\n\n\t// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth\n\tclient, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error: %v\", err)\n\t}\n\n\tparams = &sdk.ListGroupClusterCollStatMeasurementsApiParams{}\n\tsdkResp, httpResp, err := client.CollectionLevelMetricsApi.\n\t\tListGroupClusterCollStatMeasurementsWithParams(ctx, params).\n\t\tExecute()\n}\n"
      - lang: cURL
        label: curl (Service Accounts)
        source: "curl --include --header \"Authorization: Bearer ${ACCESS_TOKEN}\" \\\n  --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n  -X GET \"https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/{clusterView}/{databaseName}/{collectionName}/collStats/measurements?pretty=true\""
      - lang: cURL
        label: curl (Digest)
        source: "curl --user \"${PUBLIC_KEY}:${PRIVATE_KEY}\" \\\n  --digest --include \\\n  --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n  -X GET \"https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/{clusterView}/{databaseName}/{collectionName}/collStats/measurements?pretty=true\""
      x-rolesRequirements:
      - Project Read Only
      x-xgen-docs-url: https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Collection-Level-Metrics/operation/listGroupClusterCollStatMeasurements
      x-xgen-operation-id-override: listCollStatMeasurements
  /api/atlas/v2/groups/{groupId}/collStats/metrics:
    get:
      description: Returns all available Coll Stats Latency metric names and their respective units for the specified project at the time of request.
      operationId: listGroupCollStatMetrics
      parameters:
      - $ref: '#/components/parameters/groupId'
      - $ref: '#/components/parameters/envelope'
      responses:
        '200':
          content:
            application/vnd.atlas.2023-11-15+json:
              x-xgen-version: '2023-11-15'
          description: Succeeded
          headers:
            RateLimit-Limit:
              $ref: '#/components/headers/HeaderRateLimitLimit'
            RateLimit-Remaining:
              $ref: '#/components/headers/HeaderRateLimitRemaining'
        '400':
          $ref: '#/components/responses/badRequest'
        '401':
          $ref: '#/components/responses/unauthorized'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components/responses/notFound'
        '429':
          $ref: '#/components/responses/tooManyRequests'
        '500':
          $ref: '#/components/responses/internalServerError'
      summary: Return All Metric Names
      tags:
      - Collection Level Metrics
      x-codeSamples:
      - lang: cURL
        label: Atlas CLI
        source: atlas api collectionLevelMetrics listCollStatMetrics --help
      - lang: go
        label: Go
        source: "import (\n\t\"os\"\n\t\"context\"\n\t\"log\"\n\tsdk \"go.mongodb.org/atlas-sdk/v20250312001/admin\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\tclientID := os.Getenv(\"MONGODB_ATLAS_CLIENT_ID\")\n\tclientSecret := os.Getenv(\"MONGODB_ATLAS_CLIENT_SECRET\")\n\n\t// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth\n\tclient, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error: %v\", err)\n\t}\n\n\tparams = &sdk.ListGroupCollStatMetricsApiParams{}\n\tsdkResp, httpResp, err := client.CollectionLevelMetricsApi.\n\t\tListGroupCollStatMetricsWithParams(ctx, params).\n\t\tExecute()\n}\n"
      - lang: cURL
        label: curl (Service Accounts)
        source: "curl --include --header \"Authorization: Bearer ${ACCESS_TOKEN}\" \\\n  --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n  -X GET \"https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/collStats/metrics?pretty=true\""
      - lang: cURL
        label: curl (Digest)
        source: "curl --user \"${PUBLIC_KEY}:${PRIVATE_KEY}\" \\\n  --digest --include \\\n  --header \"Accept: application/vnd.atlas.2025-03-12+json\" \\\n  -X GET \"https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/collStats/metrics?pretty=true\""
      x-rolesRequirements:
      - Project Read Only
      x-xgen-docs-url: https://mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Collection-Level-Metrics/operation/listGroupCollStatMetrics
      x-xgen-operation-id-override: listCollStatMetrics
  /api/atlas/v2/groups/{groupId}/processes/{processId}/collStats/namespaces:
    get:
      description: Return the subset of namespaces from the given process ranked by highest total execution time (descending) within the given time window.
      operationId: getGroupProcessCollStatNamespaces
      parameters:
      - $ref: '#/components/parameters/groupId'
      - $ref: '#/components/parameters/processId'
      - $ref: '#/components/parameters/envelope'
      - $ref: '#/components/parameters/start'
      - $ref: '#/components/parameters/end'
      - $ref: '#/components/parameters/period'
      responses:
        '200':
          content:
            application/vnd.atlas.2023-11-15+json:
              schema:
                $ref: '#/components/schemas/CollStatsRankedNamespacesView'
              x-xgen-version: '2023-11-15'
          description: Succeeded
          headers:
            RateLimit-Limit:
              $ref: '#/components/headers/HeaderRateLimitLimit'
            RateLimit-Remaining:
              $ref: '#/components/headers/HeaderRateLimitRemaining'
        '401':
          $ref: '#/components/responses/unauthorized'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components

# --- truncated at 32 KB (58 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/mongodb/refs/heads/main/openapi/mongodb-collection-level-metrics-api-openapi.yml