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

# Update a credit unit

> Partial update: an absent field is left unchanged. `code` and `precision` are immutable and
cannot be changed here. Setting `archived: true` blocks the unit from new prices, packs and
grants; existing ones keep working.



## OpenAPI

````yaml https://api.meteroid.com/api-docs/openapi.json patch /api/v1/credit-units/{id}
openapi: 3.1.0
info:
  title: meteroid
  description: ''
  license:
    name: LicenseRef-Proprietary
    identifier: LicenseRef-Proprietary
  version: 0.1.0
servers: []
security: []
tags:
  - name: Meteroid
    description: Meteroid API
  - name: Add-ons
  - name: Batch Jobs
  - name: Budgets
    description: >-
      Beta: may change before general availability. Spending limits on a
      customer's usage, or one subscription's, per currency, with alerts at
      percentages of the amount.
    x-beta: true
  - name: Checkout Sessions
  - name: Checks
    description: >-
      Beta: may change before general availability. Whether a customer may
      consume more of a feature right now.
    x-beta: true
  - name: Connect
    description: Manage connected accounts (Express & Standard)
  - name: Coupons
  - name: Credit Notes
  - name: Credit units
    description: >-
      Custom denominations, such as "credits", that usage can be priced in and
      credit granted or sold in, instead of money.
  - name: Credits
    description: >-
      Prepaid credit: a customer's wallets, credit grants, ledger and top-ups.
      Promotional credit applies before tax like a discount; paid credit applies
      after tax like a payment.
  - name: Custom Properties
  - name: Customers
  - name: Entitlements
  - name: Events
  - name: Features
  - name: Invoices
  - name: Licenses
    description: >-
      Licenses for your customers' self-hosted installations: signed tokens
      carrying their plan's entitlements, activated and refreshed by the
      installation over the public licensing endpoints.
  - name: Metrics
  - name: OAuth
    description: OAuth 2.0 token endpoints (public, client-credentials auth)
  - name: OAuth Apps
    description: Manage OAuth applications for Connect integrations
  - name: Plans
  - name: Product Families
  - name: Products
  - name: Subscriptions
  - name: Usage
  - name: Usage costs
    description: >-
      Beta: may change before general availability. A customer's or a
      subscription's usage events and usage over time, with what they cost.
    x-beta: true
  - name: Webhook Endpoints
    description: Manage outbound webhook endpoints and inspect their deliveries
paths:
  /api/v1/credit-units/{id}:
    patch:
      tags:
        - Credit units
      summary: Update a credit unit
      description: >-
        Partial update: an absent field is left unchanged. `code` and
        `precision` are immutable and

        cannot be changed here. Setting `archived: true` blocks the unit from
        new prices, packs and

        grants; existing ones keep working.
      operationId: update_credit_unit
      parameters:
        - name: id
          in: path
          description: Credit unit ID
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreditUnitUpdateRequest'
        required: true
      responses:
        '200':
          description: Updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreditUnit'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '409':
          description: The product is archived
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '429':
          description: Too many requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
        '500':
          description: Internal error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RestErrorResponse'
      security:
        - bearer_auth: []
components:
  schemas:
    CreditUnitUpdateRequest:
      type: object
      description: >-
        Partial update: an absent field is left unchanged. `code` and
        `precision` have no field here,

        they are immutable. `symbol` set to `null` clears it.
      properties:
        archived:
          type:
            - boolean
            - 'null'
          description: >-
            Blocks the unit from new prices, packs and grants; existing ones
            keep working.
        name:
          type:
            - string
            - 'null'
          description: Singular display name, 1 to 64 characters.
        plural_name:
          type:
            - string
            - 'null'
          description: Plural display name, 1 to 64 characters.
        product_id:
          type:
            - string
            - 'null'
          description: >-
            The product sales of the unit are booked under; `null` clears it,
            which stops the unit

            from being sold.
        symbol:
          type:
            - string
            - 'null'
          description: >-
            Validated by the store (trimmed, at most 8 characters) rather than
            here: `validator` has

            no built-in support for a double `Option`.
      additionalProperties: false
    CreditUnit:
      type: object
      description: >-
        A tenant-defined denomination usage can be priced or credit granted in,
        instead of money.

        `code` and `precision` are immutable once created.
      required:
        - id
        - code
        - name
        - plural_name
        - precision
        - archived
        - prices
      properties:
        archived:
          type: boolean
          description: >-
            Archived units take no new prices, packs or grants; existing ones
            keep working.
        code:
          type: string
          description: >-
            Upper-case code naming the unit in wallets, grants and webhooks,
            e.g. `CREDITS`.
        id:
          type: string
          description: The unit's id (`cun_…`).
        name:
          type: string
          description: Singular display name, e.g. "Credit".
        plural_name:
          type: string
          description: Plural display name, e.g. "Credits".
        precision:
          type: integer
          format: int32
          description: >-
            Minor-unit exponent: amounts of this unit are integers of
            10^-precision credit.
          minimum: 0
        prices:
          type: array
          items:
            $ref: '#/components/schemas/CreditUnitPrice'
          description: The active selling prices, one per currency.
        product_id:
          type:
            - string
            - 'null'
          description: >-
            The product sales of this unit are booked under: their tax category
            and accounting code.

            The unit can be sold (top-ups) only once it is set.
        symbol:
          type:
            - string
            - 'null'
          description: Short display symbol, e.g. "cr".
    RestErrorResponse:
      type: object
      required:
        - code
        - message
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
    CreditUnitPrice:
      type: object
      description: >-
        What one credit sells for in a currency. A price is never edited:
        setting a new one for the

        same currency archives it.
      required:
        - id
        - currency
        - unit_price
        - created_at
      properties:
        archived_at:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            When a newer price, or its removal, replaced it; absent while
            active.
        created_at:
          type: string
          format: date-time
          description: When the price was set.
        currency:
          type: string
          description: ISO 4217 code of the currency the unit sells in.
        id:
          type: string
          description: The price's id (`cup_…`).
        unit_price:
          type: string
          description: >-
            Major units of `currency` per credit, as a decimal string (e.g.
            "0.001").
    ErrorCode:
      type: string
      enum:
        - BAD_REQUEST
        - NOT_FOUND
        - CONFLICT
        - FORBIDDEN
        - UNAUTHORIZED
        - TOKEN_EXPIRED
        - TOO_MANY_REQUESTS
        - INTERNAL_SERVER_ERROR
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer

````

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