YGO API
  1. Bookings
YGO API
  • Overview
  • Core Concepts
  • Authentication
  • Quickstart Guide
  • AI Search & Trip Planning
  • Booking Flow
  • Environments
  • General
    • Check API health status
      GET
    • Get current API key context
      GET
  • AI Search & Trip Planning
    • Send message to YGO AI
      POST
  • Product Search (Classic)
    • Search for hotel & package offers
      POST
    • Get transfers for booking
      POST
    • Get package price calendar
      POST
  • Bookings
    • Get or create open booking
      POST
    • Update open booking
      POST
    • Update booking status and trigger workflows
      POST
    • List bookings
      POST
    • Get booking
      POST
  • Schemas
    • Schemas
      • PackageSearchRequest
      • GetTransfersRequest
      • GetOpenBookingRequest
      • SaveOpenBookingRequest
      • SaveBookingStatusRequest
      • ListBookingsRequest
      • GetBookingRequest
      • GetPackageCalendarRequest
      • Product
      • TransferOptionsResponse
      • Booking
      • ProductTexts
      • TransferOption
      • BookingDetails
      • TripReference
      • PackageCalendarResponse
      • LocaleContent
      • Trip
      • BookingItemInput
      • PackageCalendarDate
      • ProductImage
      • TransferImage
      • BookingItem
      • ProductDetails
      • PickupInformation
      • Traveller
      • PackageOffer
      • PickupLocation
      • TourOperator
      • Pickup
      • Image
      • Accommodation
      • CheckPickup
      • Room
      • TransferRemark
      • Transport
      • CancellationPolicy
      • Flight
      • Airport
      • Price
      • PriceByPax
      • SuccessResponse
      • ErrorResponse
      • Hotel
      • HotelFeatures
      • FeatureState
      • RoomFeatures
      • RoomContent
      • Facility
    • Response
      • Unauthorized
  1. Bookings

Get or create open booking

POST
/getOpenBooking
Retrieve the current open booking (shopping cart) for a main trip product (see it as an "anchor") and user, or automatically create a new one if none exists. The ProductID must reference a main trip product which is either a hotel-only, hotel+flight package, or pre-bundled trip. Additional items like activities and transfers can be added to this booking later in a shopping cart fashion. This endpoint provides idempotent behavior - calling it multiple times with the same ProductID and UserID returns the same booking. If multiple open bookings are found for a user-product combination (edge case), the system logs a warning and returns the first one. The returned booking object includes complete trip details, traveler information, contact data, items, pricing, and payment status. This endpoint is essential for implementing persistent shopping cart functionality across user sessions. The UserID parameter identifies the end customer.

Request

Authorization
or
Body Params application/json

Examples

Responses

🟢200OK
application/json
Successfully retrieved or created open booking for the product
Body

🟠400Bad Request
🟠401Unauthorized
🔴500Server Error
Request Request Example
Shell
JavaScript
Java
Swift
cURL
curl --location --request POST 'https://api.ygo.ai/v1/getOpenBooking' \
--header 'Content-Type: application/json' \
--data-raw '{
    "ProductID": 12345,
    "UserID": "user_abc123xyz"
}'
Response Response Example
200 - Hotel-only booking with basic trip details
{
    "Data": {
        "ID": "A1B2C3D4",
        "UserID": "user_abc123xyz",
        "ProductID": 12345,
        "Status": "open",
        "Details": {
            "Trip": {
                "ProductID": 12345,
                "Name": "Hotel Arts Barcelona - 7 Nights",
                "Description": "Luxurious 5-star beachfront hotel in Barcelona with stunning Mediterranean views",
                "Images": [
                    {
                        "URL": "https://cdn.ygo.ai/hotels/12345/main.jpg",
                        "Width": 1920,
                        "Height": 1080,
                        "Type": "main"
                    },
                    {
                        "URL": "https://cdn.ygo.ai/hotels/12345/pool.jpg",
                        "Width": 1920,
                        "Height": 1080,
                        "Type": "gallery"
                    }
                ],
                "StartDate": "2025-11-15",
                "EndDate": "2025-11-22",
                "City": "Barcelona",
                "Country": "Spain",
                "CountryCode": "ES",
                "Latitude": 41.3851,
                "Longitude": 2.1734
            },
            "Items": [],
            "Travellers": [],
            "FirstName": "",
            "LastName": "",
            "Email": "",
            "Phone": "",
            "Street": "",
            "ZipCode": "",
            "City": "",
            "CountryCode": "",
            "TotalPrice": {
                "Amount": 1850,
                "Currency": "EUR"
            },
            "Locale": "en",
            "IsRobot": false,
            "Shop": "ygotrips",
            "Host": "ygo.ai"
        },
        "CreatedAt": "2025-10-15T14:30:00Z",
        "UpdatedAt": "2025-10-15T14:30:00Z"
    },
    "Error": null
}
Modified at 2025-10-17 15:39:54
Previous
Get package price calendar
Next
Update open booking
Built with