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

# Credit an account

> Add credits to a customer account. Returns the resulting transaction record.



## OpenAPI

````yaml post /v1/customer-credits/accounts/{id}/credit
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/customer-credits/accounts/{id}/credit:
    post:
      tags:
        - Customer Credits - Accounts (Experimental)
      summary: Credit an account
      description: >-
        Add credits to a customer account. Returns the resulting transaction
        record.
      operationId: creditCustomerCreditsAccount
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreditDebitRequestDto'
      responses:
        '201':
          description: Credit transaction created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransactionResponseDto'
        '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: Account frozen or closed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerCreditsErrorResponseDto'
      security:
        - ApiKey: []
components:
  schemas:
    CreditDebitRequestDto:
      type: object
      properties:
        amount:
          type: string
          description: Amount to credit or debit (string to support large numbers)
          example: '1000'
        reference:
          type: string
          description: >-
            Your reference ID to link this transaction to an event in your
            system (e.g. order ID, campaign ID)
          example: signup_bonus
        idempotency_key:
          type: string
          description: Idempotency key to prevent duplicate transactions
          example: idem_abc123
      required:
        - amount
        - reference
        - idempotency_key
    TransactionResponseDto:
      type: object
      properties:
        id:
          type: string
          description: Transaction ID
          example: cct_abc123
        store_id:
          type: string
          description: Store ID
        reference:
          type: string
          description: Reference string
          example: order_xyz
        idempotency_key:
          type: string
          description: Idempotency key
        reversal_of:
          type: object
          description: ID of the transaction this reverses, if applicable
          example: cct_abc123
        entries:
          description: Transaction entries
          type: array
          items:
            $ref: '#/components/schemas/EntryResponseDto'
        created_at:
          type: string
          description: Creation timestamp
      required:
        - id
        - store_id
        - reference
        - idempotency_key
        - entries
        - created_at
    CustomerCreditsErrorResponseDto:
      type: object
      properties:
        error:
          description: Error details
          allOf:
            - $ref: '#/components/schemas/CustomerCreditsErrorDetailDto'
      required:
        - error
    EntryResponseDto:
      type: object
      properties:
        id:
          type: string
          description: Entry ID
          example: cce_abc123
        transaction_id:
          type: string
          description: Transaction ID
          example: cct_abc123
        account_id:
          type: string
          description: Account ID
          example: cca_abc123
        side:
          type: string
          description: Debit or credit side
          enum:
            - debit
            - credit
        amount:
          type: string
          description: Amount as string for bigint safety
          example: '1000'
        created_at:
          type: string
          description: Creation timestamp
      required:
        - id
        - transaction_id
        - account_id
        - side
        - amount
        - created_at
    CustomerCreditsErrorDetailDto:
      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: object
          description: Machine-readable error code
          example: unbalanced_transaction
          nullable: true
        message:
          type: string
          description: Human-readable error message
          example: Total debits must equal total credits
        param:
          type: object
          description: The parameter related to the error, if applicable
          example: entries
          nullable: true
        request_id:
          type: string
          description: Unique request identifier for support
          example: req_abc123def456
      required:
        - type
        - code
        - message
        - request_id
  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.

````