Create Invoice
Table of Contents
Create a draft invoice or quote. The site must have Invoices enabled, and the API key user needs invoice creation permission. Start with an empty draft or populate it from existing reservations, a project, or actual usage.
POST /sites/{site_id}/invoices
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
site_id |
string | Yes | QReserve site ID. |
Request Body
Send a JSON object. An empty object creates an empty draft invoice.
| Parameter | Type | Required | Description |
|---|---|---|---|
invoice_type |
string | No | invoice (default) or quote. |
invoice_number |
string | No | Override the generated number. |
invoice_number_prefix |
string | No | Override the generated number prefix. |
reservation_ids |
array of strings | No | Reservation IDs to use as line-item sources. |
project_id |
string | No | Project ID in the same site. |
add_project_reservations |
boolean | No | Include reservations from the selected project. |
group_by |
string | No | Group generated reservation items by reservation (default), item, reservable, or category. |
hide_subitems |
boolean | No | Hide grouped child items on the invoice. |
actual_usage_ids |
string or array of strings | No | One or more actual usage IDs. |
actual_usage_filter |
object | No | Filters for selecting actual usage. Include site_id for the invoice site. |
group_actual_usage_by_resource |
boolean | No | Group generated actual-usage line items by resource. |
set_bill_to |
boolean | No | Use billing information from the source records when available. |
set_bill_to_account |
boolean | No | Use the account number from a source reservation when available. |
billing_period_start |
string | No | Billing period start date (YYYY-MM-DD). |
billing_period_end |
string | No | Billing period end date (YYYY-MM-DD). |
allow_empty |
boolean | No | Defaults to true. If false and no line items are generated, the API returns success without creating an invoice. |
Using actual_usage_ids or actual_usage_filter also requires actual usage editing permission.
Examples
Create an empty draft.
curl -X POST 'https://api.qreserve.com/sites/SITE_ID/invoices' \
-H 'Authorization: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{}'
Create a draft from a reservation and use its billing information where available.
{
"reservation_ids": [
"RESERVATION_ID"
],
"set_bill_to": true,
"allow_empty": false
}
Response
data contains the new draft invoice. The example is abbreviated. Use its invoice_id to update the draft.
{
"status": "success",
"data": {
"invoice_id": "INVOICE_ID",
"site_id": "SITE_ID",
"invoice_type": "invoice",
"status": "draft",
"active": true
}
}
See the Invoices API overview for shared IDs and permissions.