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

# Record write-off

> This endpoint records a write-off of an invoice in Layer.



## OpenAPI

````yaml post /v1/businesses/{businessId}/invoices/{invoiceId}/write-off
openapi: 3.0.1
info:
  title: API
  version: latest
servers: []
security:
  - BearerAuth: []
tags: []
externalDocs:
  url: /
paths:
  /v1/businesses/{businessId}/invoices/{invoiceId}/write-off:
    post:
      tags: []
      summary: Record write-off
      description: This endpoint records a write-off of an invoice in Layer.
      operationId: business.invoices.write-off.post
      parameters:
        - name: businessId
          in: path
          description: The UUID of the business the invoice is associated with
          required: true
          schema:
            type: string
        - name: invoiceId
          in: path
          description: The UUID of the invoice the write-off is applied to
          required: true
          schema:
            type: string
        - name: Content-Type
          in: header
          description: Content-Type must be set to application/json
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateInvoiceWriteOff'
      responses:
        '200':
          description: ''
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiInvoiceWriteOff'
        '400':
          description: Invalid write-off creation parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: >-
            Business id or invoice id is not found. This indicates the business
            id is invalid or the business has been archived, or the invoice id
            is invalid or the invoice has been deleted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      deprecated: false
components:
  schemas:
    CreateInvoiceWriteOff:
      type: object
      properties:
        external_id:
          type: string
          nullable: true
          description: >-
            Unique ID of the write-off in your system for linking and
            idempotency.
        amount:
          type: integer
          format: int64
          description: >-
            The amount written off. This amount counts towards the invoice total
            and decreases the outstanding balance of the invoice. The amount is
            optional if omitted, default to the entire outstanding balance of
            the invoice. If specified, the amount must be a positive value and
            cannot exceed the current outstanding balance of the invoice.
        memo:
          type: string
          nullable: true
          description: >-
            User-specified memo indicating the reason for the write-off.
            Recommended but not required.
        destination_ledger_account:
          $ref: '#/components/schemas/AccountIdentifier'
          description: >-
            Expense or contra-revenue account where write off amount is
            recorded. See
            [AccountIdentifier](/api-reference/ledger/account-identifier) for
            more details. This field is optional and defaults to the bad debt
            expense account. If the write-off is for a different reason, such as
            a charitable donation, a different ledger expense account can be
            specified here.
        write_off_at:
          type: string
          format: date-time
          description: >-
            Timestamp when the write off should be recognized in the general
            ledger.
        tags:
          type: array
          items:
            $ref: '#/components/schemas/TagKeyValue'
    ApiInvoiceWriteOff:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the write-off.
        invoice_id:
          type: string
          format: uuid
          description: Unique identifier for the invoice the write-off is for.
        external_id:
          type: string
          nullable: true
          description: >-
            Unique ID of the write-off in your system for linking and
            idempotency.
        amount:
          type: integer
          format: int64
          description: >-
            The amount written off. This amount counts towards the invoice total
            and decreases the outstanding balance of the invoice. The amount is
            optional if omitted, default to the entire outstanding balance of
            the invoice. If specified, the amount must be a positive value and
            cannot exceed the current outstanding balance of the invoice.
        memo:
          type: string
          nullable: true
          description: User-specified memo indicating the reason for the write-off.
        destination_ledger_account:
          $ref: '#/components/schemas/AccountIdentifier'
          description: >-
            Expense or contra-arevenue account where write off amount is
            recorded.
        write_off_at:
          type: string
          format: date-time
          description: >-
            Timestamp when the write off should be recognized in the general
            ledger.
        transaction_tags:
          type: array
          items:
            $ref: '#/components/schemas/ApiTag'
          description: List of tags on the invoice write-off
    ApiError:
      type: object
      properties: {}
      example: ''
      description: ''
    AccountIdentifier:
      oneOf:
        - $ref: '#/components/schemas/AccountId'
          description: ID of the account
          title: Account ID
        - $ref: '#/components/schemas/AccountStableName'
          description: Stable name associated with the account
          title: Account Stable Name
    TagKeyValue:
      type: object
      description: >-
        A TagKeyValue holds key=value data related to a tag. This is used when
        creating or updating taggable entities (transactions, invoices, etc.).
      properties:
        key:
          type: string
          description: The tag dimension key (e.g., "department", "project", "location")
          example: department
        dimension_display_name:
          type: string
          nullable: true
          description: >-
            If the TagDimension doesn't exist, providing this value specifies
            the display name upon database insertion. Otherwise, it is left as
            null on the TagDimension.
          example: Department
        value:
          type: string
          description: The tag value (e.g., "sales", "marketing", "engineering")
          example: sales
        value_display_name:
          type: string
          nullable: true
          description: >-
            If the TagValueDefinition doesn't exist, providing this value
            specifies the display name upon database insertion. Otherwise, it is
            left as null on the TagValueDefinition.
          example: Sales Department
      required:
        - key
        - value
    ApiTag:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: ID for the tag
        key:
          type: string
          description: Key for the tag
          example: ExampleTagKey
        dimension_display_name:
          type: string
          nullable: true
          description: Display name for the tag dimension
        value:
          type: string
          description: Value for the tag
          example: ExampleTagValue
        value_display_name:
          type: string
          nullable: true
          description: Display name for the tag value definition
        dimension_id:
          type: string
          format: uuid
          description: ID of the tag dimension this tag belongs to
        definition_id:
          type: string
          format: uuid
          description: ID of the tag value definition
        archived_at:
          type: string
          format: date-time
          nullable: true
          description: When the tag was archived
      required:
        - id
        - key
        - value
        - dimension_id
        - definition_id
    AccountId:
      type: object
      properties:
        type:
          type: string
          description: Resource type. Value will be `AccountId`.
          example: AccountId
        id:
          type: string
          format: uuid
          description: ID of the account
    AccountStableName:
      type: object
      properties:
        type:
          type: string
          description: Resource type. Value will be `StableName`.
          example: StableName
        stable_name:
          type: string
          example: CURRENT_ASSETS
          description: Stable name of the account
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````