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

# Update a product group

> Omitted fields stay unchanged. `products`, when sent, is the complete ordered member list: products it does not contain are removed, and its order is the display order. The request is compared with the stored group first: a request that changes nothing answers `write_result.result` `unchanged` and writes nothing, and an equal ordered member list writes no member. The product group comes back with `write_result`.



## OpenAPI

````yaml patch /v1/product-groups/{id}
openapi: 3.0.0
info:
  title: Creem API
  description: >-
    Creem is an all-in-one platform for managing subscriptions and recurring
    revenue, tailored specifically for today's SaaS companies. It enables you to
    boost revenue, enhance customer retention, and scale your operations
    seamlessly.
  version: v1
  contact:
    name: Creem Support
    url: https://creem.io
    email: support@creem.io
  license:
    name: Commercial
    url: https://creem.io/terms
  termsOfService: https://creem.io/terms
servers:
  - url: https://api.creem.io
    description: Production — live API for processing real transactions and data.
    x-speakeasy-server-id: prod
  - url: https://test-api.creem.io
    description: Test — sandbox API for development and testing with no real charges.
    x-speakeasy-server-id: test
security: []
tags: []
externalDocs:
  description: Creem Documentation
  url: https://docs.creem.io
paths:
  /v1/product-groups/{id}:
    patch:
      tags:
        - Product Groups
      summary: Update a product group
      description: >-
        Omitted fields stay unchanged. `products`, when sent, is the complete
        ordered member list: products it does not contain are removed, and its
        order is the display order. The request is compared with the stored
        group first: a request that changes nothing answers
        `write_result.result` `unchanged` and writes nothing, and an equal
        ordered member list writes no member. The product group comes back with
        `write_result`.
      operationId: updateProductGroup
      parameters:
        - name: id
          required: true
          in: path
          description: The product group ID
          schema:
            type: string
        - name: dry_run
          required: false
          in: query
          description: >-
            Send `true` to preview the write: the request runs as it would and
            is rolled back, so nothing is written. The answer is the one the
            real call would give: the same status (`201` for a create) and
            errors, and the product group with `write_result.dry_run` `true`.
            The id of a product group a dry run would create is never stored: a
            `GET` of it answers `404`. A product `id` or `external_id` that
            names no product of the store is a `reference_not_found` warning
            (`path`, `key`) instead of a `400`: on a create that entry is left
            out of the answer, and on an update the stored members stay as they
            are. `false` or no parameter is a real call; any other value answers
            `400`.
          schema:
            type: boolean
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateProductGroupRequestEntity'
      responses:
        '200':
          description: The updated product group
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProductGroupWriteResponseEntity'
        '400':
          description: Bad Request - Invalid input parameters
        '401':
          description: Unauthorized - Invalid or missing API key
        '404':
          description: Not Found - Resource does not exist
        '409':
          description: >-
            A product is already in another group (`product_already_grouped`) or
            another group of the store holds the key (`external_id_taken`)
        '422':
          description: >-
            A product of the group grants AI generation credits
            (`generation_credits_bundle_unavailable`). Nothing is changed.
        '503':
          description: >-
            Another request is changing this store's product groups
            (`product_groups_busy`); retry after `Retry-After`
      security:
        - ApiKey: []
