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

> Rename a meter and/or revise its definition. A rename is always allowed — the name is a label no aggregate depends on — but it must stay unique within the store (409 meter_name_taken). Definition changes (filter, aggregation, aggregation_property) are only accepted while the meter has processed no usage and has no associated purchase; otherwise the request is rejected with 409, because editing the definition would silently rewrite what already-recorded usage means. Send aggregation_property as null to clear it; omit it to leave it unchanged.



## OpenAPI

````yaml patch /v1/meters/{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/meters/{id}:
    patch:
      tags:
        - Meters
      summary: Update a meter
      description: >-
        Rename a meter and/or revise its definition. A rename is always allowed
        — the name is a label no aggregate depends on — but it must stay unique
        within the store (409 meter_name_taken). Definition changes (filter,
        aggregation, aggregation_property) are only accepted while the meter has
        processed no usage and has no associated purchase; otherwise the request
        is rejected with 409, because editing the definition would silently
        rewrite what already-recorded usage means. Send aggregation_property as
        null to clear it; omit it to leave it unchanged.
      operationId: updateMeter
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateMeterApiRequestDto'
      responses:
        '200':
          description: Meter updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MeterApiResponseDto'
        '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: The name is already taken, or the definition can no longer be edited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageMeteringErrorApiResponseDto'
        '422':
          description: The revised definition is not satisfiable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageMeteringErrorApiResponseDto'
      security:
        - ApiKey: []
components:
  schemas:
    UpdateMeterApiRequestDto:
      type: object
      properties:
        name:
          type: string
          description: >-
            New meter name. Renaming is allowed even after the meter has
            processed usage — the name is a label, not part of the definition.
            Must stay unique within the store. Omit to leave unchanged; `null`
            is rejected.
          example: Image generations (v2)
        aggregation:
          type: string
          description: >-
            New aggregation. Part of the meter definition, so it is only
            editable while the meter has processed no usage and has no
            associated purchase. Omit to leave unchanged; `null` is rejected.
          enum:
            - count
            - sum
            - average
            - min
            - max
            - unique
          example: sum
        aggregation_property:
          type: string
          description: >-
            New aggregation property. Omit to leave unchanged; send `null` to
            clear it (only valid when the resulting aggregation is "count").
          example: tokens
          nullable: true
        filter:
          description: >-
            New filter. Part of the meter definition (see `aggregation`). Omit
            to leave unchanged; `null` is rejected — to remove a filter, send
            one with an empty `clauses` array.
          allOf:
            - $ref: '#/components/schemas/MeterFilterApiRequestDto'
    MeterApiResponseDto:
      type: object
      properties:
        id:
          type: string
          description: Meter ID
          example: mtr_abc123
        store_id:
          type: string
          description: Store ID
          example: sto_abc123
        name:
          type: string
          description: Meter name
          example: Image generations
        event_name:
          type: string
          description: Usage event name the meter consumes
          example: image.generated
        aggregation:
          type: string
          description: Aggregation applied to matching events
          enum:
            - count
            - sum
            - average
            - min
            - max
            - unique
          example: sum
        aggregation_property:
          type: string
          description: Property the aggregation reduces; null for "count"
          nullable: true
          example: tokens
        filter:
          description: The meter filter; always present (empty clauses = match all)
          allOf:
            - $ref: '#/components/schemas/MeterFilterApiResponseDto'
        unit_label:
          type: string
          description: Display unit
          example: images
        status:
          type: string
          description: Whether the meter is active or archived
          enum:
            - active
            - archived
          example: active
        created_at:
          type: string
          description: Creation timestamp (ISO 8601)
        updated_at:
          type: string
          description: Last update timestamp (ISO 8601)
      required:
        - id
        - store_id
        - name
        - event_name
        - aggregation
        - aggregation_property
        - filter
        - unit_label
        - status
        - created_at
        - updated_at
    UsageMeteringErrorApiResponseDto:
      type: object
      properties:
        error:
          description: Error details
          allOf:
            - $ref: '#/components/schemas/UsageMeteringErrorDetailApiDto'
      required:
        - error
    MeterFilterApiRequestDto:
      type: object
      properties:
        conjunction:
          type: string
          description: How the clauses combine
          enum:
            - and
            - or
          example: and
        clauses:
          description: >-
            Filter clauses. An empty list means the meter counts every event
            with the given event name.
          type: array
          items:
            $ref: '#/components/schemas/FilterClauseApiRequestDto'
      required:
        - conjunction
        - clauses
    MeterFilterApiResponseDto:
      type: object
      properties:
        conjunction:
          type: string
          description: How the clauses combine
          enum:
            - and
            - or
          example: and
        clauses:
          description: Filter clauses; empty means the meter counts every event
          type: array
          items:
            $ref: '#/components/schemas/FilterClauseApiResponseDto'
      required:
        - conjunction
        - clauses
    UsageMeteringErrorDetailApiDto:
      type: object
      properties:
        type:
          type: string
          description: Error category
          enum:
            - invalid_request_error
            - api_error
            - authentication_error
            - rate_limit_error
          example: invalid_request_error
        code:
          type: string
          description: Machine-readable error code
          example: meter_name_taken
          nullable: true
        message:
          type: string
          description: Human-readable error message
          example: A meter named "Image generations" already exists in this store
        param:
          type: string
          description: The parameter related to the error, if applicable
          example: events[3].customer_id
          nullable: true
        details:
          type: object
          description: >-
            Structured, machine-readable context for errors that support an
            action, omitted entirely when there is none. Currently emitted for
            `meter_name_taken` when the colliding name is held by an ARCHIVED
            meter: `archived_holder` is true and `archived_holder_id` is that
            meter, which can be restored via POST /v1/meters/{id}/unarchive.
            Additive — treat unknown keys as ignorable.
          example:
            archived_holder: true
            archived_holder_id: mtr_abc123
        request_id:
          type: string
          description: Unique request identifier for support
          example: req_abc123def456
      required:
        - type
        - code
        - message
        - request_id
    FilterClauseApiRequestDto:
      type: object
      properties:
        property:
          type: string
          description: >-
            Event property to test. Resolved as a top-level property first, then
            as a metadata key — never prefixed with "metadata.".
          example: tier
        operator:
          type: string
          description: Comparison operator
          enum:
            - equals
            - not_equals
            - gt
            - gte
            - lt
            - lte
            - contains
            - not_contains
          example: equals
        value:
          description: >-
            Value to compare against. Auto-parsed (number → boolean → string) on
            both sides before comparison, so "10" and 10 behave the same — which
            is why a raw number or boolean is accepted here as well as a string.
          example: pro
          oneOf:
            - type: string
            - type: number
            - type: boolean
      required:
        - property
        - operator
        - value
    FilterClauseApiResponseDto:
      type: object
      properties:
        property:
          type: string
          description: Event property tested
          example: tier
        operator:
          type: string
          description: Comparison operator
          example: equals
        value:
          description: Value compared against, as stored after parsing
          example: pro
          oneOf:
            - type: string
            - type: number
            - type: boolean
      required:
        - property
        - operator
        - value
  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.

````