Skip to content

Bulk delete draft invoices

POST/api/v1/invoices/drafts/bulk-delete

Delete many draft invoices in one call: name them with invoice_ids, or set all_drafts (optionally with a due-date window) to clear every draft. Only drafts can be deleted: a selection that includes any other status is refused whole (400) and nothing is deleted. Each deletion runs the single-invoice path in its own savepoint, so a draft that cannot be deleted is reported without blocking the rest.

Operation ID: bulk_delete_draft_invoices·View as markdown·OpenAPI slice

Authentication

Bearer token authentication. Pass your DayZero API token in the Authorization header and the target business UUID in x-business-id.

Request body

invoice_idsarray · string

Draft invoice UUIDs to delete (1-500). Every id must be a draft or nothing is deleted. Mutually exclusive with all_drafts.

all_draftsboolean

Delete every draft invoice of the business, optionally limited by start_date / end_date. Mutually exclusive with invoice_ids. At most 500 are deleted per call; remaining says how many are left.

start_datestring · date

With all_drafts: only drafts due on or after this date.

end_datestring · date

With all_drafts: only drafts due on or before this date.

dry_runboolean

List the drafts that would be deleted; delete nothing.

Responses

200Successful Response

successboolean
messagestring
codestring
dataBulkDeleteDraftInvoicesResponse

400Bad Request - Invalid input

errorstringrequired

Error category: validation_error, unauthorized, forbidden, not_found, conflict, rate_limited, server_error, or service_unavailable.

messagestringrequired

Human-readable explanation, safe to show to end users.

codestringrequired

Stable machine-readable code in CATEGORY_NNN form (e.g. NOT_FOUND_006, AUTH_010, GEN_002).

request_idstring

Correlation id for support requests. Echoes the x-request-id request header when one was supplied.

errorsobject

Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

401Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business

errorstringrequired

Error category: validation_error, unauthorized, forbidden, not_found, conflict, rate_limited, server_error, or service_unavailable.

messagestringrequired

Human-readable explanation, safe to show to end users.

codestringrequired

Stable machine-readable code in CATEGORY_NNN form (e.g. NOT_FOUND_006, AUTH_010, GEN_002).

request_idstring

Correlation id for support requests. Echoes the x-request-id request header when one was supplied.

errorsobject

Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

403Forbidden - Insufficient permissions

errorstringrequired

Error category: validation_error, unauthorized, forbidden, not_found, conflict, rate_limited, server_error, or service_unavailable.

messagestringrequired

Human-readable explanation, safe to show to end users.

codestringrequired

Stable machine-readable code in CATEGORY_NNN form (e.g. NOT_FOUND_006, AUTH_010, GEN_002).

request_idstring

Correlation id for support requests. Echoes the x-request-id request header when one was supplied.

errorsobject

Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

422Validation Error

errorstringrequired

Error category: validation_error, unauthorized, forbidden, not_found, conflict, rate_limited, server_error, or service_unavailable.

messagestringrequired

Human-readable explanation, safe to show to end users.

codestringrequired

Stable machine-readable code in CATEGORY_NNN form (e.g. NOT_FOUND_006, AUTH_010, GEN_002).

request_idstring

Correlation id for support requests. Echoes the x-request-id request header when one was supplied.

errorsobject

Field-level validation messages keyed by field name. Present on 400/422 validation failures only.