> For the complete documentation index, see [llms.txt](https://apidocs.mytravellerschoice.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.mytravellerschoice.com/hotel-booking-api/booking-api/booking-apis/create-a-booking-api.md).

# Create a Booking -  API

At this stage, you will create and confirm the booking.

## API details

<mark style="color:green;">`POST`</mark> `/api/v1/hotel/booking-api/booking/create-booking`

**Headers**

| Name            | Value              |
| --------------- | ------------------ |
| Content-Type    | `application/json` |
| Authorization   | `Bearer <token>`   |
| Accept-Encoding | `gzip`             |

**Body**

<table><thead><tr><th width="210">Name</th><th width="101">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>hotelId</code></td><td>Integer</td><td>HotelId</td></tr><tr><td><code>tokenNumber</code></td><td>String</td><td>Unique code for an availability request received from availability response.</td></tr><tr><td><code>rateKey</code></td><td>String</td><td>Unique key of the specific room received from availability response</td></tr><tr><td><code>fromDate</code></td><td>String</td><td>checkin date</td></tr><tr><td><code>toDate</code></td><td>String</td><td>checkout date</td></tr><tr><td><code>noOfAdults</code></td><td>Integer</td><td>No of adults in a room</td></tr><tr><td><code>noOfChildren</code></td><td>Integer</td><td>No of children in a room</td></tr><tr><td><code>childrenAges</code></td><td>Array</td><td>Age of each children in a room </td></tr><tr><td><code>nationality</code></td><td>String</td><td>nationality of the guest</td></tr><tr><td><code>travellerDetails</code></td><td>Array</td><td>roomId<br>title<br>firstName<br>lastName<br>type: adult/child</td></tr></tbody></table>

<details>

<summary>Sample Request</summary>

```json
{
    "hotelId": 112,
    "rateKey": "40221e490acbd10955a41d128029a56e",
    "tokenNumber": "RA_1728413337142",
    "fromDate": "2024-10-17",
    "toDate": "2024-10-20",
    "rooms": [
        {
            "noOfAdults": 1,
            "noOfChildren": 0,
            "childrenAges": []
        }
    ],
    "nationality": "IN",
    "travellerDetails": [
        {
            "roomId": 1,
            "title": "Mr",
            "firstName": "First Name",
            "lastName": "Last Name",
            "type": "adult"
        }
    ]
}
```

</details>

### Response details

<table><thead><tr><th width="222">Name</th><th width="93">Type</th><th>Description</th></tr></thead><tbody><tr><td>referenceNumber</td><td>String</td><td>Unique code for a booking</td></tr><tr><td>hotelBookingConfNo</td><td>String</td><td>Booking Confirmation number from hotel</td></tr><tr><td>status</td><td>String</td><td>booking status</td></tr><tr><td>message</td><td>String</td><td>message for booking </td></tr></tbody></table>

<details>

<summary>Sample Response </summary>

```json
{
    "success": true,
    "data": {
        "status": "confirmed",
		"referenceNumber": "B2BHOT_1728453656963",
		"hotelBookingConfNo": "1_238-2536737_1",
        "message": "confirmed Succesfully",      
    }
}
```

</details>

#### Types of status

<table><thead><tr><th width="149">Value</th><th>Description</th></tr></thead><tbody><tr><td>confirmed</td><td>This status indicates that your order is confirmed by the hotel. You will receive hotel Booking Confirmation Number in the response</td></tr><tr><td>booked</td><td>This status indicates that your order is confirmed by the supplier, but the hotel confirmation is pending. You will not receive hotel Booking Confirmation Number at this stage. Once the hotel confirms the booking, we will send you a Webhook with necessary data. please refer to the Webhook section for more details.</td></tr></tbody></table>
