> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scorecard.io/llms.txt
> Use this file to discover all available pages before exploring further.

# List Metric Groups

> List Metric Groups configured for the specified Project. Metric Groups are returned in reverse chronological order.



## OpenAPI

````yaml get /projects/{projectId}/metric-groups
openapi: 3.1.0
info:
  title: Scorecard API
  description: REST API for Scorecard
  version: 1.0.0
servers:
  - url: https://api2.scorecard.io/api/v2
security:
  - ApiKeyAuth: []
paths:
  /projects/{projectId}/metric-groups:
    get:
      summary: List Metric Groups
      description: >-
        List Metric Groups configured for the specified Project. Metric Groups
        are returned in reverse chronological order.
      operationId: listMetricGroups
      parameters:
        - in: path
          name: projectId
          description: The ID of the Project to list Metric Groups for.
          schema:
            type: string
            example: '314'
          required: true
        - in: query
          name: limit
          description: >-
            Maximum number of items to return (1-100). Use with `cursor` for
            pagination through large sets.
          schema:
            type: integer
            exclusiveMinimum: 0
            default: 20
            example: 20
        - in: query
          name: cursor
          description: >-
            Cursor for pagination. Pass the `nextCursor` from the previous
            response to get the next page of results.
          schema:
            type: string
            example: '123'
      responses:
        '200':
          description: Successfully retrieved Metric Groups.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/MetricGroup'
                  nextCursor:
                    type:
                      - string
                      - 'null'
                  hasMore:
                    type: boolean
                  total:
                    type: integer
                    minimum: 0
                required:
                  - data
                  - nextCursor
                  - hasMore
              examples:
                List Metric Groups:
                  summary: List Metric Groups
                  description: Example response showing metric groups for a project.
                  value:
                    data:
                      - id: '612'
                        projectId: '314'
                        name: Accuracy Metrics
                        description: Metrics that evaluate factual accuracy
                        metricIds:
                          - '321'
                          - '322'
                        createdAt: '2025-01-15T09:30:00.000Z'
                        updatedAt: '2025-01-15T09:30:00.000Z'
                    nextCursor: null
                    hasMore: false
        '401':
          $ref: '#/components/responses/UnauthenticatedError'
        '500':
          $ref: '#/components/responses/ServiceError'
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Scorecard from 'scorecard-ai';

            const client = new Scorecard({
              apiKey: process.env['SCORECARD_API_KEY'], // This is the default and can be omitted
            });

            // Automatically fetches more pages as needed.
            for await (const metricGroup of client.metricGroups.list('314')) {
              console.log(metricGroup.id);
            }
        - lang: Python
          source: |-
            import os
            from scorecard_ai import Scorecard

            client = Scorecard(
                api_key=os.environ.get("SCORECARD_API_KEY"),  # This is the default and can be omitted
            )
            page = client.metric_groups.list(
                project_id="314",
            )
            page = page.data[0]
            print(page.id)
        - lang: cURL
          source: >-
            curl
            https://api2.scorecard.io/api/v2/projects/$PROJECT_ID/metric-groups
            \
                -H "Authorization: Bearer $SCORECARD_API_KEY"
components:
  schemas:
    MetricGroup:
      type: object
      properties:
        id:
          type: string
          description: The ID of the Metric Group.
        projectId:
          type: string
          description: The ID of the Project the Metric Group belongs to.
        name:
          type: string
          description: The name of the Metric Group.
        description:
          type: string
          description: The description of the Metric Group.
        metricIds:
          type: array
          items:
            type: string
          description: The IDs of the Metrics in the group.
        createdAt:
          type: string
          description: The ISO 8601 timestamp when the Metric Group was created.
        updatedAt:
          type: string
          description: The ISO 8601 timestamp when the Metric Group was last updated.
      required:
        - id
        - projectId
        - name
        - description
        - metricIds
        - createdAt
        - updatedAt
      description: >-
        A Metric Group is a named collection of Metrics within a Project, used
        to score or compare records with a consistent set of Metrics.
    ApiError:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        details:
          type: object
          additionalProperties: true
          x-stainless-any: true
      required:
        - code
        - message
        - details
      description: An API error.
  responses:
    UnauthenticatedError:
      description: Error indicating that the request is not authenticated.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          examples:
            Authentication failure:
              value:
                code: UNAUTHORIZED
                message: Invalid or missing authentication token
                details: {}
              summary: Authentication failure
              description: >-
                Error returned when authentication credentials are invalid or
                missing.
    ServiceError:
      description: >-
        An internal service error indicating an issue with the Scorecard
        service.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          examples:
            Internal error:
              value:
                code: INTERNAL_ERROR
                message: An unexpected error occurred while processing your request.
                details: {}
              summary: Internal error
              description: Generic error when an unexpected internal issue occurs.
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: starts with ak_

````