{
  "openapi": "3.1.0",
  "info": {
    "title": "BedsChain Partner API",
    "version": "1.0.0",
    "description": "Search hotels at your own prices, hold a price, book and cancel; webhooks for every change. Money is always {\"amount\": \"123.45\", \"currency\": \"AED\"} with the amount as text."
  },
  "servers": [
    {
      "url": "https://api.bedschain.com/partner/v1",
      "description": "Live"
    }
  ],
  "x-scopes": [
    "search",
    "book",
    "cancel",
    "bookings:read",
    "content:read",
    "wallet:read",
    "webhooks:manage"
  ],
  "x-webhook-events": [
    "booking.confirmed",
    "booking.failed",
    "booking.cancelled",
    "booking.on_request",
    "booking.hcn_received",
    "wallet.low_balance",
    "wallet.credited"
  ],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Your API key: Authorization: Bearer bc_live_… (bc_test_… on the sandbox)"
      }
    },
    "schemas": {
      "Booking": {
        "type": "object",
        "properties": {
          "reference": {
            "type": "string"
          },
          "clientReference": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PROCESSING",
              "ON_REQUEST",
              "CONFIRMED",
              "CANCELLATION_PENDING",
              "CANCELLED",
              "FAILED"
            ]
          },
          "vouchered": {
            "type": "boolean"
          },
          "paymentStatus": {
            "type": "string"
          },
          "payBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "hotel": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "address": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "phone": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "name",
              "address",
              "phone"
            ],
            "additionalProperties": false
          },
          "checkIn": {
            "type": "string"
          },
          "checkOut": {
            "type": "string"
          },
          "guestNationality": {
            "type": [
              "string",
              "null"
            ]
          },
          "rooms": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "board": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "guests": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string"
                      },
                      "title": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "firstName": {
                        "type": "string"
                      },
                      "lastName": {
                        "type": "string"
                      },
                      "age": {
                        "type": [
                          "number",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "type",
                      "title",
                      "firstName",
                      "lastName",
                      "age"
                    ],
                    "additionalProperties": false
                  }
                },
                "hotelConfirmation": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "name",
                "board",
                "guests",
                "hotelConfirmation"
              ],
              "additionalProperties": false
            }
          },
          "price": {
            "type": "object",
            "properties": {
              "amount": {
                "type": "string",
                "description": "Decimal as text, e.g. \"123.45\""
              },
              "currency": {
                "type": "string",
                "minLength": 3,
                "maxLength": 3
              }
            },
            "required": [
              "amount",
              "currency"
            ],
            "additionalProperties": false
          },
          "cancellation": {
            "type": "object",
            "properties": {
              "freeUntil": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "penalties": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "from": {
                      "type": "string"
                    },
                    "amount": {
                      "type": "object",
                      "properties": {
                        "amount": {
                          "type": "string",
                          "description": "Decimal as text, e.g. \"123.45\""
                        },
                        "currency": {
                          "type": "string",
                          "minLength": 3,
                          "maxLength": 3
                        }
                      },
                      "required": [
                        "amount",
                        "currency"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "from",
                    "amount"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "freeUntil",
              "penalties"
            ],
            "additionalProperties": false
          },
          "remarks": {},
          "createdAt": {
            "type": "string"
          },
          "voucherUrl": {
            "type": "string"
          }
        },
        "required": [
          "reference",
          "clientReference",
          "status",
          "vouchered",
          "paymentStatus",
          "payBy",
          "hotel",
          "checkIn",
          "checkOut",
          "guestNationality",
          "rooms",
          "price",
          "cancellation",
          "remarks",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "Money": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "string",
            "description": "Decimal as text, e.g. \"123.45\""
          },
          "currency": {
            "type": "string",
            "minLength": 3,
            "maxLength": 3
          }
        },
        "required": [
          "amount",
          "currency"
        ],
        "additionalProperties": false
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "retryable": {
                "type": "boolean"
              },
              "details": {},
              "requestId": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message",
              "retryable"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      }
    }
  },
  "paths": {
    "/destinations": {
      "get": {
        "summary": "Cities, areas and hotels by name",
        "operationId": "getDestinations",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "content:read",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/hotels": {
      "get": {
        "summary": "The hotels of a city, a page at a time (static content)",
        "operationId": "getHotels",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "content:read",
        "parameters": [
          {
            "name": "city",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "default": 1,
              "type": "integer",
              "minimum": 1,
              "maximum": 10000
            }
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "default": 100,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/hotels/changes": {
      "get": {
        "summary": "Hotels changed since a time, oldest first (1,000 a page; follow next)",
        "operationId": "getHotelsChanges",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "content:read",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/hotels/{hotelId}": {
      "get": {
        "summary": "A hotel’s static content: every photo in three sizes (url ~1000 px, small ~400 px, large up to 2000 px; WebP, jpeg for e-mails) from images.bedschain.com",
        "operationId": "getHotelsByHotelId",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "content:read",
        "parameters": [
          {
            "name": "hotelId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/availability": {
      "post": {
        "summary": "Search a city or up to 500 hotels; answers when complete or at timeoutMs",
        "operationId": "postAvailability",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "search",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "checkIn": {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  "checkOut": {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  "destination": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "cityId": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                          }
                        },
                        "required": [
                          "cityId"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "hotelIds": {
                            "minItems": 1,
                            "maxItems": 500,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            }
                          }
                        },
                        "required": [
                          "hotelIds"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "rooms": {
                    "minItems": 1,
                    "maxItems": 9,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "adults": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 9
                        },
                        "childAges": {
                          "default": [],
                          "maxItems": 6,
                          "type": "array",
                          "items": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 17
                          }
                        }
                      },
                      "required": [
                        "adults"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "nationality": {
                    "type": "string",
                    "pattern": "^[A-Z]{2}$"
                  },
                  "timeoutMs": {
                    "default": 8000,
                    "type": "integer",
                    "minimum": 1000,
                    "maximum": 20000
                  },
                  "maxOffersPerHotel": {
                    "default": 20,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 50
                  },
                  "filters": {
                    "type": "object",
                    "properties": {
                      "refundableOnly": {
                        "default": false,
                        "type": "boolean"
                      },
                      "boards": {
                        "maxItems": 10,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "pattern": "^[A-Z]{2}$"
                        }
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "checkIn",
                  "checkOut",
                  "destination",
                  "rooms",
                  "nationality"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/prebook": {
      "post": {
        "summary": "Check an offer with the hotel and hold its price",
        "operationId": "postPrebook",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "book",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 100
            },
            "description": "Send the same key to retry safely"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "offerId": {
                    "type": "string",
                    "minLength": 4,
                    "maxLength": 200
                  }
                },
                "required": [
                  "offerId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/bookings": {
      "post": {
        "summary": "Book a held price",
        "operationId": "postBookings",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "book",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 100
            },
            "description": "Send the same key to retry safely"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prebookId": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 64
                  },
                  "clientReference": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "paymentMethod": {
                    "default": "WALLET",
                    "type": "string",
                    "enum": [
                      "WALLET",
                      "PAY_LATER"
                    ]
                  },
                  "autoPay": {
                    "type": "string",
                    "enum": [
                      "NONE",
                      "WALLET",
                      "WALLET_THEN_CARD"
                    ]
                  },
                  "holder": {
                    "type": "object",
                    "properties": {
                      "firstName": {
                        "type": "string"
                      },
                      "lastName": {
                        "type": "string"
                      },
                      "email": {
                        "type": "string",
                        "format": "email",
                        "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                      },
                      "phone": {
                        "type": "string",
                        "maxLength": 30
                      }
                    },
                    "additionalProperties": false
                  },
                  "rooms": {
                    "minItems": 1,
                    "maxItems": 9,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "guests": {
                          "minItems": 1,
                          "maxItems": 9,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "ADULT",
                                  "CHILD"
                                ]
                              },
                              "title": {
                                "type": "string",
                                "enum": [
                                  "MR",
                                  "MRS",
                                  "MS",
                                  "MISS",
                                  "MSTR"
                                ]
                              },
                              "firstName": {
                                "type": "string"
                              },
                              "lastName": {
                                "type": "string"
                              },
                              "age": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 17
                              },
                              "lead": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "type",
                              "firstName",
                              "lastName"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "guests"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "specialRequests": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "prebookId",
                  "rooms"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Booking"
                }
              }
            }
          },
          "default": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "Your bookings, newest first",
        "operationId": "getBookings",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "bookings:read",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
            }
          },
          {
            "name": "clientReference",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "maximum": 1000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/bookings/{reference}": {
      "get": {
        "summary": "One booking, with its latest status",
        "operationId": "getBookingsByReference",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "bookings:read",
        "parameters": [
          {
            "name": "reference",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Booking"
                }
              }
            }
          },
          "default": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/bookings/{reference}/cancel-quote": {
      "get": {
        "summary": "What cancelling now costs",
        "operationId": "getBookingsByReferenceCancelQuote",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "cancel",
        "parameters": [
          {
            "name": "reference",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/bookings/{reference}/cancel": {
      "post": {
        "summary": "Cancel at the quoted charge",
        "operationId": "postBookingsByReferenceCancel",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "cancel",
        "parameters": [
          {
            "name": "reference",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 100
            },
            "description": "Send the same key to retry safely"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expectedCharge": {
                    "type": "object",
                    "properties": {
                      "amount": {
                        "type": "string",
                        "pattern": "^\\d+(\\.\\d+)?$"
                      },
                      "currency": {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      }
                    },
                    "required": [
                      "amount",
                      "currency"
                    ],
                    "additionalProperties": false
                  },
                  "reason": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "expectedCharge"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Booking"
                }
              }
            }
          },
          "default": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/wallet": {
      "get": {
        "summary": "Balances, credit and what is available",
        "operationId": "getWallet",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "wallet:read",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/webhooks": {
      "get": {
        "summary": "Your webhook endpoints",
        "operationId": "getWebhooks",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "webhooks:manage",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Add an endpoint; its signing secret is shown once",
        "operationId": "postWebhooks",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "webhooks:manage",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "maxLength": 500,
                    "format": "uri"
                  },
                  "events": {
                    "minItems": 1,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "booking.confirmed",
                        "booking.failed",
                        "booking.cancelled",
                        "booking.on_request",
                        "booking.hcn_received",
                        "wallet.low_balance",
                        "wallet.credited"
                      ]
                    }
                  }
                },
                "required": [
                  "url",
                  "events"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/webhooks/{id}": {
      "delete": {
        "summary": "Remove an endpoint",
        "operationId": "deleteWebhooksById",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "webhooks:manage",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Done"
          },
          "default": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/webhooks/{id}/test": {
      "post": {
        "summary": "Send a test event",
        "operationId": "postWebhooksByIdTest",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-scope": "webhooks:manage",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "An error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  }
}
