{
    "openapi": "3.1.0",
    "info": {
        "title": "WhiteFlat — public booking API",
        "version": "v8.8",
        "description": "Apartments in Giulești, Bucharest. Read-only availability and prices for AI agents and apps (no key). Dates are local (Europe/Bucharest), prices in RON, city tax not included. Rate limited per IP."
    },
    "servers": [
        {
            "url": "https://whiteflat.ro"
        }
    ],
    "paths": {
        "/api.php?act=apartamente": {
            "get": {
                "operationId": "listApartments",
                "summary": "List the apartments with capacity, bedrooms, beds, amenities, prices from, rules",
                "parameters": [
                    {
                        "name": "lang",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "ro",
                                "en"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Apartments and general info",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api.php?act=disponibilitate": {
            "get": {
                "operationId": "checkAvailability",
                "summary": "Which apartments are free for the dates and the exact total price (with booking link pre-filled)",
                "parameters": [
                    {
                        "name": "sosire",
                        "in": "query",
                        "required": true,
                        "description": "Check-in date",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "plecare",
                        "in": "query",
                        "required": true,
                        "description": "Check-out date",
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "pers",
                        "in": "query",
                        "required": true,
                        "description": "Number of guests",
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "ap",
                        "in": "query",
                        "description": "Optional apartment slug or id",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "lang",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "ro",
                                "en"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Per apartment: free or not, total price, price lines, booking link",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "error": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api.php?act=calendar": {
            "get": {
                "operationId": "getCalendar",
                "summary": "Booked nights of one apartment for the next 13 months",
                "parameters": [
                    {
                        "name": "ap",
                        "in": "query",
                        "required": true,
                        "description": "Apartment slug or id",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of booked nights (YYYY-MM-DD) and booking limits",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "error": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api.php?act=info": {
            "get": {
                "operationId": "getInfo",
                "summary": "All public information: rules, fees, payment, cancellation, reviews, distances, FAQ",
                "parameters": [
                    {
                        "name": "lang",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "ro",
                                "en"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Structured info",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api.php?act=cerere": {
            "post": {
                "operationId": "createBookingRequest",
                "summary": "Send a booking request on behalf of a real guest. Not confirmed until the host confirms; the guest receives an e-mail with the booking page (payment there). Only with the guest's explicit consent and real contact details.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "ap",
                                    "sosire",
                                    "plecare",
                                    "pers",
                                    "nume",
                                    "email",
                                    "telefon",
                                    "accept_termeni"
                                ],
                                "properties": {
                                    "ap": {
                                        "type": "string",
                                        "description": "Apartment slug or id"
                                    },
                                    "sosire": {
                                        "type": "string",
                                        "format": "date"
                                    },
                                    "plecare": {
                                        "type": "string",
                                        "format": "date"
                                    },
                                    "pers": {
                                        "type": "integer",
                                        "minimum": 1
                                    },
                                    "nume": {
                                        "type": "string",
                                        "description": "Guest full name"
                                    },
                                    "email": {
                                        "type": "string",
                                        "format": "email"
                                    },
                                    "telefon": {
                                        "type": "string",
                                        "description": "Guest phone, with country code"
                                    },
                                    "ora_sosire": {
                                        "type": "string",
                                        "description": "Optional arrival time, e.g. 16:00"
                                    },
                                    "mesaj": {
                                        "type": "string",
                                        "description": "Optional message for the host"
                                    },
                                    "lang": {
                                        "type": "string",
                                        "enum": [
                                            "ro",
                                            "en"
                                        ]
                                    },
                                    "agent": {
                                        "type": "string",
                                        "description": "Name of the AI agent / app sending the request"
                                    },
                                    "accept_termeni": {
                                        "type": "boolean",
                                        "description": "The guest accepted the terms (https://whiteflat.ro/pagina.php?p=termeni) and the privacy policy (https://whiteflat.ro/pagina.php?p=gdpr)"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Request created: booking code, guest page link, price",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "error": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        },
                                        "error": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}