Cancel a reservation
curl --request POST \
--url https://sandbox.travel.selfbook.com/rest/v1/reservation/{reservation_id}/cancel \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://sandbox.travel.selfbook.com/rest/v1/reservation/{reservation_id}/cancel"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://sandbox.travel.selfbook.com/rest/v1/reservation/{reservation_id}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.travel.selfbook.com/rest/v1/reservation/{reservation_id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox.travel.selfbook.com/rest/v1/reservation/{reservation_id}/cancel"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.travel.selfbook.com/rest/v1/reservation/{reservation_id}/cancel")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.travel.selfbook.com/rest/v1/reservation/{reservation_id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"check_in_date": "2024-05-20T00:00:00Z",
"check_out_date": "2024-05-25T00:00:00Z",
"confirmation": {
"hotel_confirmation_number": "CONFIRMATION_ID",
"record_locator": "LOCATOR_CODE"
},
"custom_data": {
"key": "value"
},
"created_at": "2024-05-20T18:00:00Z",
"guests": {
"number_of_adults": 1,
"number_of_children": 1,
"primary": {
"address": "123 Main Street Apt 152",
"city": "Miami",
"country": "US",
"email": "guest@somedomain.com",
"given_name": "John",
"surname": "Doe",
"telephone_number": "+13055551234",
"state": "FL",
"postal_code": "33123"
}
},
"hotel": {
"chain_code": "HI",
"name": "Holiday Inn",
"property_code": "E8597"
},
"id": "ZHPOGBXVQVFRVXXCHXRJATLEJWKNBERS",
"payment": {
"guest": {
"amount": 164.24,
"stripe": {
"customer": "cus_TestRce2zv5tRe",
"payment_method": "pm_Test5aAWTcmv4K1R71vVugBD"
},
"token": "01JKA2V3A58ZXN2EH5CK6B10AY"
},
"partner": {
"amount": 20,
"stripe": {
"customer": "cus_Test5R5ajq0MZH",
"payment_method": "pm_TestsWAWTcmv4K1ROuWIkGXP"
},
"token": "01JKA13A6TWPV9R4VPWBTAV4KS"
}
},
"rate": {
"booking_code": "2QN57JU",
"channel_code": "SBT1",
"number_of_rooms": 1,
"price": {
"base_price": 159,
"total_price": 184.24,
"total_taxes": 25.24,
"currency_code": "USD"
},
"terms": {
"guarantee_type": "DepositRequired",
"rate_payment_info": "PrePay",
"refundable": true,
"cancel_note": "Rate returned without cancel policy requires a rule request for complete information",
"cancel_penalties": [
{
"deadline_local": "2024-09-17T00:00:00-05:00",
"cancel_short_description": "An estimated cancellation fee of 177.44 USD applies starting from 2024-09-17T00:00-05:00[America/Chicago].",
"penalty": {
"estimated_amount": true,
"currency_amount": {
"amount": 177.44,
"currency": "USD"
},
"original_penalty_info": "100%"
}
}
]
}
},
"status": "CANCELED"
}{
"code": 2001,
"details": [
{
"message": "check_out_date is missing",
"field": [
"check_out_date"
]
}
],
"message": "Unable to process your request. Missing or invalid request parameters.",
"type": "VALIDATION"
}API Reference
Cancel Reservation
Cancels a reservation.
POST
/
rest
/
v1
/
reservation
/
{reservation_id}
/
cancel
Cancel a reservation
curl --request POST \
--url https://sandbox.travel.selfbook.com/rest/v1/reservation/{reservation_id}/cancel \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://sandbox.travel.selfbook.com/rest/v1/reservation/{reservation_id}/cancel"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://sandbox.travel.selfbook.com/rest/v1/reservation/{reservation_id}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.travel.selfbook.com/rest/v1/reservation/{reservation_id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox.travel.selfbook.com/rest/v1/reservation/{reservation_id}/cancel"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.travel.selfbook.com/rest/v1/reservation/{reservation_id}/cancel")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.travel.selfbook.com/rest/v1/reservation/{reservation_id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"check_in_date": "2024-05-20T00:00:00Z",
"check_out_date": "2024-05-25T00:00:00Z",
"confirmation": {
"hotel_confirmation_number": "CONFIRMATION_ID",
"record_locator": "LOCATOR_CODE"
},
"custom_data": {
"key": "value"
},
"created_at": "2024-05-20T18:00:00Z",
"guests": {
"number_of_adults": 1,
"number_of_children": 1,
"primary": {
"address": "123 Main Street Apt 152",
"city": "Miami",
"country": "US",
"email": "guest@somedomain.com",
"given_name": "John",
"surname": "Doe",
"telephone_number": "+13055551234",
"state": "FL",
"postal_code": "33123"
}
},
"hotel": {
"chain_code": "HI",
"name": "Holiday Inn",
"property_code": "E8597"
},
"id": "ZHPOGBXVQVFRVXXCHXRJATLEJWKNBERS",
"payment": {
"guest": {
"amount": 164.24,
"stripe": {
"customer": "cus_TestRce2zv5tRe",
"payment_method": "pm_Test5aAWTcmv4K1R71vVugBD"
},
"token": "01JKA2V3A58ZXN2EH5CK6B10AY"
},
"partner": {
"amount": 20,
"stripe": {
"customer": "cus_Test5R5ajq0MZH",
"payment_method": "pm_TestsWAWTcmv4K1ROuWIkGXP"
},
"token": "01JKA13A6TWPV9R4VPWBTAV4KS"
}
},
"rate": {
"booking_code": "2QN57JU",
"channel_code": "SBT1",
"number_of_rooms": 1,
"price": {
"base_price": 159,
"total_price": 184.24,
"total_taxes": 25.24,
"currency_code": "USD"
},
"terms": {
"guarantee_type": "DepositRequired",
"rate_payment_info": "PrePay",
"refundable": true,
"cancel_note": "Rate returned without cancel policy requires a rule request for complete information",
"cancel_penalties": [
{
"deadline_local": "2024-09-17T00:00:00-05:00",
"cancel_short_description": "An estimated cancellation fee of 177.44 USD applies starting from 2024-09-17T00:00-05:00[America/Chicago].",
"penalty": {
"estimated_amount": true,
"currency_amount": {
"amount": 177.44,
"currency": "USD"
},
"original_penalty_info": "100%"
}
}
]
}
},
"status": "CANCELED"
}{
"code": 2001,
"details": [
{
"message": "check_out_date is missing",
"field": [
"check_out_date"
]
}
],
"message": "Unable to process your request. Missing or invalid request parameters.",
"type": "VALIDATION"
}Authorizations
Basic authentication where:
- user-id is a partner account ID
- user-password is an API key token associated with the partner account
Path Parameters
id of the reservation
Response
OK
ISO 8601.
Example:
"2024-05-20T00:00:00Z"
ISO 8601.
Example:
"2024-05-25T00:00:00Z"
Show child attributes
Show child attributes
Custom data object. Returned only if included in CreateReservationRequest.
Show child attributes
Show child attributes
ISO 8601.
Example:
"2024-05-20T18:00:00Z"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
32-character alphanumeric Selfbook identifier.
Example:
"ZHPOGBXVQVFRVXXCHXRJATLEJWKNBERS"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Available options:
CANCELED, CONFIRMED, CREATED Example:
"CANCELED"
⌘I