> ## 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.

# Update Metric Group

> Update a Metric Group's name, description, or member Metrics. The `metricIds` array replaces the group's current set of Metrics.



## OpenAPI

````yaml patch /metric-groups/{metricGroupId}
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:
  /metric-groups/{metricGroupId}:
    patch:
      summary: Update Metric Group
      description: >-
        Update a Metric Group's name, description, or member Metrics. The
        `metricIds` array replaces the group's current set of Metrics.
      operationId: updateMetricGroup
      parameters:
        - in: path
          name: metricGroupId
          description: The ID of the Metric Group to update.
          schema:
            type: string
            example: '612'
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  description: The new name of the Metric Group.
                description:
                  type: string
                  description: The new description of the Metric Group.
                metricIds:
                  type: array
                  items:
                    type: string
                    description: The ID of the Metric.
                    example: '321'
                  description: >-
                    The new set of Metric IDs for the group, replacing the
                    current set. Every Metric must belong to the same Project as
                    the group.
            examples:
              Update Metric Group:
                value:
                  name: Quality Metrics
                  metricIds:
                    - '321'
                summary: Update Metric Group
                description: Rename a metric group and replace its member metrics.
      responses:
        '200':
          description: Metric Group updated successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MetricGroup'
              examples:
                Updated Metric Group:
                  value:
                    id: '612'
                    projectId: '314'
                    name: Quality Metrics
                    description: Metrics that evaluate factual accuracy
                    metricIds:
                      - '321'
                    createdAt: '2025-01-15T09:30:00.000Z'
                    updatedAt: '2025-01-15T09:30:00.000Z'
                  summary: Updated Metric Group
                  description: Response after successfully updating a metric group.
        '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
            });

            const metricGroup = await client.metricGroups.update('612', {
              metricIds: ['321'],
              name: 'Quality Metrics',
            });

            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
            )
            metric_group = client.metric_groups.update(
                metric_group_id="612",
                metric_ids=["321"],
                name="Quality Metrics",
            )
            print(metric_group.id)
        - lang: cURL
          source: >-
            curl https://api2.scorecard.io/api/v2/metric-groups/$METRIC_GROUP_ID
            \
                -X PATCH \
                -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_

````