Create a booking
Book through the same journey as the rental website: driver, customer, hold, three payment modes, rejections.
POST /car-rental/bookings books a vehicle through the same journey as the rental website: what the API creates is exactly what a visitor would have created — module reservation, vehicle held, ERP customer, notice to the agency — with the API source.
Required key: rental_bookings:write (and payments:write for an already-collected booking). Plan: Car rental module (CAR_RENTAL); the Website module (RENTAL_WEBSITE) only if you name a site.
1. With or without a rental website
A website is not required. Without siteId, any active vehicle of the fleet can be booked, without paid options. With siteId, the API uses the website’s catalogue: the vehicle must be published on it (GET /car-rental/sites/{id}/vehicles) and its paid options become available.
In both cases the API channel settings apply — set in the application (Car rental › Settings › API booking) and readable here:
GET/car-rental/booking-settings
curl 'https://quosuite.com/api/public/v1/quosuite/car-rental/booking-settings' \
-H "Authorization: Bearer $QUOSUITE_API_KEY"| Setting | Effect |
|---|---|
enabled | booking through the API open or closed (BOOKING_DISABLED otherwise) |
payment | payment policy: pay when booking (total, % or fixed amount) or request accepted then payment link — § 3 |
payAtAgency | requests without payment (AGENCY) accepted in “pay when booking” mode |
holdMinutes, minLeadHours | payment hold duration, minimum lead time before pick-up |
agencyIds | branches open to the API (empty = all) |
cancellationPolicy | refund applied by default on cancellation |
notifyCustomer | does QuoSuite email the customer (acknowledgement, payment link, confirmation)? When false, pass paymentLink.url on yourself. |
2. Create
# One key per operation, reused as is on every retry.
curl -X POST 'https://quosuite.com/api/public/v1/quosuite/car-rental/bookings' \
-H "Authorization: Bearer $QUOSUITE_API_KEY" \
-H 'Idempotency-Key: 3f1c2a9e-5b7d-4e8a-9c1f-2d6b8e4a7c30' \
-H 'Content-Type: application/json' \
-d '{
"vehicleId": "0b3c5d7e-9f1a-4b2c-8d4e-6f7a8b9c0d1e",
"startAt": "2026-12-20T09:00:00Z",
"endAt": "2026-12-27T09:00:00Z",
"pickupAgencyId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"driver": {
"firstName": "Sami",
"lastName": "Ben Ali",
"email": "sami@example.tn",
"phone": "+216 20 000 000",
"birthDate": "1990-04-12",
"drivingLicenseNumber": "TN-123456",
"drivingLicenseIssuedAt": "2012-05-01",
"flightNumber": "TU 712"
},
"payment": {
"mode": "AGENCY"
},
"acceptTerms": true
}'What creation does, in order:
- Price recalculated by the module — an amount you send is never reused;
- minimum lead time and period checked, branches open to the channel;
- driver checked: required fields, minimum age, licence seniority and validity until return (Car Rental policy);
- ERP customer: the one in
customerId, otherwise found by the driver’s email (case-insensitive), otherwise created — its record is completed, never overwritten; - vehicle held: the module reservation and the online booking are created in one transaction, after an availability check under lock;
- depending on payment: request to the agency, payment link, or immediate posting.
3. The payment policy
payment.flow says how the workspace gets paid:
PAY_ON_BOOKING— payment when booking:onBookingis the total, a percentage or a fixed amount (deposit).rules.dueOnBookingfromPOST /car-rental/quotesgives the exact amount.REQUEST— the booking is a request: nothing is paid, the vehicle is held forrequestTtlHours(without an answer, the request expires). The agency — or you, through the API — accepts it by choosing the payment term, or refuses it.
payment.mode | When | What happens | Status |
|---|---|---|---|
AGENCY | REQUEST, or PAY_ON_BOOKING with payAtAgency | request: vehicle held, nothing is invoiced | REQUESTED |
ONLINE | PAY_ON_BOOKING | payment link for the deposit or the total (paymentLink.url), vehicle held holdMinutes | PENDING_PAYMENT |
PREPAID | always | already collected by you (total or deposit) | CONFIRMED |
What the payment produces in the ERP:
- Total: agreement, validated invoice and allocated payment, together.
- Deposit: booking confirmed, the deposit is an advance on the booking — no invoice; it follows the agreement and the agreement’s invoice allocates it. The balance (
amounts.balanceDue) is paid at the agency, or recorded withPOST …/payments.
After an advance has been posted, a balance payment adds a receipt; it does not automatically create an agreement or invoice. Prepare the agreement and invoice it in the ERP. Check documents.* rather than inferring document availability from erp.posted.
A PREPAID booking requires payment.reference; payment.amount defaults to the total and cannot exceed it (422 BUSINESS_RULE_VIOLATION, detail.rule: PAYMENT_AMOUNT_MISMATCH):
# One key per operation, reused as is on every retry.
curl -X POST 'https://quosuite.com/api/public/v1/quosuite/car-rental/bookings' \
-H "Authorization: Bearer $QUOSUITE_API_KEY" \
-H 'Idempotency-Key: 3f1c2a9e-5b7d-4e8a-9c1f-2d6b8e4a7c30' \
-H 'Content-Type: application/json' \
-d '{
"vehicleId": "0b3c5d7e-9f1a-4b2c-8d4e-6f7a8b9c0d1e",
"startAt": "2026-12-20T09:00:00Z",
"endAt": "2026-12-27T09:00:00Z",
"driver": {
"firstName": "Sami",
"lastName": "Ben Ali",
"email": "sami@example.tn",
"birthDate": "1990-04-12",
"drivingLicenseNumber": "TN-123456",
"drivingLicenseIssuedAt": "2012-05-01"
},
"payment": {
"mode": "PREPAID",
"reference": "PSP-778812",
"amount": 250,
"method": "CARD"
},
"acceptTerms": true
}'4. Accept or refuse a request
POST/car-rental/bookings/{id}/accept
# One key per operation, reused as is on every retry.
curl -X POST 'https://quosuite.com/api/public/v1/quosuite/car-rental/bookings/aac39e3a-0c40-44b2-8697-b597f357c5a9/accept' \
-H "Authorization: Bearer $QUOSUITE_API_KEY" \
-H 'Idempotency-Key: 3f1c2a9e-5b7d-4e8a-9c1f-2d6b8e4a7c30' \
-H 'Content-Type: application/json' \
-d '{
"term": {
"type": "PERCENT",
"value": 30
},
"deadlineHours": 48
}'term: FULL, PERCENT (value in %), FIXED (value in the workspace currency, capped at the total) or NONE (confirmed without payment, paid at the agency) — default: payment.onAcceptance. A payment link for that amount is issued (paymentLink) and sent to the customer; the vehicle stays held until holdExpiresAt (never past pick-up). Paid: CONFIRMED; otherwise EXPIRED, vehicle released.
The link opens the workspace’s payment page (online providers, bank transfer with proof): it works without a website.
POST/car-rental/bookings/{id}/refuse
# One key per operation, reused as is on every retry.
curl -X POST 'https://quosuite.com/api/public/v1/quosuite/car-rental/bookings/aac39e3a-0c40-44b2-8697-b597f357c5a9/refuse' \
-H "Authorization: Bearer $QUOSUITE_API_KEY" \
-H 'Idempotency-Key: 3f1c2a9e-5b7d-4e8a-9c1f-2d6b8e4a7c30' \
-H 'Content-Type: application/json' \
-d '{
"reason": "Vehicle out of service"
}'5. Refusals
| Status | detail.rule | Cause |
|---|---|---|
409 CONFLICT | UNAVAILABLE | vehicle taken between search and booking |
422 BUSINESS_RULE_VIOLATION | DRIVER_INVALID | driver refused — detail.problems says why (age, licence…) |
| 422 | PAYMENT_MODE | mode refused by the policy (ONLINE in request mode, AGENCY without payAtAgency) |
| 422 | BOOKING_DISABLED | booking through the API closed in the settings |
| 422 | LEAD_TIME | pick-up too soon (minimum lead time) |
| 422 | TERMS_REQUIRED | acceptTerms missing or false |
| 422 | AGENCY_REQUIRED, AGENCY_NOT_OFFERED, VEHICLE_NOT_AT_AGENCY | branch missing, not open to the channel, or not where the vehicle leaves from |
| 422 | OPTIONS_REQUIRE_SITE, UNKNOWN_OPTION | options without siteId; option outside the website’s catalogue |
| 422 | NOT_REQUESTED, PAYMENT_TERM, DEADLINE_TOO_SHORT | accept / refuse something other than a request; invalid term; pick-up too soon for a link |
422 BUSINESS_RULE_VIOLATION | PAYMENT_AMOUNT_MISMATCH | prepaid amount above the quote total, or later payment above the remaining balance |
409 CONFLICT | PAYMENT_REFERENCE_USED, ALREADY_PAID, NOT_PAYABLE | reference used on another booking, booking fully paid, or payment on a cancelled/expired booking |
403 API_MODULE_UNAVAILABLE | — | siteId without the Website module |
404 NOT_FOUND | — | unknown vehicle (or not published on the named website), unknown customer or website |
6. Next
A payment received elsewhere is recorded (POST …/payments, deposit or balance), the vehicle is handed over (POST …/pickup) then returned (POST …/return): see Track a booking.
- POST
/car-rental/bookingsCreate a booking - GET
/car-rental/booking-settingsAPI booking settings - POST
/car-rental/bookings/{id}/acceptAccept a request (payment term) - POST
/car-rental/bookings/{id}/refuseRefuse a request - GET
/car-rental/bookings/{id}Get a booking - GET
/car-rental/sitesRental websites - GET
/car-rental/sites/{id}/vehiclesVehicles published on a website - GET
/car-rental/optionsPaid options of a website - POST
/car-rental/customersCreate or find a rental customer