TRP

TRP Partner Hotel API

Version 1.0 — Integration Guide for Partners

Introduction

The TRP Partner Hotel API is a REST JSON gateway for B2B hotel search, checkout, and booking management. Partners integrate once against this API; TRP handles supplier connectivity internally.

API base URL (this environment):

Detected from where you opened this guide. Staging: · Live:

Content-Type: application/json for request bodies

Response envelope: Success responses use { "status": true, "data": ..., "requestId": "uuid" }. List endpoints may also include pagination.

Authentication

  1. Call POST /auth/token with your client_id and client_secret.
  2. Store access_token and refresh_token securely.
  3. Send Authorization: Bearer <access_token> on all protected endpoints.
  4. When the access token expires, call POST /auth/refresh with the refresh token.
Auth endpoints do not require a Bearer token. All other endpoints in this guide require authentication.

Conventions & Errors

Booking identifiers

Booking IDs returned by the API are prefixed with TRP (e.g. TRP5107). Use this format in path parameters.

Search session

searchId is returned from POST /search. Reuse it for availability, revalidate, checkout, and booking until the session expires.

Room keys

Room rate identifiers (e.g. 7#17796899391201092) come from availability/search results. Pass them as selectedRoomsList.

Booking status labels

statusCodestatusTerminal?
0failedYes
1confirmedNo
2voucheredYes
3cancelledYes
4pendingNo
5pending_confirmedNo

Error codes

HTTPcodeWhen
400VALIDATION_ERRORInvalid parameters or body
401UNAUTHORIZEDMissing/invalid/expired token
401INVALID_CLIENTWrong client credentials
401SESSION_UNAVAILABLERefresh failed — re-authenticate
404BOOKING_NOT_FOUNDBooking not found for agent
404HOTEL_NOT_FOUNDUnknown hotel id
409BOOKING_ALREADY_CANCELLEDCancel rejected
409VOUCHER_NOT_AVAILABLEVoucher not ready
{
  "status": false,
  "error": { "code": "VALIDATION_ERROR", "message": "searchId is required" },
  "requestId": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
}

Recommended Booking Flow

Follow these phases in order. Steps marked Poll should be retried until the condition is met. Steps marked Key output produce values you need in later calls.

5 Phases
14 API calls
2 Poll loops
1 Setup & authentication
POST /auth/token access_token
Obtain Bearer token. Store refresh_token for renewal.
GET /meta/countries · /states · /cities
Load reference data. Use location_id from cities as cityId in search.
2 Search & discover hotels
POST /search searchId
Start async search with dates, city, nationality, and room occupancy.
GET /search/{searchId} Poll
Repeat until isComplete: true (e.g. every 500ms, ~11 attempts). Partner controls retry strategy.
GET /search/{searchId}/hotels hotelId
Paginated hotel list (10 per page). Pick a hotelId for the next phase.
3 Rates, revalidate & policy
GET /hotels/{hotelId}/availability room keys
Query: searchId. Returns room options and selectedRoomsList keys.
POST /hotels/{hotelId}/rooms/revalidate
Confirm selected rooms are still available (allAvailable: true).
GET /hotels/{hotelId}/cancellation-policy
Combined cancellation policy for selected room keys.
4 Checkout
GET /checkout/terms
Display general booking terms to the end user.
POST /checkout/preview
Step A: Summary only (searchId + rooms). Step B: Preview with contact + guest rooms.
5 Book & confirm
POST /booking/create bookingId
Same payload as checkout preview; acceptTerms: true required. Returns TRP… booking id.
POST /bookings/{bookingId}/confirm
Finalize booking and retrieve latest status.
GET /bookings/{bookingId}/status Poll
Poll until isTerminal: true (confirmed, vouchered, failed, or cancelled).
GET /bookings/{bookingId}/voucher
Download voucher when status is confirmed or vouchered.
Polling responsibility: The gateway does not auto-poll search or booking status. Your integration must implement retry loops for steps marked Poll.

Auth

POST /auth/token Open in Swagger ↗

Exchange partner client_id and client_secret for access and refresh tokens.

Request body

FieldTypeRequiredDescription
grant_typestringYesMust be client_credentials
client_idstringYesAPI client id issued by TRP
client_secretstringYesAPI client secret

Sample request

{
  "grant_type": "client_credentials",
  "client_id": "your_client_id",
  "client_secret": "your_client_secret"
}

Responses

200 Token issued

{
  "status": true,
  "access_token": "eyJhbGciOiJIUzI1NiIs...",
  "refresh_token": "eyJhbGciOiJIUzI1NiIs...",
  "token_type": "Bearer",
  "expires_in": 14400,
  "refresh_expires_in": 604800,
  "agent": { "id": 10049, "email": "agent@example.com" }
}

400 VALIDATION_ERROR

401 INVALID_CLIENT

POST /auth/refresh Open in Swagger ↗

Refresh an expired access token using a valid refresh token and active session.

FieldTypeRequiredDescription
grant_typestringYesMust be refresh_token
refresh_tokenstringYesRefresh token from /auth/token
{
  "grant_type": "refresh_token",
  "refresh_token": "eyJhbGciOiJIUzI1NiIs..."
}

200 New token pair (same shape as token response)

401 Invalid refresh token or SESSION_UNAVAILABLE

Platform

GET /health Swagger ↗

Liveness check. No authentication required.

200 Gateway is up

Account

GET /account/balance Swagger ↗

Returns the authenticated agent's credit limit and currency.

Auth: Bearer required

200

{
  "status": true,
  "data": {
    "creditLimit": 500000,
    "currency": "INR"
  },
  "requestId": "..."
}

404 AGENT_NOT_FOUND

Meta (Reference Data)

All meta endpoints require Bearer authentication.

GET /meta/countries Swagger ↗

List countries for nationality and destination setup.

200 Array of { id, code, name }

GET /meta/states Swagger ↗
QueryTypeRequiredDescription
countryIdinteger|stringYesCountry id from countries list
GET /meta/cities Swagger ↗
QueryTypeRequiredDescription
stateIdinteger|stringOne of*Filter by state
countryIdinteger|stringOne of*Filter by country

* At least one of stateId or countryId is required. Use location_id from results as cityId in search.

Hotels (Static Catalog)

GET /hotels Swagger ↗
QueryTypeRequiredDescription
cityIdstring|integerYeslocation_id from meta cities
pageintegerNoDefault 1, min 1
limitintegerNoDefault 20, max 1000
GET /hotels/{hotelId} Swagger ↗
PathTypeDescription
hotelIdstringVervotech unified hotel id

Checkout

GET /checkout/terms Swagger ↗

General booking terms and conditions text for display to end users.

{
  "status": true,
  "data": { "terms": ["Your booking is confirmed...", "..."] }
}
POST /checkout/preview Swagger ↗

Checkout summary or guest preview in one endpoint.

  • Summary — only searchId + selectedRoomsList (or stage: "summary")
  • Preview — include contact + rooms with guest details (or stage: "preview")
FieldTypeRequiredDescription
searchIdstringYes*Alias search_key
selectedRoomsListstring[]Yes*Alias selectedRoomKey
stagestringNosummary | preview
contact.emailstringPreviewValid email
contact.contactNumberstringPreviewOr contact.phone
contact.agencyReferencestringNoYour reference number
rooms[].roomKeystringPreviewMust match selected rooms
rooms[].adults[]arrayPreviewfirstName, lastName, pan, panVerified, etc.
rooms[].children[]arrayNofirstName, lastName, age (0–17)
acceptTermsbooleanNoFor preview display
{
  "searchId": "a6784cb565f20ea9ee44c1ad45dab41d",
  "selectedRoomsList": ["7#17796899391201092"],
  "stage": "preview",
  "contact": {
    "email": "guest@example.com",
    "contactNumber": "6367815547",
    "agencyReference": "AG-454"
  },
  "rooms": [{
    "roomKey": "7#17796899391201092",
    "adults": [{
      "title": "Mr.",
      "firstName": "YASH",
      "lastName": "RATHORE",
      "pan": "DZFPR4916B",
      "panVerified": true
    }],
    "children": [{ "firstName": "Yash", "lastName": "Rathore", "age": 4 }]
  }]
}

200 data.stage is summary or preview with pricing and policy fields

400 Session expired / validation errors

Bookings

POST /booking/create Swagger ↗

Finalize booking. Same body as checkout preview; acceptTerms: true is required.

{
  "status": true,
  "data": {
    "success": true,
    "message": "Booking confirmed",
    "bookingId": "TRP5107",
    "bookingStatusCode": 1,
    "redirectToConfirm": true,
    "redirectToHome": false
  }
}

200 Created or redirect info if duplicate search key

400 Validation / terms not accepted

GET /bookings Swagger ↗
QueryTypeDescription
pageintegerDefault 1
limitintegerDefault 20, max 100
statusstringfailed|confirmed|vouchered|cancelled|pending|pending_confirmed
bookingIdstringFilter e.g. TRP5107
agentReferencestringYour agency reference
checkInFromdateYYYY-MM-DD
checkInTodateYYYY-MM-DD
GET /bookings/{bookingId} Swagger ↗

Full booking detail: hotel, rooms, guests, policies, references.

POST /bookings/{bookingId}/confirm Swagger ↗
FieldTypeDescription
statusinteger|stringOptional, default 0
{
  "status": true,
  "data": {
    "bookingId": "TRP5107",
    "message": "Booking confirmed",
    "status": { "status": "confirmed", "statusCode": 1, "isTerminal": false }
  }
}
GET /bookings/{bookingId}/status Swagger ↗

Lightweight status for polling after book/confirm.

GET /bookings/{bookingId}/cancellation-quote Swagger ↗

Preview cancellation penalty and refund (does not cancel).

POST /bookings/{bookingId}/cancel Swagger ↗

Cancel an online booking.

200 Cancellation result with updated status

409 BOOKING_ALREADY_CANCELLED

GET /bookings/{bookingId}/voucher Swagger ↗

Voucher payload when status is confirmed or vouchered.

409 VOUCHER_NOT_AVAILABLE if status not eligible

Support

Include requestId from any error response when contacting TRP API support: tech@trpworld.com