Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.travelbase.ai/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Request Structure

Every request must target the correct base URL and carry a valid API key in the Authorization header.

Response Structure

All responses are JSON and follow a consistent envelope with a success flag, a message, and a data object.

Request Structure

All API requests must be made to the correct base URL for your environment (Sandbox or Live) and include the appropriate API key in the Authorization header.
Use the Sandbox environment (https://sandbox.travelbase.ai) for all development and testing. Switch to the Live base URL only when you are ready to go to production.

Authentication

Never expose your API key in client-side code, public repositories, or logs. Treat it like a password — store it in environment variables or a secrets manager.
Pass your key as a Bearer token in every request:
Authorization: Bearer tb_test_xxxxxxxxxxxxxxxxx

Example Request

curl -X POST "https://sandbox.travelbase.ai/v1/bookings" \
  -H "Authorization: Bearer tb_test_xxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "customer": {
      "name": "John Doe",
      "email": "john@example.com"
    },
    "itinerary": {
      "origin": "JFK",
      "destination": "LAX",
      "departureDate": "2024-12-01"
    }
  }'
Always set Content-Type: application/json when sending a request body. Omitting this header may result in a 400 Bad Request error.

Response Structure

All API responses are returned in JSON format and follow a consistent envelope structure.

success

Boolean flag indicating whether the operation completed without errors.

message

A human-readable summary of the outcome, useful for logging and debugging.

data

The payload of the response. Its shape varies per endpoint — always check the endpoint reference for the exact schema.

Backward & Forward Compatibility

The data object is backward and forward compatible. New fields may be added in future API versions without a breaking change. Always guard against missing fields in your application logic before accessing them.

Pagination & Metadata

For list endpoints, the data object may be nested alongside additional metadata such as pagination cursors or related resource links. Refer to the specific endpoint documentation for full details.

Example Response

{
  "success": true,
  "message": "Booking created successfully",
  "data": {
    "bookingId": "bk_1234567890",
    "customer": {
      "name": "John Doe",
      "email": "john@example.com"
    },
    "itinerary": {
      "origin": "JFK",
      "destination": "LAX",
      "departureDate": "2024-12-01"
    },
    "createdAt": "2024-11-01T12:00:00Z"
  }
}

Quick-Reference Checklist

Use the correct base URL for your environment (Sandbox vs. Live).
Include Authorization: Bearer <your-key> in every request.
Set Content-Type: application/json when sending a body.
Read success and errorCode — not just the HTTP status code.
Guard against missing fields in data for forward compatibility.