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

# Set Invoice Customer Credit

> Set the total managed credit applied to an invoice.

Reconciles the invoice's INVOICE_APPLICATION entries to the target amount,
booking only the delta (and its journal entry). Never writes to Stripe —
use this to record a credit drawdown performed outside Quanta (e.g. an
invoice manually marked paid out of band in the Stripe Dashboard) or to
correct a prior application. Driving the customer's balance negative
requires confirm_negative_balance.



## OpenAPI

````yaml https://app.usequanta.com/openapi/quanta-services-api/openapi.json post /admin_api/invoices/set_invoice_customer_credit
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://app.usequanta.com
    description: Production
security:
  - HTTPBearer: []
paths:
  /admin_api/invoices/set_invoice_customer_credit:
    post:
      tags:
        - invoice_admin
        - quanta-services-api
      summary: Set Invoice Customer Credit
      description: >-
        Set the total managed credit applied to an invoice.


        Reconciles the invoice's INVOICE_APPLICATION entries to the target
        amount,

        booking only the delta (and its journal entry). Never writes to Stripe —

        use this to record a credit drawdown performed outside Quanta (e.g. an

        invoice manually marked paid out of band in the Stripe Dashboard) or to

        correct a prior application. Driving the customer's balance negative

        requires confirm_negative_balance.
      operationId: set_invoice_customer_credit
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetInvoiceCustomerCreditRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SetInvoiceCustomerCreditResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    SetInvoiceCustomerCreditRequest:
      properties:
        invoice_qid:
          type: string
          title: Invoice Qid
        target_amount:
          anyOf:
            - type: number
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Target Amount
        confirm_negative_balance:
          type: boolean
          title: Confirm Negative Balance
          default: false
        reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Reason
      type: object
      required:
        - invoice_qid
        - target_amount
      title: SetInvoiceCustomerCreditRequest
    SetInvoiceCustomerCreditResponse:
      properties:
        changed:
          type: boolean
          title: Changed
        applied_total:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Applied Total
        customer_balance:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Customer Balance
      type: object
      required:
        - changed
        - applied_total
        - customer_balance
      title: SetInvoiceCustomerCreditResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Quanta Services API scoped bearer token. Supported only on Services API
        routes.

````

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