components:
  schemas:
    UpdateProductGroupRequestEntity:
      type: object
      properties:
        name:
          type: string
          description: The name of the product group, 3 to 255 characters.
        description:
          type: string
          description: A description of the product group. Send `null` to clear it.
          nullable: true
        external_id:
          type: string
          description: >-
            Your own key for this product group. Unique per store,
            case-sensitive; 1 to 255 characters: letters, digits, `_`, `-`, `.`
            and `:`. A key another group of your store uses answers `409` with
            code `external_id_taken`. Omit it to leave the key unchanged; send
            `null` to clear it.
          nullable: true
          example: pro-plans
        products:
          type: array
          description: >-
            The complete ordered list of the group, each product named by
            exactly one of `id` or `external_id`: products it does not contain
            are removed, and its order is the display order. Omit it to leave
            the members unchanged.
          items:
            oneOf:
              - $ref: '#/components/schemas/ProductGroupProductIdReferenceEntity'
              - $ref: >-
                  #/components/schemas/ProductGroupProductExternalIdReferenceEntity
          maxItems: 100
        upgrades_enabled:
          type: boolean
          description: Whether customers can switch between the products of this group.
        upgrade_behavior:
          type: string
          description: >-
            How a switch between the products of this group is billed. Send
            `null` to clear it.
          enum:
            - proration-charge-immediately
            - proration-charge
            - proration-none
          nullable: true
        upsells_enabled:
          type: boolean
          description: Whether the products of this group are offered as checkout upsells.
        is_active:
          type: boolean
          description: >-
            Whether the product group is active. Stored and returned; it does
            not yet stop upgrades or upsells.
    ProductGroupWriteResponseEntity:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the object.
        mode:
          $ref: '#/components/schemas/EnvironmentMode'
        object:
          type: string
          description: >-
            String representing the object's type. Objects of the same type
            share the same value.
          example: product_group
        name:
          type: string
          description: The name of the product group.
        description:
          type: string
          description: A description of the product group.
          nullable: true
        external_id:
          type: string
          description: Your own key for this product group, or `null` when it has none.
          nullable: true
        products:
          description: >-
            The products in the group, in display order. A product is in one
            group at a time.
          type: array
          items:
            $ref: '#/components/schemas/ProductGroupProductEntity'
        upgrades_enabled:
          type: boolean
          description: Whether customers can switch between the products of this group.
        upgrade_behavior:
          type: string
          description: >-
            How a switch between the products is billed, or `null` for the
            default.
          enum:
            - proration-charge-immediately
            - proration-charge
            - proration-none
          nullable: true
        upsells_enabled:
          type: boolean
          description: Whether the products of this group are offered as checkout upsells.
        is_active:
          type: boolean
          description: >-
            Whether the product group is active. Stored and returned; it does
            not yet stop upgrades or upsells.
        created_at:
          format: date-time
          type: string
          description: Creation date of the product group.
          example: '2023-01-01T00:00:00Z'
        updated_at:
          format: date-time
          type: string
          description: Last updated date of the product group.
          example: '2023-01-01T00:00:00Z'
        write_result:
          description: What this write did and should tell you.
          allOf:
            - $ref: '#/components/schemas/ProductGroupWriteResultEntity'
      required:
        - id
        - mode
        - object
        - name
        - description
        - external_id
        - products
        - upgrades_enabled
        - upgrade_behavior
        - upsells_enabled
        - is_active
        - created_at
        - updated_at
        - write_result
    ProductGroupProductIdReferenceEntity:
      type: object
      properties:
        id:
          type: string
          description: The product ID.
          example: prod_4dGTkmBdnTnU9vV3KZ2Hcz
      required:
        - id
    ProductGroupProductExternalIdReferenceEntity:
      type: object
      properties:
        external_id:
          type: string
          description: The product's `external_id`.
          example: pro-monthly
      required:
        - external_id
    EnvironmentMode:
      type: string
      description: String representing the environment.
      enum:
        - test
        - prod
        - sandbox
    ProductGroupProductEntity:
      type: object
      properties:
        id:
          type: string
          description: The id of the product.
        external_id:
          type: string
          description: Your own key for the product, or `null` when it has none.
          nullable: true
      required:
        - id
        - external_id
    ProductGroupWriteResultEntity:
      type: object
      properties:
        result:
          type: string
          description: >-
            What the write did. Known values: `created`, `updated`, `unchanged`
            (the product group already was what the request asked for; nothing
            was written). More values can be added, so treat a value you do not
            know like `updated`.
          example: updated
        dry_run:
          type: boolean
          description: >-
            `true` when the request was sent with `dry_run=true`: nothing was
            written, and the id of a product group the write would have created
            is never stored. `false` on a real write. Stop unless it is `true`
            when you meant a dry run.
          example: false
        changes:
          description: What changed, field by field. Empty on a create and on `unchanged`.
          type: array
          items:
            $ref: '#/components/schemas/ProductGroupWriteChangeEntity'
        warnings:
          description: >-
            Things to know about this write. The write went through. Empty when
            there is nothing to report.
          type: array
          items:
            $ref: '#/components/schemas/ProductGroupWriteWarningEntity'
      required:
        - result
        - dry_run
        - changes
        - warnings
    ProductGroupWriteChangeEntity:
      type: object
      properties:
        path:
          type: string
          description: >-
            The field that changed, by its request name: `name`, `description`,
            `is_active`, `upgrades_enabled`, `upsells_enabled`,
            `upgrade_behavior`, `external_id` or `products`. A member change is
            one `products` entry whose `from` and `to` are the ordered lists of
            product ids, because the order is part of the value.
          example: products
        from:
          description: >-
            The value before the write: the field as a read returns it; for
            `products`, the ordered product ids.
          nullable: true
          oneOf:
            - type: string
            - type: number
            - type: boolean
            - type: array
              items: {}
            - type: object
              additionalProperties: true
          example:
            - prod_monthly
            - prod_yearly
        to:
          description: >-
            The value after the write: the field as a read returns it; for
            `products`, the ordered product ids.
          nullable: true
          oneOf:
            - type: string
            - type: number
            - type: boolean
            - type: array
              items: {}
            - type: object
              additionalProperties: true
          example:
            - prod_yearly
            - prod_monthly
      required:
        - path
        - from
        - to
    ProductGroupWriteWarningEntity:
      type: object
      properties:
        code:
          type: string
          description: >-
            What the warning is about. Known values: `reference_not_found` (a
            dry run only: the product key or id in `key`, sent in `path`, names
            no product of the store; the real call answers `400`
            `reference_not_found`. On a create the entry is left out of the
            group the dry run returns; on an update the stored members stay as
            they are). More values can be added, so ignore a code you do not
            know.
          example: reference_not_found
        path:
          type: string
          description: >-
            The entry the warning is about, for example
            `products[1].external_id`.
        key:
          type: string
          description: >-
            The key the warning is about. On `reference_not_found`, the id or
            key that names nothing.
      required:
        - code
        - path
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key for authentication. You can find your API key in the Creem
        dashboard under Settings > API Keys.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.