---
title: "Execute an invoice schedule"
method: POST
path: "/v1/invoice-schedules/{scheduleKey}/execute"
tags: ["Invoice Schedules"]
---

# Execute an invoice schedule

`POST /v1/invoice-schedules/{scheduleKey}/execute`

Executes an invoice schedule immediately. During the execution, a bill run is created and generates an invoice or a credit memo asynchronously. 

When you use this API operation to execute an invoice schedule item, you have the flexibility to decide whether to specify a specific item ID.
- If you specify the unique ID of an invoice schedule item to be executed in the request, the corresponding invoice schedule item is executed.
- If you do not specify the ID of any invoice schedule item in the request, the subscription end date is used as the target date to determine the next pending schedule item to be executed. 

A paused invoice schedule and charges inside cannot be automatically executed by Zuora Scheduler or by this "Execute an invoice schedule" API operation. In this case, you can do one of the following:
- Use the <a href="https://developer.zuora.com/v1-api-reference/api/operation/POST_GenerateBillingDocuments/" target="_blank">Generate billing documents by account ID</a> API operation
- Create a bill run with the target date greater than the next run date of the invoice schedule through UI or API

For more samples, see [Execute invoice schedules](https://docs.zuora.com?resourceId=billing-execute-invoice-schedules).

**Note**: This operation is available only if you have the <a href="https://docs.zuora.com?resourceId=billing-billing-schedule-overview" target="_blank">Billing Schedule</a> feature enabled.

## Path parameters

- `scheduleKey` string, required

## Headers

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

## Request body

- POSTExecuteInvoiceScheduleRequest
  - `scheduleItemId` string — The ID of the invoice schedule item to be executed. The item must be the earliest pending schedule item. If all the invoice schedule items have been processed and credit is needed to be generated, do not specify this field in the request.

## Response `200`

OK

- ExecuteInvoiceScheduleBillRunResponse
  - `autoEmail` boolean — Whether to automatically send an email after Auto-Post is complete.
  - `autoPost` boolean — Whether to automatically post the bill run after the bill run is created.
  - `autoRenewal` boolean — Whether to automatically renew auto-renew subscriptions that are up for renewal.
  - `batches` string[] — A list of the batches of accounts for this bill run. This field cannot exist with the `billRunFilters` field. **Values:** `AllBatches` or Batch*n* where *n* is a number between 1 and 50, for example, `Batch7`.
  - `billCycleDay` string — The day of the bill cycle, this field is only valid when `batches` is specified. **Values:** - `AllBillCycleDays` or 1 - 31 for an ad-hoc bill run - `AllBillCycleDays` or 1 - 31 or `AsRunDay` for a scheduled bill run
  - `billRunFilters` BillRunFilters[] — A list of the target account or subscriptions for this bill run. This field cannot exist with the `batches` field.
    - `accountId` string — The target account of the bill run.
    - `filterType` 'Account' | 'Subscription' | 'InvoiceSchedule' — The type of the filter to determine whether to create a bill run at the account level or subscription level.
    - `subscriptionId` string — The unique ID of the target subscription belonged to the target account. This field is required if you set the `filterType` field to `Subscription`.
  - `billRunNumber` string — The number of bill run.
  - `chargeTypeToExclude` string[] — The types of the charges to be excluded from the generation of billing documents.
  - `createdById` string — The ID of the user who created the bill run.
  - `createdDate` string — The date and time when the bill run was created.
  - `id` string — The unique ID of the bill run.
  - `invoiceDate` string, date — The invoice date for this bill run, only valid for ad-hoc bill runs.
  - `invoiceDateOffset` integer — The offset compared to bill run execution date, only valid for scheduled bill runs.
  - `noEmailForZeroAmountInvoice` boolean — Whether to suppress emails for invoices with the total amount of zero or not for this bill run after the bill run is complete. **Note**: Do not email invoices with the total amount of zero.
  - `organizationLabels` object[] — The organization(s) that the object belongs to. Note: This field is available only when the Multi-Org feature is enabled.
    - `organizationId` string — The organization ID.
    - `organizationName` string — The organization name.
  - `scheduledExecutionTime` string — The scheduled execution time for a bill run.
  - `status` 'Pending' | 'Processing' | 'Completed' | 'Error' | 'Canceled' | 'Posted' | 'PostInProgress' | 'CancelInProgress' | 'RemoveInProgress' | 'Paused' — The status of the bill run.
  - `targetDate` string, date — The target date for this bill run, only valid for ad-hoc bill run.
  - `targetDateOffset` integer — The offset compared to bill run execution date, only valid for scheduled bill run.
  - `updatedById` string — The ID of the user who updated the bill run.
  - `updatedDate` string — The date and time when the bill run was updated.

## 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)
