{
  "openapi": "3.1.0",
  "info": {
    "title": "Dolyu API",
    "version": "v1",
    "description": "Read a merchant's services, staff, appointments, customers, payments, refunds, and events, and receive appointment, customer, service, staff, payment, and refund events by webhook.\n\nAll endpoints accept `GET` only; other methods return 405 `method_not_allowed`. When parsing responses and webhook events, skip fields you don't recognize."
  },
  "externalDocs": {
    "description": "Developer documentation",
    "url": "https://docs.dolyu.com/en/developers/api"
  },
  "servers": [
    {
      "url": "https://api.dolyu.com/v1"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "tags": [
    {
      "name": "Merchant",
      "description": "The merchant the key belongs to. No permission needed."
    },
    {
      "name": "Catalog",
      "description": "Services and staff. Requires `catalog:read`."
    },
    {
      "name": "Appointments",
      "description": "Requires `appointments:read`."
    },
    {
      "name": "Customers",
      "description": "Requires `customers:read`."
    },
    {
      "name": "Payments",
      "description": "Payments and refunds recorded on appointments. Requires `payments:read`."
    },
    {
      "name": "Events",
      "description": "The events recorded for the merchant, in the same JSON that is sent to webhook endpoints. Appointment events require `appointments:read`, customer events require `customers:read`, service and staff events require `catalog:read`, and payment and refund events require `payments:read`.",
      "externalDocs": {
        "url": "https://docs.dolyu.com/en/developers/api-events"
      }
    },
    {
      "name": "Webhook events",
      "description": "Requests sent to the endpoints registered in the dashboard.",
      "externalDocs": {
        "url": "https://docs.dolyu.com/en/developers/webhooks"
      }
    }
  ],
  "paths": {
    "/merchant": {
      "get": {
        "operationId": "getMerchant",
        "summary": "Retrieve the merchant",
        "tags": [
          "Merchant"
        ],
        "description": "Returns the merchant the key belongs to. Any valid key can call this endpoint. Accepts no query parameters.",
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "The merchant the key belongs to.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Merchant"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/services": {
      "get": {
        "operationId": "listServices",
        "summary": "List services",
        "tags": [
          "Catalog"
        ],
        "description": "Sorted by `created_at`, then `id`, ascending. Deleted services are not listed.",
        "security": [
          {
            "apiKey": [
              "catalog:read"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of services.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/services/{id}": {
      "get": {
        "operationId": "getService",
        "summary": "Retrieve a service",
        "tags": [
          "Catalog"
        ],
        "description": "Accepts no query parameters.",
        "security": [
          {
            "apiKey": [
              "catalog:read"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "The service.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Service"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/staff": {
      "get": {
        "operationId": "listStaff",
        "summary": "List staff members",
        "tags": [
          "Catalog"
        ],
        "description": "Sorted by `id`, ascending. Lists only members of this merchant; staff members who have left are not listed.",
        "security": [
          {
            "apiKey": [
              "catalog:read"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of staff members.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StaffList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/staff/{id}": {
      "get": {
        "operationId": "getStaff",
        "summary": "Retrieve a staff member",
        "tags": [
          "Catalog"
        ],
        "description": "Accepts no query parameters.",
        "security": [
          {
            "apiKey": [
              "catalog:read"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "The staff member.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Staff"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/appointments": {
      "get": {
        "operationId": "listAppointments",
        "summary": "List appointments",
        "tags": [
          "Appointments"
        ],
        "description": "Sorted by the `sort` field, then `id`, ascending. Deleted appointments are not listed. If the key lacks `customers:read`, each `customer` contains only `id` and `object`.",
        "security": [
          {
            "apiKey": [
              "appointments:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "description": "Only this status.",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "confirmed",
                "completed",
                "cancelled",
                "no_show"
              ]
            },
            "example": "confirmed"
          },
          {
            "name": "start_at",
            "in": "query",
            "style": "deepObject",
            "explode": true,
            "description": "Filter by start time. ISO 8601 with `Z` or an offset.",
            "schema": {
              "type": "object",
              "properties": {
                "gte": {
                  "type": "string",
                  "format": "date-time",
                  "description": "Start time is at or after this time."
                },
                "lt": {
                  "type": "string",
                  "format": "date-time",
                  "description": "Start time is before this time."
                }
              }
            },
            "example": {
              "gte": "2026-11-20T00:00:00Z",
              "lt": "2026-11-20T00:00:00Z"
            }
          },
          {
            "name": "updated_at",
            "in": "query",
            "style": "deepObject",
            "explode": true,
            "description": "Filter by last update time. ISO 8601 with `Z` or an offset.",
            "schema": {
              "type": "object",
              "properties": {
                "gte": {
                  "type": "string",
                  "format": "date-time",
                  "description": "Last updated at or after this time."
                }
              }
            },
            "example": {
              "gte": "2026-11-20T00:00:00Z"
            }
          },
          {
            "name": "customer_id",
            "in": "query",
            "description": "Appointments of this customer. If the customer belongs to another merchant, the list is empty.",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "0198c5f3-0000-7000-8000-000000000001"
          },
          {
            "name": "staff_id",
            "in": "query",
            "description": "Appointments where any item's staff member is this staff member. If the staff member belongs to another merchant, the list is empty.",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "0198c5f5-0000-7000-8000-000000000001"
          },
          {
            "name": "reference",
            "in": "query",
            "description": "Appointment reference number, case-insensitive. A series' main reference also matches appointments numbered \"main reference-sequence\". If the value does not match the reference number format, the list is empty.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "example": "7K3M9Q"
          },
          {
            "name": "sort",
            "in": "query",
            "description": "Sort field.",
            "schema": {
              "type": "string",
              "enum": [
                "start_at",
                "updated_at"
              ],
              "default": "start_at"
            },
            "example": "updated_at"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of appointments.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppointmentList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/appointments/{id}": {
      "get": {
        "operationId": "getAppointment",
        "summary": "Retrieve an appointment",
        "tags": [
          "Appointments"
        ],
        "description": "Accepts no query parameters. If the key lacks `customers:read`, `customer` contains only `id` and `object`.",
        "security": [
          {
            "apiKey": [
              "appointments:read"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "The appointment.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Appointment"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/customers": {
      "get": {
        "operationId": "listCustomers",
        "summary": "List customers",
        "tags": [
          "Customers"
        ],
        "description": "Sorted by the `sort` field, then `id`, ascending. Archived customers are not listed.",
        "security": [
          {
            "apiKey": [
              "customers:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "email",
            "in": "query",
            "description": "Exact email match, case-insensitive.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "example": "customer@example.com"
          },
          {
            "name": "phone",
            "in": "query",
            "description": "Phone number match. Different ways of writing the same number are treated as the same; customers who share the number are listed together.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "example": "+886900000000"
          },
          {
            "name": "updated_at",
            "in": "query",
            "style": "deepObject",
            "explode": true,
            "description": "Filter by last update time. ISO 8601 with `Z` or an offset.",
            "schema": {
              "type": "object",
              "properties": {
                "gte": {
                  "type": "string",
                  "format": "date-time",
                  "description": "Last updated at or after this time."
                }
              }
            },
            "example": {
              "gte": "2026-11-20T00:00:00Z"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "description": "Sort field.",
            "schema": {
              "type": "string",
              "enum": [
                "created_at",
                "updated_at"
              ],
              "default": "created_at"
            },
            "example": "updated_at"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of customers.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/customers/{id}": {
      "get": {
        "operationId": "getCustomer",
        "summary": "Retrieve a customer",
        "tags": [
          "Customers"
        ],
        "description": "Accepts no query parameters. Archived customers return 404.",
        "security": [
          {
            "apiKey": [
              "customers:read"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "The customer.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Customer"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/payments": {
      "get": {
        "operationId": "listPayments",
        "summary": "List payments",
        "tags": [
          "Payments"
        ],
        "description": "Sorted by `created_at`, then `id`, ascending. Deleted payments and payments on deleted appointments are not listed.",
        "security": [
          {
            "apiKey": [
              "payments:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "appointment_id",
            "in": "query",
            "description": "Only the payments recorded on this appointment. An appointment of another merchant returns an empty list.",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "0198c5f4-0000-7000-8000-000000000001"
          },
          {
            "name": "created_at",
            "in": "query",
            "style": "deepObject",
            "explode": true,
            "description": "Filter by the time the payment was recorded. ISO 8601 with `Z` or an offset.",
            "schema": {
              "type": "object",
              "properties": {
                "gte": {
                  "type": "string",
                  "format": "date-time",
                  "description": "Recorded at or after this time."
                },
                "lt": {
                  "type": "string",
                  "format": "date-time",
                  "description": "Recorded before this time."
                }
              }
            },
            "example": {
              "gte": "2026-11-01T00:00:00Z",
              "lt": "2026-12-01T00:00:00Z"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of payments.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/payments/{id}": {
      "get": {
        "operationId": "getPayment",
        "summary": "Retrieve a payment",
        "tags": [
          "Payments"
        ],
        "description": "Accepts no query parameters. Returns 404 for a deleted payment, a payment on a deleted appointment, and the ID of a refund.",
        "security": [
          {
            "apiKey": [
              "payments:read"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "The payment.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Payment"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/refunds": {
      "get": {
        "operationId": "listRefunds",
        "summary": "List refunds",
        "tags": [
          "Payments"
        ],
        "description": "Sorted by `created_at`, then `id`, ascending. Deleted refunds and refunds on deleted appointments are not listed.",
        "security": [
          {
            "apiKey": [
              "payments:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "appointment_id",
            "in": "query",
            "description": "Only the refunds recorded on this appointment. An appointment of another merchant returns an empty list.",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "0198c5f4-0000-7000-8000-000000000001"
          },
          {
            "name": "created_at",
            "in": "query",
            "style": "deepObject",
            "explode": true,
            "description": "Filter by the time the refund was recorded. ISO 8601 with `Z` or an offset.",
            "schema": {
              "type": "object",
              "properties": {
                "gte": {
                  "type": "string",
                  "format": "date-time",
                  "description": "Recorded at or after this time."
                },
                "lt": {
                  "type": "string",
                  "format": "date-time",
                  "description": "Recorded before this time."
                }
              }
            },
            "example": {
              "gte": "2026-11-01T00:00:00Z",
              "lt": "2026-12-01T00:00:00Z"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of refunds.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RefundList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/refunds/{id}": {
      "get": {
        "operationId": "getRefund",
        "summary": "Retrieve a refund",
        "tags": [
          "Payments"
        ],
        "description": "Accepts no query parameters. Returns 404 for a deleted refund, a refund on a deleted appointment, and the ID of a payment.",
        "security": [
          {
            "apiKey": [
              "payments:read"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "The refund.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Refund"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/events": {
      "get": {
        "operationId": "listEvents",
        "summary": "List events",
        "tags": [
          "Events"
        ],
        "description": "Sorted by `created_at`, then `id`, ascending. Lists only the event types the key has permission to read. `ping` events are not listed. Events are available for 30 days.",
        "security": [
          {
            "apiKey": [
              "catalog:read"
            ]
          },
          {
            "apiKey": [
              "appointments:read"
            ]
          },
          {
            "apiKey": [
              "customers:read"
            ]
          },
          {
            "apiKey": [
              "payments:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "description": "A single event type. A type the key has no permission to read returns an empty list.",
            "schema": {
              "type": "string",
              "enum": [
                "appointment.created",
                "appointment.confirmed",
                "appointment.cancelled",
                "appointment.completed",
                "appointment.no_show",
                "appointment.rescheduled",
                "appointment.updated",
                "customer.created",
                "customer.updated",
                "customer.deleted",
                "service.created",
                "service.updated",
                "service.deleted",
                "staff.created",
                "staff.updated",
                "staff.deleted",
                "payment.created",
                "refund.created"
              ]
            },
            "example": "appointment.created"
          },
          {
            "name": "created_at",
            "in": "query",
            "style": "deepObject",
            "explode": true,
            "description": "Filter by the time the event was recorded. ISO 8601 with `Z` or an offset.",
            "schema": {
              "type": "object",
              "properties": {
                "gte": {
                  "type": "string",
                  "format": "date-time",
                  "description": "Recorded at or after this time."
                }
              }
            },
            "example": {
              "gte": "2026-11-20T00:00:00Z"
            }
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of events.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/events/{id}": {
      "get": {
        "operationId": "getEvent",
        "summary": "Retrieve an event",
        "tags": [
          "Events"
        ],
        "description": "Accepts no query parameters. Returns 404 for an event type the key has no permission to read, and for `ping` events.",
        "security": [
          {
            "apiKey": [
              "catalog:read"
            ]
          },
          {
            "apiKey": [
              "appointments:read"
            ]
          },
          {
            "apiKey": [
              "customers:read"
            ]
          },
          {
            "apiKey": [
              "payments:read"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Id"
          }
        ],
        "responses": {
          "200": {
            "description": "The event.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "X-RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Event"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    }
  },
  "webhooks": {
    "appointment.created": {
      "post": {
        "operationId": "onAppointmentCreated",
        "summary": "An appointment is created.",
        "tags": [
          "Webhook events"
        ],
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The event ID, the same as `id` in the body. It doesn't change when the event is retried or resent."
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "The Unix time in seconds when the request is sent. It is updated on every attempt."
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`v1,<Base64>`. During secret rotation there are two signatures, separated by a space."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppointmentCreatedEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "A 2xx response counts as success. Any other status code, a timeout, or a connection failure counts as a failure."
          }
        }
      }
    },
    "appointment.confirmed": {
      "post": {
        "operationId": "onAppointmentConfirmed",
        "summary": "An appointment is confirmed.",
        "tags": [
          "Webhook events"
        ],
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The event ID, the same as `id` in the body. It doesn't change when the event is retried or resent."
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "The Unix time in seconds when the request is sent. It is updated on every attempt."
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`v1,<Base64>`. During secret rotation there are two signatures, separated by a space."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppointmentConfirmedEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "A 2xx response counts as success. Any other status code, a timeout, or a connection failure counts as a failure."
          }
        }
      }
    },
    "appointment.cancelled": {
      "post": {
        "operationId": "onAppointmentCancelled",
        "summary": "An appointment is canceled.",
        "tags": [
          "Webhook events"
        ],
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The event ID, the same as `id` in the body. It doesn't change when the event is retried or resent."
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "The Unix time in seconds when the request is sent. It is updated on every attempt."
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`v1,<Base64>`. During secret rotation there are two signatures, separated by a space."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppointmentCancelledEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "A 2xx response counts as success. Any other status code, a timeout, or a connection failure counts as a failure."
          }
        }
      }
    },
    "appointment.completed": {
      "post": {
        "operationId": "onAppointmentCompleted",
        "summary": "An appointment is completed.",
        "tags": [
          "Webhook events"
        ],
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The event ID, the same as `id` in the body. It doesn't change when the event is retried or resent."
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "The Unix time in seconds when the request is sent. It is updated on every attempt."
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`v1,<Base64>`. During secret rotation there are two signatures, separated by a space."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppointmentCompletedEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "A 2xx response counts as success. Any other status code, a timeout, or a connection failure counts as a failure."
          }
        }
      }
    },
    "appointment.no_show": {
      "post": {
        "operationId": "onAppointmentNoShow",
        "summary": "An appointment is marked as a no-show.",
        "tags": [
          "Webhook events"
        ],
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The event ID, the same as `id` in the body. It doesn't change when the event is retried or resent."
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "The Unix time in seconds when the request is sent. It is updated on every attempt."
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`v1,<Base64>`. During secret rotation there are two signatures, separated by a space."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppointmentNoShowEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "A 2xx response counts as success. Any other status code, a timeout, or a connection failure counts as a failure."
          }
        }
      }
    },
    "appointment.rescheduled": {
      "post": {
        "operationId": "onAppointmentRescheduled",
        "summary": "An appointment's start time changes.",
        "tags": [
          "Webhook events"
        ],
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The event ID, the same as `id` in the body. It doesn't change when the event is retried or resent."
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "The Unix time in seconds when the request is sent. It is updated on every attempt."
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`v1,<Base64>`. During secret rotation there are two signatures, separated by a space."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppointmentRescheduledEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "A 2xx response counts as success. Any other status code, a timeout, or a connection failure counts as a failure."
          }
        }
      }
    },
    "appointment.updated": {
      "post": {
        "operationId": "onAppointmentUpdated",
        "summary": "Other appointment details change, such as services, staff, amounts, payments, the deposit, or the customer.",
        "tags": [
          "Webhook events"
        ],
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The event ID, the same as `id` in the body. It doesn't change when the event is retried or resent."
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "The Unix time in seconds when the request is sent. It is updated on every attempt."
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`v1,<Base64>`. During secret rotation there are two signatures, separated by a space."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppointmentUpdatedEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "A 2xx response counts as success. Any other status code, a timeout, or a connection failure counts as a failure."
          }
        }
      }
    },
    "customer.created": {
      "post": {
        "operationId": "onCustomerCreated",
        "summary": "A customer is added, or an archived customer is restored.",
        "tags": [
          "Webhook events"
        ],
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The event ID, the same as `id` in the body. It doesn't change when the event is retried or resent."
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "The Unix time in seconds when the request is sent. It is updated on every attempt."
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`v1,<Base64>`. During secret rotation there are two signatures, separated by a space."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerCreatedEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "A 2xx response counts as success. Any other status code, a timeout, or a connection failure counts as a failure."
          }
        }
      }
    },
    "customer.updated": {
      "post": {
        "operationId": "onCustomerUpdated",
        "summary": "A customer's name, email, phone, or preferred language changes.",
        "tags": [
          "Webhook events"
        ],
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The event ID, the same as `id` in the body. It doesn't change when the event is retried or resent."
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "The Unix time in seconds when the request is sent. It is updated on every attempt."
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`v1,<Base64>`. During secret rotation there are two signatures, separated by a space."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerUpdatedEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "A 2xx response counts as success. Any other status code, a timeout, or a connection failure counts as a failure."
          }
        }
      }
    },
    "customer.deleted": {
      "post": {
        "operationId": "onCustomerDeleted",
        "summary": "A customer is archived or deleted, or their personal data is erased.",
        "tags": [
          "Webhook events"
        ],
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The event ID, the same as `id` in the body. It doesn't change when the event is retried or resent."
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "The Unix time in seconds when the request is sent. It is updated on every attempt."
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`v1,<Base64>`. During secret rotation there are two signatures, separated by a space."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerDeletedEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "A 2xx response counts as success. Any other status code, a timeout, or a connection failure counts as a failure."
          }
        }
      }
    },
    "service.created": {
      "post": {
        "operationId": "onServiceCreated",
        "summary": "A service is created.",
        "tags": [
          "Webhook events"
        ],
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The event ID, the same as `id` in the body. It doesn't change when the event is retried or resent."
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "The Unix time in seconds when the request is sent. It is updated on every attempt."
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`v1,<Base64>`. During secret rotation there are two signatures, separated by a space."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ServiceCreatedEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "A 2xx response counts as success. Any other status code, a timeout, or a connection failure counts as a failure."
          }
        }
      }
    },
    "service.updated": {
      "post": {
        "operationId": "onServiceUpdated",
        "summary": "A service's name, description, duration, price, booking availability, category, staff, or sort order changes.",
        "tags": [
          "Webhook events"
        ],
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The event ID, the same as `id` in the body. It doesn't change when the event is retried or resent."
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "The Unix time in seconds when the request is sent. It is updated on every attempt."
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`v1,<Base64>`. During secret rotation there are two signatures, separated by a space."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ServiceUpdatedEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "A 2xx response counts as success. Any other status code, a timeout, or a connection failure counts as a failure."
          }
        }
      }
    },
    "service.deleted": {
      "post": {
        "operationId": "onServiceDeleted",
        "summary": "A service is deleted, including when its category is deleted.",
        "tags": [
          "Webhook events"
        ],
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The event ID, the same as `id` in the body. It doesn't change when the event is retried or resent."
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "The Unix time in seconds when the request is sent. It is updated on every attempt."
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`v1,<Base64>`. During secret rotation there are two signatures, separated by a space."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ServiceDeletedEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "A 2xx response counts as success. Any other status code, a timeout, or a connection failure counts as a failure."
          }
        }
      }
    },
    "staff.created": {
      "post": {
        "operationId": "onStaffCreated",
        "summary": "A staff member joins the merchant.",
        "tags": [
          "Webhook events"
        ],
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The event ID, the same as `id` in the body. It doesn't change when the event is retried or resent."
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "The Unix time in seconds when the request is sent. It is updated on every attempt."
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`v1,<Base64>`. During secret rotation there are two signatures, separated by a space."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StaffCreatedEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "A 2xx response counts as success. Any other status code, a timeout, or a connection failure counts as a failure."
          }
        }
      }
    },
    "staff.updated": {
      "post": {
        "operationId": "onStaffUpdated",
        "summary": "A staff member's name changes.",
        "tags": [
          "Webhook events"
        ],
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The event ID, the same as `id` in the body. It doesn't change when the event is retried or resent."
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "The Unix time in seconds when the request is sent. It is updated on every attempt."
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`v1,<Base64>`. During secret rotation there are two signatures, separated by a space."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StaffUpdatedEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "A 2xx response counts as success. Any other status code, a timeout, or a connection failure counts as a failure."
          }
        }
      }
    },
    "staff.deleted": {
      "post": {
        "operationId": "onStaffDeleted",
        "summary": "A staff member is removed from or leaves the merchant, or their account is deleted.",
        "tags": [
          "Webhook events"
        ],
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The event ID, the same as `id` in the body. It doesn't change when the event is retried or resent."
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "The Unix time in seconds when the request is sent. It is updated on every attempt."
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`v1,<Base64>`. During secret rotation there are two signatures, separated by a space."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StaffDeletedEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "A 2xx response counts as success. Any other status code, a timeout, or a connection failure counts as a failure."
          }
        }
      }
    },
    "payment.created": {
      "post": {
        "operationId": "onPaymentCreated",
        "summary": "A payment is recorded on an appointment.",
        "tags": [
          "Webhook events"
        ],
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The event ID, the same as `id` in the body. It doesn't change when the event is retried or resent."
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "The Unix time in seconds when the request is sent. It is updated on every attempt."
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`v1,<Base64>`. During secret rotation there are two signatures, separated by a space."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaymentCreatedEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "A 2xx response counts as success. Any other status code, a timeout, or a connection failure counts as a failure."
          }
        }
      }
    },
    "refund.created": {
      "post": {
        "operationId": "onRefundCreated",
        "summary": "A refund is recorded on an appointment.",
        "tags": [
          "Webhook events"
        ],
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The event ID, the same as `id` in the body. It doesn't change when the event is retried or resent."
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "The Unix time in seconds when the request is sent. It is updated on every attempt."
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`v1,<Base64>`. During secret rotation there are two signatures, separated by a space."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RefundCreatedEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "A 2xx response counts as success. Any other status code, a timeout, or a connection failure counts as a failure."
          }
        }
      }
    },
    "ping": {
      "post": {
        "operationId": "onPing",
        "summary": "A test event sent from the dashboard. Sent once and not retried.",
        "tags": [
          "Webhook events"
        ],
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The event ID, the same as `id` in the body. It doesn't change when the event is retried or resent."
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "description": "The Unix time in seconds when the request is sent. It is updated on every attempt."
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "`v1,<Base64>`. During secret rotation there are two signatures, separated by a space."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PingEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "A 2xx response counts as success. Any other status code, a timeout, or a connection failure counts as a failure."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "dolyu_sk_...",
        "description": "Send the API key in the `Authorization` header. The names listed for an operation are the permissions the key needs: `catalog:read`, `appointments:read`, `customers:read`, `payments:read`."
      }
    },
    "parameters": {
      "Id": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        },
        "description": "Resource ID. If it is not a UUID, does not belong to this merchant, or has been deleted, the request returns 404 `resource_missing`."
      },
      "Limit": {
        "name": "limit",
        "in": "query",
        "description": "Items per page.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 25
        },
        "example": 50
      },
      "Cursor": {
        "name": "cursor",
        "in": "query",
        "description": "The `next_cursor` from the previous page. Only a `next_cursor` returned by this API with the same `sort` is accepted.",
        "schema": {
          "type": "string"
        }
      }
    },
    "headers": {
      "RequestId": {
        "description": "The ID of this request.",
        "schema": {
          "type": "string",
          "pattern": "^req_[A-Za-z0-9]{24}$"
        }
      },
      "RateLimitLimit": {
        "description": "The rate limit.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimitRemaining": {
        "description": "Requests left.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimitReset": {
        "description": "When the limit resets, in UTC epoch seconds.",
        "schema": {
          "type": "integer"
        }
      },
      "RetryAfter": {
        "description": "Seconds to wait before retrying.",
        "schema": {
          "type": "integer"
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "`parameter_invalid`: a query parameter is not accepted or its value is invalid. `param` names the parameter.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          },
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "X-RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "`invalid_api_key`: no key was sent, or the key is invalid, revoked, or expired. `api_key_exposed`: the key appeared in the URL or in a header other than `Authorization`, `Cookie`, or `Proxy-Authorization`, and has been revoked.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          },
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "X-RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "WWW-Authenticate": {
            "description": "Always `Bearer`.",
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden": {
        "description": "`insufficient_permission`: the key lacks the permission the endpoint requires. `merchant_inactive`: the merchant account is deactivated. `ip_not_allowed`: the request came from an IP address that isn't on the key's allowed list.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          },
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "X-RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "`resource_missing`: the resource does not exist or does not belong to this merchant.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          },
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "X-RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "`rate_limited`: the rate limit was exceeded.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          },
          "X-RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "X-RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "X-RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "Retry-After": {
            "$ref": "#/components/headers/RetryAfter"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "InternalError": {
        "description": "`internal_error`: server error.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "ServiceUnavailable": {
        "description": "`service_unavailable`: the service is temporarily unavailable. Retry later.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Merchant": {
        "type": "object",
        "required": [
          "id",
          "object",
          "name",
          "slug",
          "timezone",
          "currency",
          "locale"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "object": {
            "type": "string",
            "const": "merchant"
          },
          "name": {
            "type": "string",
            "description": "Merchant name."
          },
          "slug": {
            "type": "string",
            "description": "Booking page URL handle."
          },
          "timezone": {
            "type": "string",
            "description": "The merchant's time zone (IANA name).",
            "example": "Asia/Taipei"
          },
          "currency": {
            "type": "string",
            "description": "Currency code.",
            "example": "TWD"
          },
          "locale": {
            "type": "string",
            "enum": [
              "zh_TW",
              "en",
              "ja"
            ],
            "description": "Default language of the booking page."
          }
        }
      },
      "Service": {
        "type": "object",
        "required": [
          "id",
          "object",
          "name",
          "description",
          "duration_minutes",
          "price",
          "currency",
          "is_bookable",
          "category",
          "staff_ids",
          "sort_order"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "object": {
            "type": "string",
            "const": "service"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "duration_minutes": {
            "type": "integer",
            "description": "Service duration in minutes."
          },
          "price": {
            "type": "string",
            "description": "Price. A string in the currency's major unit, with no thousands separators or symbols, e.g. TWD `\"1200\"`, USD `\"12.50\"`."
          },
          "currency": {
            "type": "string",
            "description": "Currency code."
          },
          "is_bookable": {
            "type": "boolean",
            "description": "Whether the service is open for booking."
          },
          "category": {
            "description": "Category. `null` when there is none.",
            "anyOf": [
              {
                "type": "object",
                "required": [
                  "id",
                  "name"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "name": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "staff_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "IDs of staff members who provide this service, in ascending ID order."
          },
          "sort_order": {
            "type": "integer",
            "description": "Display order."
          }
        }
      },
      "Staff": {
        "type": "object",
        "required": [
          "id",
          "object",
          "name"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "object": {
            "type": "string",
            "const": "staff"
          },
          "name": {
            "type": "string"
          }
        }
      },
      "Appointment": {
        "type": "object",
        "required": [
          "id",
          "object",
          "reference",
          "series_id",
          "status",
          "source",
          "start_at",
          "end_at",
          "timezone",
          "local_date",
          "local_start_time",
          "local_end_time",
          "party_size",
          "total_price",
          "currency",
          "payment_status",
          "deposit",
          "status_reason",
          "customer",
          "items",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "object": {
            "type": "string",
            "const": "appointment"
          },
          "reference": {
            "type": [
              "string",
              "null"
            ],
            "description": "The appointment reference number."
          },
          "series_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Series ID."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "confirmed",
              "completed",
              "cancelled",
              "no_show"
            ]
          },
          "source": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "web",
              "line_liff",
              "line_conversation",
              "merchant_panel",
              null
            ],
            "description": "Booking source."
          },
          "start_at": {
            "type": "string",
            "format": "date-time",
            "description": "Start time."
          },
          "end_at": {
            "type": "string",
            "format": "date-time",
            "description": "Service end time."
          },
          "timezone": {
            "type": "string",
            "description": "The merchant's time zone (IANA name)."
          },
          "local_date": {
            "type": "string",
            "format": "date",
            "description": "The date in the merchant's time zone."
          },
          "local_start_time": {
            "type": "string",
            "description": "The start time in the merchant's time zone, `HH:mm`.",
            "example": "10:00"
          },
          "local_end_time": {
            "type": "string",
            "description": "The end time in the merchant's time zone, `HH:mm`.",
            "example": "11:00"
          },
          "party_size": {
            "type": "integer",
            "description": "Number of people."
          },
          "total_price": {
            "type": "string",
            "description": "Total amount. A string in the currency's major unit, with no thousands separators or symbols, e.g. TWD `\"1200\"`, USD `\"12.50\"`."
          },
          "currency": {
            "type": "string",
            "description": "Currency code."
          },
          "payment_status": {
            "type": "string",
            "enum": [
              "unpaid",
              "partially_paid",
              "fully_paid"
            ]
          },
          "deposit": {
            "description": "The deposit. `null` when there is no deposit.",
            "anyOf": [
              {
                "$ref": "#/components/schemas/Deposit"
              },
              {
                "type": "null"
              }
            ]
          },
          "status_reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "The reason entered when the appointment was canceled or marked as a no-show. `null` otherwise or when none was entered."
          },
          "customer": {
            "description": "The customer. `null` when there is no customer. Contains only `id` and `object` in webhook events and when the key lacks `customers:read`.",
            "anyOf": [
              {
                "$ref": "#/components/schemas/AppointmentCustomer"
              },
              {
                "$ref": "#/components/schemas/CustomerReference"
              },
              {
                "type": "null"
              }
            ]
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AppointmentItem"
            }
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Deposit": {
        "type": "object",
        "required": [
          "amount",
          "paid",
          "due_at",
          "reported_at"
        ],
        "properties": {
          "amount": {
            "type": "string",
            "description": "Deposit amount. A string in the currency's major unit, with no thousands separators or symbols, e.g. TWD `\"1200\"`, USD `\"12.50\"`."
          },
          "paid": {
            "type": "string",
            "description": "Deposit paid. A string in the currency's major unit, with no thousands separators or symbols, e.g. TWD `\"1200\"`, USD `\"12.50\"`."
          },
          "due_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Deposit due time."
          },
          "reported_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the customer reported paying."
          }
        }
      },
      "AppointmentItem": {
        "type": "object",
        "required": [
          "service",
          "staff",
          "start_at",
          "end_at",
          "duration_minutes",
          "quantity",
          "unit_price",
          "pricing_basis",
          "line_total"
        ],
        "properties": {
          "service": {
            "type": "object",
            "required": [
              "id",
              "name"
            ],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "staff": {
            "description": "Staff member. `null` when no staff member is assigned.",
            "anyOf": [
              {
                "type": "object",
                "required": [
                  "id",
                  "name"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "start_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Item start time."
          },
          "end_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Item service end time."
          },
          "duration_minutes": {
            "type": "integer",
            "description": "Service duration in minutes."
          },
          "quantity": {
            "type": "integer",
            "description": "Number of people."
          },
          "unit_price": {
            "type": "string",
            "description": "Unit price. A string in the currency's major unit, with no thousands separators or symbols, e.g. TWD `\"1200\"`, USD `\"12.50\"`."
          },
          "pricing_basis": {
            "type": "string",
            "enum": [
              "per_booking",
              "per_person"
            ],
            "description": "`per_booking`: one price for the whole group. `per_person`: priced by number of people."
          },
          "line_total": {
            "type": "string",
            "description": "The amount for this item. For `per_person` it is the unit price times the number of people; for `per_booking` it equals the unit price. A string in the currency's major unit, with no thousands separators or symbols, e.g. TWD `\"1200\"`, USD `\"12.50\"`."
          }
        }
      },
      "AppointmentCustomer": {
        "description": "The customer in an appointment, when the key has `customers:read`.",
        "type": "object",
        "required": [
          "id",
          "object",
          "name",
          "phone",
          "email"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "object": {
            "type": "string",
            "const": "customer"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CustomerReference": {
        "type": "object",
        "required": [
          "id",
          "object"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "object": {
            "type": "string",
            "const": "customer"
          }
        }
      },
      "Customer": {
        "type": "object",
        "required": [
          "id",
          "object",
          "name",
          "email",
          "phone",
          "preferred_locale",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "object": {
            "type": "string",
            "const": "customer"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "preferred_locale": {
            "type": [
              "string",
              "null"
            ],
            "description": "Preferred language: `zh_TW`, `en`, `ja`."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Payment": {
        "type": "object",
        "required": [
          "id",
          "object",
          "appointment_id",
          "amount",
          "currency",
          "method",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "object": {
            "type": "string",
            "const": "payment"
          },
          "appointment_id": {
            "type": "string",
            "format": "uuid",
            "description": "The appointment the payment is recorded on."
          },
          "amount": {
            "type": "string",
            "description": "Amount. A string in the currency's major unit, with no thousands separators or symbols, e.g. TWD `\"1200\"`, USD `\"12.50\"`. It has no sign."
          },
          "currency": {
            "type": "string",
            "description": "Currency code."
          },
          "method": {
            "type": "string",
            "enum": [
              "cash",
              "points",
              "bank_transfer",
              "line_pay",
              "newebpay",
              "payuni",
              "stripe",
              "other"
            ],
            "description": "How the payment was collected. `points` is the merchant's points."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the payment was recorded."
          }
        }
      },
      "Refund": {
        "type": "object",
        "required": [
          "id",
          "object",
          "appointment_id",
          "amount",
          "currency",
          "method",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "object": {
            "type": "string",
            "const": "refund"
          },
          "appointment_id": {
            "type": "string",
            "format": "uuid",
            "description": "The appointment the refund is recorded on."
          },
          "amount": {
            "type": "string",
            "description": "Amount. A string in the currency's major unit, with no thousands separators or symbols, e.g. TWD `\"1200\"`, USD `\"12.50\"`. It has no sign."
          },
          "currency": {
            "type": "string",
            "description": "Currency code."
          },
          "method": {
            "type": "string",
            "enum": [
              "cash",
              "points",
              "bank_transfer",
              "line_pay",
              "newebpay",
              "payuni",
              "stripe",
              "other"
            ],
            "description": "How the refund was returned. `points` is the merchant's points."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the refund was recorded."
          }
        }
      },
      "ServiceList": {
        "type": "object",
        "required": [
          "object",
          "data",
          "has_more",
          "next_cursor"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Service"
            },
            "description": "The resources on this page."
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether more data follows."
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "The cursor for the next page. `null` when `has_more` is `false`."
          }
        }
      },
      "StaffList": {
        "type": "object",
        "required": [
          "object",
          "data",
          "has_more",
          "next_cursor"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Staff"
            },
            "description": "The resources on this page."
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether more data follows."
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "The cursor for the next page. `null` when `has_more` is `false`."
          }
        }
      },
      "AppointmentList": {
        "type": "object",
        "required": [
          "object",
          "data",
          "has_more",
          "next_cursor"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Appointment"
            },
            "description": "The resources on this page."
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether more data follows."
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "The cursor for the next page. `null` when `has_more` is `false`."
          }
        }
      },
      "CustomerList": {
        "type": "object",
        "required": [
          "object",
          "data",
          "has_more",
          "next_cursor"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Customer"
            },
            "description": "The resources on this page."
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether more data follows."
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "The cursor for the next page. `null` when `has_more` is `false`."
          }
        }
      },
      "PaymentList": {
        "type": "object",
        "required": [
          "object",
          "data",
          "has_more",
          "next_cursor"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Payment"
            },
            "description": "The resources on this page."
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether more data follows."
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "The cursor for the next page. `null` when `has_more` is `false`."
          }
        }
      },
      "RefundList": {
        "type": "object",
        "required": [
          "object",
          "data",
          "has_more",
          "next_cursor"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Refund"
            },
            "description": "The resources on this page."
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether more data follows."
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "The cursor for the next page. `null` when `has_more` is `false`."
          }
        }
      },
      "ApiVersion": {
        "type": "string",
        "enum": [
          "v1"
        ],
        "description": "Format version of the event content, set per webhook endpoint. Within a version only backward-compatible changes are made. Events from `GET /events` carry the version of the API path (`v1`)."
      },
      "ActorType": {
        "type": "string",
        "enum": [
          "merchant_user",
          "customer",
          "system"
        ],
        "description": "The type of the actor: a staff member of the shop, a customer, or no actor."
      },
      "AppointmentCreatedEvent": {
        "description": "An appointment is created.",
        "type": "object",
        "required": [
          "id",
          "object",
          "api_version",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID, the same as the `webhook-id` header. It doesn't change when the event is retried or resent."
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "api_version": {
            "$ref": "#/components/schemas/ApiVersion"
          },
          "type": {
            "type": "string",
            "const": "appointment.created"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event was recorded."
          },
          "data": {
            "type": "object",
            "required": [
              "appointment",
              "actor_type"
            ],
            "properties": {
              "appointment": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Appointment"
                  }
                ],
                "description": "The appointment as it was read when the event was recorded. `customer` contains only `id` and `object`."
              },
              "actor_type": {
                "$ref": "#/components/schemas/ActorType"
              }
            }
          }
        }
      },
      "AppointmentConfirmedEvent": {
        "description": "An appointment is confirmed.",
        "type": "object",
        "required": [
          "id",
          "object",
          "api_version",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID, the same as the `webhook-id` header. It doesn't change when the event is retried or resent."
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "api_version": {
            "$ref": "#/components/schemas/ApiVersion"
          },
          "type": {
            "type": "string",
            "const": "appointment.confirmed"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event was recorded."
          },
          "data": {
            "type": "object",
            "required": [
              "appointment",
              "previous_status",
              "actor_type"
            ],
            "properties": {
              "appointment": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Appointment"
                  }
                ],
                "description": "The appointment as it was read when the event was recorded. `customer` contains only `id` and `object`."
              },
              "previous_status": {
                "type": "string",
                "enum": [
                  "pending",
                  "confirmed",
                  "completed",
                  "cancelled",
                  "no_show"
                ],
                "description": "The appointment status before the change."
              },
              "actor_type": {
                "$ref": "#/components/schemas/ActorType"
              }
            }
          }
        }
      },
      "AppointmentCancelledEvent": {
        "description": "An appointment is canceled.",
        "type": "object",
        "required": [
          "id",
          "object",
          "api_version",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID, the same as the `webhook-id` header. It doesn't change when the event is retried or resent."
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "api_version": {
            "$ref": "#/components/schemas/ApiVersion"
          },
          "type": {
            "type": "string",
            "const": "appointment.cancelled"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event was recorded."
          },
          "data": {
            "type": "object",
            "required": [
              "appointment",
              "previous_status",
              "actor_type"
            ],
            "properties": {
              "appointment": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Appointment"
                  }
                ],
                "description": "The appointment as it was read when the event was recorded. `customer` contains only `id` and `object`."
              },
              "previous_status": {
                "type": "string",
                "enum": [
                  "pending",
                  "confirmed",
                  "completed",
                  "cancelled",
                  "no_show"
                ],
                "description": "The appointment status before the change."
              },
              "actor_type": {
                "$ref": "#/components/schemas/ActorType"
              }
            }
          }
        }
      },
      "AppointmentCompletedEvent": {
        "description": "An appointment is completed.",
        "type": "object",
        "required": [
          "id",
          "object",
          "api_version",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID, the same as the `webhook-id` header. It doesn't change when the event is retried or resent."
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "api_version": {
            "$ref": "#/components/schemas/ApiVersion"
          },
          "type": {
            "type": "string",
            "const": "appointment.completed"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event was recorded."
          },
          "data": {
            "type": "object",
            "required": [
              "appointment",
              "previous_status",
              "actor_type"
            ],
            "properties": {
              "appointment": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Appointment"
                  }
                ],
                "description": "The appointment as it was read when the event was recorded. `customer` contains only `id` and `object`."
              },
              "previous_status": {
                "type": "string",
                "enum": [
                  "pending",
                  "confirmed",
                  "completed",
                  "cancelled",
                  "no_show"
                ],
                "description": "The appointment status before the change."
              },
              "actor_type": {
                "$ref": "#/components/schemas/ActorType"
              }
            }
          }
        }
      },
      "AppointmentNoShowEvent": {
        "description": "An appointment is marked as a no-show.",
        "type": "object",
        "required": [
          "id",
          "object",
          "api_version",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID, the same as the `webhook-id` header. It doesn't change when the event is retried or resent."
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "api_version": {
            "$ref": "#/components/schemas/ApiVersion"
          },
          "type": {
            "type": "string",
            "const": "appointment.no_show"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event was recorded."
          },
          "data": {
            "type": "object",
            "required": [
              "appointment",
              "previous_status",
              "actor_type"
            ],
            "properties": {
              "appointment": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Appointment"
                  }
                ],
                "description": "The appointment as it was read when the event was recorded. `customer` contains only `id` and `object`."
              },
              "previous_status": {
                "type": "string",
                "enum": [
                  "pending",
                  "confirmed",
                  "completed",
                  "cancelled",
                  "no_show"
                ],
                "description": "The appointment status before the change."
              },
              "actor_type": {
                "$ref": "#/components/schemas/ActorType"
              }
            }
          }
        }
      },
      "AppointmentRescheduledEvent": {
        "description": "An appointment's start time changes.",
        "type": "object",
        "required": [
          "id",
          "object",
          "api_version",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID, the same as the `webhook-id` header. It doesn't change when the event is retried or resent."
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "api_version": {
            "$ref": "#/components/schemas/ApiVersion"
          },
          "type": {
            "type": "string",
            "const": "appointment.rescheduled"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event was recorded."
          },
          "data": {
            "type": "object",
            "required": [
              "appointment",
              "previous",
              "actor_type"
            ],
            "properties": {
              "appointment": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Appointment"
                  }
                ],
                "description": "The appointment as it was read when the event was recorded. `customer` contains only `id` and `object`."
              },
              "previous": {
                "type": "object",
                "required": [
                  "start_at"
                ],
                "properties": {
                  "start_at": {
                    "type": "string",
                    "format": "date-time",
                    "description": "The original start time."
                  }
                }
              },
              "actor_type": {
                "$ref": "#/components/schemas/ActorType"
              }
            }
          }
        }
      },
      "AppointmentUpdatedEvent": {
        "description": "Other appointment details change, such as services, staff, amounts, payments, the deposit, or the customer.",
        "type": "object",
        "required": [
          "id",
          "object",
          "api_version",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID, the same as the `webhook-id` header. It doesn't change when the event is retried or resent."
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "api_version": {
            "$ref": "#/components/schemas/ApiVersion"
          },
          "type": {
            "type": "string",
            "const": "appointment.updated"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event was recorded."
          },
          "data": {
            "type": "object",
            "required": [
              "appointment"
            ],
            "properties": {
              "appointment": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Appointment"
                  }
                ],
                "description": "The appointment as it was read when the event was recorded. `customer` contains only `id` and `object`."
              }
            }
          }
        }
      },
      "CustomerCreatedEvent": {
        "description": "A customer is added, or an archived customer is restored.",
        "type": "object",
        "required": [
          "id",
          "object",
          "api_version",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID, the same as the `webhook-id` header. It doesn't change when the event is retried or resent."
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "api_version": {
            "$ref": "#/components/schemas/ApiVersion"
          },
          "type": {
            "type": "string",
            "const": "customer.created"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event was recorded."
          },
          "data": {
            "type": "object",
            "required": [
              "customer"
            ],
            "properties": {
              "customer": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/CustomerReference"
                  }
                ],
                "description": "Contains only `id` and `object`. Retrieve the customer with `GET /customers/{id}`, which returns 404 for archived and deleted customers."
              }
            }
          }
        }
      },
      "CustomerUpdatedEvent": {
        "description": "A customer's name, email, phone, or preferred language changes.",
        "type": "object",
        "required": [
          "id",
          "object",
          "api_version",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID, the same as the `webhook-id` header. It doesn't change when the event is retried or resent."
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "api_version": {
            "$ref": "#/components/schemas/ApiVersion"
          },
          "type": {
            "type": "string",
            "const": "customer.updated"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event was recorded."
          },
          "data": {
            "type": "object",
            "required": [
              "customer"
            ],
            "properties": {
              "customer": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/CustomerReference"
                  }
                ],
                "description": "Contains only `id` and `object`. Retrieve the customer with `GET /customers/{id}`, which returns 404 for archived and deleted customers."
              }
            }
          }
        }
      },
      "CustomerDeletedEvent": {
        "description": "A customer is archived or deleted, or their personal data is erased.",
        "type": "object",
        "required": [
          "id",
          "object",
          "api_version",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID, the same as the `webhook-id` header. It doesn't change when the event is retried or resent."
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "api_version": {
            "$ref": "#/components/schemas/ApiVersion"
          },
          "type": {
            "type": "string",
            "const": "customer.deleted"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event was recorded."
          },
          "data": {
            "type": "object",
            "required": [
              "customer"
            ],
            "properties": {
              "customer": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/CustomerReference"
                  }
                ],
                "description": "Contains only `id` and `object`. Retrieve the customer with `GET /customers/{id}`, which returns 404 for archived and deleted customers."
              }
            }
          }
        }
      },
      "ServiceCreatedEvent": {
        "description": "A service is created.",
        "type": "object",
        "required": [
          "id",
          "object",
          "api_version",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID, the same as the `webhook-id` header. It doesn't change when the event is retried or resent."
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "api_version": {
            "$ref": "#/components/schemas/ApiVersion"
          },
          "type": {
            "type": "string",
            "const": "service.created"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event was recorded."
          },
          "data": {
            "type": "object",
            "required": [
              "service"
            ],
            "properties": {
              "service": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Service"
                  }
                ],
                "description": "The service when the event was recorded, the same as `GET /services/{id}`."
              }
            }
          }
        }
      },
      "ServiceUpdatedEvent": {
        "description": "A service's name, description, duration, price, booking availability, category, staff, or sort order changes.",
        "type": "object",
        "required": [
          "id",
          "object",
          "api_version",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID, the same as the `webhook-id` header. It doesn't change when the event is retried or resent."
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "api_version": {
            "$ref": "#/components/schemas/ApiVersion"
          },
          "type": {
            "type": "string",
            "const": "service.updated"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event was recorded."
          },
          "data": {
            "type": "object",
            "required": [
              "service"
            ],
            "properties": {
              "service": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Service"
                  }
                ],
                "description": "The service when the event was recorded, the same as `GET /services/{id}`."
              }
            }
          }
        }
      },
      "ServiceDeletedEvent": {
        "description": "A service is deleted, including when its category is deleted.",
        "type": "object",
        "required": [
          "id",
          "object",
          "api_version",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID, the same as the `webhook-id` header. It doesn't change when the event is retried or resent."
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "api_version": {
            "$ref": "#/components/schemas/ApiVersion"
          },
          "type": {
            "type": "string",
            "const": "service.deleted"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event was recorded."
          },
          "data": {
            "type": "object",
            "required": [
              "service"
            ],
            "properties": {
              "service": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Service"
                  }
                ],
                "description": "The service as it was when deleted. `GET /services/{id}` returns 404."
              }
            }
          }
        }
      },
      "StaffCreatedEvent": {
        "description": "A staff member joins the merchant.",
        "type": "object",
        "required": [
          "id",
          "object",
          "api_version",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID, the same as the `webhook-id` header. It doesn't change when the event is retried or resent."
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "api_version": {
            "$ref": "#/components/schemas/ApiVersion"
          },
          "type": {
            "type": "string",
            "const": "staff.created"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event was recorded."
          },
          "data": {
            "type": "object",
            "required": [
              "staff"
            ],
            "properties": {
              "staff": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Staff"
                  }
                ],
                "description": "The staff member, the same as `GET /staff/{id}`."
              }
            }
          }
        }
      },
      "StaffUpdatedEvent": {
        "description": "A staff member's name changes.",
        "type": "object",
        "required": [
          "id",
          "object",
          "api_version",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID, the same as the `webhook-id` header. It doesn't change when the event is retried or resent."
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "api_version": {
            "$ref": "#/components/schemas/ApiVersion"
          },
          "type": {
            "type": "string",
            "const": "staff.updated"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event was recorded."
          },
          "data": {
            "type": "object",
            "required": [
              "staff"
            ],
            "properties": {
              "staff": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Staff"
                  }
                ],
                "description": "The staff member, the same as `GET /staff/{id}`."
              }
            }
          }
        }
      },
      "StaffDeletedEvent": {
        "description": "A staff member is removed from or leaves the merchant, or their account is deleted.",
        "type": "object",
        "required": [
          "id",
          "object",
          "api_version",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID, the same as the `webhook-id` header. It doesn't change when the event is retried or resent."
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "api_version": {
            "$ref": "#/components/schemas/ApiVersion"
          },
          "type": {
            "type": "string",
            "const": "staff.deleted"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event was recorded."
          },
          "data": {
            "type": "object",
            "required": [
              "staff"
            ],
            "properties": {
              "staff": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Staff"
                  }
                ],
                "description": "The staff member as they were when they left. `GET /staff/{id}` returns 404."
              }
            }
          }
        }
      },
      "PaymentCreatedEvent": {
        "description": "A payment is recorded on an appointment.",
        "type": "object",
        "required": [
          "id",
          "object",
          "api_version",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID, the same as the `webhook-id` header. It doesn't change when the event is retried or resent."
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "api_version": {
            "$ref": "#/components/schemas/ApiVersion"
          },
          "type": {
            "type": "string",
            "const": "payment.created"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event was recorded."
          },
          "data": {
            "type": "object",
            "required": [
              "payment"
            ],
            "properties": {
              "payment": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Payment"
                  }
                ],
                "description": "The payment, with the same fields as `GET /payments/{id}`."
              }
            }
          }
        }
      },
      "RefundCreatedEvent": {
        "description": "A refund is recorded on an appointment.",
        "type": "object",
        "required": [
          "id",
          "object",
          "api_version",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID, the same as the `webhook-id` header. It doesn't change when the event is retried or resent."
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "api_version": {
            "$ref": "#/components/schemas/ApiVersion"
          },
          "type": {
            "type": "string",
            "const": "refund.created"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event was recorded."
          },
          "data": {
            "type": "object",
            "required": [
              "refund"
            ],
            "properties": {
              "refund": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Refund"
                  }
                ],
                "description": "The refund, with the same fields as `GET /refunds/{id}`."
              }
            }
          }
        }
      },
      "PingEvent": {
        "description": "A test event sent from the dashboard. Sent once and not retried.",
        "type": "object",
        "required": [
          "id",
          "object",
          "api_version",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Event ID, the same as the `webhook-id` header. It doesn't change when the event is retried or resent."
          },
          "object": {
            "type": "string",
            "const": "event"
          },
          "api_version": {
            "$ref": "#/components/schemas/ApiVersion"
          },
          "type": {
            "type": "string",
            "const": "ping"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the event was recorded."
          },
          "data": {
            "type": "object",
            "required": [],
            "properties": {}
          }
        }
      },
      "Event": {
        "description": "An event, in the same JSON that is sent to webhook endpoints. `type` tells which one it is.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/AppointmentCreatedEvent"
          },
          {
            "$ref": "#/components/schemas/AppointmentConfirmedEvent"
          },
          {
            "$ref": "#/components/schemas/AppointmentCancelledEvent"
          },
          {
            "$ref": "#/components/schemas/AppointmentCompletedEvent"
          },
          {
            "$ref": "#/components/schemas/AppointmentNoShowEvent"
          },
          {
            "$ref": "#/components/schemas/AppointmentRescheduledEvent"
          },
          {
            "$ref": "#/components/schemas/AppointmentUpdatedEvent"
          },
          {
            "$ref": "#/components/schemas/CustomerCreatedEvent"
          },
          {
            "$ref": "#/components/schemas/CustomerUpdatedEvent"
          },
          {
            "$ref": "#/components/schemas/CustomerDeletedEvent"
          },
          {
            "$ref": "#/components/schemas/ServiceCreatedEvent"
          },
          {
            "$ref": "#/components/schemas/ServiceUpdatedEvent"
          },
          {
            "$ref": "#/components/schemas/ServiceDeletedEvent"
          },
          {
            "$ref": "#/components/schemas/StaffCreatedEvent"
          },
          {
            "$ref": "#/components/schemas/StaffUpdatedEvent"
          },
          {
            "$ref": "#/components/schemas/StaffDeletedEvent"
          },
          {
            "$ref": "#/components/schemas/PaymentCreatedEvent"
          },
          {
            "$ref": "#/components/schemas/RefundCreatedEvent"
          }
        ],
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "appointment.created": "#/components/schemas/AppointmentCreatedEvent",
            "appointment.confirmed": "#/components/schemas/AppointmentConfirmedEvent",
            "appointment.cancelled": "#/components/schemas/AppointmentCancelledEvent",
            "appointment.completed": "#/components/schemas/AppointmentCompletedEvent",
            "appointment.no_show": "#/components/schemas/AppointmentNoShowEvent",
            "appointment.rescheduled": "#/components/schemas/AppointmentRescheduledEvent",
            "appointment.updated": "#/components/schemas/AppointmentUpdatedEvent",
            "customer.created": "#/components/schemas/CustomerCreatedEvent",
            "customer.updated": "#/components/schemas/CustomerUpdatedEvent",
            "customer.deleted": "#/components/schemas/CustomerDeletedEvent",
            "service.created": "#/components/schemas/ServiceCreatedEvent",
            "service.updated": "#/components/schemas/ServiceUpdatedEvent",
            "service.deleted": "#/components/schemas/ServiceDeletedEvent",
            "staff.created": "#/components/schemas/StaffCreatedEvent",
            "staff.updated": "#/components/schemas/StaffUpdatedEvent",
            "staff.deleted": "#/components/schemas/StaffDeletedEvent",
            "payment.created": "#/components/schemas/PaymentCreatedEvent",
            "refund.created": "#/components/schemas/RefundCreatedEvent"
          }
        }
      },
      "EventList": {
        "type": "object",
        "required": [
          "object",
          "data",
          "has_more",
          "next_cursor"
        ],
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Event"
            },
            "description": "The events on this page."
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether more data follows."
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "The cursor for the next page. `null` when `has_more` is `false`."
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "type",
              "code",
              "message",
              "param",
              "request_id"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "authentication_error",
                  "permission_error",
                  "rate_limit_error",
                  "api_error"
                ]
              },
              "code": {
                "type": "string",
                "enum": [
                  "parameter_invalid",
                  "invalid_api_key",
                  "api_key_exposed",
                  "insufficient_permission",
                  "merchant_inactive",
                  "ip_not_allowed",
                  "resource_missing",
                  "method_not_allowed",
                  "rate_limited",
                  "internal_error",
                  "service_unavailable"
                ]
              },
              "message": {
                "type": "string",
                "description": "Description in English."
              },
              "param": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The parameter that caused the error. Can have a value only for `parameter_invalid`."
              },
              "request_id": {
                "type": "string",
                "pattern": "^req_[A-Za-z0-9]{24}$",
                "description": "The ID of this request, the same as the `X-Request-Id` response header."
              }
            }
          }
        }
      }
    }
  }
}
