{
 "openapi": "3.1.0",
 "info": {
  "title": "Touley tour booking API for AI agents",
  "version": "1.0.0",
  "description": "Books private and shared tours (Toast Tours: wine, brewery, distillery and Hearst Castle tours in Paso Robles, CA) through Touley. Flow: list_tours → get_tour → check_availability → quote (show it to the guest) → book with the quote_id once the guest says yes. book returns a Stripe payment link for the guest; never take card details. Prices are in USD and always come from these tools.\n\nThe same tools as the MCP server at https://ffadyoayuqszjlcsdtpj.supabase.co/functions/v1/agent/mcp. No API key; rate limited per IP. Errors come back as { \"error\": \"…\" } in plain words.",
  "contact": {
   "url": "https://touley.com/agents"
  }
 },
 "servers": [
  {
   "url": "https://ffadyoayuqszjlcsdtpj.supabase.co/functions/v1/agent"
  }
 ],
 "paths": {
  "/v1/list_tours": {
   "post": {
    "operationId": "list_tours",
    "summary": "List tours",
    "description": "The tours that can be booked online: what each is, its price basis (per hour, per person, or by quote), price from, length, the days and start times, and its booking page. Start here.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "company": {
          "type": "string",
          "description": "The company's slug (from list_tours). Optional while only one company books online."
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "{ error } in words to act on"
     },
     "429": {
      "description": "Too many requests"
     }
    }
   }
  },
  "/v1/get_tour": {
   "post": {
    "operationId": "get_tour",
    "summary": "Tour details",
    "description": "One tour in full: description, what is included, the price rules (rate table, per-person tiers, deposit, gratuity), add-ons with ids, the booking questions (ids, types, options, required), the cancellation policy and the tour's FAQ.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "company": {
          "type": "string",
          "description": "The company's slug (from list_tours). Optional while only one company books online."
         },
         "tour": {
          "type": "string",
          "description": "The tour's slug from list_tours, e.g. \"private-wine-tour\"."
         }
        },
        "required": [
         "tour"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "{ error } in words to act on"
     },
     "429": {
      "description": "Too many requests"
     }
    }
   }
  },
  "/v1/check_availability": {
   "post": {
    "operationId": "check_availability",
    "summary": "Check availability",
    "description": "Whether the company can take the group on a date: for one tour (or every tour) whether it runs that day, the start times still free (null = no set times, any start), and the price for that group and day. Saturdays and bigger groups have their own rates; low-season and last-minute discounts show here.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "company": {
          "type": "string",
          "description": "The company's slug (from list_tours). Optional while only one company books online."
         },
         "tour": {
          "type": "string",
          "description": "Optional: one tour; without it every tour."
         },
         "date": {
          "type": "string",
          "description": "Tour date, YYYY-MM-DD (the company's local date, from today on)."
         },
         "guests": {
          "type": "integer",
          "minimum": 1,
          "maximum": 150,
          "description": "Number of guests in the group (adults, children and non-tasters together)."
         },
         "hours": {
          "type": "number",
          "minimum": 1,
          "maximum": 14,
          "description": "Hours wanted, only for tours priced per hour when the guest asked for a length (else the tour's usual length; never below its minimum)."
         }
        },
        "required": [
         "date",
         "guests"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "{ error } in words to act on"
     },
     "429": {
      "description": "Too many requests"
     }
    }
   }
  },
  "/v1/quote": {
   "post": {
    "operationId": "quote",
    "summary": "Quote a booking",
    "description": "The exact price for a booking, worked out like the booking page: the tour, pickup & drop-off, add-ons, priced booking answers, gratuity, the total, what is paid today (the deposit, or everything for per-person tours) and the balance later, with the cancellation policy. Checks the date and start time are still free. Returns a quote_id for book (valid 60 minutes, same choices). Show the guest the quote before booking. Tours priced by quote return request_quote instead of a price.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "company": {
          "type": "string",
          "description": "The company's slug (from list_tours). Optional while only one company books online."
         },
         "tour": {
          "type": "string",
          "description": "The tour's slug from list_tours, e.g. \"private-wine-tour\"."
         },
         "date": {
          "type": "string",
          "description": "Tour date, YYYY-MM-DD (the company's local date, from today on)."
         },
         "guests": {
          "type": "integer",
          "minimum": 1,
          "maximum": 150,
          "description": "Number of guests in the group (adults, children and non-tasters together)."
         },
         "hours": {
          "type": "number",
          "minimum": 1,
          "maximum": 14,
          "description": "Hours wanted, only for tours priced per hour when the guest asked for a length (else the tour's usual length; never below its minimum)."
         },
         "start": {
          "type": "string",
          "description": "Start time HH:MM. Required when the tour has set start times (one of the free ones from check_availability); leave it out for tours without set times (free_start_times [null]: the office sets the pickup time; put the guest’s wish in the Comments answer)."
         },
         "pickup_address": {
          "type": "string",
          "description": "Hotel name or street address for door-to-door pickup (tours with picks_up_at_address). The pickup & drop-off fee depends on it."
         },
         "dropoff_address": {
          "type": "string",
          "description": "Only when the drop-off is somewhere else than the pickup."
         },
         "addons": {
          "type": "array",
          "description": "Add-ons from get_tour.",
          "items": {
           "type": "object",
           "properties": {
            "id": {
             "type": "string"
            },
            "qty": {
             "type": "integer",
             "minimum": 1
            }
           },
           "required": [
            "id"
           ]
          }
         },
         "gratuity": {
          "type": "object",
          "description": "Only when the tour asks for a gratuity (get_tour price.gratuity.asked): the guest's choice.",
          "properties": {
           "kind": {
            "type": "string",
            "enum": [
             "percent",
             "amount",
             "none"
            ]
           },
           "value": {
            "type": "number"
           }
          },
          "required": [
           "kind"
          ]
         },
         "children": {
          "type": "integer",
          "minimum": 0,
          "description": "Per-person tours: how many of the guests are children."
         },
         "non_tasters": {
          "type": "integer",
          "minimum": 0,
          "description": "Per-person tours: how many of the guests won't taste."
         },
         "itinerary_planning": {
          "type": "boolean",
          "description": "The guest wants the office to plan the itinerary (free for small groups, else per person)."
         },
         "answers": {
          "type": "object",
          "description": "Answers to the tour's booking questions (get_tour questions), by question id: text, number, true for yes, an option label, or a list of labels for multiple choice. Priced options are added to the total.",
          "additionalProperties": true
         }
        },
        "required": [
         "tour",
         "date",
         "guests"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "{ error } in words to act on"
     },
     "429": {
      "description": "Too many requests"
     }
    }
   }
  },
  "/v1/book": {
   "post": {
    "operationId": "book",
    "summary": "Book (get the payment link)",
    "description": "Books the quoted tour for the guest once they have seen the quote and said yes: makes the booking with the guest's contact details and answers and returns the deposit's secure Stripe payment link (payment_url). Give the guest that link: they agree to the terms and pay on Stripe's page; the date is held once paid. Never ask for or type card details. Tours priced by quote send a quote request to the office instead (no payment). Use a real guest's own email and phone (the company emails them about the booking).",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "company": {
          "type": "string",
          "description": "The company's slug (from list_tours). Optional while only one company books online."
         },
         "tour": {
          "type": "string",
          "description": "The tour's slug from list_tours, e.g. \"private-wine-tour\"."
         },
         "date": {
          "type": "string",
          "description": "Tour date, YYYY-MM-DD (the company's local date, from today on)."
         },
         "guests": {
          "type": "integer",
          "minimum": 1,
          "maximum": 150,
          "description": "Number of guests in the group (adults, children and non-tasters together)."
         },
         "hours": {
          "type": "number",
          "minimum": 1,
          "maximum": 14,
          "description": "Hours wanted, only for tours priced per hour when the guest asked for a length (else the tour's usual length; never below its minimum)."
         },
         "start": {
          "type": "string",
          "description": "Start time HH:MM. Required when the tour has set start times (one of the free ones from check_availability); leave it out for tours without set times (free_start_times [null]: the office sets the pickup time; put the guest’s wish in the Comments answer)."
         },
         "pickup_address": {
          "type": "string",
          "description": "Hotel name or street address for door-to-door pickup (tours with picks_up_at_address). The pickup & drop-off fee depends on it."
         },
         "dropoff_address": {
          "type": "string",
          "description": "Only when the drop-off is somewhere else than the pickup."
         },
         "addons": {
          "type": "array",
          "description": "Add-ons from get_tour.",
          "items": {
           "type": "object",
           "properties": {
            "id": {
             "type": "string"
            },
            "qty": {
             "type": "integer",
             "minimum": 1
            }
           },
           "required": [
            "id"
           ]
          }
         },
         "gratuity": {
          "type": "object",
          "description": "Only when the tour asks for a gratuity (get_tour price.gratuity.asked): the guest's choice.",
          "properties": {
           "kind": {
            "type": "string",
            "enum": [
             "percent",
             "amount",
             "none"
            ]
           },
           "value": {
            "type": "number"
           }
          },
          "required": [
           "kind"
          ]
         },
         "children": {
          "type": "integer",
          "minimum": 0,
          "description": "Per-person tours: how many of the guests are children."
         },
         "non_tasters": {
          "type": "integer",
          "minimum": 0,
          "description": "Per-person tours: how many of the guests won't taste."
         },
         "itinerary_planning": {
          "type": "boolean",
          "description": "The guest wants the office to plan the itinerary (free for small groups, else per person)."
         },
         "answers": {
          "type": "object",
          "description": "Answers to the tour's booking questions (get_tour questions), by question id: text, number, true for yes, an option label, or a list of labels for multiple choice. Priced options are added to the total.",
          "additionalProperties": true
         },
         "quote_id": {
          "type": "string",
          "description": "From quote, made with exactly these choices."
         },
         "guest": {
          "type": "object",
          "properties": {
           "first_name": {
            "type": "string"
           },
           "last_name": {
            "type": "string"
           },
           "email": {
            "type": "string"
           },
           "phone": {
            "type": "string"
           }
          },
          "required": [
           "first_name",
           "last_name",
           "email",
           "phone"
          ]
         },
         "occasion": {
          "type": "string",
          "description": "Optional: one of the company's occasions (get_tour occasions)."
         },
         "guest_approved": {
          "type": "boolean",
          "description": "true: the guest saw this quote (total, pay today, cancellation policy) and asked to book."
         },
         "agent": {
          "type": "string",
          "description": "Who is booking: the AI assistant or app, e.g. \"ChatGPT\", \"Claude\", \"Gemini\", \"My travel app\"."
         },
         "dry_run": {
          "type": "boolean",
          "description": "true: check everything (quote, contact details, required answers) without booking. For testing an integration."
         }
        },
        "required": [
         "tour",
         "date",
         "guests",
         "quote_id",
         "guest",
         "guest_approved",
         "agent"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "{ error } in words to act on"
     },
     "429": {
      "description": "Too many requests"
     }
    },
    "x-openai-isConsequential": true
   }
  },
  "/v1/faq_search": {
   "post": {
    "operationId": "faq_search",
    "summary": "Search the FAQ",
    "description": "The company's own answers to common questions (policies, kids, dogs, tasting fees, what to bring, accessibility, lodging, groups, areas served…). Answer guests only from what it returns; prices there are general, for a booking use quote.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "company": {
          "type": "string",
          "description": "The company's slug (from list_tours). Optional while only one company books online."
         },
         "query": {
          "type": "string",
          "description": "The question in a few words."
         }
        },
        "required": [
         "query"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The result",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "400": {
      "description": "{ error } in words to act on"
     },
     "429": {
      "description": "Too many requests"
     }
    }
   }
  }
 }
}