API Documentation

Complete guide to the Explore Cape Town Tourism API

Getting Started
The Explore Cape Town Tourism API provides comprehensive access to South African tourism data, tour packages, and booking capabilities for ride-hailing platforms.

Base URL

https://www.explore-capetown.co.za/api/v1

Response Format

All API responses are returned in JSON format with a consistent structure:

{ "success": true, "data": { ... }, "message": "Optional message", "timestamp": "2024-01-15T10:30:00Z", "request_id": "req_123456" }
Authentication
Most endpoints are publicly accessible. Protected endpoints require API key authentication.

API Key Usage

curl -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ https://www.explore-capetown.co.za/api/v1/driver/upload

Note: Contact our team to obtain an API key for protected endpoints. Public endpoints like tour packages and locations don't require authentication.

API Endpoints
Complete list of available endpoints and their usage
GET
/api/v1/itinerary/packages

Retrieve available tour packages

Query Parameters:
city
category
max_price
duration
Response:
{
  "success": true,
  "data": [
    {
      "id": "cape-point-full-day",
      "name": "Cape Point Full-Day Tour",
      "base_price": 1200,
      "duration_hours": 8,
      "city": "Cape Town"
    }
  ]
}
POST
/api/v1/itinerary/custom

Create a custom tour itinerary

Request Body:
{
  "pickup_location": "Cape Town City Centre",
  "destinations": [
    "Table Mountain",
    "V&A Waterfront"
  ],
  "preferences": {
    "budget_range": "mid-range",
    "group_size": 4,
    "interests": [
      "nature",
      "culture"
    ],
    "duration_days": 1
  }
}
POST
/api/v1/calculate/quote

Calculate pricing for a tour

Request Body:
{
  "pickup": "Cape Town City Centre",
  "stops": [
    "Table Mountain",
    "V&A Waterfront"
  ],
  "vehicle_size": 4,
  "duration_hours": 6,
  "tour_type": "multi_stop"
}
Code Examples
Integration examples in different programming languages
// Fetch tour packages
const response = await fetch('https://www.explore-capetown.co.za/api/v1/itinerary/packages?city=cape-town');
const data = await response.json();

if (data.success) {
  console.log('Available packages:', data.data);
}

// Calculate quote
const quoteResponse = await fetch('https://www.explore-capetown.co.za/api/v1/calculate/quote', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    pickup: "Cape Town City Centre",
    stops: ["Table Mountain", "V&A Waterfront"],
    vehicle_size: 4,
    duration_hours: 6,
    tour_type: "multi_stop"
  })
});

const quote = await quoteResponse.json();
console.log('Quote:', quote.data.total_price);
Error Handling
Understanding API error responses and status codes

HTTP Status Codes

200
Success - Request completed successfully
400
Bad Request - Invalid parameters or request body
401
Unauthorized - Invalid or missing API key
429
Rate Limited - Too many requests
500
Server Error - Internal server error

Error Response Format

{ "success": false, "error": "Invalid tour type specified", "message": "tour_type must be one of: single_stop, multi_stop, full_day", "timestamp": "2024-01-15T10:30:00Z", "request_id": "req_123456" }
Rate Limits
API usage limits and best practices

Public Endpoints

1,000

requests per hour

Authenticated Endpoints

5,000

requests per hour

Best Practices
  • • Cache responses when possible to reduce API calls
  • • Implement exponential backoff for rate limit errors
  • • Use webhooks for real-time updates instead of polling
  • • Contact us for higher rate limits if needed