Get an agreement or an invoice
Booking voucher, rental agreement and invoice as PDF, produced by the ERP’s engines.
Booking voucher, rental agreement, invoice: every document comes from the ERP’s engines — the workspace print templates for the voucher and the agreement, the documents engine for the invoice. The API rewrites nothing. Required key: rental_bookings:read.
1. Which documents exist?
The booking’s documents flags tell you:
curl 'https://quosuite.com/api/public/v1/quosuite/car-rental/bookings/9f8e7d6c-5b4a-4392-8170-6f5e4d3c2b1a' \
-H "Authorization: Bearer $QUOSUITE_API_KEY"| Document | Available… |
|---|---|
voucher — booking voucher | from creation, as long as the booking is neither cancelled nor expired |
contract — agreement | once the agreement exists: generation (POST …/contract), vehicle hand-over, or full-payment posting |
invoice — invoice | once linked to the booking by a first posting paid in full (documents.invoice) |
A down payment confirms the booking once amounts.due is reached and creates an advance on the reservation. It creates neither an invoice nor an agreement automatically. erp.posted: true can therefore coexist with documents.invoice: false: use the document flags before downloading.
Once an advance has been posted, later balance payments add receipts without automatically generating an agreement or invoice. Prepare the agreement through POST …/contract and invoice it in the ERP; its linked invoices can be read from GET /car-rental/contracts/{id}.
2. Generate the agreement
A pay-at-agency request has no agreement until it is prepared. To print it before the customer arrives:
POST/car-rental/bookings/{id}/contract
curl -X POST 'https://quosuite.com/api/public/v1/quosuite/car-rental/bookings/9f8e7d6c-5b4a-4392-8170-6f5e4d3c2b1a/contract' \
-H "Authorization: Bearer $QUOSUITE_API_KEY"The (draft) agreement is created from the booking — reused if it already exists: calling twice never creates two agreements. Preparing a request confirms it.
3. Download
GET /car-rental/bookings/{id}/documents/{kind} returns the PDF file itself (no JSON envelope):
GET/car-rental/bookings/{id}/documents/{kind}
curl 'https://quosuite.com/api/public/v1/quosuite/car-rental/bookings/9f8e7d6c-5b4a-4392-8170-6f5e4d3c2b1a/documents/contract' \
-H "Authorization: Bearer $QUOSUITE_API_KEY"GET/car-rental/bookings/{id}/documents/{kind}
curl 'https://quosuite.com/api/public/v1/quosuite/car-rental/bookings/9f8e7d6c-5b4a-4392-8170-6f5e4d3c2b1a/documents/invoice?lang=en' \
-H "Authorization: Bearer $QUOSUITE_API_KEY"lang (fr, en, ar) selects the language of the invoice and of the preset voucher; the agreement follows the language of its print template. A document not available yet answers 404 NOT_FOUND — check the status before writing the file.
4. The agreement and the invoice as data
The agreement can also be read as JSON — lines, frozen totals, mileage, deposit, linked invoices:
curl 'https://quosuite.com/api/public/v1/quosuite/car-rental/contracts/2a3b4c5d-6e7f-4801-9234-56789abcdef0' \
-H "Authorization: Bearer $QUOSUITE_API_KEY"The invoice is an ERP invoice like any other: the booking’s invoice.id is read through the sales resource (GET /sales/invoices/{id}, scope sales:read), with its payments and its PDF.