Create PNR
curl --request POST \
--url https://api.travomatrix.com/api/v1/flight/booking/create \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"fare_token": "VALID_TOKEN_123",
"agent_id": "AGENT_456",
"idempotency_key": "IDEM_REQ_001",
"passengers": [
{
"id": "ADT1",
"type": "ADT",
"title": "MR",
"first_name": "JOHN",
"last_name": "DOE",
"gender": "M",
"dob": "1990-05-15",
"nationality": "IN"
}
],
"contact_info": {
"email": "[email protected]",
"phone": "+919876543210"
}
}
'import requests
url = "https://api.travomatrix.com/api/v1/flight/booking/create"
payload = {
"fare_token": "VALID_TOKEN_123",
"agent_id": "AGENT_456",
"idempotency_key": "IDEM_REQ_001",
"passengers": [
{
"id": "ADT1",
"type": "ADT",
"title": "MR",
"first_name": "JOHN",
"last_name": "DOE",
"gender": "M",
"dob": "1990-05-15",
"nationality": "IN"
}
],
"contact_info": {
"email": "[email protected]",
"phone": "+919876543210"
}
}
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({
fare_token: 'VALID_TOKEN_123',
agent_id: 'AGENT_456',
idempotency_key: 'IDEM_REQ_001',
passengers: [
{
id: 'ADT1',
type: 'ADT',
title: 'MR',
first_name: 'JOHN',
last_name: 'DOE',
gender: 'M',
dob: '1990-05-15',
nationality: 'IN'
}
],
contact_info: {email: '[email protected]', phone: '+919876543210'}
})
};
fetch('https://api.travomatrix.com/api/v1/flight/booking/create', 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.travomatrix.com/api/v1/flight/booking/create",
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([
'fare_token' => 'VALID_TOKEN_123',
'agent_id' => 'AGENT_456',
'idempotency_key' => 'IDEM_REQ_001',
'passengers' => [
[
'id' => 'ADT1',
'type' => 'ADT',
'title' => 'MR',
'first_name' => 'JOHN',
'last_name' => 'DOE',
'gender' => 'M',
'dob' => '1990-05-15',
'nationality' => 'IN'
]
],
'contact_info' => [
'email' => '[email protected]',
'phone' => '+919876543210'
]
]),
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.travomatrix.com/api/v1/flight/booking/create"
payload := strings.NewReader("{\n \"fare_token\": \"VALID_TOKEN_123\",\n \"agent_id\": \"AGENT_456\",\n \"idempotency_key\": \"IDEM_REQ_001\",\n \"passengers\": [\n {\n \"id\": \"ADT1\",\n \"type\": \"ADT\",\n \"title\": \"MR\",\n \"first_name\": \"JOHN\",\n \"last_name\": \"DOE\",\n \"gender\": \"M\",\n \"dob\": \"1990-05-15\",\n \"nationality\": \"IN\"\n }\n ],\n \"contact_info\": {\n \"email\": \"[email protected]\",\n \"phone\": \"+919876543210\"\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.travomatrix.com/api/v1/flight/booking/create")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"fare_token\": \"VALID_TOKEN_123\",\n \"agent_id\": \"AGENT_456\",\n \"idempotency_key\": \"IDEM_REQ_001\",\n \"passengers\": [\n {\n \"id\": \"ADT1\",\n \"type\": \"ADT\",\n \"title\": \"MR\",\n \"first_name\": \"JOHN\",\n \"last_name\": \"DOE\",\n \"gender\": \"M\",\n \"dob\": \"1990-05-15\",\n \"nationality\": \"IN\"\n }\n ],\n \"contact_info\": {\n \"email\": \"[email protected]\",\n \"phone\": \"+919876543210\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.travomatrix.com/api/v1/flight/booking/create")
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 \"fare_token\": \"VALID_TOKEN_123\",\n \"agent_id\": \"AGENT_456\",\n \"idempotency_key\": \"IDEM_REQ_001\",\n \"passengers\": [\n {\n \"id\": \"ADT1\",\n \"type\": \"ADT\",\n \"title\": \"MR\",\n \"first_name\": \"JOHN\",\n \"last_name\": \"DOE\",\n \"gender\": \"M\",\n \"dob\": \"1990-05-15\",\n \"nationality\": \"IN\"\n }\n ],\n \"contact_info\": {\n \"email\": \"[email protected]\",\n \"phone\": \"+919876543210\"\n }\n}"
response = http.request(request)
puts response.read_body{
"booking_id": "<string>",
"pnr": "<string>",
"total_price_paise": 123,
"currency": "<string>"
}{
"trace_id": "req_abc123",
"error": {
"code": "BOOKING_FARE_EXPIRED",
"message": "The selected fare has expired.",
"retryable": true,
"errors": [
{
"field": "passengers[0].first_name",
"code": "REQUIRED",
"message": "First name is required."
}
],
"provider": {
"name": "AMADEUS",
"code": "32171",
"message": "Price has changed"
}
}
}{
"trace_id": "req_abc123",
"error": {
"code": "BOOKING_FARE_EXPIRED",
"message": "The selected fare has expired.",
"retryable": true,
"errors": [
{
"field": "passengers[0].first_name",
"code": "REQUIRED",
"message": "First name is required."
}
],
"provider": {
"name": "AMADEUS",
"code": "32171",
"message": "Price has changed"
}
}
}{
"trace_id": "req_abc123",
"error": {
"code": "BOOKING_FARE_EXPIRED",
"message": "The selected fare has expired.",
"retryable": true,
"errors": [
{
"field": "passengers[0].first_name",
"code": "REQUIRED",
"message": "First name is required."
}
],
"provider": {
"name": "AMADEUS",
"code": "32171",
"message": "Price has changed"
}
}
}{
"trace_id": "req_abc123",
"error": {
"code": "BOOKING_FARE_EXPIRED",
"message": "The selected fare has expired.",
"retryable": true,
"errors": [
{
"field": "passengers[0].first_name",
"code": "REQUIRED",
"message": "First name is required."
}
],
"provider": {
"name": "AMADEUS",
"code": "32171",
"message": "Price has changed"
}
}
}Reliability & Safety
Step 5: Insufficient Funds
Create a booking and atomically debit the agent wallet.
POST
/
flight
/
booking
/
create
Create PNR
curl --request POST \
--url https://api.travomatrix.com/api/v1/flight/booking/create \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"fare_token": "VALID_TOKEN_123",
"agent_id": "AGENT_456",
"idempotency_key": "IDEM_REQ_001",
"passengers": [
{
"id": "ADT1",
"type": "ADT",
"title": "MR",
"first_name": "JOHN",
"last_name": "DOE",
"gender": "M",
"dob": "1990-05-15",
"nationality": "IN"
}
],
"contact_info": {
"email": "[email protected]",
"phone": "+919876543210"
}
}
'import requests
url = "https://api.travomatrix.com/api/v1/flight/booking/create"
payload = {
"fare_token": "VALID_TOKEN_123",
"agent_id": "AGENT_456",
"idempotency_key": "IDEM_REQ_001",
"passengers": [
{
"id": "ADT1",
"type": "ADT",
"title": "MR",
"first_name": "JOHN",
"last_name": "DOE",
"gender": "M",
"dob": "1990-05-15",
"nationality": "IN"
}
],
"contact_info": {
"email": "[email protected]",
"phone": "+919876543210"
}
}
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({
fare_token: 'VALID_TOKEN_123',
agent_id: 'AGENT_456',
idempotency_key: 'IDEM_REQ_001',
passengers: [
{
id: 'ADT1',
type: 'ADT',
title: 'MR',
first_name: 'JOHN',
last_name: 'DOE',
gender: 'M',
dob: '1990-05-15',
nationality: 'IN'
}
],
contact_info: {email: '[email protected]', phone: '+919876543210'}
})
};
fetch('https://api.travomatrix.com/api/v1/flight/booking/create', 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.travomatrix.com/api/v1/flight/booking/create",
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([
'fare_token' => 'VALID_TOKEN_123',
'agent_id' => 'AGENT_456',
'idempotency_key' => 'IDEM_REQ_001',
'passengers' => [
[
'id' => 'ADT1',
'type' => 'ADT',
'title' => 'MR',
'first_name' => 'JOHN',
'last_name' => 'DOE',
'gender' => 'M',
'dob' => '1990-05-15',
'nationality' => 'IN'
]
],
'contact_info' => [
'email' => '[email protected]',
'phone' => '+919876543210'
]
]),
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.travomatrix.com/api/v1/flight/booking/create"
payload := strings.NewReader("{\n \"fare_token\": \"VALID_TOKEN_123\",\n \"agent_id\": \"AGENT_456\",\n \"idempotency_key\": \"IDEM_REQ_001\",\n \"passengers\": [\n {\n \"id\": \"ADT1\",\n \"type\": \"ADT\",\n \"title\": \"MR\",\n \"first_name\": \"JOHN\",\n \"last_name\": \"DOE\",\n \"gender\": \"M\",\n \"dob\": \"1990-05-15\",\n \"nationality\": \"IN\"\n }\n ],\n \"contact_info\": {\n \"email\": \"[email protected]\",\n \"phone\": \"+919876543210\"\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.travomatrix.com/api/v1/flight/booking/create")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"fare_token\": \"VALID_TOKEN_123\",\n \"agent_id\": \"AGENT_456\",\n \"idempotency_key\": \"IDEM_REQ_001\",\n \"passengers\": [\n {\n \"id\": \"ADT1\",\n \"type\": \"ADT\",\n \"title\": \"MR\",\n \"first_name\": \"JOHN\",\n \"last_name\": \"DOE\",\n \"gender\": \"M\",\n \"dob\": \"1990-05-15\",\n \"nationality\": \"IN\"\n }\n ],\n \"contact_info\": {\n \"email\": \"[email protected]\",\n \"phone\": \"+919876543210\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.travomatrix.com/api/v1/flight/booking/create")
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 \"fare_token\": \"VALID_TOKEN_123\",\n \"agent_id\": \"AGENT_456\",\n \"idempotency_key\": \"IDEM_REQ_001\",\n \"passengers\": [\n {\n \"id\": \"ADT1\",\n \"type\": \"ADT\",\n \"title\": \"MR\",\n \"first_name\": \"JOHN\",\n \"last_name\": \"DOE\",\n \"gender\": \"M\",\n \"dob\": \"1990-05-15\",\n \"nationality\": \"IN\"\n }\n ],\n \"contact_info\": {\n \"email\": \"[email protected]\",\n \"phone\": \"+919876543210\"\n }\n}"
response = http.request(request)
puts response.read_body{
"booking_id": "<string>",
"pnr": "<string>",
"total_price_paise": 123,
"currency": "<string>"
}{
"trace_id": "req_abc123",
"error": {
"code": "BOOKING_FARE_EXPIRED",
"message": "The selected fare has expired.",
"retryable": true,
"errors": [
{
"field": "passengers[0].first_name",
"code": "REQUIRED",
"message": "First name is required."
}
],
"provider": {
"name": "AMADEUS",
"code": "32171",
"message": "Price has changed"
}
}
}{
"trace_id": "req_abc123",
"error": {
"code": "BOOKING_FARE_EXPIRED",
"message": "The selected fare has expired.",
"retryable": true,
"errors": [
{
"field": "passengers[0].first_name",
"code": "REQUIRED",
"message": "First name is required."
}
],
"provider": {
"name": "AMADEUS",
"code": "32171",
"message": "Price has changed"
}
}
}{
"trace_id": "req_abc123",
"error": {
"code": "BOOKING_FARE_EXPIRED",
"message": "The selected fare has expired.",
"retryable": true,
"errors": [
{
"field": "passengers[0].first_name",
"code": "REQUIRED",
"message": "First name is required."
}
],
"provider": {
"name": "AMADEUS",
"code": "32171",
"message": "Price has changed"
}
}
}{
"trace_id": "req_abc123",
"error": {
"code": "BOOKING_FARE_EXPIRED",
"message": "The selected fare has expired.",
"retryable": true,
"errors": [
{
"field": "passengers[0].first_name",
"code": "REQUIRED",
"message": "First name is required."
}
],
"provider": {
"name": "AMADEUS",
"code": "32171",
"message": "Price has changed"
}
}
}Attempt to book an expensive flight with a test wallet that has $0 balance. You will receive a
402 Payment Required (INSUFFICIENT_FUNDS) error.
Request Setup
string
required
Generate a random string (e.g.
idem-123).string
required
Paste the token from Step 2.
string
default:"YOUR_AGENT_ID"
required
Your specific UAT Agent ID.
string
default:"idem-123"
array
required
object
required
Show child attributes
Show child attributes
string
default:"[email protected]"
string
default:"+919876543210"
Instructions
- Review the requirements and set up the request payload.
- Hit the Send button.
Requirement: Copy the
booking_id. The booking must show a BOOKED status.Authorizations
Headers
A unique string to identify this request. Retrying a request with the same key will return the cached response.
Unique correlation ID for tracing.
Body
application/json
⌘I