> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://bcdtravel.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://bcdtravel.ferndocs.com/_mcp/server.

# Cancel reservation

POST https://api.bcdtravel.com/{version}/hotels/cancel_reservation/

Cancels an active hotel reservation.

**Use case**

This endpoint can be used as part of your hotel booking application. The request initiates the cancellation process with the hotel, which can take a long time. In rare cases, the cancellation status can get stuck in an "in-progress" state, which should be handled by your application as an error.

**What's next?**

The `booking_uid` must be used to check the cancellation status via the `get_reservation_details` endpoint until it is fully completed, or an error is received.


Reference: https://bcdtravel.ferndocs.com/hotel/api-reference/hotel-api/hotels/cancel-reservation

## 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/cancel_reservation/"

headers = {"Authorization": "Signature your-signature-token"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.bcdtravel.com/version/hotels/cancel_reservation/';
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/cancel_reservation/"

	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/cancel_reservation/")

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<String> response = Unirest.post("https://api.bcdtravel.com/version/hotels/cancel_reservation/")
  .header("Authorization", "Signature your-signature-token")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.bcdtravel.com/version/hotels/cancel_reservation/', [
  'headers' => [
    'Authorization' => 'Signature your-signature-token',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.bcdtravel.com/version/hotels/cancel_reservation/");
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/cancel_reservation/")! 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()
```