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

# Mark Invoice Uncollectible

> Operator-initiated write-off: flip a still-collectible invoice to uncollectible and post the write-off reversal so the books stop carrying money that will never arrive.

Writes off an invoice by hand. The invoice's status becomes `uncollectible`, any
scheduled retry is cleared, and the write-off reversal is posted to the ledger
so AR no longer overstates what is owed. It is the manual counterpart of the
write-off the dunning engine performs automatically.

The reversal credits Accounts Receivable for the full invoice total, split by
what has already happened to the revenue:

* **Still-deferred portion** (a subscription invoice's pre-tax amount not yet
  recognized): debit Deferred Revenue, credit AR. Under the cash model this is
  the whole pre-tax amount.
* **Already-recognized portion** (accrual-model revenue recognized before
  payment, or all of a one-off invoice's pre-tax amount): recognized revenue
  cannot be un-deferred, so it is expensed — debit Bad Debt Expense, credit AR.
* **Tax**: debit Tax Payable, credit AR, since tax on money that will never be
  collected is not owed.

A partially-recognized invoice therefore shows all three legs in
[Invoice Journal Entries](/api-reference/invoices/journal-entries).

Only an `open` or `past_due` invoice can be written off — the call cannot
resurrect a paid, voided or already-uncollectible invoice, so it is safe to
repeat: a second call returns `404`. The invoice stays on the
[collections queue](/api-reference/collections/queue) with
`status: uncollectible` while a balance is still owing, and counts toward the
`uncollectible` bucket of the
[collections funnel](/api-reference/analytics/collections-funnel). To see the
posted legs, use [Invoice Journal Entries](/api-reference/invoices/journal-entries).

## Path Parameters

| Parameter | Type          | Required | Description       |
| --------- | ------------- | -------- | ----------------- |
| `id`      | string (uuid) | Yes      | The invoice's id. |

No request body.

## Example Request

```bash theme={null}
curl -X POST "https://api.recurso.dev/v1/collections/invoices/06c151de-8d3a-4b21-9c77-2f0e5a9b4d12/mark-uncollectible" \
  -H "Authorization: Bearer $API_KEY"
```

## Response

```json theme={null}
{
  "data": {
    "status": "uncollectible"
  }
}
```

## Fields

| Field    | Type   | Description                                       |
| -------- | ------ | ------------------------------------------------- |
| `status` | string | Always `uncollectible` — the invoice's new status |

## Errors

| Status | Code                | When                                                                                                                                                                 | Fix                                                                                    |
| ------ | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `400`  | `validation_failed` | `id` in the path is not a UUID                                                                                                                                       | Use the invoice's UUID                                                                 |
| `404`  | `not_found`         | Invoice doesn't exist, belongs to another tenant (existence is never confirmed across tenants), or is not `open` or `past_due` (already paid, voided or written off) | Check the ID and status from the [collections queue](/api-reference/collections/queue) |

<Note>
  The status change is committed before the ledger reversal is posted. If the
  posting fails the invoice stays `uncollectible`, the failure is logged, and
  the un-reversed write-off remains visible in the tie-out's unscheduled bucket
  until it is reconciled — the write-off is never silently lost.
</Note>

Errors use the standard envelope — see [Errors](/api-reference/errors).


## OpenAPI

````yaml POST /v1/collections/invoices/{id}/mark-uncollectible
openapi: 3.1.0
info:
  title: Recurso API
  version: 1.0.0
  description: |
    The Recurso billing engine REST API.

    Authenticate by passing your API key as a bearer token:

        Authorization: Bearer <api_key>

    Obtain an API key by registering a tenant via `POST /auth/register`.
    All authenticated endpoints live under the `/v1` prefix. Mutating
    endpoints support idempotency via the `Idempotency-Key` header.
  license:
    name: MIT
    identifier: MIT
servers:
  - url: https://billing.example.com
    description: >-
      Example deployment — substitute the base URL of your own Recurso
      deployment.
security:
  - bearerAuth: []
tags:
  - name: System
    description: Health, version, and API metadata
  - name: Auth
    description: Tenant registration
  - name: Plans
    description: Product catalog plans
  - name: Customers
    description: Customer management
  - name: Subscriptions
    description: Subscription lifecycle
  - name: Invoices
    description: Invoices, PDFs, and Indian GST e-invoicing
  - name: Coupons
    description: Discounts
  - name: Usage
    description: Metered usage events
  - name: Credit Notes
    description: Customer credits
  - name: Quotes
    description: Quote-to-invoice lifecycle
  - name: Webhooks
    description: Webhook endpoint management and event feed
  - name: Analytics
    description: Revenue analytics
  - name: Checkout
    description: Public hosted checkout for invoices
  - name: Payments
    description: Payment order creation
  - name: Inbound Webhooks
    description: Receivers for payment-gateway callbacks (Razorpay, Stripe)
  - name: Customer Portal
    description: Customer-facing portal — magic-link auth and session-scoped data
  - name: Developer
    description: API key management
  - name: Account
    description: Tenant account settings
  - name: Finance
    description: Ledger accounts, entries, reconciliation, and revenue recognition
  - name: Settings
    description: Tax (GST) and e-invoicing (IRP) configuration
  - name: Consents
    description: Consent records for RBI-compliant recurring billing
  - name: Referrals
    description: Customer referral program
  - name: Gifts
    description: Gift subscriptions
  - name: Mandates
    description: UPI Autopay mandates
  - name: Offline Payments
    description: Virtual accounts and manually recorded payments
  - name: Organizations
    description: Multi-entity organizations grouping several tenants
  - name: Accounting
    description: QuickBooks / Xero accounting integrations
  - name: Churn
    description: Churn risk scoring and alerts
  - name: Cancel Flows
    description: Configurable retention flows shown at cancellation time
  - name: Dunning
    description: Dunning analytics and multi-channel dunning campaigns
paths:
  /v1/collections/invoices/{id}/mark-uncollectible:
    post:
      tags:
        - Collections
      summary: Manually write off an invoice as uncollectible
      description: >
        Operator-initiated write-off: flips a still-collectible (open or
        past_due) invoice to uncollectible and posts the write-off reversal
        (still-deferred portion DR Deferred Revenue / CR AR, already-recognized
        portion DR Bad Debt Expense / CR AR, tax DR Tax Payable / CR AR) so AR
        stops carrying money that will never arrive. Any other status → 404.
      operationId: collectionsMarkUncollectible
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Invoice marked uncollectible.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      status:
                        type: string
                        const: uncollectible
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  responses:
    Unauthorized:
      description: Missing or invalid credentials (API key or session cookie).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: The requested resource does not exist.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          description: Structured error detail.
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Stable machine-readable error code.
              examples:
                - validation_failed
                - unauthorized
                - forbidden
                - not_found
                - conflict
                - rate_limited
                - internal_error
                - invalid_api_key
                - key_mode_mismatch
                - over_refund
                - invoice_not_paid
                - invoice_already_paid
            message:
              type: string
              description: Human-readable explanation.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: >-
        Tenant API key obtained from `POST /auth/register` or `POST
        /v1/developer/keys`.

````