{
    "openapi": "3.1.0",
    "info": {
        "title": "Best Guest Chekin-compatible API",
        "version": "3.0",
        "summary": "Paths, fields, statuses, errors and webhooks in the shape of Chekin's API v3, served by Best Guest.",
        "description": "Built so an integration written for Chekin can switch by changing the base URL and the credentials. It is a translation of Chekin's documented API onto Best Guest's own services: the same checks, the same data.\n\nBase URLs: `https://api.bestguest.app/api/v3/` and, for clients written against the newer documentation, `https://api.bestguest.app/public/api/v1/` (identical).\n\nAuthentication: `POST /token/` with `{email, password}` where `password` is a Best Guest API key (bgk_...); send the returned token as `Authorization: JWT <token>`. It lasts one hour.\n\nWorks for properties in Czechia, Slovakia and Poland. Not served (a clear 404): police and statistics accounts, locations, the tax calculator, OCR, biometric match, documents and receipts, guest groups as a resource, creating a housing or a room. Police registration is not triggered by a partner: see the housing's `is_auto_police_registration_enabled` and the reservation's `detailed_statuses`.\n\nLimits per minute per key: reservations 300, housings and rooms 200, creating a guest 50, webhooks 100. A throttled request is not processed and answers 429 with `Retry-After`."
    },
    "servers": [
        {
            "url": "https://api.bestguest.app/api/v3",
            "description": "Best Guest (identical under /public/api/v1)"
        }
    ],
    "tags": [
        {
            "name": "Authentication"
        },
        {
            "name": "Housings"
        },
        {
            "name": "Reservations"
        },
        {
            "name": "Guests"
        },
        {
            "name": "Webhooks"
        }
    ],
    "paths": {
        "/guests/": {
            "post": {
                "operationId": "guestsCreate",
                "tags": [
                    "Guests"
                ],
                "summary": "Create a guest",
                "description": "Adds a guest to a reservation (`reservation_id`). A `signature` (base64 PNG/JPEG) is accepted and, with the other required details, completes the guest's form. Gender, second surname and the document's issue/expiry dates are accepted and ignored.",
                "security": [
                    {
                        "JWT": []
                    }
                ],
                "x-rate-limit-bucket": "guests",
                "responses": {
                    "201": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Guest"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/Throttled"
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/GuestRequest"
                            }
                        }
                    }
                }
            }
        },
        "/guests/{id}/": {
            "get": {
                "operationId": "guestsGet",
                "tags": [
                    "Guests"
                ],
                "summary": "Get a guest",
                "security": [
                    {
                        "JWT": []
                    }
                ],
                "x-rate-limit-bucket": "guests",
                "responses": {
                    "200": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Guest"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/Throttled"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            },
            "patch": {
                "operationId": "guestsUpdate",
                "tags": [
                    "Guests"
                ],
                "summary": "Change a guest",
                "description": "Only guests you created. A form the guest completed, signed or edited is never overwritten.",
                "security": [
                    {
                        "JWT": []
                    }
                ],
                "x-rate-limit-bucket": "guests",
                "responses": {
                    "200": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Guest"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/Throttled"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/GuestRequest"
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "guestsDelete",
                "tags": [
                    "Guests"
                ],
                "summary": "Delete a guest",
                "description": "Not supported: always 403.",
                "security": [
                    {
                        "JWT": []
                    }
                ],
                "x-rate-limit-bucket": "guests",
                "responses": {
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "400": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/Throttled"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/housings/": {
            "get": {
                "operationId": "housingsList",
                "tags": [
                    "Housings"
                ],
                "summary": "List housings",
                "description": "Your properties. Read-only.",
                "security": [
                    {
                        "JWT": []
                    }
                ],
                "x-rate-limit-bucket": "housings",
                "responses": {
                    "200": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "allOf": [
                                        {
                                            "$ref": "#/components/schemas/Page"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "results": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/Housing"
                                                    }
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/Throttled"
                    }
                }
            }
        },
        "/housings/{id}/": {
            "get": {
                "operationId": "housingsGet",
                "tags": [
                    "Housings"
                ],
                "summary": "Get a housing",
                "security": [
                    {
                        "JWT": []
                    }
                ],
                "x-rate-limit-bucket": "housings",
                "responses": {
                    "200": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Housing"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/Throttled"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/reservations/": {
            "post": {
                "operationId": "reservationsCreate",
                "tags": [
                    "Reservations"
                ],
                "summary": "Create a reservation",
                "description": "Best Guest e-mails the guest the check-in link unless `send_invite_email` is false. `external_id` (optional) lets you find the reservation again; if it is already used the call is refused, use PATCH.",
                "security": [
                    {
                        "JWT": []
                    }
                ],
                "x-rate-limit-bucket": "reservations",
                "responses": {
                    "201": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Reservation"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/Throttled"
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ReservationRequest"
                            }
                        }
                    }
                }
            },
            "get": {
                "operationId": "reservationsList",
                "tags": [
                    "Reservations"
                ],
                "summary": "List reservations",
                "description": "Filters: `housing_id`, `checkin_date_from`, `external_id`; paging: `page`, `page_size` (default 20, at most 100).",
                "security": [
                    {
                        "JWT": []
                    }
                ],
                "x-rate-limit-bucket": "reservations",
                "responses": {
                    "200": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "allOf": [
                                        {
                                            "$ref": "#/components/schemas/Page"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "results": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/Reservation"
                                                    }
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/Throttled"
                    }
                },
                "parameters": [
                    {
                        "name": "housing_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "checkin_date_from",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "external_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page_size",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/reservations/{id}/": {
            "get": {
                "operationId": "reservationsGet",
                "tags": [
                    "Reservations"
                ],
                "summary": "Get a reservation",
                "security": [
                    {
                        "JWT": []
                    }
                ],
                "x-rate-limit-bucket": "reservations",
                "responses": {
                    "200": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Reservation"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/Throttled"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            },
            "patch": {
                "operationId": "reservationsUpdate",
                "tags": [
                    "Reservations"
                ],
                "summary": "Change a reservation",
                "description": "Only reservations created through the API. A new `default_invite_email` ends the old check-in link and makes a new one. `{\"status\": \"DELETED\"}` cancels.",
                "security": [
                    {
                        "JWT": []
                    }
                ],
                "x-rate-limit-bucket": "reservations",
                "responses": {
                    "200": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Reservation"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/Throttled"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ReservationRequest"
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "reservationsDelete",
                "tags": [
                    "Reservations"
                ],
                "summary": "Delete a reservation",
                "description": "Cancels it. Refused once it has been submitted for police reporting.",
                "security": [
                    {
                        "JWT": []
                    }
                ],
                "x-rate-limit-bucket": "reservations",
                "responses": {
                    "204": {
                        "description": "No content."
                    },
                    "400": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/Throttled"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/reservations/{id}/resend-reservation-to-police-check-out/": {
            "post": {
                "operationId": "checkOutNotUsed",
                "tags": [
                    "Reservations"
                ],
                "summary": "Police check-out",
                "description": "Check-outs are not reported to any authority Best Guest serves. Always `NOT_USED`.",
                "security": [
                    {
                        "JWT": []
                    }
                ],
                "x-rate-limit-bucket": "reservations",
                "responses": {
                    "200": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Status"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/Throttled"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/reservations/{id}/resend-reservation-to-police/": {
            "post": {
                "operationId": "policeResend",
                "tags": [
                    "Reservations"
                ],
                "summary": "Police registration status",
                "description": "Best Guest never submits to the police on a partner's request: the host's \"close reservations automatically\" option and the schedule do. This returns the current state.",
                "security": [
                    {
                        "JWT": []
                    }
                ],
                "x-rate-limit-bucket": "reservations",
                "responses": {
                    "200": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Status"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/Throttled"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/reservations/{id}/resend-reservation-to-stat-check-out/": {
            "post": {
                "operationId": "statNotUsed",
                "tags": [
                    "Reservations"
                ],
                "summary": "Statistics registration",
                "description": "Not available. Always `NOT_USED`.",
                "security": [
                    {
                        "JWT": []
                    }
                ],
                "x-rate-limit-bucket": "reservations",
                "responses": {
                    "200": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Status"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/Throttled"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/reservations/{id}/resend-reservation-to-stat/": {
            "post": {
                "operationId": "statNotUsed",
                "tags": [
                    "Reservations"
                ],
                "summary": "Statistics registration",
                "description": "Not available. Always `NOT_USED`.",
                "security": [
                    {
                        "JWT": []
                    }
                ],
                "x-rate-limit-bucket": "reservations",
                "responses": {
                    "200": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Status"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/Throttled"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/reservations/{id}/send-reservation-to-police-check-out/": {
            "post": {
                "operationId": "checkOutNotUsed",
                "tags": [
                    "Reservations"
                ],
                "summary": "Police check-out",
                "description": "Check-outs are not reported to any authority Best Guest serves. Always `NOT_USED`.",
                "security": [
                    {
                        "JWT": []
                    }
                ],
                "x-rate-limit-bucket": "reservations",
                "responses": {
                    "200": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Status"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/Throttled"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/rooms/": {
            "get": {
                "operationId": "roomsList",
                "tags": [
                    "Housings"
                ],
                "summary": "List rooms",
                "description": "Your listings. Filter with `housing_id`.",
                "security": [
                    {
                        "JWT": []
                    }
                ],
                "x-rate-limit-bucket": "housings",
                "responses": {
                    "200": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "allOf": [
                                        {
                                            "$ref": "#/components/schemas/Page"
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "results": {
                                                    "type": "array",
                                                    "items": {
                                                        "$ref": "#/components/schemas/Room"
                                                    }
                                                }
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/Throttled"
                    }
                },
                "parameters": [
                    {
                        "name": "housing_id",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page_size",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/rooms/{id}/": {
            "get": {
                "operationId": "roomsGet",
                "tags": [
                    "Housings"
                ],
                "summary": "Get a room",
                "security": [
                    {
                        "JWT": []
                    }
                ],
                "x-rate-limit-bucket": "housings",
                "responses": {
                    "200": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Room"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/Throttled"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        },
        "/token/": {
            "post": {
                "operationId": "token",
                "tags": [
                    "Authentication"
                ],
                "summary": "Log in",
                "description": "Trade a Best Guest API key for a 1-hour token. `password` is the API key (bgk_...); `email` must be non-empty.",
                "security": [],
                "x-rate-limit-bucket": "default",
                "responses": {
                    "200": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Token"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/Throttled"
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/TokenRequest"
                            }
                        }
                    }
                }
            }
        },
        "/token/refresh/": {
            "post": {
                "operationId": "refresh",
                "tags": [
                    "Authentication"
                ],
                "summary": "Refresh the token",
                "description": "Trade a still-valid token for a new one. A revoked key's tokens stop working at once.",
                "security": [],
                "x-rate-limit-bucket": "default",
                "responses": {
                    "200": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Token"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/Throttled"
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/TokenRefreshRequest"
                            }
                        }
                    }
                }
            }
        },
        "/webhooks/": {
            "post": {
                "operationId": "webhooksCreate",
                "tags": [
                    "Webhooks"
                ],
                "summary": "Subscribe",
                "description": "One event per subscription. Signed with HMAC-SHA256 (hex) in `x-payload-signature` using `signature_secret`; if you send none, one is made and returned once.",
                "security": [
                    {
                        "JWT": []
                    }
                ],
                "x-rate-limit-bucket": "webhooks",
                "responses": {
                    "201": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Webhook"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/Throttled"
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookRequest"
                            }
                        }
                    }
                }
            },
            "get": {
                "operationId": "webhooksList",
                "tags": [
                    "Webhooks"
                ],
                "summary": "List subscriptions",
                "security": [
                    {
                        "JWT": []
                    }
                ],
                "x-rate-limit-bucket": "webhooks",
                "responses": {
                    "200": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/Webhook"
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/Throttled"
                    }
                }
            }
        },
        "/webhooks/{id}/": {
            "delete": {
                "operationId": "webhooksDelete",
                "tags": [
                    "Webhooks"
                ],
                "summary": "Unsubscribe",
                "security": [
                    {
                        "JWT": []
                    }
                ],
                "x-rate-limit-bucket": "webhooks",
                "responses": {
                    "204": {
                        "description": "No content."
                    },
                    "400": {
                        "$ref": "#/components/responses/ValidationFailed"
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/Throttled"
                    }
                },
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ]
            }
        }
    },
    "webhooks": {
        "event": {
            "post": {
                "summary": "A webhook delivery",
                "description": "Sent to the `target` of a subscription. Any answer other than 2xx is retried (1 m, 5 m, 30 m, 2 h, 6 h, 12 h, 24 h). Header `x-payload-signature` = HMAC-SHA256 (hex) of the raw body with your `signature_secret`.\n\nEvents: `Reservation.updated` (any change, cancellation, closing, reopening, local fee), `Guest.created` (a guest completed their form), `PoliceRegistration.created|scheduled` (the reservation was closed for the police), `PoliceRegistration.complete`, `PoliceRegistration.error`. `StatRegistration.*` and the other police events are accepted but never fire.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookDelivery"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Any 2xx acknowledges the event."
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "JWT": {
                "type": "apiKey",
                "in": "header",
                "name": "Authorization",
                "description": "`JWT <token>` from POST /token/ (`Bearer <token>` is accepted too). A raw Best Guest key (`JWT bgk_...`) works as well."
            }
        },
        "responses": {
            "ValidationFailed": {
                "description": "{\"code\":\"1000\",\"message\":\"Validation Failed\",\"status_code\":400,\"errors\":[{\"message\":\"...\"}]}. A Best Guest conflict (OVERLAP_CONFLICT, ALREADY_SENT, ...) is a 400 whose message starts with its code.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "Unauthorized": {
                "description": "{\"code\":4002,\"message\":\"Invalid Authorization header. No credentials provided.\",\"status_code\":401,\"errors\":[]}",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "Forbidden": {
                "description": "A read key tried to write, or the operation is not supported.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "NotFound": {
                "description": "No such resource in your account, or an endpoint Best Guest does not serve.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "Throttled": {
                "description": "{\"detail\":\"Request was throttled. Expected available in N seconds.\",\"errors\":[]} with a Retry-After header."
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "properties": {
                    "code": {
                        "type": [
                            "string",
                            "integer"
                        ]
                    },
                    "message": {
                        "type": "string"
                    },
                    "status_code": {
                        "type": "integer"
                    },
                    "errors": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            },
            "Page": {
                "type": "object",
                "properties": {
                    "count": {
                        "type": "integer"
                    },
                    "next": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "previous": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "TokenRequest": {
                "type": "object",
                "required": [
                    "email",
                    "password"
                ],
                "properties": {
                    "email": {
                        "type": "string"
                    },
                    "password": {
                        "type": "string",
                        "description": "A Best Guest API key (bgk_...)."
                    }
                }
            },
            "TokenRefreshRequest": {
                "type": "object",
                "required": [
                    "token"
                ],
                "properties": {
                    "token": {
                        "type": "string"
                    }
                }
            },
            "Token": {
                "type": "object",
                "properties": {
                    "token": {
                        "type": "string"
                    }
                }
            },
            "Status": {
                "type": "object",
                "properties": {
                    "status": {
                        "enum": [
                            "NEW",
                            "MANUAL",
                            "SCHEDULED",
                            "COMPLETE",
                            "ERROR",
                            "NOT_USED"
                        ]
                    }
                }
            },
            "Housing": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "name": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "type": {
                        "type": "string"
                    },
                    "location": {
                        "type": "object"
                    },
                    "time_zone": {
                        "type": "string"
                    },
                    "rooms_quantity": {
                        "type": "integer"
                    },
                    "max_capacity": {
                        "type": "integer"
                    },
                    "rooms": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Room"
                        }
                    },
                    "is_police_registration_enabled": {
                        "type": "boolean"
                    },
                    "is_auto_police_registration_enabled": {
                        "type": "boolean",
                        "description": "Read from the host's \"close reservations automatically\" option. Not writable here."
                    },
                    "is_stat_registration_enabled": {
                        "const": false
                    },
                    "status": {
                        "type": "string"
                    }
                }
            },
            "Room": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "name": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "housing_id": {
                        "type": "string"
                    }
                }
            },
            "ReservationRequest": {
                "type": "object",
                "properties": {
                    "housing_id": {
                        "type": "string"
                    },
                    "check_in_date": {
                        "type": "string",
                        "description": "YYYY-MM-DD or an ISO date-time."
                    },
                    "check_out_date": {
                        "type": "string"
                    },
                    "nights_of_stay": {
                        "type": "integer",
                        "description": "Instead of check_out_date."
                    },
                    "rooms": {
                        "type": "array",
                        "items": {
                            "type": [
                                "string",
                                "integer"
                            ]
                        },
                        "description": "Room ids; omit for a housing with one room."
                    },
                    "external_id": {
                        "type": "string"
                    },
                    "default_invite_email": {
                        "type": "string"
                    },
                    "default_phone_number": {
                        "type": "string"
                    },
                    "default_leader_full_name": {
                        "type": "string",
                        "description": "The last word is the surname."
                    },
                    "language": {
                        "type": "string",
                        "description": "ISO 639-3, e.g. eng."
                    },
                    "source": {
                        "type": "string"
                    },
                    "send_invite_email": {
                        "type": "boolean",
                        "description": "false: Best Guest does not e-mail the guest; use signup_form_link yourself."
                    },
                    "guest_group": {
                        "type": "object",
                        "properties": {
                            "number_of_guests": {
                                "type": "integer"
                            },
                            "members": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/GuestRequest"
                                }
                            }
                        }
                    },
                    "status": {
                        "type": "string",
                        "description": "On PATCH, DELETED cancels the reservation."
                    }
                }
            },
            "Reservation": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "external_id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "housing": {
                        "type": "object"
                    },
                    "housing_id": {
                        "type": "string"
                    },
                    "rooms": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "check_in_date": {
                        "type": "string"
                    },
                    "check_out_date": {
                        "type": "string"
                    },
                    "nights_of_stay": {
                        "type": "integer"
                    },
                    "status": {
                        "enum": [
                            "NEW",
                            "CHECKED_IN",
                            "CHECKED_OUT",
                            "COMPLETE",
                            "DELETED"
                        ]
                    },
                    "aggregated_status": {
                        "enum": [
                            "NEW",
                            "ERROR",
                            "COMPLETE",
                            "CHECK_IN_REG",
                            "IN_PROGRESS",
                            "GUESTS_MISSING",
                            "CREDS_MISSING"
                        ]
                    },
                    "general_status": {
                        "type": "string"
                    },
                    "detailed_statuses": {
                        "type": "object",
                        "description": "identity_verification, remote_access, guest_registration, police_check-in, police_check-out. Outside Czechia police_check-in is NOT_USED even when the reservation is COMPLETE: it is closed, nothing is reported."
                    },
                    "error_details": {
                        "type": "object"
                    },
                    "signup_form_link": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "links": {
                        "type": "object",
                        "properties": {
                            "check-in_online": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "payment_link": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "upselling_link": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    },
                    "guest_group": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "number_of_guests": {
                                "type": "integer"
                            },
                            "members": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/Guest"
                                }
                            },
                            "leader_id": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "type": {
                                "const": "G"
                            }
                        }
                    }
                }
            },
            "GuestRequest": {
                "type": "object",
                "properties": {
                    "reservation_id": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "surname": {
                        "type": "string"
                    },
                    "birth_date": {
                        "type": "string",
                        "format": "date"
                    },
                    "nationality": {
                        "type": "string",
                        "description": "ISO 3166 alpha-2, e.g. DE."
                    },
                    "gender": {
                        "enum": [
                            "M",
                            "F",
                            "N"
                        ],
                        "description": "Accepted and ignored."
                    },
                    "document": {
                        "type": "object",
                        "properties": {
                            "type": {
                                "enum": [
                                    "P",
                                    "I",
                                    "CZ_P",
                                    "CZ_ID",
                                    "CO_P",
                                    "CO_FID"
                                ],
                                "description": "Other types are refused with 400."
                            },
                            "number": {
                                "type": "string"
                            }
                        }
                    },
                    "residence": {
                        "type": "object",
                        "properties": {
                            "country": {
                                "type": "string"
                            },
                            "city": {
                                "type": "string"
                            },
                            "postal_code": {
                                "type": "string"
                            },
                            "address": {
                                "type": "string"
                            }
                        }
                    },
                    "birth_place": {
                        "type": "object"
                    },
                    "email": {
                        "type": "string"
                    },
                    "phone": {
                        "type": "string"
                    },
                    "signature": {
                        "type": "string",
                        "description": "Base64 PNG/JPEG (a data URI is accepted)."
                    }
                }
            },
            "Guest": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "name": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "surname": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "gender": {
                        "const": "N"
                    },
                    "birth_date": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "nationality": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "document": {
                        "type": [
                            "object",
                            "null"
                        ]
                    },
                    "signature": {
                        "type": "null",
                        "description": "Never returned."
                    },
                    "statuses": {
                        "type": "object",
                        "description": "police, statistics (in/out), arrival (EXPECTED/ARRIVED), data (NEW/INCOMPLETE/COMPLETE)."
                    }
                }
            },
            "WebhookRequest": {
                "type": "object",
                "required": [
                    "target",
                    "event"
                ],
                "properties": {
                    "target": {
                        "type": "string",
                        "description": "https on port 443, resolving to public addresses only."
                    },
                    "event": {
                        "enum": [
                            "Reservation.updated",
                            "Guest.created",
                            "PoliceRegistration.created",
                            "PoliceRegistration.scheduled",
                            "PoliceRegistration.complete",
                            "PoliceRegistration.error",
                            "PoliceRegistration.updated",
                            "PoliceRegistration.deleted",
                            "PoliceRegistration.progress",
                            "StatRegistration.created",
                            "StatRegistration.updated",
                            "StatRegistration.deleted",
                            "StatRegistration.scheduled",
                            "StatRegistration.progress",
                            "StatRegistration.complete",
                            "StatRegistration.error"
                        ]
                    },
                    "signature_secret": {
                        "type": "string"
                    },
                    "housing_id": {
                        "type": "string"
                    }
                }
            },
            "Webhook": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "event": {
                        "type": "string"
                    },
                    "target": {
                        "type": "string"
                    },
                    "housing_id": {
                        "type": "string"
                    },
                    "signature_secret": {
                        "type": "string",
                        "description": "Only when you sent none: returned once."
                    }
                }
            },
            "WebhookDelivery": {
                "type": "object",
                "properties": {
                    "hook": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "event": {
                                "type": "string"
                            },
                            "target": {
                                "type": "string"
                            }
                        }
                    },
                    "data": {
                        "type": "object",
                        "properties": {
                            "reservation_id": {
                                "type": "string"
                            },
                            "reservation_url": {
                                "type": "string"
                            },
                            "guest_id": {
                                "type": "string"
                            },
                            "guest_origin": {
                                "const": "BG_ONLINE"
                            }
                        }
                    }
                }
            }
        }
    }
}
