Getting Started

Learn how to connect and authenticate with the VTO Travel API

Integration Overview

The VTO Travel API provides access to client data, trip information, and travel bookings through a RESTful interface with office-based authentication and rate limiting.

🏢 Office-Based Authentication

Each API token is tied to a specific office with automatic database routing

⚡ Rate Limited

Built-in rate limiting with configurable limits per office

🎯 Multi-Database

Automatic switching between master and client databases

📊 Rich Data

Comprehensive client, trip, and financial information

Base URL & Endpoints

All API requests should be made to:

https://api.vto.cloud/

Endpoint Structure

Endpoints follow a simple resource/action pattern:

  • /client/fetchAll - List clients with pagination
  • /client/fetchOne/{id} - Get specific client details
  • /trip/fetchAll - List trips with filtering
  • /trip/fetchOne/{id} - Get complete trip information

Authentication

The API uses token-based authentication with office-specific tokens:

Required Headers

Header Type Required Description
X-Api-Token string Required API token for authentication (format: prefix.secret)
Content-Type string Optional Set to application/json for POST requests
X-Debug string Optional Set to 1 to enable debug information
Token Format: API tokens follow the format prefix.secret where the prefix identifies the token and the secret provides authentication.
Rate Limiting: Each token has configured rate limits. Default is 500 requests per minute. Exceeding limits returns HTTP 429.

Quick Start Guide

1. Obtain API Token

Contact your system administrator to generate an API token for your office. Each token is tied to:

  • A specific office and database
  • Configured rate limits
  • Usage tracking and monitoring

2. Test Your Connection

Make a simple request to verify your token works:

cURL Test
curl -X GET "https://api.vto.cloud/client/fetchAll?per_page=1" \
  -H "X-Api-Token: your_token_prefix.your_token_secret"
JavaScript Test
const response = await fetch('https://api.vto.cloud/client/fetchAll?per_page=1', {
  headers: {
    'X-Api-Token': 'your_token_prefix.your_token_secret'
  }
});

const data = await response.json();
if (data.success) {
  console.log('Connection successful!', data);
} else {
  console.error('Error:', data.error);
}
PHP Test
Error: Invalid API token
Python Test
import requests

headers = {'X-Api-Token': 'your_token_prefix.your_token_secret'}
response = requests.get('https://api.vto.cloud/client/fetchAll?per_page=1', headers=headers)
data = response.json()

if data['success']:
    print('Connection successful!')
    print(data)
else:
    print(f"Error: {data['error']}")

3. Handle the Response

All successful responses follow this standard format:

{
  "success": true,
  "data": [...],
  "pagination": {
    "total": 150,
    "page": 1,
    "per_page": 50,
    "total_pages": 3,
    "has_next": true,
    "has_previous": false
  },
  "timestamp": "2024-01-15T09:30:00+00:00"
}

Error responses include debug information when enabled:

{
  "success": false,
  "error": "Invalid API token",
  "code": 401,
  "details": {
    "message": "Token validation failed",
    "trace": null
  },
  "timestamp": "2024-01-15T09:30:00+00:00"
}

4. Enable Debug Mode (Optional)

For development and troubleshooting, enable debug mode:

Using Header
curl -X GET "https://api.vto.cloud/client/fetchAll" \
  -H "X-Api-Token: your_token_here" \
  -H "X-Debug: 1"
Using Query Parameter
curl -X GET "https://api.vto.cloud/client/fetchAll?debug=1" \
  -H "X-Api-Token: your_token_here"

Database Context & Multi-Tenancy

The API automatically handles database routing based on your API token:

🏢 Master Database

Contains office information, API tokens, and system configuration

  • Office management
  • Token validation
  • Rate limiting

📊 Client Database

Contains your office's specific client and trip data

  • Client information
  • Trip bookings
  • Financial data
Automatic Routing: You don't need to specify which database to use - the API automatically routes to the correct database based on your token's office association.

Rate Limiting

Each API token has configured rate limits to ensure fair usage:

Limit Type Default Value Description
Requests per Window 500 Maximum requests allowed in the time window
Time Window 60 seconds Rolling time window for rate limit calculation
Response Code 429 HTTP status when rate limit is exceeded
Rate Limit Headers: Future versions will include rate limit information in response headers to help you track usage.

Common Use Cases

📋 Client Management

Sync client information with your CRM or accounting system

GET /client/fetchAll?active=true&per_page=100

💼 Trip Reporting

Generate reports on bookings and financial data

GET /trip/fetchAll?date_from=2024-01-01&consultant_id=123

🔍 Detailed Analysis

Get complete trip details including sectors and itineraries

GET /trip/fetchOne/12345

📊 Dashboard Integration

Build real-time dashboards with current booking data

GET /client/fetchAll?search=Corporate&corporate=true

Next Steps

👥 Client Endpoints

Learn how to retrieve and search client information

Client API →

✈️ Trip Endpoints

Access trip bookings, sectors, and itinerary details

Trip API →

⚠️ Error Handling

Learn how to handle API errors and rate limits

Error Handling →

🛠️ CLI Tools

Generate and manage API tokens using CLI scripts

CLI Tools →