# Deplete funds

Depletes prepaid balance funds.
A fund is depleted only when it exists, is not deleted, has a balance greater than zero,
and its source type is a prepayment fund: charge-based unit funds, upfront currency funds.
Other funds in the request (for example in-arrears currency or non-prepayment sources) are not depleted;
each appears in the response with `status` set to `failed`.
Supply exactly one of `fundIds` or `depleteOptions`.
`fundIds` depletes each listed fund in full using the default accounting date.
`depleteOptions` selects funds through each entry's `fundId` and lets each entry specify
its own accounting date and partial amount or quantity. When `depleteOptions` is non-empty,
it alone determines which funds are depleted; `fundIds` is ignored.
**Partial deplete**
To deplete only part of a fund's balance, include either `depleteAmount` or
`depleteQuantity` in the `depleteOptions` entry. Use `depleteAmount` for currency
funds and `depleteQuantity` for unit funds. Do not include both fields in one entry.
When neither field is provided, the full remaining balance is depleted.
A single request cannot mix currency funds with unit or incentive funds.
Such a request is rejected in full before any depletion runs. Submit separate
requests for currency funds and for unit or incentive funds.
**Custom deplete date**
When using `depleteOptions`, you can supply a `depleteDate` for each fund. The
supplied date must be on or after the later of `startDate` and the fund's latest
relevant drawdown or deplete transaction date, and on or before `endDate` minus
one day. The fund's `endDate` is exclusive.
When `depleteDate` is omitted, the API uses `endDate` minus one day. Date-range
validation applies only when the request explicitly supplies `depleteDate`.
**Per-fund error-handling**
If one fund fails, the remaining funds are still processed and the affected fund is
returned with `status` set to `failed`. This applies to per-fund rejection before any depletion runs
(unknown id, deleted, zero balance, non-prepayment, invalid partial amount or quantity, or invalid
caller-supplied `depleteDate`).
If the request fails request-level validation (shape, batch limits, mixed depletable groups,
blank or duplicate `fundId` in `depleteOptions`, both `depleteAmount` and `depleteQuantity` on one entry,
or unrecognized body fields), no funds are depleted.

Endpoint: POST /v1/prepaid-balance-funds/deplete
Version: 2026-11-13
Security: bearerAuth

## Security:

  - `bearerAuth` (unknown)
    http bearer

## Header parameters:

  - `Idempotency-Key` (string)
    Specify a unique idempotency key if you want to perform an idempotent POST or PATCH request. Do not use this header in other request types. 

With this header specified, the Zuora server can identify subsequent retries of the same request using this value, which prevents the same operation from being performed multiple times by accident.

  - `Accept-Encoding` (string)
    Include the `Accept-Encoding: gzip` header to compress responses as a gzipped file. It can significantly reduce the bandwidth required for a response.
