{
  "openapi": "3.1.0",
  "info": {
    "title": "The Jungle Safari Planner API",
    "description": "Plan India wildlife safaris with The Jungle Safari. Use getDestinations and getSeasonality, then suggestItinerary for an in-chat itinerary + short planUrl, or createPlanLink / submitSafariInquiry after the traveller confirms.",
    "version": "1.3.0",
    "contact": {
      "name": "The Jungle Safari",
      "email": "booking@thejunglesafari.com",
      "url": "https://thejunglesafari.com"
    }
  },
  "servers": [
    {
      "url": "https://thejunglesafari.com"
    }
  ],
  "paths": {
    "/api/builder-inquiry": {
      "post": {
        "operationId": "submitSafariInquiry",
        "summary": "Submit a Plan Your Safari inquiry",
        "description": "Submits a custom safari inquiry to The Jungle Safari. Collect name and email first. Confirm the itinerary with the traveller before calling.",
        "security": [],
        "x-openai-isConsequential": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "email"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Traveller full name"
                  },
                  "email": {
                    "type": "string",
                    "description": "Traveller email for the quote reply"
                  },
                  "phone": {
                    "type": "string",
                    "description": "Phone or WhatsApp number"
                  },
                  "country": {
                    "type": "string",
                    "description": "Traveller country"
                  },
                  "travelDate": {
                    "type": "string",
                    "description": "Tentative start date as YYYY-MM-DD or YYYY-MM"
                  },
                  "tripDuration": {
                    "type": "integer",
                    "description": "Total trip length in days"
                  },
                  "travellers": {
                    "type": "integer",
                    "description": "Number of adult travellers"
                  },
                  "children": {
                    "type": "integer",
                    "description": "Number of children"
                  },
                  "experience": {
                    "type": "string",
                    "enum": [
                      "first",
                      "some",
                      "experienced"
                    ],
                    "description": "Safari experience level"
                  },
                  "occasion": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Special occasion tags"
                  },
                  "message": {
                    "type": "string",
                    "description": "Extra notes and preferences"
                  },
                  "itineraryData": {
                    "type": "string",
                    "description": "Human-readable itinerary summary. Always append '| Source: ChatGPT Custom GPT'."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Inquiry accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid fields",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/agent/destinations.json": {
      "get": {
        "operationId": "getDestinations",
        "summary": "List safari destinations and curated tour options",
        "description": "Returns parks, curated tours, and planning tips. Call this before recommending an itinerary.",
        "security": [],
        "responses": {
          "200": {
            "description": "Destination catalogue",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "brand": {
                      "type": "string"
                    },
                    "website": {
                      "type": "string"
                    },
                    "plannerUrl": {
                      "type": "string"
                    },
                    "contact": {
                      "type": "object",
                      "properties": {
                        "email": {
                          "type": "string"
                        },
                        "phone": {
                          "type": "string"
                        },
                        "whatsapp": {
                          "type": "string"
                        },
                        "hours": {
                          "type": "string"
                        },
                        "replySla": {
                          "type": "string"
                        }
                      }
                    },
                    "destinations": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "region": {
                            "type": "string"
                          },
                          "state": {
                            "type": "string"
                          },
                          "highlights": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "minNights": {
                            "type": "integer"
                          },
                          "bestFor": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "curatedTours": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "nights": {
                            "type": "integer"
                          },
                          "days": {
                            "type": "integer"
                          },
                          "stops": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    },
                    "popularCombos": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "parks": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "typicalDays": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "planningTips": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/agent/seasonality.json": {
      "get": {
        "operationId": "getSeasonality",
        "summary": "Park open months, best wildlife windows, and monsoon closures",
        "description": "Returns per-destination openMonths, bestMonths, and closedMonths (1=Jan through 12=Dec). Call before recommending travel dates.",
        "security": [],
        "responses": {
          "200": {
            "description": "Seasonality catalogue",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "brand": {
                      "type": "string"
                    },
                    "website": {
                      "type": "string"
                    },
                    "updated": {
                      "type": "string"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "destinations": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "openMonths": {
                            "type": "array",
                            "items": {
                              "type": "integer"
                            },
                            "description": "Months open for safari planning, 1=Jan through 12=Dec"
                          },
                          "bestMonths": {
                            "type": "array",
                            "items": {
                              "type": "integer"
                            },
                            "description": "Best wildlife or comfort months, 1=Jan through 12=Dec"
                          },
                          "closedMonths": {
                            "type": "array",
                            "items": {
                              "type": "integer"
                            },
                            "description": "Months to avoid for core park access, 1=Jan through 12=Dec"
                          },
                          "summary": {
                            "type": "string"
                          },
                          "wildlifeFocus": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/plan-link": {
      "post": {
        "operationId": "createPlanLink",
        "summary": "Create a short prefilled Plan Your Safari link",
        "description": "Encodes itinerary and contact details into a short URL that redirects to /plan-your-safari with query params filled. Prefer this over long query strings in chat.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "destinations": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Park ids such as corbett, bandhavgarh"
                  },
                  "duration": {
                    "type": "integer",
                    "minimum": 3,
                    "maximum": 21
                  },
                  "start": {
                    "type": "string",
                    "description": "YYYY-MM-DD"
                  },
                  "end": {
                    "type": "string",
                    "description": "YYYY-MM-DD"
                  },
                  "party": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 20
                  },
                  "travellers": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 20
                  },
                  "children": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10
                  },
                  "lodgeTier": {
                    "type": "string",
                    "enum": [
                      "budget",
                      "mid",
                      "luxury"
                    ]
                  },
                  "name": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string"
                  },
                  "phone": {
                    "type": "string"
                  },
                  "country": {
                    "type": "string"
                  },
                  "notes": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Short link created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "url": {
                      "type": "string"
                    },
                    "token": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid fields",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/suggest-itinerary": {
      "post": {
        "operationId": "suggestItinerary",
        "summary": "Suggest a structured safari itinerary for chat agents",
        "description": "Returns a JSON itinerary outline (parks, nights, warnings, tips) plus a short planUrl the traveller can open. Does not book or take payment.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "destinations": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Optional park ids. If omitted, parks are chosen from wildlife/region."
                  },
                  "wildlife": {
                    "type": "string",
                    "description": "Focus such as tiger, rhino, birds, culture"
                  },
                  "region": {
                    "type": "string",
                    "description": "Optional region hint: north, central, east, rajasthan"
                  },
                  "duration": {
                    "type": "integer",
                    "minimum": 3,
                    "maximum": 21
                  },
                  "start": {
                    "type": "string",
                    "description": "YYYY-MM or YYYY-MM-DD"
                  },
                  "party": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 20
                  },
                  "travellers": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 20
                  },
                  "children": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10
                  },
                  "lodgeTier": {
                    "type": "string",
                    "enum": [
                      "budget",
                      "mid",
                      "luxury"
                    ]
                  },
                  "includeCulture": {
                    "type": "boolean"
                  },
                  "name": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string"
                  },
                  "phone": {
                    "type": "string"
                  },
                  "country": {
                    "type": "string"
                  },
                  "notes": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Suggested itinerary",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "title": {
                      "type": "string"
                    },
                    "summary": {
                      "type": "string"
                    },
                    "durationDays": {
                      "type": "integer"
                    },
                    "travelMonth": {
                      "type": "integer",
                      "nullable": true
                    },
                    "stops": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "region": {
                            "type": "string"
                          },
                          "nights": {
                            "type": "integer"
                          },
                          "bestFor": {
                            "type": "string"
                          },
                          "highlights": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "tips": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "planUrl": {
                      "type": "string"
                    },
                    "plannerUrl": {
                      "type": "string"
                    },
                    "nextStep": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
