---
title: "Unpost an invoice"
method: PUT
path: "/v1/invoices/{invoiceKey}/unpost"
tags: ["Invoices"]
---

# Unpost an invoice

`PUT /v1/invoices/{invoiceKey}/unpost`

Unposts a posted invoice and changes its status to `Draft`.

- For invoices with a large number of invoice items, Zuora might process this operation asynchronously. In this case, the response returns `jobId` and `jobStatus`. 
  - If `jobStatus` is `Pending`, use the [Retrieve an operation job](https://developer.zuora.com/v1-api-reference/api/operations/get_operationjob) operation to retrieve the job status until processing is complete.
  - If `jobStatus` is `Completed`, the operation completed synchronously and the response includes the unposted invoice details.

- When an invoice and a credit memo contain items generated from the same rate plan charge, posting or unposting either document automatically posts or unposts the other.

**Restrictions:**

You cannot unpost an invoice if any of the following restrictions is met:

- The invoice is not in `Posted` status.
- Payments or adjustments are applied to the invoice.
- Non-cancelled memos have been created from the invoice.
- Credit memos are applied to the invoice.
- The invoice does not satisfy other applicable unpost validations, such as e-invoicing validation.

## Path parameters

- `invoiceKey` string, required

## Headers

- `Accept-Encoding` string
- `Content-Encoding` string
- `Zuora-Track-Id` string
- `Zuora-Entity-Ids` string
- `Zuora-Org-Ids` string
- `Zuora-Version` string

## Response `200`

OK

- UnpostInvoiceResponseType
  - `invoice` UnpostedInvoiceType
    - `id` string — The unique ID of the invoice.
    - `accountId` string — The ID of the customer account associated with the invoice.
    - `invoiceNumber` string — The unique identification number of the invoice.
    - `status` string — The status of the invoice.
    - `invoiceDate` string, date — The invoice created date.
    - `dueDate` string, date — The date by which the payment for this invoice is due.
    - `amount` string, number — The total amount of the invoice.
    - `balance` string, number — The remaining balance of the invoice after all payments, adjustments, and refunds are applied.
  - `jobId` string — Operation job ID for tracking. **Note:** Use with the [Retrieve an operation job](https://developer.zuora.com/v1-api-reference/api/operations/get_operationjob) operation to poll the asynchronous job's status.
  - `jobStatus` 'Pending' | 'Completed' — Job status of the operation. **Note:** - `Completed` indicates the operation finished synchronously. - `Pending` indicates the operation is still running asynchronously.
  - `success` boolean — Indicates whether the operation was successful.

## Other responses

- `500` — Internal Server Error
- `4XX` — Request Errors

---

[API](https://skmtc.dev/zuora/apis/api-reference.md) · [All operations](https://skmtc.dev/zuora/apis/api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/zuora/api-reference/revisions/d11e237f3e54/schema)
