{
  "openapi": "3.1.0",
  "info": {
    "title": "The Circle Workspace booking API",
    "version": "1.0.0",
    "description": "Check availability and book day passes, 5-hour passes, meeting rooms and free tours at The Circle Workspace, Alexandria, Egypt. Free to use, no API key. Bookings are paid on arrival. Dates and times are in Africa/Cairo time. For AI assistants, the same functions are available as an MCP server at https://circleworkspace.com/api/mcp/.",
    "contact": {
      "name": "The Circle Workspace",
      "email": "contact@circleworkspace.com",
      "url": "https://circleworkspace.com/developers/"
    },
    "termsOfService": "https://circleworkspace.com/privacy/"
  },
  "servers": [
    {
      "url": "https://circleworkspace.com"
    }
  ],
  "externalDocs": {
    "description": "Developer guide",
    "url": "https://circleworkspace.com/developers/"
  },
  "paths": {
    "/api/availability/": {
      "get": {
        "operationId": "getBookedSlots",
        "summary": "List booked meeting-room or tour times",
        "description": "Returns the times already booked at a branch on a date. Free times are the half-hour starts between 09:00 and 23:30 that do not overlap them. Day and 5-hour passes do not need a time slot.",
        "parameters": [
          {
            "name": "branch",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "roushdy",
                "kafr-abdo"
              ]
            },
            "description": "Branch: roushdy (15 Syria St) or kafr-abdo (Ali Zou El Fekar St)"
          },
          {
            "name": "date",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "YYYY-MM-DD, from today up to 20 days ahead"
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "meeting",
                "tour"
              ],
              "default": "meeting"
            },
            "description": "meeting for meeting rooms, tour for free tours"
          }
        ],
        "responses": {
          "200": {
            "description": "Booked times",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "booked": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "start_time": {
                            "type": "string",
                            "example": "10:00:00"
                          },
                          "end_time": {
                            "type": "string",
                            "example": "12:00:00"
                          }
                        }
                      }
                    }
                  },
                  "required": [
                    "booked"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid branch or date",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/bookings/": {
      "post": {
        "operationId": "createBooking",
        "summary": "Book a pass, meeting room or tour",
        "description": "Creates a booking, paid on arrival, and emails a confirmation. Confirm the details with the person before booking. Limits: 3 bookings an hour and 3 a day per phone or email, one meeting room per person per day.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "phone",
                  "email",
                  "branch",
                  "type",
                  "date"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 80,
                    "description": "Full name"
                  },
                  "phone": {
                    "type": "string",
                    "maxLength": 25,
                    "description": "Phone with country code"
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "description": "Email for the confirmation"
                  },
                  "branch": {
                    "type": "string",
                    "enum": [
                      "roushdy",
                      "kafr-abdo"
                    ]
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "shared",
                      "meeting",
                      "tour"
                    ],
                    "description": "shared = day or 5-hour pass; meeting = meeting room; tour = free 30-minute tour"
                  },
                  "date": {
                    "type": "string",
                    "format": "date",
                    "description": "YYYY-MM-DD, up to 20 days ahead"
                  },
                  "start_time": {
                    "type": "string",
                    "pattern": "^\\d{2}:(00|30)$",
                    "description": "Meeting rooms and tours: HH:MM on the hour or half hour, 09:00 to 23:30. Passes: 09:00"
                  },
                  "end_time": {
                    "type": "string",
                    "pattern": "^\\d{2}:(00|30)$",
                    "description": "Meeting rooms: start plus 1, 2, 3, 4 or 8 hours, by 24:00. Tours: start plus 30 minutes. Passes: 17:00"
                  },
                  "attendees": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9,
                    "default": 1
                  },
                  "notes": {
                    "type": "string",
                    "maxLength": 500,
                    "description": "For passes, \"Day Pass\" or \"Shift Pass\" (5 hours)"
                  }
                }
              },
              "examples": {
                "meeting": {
                  "value": {
                    "name": "Sara Ali",
                    "phone": "+201000000000",
                    "email": "sara@example.com",
                    "branch": "roushdy",
                    "type": "meeting",
                    "date": "2026-12-10",
                    "start_time": "10:00",
                    "end_time": "12:00",
                    "attendees": 4
                  }
                },
                "dayPass": {
                  "value": {
                    "name": "Omar Hassan",
                    "phone": "+201100000000",
                    "email": "omar@example.com",
                    "branch": "kafr-abdo",
                    "type": "shared",
                    "date": "2026-12-10",
                    "start_time": "09:00",
                    "end_time": "17:00",
                    "notes": "Day Pass"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Booked",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "booking": {
                      "type": "object"
                    },
                    "emailSent": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid details",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Time slot already booked",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Booking limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    }
  }
}
