{
  "openapi": "3.0.0",
  "info": {
    "version": "2.0.0",
    "title": "Blackbell integrations API (/api/i)",
    "description": "Blackbell for business"
  },
  "security": [
    {
      "api_key": []
    }
  ],
  "paths": {
    "/new_service_requests/web_hooks": {
      "x-ms-notification-content": {
        "description": "Details for hook",
        "schema": {
          "$ref": "#/components/schemas/ServiceRequest"
        }
      },
      "post": {
        "description": "Creates a hook for new orders",
        "summary": "Triggers when new order placed",
        "operationId": "AddNewOrdersHook",
        "x-ms-trigger": "single",
        "requestBody": {
          "$ref": "#/components/requestBodies/HookRequestBody"
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Hook"
                }
              }
            }
          }
        }
      }
    },
    "/web_hooks/{hook_id}": {
      "delete": {
        "summary": "Delete Web Hook",
        "description": "Deletes existing hook",
        "operationId": "DeleteHookTrigger",
        "x-ms-visibility": "internal",
        "parameters": [
          {
            "name": "hook_id",
            "in": "path",
            "required": true,
            "description": "Hook ID to delete",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          }
        }
      }
    },
    "/new_conversations/web_hooks": {
      "x-ms-notification-content": {
        "description": "Details for hook",
        "schema": {
          "$ref": "#/components/schemas/Chat"
        }
      },
      "post": {
        "description": "Creates a hook for new chats",
        "summary": "Triggers when new chat is started",
        "operationId": "AddNewChatsHook",
        "x-ms-trigger": "single",
        "requestBody": {
          "$ref": "#/components/requestBodies/HookRequestBody"
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Hook"
                }
              }
            }
          }
        }
      }
    },
    "/customer_groups": {
      "get": {
        "summary": "The account's customer groups (saved label rules) with the rule in words and the people count",
        "operationId": "ListCustomerGroups",
        "tags": [
          "Integrations"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "summary": "Create a customer group: a saved rule on labels and custom fields. Answers the rule in words and the people count",
        "operationId": "CreateCustomerGroup",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/CreateCustomerGroupBody"
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/customer_groups/{id}": {
      "put": {
        "summary": "Change a customer group; a rule key given replaces the whole rule. Pages, forms and broadcasts that use it change at once",
        "operationId": "UpdateCustomerGroup",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Group id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/CreateCustomerGroupBody"
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "summary": "Delete a customer group. Refused while a page, form, version or unsent broadcast uses it (used_by)",
        "operationId": "DeleteCustomerGroup",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Group id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/visitors/{visitor_id}/invite": {
      "post": {
        "summary": "Email a contact a sign-in to the app (only when the person asks)",
        "operationId": "InviteContact",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "visitor_id",
            "in": "path",
            "required": true,
            "description": "Customer id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/labels": {
      "get": {
        "summary": "Labels, tags, customer groups: the account's customer labels",
        "operationId": "ListLabels",
        "tags": [
          "Integrations"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "summary": "Create a customer label (an existing name returns that label)",
        "operationId": "CreateLabel",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "status",
                      "access",
                      "other"
                    ]
                  },
                  "ends_after_months": {
                    "type": "integer",
                    "description": "Access labels only: removed N months after a person gets it"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/labels/{id}": {
      "patch": {
        "summary": "Set the kind of a customer label (status, access, other); access labels can end after N months",
        "operationId": "SetLabelKind",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Label id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "status",
                      "access",
                      "other"
                    ]
                  },
                  "ends_after_months": {
                    "type": "integer",
                    "description": "Access labels only: removed N months after a person gets it"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/labels/{id}/visitors": {
      "post": {
        "summary": "Add or remove one label on up to 1,000 customers",
        "operationId": "BulkLabelCustomers",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Label id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sync_type": {
                    "type": "string",
                    "enum": [
                      "add",
                      "remove"
                    ]
                  },
                  "visitor_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  },
                  "visitor_emails": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/visitors": {
      "get": {
        "summary": "Customers, clients, members, users, people, sign-ups, count: list the account's customers with their label_ids, by id, one page at a time (answers total, page and per_page). Short rows (id, name, email, phone, label_ids, joined_on). Filters: labels, sign-up dates or last N days, name or email; count_only answers the number alone",
        "operationId": "ListCustomers",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": true,
            "description": "From 1",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Up to 500, default 100",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Label filter: customers with all of labels_id_in, or none of labels_id_not_in",
            "properties": {
              "labels_id_in": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              "labels_id_not_in": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              }
            },
            "schema": {
              "type": "object",
              "additionalProperties": false
            }
          },
          {
            "name": "signed_up_from",
            "in": "query",
            "required": false,
            "description": "Joined on or after this day, YYYY-MM-DD (account time zone)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "signed_up_to",
            "in": "query",
            "required": false,
            "description": "Joined on or before this day, YYYY-MM-DD",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "signed_up_last_days",
            "in": "query",
            "required": false,
            "description": "Joined in the last N days (no date needed)",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Part of a name or email",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "detail",
            "in": "query",
            "required": false,
            "description": "true: full rows (stays, custom fields); default short rows",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "count_only",
            "in": "query",
            "required": false,
            "description": "true: answers { total } alone, no rows",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "missing",
            "in": "query",
            "required": false,
            "description": "Only customers with no email",
            "schema": {
              "type": "string",
              "enum": [
                "no_email"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "summary": "Create or match one customer by email; never removes labels",
        "operationId": "UpsertCustomer",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string"
                  },
                  "first_name": {
                    "type": "string"
                  },
                  "last_name": {
                    "type": "string"
                  },
                  "locale": {
                    "type": "string"
                  },
                  "country": {
                    "type": "string"
                  },
                  "label_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/visitors/bulk": {
      "post": {
        "summary": "Create or match up to 1,000 customers, one answer per row",
        "operationId": "ImportCustomers",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "visitors": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/visitors/bulk_update": {
      "post": {
        "summary": "Up to 1,000 people: creates the emails that are not customers, then labels (add, remove, replace) and custom fields (set, clear; a row can hold its own values). 200 or fewer answer the result; more answer an id for GetCustomerBulkUpdate",
        "operationId": "BulkUpdateCustomers",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "visitor_emails": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "visitor_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  },
                  "rows": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "email": {
                          "type": "string"
                        },
                        "first_name": {
                          "type": "string"
                        },
                        "last_name": {
                          "type": "string"
                        },
                        "crm_fields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "crm_field_definition_id": {
                                "type": "integer"
                              },
                              "action": {
                                "type": "string",
                                "enum": [
                                  "set",
                                  "clear"
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "labels": {
                    "type": "object",
                    "properties": {
                      "mode": {
                        "type": "string",
                        "enum": [
                          "add",
                          "remove",
                          "replace"
                        ]
                      },
                      "label_ids": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      }
                    }
                  },
                  "crm_fields": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "crm_field_definition_id": {
                          "type": "integer"
                        },
                        "action": {
                          "type": "string",
                          "enum": [
                            "set",
                            "clear"
                          ]
                        }
                      }
                    }
                  },
                  "create_only": {
                    "type": "boolean",
                    "description": "true: only create the missing customers (no labels or fields); answers visitor_ids"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/visitors/bulk_update/{job_id}": {
      "get": {
        "summary": "Progress of a BulkUpdateCustomers run",
        "operationId": "GetCustomerBulkUpdate",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "description": "The id BulkUpdateCustomers gave",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/visitors/{visitor_id}/labels": {
      "post": {
        "summary": "Add labels on one customer; the customer's other labels stay",
        "operationId": "AddLabels",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "visitor_id",
            "in": "path",
            "required": true,
            "description": "Customer id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/visitors/{visitor_id}/labels/{id}": {
      "delete": {
        "summary": "Remove one label from one customer",
        "operationId": "RemoveLabel",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "visitor_id",
            "in": "path",
            "required": true,
            "description": "Customer id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Label id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/visitors/{id}/crm_fields": {
      "put": {
        "summary": "Write custom field values on one customer",
        "operationId": "SetCustomerFields",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Customer id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "crm_fields_attributes": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/crm_group_definitions": {
      "get": {
        "summary": "The account's custom field groups and fields with their ids and options (for SetCustomerFields)",
        "operationId": "ListCustomFields",
        "tags": [
          "Integrations"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/broadcasts": {
      "get": {
        "summary": "Broadcasts, newest first: id, state, channel, title per language, asks_answer, created_at, sent_at",
        "operationId": "ListBroadcasts",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": false,
            "description": "Only broadcasts made on or after this date (2026-11-01)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "From 1",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Up to 100, default 20",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "summary": "Create a draft broadcast (draft: true) with its text, channel and audience. Sends nothing",
        "operationId": "DraftBroadcast",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "draft": {
                    "type": "boolean"
                  },
                  "visitor_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "These customers only (use alone)"
                  },
                  "labels_id_in": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Customers with all of these labels"
                  },
                  "labels_id_in_any": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Customers with at least one of these labels, for example several buildings (not with labels_id_in)"
                  },
                  "labels_id_not_in": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Leave out customers with any of these labels"
                  },
                  "groups_in": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Customer groups (list_customer_groups); a group = its labels. With labels too, both must match"
                  },
                  "groups_mode": {
                    "type": "string",
                    "enum": [
                      "any",
                      "all"
                    ],
                    "description": "any (default): one group is enough; all: in every group"
                  },
                  "groups_not_in": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Leave out people in any of these groups"
                  },
                  "everyone": {
                    "type": "boolean",
                    "description": "Every customer of the account (with labels_id_not_in or groups_not_in to leave people out)"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "moving_out_soon",
                      "approved_only"
                    ],
                    "description": "Optional: only people moving out soon, or only approved people"
                  },
                  "answers": {
                    "type": "object",
                    "description": "Ask for an answer. People answer with 2 to 4 buttons in the app and the email",
                    "properties": {
                      "enabled": {
                        "type": "boolean",
                        "description": "Default true; false stops asking"
                      },
                      "preset": {
                        "type": "string",
                        "enum": [
                          "access_visit",
                          "yes_no",
                          "attend",
                          "custom"
                        ],
                        "description": "Quick pick: access_visit (I will be present / Use management keys), yes_no, attend (I'll attend / I can't attend). Alone it fills the buttons; custom = your options"
                      },
                      "options": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "label": {
                              "type": "string",
                              "description": "At most 40 characters"
                            },
                            "asks": {
                              "type": "string",
                              "enum": [
                                "date",
                                "text"
                              ],
                              "description": "Optional: this button also asks for a date or a short text"
                            },
                            "asks_label": {
                              "type": "string",
                              "description": "The words over the date or text box"
                            },
                            "after_text": {
                              "type": "string",
                              "description": "Shown after the answer is saved"
                            }
                          }
                        },
                        "description": "2 to 4 buttons, in order"
                      },
                      "answer_by": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Optional deadline (ISO 8601 with offset); the buttons close after it and the sender gets a summary"
                      },
                      "reminder_hours": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        },
                        "description": "Up to 2 automatic reminders to people who did not answer: hours before answer_by (2, 6, 12, 24, 48), or after the send without answer_by (6, 12, 24, 48, 72). Each reminder counts in the quota"
                      },
                      "allow_note": {
                        "type": "boolean",
                        "description": "People can add a one-line note"
                      },
                      "buttons_after": {
                        "type": "integer",
                        "description": "Put the buttons after block N of the text (1 = after the first paragraph); empty = after the text"
                      }
                    }
                  },
                  "delivery": {
                    "type": "object",
                    "description": "Missed people",
                    "properties": {
                      "alert": {
                        "type": "boolean",
                        "description": "One hour after the send, email the people not reached to alert_to (default true)"
                      },
                      "backup": {
                        "type": "boolean",
                        "description": "Try another channel: no app -> email, no email -> push, email bounced -> push (default false)"
                      },
                      "alert_to": {
                        "type": "object",
                        "description": "Who gets the not reached list: staff of this account (list_team ids) and/or typed emails, 1 to 10 people. Left out: a new draft gets the people of the last broadcast (else you); a draft keeps its people",
                        "properties": {
                          "staff_ids": {
                            "type": "array",
                            "items": {
                              "type": "integer"
                            }
                          },
                          "emails": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  },
                  "communication_channel": {
                    "type": "string",
                    "enum": [
                      "email",
                      "push_notification",
                      "push_or_email",
                      "push_and_email"
                    ]
                  },
                  "translation_texts": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string"
                      },
                      "body": {
                        "type": "string",
                        "description": "HTML (<p>, <b>, <a href>), or plain text: a blank line starts a new paragraph"
                      }
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/broadcasts/{id}": {
      "get": {
        "summary": "One broadcast: state, audience with names and audience_count (now), answers, delivery settings, receipts and cms_url",
        "operationId": "GetBroadcast",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Broadcast id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "put": {
        "summary": "Change a draft broadcast's title, body, locale, channel, answers or delivery. Keys left out stay. Sends nothing",
        "operationId": "EditBroadcastDraft",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Broadcast id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "The title (also the email subject and the push title)"
                  },
                  "body": {
                    "type": "string",
                    "description": "The whole message as HTML; it replaces the old text"
                  },
                  "locale": {
                    "type": "string",
                    "description": "Language of title and body, for example en or fr"
                  },
                  "communication_channel": {
                    "type": "string",
                    "enum": [
                      "email",
                      "push_notification",
                      "push_or_email",
                      "push_and_email"
                    ]
                  },
                  "answers": {
                    "type": "object",
                    "description": "Ask for an answer. People answer with 2 to 4 buttons in the app and the email",
                    "properties": {
                      "enabled": {
                        "type": "boolean",
                        "description": "Default true; false stops asking"
                      },
                      "preset": {
                        "type": "string",
                        "enum": [
                          "access_visit",
                          "yes_no",
                          "attend",
                          "custom"
                        ],
                        "description": "Quick pick: access_visit (I will be present / Use management keys), yes_no, attend (I'll attend / I can't attend). Alone it fills the buttons; custom = your options"
                      },
                      "options": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "label": {
                              "type": "string",
                              "description": "At most 40 characters"
                            },
                            "asks": {
                              "type": "string",
                              "enum": [
                                "date",
                                "text"
                              ],
                              "description": "Optional: this button also asks for a date or a short text"
                            },
                            "asks_label": {
                              "type": "string",
                              "description": "The words over the date or text box"
                            },
                            "after_text": {
                              "type": "string",
                              "description": "Shown after the answer is saved"
                            }
                          }
                        },
                        "description": "2 to 4 buttons, in order"
                      },
                      "answer_by": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Optional deadline (ISO 8601 with offset); the buttons close after it and the sender gets a summary"
                      },
                      "reminder_hours": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        },
                        "description": "Up to 2 automatic reminders to people who did not answer: hours before answer_by (2, 6, 12, 24, 48), or after the send without answer_by (6, 12, 24, 48, 72). Each reminder counts in the quota"
                      },
                      "allow_note": {
                        "type": "boolean",
                        "description": "People can add a one-line note"
                      },
                      "buttons_after": {
                        "type": "integer",
                        "description": "Put the buttons after block N of the text (1 = after the first paragraph); empty = after the text"
                      }
                    }
                  },
                  "delivery": {
                    "type": "object",
                    "description": "Missed people",
                    "properties": {
                      "alert": {
                        "type": "boolean",
                        "description": "One hour after the send, email the people not reached to alert_to (default true)"
                      },
                      "backup": {
                        "type": "boolean",
                        "description": "Try another channel: no app -> email, no email -> push, email bounced -> push (default false)"
                      },
                      "alert_to": {
                        "type": "object",
                        "description": "Who gets the not reached list: staff of this account (list_team ids) and/or typed emails, 1 to 10 people. Left out: a new draft gets the people of the last broadcast (else you); a draft keeps its people",
                        "properties": {
                          "staff_ids": {
                            "type": "array",
                            "items": {
                              "type": "integer"
                            }
                          },
                          "emails": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/broadcasts/{id}/preview": {
      "get": {
        "summary": "The email, iPhone push and app views of a broadcast, with screenshots. Status running: call again in 20 s",
        "operationId": "PreviewBroadcast",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Broadcast id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "description": "Language to show, default the account language",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/broadcasts/{id}/audience": {
      "put": {
        "summary": "Replace a draft broadcast's audience (sends nothing): visitor_ids, or labels_id_in and/or labels_id_not_in, or everyone: true. Answers the new audience and its count",
        "operationId": "SetBroadcastAudience",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Broadcast id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "visitor_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "These customers only (use alone)"
                  },
                  "labels_id_in": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Customers with all of these labels"
                  },
                  "labels_id_in_any": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Customers with at least one of these labels, for example several buildings (not with labels_id_in)"
                  },
                  "labels_id_not_in": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Leave out customers with any of these labels"
                  },
                  "groups_in": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Customer groups (list_customer_groups); a group = its labels. With labels too, both must match"
                  },
                  "groups_mode": {
                    "type": "string",
                    "enum": [
                      "any",
                      "all"
                    ],
                    "description": "any (default): one group is enough; all: in every group"
                  },
                  "groups_not_in": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Leave out people in any of these groups"
                  },
                  "everyone": {
                    "type": "boolean",
                    "description": "Every customer of the account (with labels_id_not_in or groups_not_in to leave people out)"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "moving_out_soon",
                      "approved_only"
                    ],
                    "description": "Optional: only people moving out soon, or only approved people"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/broadcasts/{id}/settings": {
      "put": {
        "summary": "Change a draft's answers (ask for an answer) and/or delivery (missed people). Keys left out keep their value; answers: { enabled: false } stops asking. Sends nothing",
        "operationId": "SetBroadcastSettings",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Broadcast id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "answers": {
                    "type": "object",
                    "description": "Ask for an answer. People answer with 2 to 4 buttons in the app and the email",
                    "properties": {
                      "enabled": {
                        "type": "boolean",
                        "description": "Default true; false stops asking"
                      },
                      "preset": {
                        "type": "string",
                        "enum": [
                          "access_visit",
                          "yes_no",
                          "attend",
                          "custom"
                        ],
                        "description": "Quick pick: access_visit (I will be present / Use management keys), yes_no, attend (I'll attend / I can't attend). Alone it fills the buttons; custom = your options"
                      },
                      "options": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "label": {
                              "type": "string",
                              "description": "At most 40 characters"
                            },
                            "asks": {
                              "type": "string",
                              "enum": [
                                "date",
                                "text"
                              ],
                              "description": "Optional: this button also asks for a date or a short text"
                            },
                            "asks_label": {
                              "type": "string",
                              "description": "The words over the date or text box"
                            },
                            "after_text": {
                              "type": "string",
                              "description": "Shown after the answer is saved"
                            }
                          }
                        },
                        "description": "2 to 4 buttons, in order"
                      },
                      "answer_by": {
                        "type": "string",
                        "format": "date-time",
                        "description": "Optional deadline (ISO 8601 with offset); the buttons close after it and the sender gets a summary"
                      },
                      "reminder_hours": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        },
                        "description": "Up to 2 automatic reminders to people who did not answer: hours before answer_by (2, 6, 12, 24, 48), or after the send without answer_by (6, 12, 24, 48, 72). Each reminder counts in the quota"
                      },
                      "allow_note": {
                        "type": "boolean",
                        "description": "People can add a one-line note"
                      },
                      "buttons_after": {
                        "type": "integer",
                        "description": "Put the buttons after block N of the text (1 = after the first paragraph); empty = after the text"
                      }
                    }
                  },
                  "delivery": {
                    "type": "object",
                    "description": "Missed people",
                    "properties": {
                      "alert": {
                        "type": "boolean",
                        "description": "One hour after the send, email the people not reached to alert_to (default true)"
                      },
                      "backup": {
                        "type": "boolean",
                        "description": "Try another channel: no app -> email, no email -> push, email bounced -> push (default false)"
                      },
                      "alert_to": {
                        "type": "object",
                        "description": "Who gets the not reached list: staff of this account (list_team ids) and/or typed emails, 1 to 10 people. Left out: a new draft gets the people of the last broadcast (else you); a draft keeps its people",
                        "properties": {
                          "staff_ids": {
                            "type": "array",
                            "items": {
                              "type": "integer"
                            }
                          },
                          "emails": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/broadcasts/{id}/answers": {
      "get": {
        "summary": "Answers of a broadcast: counts per button and No answer, reminders, one row per person (first 500), answers_url",
        "operationId": "GetBroadcastAnswers",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Broadcast id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/broadcasts/{id}/answers/remind": {
      "post": {
        "summary": "Send the broadcast again to the people who did not answer (or only visitor_ids), after the person said yes. It is a send: it counts in the quota",
        "operationId": "RemindBroadcastAnswers",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Broadcast id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "visitor_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Optional: only these people (they must not have answered)"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/broadcasts/{id}/delivery": {
      "get": {
        "summary": "Proof of delivery in people: sent, delivered, bounced, read, clicked, answered, not reached; history; rows; delivery_url",
        "operationId": "GetBroadcastDelivery",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Broadcast id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/broadcasts/{id}/duplicate": {
      "post": {
        "summary": "Copy any broadcast to a new draft: texts, channel, audience, image, button, answers. Sends nothing",
        "operationId": "DuplicateBroadcast",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Broadcast id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/broadcasts/{id}/look": {
      "put": {
        "summary": "Set or remove a draft's header image and button. Keys left out stay. Sends nothing",
        "operationId": "SetBroadcastLook",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Broadcast id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "image_url": {
                    "type": "string",
                    "description": "https or data:image URL; replaces the header image"
                  },
                  "remove_image": {
                    "type": "boolean"
                  },
                  "button": {
                    "type": "object",
                    "description": "Replaces the button: label and one of url, page_id, form_id",
                    "properties": {
                      "label": {
                        "type": "string"
                      },
                      "url": {
                        "type": "string"
                      },
                      "page_id": {
                        "type": "integer"
                      },
                      "form_id": {
                        "type": "integer"
                      },
                      "color": {
                        "type": "string",
                        "description": "Optional, like #1a73e8"
                      }
                    }
                  },
                  "remove_button": {
                    "type": "boolean"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/broadcasts/{id}/test": {
      "post": {
        "summary": "Send the broadcast to yourself only (your email and/or app, by its channel). No customer gets it",
        "operationId": "SendTestBroadcast",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Broadcast id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/broadcasts/{id}/send": {
      "post": {
        "summary": "Send a draft broadcast (list, labels or everyone audience) after the person said yes. Once only, quota checked.",
        "operationId": "SendBroadcast",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Broadcast id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "everyone": {
                    "type": "boolean",
                    "description": "Required (true) when the audience is everyone"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/services": {
      "get": {
        "summary": "Offers, services, what can be booked: published booking forms with a calendar",
        "operationId": "ListOffers",
        "tags": [
          "Integrations"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/services/{id}/slots": {
      "get": {
        "summary": "Free slots, availability, open times of one day",
        "operationId": "ListFreeSlots",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Form id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "date",
            "in": "query",
            "required": true,
            "description": "YYYY-MM-DD",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "calendar_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/holds": {
      "post": {
        "summary": "Hold a free slot for 15 minutes",
        "operationId": "HoldSlot",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "service_id": {
                    "type": "integer"
                  },
                  "calendar_id": {
                    "type": "integer"
                  },
                  "visitor_id": {
                    "type": "integer"
                  },
                  "starts_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "slots_amount": {
                    "type": "integer"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/holds/{id}": {
      "get": {
        "summary": "Read the hold status (held, confirmed or released). Confirm the hold to get a payment link.",
        "operationId": "GetHold",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Hold id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "summary": "Free the slot now",
        "operationId": "ReleaseHold",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Hold id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/holds/{id}/confirm": {
      "post": {
        "summary": "Turn the hold into an order; answers pay_url for the customer (card, Apple Pay, Google Pay)",
        "operationId": "ConfirmHold",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Hold id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/calendar_events/schedule": {
      "get": {
        "summary": "Every event in from..to (orders and manual events) with calendar, customer, status and labels. changed_since gives changes only",
        "operationId": "ListAgendaEvents",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "description": "ISO 8601, e.g. 2026-11-01T00:00:00Z",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "description": "ISO 8601, after from",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "label_id",
            "in": "query",
            "required": false,
            "description": "Only events with this label",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "changed_since",
            "in": "query",
            "required": false,
            "description": "server_time of an earlier answer (at most 7 days old)",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/pages": {
      "get": {
        "summary": "Pages, site, website: the account's pages: title, status, members only, URL. search finds words in titles and texts, with each match",
        "operationId": "ListPages",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Words to find in titles and block texts",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "online",
                "archived"
              ]
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "From 1",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Up to 200, default 50",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "summary": "Create a draft page in the main language; with html it becomes a free page in an edit session. Answers page_id, preview_url and to_fix",
        "operationId": "CreatePage",
        "tags": [
          "Pages"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "Page title (menus, editor)"
                  },
                  "slug": {
                    "type": "string",
                    "description": "Web address part, e.g. summer-camp"
                  },
                  "seo_title": {
                    "type": "string"
                  },
                  "seo_description": {
                    "type": "string"
                  },
                  "seo_image_url": {
                    "type": "string",
                    "description": "Share image, a https link"
                  },
                  "html": {
                    "type": "string",
                    "description": "The whole page: one HTML document with its <style> and <script> inside (or the body only)"
                  },
                  "upload_id": {
                    "type": "string",
                    "description": "Instead of html, for a page already in a file: send it to get_upload_link's link with curl, then pass upload_id (much faster than writing the html here)"
                  },
                  "css": {
                    "type": "string",
                    "description": "More CSS (optional)"
                  },
                  "js": {
                    "type": "string",
                    "description": "More JS (optional)"
                  },
                  "forms_to": {
                    "type": "string",
                    "description": "form:<form id>, booking:<calendar ids> or chat: each form that sends nowhere becomes this Blackbell button (list_forms). Forms that the page JS handles, web forms (data-bb-form) and forms with data-bb-ignore stay"
                  },
                  "locale": {
                    "type": "string",
                    "description": "Language code (default: the account's main language)"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/pages/{id}": {
      "get": {
        "summary": "One page: settings, access, slug, languages, and its blocks in order with a summary and where each click goes",
        "operationId": "GetPage",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Page id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/pages/{id}/outline": {
      "get": {
        "summary": "The page in about 2 KB: blocks in order, free page sections with code line, heading, text keys and links. Read this first",
        "operationId": "GetPageOutline",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Page id, or copy_page_id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/uploads": {
      "post": {
        "summary": "A one-time upload link (1 hour) for a file: curl -sS -T file '<upload_url>', then pass upload_id",
        "operationId": "GetUploadLink",
        "tags": [
          "Pages"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/pages/import": {
      "post": {
        "summary": "Put a whole HTML page (upload_id or html) on the site as a new draft page. Answers page_id, preview_url, url and similar_pages",
        "operationId": "ImportPage",
        "tags": [
          "Pages"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "Default: the <title> of the file"
                  },
                  "slug": {
                    "type": "string",
                    "description": "Web address part, e.g. summer-camp"
                  },
                  "html": {
                    "type": "string",
                    "description": "The whole page: one HTML document with its <style> and <script> inside (or the body only)"
                  },
                  "upload_id": {
                    "type": "string",
                    "description": "Instead of html, for a page already in a file: send it to get_upload_link's link with curl, then pass upload_id (much faster than writing the html here)"
                  },
                  "css": {
                    "type": "string",
                    "description": "More CSS (optional)"
                  },
                  "js": {
                    "type": "string",
                    "description": "More JS (optional)"
                  },
                  "forms_to": {
                    "type": "string",
                    "description": "form:<form id>, booking:<calendar ids> or chat: each form that sends nowhere becomes this Blackbell button (list_forms). Forms that the page JS handles, web forms (data-bb-form) and forms with data-bb-ignore stay"
                  },
                  "locale": {
                    "type": "string",
                    "description": "Language code (default: the account's main language)"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/pages/edit": {
      "post": {
        "summary": "Find a text in every page; with changes and one page found, edit it in that page's edit session. Answers pages and code snippets",
        "operationId": "FindAndEdit",
        "tags": [
          "Pages"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "find": {
                    "type": "string",
                    "description": "A text the page shows or holds in its code, 3 characters or more"
                  },
                  "changes": {
                    "type": "array",
                    "description": "Like edit_page changes",
                    "items": {
                      "type": "object"
                    }
                  },
                  "dry_run": {
                    "type": "boolean",
                    "description": "Default false"
                  },
                  "locale": {
                    "type": "string",
                    "description": "Language code (default: the account's main language)"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/pages/{page_id}/languages": {
      "post": {
        "summary": "Add or replace one language of a free page, from upload_id, html or from_page_id. Same texts in the same order. Goes into the edit session",
        "operationId": "AddPageLanguage",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "page_id",
            "in": "path",
            "required": true,
            "description": "Page id (the live page)",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "locale": {
                    "type": "string",
                    "description": "The language of these texts, for example fr"
                  },
                  "html": {
                    "type": "string",
                    "description": "The whole page in that language (or the body only)"
                  },
                  "upload_id": {
                    "type": "string",
                    "description": "Instead of html: the file sent to get_upload_link's link"
                  },
                  "from_page_id": {
                    "type": "integer",
                    "description": "Instead of html: a page of this account written in that language"
                  },
                  "title": {
                    "type": "string",
                    "description": "Page title in that language (default: the <title> of the file)"
                  },
                  "dry_run": {
                    "type": "boolean",
                    "description": "Default false: true only checks that the texts match"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/images": {
      "post": {
        "summary": "Store an image from a https or data URL for a page. Answers url to use with an alt text",
        "operationId": "UploadImage",
        "tags": [
          "Pages"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "https image link, or data:image/png;base64,..."
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/texts": {
      "get": {
        "summary": "Every text of the session copy in locale from, next to its text in locale to (null when missing)",
        "operationId": "GetPageTexts",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Default: the account's main language",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "description": "Language to translate to, for example fr",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/pages/{id}/stats": {
      "get": {
        "summary": "Page visits, views, traffic, analytics: views per day and bookings of linked forms, before and since the last go live",
        "operationId": "GetPageStats",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Page id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "description": "Default 30, max 180",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/menu": {
      "get": {
        "summary": "The site menu in order: each entry has a name and its items (pages or outside links). One item is a plain link; more items open a list",
        "operationId": "ListMenu",
        "tags": [
          "Pages"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "summary": "Put a page in the site menu, live at once: in the entry menu_id (list_menu), or as a new entry named name (default: the page title). Show the person the change and wait for a yes first",
        "operationId": "AddToMenu",
        "tags": [
          "Pages"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "page_id": {
                    "type": "integer"
                  },
                  "menu_id": {
                    "type": "integer"
                  },
                  "name": {
                    "type": "string"
                  },
                  "position": {
                    "type": "integer",
                    "description": "Place of a new entry (default: last)"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/menu/pages/{page_id}": {
      "delete": {
        "summary": "Take a page out of the site menu, live at once; an entry left empty goes too. The page itself stays",
        "operationId": "RemoveFromMenu",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "page_id",
            "in": "path",
            "required": true,
            "description": "Page id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/free_page": {
      "post": {
        "summary": "Replace the whole code of a free page (every language) in its edit session. For a big redesign only",
        "operationId": "ImportFreePage",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "html": {
                    "type": "string",
                    "description": "The whole page: one HTML document with its <style> and <script> inside (or the body only)"
                  },
                  "upload_id": {
                    "type": "string",
                    "description": "Instead of html, for a page already in a file: send it to get_upload_link's link with curl, then pass upload_id (much faster than writing the html here)"
                  },
                  "css": {
                    "type": "string",
                    "description": "More CSS (optional)"
                  },
                  "js": {
                    "type": "string",
                    "description": "More JS (optional)"
                  },
                  "forms_to": {
                    "type": "string",
                    "description": "form:<form id>, booking:<calendar ids> or chat: each form that sends nowhere becomes this Blackbell button (list_forms). Forms that the page JS handles, web forms (data-bb-form) and forms with data-bb-ignore stay"
                  },
                  "locale": {
                    "type": "string",
                    "description": "Language code (default: the account's main language)"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/pages/{page_id}/edit": {
      "post": {
        "summary": "Many changes to a page in one call, all or none, in its edit session: code, text, click, css_class, replace_text",
        "operationId": "EditPage",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "page_id",
            "in": "path",
            "required": true,
            "description": "Page id (the live page)",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "changes": {
                    "type": "array",
                    "description": "Up to 50, applied in order",
                    "items": {
                      "type": "object",
                      "required": [
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "code",
                            "text",
                            "click",
                            "css_class",
                            "replace_text"
                          ]
                        },
                        "block_id": {
                          "type": "integer"
                        },
                        "field": {
                          "type": "string",
                          "enum": [
                            "html",
                            "css",
                            "js"
                          ]
                        },
                        "old": {
                          "type": "string"
                        },
                        "at": {
                          "type": "string",
                          "enum": [
                            "end",
                            "start"
                          ]
                        },
                        "new": {
                          "type": "string"
                        },
                        "key": {
                          "type": "string"
                        },
                        "html": {
                          "type": "string"
                        },
                        "click_type": {
                          "type": "string"
                        },
                        "page_id": {
                          "type": "integer"
                        },
                        "form_id": {
                          "type": "integer"
                        },
                        "url": {
                          "type": "string"
                        },
                        "value": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "css_class": {
                          "type": "string"
                        },
                        "find": {
                          "type": "string"
                        },
                        "match_case": {
                          "type": "boolean"
                        },
                        "locale": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "dry_run": {
                    "type": "boolean",
                    "description": "Default false"
                  },
                  "locale": {
                    "type": "string",
                    "description": "Language code (default: the account's main language)"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/blocks/{id}": {
      "get": {
        "summary": "One block as the editor shows it: texts, images, buttons, items, visibility, who sees it and free page parts. Not the free page code",
        "operationId": "GetBlock",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Block id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "description": "Texts in this language (default: the main language); all = every language",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "code",
            "in": "query",
            "required": false,
            "description": "true = the whole free page code too (big: avoid)",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/blocks/{id}/code": {
      "get": {
        "summary": "Find text in a free page's code and get snippets with line numbers and unique; lines gives a range (up to 400)",
        "operationId": "SearchCode",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Free page block id (get_page)",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "query",
            "in": "query",
            "required": false,
            "description": "Text to find (a regex with regex true)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "field",
            "in": "query",
            "required": false,
            "description": "Default: all three",
            "schema": {
              "type": "string",
              "enum": [
                "html",
                "css",
                "js"
              ]
            }
          },
          {
            "name": "regex",
            "in": "query",
            "required": false,
            "description": "Default false",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "match_case",
            "in": "query",
            "required": false,
            "description": "Default false",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "context",
            "in": "query",
            "required": false,
            "description": "Characters around each match, default 150, max 1000",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "max",
            "in": "query",
            "required": false,
            "description": "Matches to answer, default 20, max 50",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "lines",
            "in": "query",
            "required": false,
            "description": "Read lines instead, like \"120-180\" (needs field)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions": {
      "post": {
        "summary": "Open a hidden copy of a page to edit: copy_page_id and preview_url. new: true and name make another hidden version",
        "operationId": "StartEditSession",
        "tags": [
          "Pages"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "page_id": {
                    "type": "integer",
                    "description": "Page to edit"
                  },
                  "name": {
                    "type": "string",
                    "description": "Name of the hidden version, like \"Christmas menu\" (80 characters)"
                  },
                  "new": {
                    "type": "boolean",
                    "description": "true: a new hidden version even if one is open"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}": {
      "get": {
        "summary": "An edit session: status, copy_page_id, preview_url, live_url and its steps with changes before and after",
        "operationId": "GetEditSession",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "summary": "Drop an edit session or a hidden version and its copy (also a version shown to groups: its people see the public page again; ask the person first). The live page stays as it is",
        "operationId": "DiscardEditSession",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/name": {
      "put": {
        "summary": "Rename a hidden version or a version shown to groups (60 characters). Only your team sees the name",
        "operationId": "RenameHiddenVersion",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id (list_hidden_versions)",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/duplicate": {
      "post": {
        "summary": "Copy a version as a new hidden version \"<name> (copy)\" with no group. At most 10 versions a page",
        "operationId": "DuplicateHiddenVersion",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id (list_hidden_versions)",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/check": {
      "get": {
        "summary": "The check of an edit session: problems that block go live, warnings, quality score with to_fix, and screenshots at 390 and 1440 px",
        "operationId": "CheckEditSession",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "render",
            "in": "query",
            "required": false,
            "description": "Default true; false skips the render",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "fix",
            "in": "query",
            "required": false,
            "description": "true: first make the safe fixes in the session (resized images, late loading below the first screen, alt texts from the nearest heading), listed in fixed. They never change the design or the texts",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/go_live": {
      "post": {
        "summary": "Put an edit session live after the person's yes. Refused (409) while the check finds a blocker or the live page changed. Answers live_urls with status",
        "operationId": "GoLiveEditSession",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "force": {
                    "type": "boolean",
                    "description": "true only after the person saw that the live page changed meanwhile and still wants this"
                  },
                  "publish": {
                    "type": "boolean",
                    "description": "true opens a draft page to visitors"
                  },
                  "add_to_menu": {
                    "type": "boolean",
                    "description": "true puts the page in the site menu"
                  },
                  "menu_id": {
                    "type": "integer",
                    "description": "Menu entry to add the page to (list_menu)"
                  },
                  "menu_name": {
                    "type": "string",
                    "description": "Name of a new menu entry (default: the page title)"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/undo": {
      "post": {
        "summary": "Put the page back as it was before this session went live, as a whole. Refused (409) if the page changed after going live, unless force",
        "operationId": "UndoEditSession",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "force": {
                    "type": "boolean",
                    "description": "true only after the person saw that the live page changed meanwhile and still wants this"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/undo_step": {
      "post": {
        "summary": "Undo one step of an open edit session (default the last). Answers the undone step and the steps now",
        "operationId": "UndoEditStep",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "step_id": {
                    "type": "integer",
                    "description": "A step_id from get_edit_session; left out, the last step"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/blocks/{block_id}/text": {
      "put": {
        "summary": "Replace one text of a block in the session copy, with editor HTML",
        "operationId": "SetText",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "block_id",
            "in": "path",
            "required": true,
            "description": "Block id in the session's copy (get_page copy_page_id)",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "description": "Text key from get_block (title, text, ...)"
                  },
                  "html": {
                    "type": "string",
                    "description": "The whole new text, as HTML"
                  },
                  "locale": {
                    "type": "string",
                    "description": "Language code (default: the account's main language)"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/blocks/{block_id}/click": {
      "put": {
        "summary": "Set where a button or image goes on click in the session copy: page, form, website, phone, email, none",
        "operationId": "SetClickAction",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "block_id",
            "in": "path",
            "required": true,
            "description": "Block id in the session's copy (get_page copy_page_id)",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "description": "Button or image key from get_block"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "none",
                      "page",
                      "form",
                      "website",
                      "youtube",
                      "email",
                      "phone",
                      "whatsapp",
                      "telegram",
                      "instagram",
                      "messenger"
                    ],
                    "description": "page: page_id; form: form_id; website, youtube: url; email, phone and chat apps: value; none clears"
                  },
                  "page_id": {
                    "type": "integer"
                  },
                  "form_id": {
                    "type": "integer"
                  },
                  "form_mode": {
                    "type": "string",
                    "enum": [
                      "wizard",
                      "autoopen",
                      "page"
                    ]
                  },
                  "url": {
                    "type": "string"
                  },
                  "value": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string",
                    "description": "Button label (optional)"
                  },
                  "locale": {
                    "type": "string",
                    "description": "Language code (default: the account's main language)"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/blocks/{block_id}/text_style": {
      "put": {
        "summary": "Font, size and alignment of one text slot (all languages) in the session copy",
        "operationId": "SetTextStyle",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "block_id",
            "in": "path",
            "required": true,
            "description": "Block id in the session's copy (get_page copy_page_id)",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "description": "Text key from get_block"
                  },
                  "font_family": {
                    "type": "string"
                  },
                  "size": {
                    "type": "integer"
                  },
                  "align": {
                    "type": "string",
                    "enum": [
                      "left",
                      "center",
                      "right",
                      "none"
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/blocks/{block_id}/format": {
      "put": {
        "summary": "Make a phrase bold, italic, underlined, coloured or a link in one text of the session copy",
        "operationId": "FormatText",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "block_id",
            "in": "path",
            "required": true,
            "description": "Block id in the session's copy (get_page copy_page_id)",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string"
                  },
                  "phrase": {
                    "type": "string",
                    "description": "Exact words, as in the text"
                  },
                  "occurrence": {
                    "type": "integer",
                    "description": "From 1; all when left out"
                  },
                  "bold": {
                    "type": "boolean"
                  },
                  "italic": {
                    "type": "boolean"
                  },
                  "underline": {
                    "type": "boolean"
                  },
                  "color": {
                    "type": "string",
                    "description": "#rrggbb, rgb(...) or a colour name"
                  },
                  "link": {
                    "type": "string",
                    "description": "/page/<id>, /service/<id>?wizard=true, https://..., mailto: or tel:"
                  },
                  "locale": {
                    "type": "string",
                    "description": "Language code (default: the account's main language)"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/replace_text": {
      "post": {
        "summary": "Find and replace words in every text of the session copy. dry_run is true by default",
        "operationId": "ReplaceText",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "find": {
                    "type": "string"
                  },
                  "match_case": {
                    "type": "boolean"
                  },
                  "dry_run": {
                    "type": "boolean",
                    "description": "Default true"
                  },
                  "locale": {
                    "type": "string",
                    "description": "Language code (default: the account's main language)"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/blocks/{block_id}/code": {
      "post": {
        "summary": "Patch a free page's HTML, CSS or JS in the session copy with old/new pairs; each old text appears once. All or none",
        "operationId": "ReplaceCode",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "block_id",
            "in": "path",
            "required": true,
            "description": "Block id in the session's copy (get_page copy_page_id)",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pairs": {
                    "type": "array",
                    "description": "Up to 50 changes, applied in order",
                    "items": {
                      "type": "object",
                      "required": [
                        "field",
                        "new"
                      ],
                      "properties": {
                        "field": {
                          "type": "string",
                          "enum": [
                            "html",
                            "css",
                            "js"
                          ]
                        },
                        "old": {
                          "type": "string",
                          "description": "Exact text now in the field, found once"
                        },
                        "at": {
                          "type": "string",
                          "enum": [
                            "end",
                            "start"
                          ],
                          "description": "Instead of old: add new at the end (or start) of the field, like new CSS rules"
                        },
                        "new": {
                          "type": "string",
                          "description": "Its replacement (\"\" removes it)"
                        }
                      }
                    }
                  },
                  "sync_texts": {
                    "type": "boolean",
                    "description": "Default true"
                  },
                  "dry_run": {
                    "type": "boolean",
                    "description": "Default false"
                  },
                  "locale": {
                    "type": "string",
                    "description": "Language code (default: the account's main language)"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/blocks": {
      "post": {
        "summary": "Add a block to the session copy: a library block (template_id) or a copy of any block. Answers the blocks in order and preview_url",
        "operationId": "AddBlock",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "template_id": {
                    "type": "string",
                    "description": "Library block id, or a template name from get_block"
                  },
                  "copy_from_block_id": {
                    "type": "integer",
                    "description": "Block to copy (get_page of any page, or of copy_page_id)"
                  },
                  "position": {
                    "type": "integer",
                    "description": "From 1"
                  },
                  "parent_block_id": {
                    "type": "integer",
                    "description": "A block in the session's copy: add the new block as one of its list items"
                  },
                  "locale": {
                    "type": "string",
                    "description": "Language code (default: the account's main language)"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/blocks/{block_id}": {
      "delete": {
        "summary": "Remove a block or list item from the session copy. Answers the blocks in order and preview_url",
        "operationId": "RemoveBlock",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "block_id",
            "in": "path",
            "required": true,
            "description": "Block id in the session's copy (get_page copy_page_id)",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/blocks/{block_id}/position": {
      "put": {
        "summary": "Move a block (or a list item, among its block's items) in the session's copy. position from 1 (the top); past the end means last. Answers the copy's blocks in order and the preview_url",
        "operationId": "MoveBlock",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "block_id",
            "in": "path",
            "required": true,
            "description": "Block id in the session's copy (get_page copy_page_id)",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "position": {
                    "type": "integer",
                    "description": "From 1"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/title": {
      "put": {
        "summary": "Set the page title (the header) in the session's copy, in one language. Plain text, one line. Answers the title and the preview_url",
        "operationId": "SetPageTitle",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "locale": {
                    "type": "string",
                    "description": "Language code (default: the account's main language)"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/block_templates": {
      "get": {
        "summary": "The editor's block library: id, template, tags, preview image, default texts. Filter by search or template",
        "operationId": "ListBlockTemplates",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Words to find, like pricing, faq, hero",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "template",
            "in": "query",
            "required": false,
            "description": "Template of an existing block",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/links": {
      "get": {
        "summary": "Every click on the account's pages, where it goes and its problem (empty, missing, draft or archived page or form)",
        "operationId": "FindLinks",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "page_id",
            "in": "query",
            "required": false,
            "description": "Only links on this page",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "target_page_id",
            "in": "query",
            "required": false,
            "description": "Only links that open this page",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "target_form_id",
            "in": "query",
            "required": false,
            "description": "Only links that open this form",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "url_contains",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "problems_only",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/pages/{page_id}/versions": {
      "get": {
        "summary": "Saved versions of a page, newest first (last 20): version_id, live_until, first block titles, preview_url",
        "operationId": "ListPageVersions",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "page_id",
            "in": "path",
            "required": true,
            "description": "Page id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/pages/{page_id}/hidden_versions": {
      "get": {
        "summary": "The open hidden versions of a page and its audience versions. cards: true adds people counts and who sees each",
        "operationId": "ListHiddenVersions",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "page_id",
            "in": "path",
            "required": true,
            "description": "Page id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "cards",
            "in": "query",
            "required": false,
            "description": "true: add people counts and who sees each version",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/pages/{page_id}/versions/{id}/restore": {
      "post": {
        "summary": "Open a new hidden version whose copy is a saved version. Answers preview_url",
        "operationId": "RestorePageVersion",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "page_id",
            "in": "path",
            "required": true,
            "description": "Page id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "version_id from list_page_versions",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/blocks/{block_id}/audience": {
      "put": {
        "summary": "Show one block of the session copy only to an audience. Live at go live",
        "operationId": "SetBlockAudience",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "block_id",
            "in": "path",
            "required": true,
            "description": "Block id in the copy",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "audience": {
                    "type": "object",
                    "description": "Who sees it. Every field given must match. who: everyone | signed_in | signed_out; labels_in_all: label ids, the person has every one; labels_in_any: label ids, one is enough (list_labels); labels_not_in: label ids the person must not have; groups_in_all / groups_in_any / groups_not_in: customer group ids, the same way; where: any | app (the iPhone and Android apps) | web. Leave it empty (or null) for everyone",
                    "properties": {
                      "who": {
                        "type": "string",
                        "enum": [
                          "everyone",
                          "signed_in",
                          "signed_out"
                        ]
                      },
                      "labels_in_all": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "labels_in_any": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "labels_not_in": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "groups_in_all": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "groups_in_any": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "groups_not_in": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "where": {
                        "type": "string",
                        "enum": [
                          "any",
                          "app",
                          "web"
                        ]
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "moving_out_soon",
                          "approved_only"
                        ],
                        "description": "Optional: only people moving out soon, or only approved people"
                      }
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/blocks/{block_id}/part_audience": {
      "put": {
        "summary": "Show one part only to an audience or between dates, in the session copy: a free page element (selector) or a block field (key)",
        "operationId": "SetPartAudience",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "block_id",
            "in": "path",
            "required": true,
            "description": "Block id in the copy",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "selector": {
                    "type": "string",
                    "description": "Free page: CSS selector of one element, for example #offer or section:nth-of-type(2)"
                  },
                  "key": {
                    "type": "string",
                    "description": "Block page: the field key (get_block texts, buttons, images), for example title or link"
                  },
                  "audience": {
                    "type": "object",
                    "description": "Who sees it. Every field given must match. who: everyone | signed_in | signed_out; labels_in_all: label ids, the person has every one; labels_in_any: label ids, one is enough (list_labels); labels_not_in: label ids the person must not have; groups_in_all / groups_in_any / groups_not_in: customer group ids, the same way; where: any | app (the iPhone and Android apps) | web. Leave it empty (or null) for everyone",
                    "properties": {
                      "who": {
                        "type": "string",
                        "enum": [
                          "everyone",
                          "signed_in",
                          "signed_out"
                        ]
                      },
                      "labels_in_all": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "labels_in_any": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "labels_not_in": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "groups_in_all": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "groups_in_any": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "groups_not_in": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "where": {
                        "type": "string",
                        "enum": [
                          "any",
                          "app",
                          "web"
                        ]
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "moving_out_soon",
                          "approved_only"
                        ],
                        "description": "Optional: only people moving out soon, or only approved people"
                      }
                    }
                  },
                  "show_from": {
                    "type": "string",
                    "description": "ISO time: hidden before it (optional)"
                  },
                  "hide_from": {
                    "type": "string",
                    "description": "ISO time: hidden from it (optional)"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/audience": {
      "put": {
        "summary": "Show a hidden version to an audience instead of the public page, same link, live at once. position sets the order",
        "operationId": "SetVersionAudience",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id (list_hidden_versions)",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "audience": {
                    "type": "object",
                    "description": "Who sees it. Every field given must match. who: everyone | signed_in | signed_out; labels_in_all: label ids, the person has every one; labels_in_any: label ids, one is enough (list_labels); labels_not_in: label ids the person must not have; groups_in_all / groups_in_any / groups_not_in: customer group ids, the same way; where: any | app (the iPhone and Android apps) | web. Leave it empty (or null) for everyone",
                    "properties": {
                      "who": {
                        "type": "string",
                        "enum": [
                          "everyone",
                          "signed_in",
                          "signed_out"
                        ]
                      },
                      "labels_in_all": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "labels_in_any": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "labels_not_in": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "groups_in_all": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "groups_in_any": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "groups_not_in": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "where": {
                        "type": "string",
                        "enum": [
                          "any",
                          "app",
                          "web"
                        ]
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "moving_out_soon",
                          "approved_only"
                        ],
                        "description": "Optional: only people moving out soon, or only approved people"
                      }
                    }
                  },
                  "position": {
                    "type": "integer",
                    "description": "Place in the order, from 1 (default: last)"
                  },
                  "force": {
                    "type": "boolean",
                    "description": "Only after the person saw that the public page changed since the version started (409)"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/stop_audience": {
      "post": {
        "summary": "Stop showing an audience version: its group sees the public page again. The version stays as a hidden version with its group",
        "operationId": "StopVersionAudience",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/pages/{id}/view_as": {
      "get": {
        "summary": "What one viewer gets on a page and why: the version, visible parts, or locked. A customer adds the step by step check",
        "operationId": "ViewPageAs",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Page id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "as",
            "in": "query",
            "required": true,
            "description": "signed_out, label:<id>, group:<id> or customer:<id>",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "device",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "web",
                "app"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/pages/{id}/audience_count": {
      "post": {
        "summary": "Count the people a rule would reach on a page, before you set it. Saves nothing",
        "operationId": "CountPageAudience",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Page id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "access": {
                    "type": "object",
                    "description": "The set_page_access keys"
                  },
                  "version_audience": {
                    "type": "object",
                    "description": "Who sees it. Every field given must match. who: everyone | signed_in | signed_out; labels_in_all: label ids, the person has every one; labels_in_any: label ids, one is enough (list_labels); labels_not_in: label ids the person must not have; groups_in_all / groups_in_any / groups_not_in: customer group ids, the same way; where: any | app (the iPhone and Android apps) | web. Leave it empty (or null) for everyone",
                    "properties": {
                      "who": {
                        "type": "string",
                        "enum": [
                          "everyone",
                          "signed_in",
                          "signed_out"
                        ]
                      },
                      "labels_in_all": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "labels_in_any": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "labels_not_in": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "groups_in_all": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "groups_in_any": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "groups_not_in": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "where": {
                        "type": "string",
                        "enum": [
                          "any",
                          "app",
                          "web"
                        ]
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "moving_out_soon",
                          "approved_only"
                        ],
                        "description": "Optional: only people moving out soon, or only approved people"
                      }
                    }
                  },
                  "version_id": {
                    "type": "integer",
                    "description": "With version_audience: its place in the order"
                  },
                  "block_audience": {
                    "type": "object",
                    "description": "Who sees it. Every field given must match. who: everyone | signed_in | signed_out; labels_in_all: label ids, the person has every one; labels_in_any: label ids, one is enough (list_labels); labels_not_in: label ids the person must not have; groups_in_all / groups_in_any / groups_not_in: customer group ids, the same way; where: any | app (the iPhone and Android apps) | web. Leave it empty (or null) for everyone",
                    "properties": {
                      "who": {
                        "type": "string",
                        "enum": [
                          "everyone",
                          "signed_in",
                          "signed_out"
                        ]
                      },
                      "labels_in_all": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "labels_in_any": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "labels_not_in": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "groups_in_all": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "groups_in_any": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "groups_not_in": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "where": {
                        "type": "string",
                        "enum": [
                          "any",
                          "app",
                          "web"
                        ]
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "moving_out_soon",
                          "approved_only"
                        ],
                        "description": "Optional: only people moving out soon, or only approved people"
                      }
                    }
                  },
                  "part_show": {
                    "type": "string",
                    "description": "data-bb-show words, e.g. labels:1,2 app"
                  },
                  "block_id": {
                    "type": "integer",
                    "description": "The block the rule is on (its own rule applies too)"
                  },
                  "edit_session_id": {
                    "type": "integer",
                    "description": "The block is in this edit session copy"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/pages/{id}/versions_to_review": {
      "get": {
        "summary": "Audience versions made from an older public page, with the public changes since",
        "operationId": "ListVersionsToReview",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Page id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/same_change": {
      "post": {
        "summary": "Make a new hidden version of an audience version with the public text changes repeated; not_repeated lists the rest",
        "operationId": "RepeatPublicChanges",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Audience version id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/mark_reviewed": {
      "post": {
        "summary": "Mark an audience version as up to date with the public page (\"Not needed\")",
        "operationId": "MarkVersionReviewed",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Audience version id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/restore": {
      "post": {
        "summary": "Bring back a version deleted in the last 24 hours (shown to its group again if it was)",
        "operationId": "RestoreHiddenVersion",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/customer_todos": {
      "post": {
        "summary": "Add a to-do to the For you block of customers' app: one customer, visitor_ids, or every customer with label_id",
        "operationId": "AddCustomerTodo",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "Up to 300 characters"
                  },
                  "button": {
                    "type": "object",
                    "description": "Optional: kind page (id), form (id) or url (https link), and label",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "page",
                          "form",
                          "url"
                        ]
                      },
                      "id": {
                        "type": "integer"
                      },
                      "url": {
                        "type": "string"
                      },
                      "label": {
                        "type": "string"
                      }
                    }
                  },
                  "due_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "visitor_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  },
                  "label_id": {
                    "type": "integer"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "get": {
        "summary": "Customer to-dos, newest first: open ones by default (open=false for done ones), for one customer with visitor_id",
        "operationId": "ListCustomerTodos",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "visitor_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "open",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/pages/{page_id}/style": {
      "get": {
        "summary": "A page's style (fonts, sizes, colors), its CSS, the presets and the text roles",
        "operationId": "GetPageStyle",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "page_id",
            "in": "path",
            "required": true,
            "description": "Page id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/style": {
      "put": {
        "summary": "One design for every block of the session copy: a preset or tokens for fonts, weight, case and sizes",
        "operationId": "SetPageStyle",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "preset": {
                    "type": "string",
                    "enum": [
                      "modern",
                      "elegant",
                      "bold",
                      "friendly"
                    ]
                  },
                  "heading_font": {
                    "type": "string",
                    "description": "A Google Fonts family, like Inter or Playfair Display"
                  },
                  "body_font": {
                    "type": "string",
                    "description": "A Google Fonts family"
                  },
                  "heading_weight": {
                    "type": "integer",
                    "enum": [
                      400,
                      500,
                      600,
                      700,
                      800,
                      900
                    ]
                  },
                  "heading_case": {
                    "type": "string",
                    "enum": [
                      "none",
                      "uppercase",
                      "capitalize"
                    ]
                  },
                  "heading_color": {
                    "type": "string",
                    "description": "#rrggbb"
                  },
                  "body_color": {
                    "type": "string",
                    "description": "#rrggbb"
                  },
                  "hero_size": {
                    "type": "integer",
                    "description": "px on a large screen, 12 to 120"
                  },
                  "title_size": {
                    "type": "integer",
                    "description": "px"
                  },
                  "item_title_size": {
                    "type": "integer",
                    "description": "px"
                  },
                  "body_size": {
                    "type": "integer",
                    "description": "px"
                  },
                  "remove": {
                    "type": "boolean"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/css": {
      "put": {
        "summary": "Your own CSS for the session copy (after the page style), up to 20000 characters; \"\" removes it",
        "operationId": "SetPageCss",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "css": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/site_css": {
      "get": {
        "summary": "The site CSS every free page gets first: size and selectors; query finds rules; full: true gives all",
        "operationId": "GetSiteCss",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "required": false,
            "description": "Text to find in the rules",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "full",
            "in": "query",
            "required": false,
            "description": "The whole CSS",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "draft",
            "in": "query",
            "required": false,
            "description": "Read the draft",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "put": {
        "summary": "Replace the whole site CSS, live at once on every free page (ask the person first); draft: true sets the draft only. To add or change a few rules, use edit_site_css. A big CSS: upload_id from get_upload_link. No \"<\"",
        "operationId": "SetSiteCss",
        "tags": [
          "Pages"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "css": {
                    "type": "string"
                  },
                  "upload_id": {
                    "type": "string",
                    "description": "In place of css"
                  },
                  "draft": {
                    "type": "boolean"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "patch": {
        "summary": "Change the site CSS draft (made from the live CSS), never the live CSS: append rules, replace or remove one rule. Answers preview links and screenshots of live pages with the draft (preview_site_css reads them again)",
        "operationId": "EditSiteCss",
        "tags": [
          "Pages"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "append": {
                    "type": "string",
                    "description": "CSS rules added at the end, like a @media block"
                  },
                  "upload_id": {
                    "type": "string",
                    "description": "In place of append: the rules sent as a file (get_upload_link)"
                  },
                  "remove": {
                    "type": "object",
                    "description": "One top-level rule: { selector or n }",
                    "properties": {
                      "selector": {
                        "type": "string"
                      },
                      "n": {
                        "type": "integer"
                      }
                    }
                  },
                  "page_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Pages to preview (default: the 3 last changed)"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/site_css/preview": {
      "get": {
        "summary": "The site CSS draft on live pages: preview links, page titles, laptop and phone screenshots. Changes nothing",
        "operationId": "PreviewSiteCss",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "page_ids",
            "in": "query",
            "required": false,
            "description": "Up to 5 pages (default: the 3 last changed published free pages)",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "integer"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/site_css/go_live": {
      "post": {
        "summary": "The site CSS draft goes live on every free page (ask the person first, after the previews)",
        "operationId": "GoLiveSiteCss",
        "tags": [
          "Pages"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/site_css/draft": {
      "delete": {
        "summary": "Delete the site CSS draft; the live CSS stays as it is",
        "operationId": "DiscardSiteCssDraft",
        "tags": [
          "Pages"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/site_css/share": {
      "post": {
        "summary": "Move the CSS rules that free pages start with into the site CSS. dry_run is true by default",
        "operationId": "SharePageCss",
        "tags": [
          "Pages"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "page_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "2 or more free pages"
                  },
                  "dry_run": {
                    "type": "boolean",
                    "description": "Default true"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/edit_sessions/{id}/blocks/{block_id}/css_class": {
      "put": {
        "summary": "Set up to 5 CSS classes on one block of the session copy; \"\" removes them",
        "operationId": "SetBlockClass",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Edit session id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "block_id",
            "in": "path",
            "required": true,
            "description": "Block id in the session's copy (get_page copy_page_id)",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "css_class": {
                    "type": "string",
                    "description": "Like \"soft-card wide\""
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/stats": {
      "get": {
        "summary": "Dashboard, numbers, KPIs: the account at a glance: visits, messages, chats, orders and revenue in the last 24 hours and the last 7 days, and the number of orders in each tab (inbox, processing, accepted, all)",
        "operationId": "GetStats",
        "tags": [
          "Integrations"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/orders": {
      "get": {
        "summary": "Orders, bookings, reservations, appointments: newest change first: status, name, cost, booked time, unread messages, customer, labels. Tabs: inbox, processing, accepted, all",
        "operationId": "ListOrders",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "tab",
            "in": "query",
            "required": false,
            "description": "Default inbox",
            "schema": {
              "type": "string",
              "enum": [
                "inbox",
                "processing",
                "accepted",
                "all"
              ]
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "From 1",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per",
            "in": "query",
            "required": false,
            "description": "Up to 50, default 10",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "visitor_id",
            "in": "query",
            "required": false,
            "description": "Only this customer's orders",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/orders/{id}": {
      "get": {
        "summary": "One order: status, items, cost, booked times, customer (name, email, phone), its chat id and its last 5 messages",
        "operationId": "GetOrder",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Order id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/orders/{id}/status": {
      "put": {
        "summary": "Move an order to processing, rejected or archived; the customer gets the email. Not accepted (CMS only)",
        "operationId": "SetOrderStatus",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Order id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "processing",
                      "rejected",
                      "archived"
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/forms": {
      "get": {
        "summary": "Every form of the account (booking, order or product form), published, draft or archived: name, kind, price, calendars, private. The forms drawn by a page's own HTML are web forms: list_web_forms",
        "operationId": "ListForms",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Only forms in this status",
            "schema": {
              "type": "string",
              "enum": [
                "published",
                "draft",
                "archived"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "summary": "Make a new blank form (booking, request or product) with the account form defaults; a draft unless status published",
        "operationId": "CreateForm",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "The name customers see"
                  },
                  "description": {
                    "type": "string"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "service",
                      "form",
                      "product"
                    ],
                    "description": "service = booking or order form (default), form = request, product"
                  },
                  "price": {
                    "type": "number",
                    "description": "In the account currency"
                  },
                  "pricing_policy": {
                    "type": "string",
                    "enum": [
                      "paid",
                      "free",
                      "by_quote",
                      "no_price"
                    ],
                    "description": "Default: the account form defaults"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "draft",
                      "published"
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/forms/{id}/status": {
      "put": {
        "summary": "Publish a form, set it back to draft (customers cannot order it), or archive it",
        "operationId": "SetFormStatus",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Form id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "published",
                      "draft",
                      "archived"
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/conversations": {
      "get": {
        "summary": "Chats with customers (order chats and direct chats), newest first: status, the order it is about, the customer, the last message",
        "operationId": "ListConversations",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "placed = new",
            "schema": {
              "type": "string",
              "enum": [
                "placed",
                "processing",
                "closed"
              ]
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "From 1",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per",
            "in": "query",
            "required": false,
            "description": "Up to 50, default 20",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/conversations/{id}": {
      "get": {
        "summary": "One chat with its last 100 messages, oldest first (from: customer, staff or system)",
        "operationId": "GetConversation",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Conversation id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/conversations/{id}/messages": {
      "post": {
        "summary": "Send a message in a chat as staff. The customer gets a push and an email. Show the person the text and wait for a yes first",
        "operationId": "ReplyToConversation",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Conversation id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "body": {
                    "type": "string",
                    "description": "The message text"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/orders/{id}/price": {
      "put": {
        "summary": "Set the price of an order item (by quote). A higher price asks the customer to accept it",
        "operationId": "SendQuote",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Order id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "price": {
                    "type": "number",
                    "description": "Unit price in the account currency"
                  },
                  "amount": {
                    "type": "integer",
                    "description": "Quantity"
                  },
                  "item_id": {
                    "type": "integer"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/orders/{id}/discount": {
      "post": {
        "summary": "Give a discount on an order item: a percent, a fixed amount in cents, or an account coupon code (one of them). Give item_id when the order has several items",
        "operationId": "DiscountOrder",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Order id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "percent": {
                    "type": "integer"
                  },
                  "amount_cents": {
                    "type": "integer"
                  },
                  "coupon_code": {
                    "type": "string"
                  },
                  "item_id": {
                    "type": "integer"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/orders/{id}/assignee": {
      "put": {
        "summary": "Set the order's main assignee (a staff id from list_team)",
        "operationId": "AssignOrder",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Order id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "user_id": {
                    "type": "integer"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/orders/{id}/labels": {
      "post": {
        "summary": "Add or remove to-do labels on an order, by name. A new name creates the order label",
        "operationId": "LabelOrder",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Order id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/LabelOrderBody"
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/payment_links": {
      "post": {
        "summary": "Ask a customer to pay an amount: an order with a note, sent by chat and email. Ask the person first",
        "operationId": "SendPaymentLink",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "visitor_id": {
                    "type": "integer",
                    "description": "Customer id"
                  },
                  "amount_cents": {
                    "type": "integer",
                    "description": "In cents"
                  },
                  "comment": {
                    "type": "string",
                    "description": "What it is for; the customer sees it"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/saved_replies": {
      "get": {
        "summary": "The account's saved chat replies (name, text). To send one, pass its text to reply_to_conversation",
        "operationId": "ListSavedReplies",
        "tags": [
          "Integrations"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/visitors/{id}": {
      "get": {
        "summary": "One customer: profile, labels and custom fields. Their orders: list_orders with visitor_id",
        "operationId": "GetCustomer",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Customer id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/payments": {
      "get": {
        "summary": "Payments, revenue, money received: card payments received by the account, newest first: amount, state, refunded and still refundable amounts, order, customer",
        "operationId": "ListPayments",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "From 1",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per",
            "in": "query",
            "required": false,
            "description": "Up to 50, default 20",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "order_id",
            "in": "query",
            "required": false,
            "description": "Only this order's payments",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/payments/{id}/refunds": {
      "post": {
        "summary": "Refund a card payment, fully or in part (at most its refundable amount). Money goes back to the customer and cannot be undone. Show the person the amount and the customer, and wait for a yes first",
        "operationId": "RefundPayment",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Payment id (list_payments)",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount_cents": {
                    "type": "integer",
                    "description": "In cents"
                  },
                  "comments": {
                    "type": "string",
                    "description": "Why (staff only)"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/balance": {
      "get": {
        "summary": "The account's Blackbell balance per currency: available (can be paid out) and pending",
        "operationId": "GetBalance",
        "tags": [
          "Integrations"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/payouts": {
      "get": {
        "summary": "Payouts of the balance to the bank, newest first",
        "operationId": "ListPayouts",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "From 1",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "summary": "Pay part or all of the available balance out to the bank account in the settings. Cannot be undone. Show the person the amount and wait for a yes first",
        "operationId": "RequestPayout",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount_cents": {
                    "type": "integer",
                    "description": "In cents, at most the available balance"
                  },
                  "currency": {
                    "type": "string",
                    "description": "When the account has several balances"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/settings": {
      "get": {
        "summary": "Settings, business facts, today and now: name, time zone and its date and time now, currency, languages, chat hours, form defaults, emails, sign-up fields, broadcast limit, plan",
        "operationId": "GetSettings",
        "tags": [
          "Integrations"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "put": {
        "summary": "Change the account name, time zone (IANA, e.g. Europe/London), address, main language or site languages. The currency is not changed here (money already earned stays in its currency): do it in the CMS",
        "operationId": "UpdateSettings",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "time_zone": {
                    "type": "string"
                  },
                  "location": {
                    "type": "string",
                    "description": "Address"
                  },
                  "default_locale": {
                    "type": "string",
                    "description": "e.g. en"
                  },
                  "available_locales": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/settings/chat_hours": {
      "put": {
        "summary": "Set when the team answers chats, for the whole week (a day not listed has no hours; several ranges per day are fine). Times in the account time zone",
        "operationId": "SetChatHours",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/SetChatHoursBody"
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/settings/form_defaults": {
      "put": {
        "summary": "What new forms start with: price policy, payment, capture, cart, button label, auto-confirm",
        "operationId": "SetFormDefaults",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pricing_policy": {
                    "type": "string",
                    "enum": [
                      "paid",
                      "free",
                      "by_quote",
                      "no_price"
                    ]
                  },
                  "payment_method": {
                    "type": "string",
                    "enum": [
                      "external",
                      "stripe",
                      "post_to_bill"
                    ]
                  },
                  "capture_on_checkout": {
                    "type": "string",
                    "enum": [
                      "nothing",
                      "credit_card",
                      "reservation"
                    ]
                  },
                  "cart_behaviour": {
                    "type": "string",
                    "enum": [
                      "add_and_auto_open",
                      "add_and_expand_sidebar",
                      "submit_without_opening"
                    ]
                  },
                  "button_label_key": {
                    "type": "string"
                  },
                  "require_visitor_phone": {
                    "type": "boolean"
                  },
                  "require_visitor_delivery_notes": {
                    "type": "boolean"
                  },
                  "auto_confirm_orders": {
                    "type": "boolean"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/settings/ratings": {
      "put": {
        "summary": "Show customer ratings on the site or hide them, and the lowest stars shown (1 to 5)",
        "operationId": "SetRatingsSettings",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "visible": {
                    "type": "boolean"
                  },
                  "min_stars": {
                    "type": "integer"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/settings/emails": {
      "put": {
        "summary": "Emails to customers: the reply-to name and address, and whether customers get the \"order placed\" and \"order processing\" emails",
        "operationId": "SetEmailSettings",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reply_to_name": {
                    "type": "string"
                  },
                  "reply_to_address": {
                    "type": "string"
                  },
                  "visitor_order_processing_email_enabled": {
                    "type": "boolean"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/settings/sign_up_fields": {
      "put": {
        "summary": "What customers must give when they sign up: photo, phone, gender, nationality, date of birth, address",
        "operationId": "SetSignUpFields",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "visitor_photo_required": {
                    "type": "boolean"
                  },
                  "notification_phone_required": {
                    "type": "boolean"
                  },
                  "gender_required": {
                    "type": "boolean"
                  },
                  "nationality_required": {
                    "type": "boolean"
                  },
                  "date_of_birth_required": {
                    "type": "boolean"
                  },
                  "location_required": {
                    "type": "boolean"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/settings/logo": {
      "put": {
        "summary": "Change the account logo (place logo or menu) from a square image, live at once; remove: true removes it",
        "operationId": "SetLogo",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "https image link or data:image/png;base64,... URL"
                  },
                  "remove": {
                    "type": "boolean"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/feedback": {
      "post": {
        "summary": "Send one report to Blackbell about a tool: what you did, what happened, what you expected, numbers. No personal data. 20 a day",
        "operationId": "SendFeedback",
        "tags": [
          "Integrations"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "The report, 4000 characters at most"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "bug",
                      "idea",
                      "measure",
                      "question",
                      "other"
                    ]
                  },
                  "tool": {
                    "type": "string",
                    "description": "The tool it is about, if one"
                  },
                  "page_id": {
                    "type": "integer",
                    "description": "The page it is about, if one"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/calendars": {
      "get": {
        "summary": "Every calendar: kind, the forms that book it, weekly hours, special dates from today (closed or other hours), booking limits and fair booking",
        "operationId": "ListCalendars",
        "tags": [
          "Integrations"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "summary": "Make a new calendar (a person, room or class that takes bookings), with weekly hours (left out: the CMS default hours)",
        "operationId": "CreateCalendar",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "The name customers see when they pick a time"
                  },
                  "description": {
                    "type": "string"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "hourly",
                      "daily",
                      "overnight",
                      "event"
                    ],
                    "description": "hourly (default) = time slots, daily, overnight, event = fixed sessions"
                  },
                  "color": {
                    "type": "string",
                    "description": "e.g. #4a90e2"
                  },
                  "hours": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "week_day": {
                          "type": "string",
                          "enum": [
                            "monday",
                            "tuesday",
                            "wednesday",
                            "thursday",
                            "friday",
                            "saturday",
                            "sunday"
                          ]
                        },
                        "starts_at": {
                          "type": "string",
                          "description": "HH:MM"
                        },
                        "ends_at": {
                          "type": "string",
                          "description": "HH:MM"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/calendars/{id}": {
      "put": {
        "summary": "Rename a calendar, or change its description or color. Fields not sent keep their value",
        "operationId": "UpdateCalendar",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Calendar id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "color": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/calendars/{id}/hours": {
      "put": {
        "summary": "Set the weekly open hours of a calendar, for the whole week (a day not listed is closed). Forms only offer slots inside them. Times in the account time zone",
        "operationId": "SetCalendarHours",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Calendar id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/SetChatHoursBody"
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/calendars/{id}/dates": {
      "put": {
        "summary": "Close a calendar on one date, give it other hours, or go back to weekly hours. Bookings stay and nobody is told",
        "operationId": "SetCalendarDate",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Calendar id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "date": {
                    "type": "string",
                    "description": "YYYY-MM-DD"
                  },
                  "closed": {
                    "type": "boolean"
                  },
                  "hours": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "starts_at": {
                          "type": "string",
                          "description": "HH:MM"
                        },
                        "ends_at": {
                          "type": "string",
                          "description": "HH:MM"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/calendars/{id}/limits": {
      "put": {
        "summary": "Booking limits of a calendar, all at once (a limit not sent is removed): max bookings per slot, max per customer and max overall per day, week or month",
        "operationId": "SetCalendarLimits",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Calendar id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "per_slot": {
                    "type": "integer"
                  },
                  "per_customer": {
                    "type": "object",
                    "properties": {
                      "size": {
                        "type": "string",
                        "enum": [
                          "day",
                          "week",
                          "month"
                        ]
                      },
                      "value": {
                        "type": "integer"
                      }
                    }
                  },
                  "overall": {
                    "type": "object",
                    "properties": {
                      "size": {
                        "type": "string",
                        "enum": [
                          "day",
                          "week",
                          "month"
                        ]
                      },
                      "value": {
                        "type": "integer"
                      }
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/calendars/{id}/fair_booking": {
      "put": {
        "summary": "Set fair booking rules of a calendar: max upcoming bookings, peak times, confirm or release, waiting list. Keys left out stay",
        "operationId": "SetFairBooking",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Calendar id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "max_upcoming": {
                    "type": "integer",
                    "description": "Per customer; null = no limit"
                  },
                  "peak_max_upcoming": {
                    "type": "integer",
                    "description": "Per customer in peak times"
                  },
                  "peak_windows": {
                    "type": "array",
                    "description": "Peak times: days (0 = Sunday) or a date (YYYY-MM-DD), from and to (HH:MM, same day)",
                    "items": {
                      "type": "object",
                      "properties": {
                        "days": {
                          "type": "array",
                          "items": {
                            "type": "integer"
                          }
                        },
                        "date": {
                          "type": "string"
                        },
                        "from": {
                          "type": "string"
                        },
                        "to": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "confirm_enabled": {
                    "type": "boolean"
                  },
                  "confirm_notify_at": {
                    "type": "string",
                    "description": "HH:MM: ask to confirm"
                  },
                  "confirm_by": {
                    "type": "string",
                    "description": "HH:MM: not confirmed = released"
                  },
                  "confirm_days_before": {
                    "type": "integer",
                    "description": "0 = same day, 1 = day before"
                  },
                  "waiting_list_enabled": {
                    "type": "boolean"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/calendars/{id}/waiting_list": {
      "get": {
        "summary": "Upcoming slots of a calendar with people waiting; with starts_at, who waits for that slot, first come first",
        "operationId": "ListWaitingList",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Calendar id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "starts_at",
            "in": "query",
            "required": false,
            "description": "ISO 8601 start of one slot",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/bookings": {
      "post": {
        "summary": "Put a booking in a calendar by hand (no order, no payment, no slot check). A given customer gets the email",
        "operationId": "CreateBooking",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "calendar_id": {
                    "type": "integer"
                  },
                  "starts_at": {
                    "type": "string",
                    "description": "ISO 8601"
                  },
                  "ends_at": {
                    "type": "string",
                    "description": "ISO 8601"
                  },
                  "name": {
                    "type": "string"
                  },
                  "visitor_id": {
                    "type": "integer",
                    "description": "Customer id"
                  },
                  "slots_amount": {
                    "type": "integer"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/bookings/{id}": {
      "put": {
        "summary": "Move a booking (event id) to another time or calendar. An order booking is checked; the customer gets an email",
        "operationId": "MoveBooking",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Event id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "starts_at": {
                    "type": "string",
                    "description": "ISO 8601"
                  },
                  "ends_at": {
                    "type": "string",
                    "description": "ISO 8601"
                  },
                  "calendar_id": {
                    "type": "integer"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "summary": "Cancel a booking made by hand (no order). The customer gets the cancel email; nothing is refunded. An order's booking is cancelled with its order (set_order_status rejected)",
        "operationId": "CancelBooking",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Event id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/forms/{id}": {
      "get": {
        "summary": "One form with all its setup: price, payment, confirmation, order flow, ratings, web address, access and schedule",
        "operationId": "GetForm",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Form id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "put": {
        "summary": "Change a form's settings (the CMS \"All settings\" tab). Fields not sent keep their value. Published forms change on the site at once",
        "operationId": "UpdateForm",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Form id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "price": {
                    "type": "number",
                    "description": "In the account currency"
                  },
                  "pricing_policy": {
                    "type": "string",
                    "enum": [
                      "paid",
                      "free",
                      "by_quote",
                      "no_price"
                    ]
                  },
                  "default_payment_method": {
                    "type": "string",
                    "enum": [
                      "external",
                      "stripe",
                      "post_to_bill"
                    ]
                  },
                  "capture_on_checkout": {
                    "type": "string",
                    "enum": [
                      "nothing",
                      "credit_card",
                      "reservation"
                    ],
                    "description": "nothing, card saved, or reservation (card charged later)"
                  },
                  "auto_confirm_orders": {
                    "type": "boolean"
                  },
                  "require_visitor_phone": {
                    "type": "boolean"
                  },
                  "require_visitor_delivery_notes": {
                    "type": "boolean"
                  },
                  "cart_behaviour": {
                    "type": "string",
                    "enum": [
                      "add_and_auto_open",
                      "add_and_expand_sidebar",
                      "submit_without_opening"
                    ]
                  },
                  "button_label_key": {
                    "type": "string"
                  },
                  "service_ratings_enabled": {
                    "type": "boolean"
                  },
                  "multiple_slots_enabled": {
                    "type": "boolean"
                  },
                  "customer_label_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Labels given to the customer who orders"
                  },
                  "internal_name": {
                    "type": "string"
                  },
                  "internal_description": {
                    "type": "string"
                  },
                  "slug": {
                    "type": "string",
                    "description": "Web address part, e.g. tennis-lesson"
                  },
                  "seo_title": {
                    "type": "string"
                  },
                  "seo_description": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/forms/{id}/schedule": {
      "put": {
        "summary": "A form's schedule: calendar_ids, slot length, buffers, notice, booking window, cancellation. Fields not sent stay",
        "operationId": "SetFormSchedule",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Form id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "calendar_type": {
                    "type": "string",
                    "enum": [
                      "hourly",
                      "daily",
                      "overnight",
                      "event"
                    ]
                  },
                  "calendar_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  },
                  "slot_minutes": {
                    "type": "integer",
                    "description": "Length of one booking"
                  },
                  "start_every_minutes": {
                    "type": "integer",
                    "description": "A slot starts every N minutes"
                  },
                  "max_minutes": {
                    "type": "integer",
                    "description": "Longest booking when the customer can take more time"
                  },
                  "more_time_step_minutes": {
                    "type": "integer",
                    "description": "Minutes"
                  },
                  "buffer_before_minutes": {
                    "type": "integer",
                    "description": "Minutes"
                  },
                  "buffer_after_minutes": {
                    "type": "integer",
                    "description": "Minutes"
                  },
                  "notice_minutes": {
                    "type": "integer",
                    "description": "Book at least this long before; 0 = no notice"
                  },
                  "booking_window": {
                    "type": "string",
                    "enum": [
                      "always",
                      "next_days",
                      "dates"
                    ]
                  },
                  "window_days": {
                    "type": "integer"
                  },
                  "window_from": {
                    "type": "string",
                    "description": "YYYY-MM-DD"
                  },
                  "window_to": {
                    "type": "string",
                    "description": "YYYY-MM-DD"
                  },
                  "cancellation": {
                    "type": "string",
                    "enum": [
                      "disabled",
                      "with_refund",
                      "without_refund"
                    ],
                    "description": "Can customers cancel, with or without refund"
                  },
                  "cancel_before_minutes": {
                    "type": "integer",
                    "description": "Customers can cancel until this long before"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/forms/{id}/access": {
      "put": {
        "summary": "Who can use a form (everyone, signed_in, labels, groups, staff) and what others get (locked_mode). Live at once",
        "operationId": "SetFormAccess",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Form id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "who": {
                    "type": "string",
                    "enum": [
                      "everyone",
                      "signed_in",
                      "labels",
                      "groups",
                      "staff"
                    ],
                    "description": ""
                  },
                  "label_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  },
                  "match": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ],
                    "description": "all (default) = has every label; any = has one of them"
                  },
                  "exclude_label_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "moving_out_soon",
                      "approved_only"
                    ],
                    "description": "Optional: only people moving out soon, or only approved people"
                  },
                  "group_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  },
                  "group_match": {
                    "type": "string",
                    "enum": [
                      "any",
                      "all"
                    ],
                    "description": "any (default) = in one group is enough; all = in every group"
                  },
                  "exclude_group_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  },
                  "locked_mode": {
                    "type": "string",
                    "enum": [
                      "hide",
                      "locked_button",
                      "redirect"
                    ],
                    "description": "People who cannot use it: hide (Book buttons, calendar slots and menu items hidden), locked_button (the form locked + one button to locked_button_page_id; none = homepage), redirect (to redirect_page_id)"
                  },
                  "locked_button_page_id": {
                    "type": "integer",
                    "description": "The page the locked button opens (null = homepage)"
                  },
                  "locked_button_text": {
                    "type": "string",
                    "description": "The locked button text (empty = the page title)"
                  },
                  "redirect_page_id": {
                    "type": "integer",
                    "description": "The page people go to with locked_mode redirect"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/pages/{id}/settings": {
      "get": {
        "summary": "A page's settings: status, homepage, languages, web address, search texts, share image, access, folders",
        "operationId": "GetPageSettings",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Page id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "put": {
        "summary": "Change a page's status, languages, slug, search texts, share image or homepage, live at once",
        "operationId": "SetPageSettings",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Page id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "published",
                      "draft",
                      "archived"
                    ]
                  },
                  "available_locales": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "slug": {
                    "type": "string"
                  },
                  "seo_title": {
                    "type": "string"
                  },
                  "seo_description": {
                    "type": "string"
                  },
                  "seo_image_url": {
                    "type": "string",
                    "description": "Share image: a https image link (WhatsApp, Facebook, Google)"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/pages/{id}/access": {
      "get": {
        "summary": "Who sees what on a page: status, who can open it and how many, what others get, each version with its people, blocks and parts with a rule",
        "operationId": "GetPageAccess",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Page id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "version_id",
            "in": "query",
            "required": false,
            "description": "Blocks of this hidden or audience version",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "put": {
        "summary": "Who can open a page (everyone, signed_in, labels, groups, staff) and what others get (closed_mode). Live at once",
        "operationId": "SetPageAccess",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Page id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "who": {
                    "type": "string",
                    "enum": [
                      "everyone",
                      "signed_in",
                      "labels",
                      "groups",
                      "staff"
                    ],
                    "description": ""
                  },
                  "label_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  },
                  "match": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ],
                    "description": "all (default) = has every label; any = has one of them"
                  },
                  "exclude_label_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "moving_out_soon",
                      "approved_only"
                    ],
                    "description": "Optional: only people moving out soon, or only approved people"
                  },
                  "group_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  },
                  "group_match": {
                    "type": "string",
                    "enum": [
                      "any",
                      "all"
                    ],
                    "description": "any (default) = in one group is enough; all = in every group"
                  },
                  "exclude_group_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  },
                  "closed_mode": {
                    "type": "string",
                    "enum": [
                      "hide",
                      "locked_form",
                      "redirect"
                    ],
                    "description": "People who cannot open it: hide (Home), locked_form (locked page + form), redirect (to redirect_page_id)"
                  },
                  "redirect_page_id": {
                    "type": "integer"
                  },
                  "locked_mode_service_id": {
                    "type": "integer",
                    "description": "The form for locked_form"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/pages/{id}/blocks/{block_id}/pin": {
      "put": {
        "summary": "Pin a live block to the top or bottom of every page, live at once; none unpins",
        "operationId": "PinBlock",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Page id that holds the block",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "block_id",
            "in": "path",
            "required": true,
            "description": "Block id from get_page_outline",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "position": {
                    "type": "string",
                    "enum": [
                      "top",
                      "bottom",
                      "none"
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/pages/{id}/folders": {
      "post": {
        "summary": "Put a page in CMS folders or take it out. Visitors see no change",
        "operationId": "SetPageFolders",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Page id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/LabelOrderBody"
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/plans": {
      "get": {
        "summary": "The account's subscription plans: name, price, how often, active subscribers",
        "operationId": "ListPlans",
        "tags": [
          "Integrations"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/subscriptions": {
      "get": {
        "summary": "Customers' subscriptions, newest first: status (active, trialing, past_due, canceled, incomplete), paused, plan, price, customer, next renewal",
        "operationId": "ListSubscriptions",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "visitor_id",
            "in": "query",
            "required": false,
            "description": "Only this customer's",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "paused",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "From 1",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per",
            "in": "query",
            "required": false,
            "description": "Up to 50, default 20",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/subscriptions/{id}": {
      "get": {
        "summary": "One subscription with its last 12 invoices (status, amount, attempts)",
        "operationId": "GetSubscription",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Subscription id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "summary": "Cancel a subscription now (no end-of-period option). Nothing is refunded; the customer and the team get an email. Cannot be undone. Show the person the customer and the plan, and wait for a yes first",
        "operationId": "CancelSubscription",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Subscription id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/subscriptions/{id}/pause": {
      "post": {
        "summary": "Pause a subscription: no invoices while paused. With resumes_on it starts again that day, else it stays paused until resume_subscription",
        "operationId": "PauseSubscription",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Subscription id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "resumes_on": {
                    "type": "string",
                    "description": "YYYY-MM-DD, optional"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/subscriptions/{id}/resume": {
      "post": {
        "summary": "Start a paused subscription again",
        "operationId": "ResumeSubscription",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Subscription id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/subscriptions/{id}/plan": {
      "put": {
        "summary": "Move a subscription to another plan (list_plans). The customer is charged the prorated difference at once. Show the person the old and new plan, and wait for a yes first",
        "operationId": "ChangeSubscriptionPlan",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Subscription id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "plan_id": {
                    "type": "integer"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/invoices/{id}/retry": {
      "post": {
        "summary": "Charge a failed subscription invoice again, on the customer's card (invoice ids from get_subscription). Wait for a yes first",
        "operationId": "RetryInvoice",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Invoice id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/coupons": {
      "get": {
        "summary": "Coupons: codes, discount, uses and limits, expiry, forms, active",
        "operationId": "ListCoupons",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "expired"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "summary": "Create a coupon: one code or bulk_count random codes; percentage or fixed; no form_ids = every form",
        "operationId": "CreateCoupon",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Internal name, unique"
                  },
                  "code": {
                    "type": "string"
                  },
                  "bulk_count": {
                    "type": "integer"
                  },
                  "bulk_prefix": {
                    "type": "string"
                  },
                  "discount_type": {
                    "type": "string",
                    "enum": [
                      "fixed",
                      "percentage"
                    ]
                  },
                  "discount_amount": {
                    "type": "number"
                  },
                  "max_uses": {
                    "type": "integer"
                  },
                  "max_uses_per_customer": {
                    "type": "integer"
                  },
                  "expires_on": {
                    "type": "string",
                    "description": "YYYY-MM-DD, last day it works"
                  },
                  "form_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/coupons/{id}": {
      "put": {
        "summary": "Change a coupon: name, limits, expiry, forms. end_now: true stops it today (coupons are never deleted, so past discounts stay). The discount itself cannot change: make a new coupon",
        "operationId": "UpdateCoupon",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Coupon id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "max_uses": {
                    "type": "integer"
                  },
                  "max_uses_per_customer": {
                    "type": "integer"
                  },
                  "expires_on": {
                    "type": "string",
                    "description": "YYYY-MM-DD"
                  },
                  "form_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  },
                  "end_now": {
                    "type": "boolean"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/forms/{id}/questions": {
      "get": {
        "summary": "The steps of a form, in order, with their questions and dropdown choices and extra prices. text_locale gives the language of the step title, or its subtitle when the title is empty. Steps of kind time, address or participants are shown but changed elsewhere (set_form_schedule, CMS)",
        "operationId": "GetFormQuestions",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Form id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "x-account-locales": true,
            "description": "Account language to read or write. Defaults to the main language.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/forms/{id}/steps": {
      "post": {
        "summary": "Add a step of questions to a form. Published forms change on the site at once",
        "operationId": "AddFormStep",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Form id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "x-account-locales": true,
            "description": "Account language to read or write. Defaults to the main language.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/AddFormStepBody"
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/forms/{id}/steps/{step_id}": {
      "put": {
        "summary": "Change a step: its title, settings, and (when questions is sent) its whole list of questions. Read get_form_questions first",
        "operationId": "UpdateFormStep",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Form id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "step_id",
            "in": "path",
            "required": true,
            "description": "Step id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "x-account-locales": true,
            "description": "Account language to read or write. Defaults to the main language.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/AddFormStepBody"
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "summary": "Remove a step of questions from a form (answers on past orders stay)",
        "operationId": "RemoveFormStep",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Form id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "step_id",
            "in": "path",
            "required": true,
            "description": "Step id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/forms/{id}/automations": {
      "get": {
        "summary": "What happens by itself on an order of this form: chat replies, jobs, labels on accept, team alerts, notes",
        "operationId": "GetFormAutomations",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Form id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "put": {
        "summary": "Set the automations of a form. Each field sent replaces that automation; fields not sent stay",
        "operationId": "SetFormAutomations",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Form id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reply_on_accepted_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Saved replies sent when an order is accepted"
                  },
                  "job_on": {
                    "type": "string",
                    "enum": [
                      "placed",
                      "processing",
                      "accepted",
                      "none"
                    ],
                    "description": "Create a job for the team at this order status; none = no job"
                  },
                  "label_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Customer labels given when an order is accepted"
                  },
                  "department_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Team departments alerted on a new order (list_team_alerts)"
                  },
                  "workflow_notes": {
                    "type": "string",
                    "description": "Notes the team sees on each order of this form"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/team": {
      "get": {
        "summary": "Staff, team, employees: the account's staff: id, name, email, phone, roles (for assign_order), pending (never signed in)",
        "operationId": "ListTeam",
        "tags": [
          "Integrations"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "summary": "Add a staff user. They get an email to sign in to the CMS at once. Show the person the email and roles, and wait for a yes first",
        "operationId": "InviteStaff",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "first_name": {
                    "type": "string"
                  },
                  "last_name": {
                    "type": "string"
                  },
                  "phone": {
                    "type": "string",
                    "description": "International format, +44..."
                  },
                  "roles": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "What the staff user can do: establishment_manager (all settings), content_manager (pages, forms), engagement_manager (broadcasts), request_manager (orders, chat), translation_manager, technitian (jobs only), billing_manager (money). Allowed: establishment_manager, content_manager, engagement_manager, request_manager, translation_manager, technitian, billing_manager"
                  },
                  "email": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/team/{id}": {
      "put": {
        "summary": "Change a staff user's name, phone or roles (roles sent = the whole list). The account admin keeps all roles",
        "operationId": "UpdateStaff",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Staff user id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "first_name": {
                    "type": "string"
                  },
                  "last_name": {
                    "type": "string"
                  },
                  "phone": {
                    "type": "string",
                    "description": "International format, +44..."
                  },
                  "roles": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "What the staff user can do: establishment_manager (all settings), content_manager (pages, forms), engagement_manager (broadcasts), request_manager (orders, chat), translation_manager, technitian (jobs only), billing_manager (money). Allowed: establishment_manager, content_manager, engagement_manager, request_manager, translation_manager, technitian, billing_manager"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "summary": "Remove a staff user: they can no longer sign in. Their past work stays. Not the account admin",
        "operationId": "RemoveStaff",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Staff user id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/team/{id}/resend_invite": {
      "post": {
        "summary": "Send the sign-in email again to a staff user who never signed in (list_team pending: true). At most once in 10 minutes, 5 a day. Ask first",
        "operationId": "ResendStaffInvite",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Staff user id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/team/alerts": {
      "get": {
        "summary": "Who is told about new orders, chats and requests: departments and each alert with its departments and escalations",
        "operationId": "ListTeamAlerts",
        "tags": [
          "Integrations"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "summary": "Add an alert for the account, not a staff user: a shared email, an sms or a phone number",
        "operationId": "AddTeamAlert",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "medium": {
                    "type": "string",
                    "enum": [
                      "email",
                      "sms",
                      "phone"
                    ]
                  },
                  "path": {
                    "type": "string",
                    "description": "The email address or the phone number"
                  },
                  "department_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Departments it alerts at once"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/team/alerts/{id}": {
      "put": {
        "summary": "Turn an alert on or off, or set the departments it alerts at once (the whole list)",
        "operationId": "SetTeamAlert",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Alert id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "active": {
                    "type": "boolean"
                  },
                  "department_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Departments it alerts at once"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "summary": "Remove an account alert. For a staff user's alert: it stops alerting at once (use set_team_alert active false to pause)",
        "operationId": "RemoveTeamAlert",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Alert id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/exports": {
      "get": {
        "summary": "The last 20 exports of the account (CSV or Excel .xlsx): kind, status (pending, processing, done, failed), file link when done and when that link expires",
        "operationId": "ListExports",
        "tags": [
          "Integrations"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "summary": "Start a CSV export. It runs in the background (a few seconds to minutes) and is emailed to the staff user. Returns the export id, status and kind. Use that id with get_export for the file link.",
        "operationId": "StartExport",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "orders",
                      "customers",
                      "payments",
                      "payouts"
                    ]
                  },
                  "from": {
                    "type": "string",
                    "format": "date",
                    "description": "Created from this day (YYYY-MM-DD, account time zone); leave out for all"
                  },
                  "to": {
                    "type": "string",
                    "format": "date",
                    "description": "Created up to this day, included"
                  },
                  "staff_id": {
                    "type": "integer",
                    "description": "Staff user who gets the email (list_team); default the account admin"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/exports/{id}": {
      "get": {
        "summary": "One export: its status, and the file link when done (link_expires_at: when that link stops working; read again for a new one)",
        "operationId": "GetExport",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Export id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/web_forms": {
      "get": {
        "summary": "Web forms: name, on or off, who gets the email, answer counts, and the html to use",
        "operationId": "ListWebForms",
        "tags": [
          "Pages"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "summary": "Create a web form for a free page: wrap its fields in <form data-bb-form=\"id\">. Answers come with no sign-in",
        "operationId": "CreateWebForm",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "notify_emails": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/web_forms/{id}/submissions": {
      "get": {
        "summary": "Answers to one web form, newest first: email, name, every field (label, type, value), status",
        "operationId": "ListWebFormAnswers",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Web form id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "new",
                "handled",
                "spam"
              ]
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "From 1",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per",
            "in": "query",
            "required": false,
            "description": "Up to 50, default 20",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/form_submissions/{id}/status": {
      "put": {
        "summary": "Mark one web form answer new, handled or spam",
        "operationId": "SetWebFormAnswerStatus",
        "tags": [
          "Pages"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Answer id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "new",
                      "handled",
                      "spam"
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api_keys": {
      "get": {
        "summary": "The account's active scoped keys and run tokens (all=true: revoked and expired too). The key itself is never shown again.",
        "operationId": "ListApiKeys",
        "tags": [
          "Keys"
        ],
        "parameters": [
          {
            "name": "all",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "summary": "Make a scoped key: read-only and/or limited to some tools. The answer holds the key (bbk_…) once.",
        "operationId": "CreateApiKey",
        "tags": [
          "Keys"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "read_only": {
                    "type": "boolean"
                  },
                  "tools": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Tool names as the Blackbell MCP lists them (for example list_customers). Empty: every tool."
                  },
                  "can_send_broadcasts": {
                    "type": "boolean",
                    "description": "Default true"
                  },
                  "expires_at": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Optional"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api_keys/{id}": {
      "delete": {
        "summary": "Revoke a scoped key or run token at once",
        "operationId": "RevokeApiKey",
        "tags": [
          "Keys"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Key id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/run_tokens": {
      "post": {
        "summary": "Make a short key (bbr_…) for one automation run: 15 minutes by default, 60 at most. It cannot send a broadcast unless can_send_broadcasts is true.",
        "operationId": "CreateRunToken",
        "tags": [
          "Keys"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "ttl_minutes": {
                    "type": "integer"
                  },
                  "read_only": {
                    "type": "boolean"
                  },
                  "tools": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Tool names as the Blackbell MCP lists them (for example list_customers). Empty: every tool."
                  },
                  "can_send_broadcasts": {
                    "type": "boolean",
                    "description": "Default false"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/{event_type}/web_hooks": {
      "post": {
        "summary": "Subscribe a URL to an event. Body: the event envelope {id, type, api_version, created_at, account_id, data}. Headers: Blackbell-Signature t=<unix>,v1=<HMAC-SHA256 of \"<t>.<body>\" with the webhook secret>, X-Blackbell-Event, X-Blackbell-Delivery.",
        "operationId": "AddWebhook",
        "tags": [
          "Keys"
        ],
        "parameters": [
          {
            "name": "event_type",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "order_paid",
                "hold_expired",
                "booking_cancelled"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "destination_url": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/connected_apps": {
      "get": {
        "summary": "The apps this account connected (Slack, Notion, Calendly, any app with an MCP server), each with its status and its card. Never shows a token.",
        "operationId": "ListConnectedApps",
        "tags": [
          "Integrations"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "summary": "Connect an app by its MCP server URL. Answers login_url for the person (15 minutes)",
        "operationId": "ConnectApp",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "A short name: lower-case letters, digits, - or _ (\"notion\")"
                  },
                  "title": {
                    "type": "string",
                    "description": "The name people see (\"Notion\")"
                  },
                  "url": {
                    "type": "string",
                    "description": "The app's MCP server URL, https only (for example https://mcp.notion.com/mcp)"
                  },
                  "allowed_tools": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Optional. Only these tools of the app may be used. Empty: all its tools."
                  },
                  "token": {
                    "type": "string",
                    "description": "Only for an app with no sign-in page: its access token. Ask the person to paste it; never invent one."
                  },
                  "client_id": {
                    "type": "string",
                    "description": "Only when the app asks you to make an OAuth client by hand"
                  },
                  "client_secret": {
                    "type": "string",
                    "description": "With client_id, when the app gives one"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/connected_apps/{id}": {
      "delete": {
        "summary": "Disconnect an app: Blackbell forgets its tokens at once, and rules stop using it",
        "operationId": "DisconnectApp",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Connected app id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/connected_apps/{id}/webhook": {
      "post": {
        "summary": "Make a secret webhook link for a connected app with no automatic webhook. Answers webhook_url once; a new call replaces it",
        "operationId": "AddAppWebhook",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Connected app id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "signing_secret": {
                    "type": "string",
                    "description": "Optional. The signing secret the app shows for its webhooks. With it, Blackbell refuses posts that the app did not sign."
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "summary": "Remove the app's webhook: its link stops working and rules on its events stop starting",
        "operationId": "RemoveAppWebhook",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Connected app id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/connected_apps/{id}/subscribe": {
      "post": {
        "summary": "Look again for the app's own webhook tool and subscribe automatically. Blackbell does this by itself after a sign-in; use it after the app added webhook support.",
        "operationId": "SubscribeApp",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Connected app id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/SubscribeAppBody"
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/automations": {
      "get": {
        "summary": "The account's rules (automations), each with its trigger, its status and its card (last run, what waits for a yes)",
        "operationId": "ListAutomations",
        "tags": [
          "Integrations"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "summary": "Make a rule: a trigger and what to do, in plain words. Say the rule back to the person and wait for a yes before you call this. A webhook rule answers webhook_url once.",
        "operationId": "CreateAutomation",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "A short name the business will recognise"
                  },
                  "instruction": {
                    "type": "string",
                    "description": "What to do on each run, in plain words, as the business said it. Up to 4,000 characters."
                  },
                  "trigger_kind": {
                    "type": "string",
                    "enum": [
                      "event",
                      "schedule",
                      "webhook",
                      "app_event"
                    ],
                    "description": "event: a Blackbell event. schedule: at fixed times (use it to check a state in another app, for example \"a free spot on Wednesday\"). webhook: another app calls a secret URL of this rule. app_event: a connected app sends an event on its own webhook (best when the app shows a webhook in list_connected_apps: the rule starts at once, no schedule)."
                  },
                  "trigger_event": {
                    "type": "string",
                    "description": "For trigger_kind event, one of: order_created, order_paid, booking_cancelled, hold_expired, customer_created, conversation_started. For trigger_kind app_event: the event name the app sends (see the app's webhook events in list_connected_apps), or empty for every event."
                  },
                  "trigger_app_id": {
                    "type": "integer",
                    "description": "For trigger_kind app_event: the connected app that sends the event. It needs a webhook (list_connected_apps shows it)."
                  },
                  "schedule": {
                    "type": "string",
                    "description": "For trigger_kind schedule: a cron line with 5 parts, in the time zone. \"0 18 * * 2\" = Tuesdays 18:00. At least 15 minutes between runs."
                  },
                  "time_zone": {
                    "type": "string",
                    "description": "Optional, for example \"Europe/Paris\". Default: the account time zone."
                  },
                  "connected_app_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "The connected apps this rule may use (list_connected_apps), 5 at most"
                  },
                  "blackbell_tools": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Optional. The Blackbell tools a run may call. Empty: read everything and make a draft broadcast, nothing else."
                  },
                  "can_send_broadcasts": {
                    "type": "boolean",
                    "description": "Default false: a run makes a draft and the business taps Send. Set true only when the person said the rule may send without asking."
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/automations/{id}": {
      "put": {
        "summary": "Change a rule, pause it (status paused) or turn it on again (status on). Send only what changes.",
        "operationId": "UpdateAutomation",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Rule id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "A short name the business will recognise"
                  },
                  "instruction": {
                    "type": "string",
                    "description": "What to do on each run, in plain words, as the business said it. Up to 4,000 characters."
                  },
                  "trigger_kind": {
                    "type": "string",
                    "enum": [
                      "event",
                      "schedule",
                      "webhook",
                      "app_event"
                    ],
                    "description": "event: a Blackbell event. schedule: at fixed times (use it to check a state in another app, for example \"a free spot on Wednesday\"). webhook: another app calls a secret URL of this rule. app_event: a connected app sends an event on its own webhook (best when the app shows a webhook in list_connected_apps: the rule starts at once, no schedule)."
                  },
                  "trigger_event": {
                    "type": "string",
                    "description": "For trigger_kind event, one of: order_created, order_paid, booking_cancelled, hold_expired, customer_created, conversation_started. For trigger_kind app_event: the event name the app sends (see the app's webhook events in list_connected_apps), or empty for every event."
                  },
                  "trigger_app_id": {
                    "type": "integer",
                    "description": "For trigger_kind app_event: the connected app that sends the event. It needs a webhook (list_connected_apps shows it)."
                  },
                  "schedule": {
                    "type": "string",
                    "description": "For trigger_kind schedule: a cron line with 5 parts, in the time zone. \"0 18 * * 2\" = Tuesdays 18:00. At least 15 minutes between runs."
                  },
                  "time_zone": {
                    "type": "string",
                    "description": "Optional, for example \"Europe/Paris\". Default: the account time zone."
                  },
                  "connected_app_ids": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "The connected apps this rule may use (list_connected_apps), 5 at most"
                  },
                  "blackbell_tools": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Optional. The Blackbell tools a run may call. Empty: read everything and make a draft broadcast, nothing else."
                  },
                  "can_send_broadcasts": {
                    "type": "boolean",
                    "description": "Default false: a run makes a draft and the business taps Send. Set true only when the person said the rule may send without asking."
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "on",
                      "paused"
                    ]
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "summary": "Delete a rule and its run history",
        "operationId": "DeleteAutomation",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Rule id",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/automations/{id}/run": {
      "post": {
        "summary": "Run a rule once now, to test it. It does real work: ask the person first.",
        "operationId": "RunAutomation",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Rule id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any string up to 255 characters. A retry with the same key gets the first answer back (24 hours).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/SubscribeAppBody"
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/automations/{id}/runs": {
      "get": {
        "summary": "The last runs of a rule, newest first: status, what it did, the error if it failed, and its card",
        "operationId": "ListAutomationRuns",
        "tags": [
          "Integrations"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Rule id",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "required": false,
            "description": "Up to 50, default 10",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://www.blackbell.com/api/i"
    }
  ],
  "components": {
    "requestBodies": {
      "AddFormStepBody": {
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "description": "Step title"
                },
                "subtitle": {
                  "type": "string"
                },
                "required": {
                  "type": "boolean"
                },
                "multiple": {
                  "type": "boolean",
                  "description": "The customer can pick several"
                },
                "hidden": {
                  "type": "boolean"
                },
                "position": {
                  "type": "integer",
                  "description": "From 1"
                },
                "questions": {
                  "type": "array",
                  "description": "The whole list of questions of the step, in order. Keep a question: give its id. New: no id. Left out of the list: removed (past answers stay)",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "integer"
                      },
                      "name": {
                        "type": "string",
                        "description": "The question as the customer reads it"
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "text",
                          "long_text",
                          "checkbox",
                          "yes_no",
                          "dropdown",
                          "number",
                          "quantity",
                          "date",
                          "email",
                          "phone",
                          "image",
                          "signature",
                          "section_break"
                        ],
                        "description": "checkbox with a price = a paid extra; quantity = a +/- picker; section_break = a title between questions"
                      },
                      "required": {
                        "type": "boolean"
                      },
                      "hidden": {
                        "type": "boolean"
                      },
                      "price": {
                        "type": "number",
                        "description": "Extra price in the account currency; leave out for free"
                      },
                      "options": {
                        "type": "array",
                        "description": "For dropdown: the choices",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "integer"
                            },
                            "name": {
                              "type": "string"
                            },
                            "price": {
                              "type": "number"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "required": true
      },
      "LabelOrderBody": {
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "add": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "remove": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "required": true
      },
      "SubscribeAppBody": {
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {}
            }
          }
        },
        "required": true
      },
      "CreateCustomerGroupBody": {
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "description": "Up to 80 characters, unique"
                },
                "description": {
                  "type": "string"
                },
                "labels_in_any": {
                  "type": "array",
                  "items": {
                    "type": "integer"
                  },
                  "description": "Has one of these labels"
                },
                "labels_in_all": {
                  "type": "array",
                  "items": {
                    "type": "integer"
                  },
                  "description": "Also has every one of these labels"
                },
                "labels_not_in": {
                  "type": "array",
                  "items": {
                    "type": "integer"
                  },
                  "description": "Has none of these labels"
                },
                "fields": {
                  "type": "array",
                  "description": "Dropdown custom fields (list_custom_fields)",
                  "items": {
                    "type": "object",
                    "properties": {
                      "field_id": {
                        "type": "integer"
                      },
                      "op": {
                        "type": "string",
                        "enum": [
                          "is",
                          "is_not"
                        ]
                      },
                      "value_ids": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "moving_out_soon",
                    "approved_only"
                  ],
                  "description": "Optional: only people moving out soon, or only approved people"
                }
              }
            }
          }
        },
        "required": true
      },
      "HookRequestBody": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/HookRequestBody"
            }
          }
        },
        "description": "This is the request body of the hook"
      },
      "SetChatHoursBody": {
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "hours": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "week_day": {
                        "type": "string",
                        "enum": [
                          "monday",
                          "tuesday",
                          "wednesday",
                          "thursday",
                          "friday",
                          "saturday",
                          "sunday"
                        ]
                      },
                      "starts_at": {
                        "type": "string",
                        "description": "HH:MM"
                      },
                      "ends_at": {
                        "type": "string",
                        "description": "HH:MM"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "required": true
      }
    },
    "securitySchemes": {
      "api_key": {
        "type": "apiKey",
        "name": "Api-Key",
        "in": "header"
      }
    },
    "schemas": {
      "Hook": {
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "HookRequestBody": {
        "type": "object",
        "properties": {
          "destination_url": {
            "type": "string",
            "title": "URL for hook callback",
            "description": "URL for hook callback",
            "x-ms-notification-url": true,
            "x-ms-visibility": "internal"
          }
        }
      },
      "ServiceRequest": {
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "title": "Order ID",
            "description": "Unique order identifier in BlackBell"
          },
          "name": {
            "type": "string",
            "title": "Order name",
            "description": "Description of items in order"
          },
          "money_cost": {
            "type": "number",
            "title": "Total",
            "description": "Total including items and delivery"
          },
          "status": {
            "type": "string",
            "title": "Order status",
            "description": "Order status"
          },
          "delivery_address": {
            "type": "object",
            "title": "Delivery address",
            "description": "Delivery address with coordinates"
          },
          "app_name": {
            "type": "string",
            "title": "Application name",
            "description": "Application name, where order was placed"
          },
          "supplier_name": {
            "type": "string",
            "title": "Supplier name",
            "description": "Application name, where order is processed"
          },
          "visitor_name": {
            "type": "string",
            "title": "Visitor name",
            "description": "Visitor name"
          },
          "visitor_email": {
            "type": "string",
            "title": "Visitor email",
            "description": "Visitor email"
          },
          "scheduled_at": {
            "type": "string",
            "title": "Scheduled on",
            "description": "Scheduled time"
          },
          "request_items": {
            "type": "array",
            "title": "Request items",
            "descriptions": "Array of ordered services with options and calendar events inside",
            "items": {}
          },
          "service_ratings": {
            "type": "array",
            "title": "Service ratings",
            "description": "Service ratings",
            "items": {}
          }
        }
      },
      "Chat": {
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "title": "Chat ID",
            "description": "Unique Chat identifier in blackbell system"
          },
          "status": {
            "type": "string",
            "title": "Chat status",
            "description": "Chat status"
          },
          "visitor_name": {
            "type": "string",
            "title": "Requester name",
            "description": "Name of a person who started chat"
          }
        }
      }
    }
  }
}