Create booking

Bookings

post/api/v5/bookings/{pcode}x-api-key

Create one or more bookings for a property in a single call. Every entry of rooms becomes its own booking, so a request for a double and a single creates two bookings and the response carries two ids, in the same order as they were sent. Availability is checked before the bookings are written: if any of the requested rooms is not available for the date range, the whole request is rejected with 409 roomsNotAvailable and nothing is created. The one exception is a booking that says where it was already sold — settings.otaId or settings.locator sent: it is not checked and is written even over a full night, because refusing it would lose a sale that already happened elsewhere; the overbooking is left to the property. Room types and their ids come from GET /api/rooms/{pcode}/types, and availability from GET /api/v2/rooms/{pcode}/availability. Send an Idempotency-Key header to make retries safe: if the answer is lost (a timeout, a dropped connection), repeating the same request with the same key never creates the bookings twice — it answers 409 creationInProgress while the first request is still running and the same ids once it has finished. Reusing a key with a different body answers 422 idempotencyKeyReused. When the bookings could not be stored and none was created, the answer is 409 legacyWriteFailed with fault: dependency: the same request may be sent again, except that a holder company sent as new was already created, so it has to be sent as an existing one.

Console

Runs against the API from your browser, with the same request your server will send.

Environment

Production

https://uni-api.hotelgest.com

Calls hit live data with your own API key. A POST, PUT, PATCH or DELETE here changes a real property.

Credentials

The API key, sent on every request. A property admin creates it in the PMS under Settings → API keys; a partner receives one per property when the property activates its integration. It works only for the property it was issued for, and only on the endpoints granted to it.

This endpoint needs a credential. Without it you will get a 401.

Stored in this browser only. Never sent anywhere but the API host above.

Path parameters

Headers

Body

Arm production

Writing methods are locked until you arm them. This is live hotel data.

POST is locked on production. Arm it above if you mean it.

posthttps://uni-api.hotelgest.com/api/v5/bookings/123456

Send the request to see the real response here.

Nothing is mocked. What comes back is what the API returned.

Requests go straight from your browser to the API host above — nothing is proxied through this site.

Path parameters

pcode
number

Property code. Identifies the property (hotel, apartment building, hostel) the request applies to. It must match the property your API key was issued for.

Request body

Dates

Booking dates

Host

Host information

Room[]

Rooms information

Settings

Settings information

Product[]

Products information

groupId
number

Group ID

segmentIds
number[]

Market segment ids to attach

segmentApplyScope
enumDeprecated

Deprecated and ignored. segmentIds always apply to the reservation.

One of:bookingcustomerboth

packId
number

Pack/Promotion ID (code_pack)

Example
1{
2 "date": {
3 "from": "2024-12-20",
4 "to": "2024-12-25"
5 },
6 "host": {
7 "name": "John",
8 "surname": "Doe",
9 "phone": "+1 234 567 8900",
10 "email": "john.doe@example.com",
11 "documentType": "D",
12 "sex": {},
13 "documentNumber": "12345678A",
14 "city": "Cityville",
15 "address": "123 Main St.",
16 "postalCode": "12345",
17 "country": "Countryland",
18 "province": "Provinceland",
19 "notes": "Some notes about the booking",
20 "customerType": "particular",
21 "companyId": 123,
22 "isNewCompany": true,
23 "company": {
24 "name": "Company Ltd.",
25 "documentNumber": "123456789",
26 "phone": "+1 234 567 8900",
27 "address": "123 Main St.",
28 "city": "Cityville",
29 "postalCode": "12345",
30 "country": "Countryland",
31 "province": "Provinceland"
32 },
33 "language": "en"
34 },
35 "rooms": [
36 {
37 "boardId": "hb",
38 "politicId": "4",
39 "pax": "2",
40 "adults": 2,
41 "children": 1,
42 "babies": 0,
43 "rtcode": "11111",
44 "rcode": "22222",
45 "ancillary": {
46 "2025-01-01": 100
47 },
48 "ancillaryWithDiscount": {
49 "2025-01-01": 80
50 },
51 "promoCode": "PROMO-123",
52 "promoCodeManual": {
53 "isActive": true,
54 "type": "fbn",
55 "value": 20.5
56 }
57 }
58 ],
59 "settings": {
60 "tentative": {
61 "isActive": true,
62 "releaseDateTentative": "2025-01-01"
63 },
64 "hidePrices": false,
65 "sendEmail": true,
66 "locator": "ABC123",
67 "otaId": 1,
68 "arrivalHour": "15:00",
69 "departureHour": "18:00",
70 "requestNotes": "Please prepare a crib for the baby.",
71 "internalNotes": "Internal notes about the booking"
72 },
73 "products": [
74 {
75 "id": 1,
76 "quantity": 1,
77 "start": "2024-12-20",
78 "end": "2024-12-25",
79 "startTime": "14:00",
80 "endTime": "16:00",
81 "tax": 10.5,
82 "price": 100,
83 "name": "Sample Product",
84 "description": "This is a sample product description.",
85 "discountType": "p",
86 "discountValue": 15,
87 "discountCalculated": 15,
88 "productType": "pbd",
89 "accounting": 12,
90 "experticket": {
91 "productId": "idft1of16amcg",
92 "sessionId": "string",
93 "saleKey": "3f9c0a7d12e44b6a",
94 "answers": [
95 {
96 "profileId": "5df8t6ku41djh",
97 "level": "ticket",
98 "ticketId": "string",
99 "questionId": "nr1k8sehrno3a",
100 "value": "string"
101 }
102 ]
103 }
104 }
105 ],
106 "groupId": 123,
107 "segmentIds": [
108 1
109 ],
110 "segmentApplyScope": "booking",
111 "packId": 456
112}

Responses

Ok. If your API key answers encrypted — every key issued now does, and every partner credential — this body arrives as the encryption envelope ({ crypto, protected, wrappedKey, iv, payload, tag }, a compact JWE), and the schema below is what its payload decrypts to. See https://public-api.hotelgest.com/public/guides/encryption

id
number

ID of the created booking. Use it against the booking endpoints (GET /api/bookings/{pcode}/detail/{bookingId})

Example response
1[
2 {
3 "id": 789
4 }
5]

What is a pcode?

The property code. Every endpoint is scoped to one property, and your API key only works for the property it was issued for.

Retries

Send an Idempotency-Key header when you create bookings: a retry with the same key never creates the booking twice.

Rate limits

100 requests per minute per source IP, 120 per API key and 300 per property, each counted across every endpoint together — not per endpoint. Over any of them you get a 429 with the seconds to wait in Retry-After-<limit> (apikey-ip, apikey or apikey-pcode): stop and wait it out. Repeat offences on a key or a property are blocked for longer each time, up to 7 days.