### Go example Source: https://docs.gojinko.com/api/trip/ancillaries Go example using net/http to GET the ancillaries endpoint. Prints the response body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.gojinko.com/v1/trip/{trip_id}/ancillaries" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("X-API-Key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } ``` -------------------------------- ### Ruby example Source: https://docs.gojinko.com/api/trip/ancillaries Ruby example using net/http to GET the ancillaries endpoint. Prints the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api.gojinko.com/v1/trip/{trip_id}/ancillaries") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["X-API-Key"] = '' response = http.request(request) puts response.read_body ``` -------------------------------- ### Go example for hotel details Source: https://docs.gojinko.com/api/hotel-details Uses net/http to send a GET request with an API key header and prints the response body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.gojinko.com/v1/hotel_details/{hotel_id}" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("X-API-Key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } ``` -------------------------------- ### Go net/http GET webhook Source: https://docs.gojinko.com/api/webhooks/get Go example using net/http to GET a webhook subscription. Adds the X-API-Key header and prints the response body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.gojinko.com/v1/webhooks/{id}" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("X-API-Key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } ``` -------------------------------- ### List webhooks with net/http (Go) Source: https://docs.gojinko.com/api/webhooks/list Go example using net/http to GET /v1/webhooks with an X-API-Key header. Replace with your API key. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.gojinko.com/v1/webhooks" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("X-API-Key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } ``` -------------------------------- ### Quick start with createJinkoClient and flightCalendar Source: https://docs.gojinko.com/connect/sdk Shows the minimal setup for creating a client and calling the flightCalendar method. Uses an API key and returns itineraries. ```javascript import { createJinkoClient } from '@gojinko/api-client' const client = await createJinkoClient({ apiKey: 'jnk_t_...' }) const { itineraries } = await client.flightCalendar({ origins: ['JFK'], destinations: ['CDG'], origin_type: 'airport', destination_type: 'airport', trip_type: 'oneway', departure_dates: ['2027-06-15'], }) ``` -------------------------------- ### List webhooks with net/http (Ruby) Source: https://docs.gojinko.com/api/webhooks/list Ruby example using net/http to GET /v1/webhooks with an X-API-Key header. Replace with your API key. ```ruby require 'uri' require 'net/http' url = URI("https://api.gojinko.com/v1/webhooks") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["X-API-Key"] = '' response = http.request(request) puts response.read_body ``` -------------------------------- ### Go GET /v1/destination Source: https://docs.gojinko.com/api/destination Go example using net/http to call the destination endpoint. Requires an API key in the X-API-Key header. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.gojinko.com/v1/destination" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("X-API-Key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } ``` -------------------------------- ### List webhooks with fetch (JavaScript) Source: https://docs.gojinko.com/api/webhooks/list JavaScript example using fetch to GET /v1/webhooks with an X-API-Key header. Replace with your API key. ```javascript const options = {method: 'GET', headers: {'X-API-Key': ''}}; fetch('https://api.gojinko.com/v1/webhooks', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); ``` -------------------------------- ### Go net/http request to market endpoint Source: https://docs.gojinko.com/api/market Go example using net/http to call the market endpoint. Creates a GET request with the X-API-Key header and prints the response body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.gojinko.com/v1/market?limit=20" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("X-API-Key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } ``` -------------------------------- ### Hotel search destination and occupancy examples Source: https://docs.gojinko.com/tools/hotel-search Five destination and occupancy examples for the hotel search tool. Each example is a JSON object for the destination and occupancy parameters; add checkin and checkout for the user's actual stay. Example 1 is a free-text city search. Example 2 is a two-room family with kids. Example 3 is an island/region search using lat-lng + radius. Example 4 is a geo-radius search around a POI. Example 5 is Mode A, where the user named a specific hotel. ```json { "destination": { "query": "Paris" }, "adults": 2 } ``` ```json { "destination": { "city_name": "Barcelona", "country_code": "es" }, "occupancies": [{ "adults": 2 }, { "adults": 1, "children_ages": [5, 7] }] } ``` ```json { "destination": { "latitude": 39.9496, "longitude": 4.1102, "radius_km": 30 }, "adults": 1 } ``` ```json { "destination": { "latitude": 41.4036, "longitude": 2.1744, "radius_km": 3 }, "adults": 2 } ``` ```json { "destination": { "hotel_name": "Hotel Calimala", "country_code": "it", "city_name": "Florence" }, "adults": 2, "currency": "EUR" } ``` -------------------------------- ### Example: jinko exchange shop with booking reference Source: https://docs.gojinko.com/cli/exchange/shop Example command that shops for flight exchange alternatives. Requires --booking-ref; --last-name is needed for guest lookup. Returns alternative itineraries with offer_id values, which you then pass to jinko exchange price. ```bash jinko exchange shop \ --booking-ref JNK-ABC123 \ --last-name Doe \ --preferred-departure-date 2027-07-15 ``` -------------------------------- ### GET /v1/bookings/{booking_ref} Source: https://docs.gojinko.com/api-reference/public-api.yaml Retrieves booking details by reference, including calendar files. ```APIDOC ## GET /v1/bookings/{booking_ref} ### Description Retrieves the details of a booking by its Jinko booking reference. The response includes the booking reference, status, type, last name, total paid, items, and calendar files. ### Method GET ### Endpoint /v1/bookings/{booking_ref} ### Parameters #### Path Parameters - **booking_ref** (string) - Required - The Jinko booking reference of the booking to retrieve. ### Response #### Success Response (200) - **booking** (object) - The booked trip details. - **booking_reference** (string) - The Jinko booking reference. - **status** (string) - The booking status (e.g., confirmed). - **type** (string) - What was booked: "flight" or "hotel". - **last_name** (string) - The last name on the booking. - **total_paid** (object) - The total amount paid, with amount, currency, and decimal_places. - **items** (array) - List of booking items, each with confirmation details. - **can_refund** (boolean) - Deprecated: OR aggregate over items[].servicing.can_refund. - **can_void** (boolean) - Deprecated: OR aggregate over items[].servicing.can_void. - **can_exchange** (boolean) - Deprecated: OR aggregate over items[].servicing.can_exchange. - **refund_support_level** (string) - Deprecated: Use items[].servicing.refund_support_level. - **exchange_support_level** (string) - Deprecated: Use items[].servicing.exchange_support_level. - **created_at** (string) - The creation timestamp. - **calendar** (object) - Calendar entries as iCalendar files, absent when no flight/hotel. #### Response Example ```json { "booking": { "booking_reference": "JNK-A0AUR2", "status": "confirmed", "type": "flight", "last_name": "Doe", "total_paid": { "amount": 31840, "currency": "USD", "decimal_places": 2 }, "created_at": "2026-05-20T09:14:00Z", "calendar": { "files": [] } } } ``` ``` -------------------------------- ### Go net/http example for flight_refund_preview Source: https://docs.gojinko.com/api/flight-refund-preview Go example using net/http to POST to the flight refund preview endpoint. Prints the response body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.gojinko.com/v1/flight_refund_preview" payload := strings.NewReader("{\n \"booking_ref\": \"JNK-A0AUR2\",\n \"last_name\": \"Doe\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-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)) } ``` -------------------------------- ### Successful response example for GET /v1/audience/trend Source: https://docs.gojinko.com/api/audience/trend Example JSON response with series data and summary metrics. ```json { "granularity": "week", "from": "2026-06-19", "to": "2026-06-25", "series": [ { "series": [ { "date": "2026-06-20", "value": 1234 } ], "label": "FR", "origin": "Country:US", "destination": "Country:FR", "summary": { "total": 34567, "avg_per_day": 1191, "growth_pct": 12.3, "peak_date": "2026-06-14", "peak_value": 1890 } } ] } ``` -------------------------------- ### GET /health Source: https://docs.gojinko.com/api-reference/public-api.yaml Health check endpoint to verify service availability. ```APIDOC ## GET /health ### Description Service health check endpoint. ### Method GET ### Endpoint /health ### Response #### Success Response (200) - Service is up ``` -------------------------------- ### Java Unirest example Source: https://docs.gojinko.com/api/trip/ancillaries Java example using Unirest to GET the ancillaries endpoint. Returns the response as a string. ```java HttpResponse response = Unirest.get("https://api.gojinko.com/v1/trip/{trip_id}/ancillaries") .header("X-API-Key", "") .asString(); ``` -------------------------------- ### GET /quotes/{quote_id} Source: https://docs.gojinko.com/api-reference/public-api.yaml Retrieves a cancellation quote for a booked item. The quote provides the customer refund figure, penalty, and policy details. The quote is binding until `expires_at`. ```APIDOC ## GET /quotes/{quote_id} ### Description Retrieves a cancellation quote for a booked item. The quote provides the customer refund figure, penalty, and policy details. The quote is binding until `expires_at`. ### Method GET ### Endpoint `/quotes/{quote_id}` ### Parameters #### Path Parameters - **quote_id** (string) - Required - The unique identifier of the quote. ### Response #### Success Response (200) - **status** (string) - The status of the quote. Possible values: `completed` (figures are final until `expires_at`). - **commitable** (boolean) - Whether a commit against this quote would be accepted right now. When false, `not_commitable_reason` says why. - **support_level** (ServicingSupportLevel) - The support level for the quote. - **manual_reason** (string) - Why a person has to act, in the supplier's terms. Present with `support_level: MANUAL_REQUIRED`. - **expires_at** (string) - When this quote stops binding. Committing after it answers 409 `quote_expired`. - **item** (string) - The booked item this quote would cancel ("itm_..."). - **refund** (object) - The customer figure: what would go back to the payment method. Contains `basis` (string) - how the figure was computed (`sell_minus_penalty` or `original_charge`). - **penalty** (object) - What the customer would forfeit. Contains `fee_known` (boolean) - false means the penalty could not be established (UNKNOWN, not zero). - **policy** (object) - The supplier's cancellation policy. Contains `free_cancel_until` (string, nullable) - last instant at which cancelling costs nothing; `is_refundable_now` (boolean); `tiers` (array) - policy steps in time order, each with `from` (string), `amount` (Money), `fraction` (number). - **provider_figures** (ProviderFigures) - Provider-specific figures. - **not_commitable_reason** (string) - Why `commitable` is false. Possible values: `penalty_exceeds_sell`, `multi_currency_basis`. #### Response Example ```json { "status": "completed", "commitable": true, "support_level": "AUTOMATED", "manual_reason": null, "expires_at": "2026-09-03T12:15:00Z", "item": "itm_7f2c9a4e8b1d", "refund": { "amount": 100.00, "currency": "USD", "basis": "sell_minus_penalty" }, "penalty": { "amount": 50.00, "currency": "USD", "fee_known": true }, "policy": { "free_cancel_until": "2026-09-01T00:00:00Z", "is_refundable_now": true, "tiers": [ { "from": "2026-09-01T00:00:00Z", "amount": {"amount": 0, "currency": "USD"}, "fraction": 0.5 } ] }, "provider_figures": {}, "not_commitable_reason": null } ``` ``` -------------------------------- ### Go net/http example for exchange_shop Source: https://docs.gojinko.com/api/exchange/shop Go example using net/http to call the exchange shop endpoint. Prints the response body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.gojinko.com/v1/exchange_shop" payload := strings.NewReader("{\n \"booking_ref\": \"JNK-A0AUR2\",\n \"last_name\": \"Doe\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-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)) } ``` -------------------------------- ### PHP cURL example Source: https://docs.gojinko.com/api/trip/ancillaries PHP example using cURL to GET the ancillaries endpoint. Outputs the response or a cURL error. ```php "https://api.gojinko.com/v1/trip/{trip_id}/ancillaries", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "X-API-Key: " ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } ``` -------------------------------- ### Python requests GET webhook Source: https://docs.gojinko.com/api/webhooks/get Python example using the requests library to GET a webhook subscription. Requires the X-API-Key header. ```python import requests url = "https://api.gojinko.com/v1/webhooks/{id}" headers = {"X-API-Key": ""} response = requests.get(url, headers=headers) print(response.text) ``` -------------------------------- ### Install @gojinko/api-client Source: https://docs.gojinko.com/connect/sdk Installs the SDK. Requires Node.js >= 20 and ESM-only projects. ```bash npm install @gojinko/api-client ``` -------------------------------- ### Go net/http example for hotel cancel preview Source: https://docs.gojinko.com/api/hotel-cancel-preview Go example using the standard net/http library to POST the booking reference and last name to the hotel cancel preview endpoint. Prints the response body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.gojinko.com/v1/hotel_cancel_preview" payload := strings.NewReader("{\n \"booking_ref\": \"JNK-H1ZK90\",\n \"last_name\": \"Doe\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-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)) } ``` -------------------------------- ### JavaScript fetch example Source: https://docs.gojinko.com/api/trip/ancillaries JavaScript example using fetch to GET the ancillaries endpoint. Logs the response JSON or error to the console. ```javascript const options = {method: 'GET', headers: {'X-API-Key': ''}}; fetch('https://api.gojinko.com/v1/trip/{trip_id}/ancillaries', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); ``` -------------------------------- ### JavaScript fetch GET webhook Source: https://docs.gojinko.com/api/webhooks/get JavaScript fetch example to GET a webhook subscription. Uses the X-API-Key header and logs the JSON response. ```javascript const options = {method: 'GET', headers: {'X-API-Key': ''}}; fetch('https://api.gojinko.com/v1/webhooks/{id}', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); ``` -------------------------------- ### Go net/http example for exchange_shop Source: https://docs.gojinko.com/api/exchange/shop Go example using net/http to call the exchange_shop endpoint. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.gojinko.com/v1/exchange_shop" payload := strings.NewReader("{\n \"booking_ref\": \"JNK-A0AUR2\",\n \"last_name\": \"Doe\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-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)) } ``` -------------------------------- ### Initiate refund with Go net/http Source: https://docs.gojinko.com/api/refund/commit Go example using the standard net/http library to initiate a refund. Sends a POST request with the booking reference and last name, and prints the response body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.gojinko.com/v1/refund_commit" payload := strings.NewReader("{\n \"booking_ref\": \"JNK-A0AUR2\",\n \"last_name\": \"Doe\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-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)) } ``` -------------------------------- ### Python requests example Source: https://docs.gojinko.com/api/trip/ancillaries Python example using the requests library to GET the ancillaries endpoint. Requires the requests library and an API key. ```python import requests url = "https://api.gojinko.com/v1/trip/{trip_id}/ancillaries" headers = {"X-API-Key": ""} response = requests.get(url, headers=headers) print(response.text) ``` -------------------------------- ### jinko config set examples Source: https://docs.gojinko.com/cli/config/set Two example invocations: one switches the active environment to sandbox, the other stores an API key under the active environment. The environment key accepts prod or sandbox. ```bash # Switch the active environment (prod | sandbox) jinko config set environment sandbox # Store an API key under the active environment jinko config set api_key jnk_sandbox_t_your_key ``` -------------------------------- ### Java Unirest GET webhook Source: https://docs.gojinko.com/api/webhooks/get Java example using Unirest to GET a webhook subscription. Sets the X-API-Key header and returns the response as a string. ```java HttpResponse response = Unirest.get("https://api.gojinko.com/v1/webhooks/{id}") .header("X-API-Key", "") .asString(); ``` -------------------------------- ### jinko auth status example with output Source: https://docs.gojinko.com/cli/auth/status Example of running jinko auth status. The output shows authentication details including environment, method, token, and source. ```bash jinko auth status # → authenticated: true # environment: prod # method: api_key # token: jnk_t_...ab12 # source: config ``` -------------------------------- ### PHP cURL GET webhook Source: https://docs.gojinko.com/api/webhooks/get PHP cURL example to GET a webhook subscription. Sets the X-API-Key header and prints the response or a cURL error. ```php "https://api.gojinko.com/v1/webhooks/{id}", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "X-API-Key: " ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } ``` -------------------------------- ### jinko config show example Source: https://docs.gojinko.com/cli/config/show Example of running `jinko config show` to display the current configuration file `~/.jinko/config.yaml` with secrets masked. ```bash jinko config show # Dumps the current ~/.jinko/config.yaml (secrets masked) ``` -------------------------------- ### Go net/http example for selecting ancillaries Source: https://docs.gojinko.com/api/select-ancillaries Go example using net/http to POST a selection of a 20kg baggage ancillary. Prints the response body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.gojinko.com/v1/select_ancillaries" payload := strings.NewReader("{\n \"trip_id\": \"trip_1048576\",\n \"item_id\": \"itm_4b91c2\",\n \"selections\": [\n {\n \"offer_id\": \"anc_bag_20kg\",\n \"category\": \"baggage\",\n \"quantity\": 1\n }\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-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)) } ``` -------------------------------- ### GET /v1/trip/{trip_id} Source: https://docs.gojinko.com/api/trip-status This snippet documents the GET /v1/trip/{trip_id} endpoint, including its purpose, parameters, request example, response schema, and error responses. ```APIDOC ## GET /v1/trip/{trip_id} ### Description Fetch the full lifecycle state of a trip — items, travelers, quote, fulfillment, and any booking references. ### Method GET ### Endpoint https://api.gojinko.com/v1/trip/{trip_id} ### Parameters #### Path Parameters - **trip_id** (string) - Required - The unique identifier of the trip. #### Headers - **X-API-Key** (string) - Required - API key for authentication. ### Request Example ``` curl --request GET \ --url https://api.gojinko.com/v1/trip/{trip_id} \ --header 'X-API-Key: ' ``` ### Response #### Success Response (200) - **trip_id** (string) - The unique identifier of the trip. - **payment_attempt** (object) - Payment attempt details. - **status** (string) - Current status of the trip. - **travelers** (array) - List of travelers. - **contact** (object) - Contact information. - **items** (array) - List of trip items. #### Response Example ``` { "trip_id": "trip_1048576", "payment_attempt": { "payment_attempt_id": "", "trip_id": "", "quoted_cart_id": 123, "payment_status": "not_started", "booking_status": "", "payment_error": { "code": "credential_format_invalid", "message": "" }, "recovery": { "action": "poll", "replacement_credential_required": true }, "recovery_status": "automatic", "fulfillment_cart_id": 123, "booking_ref": "", "quote_expires_at": "2023-11-07T05:31:56Z", "retry_after_seconds": 123, "authentication": { "url": "", "expires_at": "2023-11-07T05:31:56Z" }, "money": { "authorized": { "amount": 123, "value": 41250, "currency": "USD", "decimal_places": 2, "display": "USD 412.50" }, "captured": { "amount": 123, "value": 41250, "currency": "USD", "decimal_places": 2, "display": "USD 412.50" }, "released": { "amount": 123, "value": 41250, "currency": "USD", "decimal_places": 2, "display": "USD 412.50" }, "refunded": { "amount": 123, "value": 41250, "currency": "USD", "decimal_places": 2, "display": "USD 412.50" }, "externally_reimbursed": { "amount": 123, "value": 41250, "currency": "USD", "decimal_places": 2, "display": "USD 412.50" }, "resolution_status": "pending", "refund_reference": "" } }, "status": "draft", "travelers": [ { "first_name": "John", "last_name": "Doe", "date_of_birth": "1990-01-15", "gender": "MALE", "passenger_type": "ADULT" } ], "contact": { "email": "", "phone": "", "title": "" }, "items": [ { "item_id": "itm_4b91c2", "kind": "flight", "offer_id": "htl_2d67a7441c60e5de", "trip_item_token": "of_9c1d2e:FARE_ABC", "hotel_id": "lp1f2c3", "price": { "amount": 123, "value": 41250, "currency": "USD", "decimal_places": 2, "display": "USD 412.50" }, "pax_count": 1, "available_ancillaries": [ { "offer_id": "anc_bag_20kg", "type": "bag", "label": "bag&1 x large 55 x 40 x 20 cm&Includes Speedy Boarding" } ] } ] } ``` ### Error Responses - **400** - Bad Request - **401** - Unauthorized - **402** - Payment Required - **404** - Not Found - **409** - Conflict - **410** - Gone - **422** - Unprocessable Entity - **429** - Too Many Requests - **502** - Bad Gateway - **503** - Service Unavailable - **504** - Gateway Timeout #### Error Example ``` { "error": { "code": "UPSTREAM_UNAVAILABLE", "message": "The upstream service is temporarily unavailable. Please retry later.", "doc_url": "https://docs.gojinko.com/concepts/errors" } } ``` ``` -------------------------------- ### Ruby Net::HTTP GET webhook Source: https://docs.gojinko.com/api/webhooks/get Ruby example using Net::HTTP to GET a webhook subscription. Sets the X-API-Key header and prints the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api.gojinko.com/v1/webhooks/{id}") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["X-API-Key"] = '' response = http.request(request) puts response.read_body ``` -------------------------------- ### Success response for GET /v1/audience Source: https://docs.gojinko.com/api/audience Example success response for the GET /v1/audience endpoint. Returns an array of rows with rank, audience name, and share (demand share). ```json { "rows": [ { "rank": 1, "audience": "Couple", "share": 0.37 } ] } ``` -------------------------------- ### GET /v1/audience in PHP, Go, Java, and Ruby Source: https://docs.gojinko.com/api/audience Example requests to the GET /v1/audience endpoint in PHP, Go, Java (Unirest), and Ruby. All use the X-API-Key header for authentication and require a valid API key. ```php "https://api.gojinko.com/v1/audience", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "X-API-Key: " ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.gojinko.com/v1/audience" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("X-API-Key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } ``` ```java HttpResponse response = Unirest.get("https://api.gojinko.com/v1/audience") .header("X-API-Key", "") .asString(); ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.gojinko.com/v1/audience") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["X-API-Key"] = '' response = http.request(request) puts response.read_body ``` -------------------------------- ### Go net/http example for car cancel preview Source: https://docs.gojinko.com/api/car-cancel-preview Go example using the standard net/http library to call the car cancel preview endpoint. Sends a POST request with the booking reference and last name, then prints the response body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.gojinko.com/v1/car_cancel_preview" payload := strings.NewReader("{\n \"booking_ref\": \"JNK-8PT9VS\",\n \"last_name\": \"Doe\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-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)) } ``` -------------------------------- ### flight-calendar example: JFK to CDG in June Source: https://docs.gojinko.com/cli/flight-calendar Example command that finds the cheapest days to fly from JFK to CDG in June 2027. The output prices are in minor units; divide by 10^decimal_places to get the display value. ```bash # Cheapest days JFK → CDG in June jinko flight-calendar --origins JFK --destinations CDG --month 2027-06 ``` -------------------------------- ### First CLI requests Source: https://docs.gojinko.com/connect/cli Example commands for finding destinations, checking flight calendars, and searching flights. These mirror the booking workflow exposed through MCP. ```bash jinko find-destination --origins JFK jinko flight-calendar --origins JFK --destinations CDG --month 2027-06 jinko flight-search --origin JFK --destination CDG --departure-date 2027-06-15 ``` -------------------------------- ### PHP cURL example for hotel details Source: https://docs.gojinko.com/api/hotel-details Uses PHP cURL to make a GET request and outputs the response or an error. ```php "https://api.gojinko.com/v1/hotel_details/{hotel_id}", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "X-API-Key: " ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } ``` -------------------------------- ### Go net/http example for get_booking Source: https://docs.gojinko.com/api/get-booking Go example using the standard net/http library to POST to the get_booking endpoint. Builds a JSON payload as a string, sets the API key and content type headers, and prints the response body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.gojinko.com/v1/get_booking" payload := strings.NewReader("{\n \"booking_ref\": \"JNK-A0AUR2\",\n \"last_name\": \"Doe\",\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", "") 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)) } ``` -------------------------------- ### GET /v1/trip/{trip_id} with Java Unirest Source: https://docs.gojinko.com/api/trip-status Java example using Unirest to fetch trip status. Requires an API key. ```java HttpResponse response = Unirest.get("https://api.gojinko.com/v1/trip/{trip_id}") .header("X-API-Key", "") .asString(); ``` -------------------------------- ### GET /v1/trip/{trip_id} with Go net/http Source: https://docs.gojinko.com/api/trip-status Go example using net/http to fetch trip status. Requires an API key. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.gojinko.com/v1/trip/{trip_id}" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("X-API-Key", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(string(body)) } ``` -------------------------------- ### Ruby Net::HTTP example for hotel cancel preview Source: https://docs.gojinko.com/api/hotel-cancel-preview Ruby example using Net::HTTP to POST the booking reference and last name to the hotel cancel preview endpoint. Prints the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api.gojinko.com/v1/hotel_cancel_preview") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["X-API-Key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"booking_ref\": \"JNK-H1ZK90\",\n \"last_name\": \"Doe\"\n}" response = http.request(request) puts response.read_body ``` -------------------------------- ### Python requests example for flight_refund_preview Source: https://docs.gojinko.com/api/flight-refund-preview Python example using the requests library to call the flight refund preview endpoint. Prints the response text. ```python import requests url = "https://api.gojinko.com/v1/flight_refund_preview" payload = { "booking_ref": "JNK-A0AUR2", "last_name": "Doe" } headers = { "X-API-Key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text) ``` -------------------------------- ### GET /v1/trip/{trip_id} with PHP cURL Source: https://docs.gojinko.com/api/trip-status PHP example using cURL to fetch trip status. Requires an API key. ```php "https://api.gojinko.com/v1/trip/{trip_id}", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "X-API-Key: " ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } ``` -------------------------------- ### JavaScript fetch example for exchange_shop Source: https://docs.gojinko.com/api/exchange/shop JavaScript example using fetch to call the exchange_shop endpoint. ```javascript const options = { method: 'POST', headers: {'X-API-Key': '', 'Content-Type': 'application/json'}, body: JSON.stringify({booking_ref: 'JNK-A0AUR2', last_name: 'Doe'}) }; fetch('https://api.gojinko.com/v1/exchange_shop', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); ``` -------------------------------- ### GET /v1/trip/{trip_id} with JavaScript fetch Source: https://docs.gojinko.com/api/trip-status JavaScript example using fetch to retrieve trip status. Requires an API key. ```javascript const options = {method: 'GET', headers: {'X-API-Key': ''}}; fetch('https://api.gojinko.com/v1/trip/{trip_id}', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err)); ``` -------------------------------- ### Register webhook with Go Source: https://docs.gojinko.com/api/webhooks/register Go example using net/http to register a webhook. Replace with your API key. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.gojinko.com/v1/webhooks" payload := strings.NewReader("{\n \"url\": \"https://partner.example.com/jinko/webhooks\",\n \"events\": [\n \"booking.completed\",\n \"booking.failed\",\n \"booking.partial\"\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("X-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)) } ``` -------------------------------- ### Java Unirest example for hotel details Source: https://docs.gojinko.com/api/hotel-details Uses the Unirest HTTP client to make a GET request and returns the response as a string. ```java HttpResponse response = Unirest.get("https://api.gojinko.com/v1/hotel_details/{hotel_id}") .header("X-API-Key", "") .asString(); ``` -------------------------------- ### Ruby Net::HTTP example for flight_refund_preview Source: https://docs.gojinko.com/api/flight-refund-preview Ruby example using Net::HTTP to POST to the flight refund preview endpoint. Prints the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api.gojinko.com/v1/flight_refund_preview") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["X-API-Key"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"booking_ref\": \"JNK-A0AUR2\",\n \"last_name\": \"Doe\"\n}" response = http.request(request) puts response.read_body ``` -------------------------------- ### Ruby GET /v1/destination Source: https://docs.gojinko.com/api/destination Ruby example using net/http to call the destination endpoint. Requires an API key in the X-API-Key header. ```ruby require 'uri' require 'net/http' url = URI("https://api.gojinko.com/v1/destination") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["X-API-Key"] = '' response = http.request(request) puts response.read_body ``` -------------------------------- ### Initiate refund with Python requests Source: https://docs.gojinko.com/api/refund/commit Python example using the requests library to initiate a refund. Sends a POST request with the booking reference and last name, and prints the response text. ```python import requests url = "https://api.gojinko.com/v1/refund_commit" payload = { "booking_ref": "JNK-A0AUR2", "last_name": "Doe" } headers = { "X-API-Key": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.text) ```