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

# Update an add-on

> Update a credit pack with its complete editable body.

Updates one active credit pack by its URL `id`. Send the complete editable body: `name`, `type: "credit_pack"`, positive `creditAmount`, and positive `priceCents` in USD cents. The response contains the current `item` and `changed`; unchanged values return `changed: false`.

New Checkouts use the updated value. If a purchase is still `pending_checkout`, changing its credit amount or price returns `409 purchase_pending`. Complete the payment or wait for Stripe's signed `checkout.session.expired` event to clear the pending purchase, then retry. A browser cancel redirect alone does not expire the session. If an expired Checkout still blocks the edit, verify the organization's Stripe webhook subscribes to expiry events and that Ledger received the event. A name-only edit is allowed while Checkout is pending. An unknown or archived ID returns `404 not_found`; invalid values return `400 invalid_request`.

See [Create an add-on](https://docs.integrateledger.com/api-reference/add-ons/create.md) for pack setup and [Customers](https://docs.integrateledger.com/customers.md) for payment and credit timing.


## OpenAPI

````yaml openapi.json PUT /v1/add-ons/{id}
openapi: 3.1.0
info:
  title: Ledger API
  version: 0.1.0
servers:
  - url: https://api.integrateledger.com
    description: Hosted Ledger API
security: []
paths:
  /v1/add-ons/{id}:
    put:
      tags:
        - Add-ons
      summary: Update an add-on
      operationId: updateAddOn
      parameters:
        - schema:
            type: string
            minLength: 1
            maxLength: 100
            pattern: ^[a-zA-Z0-9_-]+$
          required: true
          name: id
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateAddOnInput'
      responses:
        '200':
          description: AddOn updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddOnMutation'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '401':
          description: Invalid Ledger API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '404':
          description: Item not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '409':
          description: Item ID already exists or add-on Checkout is pending
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
      security:
        - ApiKey: []
      x-codeSamples:
        - lang: bash
          label: cURL
          source: >-
            curl --request PUT
            'https://api.integrateledger.com/v1/add-ons/extra_credits' \
              -H "Authorization: Bearer $LEDGER_API_KEY" \
              -H 'Content-Type: application/json' \
              --data '{"name":"Extra credits","type":"credit_pack","creditAmount":100,"priceCents":900}'
        - lang: python
          label: Python SDK (source only)
          source: >-
            import os

            from ledger_sdk import Ledger


            ledger = Ledger(api_key=os.environ["LEDGER_API_KEY"])

            ledger.update_add_on("extra_credits", name="Extra credits",
            credit_amount=100, price_cents=900)
        - lang: typescript
          label: TypeScript SDK (source only)
          source: >-
            import { Ledger } from "@ledger/sdk";


            const ledger = new Ledger({ apiKey: process.env.LEDGER_API_KEY ?? ""
            });

            await ledger.updateAddOn({ id: "extra_credits", body: { name: "Extra
            credits", type: "credit_pack", creditAmount: 100, priceCents: 900 }
            });
components:
  schemas:
    UpdateAddOnInput:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 120
        type:
          type: string
          enum:
            - credit_pack
        creditAmount:
          type: integer
          exclusiveMinimum: 0
          maximum: 2147483647
        priceCents:
          type: integer
          exclusiveMinimum: 0
          maximum: 2147483647
      required:
        - name
        - type
        - creditAmount
        - priceCents
      additionalProperties: false
    AddOnMutation:
      type: object
      properties:
        item:
          $ref: '#/components/schemas/AddOnItem'
        changed:
          type: boolean
      required:
        - item
        - changed
    AddOnItem:
      type: object
      properties:
        id:
          type: string
          minLength: 1
          maxLength: 100
          pattern: ^[a-zA-Z0-9_-]+$
        name:
          type: string
          minLength: 1
          maxLength: 120
        type:
          type: string
          enum:
            - credit_pack
        creditAmount:
          type: integer
          exclusiveMinimum: 0
          maximum: 2147483647
        priceCents:
          type: integer
          exclusiveMinimum: 0
          maximum: 2147483647
      required:
        - id
        - name
        - type
        - creditAmount
        - priceCents
      additionalProperties: false
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer

````

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