> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://bcdtravel.ferndocs.com/hotel/api-reference/hotel-api/hotels/book/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://bcdtravel.ferndocs.com/_mcp/server. # Book hotel POST https://api.bcdtravel.com/{version}/hotels/book/ Books a hotel room/rate. **Use case** This endpoint can be used on a reservation check-out page to allow users to book a hotel room/rate. The request creates a new passenger name record (PNR) in the GDS. The request will initiate the reservation process, which can take up to 3 minutes to process, depending on the hotel. If `pnr_id` is passed in the request, the reservation will be associated to that passenger name record (PNR) in the GDS. If not, a new PNR will be created. The response contains the `booking_uid`. **What's next?** The `booking_uid` in the response can be used to get reservation details via the `get_reservation_details` endpoint, and must be used to check the reservation status until it is fully completed, or an error is received. Reference: https://bcdtravel.ferndocs.com/hotel/api-reference/hotel-api/hotels/book ## Request ### Path parameters - `version` (string, required) ### Headers - `Authorization` (string, optional) — Request signature for authentication. Format: Signature YOUR_SIGNATURE. Calculated using HMAC-SHA256 with your secret key. ## Examples **SDK Code** ```python import requests url = "https://api.bcdtravel.com/version/hotels/book/" headers = {"Authorization": "Signature your-signature-token"} response = requests.post(url, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.bcdtravel.com/version/hotels/book/'; const options = {method: 'POST', headers: {Authorization: 'Signature your-signature-token'}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.bcdtravel.com/version/hotels/book/" req, _ := http.NewRequest("POST", url, nil) req.Header.Add("Authorization", "Signature your-signature-token") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.bcdtravel.com/version/hotels/book/") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Signature your-signature-token' response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.bcdtravel.com/version/hotels/book/") .header("Authorization", "Signature your-signature-token") .asString(); ``` ```php request('POST', 'https://api.bcdtravel.com/version/hotels/book/', [ 'headers' => [ 'Authorization' => 'Signature your-signature-token', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.bcdtravel.com/version/hotels/book/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Signature your-signature-token"); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Authorization": "Signature your-signature-token"] let request = NSMutableURLRequest(url: NSURL(string: "https://api.bcdtravel.com/version/hotels/book/")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```