{
  "openapi": "3.0.3",
  "info": {
    "title": "Book Taxi Group — transfers for AI agents",
    "version": "0.3.0",
    "description": "Private airport, port, station and city transfers in 3,800+ cities. Flow: POST /quote -> show the vehicles and prices to the traveller -> POST /book with the vehicle they chose -> send payment_url to the traveller -> the booking is confirmed only after payment; unpaid bookings are cancelled automatically when pay_before passes. No API key needed. Request and response bodies are JSON. Prices are fixed and all-inclusive (meet & greet, waiting time, tolls and taxes), in EUR by default: pass currency in /quote for USD, GBP, CAD, AUD or CHF, and the traveller pays exactly that amount in that currency. Free cancellation up to 24 h before pickup. A cancelled or diverted flight counts as a no-show. One-way transfers only: for a return trip, quote and book the way back as a second transfer. Errors always come as {\"error\": {\"code\", \"message\"}}; an existing endpoint called with the wrong method answers 405 with an Allow header."
  },
  "servers": [{ "url": "https://www.booktaxigroup.com/agent" }],
  "paths": {
    "/quote": {
      "post": {
        "operationId": "quoteTransfer",
        "summary": "Get fixed prices for a transfer",
        "description": "Places can be free text (address, hotel, airport name or code) or coordinates. The response repeats the places as we understood them (name, IATA code, coordinates): confirm them with the traveller before booking. quote_id is null and vehicles is empty when no vehicle is available for that route and time; the message field then says what the traveller can do.",
        "requestBody": { "required": true, "content": { "application/json": {
          "schema": { "$ref": "#/components/schemas/QuoteRequest" },
          "example": { "pickup": "Barcelona Airport (BCN)", "dropoff": "Placa de Catalunya, Barcelona", "date": "2026-12-02", "time": "12:00", "passengers": 2, "luggage": 2, "currency": "EUR" }
        } } },
        "responses": {
          "200": { "description": "Vehicles and prices (vehicles may be empty, then quote_id is null)", "content": { "application/json": {
            "schema": { "$ref": "#/components/schemas/Quote" },
            "example": {
              "quote_id": "q0d89d2f64fe5079a97008712", "expires_at": "2026-11-29T10:04:09+00:00",
              "pickup": { "name": "Josep Tarradellas Barcelona-El Prat Airport, 08820 El Prat de Llobregat, Spain", "iata": "BCN", "lat": 41.297445, "lon": 2.083294 },
              "dropoff": { "name": "Plaça de Catalunya, 08002 Barcelona, Spain", "iata": "", "lat": 41.387015, "lon": 2.170047 },
              "currency": "EUR", "pickup_local_time": "2026-12-02 12:00", "distance_km": 19.76, "passengers": 2, "luggage": 2,
              "vehicles": [
                { "vehicle_id": "1", "category": "Economy sedan", "class": "economy", "example_model": "Standard Sedan", "max_passengers": 4, "max_luggage": 4, "price": 52.1, "currency": "EUR", "meet_and_greet": true, "free_cancellation_hours_before_pickup": 24, "image": "https://www.booktaxibcn.com/images/v1b.jpg" },
                { "vehicle_id": "5", "category": "Economy minivan", "class": "economy", "example_model": "Van 6 seats", "max_passengers": 6, "max_luggage": 6, "price": 72.32, "currency": "EUR", "meet_and_greet": true, "free_cancellation_hours_before_pickup": 24, "image": "https://www.booktaxibcn.com/images/v5.jpg" }
              ],
              "terms": "Fixed all-inclusive price (meet & greet, waiting time, tolls and taxes). Free cancellation up to 24 h before pickup. Flight cancelled or diverted counts as a no-show. Full terms: https://www.booktaxigroup.com/terms-and-conditions.php"
            }
          } } },
          "400": { "$ref": "#/components/responses/Error" }, "405": { "$ref": "#/components/responses/Error" }, "422": { "$ref": "#/components/responses/Error" },
          "429": { "$ref": "#/components/responses/Error" }, "502": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/book": {
      "post": {
        "operationId": "bookTransfer",
        "summary": "Create a booking pending payment and get the traveller's payment link",
        "description": "Only call this after the traveller has agreed to the vehicle, price and pickup time. Repeating the same quote_id + vehicle_id + email returns the same booking. A quote is valid until its expires_at; after that, request a new quote.",
        "requestBody": { "required": true, "content": { "application/json": {
          "schema": { "$ref": "#/components/schemas/BookRequest" },
          "example": { "quote_id": "q0d89d2f64fe5079a97008712", "vehicle_id": "1", "agent_name": "Example Assistant",
            "passenger": { "first_name": "Anna", "last_name": "Smith", "email": "anna.smith@example.com", "phone": "+447700900123", "flight_number": "VY7821", "notes": "Two suitcases and a stroller" } }
        } } },
        "responses": {
          "201": { "description": "Booking created, pending payment", "content": { "application/json": {
            "schema": { "$ref": "#/components/schemas/Booking" },
            "example": { "booking_ref": "00180579BCN", "status": "pending_payment", "payment_url": "https://www.booktaxigroup.com/agent/pay/fc6c0db3eba75dd1587036a64019d873",
              "pay_before": "2026-11-29T10:34:33+00:00", "price": 52.1, "currency": "EUR", "vehicle": "Economy sedan (Standard Sedan)", "category": "Economy sedan", "class": "economy", "pickup_local_time": "2026-12-02 12:00",
              "pickup": "Josep Tarradellas Barcelona-El Prat Airport, 08820 El Prat de Llobregat, Spain", "dropoff": "Plaça de Catalunya, 08002 Barcelona, Spain",
              "next_step": "Send payment_url to the traveller. The booking is confirmed only after payment; unpaid bookings are cancelled automatically at pay_before.",
              "status_url": "https://www.booktaxigroup.com/agent/booking/00180579BCN" }
          } } },
          "400": { "$ref": "#/components/responses/Error" }, "405": { "$ref": "#/components/responses/Error" }, "409": { "$ref": "#/components/responses/Error" },
          "429": { "$ref": "#/components/responses/Error" }, "502": { "$ref": "#/components/responses/Error" }, "503": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/booking/{ref}": {
      "get": {
        "operationId": "getBookingStatus",
        "summary": "Booking status",
        "parameters": [
          { "name": "ref", "in": "path", "required": true, "schema": { "type": "string", "pattern": "^[0-9]{8,9}[A-Z]{3}$", "example": "00180579BCN" } },
          { "name": "email", "in": "query", "required": true, "description": "Passenger email used when booking", "schema": { "type": "string", "format": "email" } }
        ],
        "responses": {
          "200": { "description": "Status", "content": { "application/json": {
            "schema": { "$ref": "#/components/schemas/Status" },
            "example": { "booking_ref": "00180579BCN", "status": "confirmed", "price": 52.1, "currency": "EUR", "pickup_local_time": "2026-12-02 12:00" }
          } } },
          "404": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/booking/{ref}/cancel": {
      "post": {
        "operationId": "cancelBooking",
        "summary": "Cancel a booking",
        "description": "Unpaid: cancelled at once, nothing charged. Paid and more than 24 h before pickup: cancelled at once with an automatic full refund to the card (refund object in the response). Paid and 24 h or less before pickup: not cancelled (non-refundable); the response says to call +34 935 478 521.",
        "parameters": [{ "name": "ref", "in": "path", "required": true, "schema": { "type": "string", "pattern": "^[0-9]{8,9}[A-Z]{3}$" } }],
        "requestBody": { "required": true, "content": { "application/json": {
          "schema": { "type": "object", "required": ["email"], "properties": { "email": { "type": "string", "format": "email", "description": "Passenger email used when booking" } } },
          "example": { "email": "anna.smith@example.com" }
        } } },
        "responses": {
          "200": { "description": "status=cancelled (with refund if it was paid), or status=confirmed with cancelled=false and a message when it cannot be cancelled online", "content": { "application/json": {
            "schema": { "$ref": "#/components/schemas/CancelResult" },
            "example": { "booking_ref": "00180579BCN", "status": "cancelled", "refund": { "status": "refunded", "amount": 52.1, "currency": "EUR", "note": "Full refund to the card used for payment. It can take 5-10 business days to show on the statement." } }
          } } },
          "404": { "$ref": "#/components/responses/Error" }, "405": { "$ref": "#/components/responses/Error" }, "409": { "$ref": "#/components/responses/Error" },
          "502": { "description": "Could not be cancelled right now; nothing changed. Retry later.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Place": {
        "oneOf": [
          { "type": "string", "description": "Address, hotel, airport name or code, e.g. 'Barcelona Airport (BCN)'" },
          { "type": "object", "required": ["lat", "lon"], "properties": { "lat": { "type": "number" }, "lon": { "type": "number" }, "name": { "type": "string" }, "iata": { "type": "string", "description": "3-letter airport code, if the place is an airport" } } }
        ]
      },
      "ResolvedPlace": {
        "type": "object", "required": ["name", "iata", "lat", "lon"],
        "description": "The place as we understood it. Confirm it with the traveller before booking.",
        "properties": { "name": { "type": "string" }, "iata": { "type": "string", "description": "Airport code, empty if the place is not an airport" }, "lat": { "type": "number" }, "lon": { "type": "number" } }
      },
      "QuoteRequest": {
        "type": "object", "required": ["pickup", "dropoff", "date", "time"],
        "properties": {
          "pickup": { "$ref": "#/components/schemas/Place" }, "dropoff": { "$ref": "#/components/schemas/Place" },
          "date": { "type": "string", "format": "date", "pattern": "^\\d{4}-\\d{2}-\\d{2}$", "example": "2026-12-02", "description": "Local date at the pickup place, YYYY-MM-DD" },
          "time": { "type": "string", "pattern": "^\\d{2}:\\d{2}$", "example": "12:00", "description": "Local time at the pickup place, HH:MM, 24 h (for airport pickups, the landing time). At least 4 hours from now." },
          "passengers": { "type": "integer", "minimum": 1, "maximum": 50, "default": 1 }, "luggage": { "type": "integer", "minimum": 0, "maximum": 50, "default": 0 },
          "currency": { "type": "string", "enum": ["EUR", "USD", "GBP", "CAD", "AUD", "CHF"], "default": "EUR", "description": "Currency of the prices; the payment is charged in it. Converted at the day's exchange rate when quoting, then fixed for that quote." },
          "child_seats": { "type": "integer", "minimum": 0, "maximum": 8, "default": 0 }, "booster_seats": { "type": "integer", "minimum": 0, "maximum": 8, "default": 0 }, "infant_seats": { "type": "integer", "minimum": 0, "maximum": 8, "default": 0 }
        }
      },
      "Vehicle": {
        "type": "object",
        "required": ["vehicle_id", "category", "class", "example_model", "max_passengers", "max_luggage", "price", "currency", "meet_and_greet", "free_cancellation_hours_before_pickup"],
        "properties": {
          "vehicle_id": { "type": "string", "description": "Pass it to /book" }, "category": { "type": "string" }, "class": { "type": "string", "enum": ["economy", "business", "first"] },
          "example_model": { "type": "string", "description": "Example model or size; the actual car can differ within the category" },
          "max_passengers": { "type": "integer" }, "max_luggage": { "type": "integer" }, "price": { "type": "number", "description": "Total price for the transfer, all-inclusive" }, "currency": { "type": "string", "example": "EUR" },
          "meet_and_greet": { "type": "boolean" }, "free_cancellation_hours_before_pickup": { "type": "integer" }, "image": { "type": "string" }
        }
      },
      "Quote": {
        "type": "object", "required": ["quote_id", "vehicles"],
        "properties": {
          "quote_id": { "type": "string", "nullable": true, "description": "null when no vehicle is available (vehicles is then empty and message explains)" },
          "expires_at": { "type": "string", "format": "date-time", "description": "Book before this time or request a new quote" },
          "pickup": { "$ref": "#/components/schemas/ResolvedPlace" }, "dropoff": { "$ref": "#/components/schemas/ResolvedPlace" },
          "currency": { "type": "string", "example": "EUR", "description": "Currency of every price in this quote" },
          "pickup_local_time": { "type": "string", "example": "2026-12-02 12:00", "description": "YYYY-MM-DD HH:MM, local time at the pickup place" },
          "distance_km": { "type": "number" }, "passengers": { "type": "integer" }, "luggage": { "type": "integer" },
          "vehicles": { "type": "array", "items": { "$ref": "#/components/schemas/Vehicle" }, "description": "Cheapest first" },
          "terms": { "type": "string" }, "message": { "type": "string", "description": "Only when there are no vehicles" }
        }
      },
      "BookRequest": {
        "type": "object", "required": ["quote_id", "vehicle_id", "passenger"],
        "properties": {
          "quote_id": { "type": "string" }, "vehicle_id": { "type": "string" },
          "agent_name": { "type": "string", "description": "Optional name of the assistant making the booking" },
          "passenger": {
            "type": "object", "required": ["first_name", "last_name", "email", "phone"],
            "properties": {
              "first_name": { "type": "string" }, "last_name": { "type": "string" }, "email": { "type": "string", "format": "email" },
              "phone": { "type": "string", "description": "Mobile in international format, e.g. +447700900123. The driver and our team use it on the day." },
              "flight_number": { "type": "string", "example": "VY7821", "description": "Optional but recommended for airport pickups: we follow the flight and wait if it is late. If it is missing, we ask the traveller for it by WhatsApp." },
              "notes": { "type": "string", "description": "Anything the driver should know (max 400 characters)" }
            }
          }
        }
      },
      "Booking": {
        "type": "object", "required": ["booking_ref", "status", "payment_url", "pay_before", "price", "currency"],
        "properties": {
          "booking_ref": { "type": "string" }, "status": { "type": "string", "enum": ["pending_payment"] },
          "payment_url": { "type": "string", "description": "Send it to the traveller: secure card payment page" }, "pay_before": { "type": "string", "format": "date-time" },
          "price": { "type": "number" }, "currency": { "type": "string" },
          "vehicle": { "type": "string", "description": "Vehicle as shown to the traveller: category and example model" }, "category": { "type": "string" }, "class": { "type": "string", "enum": ["economy", "business", "first"] },
          "pickup_local_time": { "type": "string" }, "pickup": { "type": "string" }, "dropoff": { "type": "string" },
          "next_step": { "type": "string" }, "status_url": { "type": "string" }
        }
      },
      "Status": {
        "type": "object", "required": ["booking_ref", "status", "price", "currency"],
        "properties": {
          "booking_ref": { "type": "string" }, "status": { "type": "string", "enum": ["pending_payment", "confirmed", "cancelled", "expired"] },
          "price": { "type": "number" }, "currency": { "type": "string" }, "pickup_local_time": { "type": "string" },
          "payment_url": { "type": "string", "description": "Only while pending_payment" }, "pay_before": { "type": "string", "format": "date-time" },
          "driver_assigned": { "type": "boolean" }, "refund": { "$ref": "#/components/schemas/Refund" }
        }
      },
      "Refund": {
        "type": "object", "required": ["status", "amount", "currency"],
        "properties": { "status": { "type": "string", "enum": ["refunded", "processing"] }, "amount": { "type": "number" }, "currency": { "type": "string" }, "note": { "type": "string" } }
      },
      "CancelResult": {
        "type": "object", "required": ["booking_ref", "status"],
        "properties": {
          "booking_ref": { "type": "string" }, "status": { "type": "string", "enum": ["cancelled", "expired", "confirmed"] },
          "cancelled": { "type": "boolean", "description": "false when it could not be cancelled online" }, "message": { "type": "string" },
          "refund": { "oneOf": [{ "$ref": "#/components/schemas/Refund" }, { "type": "string", "example": "nothing was charged" }] }
        }
      },
      "Error": {
        "type": "object", "required": ["error"],
        "properties": { "error": { "type": "object", "required": ["code", "message"], "properties": { "code": { "type": "string", "example": "bad_pickup_time" }, "message": { "type": "string" } } } },
        "example": { "error": { "code": "method_not_allowed", "message": "Use POST for this endpoint. See https://www.booktaxigroup.com/agent/openapi" } }
      }
    },
    "responses": { "Error": { "description": "Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } }
  }
}
