curl --request POST \
--url https://api.gojinko.com/v1/hotel_cancel \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"booking_ref": "JNK-A0AUR2",
"booked_item_id": "itm_aaaaaaaaaaaaafhuxsdxpbzrbfz5hm3a",
"last_name": "Doe",
"provider_booking_id": "<string>",
"provider": "<string>",
"intent": {
"user_intent": "find a cheap flight to Tokyo"
}
}
'import requests
url = "https://api.gojinko.com/v1/hotel_cancel"
payload = {
"booking_ref": "JNK-A0AUR2",
"booked_item_id": "itm_aaaaaaaaaaaaafhuxsdxpbzrbfz5hm3a",
"last_name": "Doe",
"provider_booking_id": "<string>",
"provider": "<string>",
"intent": { "user_intent": "find a cheap flight to Tokyo" }
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
booking_ref: 'JNK-A0AUR2',
booked_item_id: 'itm_aaaaaaaaaaaaafhuxsdxpbzrbfz5hm3a',
last_name: 'Doe',
provider_booking_id: '<string>',
provider: '<string>',
intent: {user_intent: 'find a cheap flight to Tokyo'}
})
};
fetch('https://api.gojinko.com/v1/hotel_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://api.gojinko.com/v1/hotel_cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'booking_ref' => 'JNK-A0AUR2',
'booked_item_id' => 'itm_aaaaaaaaaaaaafhuxsdxpbzrbfz5hm3a',
'last_name' => 'Doe',
'provider_booking_id' => '<string>',
'provider' => '<string>',
'intent' => [
'user_intent' => 'find a cheap flight to Tokyo'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gojinko.com/v1/hotel_cancel"
payload := strings.NewReader("{\n \"booking_ref\": \"JNK-A0AUR2\",\n \"booked_item_id\": \"itm_aaaaaaaaaaaaafhuxsdxpbzrbfz5hm3a\",\n \"last_name\": \"Doe\",\n \"provider_booking_id\": \"<string>\",\n \"provider\": \"<string>\",\n \"intent\": {\n \"user_intent\": \"find a cheap flight to Tokyo\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gojinko.com/v1/hotel_cancel")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"booking_ref\": \"JNK-A0AUR2\",\n \"booked_item_id\": \"itm_aaaaaaaaaaaaafhuxsdxpbzrbfz5hm3a\",\n \"last_name\": \"Doe\",\n \"provider_booking_id\": \"<string>\",\n \"provider\": \"<string>\",\n \"intent\": {\n \"user_intent\": \"find a cheap flight to Tokyo\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gojinko.com/v1/hotel_cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"booking_ref\": \"JNK-A0AUR2\",\n \"booked_item_id\": \"itm_aaaaaaaaaaaaafhuxsdxpbzrbfz5hm3a\",\n \"last_name\": \"Doe\",\n \"provider_booking_id\": \"<string>\",\n \"provider\": \"<string>\",\n \"intent\": {\n \"user_intent\": \"find a cheap flight to Tokyo\"\n }\n}"
response = http.request(request)
puts response.read_body{
"booking_ref": "JNK-A0AUR2",
"booking_reference": "JNK-A0AUR2",
"confirmation_number": "<string>",
"status": "cancelled",
"operation": "svc_01J7ZR5Q2KME8V4T",
"state": "in_progress",
"refund_amount": {
"amount": 123,
"value": 41250,
"currency": "USD",
"decimal_places": 2,
"display": "USD 412.50"
},
"customer_refund_amount": {
"amount": 123,
"value": 41250,
"currency": "USD",
"decimal_places": 2,
"display": "USD 412.50"
},
"penalty_amount": {
"amount": 123,
"value": 41250,
"currency": "USD",
"decimal_places": 2,
"display": "USD 412.50"
},
"cancelled_at": "2026-06-01T12:34:56Z",
"idempotent": false
}{
"error": {
"code": "BAD_REQUEST",
"message": "Malformed JSON in request body.",
"doc_url": "https://docs.gojinko.com/concepts/errors"
}
}{
"error": {
"code": "AUTH_REQUIRED",
"message": "Invalid or expired API key.",
"doc_url": "https://docs.gojinko.com/authentication/api-keys"
}
}{
"error": {
"code": "PAYMENT_REQUIRED",
"message": "Insufficient balance — this call costs $0.0150 and your organization has $0.0000 available. Top up at https://dashboard.gojinko.com/developers/billing/topup",
"doc_url": "https://docs.gojinko.com/concepts/errors"
}
}{
"error": {
"code": "NOT_FOUND",
"message": "Resource not found.",
"doc_url": "https://docs.gojinko.com/concepts/errors"
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>",
"doc_url": "<string>",
"field": "selections[1].quantity"
}
}{
"error": {
"code": "GONE",
"message": "The resource no longer exists.",
"doc_url": "https://docs.gojinko.com/concepts/errors"
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "A required field is missing or invalid.",
"doc_url": "https://docs.gojinko.com/concepts/errors"
}
}{
"error": {
"code": "RATE_LIMITED",
"message": "Too many requests. Retry after the Retry-After delay.",
"doc_url": "https://docs.gojinko.com/concepts/errors"
}
}{
"error": {
"code": "UPSTREAM_REJECTED",
"message": "The request was declined for this offer. Try another offer.",
"doc_url": "https://docs.gojinko.com/concepts/errors"
}
}{
"error": {
"code": "UPSTREAM_UNAVAILABLE",
"message": "The service is temporarily unavailable. Retry after the Retry-After delay.",
"doc_url": "https://docs.gojinko.com/concepts/errors"
}
}{
"error": {
"code": "UPSTREAM_TIMEOUT",
"message": "The request timed out before a result was available. Retry the request.",
"doc_url": "https://docs.gojinko.com/concepts/errors"
}
}hotel-cancel
DEPRECATED, use /v1/hotel_cancel_preview and /v1/hotel_cancel_commit. Cancel a hotel booking and get a refund when eligible. Preview and commit in one call, POST /v1/hotel_cancel_preview plus /v1/hotel_cancel_commit is the two-step form, which shows the customer the refund before anything is cancelled. refund_amount is what the CUSTOMER gets back; all amounts are customer-facing only. Returning the money outlives this call: poll the operation handle with POST /v1/hotel_cancel_status. Every call here needs API authentication (an API key or a Bearer token); this is about which mode identifies the booking. Call get_booking first, then send booking_ref and the selected booked_item_id. Guests must send last_name; an owning credential may omit it. The deprecated provider, order_id, provider_reference and provider_booking_id are accepted until 2027-04-30 where the request declares them; a request that sends one is answered with Deprecation and Sunset headers.
curl --request POST \
--url https://api.gojinko.com/v1/hotel_cancel \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"booking_ref": "JNK-A0AUR2",
"booked_item_id": "itm_aaaaaaaaaaaaafhuxsdxpbzrbfz5hm3a",
"last_name": "Doe",
"provider_booking_id": "<string>",
"provider": "<string>",
"intent": {
"user_intent": "find a cheap flight to Tokyo"
}
}
'import requests
url = "https://api.gojinko.com/v1/hotel_cancel"
payload = {
"booking_ref": "JNK-A0AUR2",
"booked_item_id": "itm_aaaaaaaaaaaaafhuxsdxpbzrbfz5hm3a",
"last_name": "Doe",
"provider_booking_id": "<string>",
"provider": "<string>",
"intent": { "user_intent": "find a cheap flight to Tokyo" }
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
booking_ref: 'JNK-A0AUR2',
booked_item_id: 'itm_aaaaaaaaaaaaafhuxsdxpbzrbfz5hm3a',
last_name: 'Doe',
provider_booking_id: '<string>',
provider: '<string>',
intent: {user_intent: 'find a cheap flight to Tokyo'}
})
};
fetch('https://api.gojinko.com/v1/hotel_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://api.gojinko.com/v1/hotel_cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'booking_ref' => 'JNK-A0AUR2',
'booked_item_id' => 'itm_aaaaaaaaaaaaafhuxsdxpbzrbfz5hm3a',
'last_name' => 'Doe',
'provider_booking_id' => '<string>',
'provider' => '<string>',
'intent' => [
'user_intent' => 'find a cheap flight to Tokyo'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gojinko.com/v1/hotel_cancel"
payload := strings.NewReader("{\n \"booking_ref\": \"JNK-A0AUR2\",\n \"booked_item_id\": \"itm_aaaaaaaaaaaaafhuxsdxpbzrbfz5hm3a\",\n \"last_name\": \"Doe\",\n \"provider_booking_id\": \"<string>\",\n \"provider\": \"<string>\",\n \"intent\": {\n \"user_intent\": \"find a cheap flight to Tokyo\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gojinko.com/v1/hotel_cancel")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"booking_ref\": \"JNK-A0AUR2\",\n \"booked_item_id\": \"itm_aaaaaaaaaaaaafhuxsdxpbzrbfz5hm3a\",\n \"last_name\": \"Doe\",\n \"provider_booking_id\": \"<string>\",\n \"provider\": \"<string>\",\n \"intent\": {\n \"user_intent\": \"find a cheap flight to Tokyo\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gojinko.com/v1/hotel_cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"booking_ref\": \"JNK-A0AUR2\",\n \"booked_item_id\": \"itm_aaaaaaaaaaaaafhuxsdxpbzrbfz5hm3a\",\n \"last_name\": \"Doe\",\n \"provider_booking_id\": \"<string>\",\n \"provider\": \"<string>\",\n \"intent\": {\n \"user_intent\": \"find a cheap flight to Tokyo\"\n }\n}"
response = http.request(request)
puts response.read_body{
"booking_ref": "JNK-A0AUR2",
"booking_reference": "JNK-A0AUR2",
"confirmation_number": "<string>",
"status": "cancelled",
"operation": "svc_01J7ZR5Q2KME8V4T",
"state": "in_progress",
"refund_amount": {
"amount": 123,
"value": 41250,
"currency": "USD",
"decimal_places": 2,
"display": "USD 412.50"
},
"customer_refund_amount": {
"amount": 123,
"value": 41250,
"currency": "USD",
"decimal_places": 2,
"display": "USD 412.50"
},
"penalty_amount": {
"amount": 123,
"value": 41250,
"currency": "USD",
"decimal_places": 2,
"display": "USD 412.50"
},
"cancelled_at": "2026-06-01T12:34:56Z",
"idempotent": false
}{
"error": {
"code": "BAD_REQUEST",
"message": "Malformed JSON in request body.",
"doc_url": "https://docs.gojinko.com/concepts/errors"
}
}{
"error": {
"code": "AUTH_REQUIRED",
"message": "Invalid or expired API key.",
"doc_url": "https://docs.gojinko.com/authentication/api-keys"
}
}{
"error": {
"code": "PAYMENT_REQUIRED",
"message": "Insufficient balance — this call costs $0.0150 and your organization has $0.0000 available. Top up at https://dashboard.gojinko.com/developers/billing/topup",
"doc_url": "https://docs.gojinko.com/concepts/errors"
}
}{
"error": {
"code": "NOT_FOUND",
"message": "Resource not found.",
"doc_url": "https://docs.gojinko.com/concepts/errors"
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>",
"doc_url": "<string>",
"field": "selections[1].quantity"
}
}{
"error": {
"code": "GONE",
"message": "The resource no longer exists.",
"doc_url": "https://docs.gojinko.com/concepts/errors"
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "A required field is missing or invalid.",
"doc_url": "https://docs.gojinko.com/concepts/errors"
}
}{
"error": {
"code": "RATE_LIMITED",
"message": "Too many requests. Retry after the Retry-After delay.",
"doc_url": "https://docs.gojinko.com/concepts/errors"
}
}{
"error": {
"code": "UPSTREAM_REJECTED",
"message": "The request was declined for this offer. Try another offer.",
"doc_url": "https://docs.gojinko.com/concepts/errors"
}
}{
"error": {
"code": "UPSTREAM_UNAVAILABLE",
"message": "The service is temporarily unavailable. Retry after the Retry-After delay.",
"doc_url": "https://docs.gojinko.com/concepts/errors"
}
}{
"error": {
"code": "UPSTREAM_TIMEOUT",
"message": "The request timed out before a result was available. Retry the request.",
"doc_url": "https://docs.gojinko.com/concepts/errors"
}
}booking_ref and the hotel’s booked_item_id from get_booking. Omit booked_item_id only when the booking has exactly one hotel item.
- Guest verification: send
booking_refandlast_nametogether. - Authenticated owner: send
booking_refwith a credential that owns the booking;last_namemay be omitted.
Authorizations
Body
Jinko booking reference. Call get_booking first, then select its booked_item_id for servicing.
1"JNK-A0AUR2"
The booked item, from get_booking items[].booked_item_id. Preserved across exchanges. Omit only when the booking has exactly one item of the requested domain; otherwise a 409 returns items to choose from.
^itm_[a-z2-7]+$(?![\s\S])"itm_aaaaaaaaaaaaafhuxsdxpbzrbfz5hm3a"
Required for guest lookup. A credential that owns the booking may omit it; ownership is checked by the platform.
1"Doe"
Deprecated: name the booking with booking_ref and booked_item_id from get_booking. Names the booking instead of booking_ref and last_name, never beside it, and needs a credential that owns the booking. Accepted until 2027-04-30; a request that sends it is answered with Deprecation and Sunset headers.
1Deprecated: omit it. The platform uses the supplier recorded with the booking. Accepted until 2027-04-30; a request that sends it is answered with Deprecation and Sunset headers.
Show child attributes
Show child attributes
Response
Cancel a hotel booking and get a refund when eligible. Preview and commit in one call — POST /v1/hotel_cancel_preview plus /v1/hotel_cancel_commit is the two-step form, which shows the customer the refund before anything is cancelled. refund_amount is what the CUSTOMER gets back; all amounts are customer-facing only. Returning the money outlives this call: poll the operation handle with POST /v1/hotel_cancel_status. Every call here needs API authentication (an API key or a Bearer token); this is about which mode identifies the booking. Call get_booking first, then send booking_ref and the selected booked_item_id. Guests must send last_name; an owning credential may omit it. The deprecated provider, order_id, provider_reference and provider_booking_id are accepted until 2027-04-30 where the request declares them; a request that sends one is answered with Deprecation and Sunset headers.
"JNK-A0AUR2"
Deprecated: use booking_ref instead. Same value.
"JNK-A0AUR2"
Deprecated: read the item’s supplier_references on POST /v1/get_booking, which names who issued each reference. Customer-facing hotel confirmation number, when supplied by the hotel.
"cancelled"
The cancellation this call started ("svc_…"). Cancelling the booking at the supplier and returning the money are separate steps, so this call answering does not mean both finished — poll the handle with POST /v1/hotel_cancel_status until state is terminal.
"svc_01J7ZR5Q2KME8V4T"
Where the cancellation has got to. in_progress — running; keep polling. attention_required — stalled on something a person at Jinko has to resolve (reason names it); keep polling, and do not report it to the customer as a failure, because the booking may already be cancelled at the supplier. succeeded and failed are terminal: the supplier outcome and the money are both settled and nothing further will change.
in_progress, attention_required, succeeded, failed THE CUSTOMER FIGURE: what goes back to the payment method that paid for this booking — what the customer paid for it, less penalty_amount. Up to contract version 0.3.0 this field carried the SUPPLIER's net refund instead, which on a booking sold at a margin is a smaller number. Only customer-facing amounts are published. Absent when no refund was scheduled — absent is not zero.
Show child attributes
Show child attributes
Deprecated alias of refund_amount, carrying the same value. It existed because refund_amount used to be the supplier figure; now that refund_amount IS the customer figure the alias is redundant. Read refund_amount — this field is removed in the next contract version.
Show child attributes
Show child attributes
The cancellation penalty withheld from the customer, on the same basis as refund_amount: what they paid, less this, is what they get back. When unknown, the amount is omitted; a fee_known: false marker may remain.
- Option 1
- Option 2
Show child attributes
Show child attributes
"2026-06-01T12:34:56Z"
false