If specified, Zuora automatically compresses responses that contain over 1000 bytes of data, and the response contains a `Content-Encoding` header with the compression algorithm so that your client can decompress it.

  - `Content-Encoding` (string)
    Include the `Content-Encoding: gzip` header to compress a request. With this header specified, you should upload a gzipped file for the request payload instead of sending the JSON payload.

  - `Authorization` (string)
    The value is in the `Bearer {token}` format where {token} is a valid OAuth token generated by calling [Create an OAuth token](https://developer.zuora.com/v1-api-reference/api/oauth/createtoken).

  - `Zuora-Entity-Ids` (string)
    An entity ID. If you have [Zuora Multi-entity](https://docs.zuora.com?resourceId=platform-multi-entity-overview) enabled and the OAuth token is valid for more than one entity, you must use this header to specify which entity to perform the operation in. If the OAuth token is only valid for a single entity, or you do not have Zuora Multi-entity enabled, you should not set this header.

  - `Zuora-Org-Ids` (string)
    Comma separated IDs. If you have Zuora Multi-Org enabled,
you can use this header to specify which orgs to perform the operation in. If you do not have Zuora Multi-Org enabled, you should not set this header.
The IDs must be a sub-set of the user's accessible orgs. If you specify an org that the user does not have access to, the operation fails. This header is important in Multi-Org (MO) setups because it defines the organization context under which the API should operate—mainly used for read access or data visibility filtering. If the header is not set, the operation is performed in scope of the user's accessible orgs.

  - `Zuora-Track-Id` (string)
    A custom identifier for tracing the API call. If you set a value for this header, Zuora returns the same value in the response headers. This header enables you to associate your system process identifiers with Zuora API calls, to assist with troubleshooting in the event of an issue.
The value of this field must use the US-ASCII character set and must not include any of the following characters: colon (`:`), semicolon (`;`), double quote (`"`), and quote (`'`).

  - `Zuora-Version` (string)
    The minor API version.
For a list of available minor versions, see [API upgrades](https://developer.zuora.com/v1-api-reference/api-upgrades/).

## Request body:

  - `application/json` (unknown)
    Only `fundIds` and `depleteOptions` are accepted in the request.
Supply exactly one of them with at least one entry.

## Request fields (application/json):

  - `fundIds` (array)
    IDs of the funds to deplete in full.
Mutually exclusive with `depleteOptions`.
Each fund is recorded with the default accounting date of `endDate` minus one day.
Duplicate ids in this array are not rejected by request validation.

  - `depleteOptions` (array)
    Per-fund deplete instructions.
Mutually exclusive with `fundIds`.
When supplied, this array alone determines which funds are depleted.
A `fundId` must not appear more than once.
A single request cannot mix currency funds with unit or incentive funds.
Such a request is rejected in full before any depletion is applied.

  - `depleteOptions.fundId` (string, required)
    The ID of the fund to deplete.

  - `depleteOptions.depleteDate` (string)
    Accounting date recorded on the deplete transaction and the daily consumption record.
Must be on or after the later of `startDate` and the fund's most recent drawdown
or deplete date, and on or before `endDate` minus one day.
Defaults to `endDate` minus one day.

  - `depleteOptions.depleteAmount` (number)
    Amount to deplete from a currency fund.
Must be greater than zero and must not exceed the fund's balance.
Mutually exclusive with `depleteQuantity`.
Not applicable to quantity-based funds.
When both `depleteAmount` and `depleteQuantity` are omitted,
the fund is depleted in full.

  - `depleteOptions.depleteQuantity` (number)
    Quantity to deplete from a quantity-based fund.
Must be greater than zero and must not exceed the fund's balance.
Mutually exclusive with `depleteAmount`.
Not applicable to amount-based funds (for example upfront currency).
When both `depleteAmount` and `depleteQuantity` are omitted,
the fund is depleted in full.

## Response 200:

  - `200` (unknown)
    OK
Returns per-fund results in `fundIds` when depletion processing completes.
The top-level `success` field follows the common response pattern.

## Response 200 fields (application/json):

  - `processId` (string)
    The ID of the process that handles the operation.

  - `reasons` (array)
    The container of the error code and message.
This field is available only if the `success` field is `false`.

  - `reasons.code` (string)
    The error code of the response.

  - `reasons.message` (string)
    Detailed information about the error response.

  - `requestId` (string)
    Unique identifier of the request.

  - `success` (boolean)
    Indicates whether the request was structurally valid and processing completed.
A value of `true` can include per-fund failures.
A value of `false` indicates the entire request was rejected (validation, permission,
or depletion transaction failure), with details in `reasons`.

  - `fundIds` (array)
    One entry per fund in the request, covering both depleted funds and funds that were 
rejected on their own. Absent when the request was rejected as a whole.

  - `fundIds.fundId` (string)
    The unique ID of the fund.

  - `fundIds.status` (string)
    The outcome of the depletion attempt for this fund.
- `success`: The fund was depleted, either fully or partially.
- `failed`: This fund was rejected individually. Other funds in the same
request may have been depleted successfully.
    Enum: "success", "failed"

  - `fundIds.message` (string)
    A description of the outcome for this fund. For a `failed` status, this field
contains the reason the fund was rejected.

  - `fundIds.depleteDate` (string)
    The accounting date on which the depletion was recorded. Present only when
`status` is `success`; omitted for failed funds.
When a per-fund `depleteDate` is supplied, this field returns that date.
Otherwise, it returns `endDate` minus one day.

## Response 200 headers (application/json):

  - `Content-Encoding` (string)
    This header is returned if you specify the `Accept-Encoding: gzip` request header and the response contains over 1000 bytes of data.
Note that only the following MIME types support gzipped responses:
- `application/json`
- `application/xml`
- `text/html`
- `text/csv`
- `text/plain`

  - `RateLimit-Limit` (string)
    The request limit quota for the time window closest to exhaustion. See [rate limits](https://developer.zuora.com/docs/guides/rate-limits/) for more information.

  - `RateLimit-Remaining` (number)
    The number of requests remaining in the time window closest to quota exhaustion. See [rate limits](https://developer.zuora.com/docs/guides/rate-limits/) for more information.

  - `RateLimit-Reset` (number)
    The number of seconds until the quota resets for the time window closest to quota exhaustion. See [rate limits](https://developer.zuora.com/docs/guides/rate-limits/) for more information.

  - `Zuora-Request-Id` (string)
    The Zuora internal identifier of the API call. 
You cannot control the value of this header.

  - `Zuora-Track-Id` (string)
    A custom identifier for tracing the API call. 
If you specified a tracing identifier in the request headers, Zuora returns the same tracing identifier. 
Otherwise, Zuora does not set this header.

  - `Concurrency-Limit-Type` (string)
    The type of the concurrency limit, which can be `Default`, `High-volume transactions`, or `Object Query`.
For more information, see [Concurrent request limits](https://developer.zuora.com/docs/guides/rate-limits/#concurrent-request-limits).

  - `Concurrency-Limit-Limit` (integer)
    The total number of the permitted concurrent requests.
For more information, see [Concurrent request limits](https://developer.zuora.com/docs/guides/rate-limits/#concurrent-request-limits).

  - `Concurrency-Limit-Remaining` (integer)
    The remaining number of the permitted concurrent requests.
For more information, see [Concurrent request limits](https://developer.zuora.com/docs/guides/rate-limits/#concurrent-request-limits).

## Response 500:

  - `500` (unknown)
    Internal Server Error

## Response 500 fields (application/json):

  - `reasons` (array)

  - `reasons.code` (string)
    The error code of response.

  - `reasons.message` (string)
    The detail information of the error response

## Response 500 headers (application/json):

  - `Content-Encoding` (string)
    This header is returned if you specify the `Accept-Encoding: gzip` request header and the response contains over 1000 bytes of data.
Note that only the following MIME types support gzipped responses:
- `application/json`
- `application/xml`
- `text/html`
- `text/csv`
- `text/plain`

  - `RateLimit-Limit` (string)
    The request limit quota for the time window closest to exhaustion. See [rate limits](https://developer.zuora.com/docs/guides/rate-limits/) for more information.

  - `RateLimit-Remaining` (number)
    The number of requests remaining in the time window closest to quota exhaustion. See [rate limits](https://developer.zuora.com/docs/guides/rate-limits/) for more information.

  - `RateLimit-Reset` (number)
    The number of seconds until the quota resets for the time window closest to quota exhaustion. See [rate limits](https://developer.zuora.com/docs/guides/rate-limits/) for more information.

  - `Zuora-Request-Id` (string)
    The Zuora internal identifier of the API call. 
You cannot control the value of this header.

  - `Zuora-Track-Id` (string)
    A custom identifier for tracing the API call. 
If you specified a tracing identifier in the request headers, Zuora returns the same tracing identifier. 
Otherwise, Zuora does not set this header.

## Response 4XX:

  - `4XX` (unknown)
    Request Errors

## Response 4XX fields (application/json):

  - `processId` (string)
    The ID of the process that handles the operation.

  - `reasons` (array)
    The container of the error code and message. This field is available only if the `success` field is `false`.

  - `reasons.code` (string)
    The error code of response.

  - `reasons.message` (string)
    The detail information of the error response

  - `requestId` (string)
    Unique identifier of the request.

  - `success` (boolean)
    Indicates whether the call succeeded.

## Response 4XX headers (application/json):

  - `Content-Encoding` (string)
    This header is returned if you specify the `Accept-Encoding: gzip` request header and the response contains over 1000 bytes of data.
Note that only the following MIME types support gzipped responses:
- `application/json`
- `application/xml`
- `text/html`
- `text/csv`
- `text/plain`

  - `RateLimit-Limit` (string)
    The request limit quota for the time window closest to exhaustion. See [rate limits](https://developer.zuora.com/docs/guides/rate-limits/) for more information.

  - `RateLimit-Remaining` (number)
    The number of requests remaining in the time window closest to quota exhaustion. See [rate limits](https://developer.zuora.com/docs/guides/rate-limits/) for more information.

  - `RateLimit-Reset` (number)
    The number of seconds until the quota resets for the time window closest to quota exhaustion. See [rate limits](https://developer.zuora.com/docs/guides/rate-limits/) for more information.

  - `Zuora-Request-Id` (string)
    The Zuora internal identifier of the API call. 
You cannot control the value of this header.

  - `Zuora-Track-Id` (string)
    A custom identifier for tracing the API call. 
If you specified a tracing identifier in the request headers, Zuora returns the same tracing identifier. 
Otherwise, Zuora does not set this header.

## Response 200 examples:

  - `response` (unknown)

## Response 500 examples:

  - `response` (unknown)

