{
  "openapi": "3.0.0",
  "info": {
    "title": "1club Platform API",
    "version": "1.0.0",
    "description": "The 1club Platform API lets you programmatically access and manage your organization's data.\n\n## Official API Contract\n\nThis documentation is the official source of truth for the 1club Platform API.\nIf an integration relies on undocumented endpoints, fields, response shapes, or internal behavior outside this spec, we can't guarantee backward compatibility.\nBuild against what's documented here to stay stable as the platform evolves.\n\n## Authentication\n\nAll requests require a customer API key passed as a Bearer token:\n\n```\nAuthorization: Bearer 1club_sk_live_...\n```\n\nGenerate API keys from the admin portal under **Settings > API Tokens**.\nThe key is tied to your organization - all responses are scoped to your org's data.\n\nAgents and MCP connectors can instead send an OAuth access token (the `platformOAuth` scheme), requesting only the scopes the task needs.\n\n## Rate Limiting\n\n- **100 requests per minute** per API key\n- When exceeded, the API returns `429 Too Many Requests` with a `Retry-After` header\n- Rate limit headers are included in every response:\n  - `X-RateLimit-Limit` - max requests per window\n  - `X-RateLimit-Remaining` - requests remaining\n  - `X-RateLimit-Reset` - seconds until the window resets\n\n## Errors\n\n| Status | Meaning |\n|--------|---------|\n| `400` | Invalid request parameters |\n| `401` | Missing or invalid API key |\n| `404` | Resource not found (or doesn't belong to your organization) |\n| `429` | Rate limit exceeded |\n| `500` | Internal server error |\n\n## Versioning and deprecation\n\nThe API is versioned in the path (`/v1`). Changes within a version are additive: new endpoints, new optional parameters and new response fields can appear at any time, so clients should ignore fields they do not recognise.\nA breaking change ships as a new version.\nAn operation due to be removed is first marked `deprecated: true` in this spec and announced in the changelog at https://docs.1club.ai/changelog, with advance notice before it is withdrawn.",
    "contact": {
      "name": "1club API Support",
      "email": "support@1club.ai"
    }
  },
  "servers": [
    {
      "url": "https://api.1club.ai",
      "description": "Production API"
    }
  ],
  "components": {
    "securitySchemes": {
      "customerApiAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Organization-scoped bearer credential: a customer API key (1club_sk_live_...) or an MCP OAuth access token."
      },
      "platformOAuth": {
        "type": "oauth2",
        "description": "OAuth 2.1 authorization code flow with PKCE (S256), as used by MCP connectors. Register a client dynamically (RFC 7591) at https://api.1club.ai/v1/mcp/oauth/register. Each scope grants one capability; request only what the integration needs.",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://auth.1club.ai/oauth/authorize",
            "tokenUrl": "https://api.1club.ai/v1/mcp/oauth/token",
            "scopes": {
              "*": "Full access - read and manage everything in this organization, including capabilities added later",
              "classes:read": "View classes, class types, schedules and progression tracks",
              "classes:write": "Create, reschedule, and cancel classes, and maintain the class types they are run as",
              "checkins:read": "View check-ins",
              "checkins:write": "Check people in, to a booking or on their membership",
              "content:read": "View published content",
              "content:write": "Create, edit and delete content - posts, FAQs, documents and reusable blocks",
              "website:read": "View your website: pages, sections, layout, styles and publish history",
              "website:write": "Edit your website - pages, sections, navigation and styles. Edits stay unpublished until published.",
              "website:publish": "Publish your website, making unpublished edits visible to the public, and roll back to an earlier version",
              "media:read": "View your media library",
              "media:write": "Add images and videos to your media library and edit their names and descriptions",
              "media:delete": "Permanently delete files from your media library",
              "clubs:read": "View club information",
              "clubs:write": "Edit your clubs' details - name, contact details, address, opening hours, amenities and sports. Live on your website, member portal, app and 1club.me at once; a club listed on 1club.me sends its listing's changes for review.",
              "transactions:read": "View transactions, who owes you and for how long, the sales behind your tax report and your chart of accounts",
              "transactions:write": "Record revenue collected outside 1club, such as a marketplace payout for your bookings, and refunds of it. Nothing is charged to anyone.",
              "transactions:delete": "Void unpaid charges so they are no longer owed, and delete ones raised by mistake. A never-paid pass whose last charge goes is cancelled with it. Paid charges cannot be voided or deleted, and an API key reaches only the charges of bookings it made.",
              "payments:write": "Record a payment against what a member owes, with one of your own payment methods such as cash or a bank transfer, and charge a member's saved card for a charge. An API key reaches only the charges of bookings it made.",
              "invoices:read": "View your invoices - who they were issued to, their amounts and status - and how much was invoiced over a period",
              "areas:read": "View areas, area types, blocks and availability",
              "areas:write": "Create and update areas and area types, and block or unblock an area",
              "bookings:read": "View bookings, and every booking of a period with where its payment stands (the booking audit)",
              "bookings:write": "Create, change, reschedule and cancel bookings, add or remove participants, and waive what a cancelled or missed booking still owes",
              "bookings:delete": "Permanently delete bookings entered by mistake, with their unpaid charges, check-ins and players. A paid or invoiced booking cannot be deleted - cancel and refund it instead.",
              "contacts:read": "View contacts, their tags and custom field values, and your sales pipeline stages and sources, and who is behind your people reports (at risk, renewals, promotions, cancellations)",
              "contacts:write": "Create and update contacts and tag them, and maintain your tags, smart tag rules and contact custom fields",
              "contacts:delete": "Archive contacts, which cancels their active memberships and all their future bookings. Separate from creating and updating because those cancellations are not undone by restoring the contact.",
              "instructors:read": "View instructors, their availability, the staff roster and their time off",
              "instructors:write": "Create and update instructors (coaches) and the instructor types they are grouped by, including what members pay for a one-to-one session and how you pay the coach, and manage the staff roster (shifts, rotations) and their time off. Does not grant admin-portal access: an instructor created this way has no login and is never invited to your staff portal.",
              "plans:read": "View plans and pricing",
              "plans:write": "Create, edit and delete plans and plan categories",
              "memberships:read": "View memberships",
              "memberships:write": "Sell memberships, set their price and whether they are paid, and pause, resume or cancel them",
              "products:read": "View the product catalogue and its categories, including prices and how many are left to sell",
              "products:write": "Create and edit products and product categories",
              "forms:read": "View your forms and their questions, and how many people have completed each. Not the answers themselves.",
              "forms:write": "Create and edit forms and their questions, including sign-up forms that sell your plans and products. Forms are public as soon as they are created or changed. Does not delete forms.",
              "organization:write": "Change organization-wide settings, which take effect immediately. That includes which languages you offer, across your website, the member portal, the mobile app and email, and what your clubs call their booking cards (private training, group activities, areas) wherever members book.",
              "revenue-accounts:write": "Add accounts to your chart of accounts and edit them, including which one sales post to by default. Reading the chart needs no scope of its own - any of plans, products or transactions admits it.",
              "pricing-rules:read": "View pricing rules - the surcharges, discounts and set prices applied when a booking is priced - and quote what a booking would cost",
              "pricing-rules:write": "Create, edit, turn off and delete pricing rules. Changes apply to every booking priced afterwards.",
              "booking-policies:read": "View booking policies: cancellation and refund rules, payment timing and booking windows",
              "booking-policies:write": "Create, edit, duplicate and delete booking policies. Changes apply to every booking they cover from then on.",
              "document-rules:read": "View document rules - which members are asked to sign or accept which documents, such as waivers",
              "document-rules:write": "Create, edit and delete document rules, which decide who must sign or accept a document and whether it is required for entry",
              "external-programs:read": "View external programs - third parties such as MultiSport or a corporate wellness scheme that pay for members' visits - and what each covers",
              "external-programs:write": "Create, edit and remove external programs, including what each pays per visit and which classes, areas and coaches it can be used for",
              "templates:read": "View your email and SMS templates",
              "templates:write": "Create, edit and delete email and SMS templates",
              "events:read": "View events, their tickets and how many are sold",
              "events:write": "Create, edit, duplicate and delete events, and publish, unpublish or cancel them. Cancelling an event also cancels its attendees' bookings.",
              "messages:read": "View messages sent to and received from your members, and their delivery status",
              "messages:write": "Prepare draft messages to members. Drafts are never sent from here: someone at your club reviews and sends them from 1club.",
              "analytics:read": "View statistics over a period - revenue, tax, bookings, check-ins, how full your classes, courts and coaches were, memberships added and cancelled, and new members - as totals, never the people or sales behind them",
              "payment-methods:write": "Add, rename and remove the payment methods staff record by hand, such as cash or a bank transfer, and choose which ones members may pick when paying for a booking. Reading them needs no scope of its own - transactions:read admits it.",
              "staff:read": "View your staff accounts, their roles, and what each role is allowed to do",
              "staff:write": "Change a staff member's role, and what the manager, front desk and instructor roles are allowed to do. Only a signed-in person can use it, with the same limits as in 1club: an API key is always refused.",
              "notifications:read": "View which notifications each role gets by default, and on which channels",
              "notifications:write": "Change which notifications each role gets and on which channels, and apply those defaults to everyone in a role, replacing their own choices",
              "competitors:read": "View the competitors you follow, their prices and Google ratings, and how your prices compare with the market",
              "competitors:write": "Add, edit and remove the competitors you follow, and have their websites read again",
              "promotions:read": "View your promotions - discounts and vouchers, their promo codes, dates and how often they were redeemed",
              "promotions:write": "Create, edit and delete promotions - discounts and vouchers and their promo codes. A promotion is offered to members as soon as its dates allow.",
              "reviews:read": "View your reviews - ratings, what members wrote, your replies and the private notes reviewers left for you",
              "automations:read": "View your automations - what starts each one, its steps and the messages it sends"
            }
          }
        }
      }
    },
    "schemas": {
      "PlatformClassCreate": {
        "type": "object",
        "required": [
          "clubId",
          "name",
          "startTime",
          "endTime"
        ],
        "properties": {
          "clubId": {
            "type": "integer"
          },
          "instructorLocationId": {
            "type": "integer",
            "nullable": true,
            "description": "Where the class happens, when that is one of its instructors' locations (GET /v1/platform/instructors/{id} `locations`) rather than an area of its club. Required for a Professional's class (`INSTRUCTOR_LOCATION_REQUIRED`), whose club is its business and not a place. The class then takes no `areaId`."
          },
          "areaId": {
            "type": "integer",
            "nullable": true
          },
          "classTypeId": {
            "type": "integer",
            "nullable": true
          },
          "instructorIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 20
          },
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 5000
          },
          "priceBeforeTax": {
            "type": "number",
            "minimum": 0,
            "description": "The price to store, excluding tax - the same field reads return. The tax-inclusive `price` a class reads back with is computed and cannot be written: sending it is a 400, because posting it back would re-apply tax on every round trip."
          },
          "isFree": {
            "type": "boolean"
          },
          "maxCapacity": {
            "type": "integer",
            "nullable": true,
            "minimum": 1
          },
          "startTime": {
            "type": "string",
            "format": "date-time",
            "description": "ISO 8601 instant with an explicit offset."
          },
          "endTime": {
            "type": "string",
            "format": "date-time",
            "description": "ISO 8601 instant with an explicit offset."
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Private",
              "Member_only",
              "Public"
            ]
          },
          "sport": {
            "type": "string",
            "nullable": true,
            "maxLength": 60
          },
          "color": {
            "type": "string",
            "pattern": "^#[0-9a-fA-F]{6}$"
          },
          "recurrence": {
            "type": "object",
            "description": "Repeat rule. Present, this one request creates the whole series rather than a single occurrence - `startTime`/`endTime` become the template slot, and the series runs from `startTime`. A bounded series (`ends.type` `until` or `after`) is written in full here and capped at 520 occurrences; an open-ended one materializes a rolling window and extends itself. Unknown fields are rejected.",
            "required": [
              "frequency"
            ],
            "properties": {
              "frequency": {
                "type": "string",
                "enum": [
                  "daily",
                  "weekly",
                  "monthly"
                ]
              },
              "interval": {
                "type": "integer",
                "minimum": 1,
                "maximum": 365,
                "default": 1,
                "description": "Repeat every N days, weeks or months."
              },
              "daysOfWeek": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "sunday",
                    "monday",
                    "tuesday",
                    "wednesday",
                    "thursday",
                    "friday",
                    "saturday"
                  ]
                },
                "minItems": 1,
                "maxItems": 7,
                "description": "Required for a weekly cadence, and rejected for any other - nothing else reads it. The first occurrence is the first listed day at or after `startTime`."
              },
              "endDate": {
                "type": "string",
                "format": "date-time",
                "description": "Last day the series may reach, as an ISO 8601 instant with an explicit offset; an occurrence starting at or before it is kept. Required when `ends.type` is `until`, and rejected otherwise."
              },
              "ends": {
                "type": "object",
                "description": "How the series terminates. Omitted on a create means `never`: an open-ended series kept on a rolling window.",
                "required": [
                  "type"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "until",
                      "after",
                      "never"
                    ]
                  },
                  "occurrences": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 520,
                    "description": "How many occurrences the series holds **in total**, counted from its first occurrence and across every day in `daysOfWeek` - not how many weeks. A Monday-and-Wednesday class running for twelve weeks is `24`, not `12`; sending `12` there creates six weeks. When the series ends on a date rather than after a count, `ends.type: \"until\"` with an `endDate` says so without the arithmetic. Required when `ends.type` is `after`, and rejected otherwise."
                  }
                }
              }
            }
          }
        }
      },
      "PlatformClassUpdate": {
        "type": "object",
        "properties": {
          "clubId": {
            "type": "integer"
          },
          "instructorLocationId": {
            "type": "integer",
            "nullable": true,
            "description": "Where the class happens, when that is one of its instructors' locations (GET /v1/platform/instructors/{id} `locations`) rather than an area of its club. Required for a Professional's class (`INSTRUCTOR_LOCATION_REQUIRED`), whose club is its business and not a place. The class then takes no `areaId`."
          },
          "areaId": {
            "type": "integer",
            "nullable": true
          },
          "classTypeId": {
            "type": "integer",
            "nullable": true
          },
          "instructorIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 20
          },
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 5000
          },
          "priceBeforeTax": {
            "type": "number",
            "minimum": 0,
            "description": "The price to store, excluding tax - the same field reads return. The tax-inclusive `price` a class reads back with is computed and cannot be written: sending it is a 400, because posting it back would re-apply tax on every round trip."
          },
          "isFree": {
            "type": "boolean"
          },
          "maxCapacity": {
            "type": "integer",
            "nullable": true,
            "minimum": 1
          },
          "startTime": {
            "type": "string",
            "format": "date-time",
            "description": "ISO 8601 instant with an explicit offset."
          },
          "endTime": {
            "type": "string",
            "format": "date-time",
            "description": "ISO 8601 instant with an explicit offset."
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Private",
              "Member_only",
              "Public"
            ]
          },
          "sport": {
            "type": "string",
            "nullable": true,
            "maxLength": 60
          },
          "color": {
            "type": "string",
            "pattern": "^#[0-9a-fA-F]{6}$"
          },
          "recurrence": {
            "type": "object",
            "description": "Moves where the series this occurrence belongs to ends; needs `scope=all_future`, and is sent on its own - a body that also carries class fields is rejected. Only the end - a cadence field is rejected. An earlier end removes the occurrences past it and is refused with 409 while any of them has an active booking or waitlist entry.",
            "required": [
              "ends"
            ],
            "properties": {
              "endDate": {
                "type": "string",
                "format": "date-time",
                "description": "Last day the series may reach, as an ISO 8601 instant with an explicit offset; an occurrence starting at or before it is kept. Required when `ends.type` is `until`, and rejected otherwise."
              },
              "ends": {
                "type": "object",
                "description": "How the series terminates. Omitted on a create means `never`: an open-ended series kept on a rolling window.",
                "required": [
                  "type"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "until",
                      "after",
                      "never"
                    ]
                  },
                  "occurrences": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 520,
                    "description": "How many occurrences the series holds **in total**, counted from its first occurrence and across every day in `daysOfWeek` - not how many weeks. A Monday-and-Wednesday class running for twelve weeks is `24`, not `12`; sending `12` there creates six weeks. When the series ends on a date rather than after a count, `ends.type: \"until\"` with an `endDate` says so without the arithmetic. Required when `ends.type` is `after`, and rejected otherwise."
                  }
                }
              }
            }
          },
          "notifyCustomer": {
            "type": "boolean",
            "default": false,
            "description": "Tell the people booked on this class what changed - email plus the in-app and WhatsApp notification. Only sent when the edit changes something visible on their booking (start/end time, area, club, or the instructors); a rename or a price change notifies nobody. Off by default, so callers normally send their own. Assigned instructors get their calendar update either way."
          }
        }
      },
      "PlatformPlanCreate": {
        "type": "object",
        "required": [
          "name",
          "price"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 120
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 5000
          },
          "clubId": {
            "type": "integer",
            "nullable": true
          },
          "planCategoryId": {
            "type": "integer",
            "nullable": true,
            "description": "Category the plan is grouped under on price lists, from GET /v1/platform/plan-categories. `null` takes it out of every category."
          },
          "revenueAccountId": {
            "type": "integer",
            "nullable": true,
            "description": "Ledger account a sale of this plan posts to, from GET /v1/platform/revenue-accounts. Leave it out and the sale falls to the organization's default account, resolved at the time of the sale - so omitting this is a choice, not a gap. `null` clears it back to that."
          },
          "price": {
            "type": "number",
            "minimum": 0
          },
          "signupFee": {
            "type": "number",
            "minimum": 0
          },
          "billingFrequency": {
            "type": "string",
            "enum": [
              "one_time",
              "weekly",
              "monthly",
              "quarterly",
              "annually",
              "custom"
            ]
          },
          "customPeriod": {
            "type": "integer",
            "nullable": true,
            "minimum": 1
          },
          "customPeriodUnit": {
            "type": "string",
            "nullable": true,
            "enum": [
              "days",
              "weeks",
              "months"
            ]
          },
          "minimumTermMonths": {
            "type": "integer",
            "nullable": true,
            "minimum": 1,
            "maximum": 120,
            "description": "Months a buyer commits to before the membership may end, counted from its start; null for none. A membership sold on the plan is stamped with it. Binds only a renewing plan whose first billing period it outlasts - 12 on a yearly plan commits to nothing."
          },
          "isActive": {
            "type": "boolean"
          },
          "maxUses": {
            "type": "number",
            "nullable": true,
            "minimum": 0
          },
          "sessionUnit": {
            "type": "string",
            "nullable": true,
            "enum": [
              "booking",
              "hour"
            ]
          },
          "validityPeriod": {
            "type": "integer",
            "nullable": true,
            "minimum": 1
          },
          "autoRenews": {
            "type": "boolean"
          },
          "renewalDaysInAdvance": {
            "type": "integer",
            "minimum": 0,
            "maximum": 60
          },
          "requirePaymentUpfront": {
            "type": "boolean"
          },
          "featured": {
            "type": "boolean",
            "description": "Highlight the plan as \"Most popular\" on the club's price lists. A flag, not a single choice: mark the same tier at each billing period it is sold at."
          },
          "isIntroOffer": {
            "type": "boolean",
            "description": "Mark the plan as an intro offer for first-time customers. It is counted in the First visits report."
          },
          "sports": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 50
          },
          "features": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 100
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Private",
              "Member_only",
              "Public"
            ]
          },
          "validFor": {
            "type": "object",
            "properties": {
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "classes",
                    "areas",
                    "instructors"
                  ]
                }
              },
              "classTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              "areaTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              "instructorTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              }
            }
          },
          "allowances": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "description": "The plan's session counters, sent instead of `maxUses`, `sessionUnit` and `validFor`: several for a plan like 5 Yoga + 4 Pilates a month. Two allowances may not cover the same type in the same scope, and only one may have no scopes (the one a check-in without a booking spends). On an update, an `id` from the plan's `allowances` keeps that allowance; one left out is removed. A single entry makes an ordinary plan.",
            "items": {
              "type": "object",
              "required": [
                "validFor",
                "maxUses"
              ],
              "properties": {
                "id": {
                  "type": "integer",
                  "description": "An existing allowance's `allowanceId`, to keep it."
                },
                "validFor": {
                  "type": "object",
                  "properties": {
                    "scopes": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "classes",
                          "areas",
                          "instructors"
                        ]
                      }
                    },
                    "classTypes": {
                      "type": "array",
                      "items": {
                        "type": "integer"
                      }
                    },
                    "areaTypes": {
                      "type": "array",
                      "items": {
                        "type": "integer"
                      }
                    },
                    "instructorTypes": {
                      "type": "array",
                      "items": {
                        "type": "integer"
                      }
                    }
                  }
                },
                "maxUses": {
                  "type": "number",
                  "nullable": true,
                  "minimum": 0,
                  "description": "Sessions it grants each period; null for unlimited."
                },
                "sessionUnit": {
                  "type": "string",
                  "nullable": true,
                  "enum": [
                    "booking",
                    "hour"
                  ]
                }
              }
            }
          }
        }
      },
      "PlatformPlanUpdate": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 120
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 5000
          },
          "clubId": {
            "type": "integer",
            "nullable": true
          },
          "planCategoryId": {
            "type": "integer",
            "nullable": true,
            "description": "Category the plan is grouped under on price lists, from GET /v1/platform/plan-categories. `null` takes it out of every category."
          },
          "revenueAccountId": {
            "type": "integer",
            "nullable": true,
            "description": "Ledger account a sale of this plan posts to, from GET /v1/platform/revenue-accounts. Leave it out and the sale falls to the organization's default account, resolved at the time of the sale - so omitting this is a choice, not a gap. `null` clears it back to that."
          },
          "price": {
            "type": "number",
            "minimum": 0
          },
          "signupFee": {
            "type": "number",
            "minimum": 0
          },
          "billingFrequency": {
            "type": "string",
            "enum": [
              "one_time",
              "weekly",
              "monthly",
              "quarterly",
              "annually",
              "custom"
            ]
          },
          "customPeriod": {
            "type": "integer",
            "nullable": true,
            "minimum": 1
          },
          "customPeriodUnit": {
            "type": "string",
            "nullable": true,
            "enum": [
              "days",
              "weeks",
              "months"
            ]
          },
          "minimumTermMonths": {
            "type": "integer",
            "nullable": true,
            "minimum": 1,
            "maximum": 120,
            "description": "Months a buyer commits to before the membership may end, counted from its start; null for none. A membership sold on the plan is stamped with it. Binds only a renewing plan whose first billing period it outlasts - 12 on a yearly plan commits to nothing."
          },
          "isActive": {
            "type": "boolean"
          },
          "maxUses": {
            "type": "number",
            "nullable": true,
            "minimum": 0
          },
          "sessionUnit": {
            "type": "string",
            "nullable": true,
            "enum": [
              "booking",
              "hour"
            ]
          },
          "validityPeriod": {
            "type": "integer",
            "nullable": true,
            "minimum": 1
          },
          "autoRenews": {
            "type": "boolean"
          },
          "renewalDaysInAdvance": {
            "type": "integer",
            "minimum": 0,
            "maximum": 60
          },
          "requirePaymentUpfront": {
            "type": "boolean"
          },
          "featured": {
            "type": "boolean",
            "description": "Highlight the plan as \"Most popular\" on the club's price lists. A flag, not a single choice: mark the same tier at each billing period it is sold at."
          },
          "isIntroOffer": {
            "type": "boolean",
            "description": "Mark the plan as an intro offer for first-time customers. It is counted in the First visits report."
          },
          "sports": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 50
          },
          "features": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 100
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Private",
              "Member_only",
              "Public"
            ]
          },
          "validFor": {
            "type": "object",
            "properties": {
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "classes",
                    "areas",
                    "instructors"
                  ]
                }
              },
              "classTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              "areaTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              "instructorTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              }
            }
          },
          "allowances": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "description": "The plan's session counters, sent instead of `maxUses`, `sessionUnit` and `validFor`: several for a plan like 5 Yoga + 4 Pilates a month. Two allowances may not cover the same type in the same scope, and only one may have no scopes (the one a check-in without a booking spends). On an update, an `id` from the plan's `allowances` keeps that allowance; one left out is removed. A single entry makes an ordinary plan.",
            "items": {
              "type": "object",
              "required": [
                "validFor",
                "maxUses"
              ],
              "properties": {
                "id": {
                  "type": "integer",
                  "description": "An existing allowance's `allowanceId`, to keep it."
                },
                "validFor": {
                  "type": "object",
                  "properties": {
                    "scopes": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "classes",
                          "areas",
                          "instructors"
                        ]
                      }
                    },
                    "classTypes": {
                      "type": "array",
                      "items": {
                        "type": "integer"
                      }
                    },
                    "areaTypes": {
                      "type": "array",
                      "items": {
                        "type": "integer"
                      }
                    },
                    "instructorTypes": {
                      "type": "array",
                      "items": {
                        "type": "integer"
                      }
                    }
                  }
                },
                "maxUses": {
                  "type": "number",
                  "nullable": true,
                  "minimum": 0,
                  "description": "Sessions it grants each period; null for unlimited."
                },
                "sessionUnit": {
                  "type": "string",
                  "nullable": true,
                  "enum": [
                    "booking",
                    "hour"
                  ]
                }
              }
            }
          }
        }
      },
      "PlatformInstructor": {
        "type": "object",
        "description": "Public instructor shape returned alongside classes.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "contactId": {
            "type": "integer"
          },
          "sports": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "typeId": {
            "type": "integer",
            "nullable": true
          },
          "type": {
            "type": "object",
            "nullable": true,
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "experience": {
            "type": "string",
            "nullable": true
          },
          "hourlyRate": {
            "type": "number",
            "format": "float",
            "nullable": true
          },
          "bio": {
            "type": "object",
            "nullable": true,
            "additionalProperties": true,
            "description": "EditorJS document for the instructor bio."
          },
          "certifications": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "isActive": {
            "type": "boolean"
          },
          "isBookable": {
            "type": "boolean"
          },
          "contact": {
            "type": "object",
            "nullable": true,
            "properties": {
              "name": {
                "type": "string",
                "nullable": true
              },
              "profileImage": {
                "type": "string",
                "nullable": true
              }
            }
          }
        }
      },
      "PlatformClass": {
        "type": "object",
        "description": "One class occurrence. A weekly class materializes a row per session, linked by `recurrenceId` and `occurrenceIndex`, so `id` is what a booking's `classId` points at - and what distinguishes two groups running in the same hour. Read the staff roster with GET /v1/platform/classes/{id}/bookings.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "images": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "classTypeId": {
            "type": "integer",
            "nullable": true
          },
          "classType": {
            "type": "object",
            "nullable": true,
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string",
                "nullable": true
              },
              "slug": {
                "type": "string",
                "nullable": true
              },
              "maxPartySize": {
                "type": "integer",
                "nullable": true
              }
            }
          },
          "clubId": {
            "type": "integer"
          },
          "instructorLocationId": {
            "type": "integer",
            "nullable": true,
            "description": "Where the class happens when that is one of its instructors' locations rather than its club: always set for a Professional's class."
          },
          "club": {
            "type": "object",
            "nullable": true,
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "areaId": {
            "type": "integer",
            "nullable": true,
            "description": "Room or court the class occupies, when one is assigned."
          },
          "area": {
            "type": "object",
            "nullable": true,
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "startTime": {
            "type": "string",
            "format": "date-time"
          },
          "endTime": {
            "type": "string",
            "format": "date-time"
          },
          "durationMinutes": {
            "type": "integer"
          },
          "isMultiDay": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "cancelled"
            ],
            "description": "A cancelled occurrence keeps its bookings and roster."
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Public",
              "Member_only",
              "Private"
            ]
          },
          "sport": {
            "type": "string",
            "nullable": true
          },
          "color": {
            "type": "string",
            "nullable": true
          },
          "price": {
            "type": "number",
            "format": "float",
            "nullable": true,
            "description": "Price including the organization's default tax - what a member is charged."
          },
          "priceBeforeTax": {
            "type": "number",
            "format": "float",
            "nullable": true,
            "description": "The price as stored on the class, before tax."
          },
          "isFree": {
            "type": "boolean"
          },
          "maxCapacity": {
            "type": "integer",
            "nullable": true,
            "description": "Seats; null when uncapped."
          },
          "maxPartySize": {
            "type": "integer",
            "description": "Largest party one booking may bring, from the class type."
          },
          "bookedCount": {
            "type": "integer",
            "description": "Seats taken: attendee bookings plus standalone walk-in check-ins."
          },
          "currentBookings": {
            "type": "integer",
            "description": "Legacy alias of `bookedCount`."
          },
          "spotsLeft": {
            "type": "integer",
            "nullable": true,
            "description": "`maxCapacity - bookedCount`, floored at 0; null when capacity is unlimited."
          },
          "waitlistCount": {
            "type": "integer",
            "description": "Entries waiting (pending or notified)."
          },
          "allowWaitlist": {
            "type": "boolean"
          },
          "timeStatus": {
            "type": "string",
            "enum": [
              "past",
              "upcoming"
            ]
          },
          "availabilityStatus": {
            "type": "string",
            "enum": [
              "available",
              "full"
            ]
          },
          "recurrenceId": {
            "type": "integer",
            "nullable": true,
            "description": "The series this occurrence belongs to; null for a one-off class."
          },
          "occurrenceIndex": {
            "type": "integer",
            "nullable": true,
            "description": "Position within the series, as materialized."
          },
          "recurrence": {
            "type": "object",
            "nullable": true,
            "description": "The series rule, when this occurrence belongs to one.",
            "properties": {
              "id": {
                "type": "integer"
              },
              "frequency": {
                "type": "string",
                "enum": [
                  "daily",
                  "weekly",
                  "monthly"
                ]
              },
              "interval": {
                "type": "integer"
              },
              "daysOfWeek": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "endsType": {
                "type": "string",
                "enum": [
                  "until",
                  "after",
                  "never"
                ]
              },
              "endsDate": {
                "type": "string",
                "format": "date-time",
                "nullable": true
              },
              "endsTotalOccurrences": {
                "type": "integer",
                "nullable": true
              },
              "status": {
                "type": "string",
                "enum": [
                  "active",
                  "paused",
                  "cancelled"
                ]
              }
            }
          },
          "instructors": {
            "type": "array",
            "description": "Who teaches the occurrence. The instructor's own weekly availability is not included; read it from GET /v1/platform/instructors.",
            "items": {
              "$ref": "#/components/schemas/PlatformInstructor"
            }
          },
          "externalSource": {
            "type": "string",
            "nullable": true,
            "description": "Import provenance - set when the occurrence came from an external system rather than being created in 1club."
          },
          "externalId": {
            "type": "string",
            "nullable": true,
            "description": "The source system's id for this occurrence, for reconciliation against it."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "translations": {
            "type": "object",
            "nullable": true,
            "additionalProperties": true,
            "description": "Every locale's copy, keyed by language code (e.g. 'es', 'fr'). Returned alongside the `locale`-resolved `name`/`description`, so an integration syncing a multilingual timetable can read all of them in one call."
          },
          "series": {
            "type": "object",
            "description": "Present **only** on the response to a recurring create or to an update that moved where the series ends, never on a read: it describes what that one request did. An occurrence at a club that is closed, or past its closing date, is skipped rather than failing the request, so comparing `occurrencesCreated` with what you asked for is the only way a partially-skipped season is visible.",
            "properties": {
              "recurrenceId": {
                "type": "integer"
              },
              "occurrencesCreated": {
                "type": "integer",
                "description": "Occurrences written by this request. The whole series for a bounded one; the first window for an open-ended one, which the extension job grows from there."
              },
              "occurrencesRemoved": {
                "type": "integer",
                "description": "Occurrences past the new end that this request removed. Only on the response to an end change."
              }
            }
          }
        }
      },
      "PlatformClassPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformClass"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total classes matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformClassBooking": {
        "type": "object",
        "description": "One attendee of a class occurrence. Class seats are one booking per person, so this is a booking row resolved with the attendee's name, check-in and payment.",
        "properties": {
          "bookingId": {
            "type": "integer"
          },
          "contactId": {
            "type": "integer",
            "nullable": true,
            "description": "Null for an anonymous seat - a pass or a guest ticket sold without naming who would use it. `bookerName` is then who paid for it."
          },
          "contactName": {
            "type": "string",
            "nullable": true
          },
          "bookerName": {
            "type": "string",
            "nullable": true,
            "description": "Who paid, when the seat is anonymous and was sold through an order - so a roster reads \"Anonymous (Ivan Petrov)\" rather than an opaque booking number."
          },
          "contactEmail": {
            "type": "string",
            "nullable": true,
            "description": "Null unless the key also holds `contacts:read` - an email address is contact PII, gated as it is on the contacts resource."
          },
          "status": {
            "type": "string",
            "description": "Booking status (confirmed, pending, checked_in, cancelled)."
          },
          "source": {
            "type": "string",
            "nullable": true,
            "description": "Channel that created it (admin, portal, app, api, kiosk, …)."
          },
          "startTime": {
            "type": "string",
            "format": "date-time"
          },
          "endTime": {
            "type": "string",
            "format": "date-time"
          },
          "checkedIn": {
            "type": "boolean",
            "description": "Whether the attendee was checked in."
          },
          "checkedInAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "payment": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "paid",
                  "unpaid",
                  "no_charge"
                ],
                "description": "Classified exactly as on `PlatformBooking`. A seat covered by a membership or an external program is `no_charge` - it owes nothing even though it carries a price - so do not read it as an outstanding balance."
              },
              "amount": {
                "type": "number",
                "nullable": true
              },
              "paidAmount": {
                "type": "number",
                "description": "What has been collected on the booking, gross, before any refund. `0` when nothing has."
              },
              "refundedAmount": {
                "type": "number",
                "description": "What has been returned to the customer, across every refund recorded. `paidAmount - refundedAmount` is what the club kept."
              },
              "reference": {
                "type": "string",
                "nullable": true,
                "description": "The collecting partner's own id for the payment, when one reported it through this API (`payment.reference`); null for money 1club collected itself."
              },
              "fee": {
                "type": "number",
                "nullable": true,
                "description": "What the collecting partner kept out of the amount, when it reported one (`payment.fee`)."
              }
            }
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "classId": {
            "type": "integer"
          },
          "membershipId": {
            "type": "integer",
            "nullable": true,
            "description": "The membership the seat was drawn from, when it was covered by one."
          },
          "entranceMethod": {
            "type": "string",
            "nullable": true,
            "description": "How the seat was paid for (direct_payment, membership, external_program)."
          }
        }
      },
      "PlatformClassBookingPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformClassBooking"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total attendees matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformEventBooking": {
        "type": "object",
        "description": "One seat at an event: a registration, or a guest ticket bought with one. Every seat is its own booking row, resolved with the attendee's name, ticket, check-in and payment.",
        "properties": {
          "bookingId": {
            "type": "integer"
          },
          "contactId": {
            "type": "integer",
            "nullable": true,
            "description": "Null for an anonymous seat - a pass or a guest ticket sold without naming who would use it. `bookerName` is then who paid for it."
          },
          "contactName": {
            "type": "string",
            "nullable": true
          },
          "bookerName": {
            "type": "string",
            "nullable": true,
            "description": "Who paid, when the seat is anonymous and was sold through an order - so a roster reads \"Anonymous (Ivan Petrov)\" rather than an opaque booking number."
          },
          "contactEmail": {
            "type": "string",
            "nullable": true,
            "description": "Null unless the key also holds `contacts:read` - an email address is contact PII, gated as it is on the contacts resource."
          },
          "status": {
            "type": "string",
            "description": "Booking status (confirmed, pending, checked_in, cancelled)."
          },
          "source": {
            "type": "string",
            "nullable": true,
            "description": "Channel that created it (admin, portal, app, api, kiosk, …)."
          },
          "startTime": {
            "type": "string",
            "format": "date-time"
          },
          "endTime": {
            "type": "string",
            "format": "date-time"
          },
          "checkedIn": {
            "type": "boolean",
            "description": "Whether the attendee was checked in."
          },
          "checkedInAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "payment": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "paid",
                  "unpaid",
                  "no_charge"
                ],
                "description": "Classified exactly as on `PlatformBooking`. A seat covered by a membership or an external program is `no_charge` - it owes nothing even though it carries a price - so do not read it as an outstanding balance."
              },
              "amount": {
                "type": "number",
                "nullable": true
              },
              "paidAmount": {
                "type": "number",
                "description": "What has been collected on the booking, gross, before any refund. `0` when nothing has."
              },
              "refundedAmount": {
                "type": "number",
                "description": "What has been returned to the customer, across every refund recorded. `paidAmount - refundedAmount` is what the club kept."
              },
              "reference": {
                "type": "string",
                "nullable": true,
                "description": "The collecting partner's own id for the payment, when one reported it through this API (`payment.reference`); null for money 1club collected itself."
              },
              "fee": {
                "type": "number",
                "nullable": true,
                "description": "What the collecting partner kept out of the amount, when it reported one (`payment.fee`)."
              }
            }
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "eventId": {
            "type": "integer"
          },
          "ticket": {
            "type": "object",
            "nullable": true,
            "description": "The ticket the seat was sold on; null on an event that sells none.",
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              }
            }
          }
        }
      },
      "PlatformEventBookingPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformEventBooking"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total attendees matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformClub": {
        "type": "object",
        "description": "A club with its address, contact info, amenities, sports, aggregated images, and average rating.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string",
            "nullable": true
          },
          "address": {
            "type": "string",
            "nullable": true
          },
          "city": {
            "type": "string",
            "nullable": true
          },
          "state": {
            "type": "string",
            "nullable": true
          },
          "country": {
            "type": "string",
            "nullable": true
          },
          "postalCode": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "website": {
            "type": "string",
            "nullable": true
          },
          "logo": {
            "type": "string",
            "nullable": true
          },
          "images": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "All images aggregated from the club and its active areas."
          },
          "amenities": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Raw amenity IDs stored on the club."
          },
          "amenitiesResolved": {
            "type": "array",
            "description": "Amenities resolved to display objects (id, name, locale-aware).",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "icon": {
                  "type": "string",
                  "nullable": true
                },
                "category": {
                  "type": "string",
                  "nullable": true
                }
              }
            }
          },
          "sports": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rating": {
            "type": "object",
            "nullable": true,
            "description": "Average and total of public reviews. Omitted when there are no public reviews.",
            "properties": {
              "average": {
                "type": "number",
                "format": "float"
              },
              "total": {
                "type": "integer"
              }
            }
          },
          "socialProfiles": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Map of social network keys (e.g. 'instagram') to profile URLs."
          },
          "subtitle": {
            "type": "string",
            "nullable": true,
            "description": "In the requested `locale` when the club has a translation for it."
          },
          "description": {
            "type": "object",
            "nullable": true,
            "additionalProperties": true,
            "description": "The club description as an Editor.js block tree (`{ blocks: [...] }`), its text in the requested `locale` when the club has a translation for it."
          },
          "gettingThere": {
            "type": "string",
            "nullable": true,
            "description": "How to reach the club, in the club's own words. In the requested `locale` when translated."
          },
          "operatingHours": {
            "type": "object",
            "nullable": true,
            "description": "Opening hours per weekday (`monday` … `sunday`), each `{ enabled, openTime, closeTime }` in the club's own clock.",
            "additionalProperties": true
          },
          "timezone": {
            "type": "string",
            "nullable": true,
            "description": "The club's IANA timezone, which `operatingHours` are read in."
          },
          "privateTrainingLabel": {
            "type": "string",
            "nullable": true,
            "maxLength": 30,
            "description": "The title of the card that sells an hour with a coach. Defaults to the platform's \"Private training\". Up to 30 characters, on one line. Null when the club uses the platform wording."
          },
          "groupActivitiesLabel": {
            "type": "string",
            "nullable": true,
            "maxLength": 30,
            "description": "The title of the card that lists the club's classes. Defaults to the platform's \"Group activities\". Up to 30 characters, on one line. Null when the club uses the platform wording."
          },
          "areasLabel": {
            "type": "string",
            "nullable": true,
            "maxLength": 30,
            "description": "The title of the card for areas that have no area-type name of their own - untyped areas, and the card that gathers every area. A card for a named area type always shows that type's name instead, so a club whose types are all named never sees this one. Defaults to the platform's \"Areas\". Up to 30 characters, on one line. Null when the club uses the platform wording."
          },
          "translations": {
            "type": "object",
            "description": "Per-language renderings of the labels, keyed by locale, then by label field. Only the booking-card labels; a member reading in a locale with no entry here sees the label itself.",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "privateTrainingLabel": {
                  "type": "string",
                  "maxLength": 30
                },
                "groupActivitiesLabel": {
                  "type": "string",
                  "maxLength": 30
                },
                "areasLabel": {
                  "type": "string",
                  "maxLength": 30
                }
              },
              "additionalProperties": false
            },
            "example": {
              "en": {
                "privateTrainingLabel": "Personal coaching"
              }
            }
          }
        }
      },
      "PlatformClubSummary": {
        "type": "object",
        "description": "One of the organization's clubs, as the club list returns it and as a booking-label update answers: who it is, and its own words for the booking cards members choose from under \"What would you like to book?\".",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string",
            "description": "What every other club endpoint takes in its path."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "inactive",
              "pending",
              "closed"
            ],
            "description": "Only an active club is open for booking; the labels of any club can be set ahead of time."
          },
          "city": {
            "type": "string",
            "nullable": true
          },
          "privateTrainingLabel": {
            "type": "string",
            "nullable": true,
            "maxLength": 30,
            "description": "The title of the card that sells an hour with a coach. Defaults to the platform's \"Private training\". Up to 30 characters, on one line. Null when the club uses the platform wording."
          },
          "groupActivitiesLabel": {
            "type": "string",
            "nullable": true,
            "maxLength": 30,
            "description": "The title of the card that lists the club's classes. Defaults to the platform's \"Group activities\". Up to 30 characters, on one line. Null when the club uses the platform wording."
          },
          "areasLabel": {
            "type": "string",
            "nullable": true,
            "maxLength": 30,
            "description": "The title of the card for areas that have no area-type name of their own - untyped areas, and the card that gathers every area. A card for a named area type always shows that type's name instead, so a club whose types are all named never sees this one. Defaults to the platform's \"Areas\". Up to 30 characters, on one line. Null when the club uses the platform wording."
          },
          "translations": {
            "type": "object",
            "description": "Per-language renderings of the labels, keyed by locale, then by label field. Only the booking-card labels; a member reading in a locale with no entry here sees the label itself.",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "privateTrainingLabel": {
                  "type": "string",
                  "maxLength": 30
                },
                "groupActivitiesLabel": {
                  "type": "string",
                  "maxLength": 30
                },
                "areasLabel": {
                  "type": "string",
                  "maxLength": 30
                }
              },
              "additionalProperties": false
            },
            "example": {
              "en": {
                "privateTrainingLabel": "Personal coaching"
              }
            }
          }
        }
      },
      "PlatformClubBookingLabelsUpdate": {
        "type": "object",
        "description": "The booking-card labels to change. Send only what changes; an omitted field is left alone, and at least one is required. The change is live as soon as it is saved, on every surface members book from: the website, the member portal, the mobile app and 1club.me. Only the card titles are the club's to word: the line under each card is always the platform's, a count (\"4 available\") or, under the group activities card, the club's class type names.",
        "minProperties": 1,
        "additionalProperties": false,
        "properties": {
          "privateTrainingLabel": {
            "type": "string",
            "nullable": true,
            "maxLength": 30,
            "description": "The title of the card that sells an hour with a coach. Defaults to the platform's \"Private training\". Up to 30 characters, on one line. An empty string or null clears it, and members read the platform wording again (already translated into every language 1club ships). Clearing a label also removes its translations."
          },
          "groupActivitiesLabel": {
            "type": "string",
            "nullable": true,
            "maxLength": 30,
            "description": "The title of the card that lists the club's classes. Defaults to the platform's \"Group activities\". Up to 30 characters, on one line. An empty string or null clears it, and members read the platform wording again (already translated into every language 1club ships). Clearing a label also removes its translations."
          },
          "areasLabel": {
            "type": "string",
            "nullable": true,
            "maxLength": 30,
            "description": "The title of the card for areas that have no area-type name of their own - untyped areas, and the card that gathers every area. A card for a named area type always shows that type's name instead, so a club whose types are all named never sees this one. Defaults to the platform's \"Areas\". Up to 30 characters, on one line. An empty string or null clears it, and members read the platform wording again (already translated into every language 1club ships). Clearing a label also removes its translations."
          },
          "translations": {
            "type": "object",
            "description": "Per-language renderings of the labels, keyed by locale (`\"en\"`, `\"pt-BR\"`), then by label field. Merged into what the club already has: only the locales and fields you send change. A string sets that translation, an empty string or null removes it. A translation needs a label under it - one for a label the club does not set (after this request) is refused, since the card then shows the platform wording, which is translated already. Only the three label fields are accepted here; the club's other translations are never touched.",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "privateTrainingLabel": {
                  "type": "string",
                  "nullable": true,
                  "maxLength": 30
                },
                "groupActivitiesLabel": {
                  "type": "string",
                  "nullable": true,
                  "maxLength": 30
                },
                "areasLabel": {
                  "type": "string",
                  "nullable": true,
                  "maxLength": 30
                }
              },
              "additionalProperties": false
            },
            "example": {
              "en": {
                "privateTrainingLabel": "Personal coaching"
              }
            }
          }
        }
      },
      "PostFaq": {
        "type": "object",
        "description": "One question of a post's FAQ. Plain text; blank lines separate the answer's paragraphs.",
        "required": [
          "question",
          "answer"
        ],
        "properties": {
          "question": {
            "type": "string",
            "maxLength": 300
          },
          "answer": {
            "type": "string",
            "maxLength": 3000
          }
        }
      },
      "PlatformContent": {
        "type": "object",
        "description": "A content item (FAQ, post, document, block, or how-to guide) for the organization.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "organizationId": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "faq",
              "post",
              "document",
              "block",
              "how-to-guide"
            ]
          },
          "status": {
            "type": "string"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Public",
              "Member_only",
              "Private"
            ]
          },
          "audience": {
            "allOf": [
              {
                "$ref": "#/components/schemas/PlatformContactAudience"
              }
            ],
            "nullable": true,
            "description": "Who may read it on the portal and website. Anyone outside it, signed-out visitors included, never sees it. Shared by every translation of the slug. Null is everyone its visibility allows."
          },
          "content": {
            "type": "object",
            "description": "Body of the content item. May contain HTML, EditorJS blocks, a summary, and keywords.",
            "properties": {
              "html": {
                "type": "string",
                "nullable": true
              },
              "blocks": {
                "type": "object",
                "nullable": true,
                "additionalProperties": true,
                "description": "EditorJS document."
              },
              "summary": {
                "type": "string",
                "nullable": true
              },
              "keywords": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "excerpt": {
            "type": "string",
            "nullable": true
          },
          "metaTitle": {
            "type": "string",
            "nullable": true
          },
          "metaDescription": {
            "type": "string",
            "nullable": true
          },
          "metaKeywords": {
            "type": "string",
            "nullable": true
          },
          "canonicalUrl": {
            "type": "string",
            "nullable": true
          },
          "template": {
            "type": "string",
            "nullable": true
          },
          "layout": {
            "type": "string",
            "nullable": true
          },
          "customFields": {
            "type": "object",
            "nullable": true,
            "additionalProperties": true
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "summary": {
            "type": "string",
            "nullable": true
          },
          "keywords": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "images": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "featured": {
            "type": "boolean",
            "nullable": true
          },
          "faqs": {
            "type": "array",
            "description": "A post's questions and answers, shown after its text. Empty for other types.",
            "items": {
              "$ref": "#/components/schemas/PostFaq"
            }
          },
          "authorId": {
            "type": "integer",
            "nullable": true
          },
          "author": {
            "type": "object",
            "nullable": true,
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              },
              "email": {
                "type": "string"
              },
              "profileImage": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "language": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformMedia": {
        "type": "object",
        "description": "An item in the organization's media library. Files are hosted externally (Cloudinary for anything uploaded through the admin editor); this record is the library entry that website sections and content reference by `url`.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "url": {
            "type": "string",
            "description": "Public URL of the file. Immutable - register a new item to replace a file."
          },
          "name": {
            "type": "string",
            "description": "Display name. Searched, along with altText, when looking an image up by name."
          },
          "altText": {
            "type": "string",
            "nullable": true,
            "description": "Alternative text for screen readers. Also searched."
          },
          "caption": {
            "type": "string",
            "nullable": true
          },
          "mediaType": {
            "type": "string",
            "enum": [
              "image",
              "video"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformWebsiteSection": {
        "type": "object",
        "description": "One section of a page or of the site layout. `config` fields depend on `type` - see GET /v1/platform/website/section-types for the definitions.",
        "properties": {
          "type": {
            "type": "string",
            "description": "Section type, e.g. \"hero\", \"plans\", \"faq\", \"header\"."
          },
          "htmlId": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]*$",
            "description": "The section's anchor on the page (`#<htmlId>`), unique within the page. Send back the value a read returned to keep it; omit it and one is derived from the type."
          },
          "config": {
            "type": "object",
            "additionalProperties": true
          },
          "translations": {
            "type": "object",
            "additionalProperties": true,
            "description": "Per-locale overrides for the section's translatable string fields, keyed by locale then field: { \"bg\": { \"headline\": \"…\" } }. Config values themselves stay in the default language."
          }
        }
      },
      "PlatformWebsitePage": {
        "type": "object",
        "description": "A page on the website draft.",
        "properties": {
          "slug": {
            "type": "string",
            "description": "URL path segment. The homepage is served at \"/\" regardless of its slug."
          },
          "title": {
            "type": "string"
          },
          "isHomepage": {
            "type": "boolean"
          },
          "sectionCount": {
            "type": "integer"
          },
          "sectionTypes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sections": {
            "type": "array",
            "description": "Present when fetching a single page; omitted from list responses.",
            "items": {
              "$ref": "#/components/schemas/PlatformWebsiteSection"
            }
          },
          "metaTitle": {
            "type": "string",
            "nullable": true
          },
          "metaDescription": {
            "type": "string",
            "nullable": true
          },
          "ogImage": {
            "type": "string",
            "nullable": true
          },
          "noindex": {
            "type": "boolean",
            "description": "True when the page asks search engines not to index it and is left out of `sitemap.xml`."
          },
          "translations": {
            "type": "object",
            "nullable": true,
            "description": "Per-locale `metaTitle`/`metaDescription` overrides, keyed by locale: { \"bg\": { \"metaTitle\": \"…\" } }. Present when fetching a single page.",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "metaTitle": {
                  "type": "string"
                },
                "metaDescription": {
                  "type": "string"
                }
              }
            }
          },
          "seo": {
            "$ref": "#/components/schemas/PlatformWebsitePageSeo"
          },
          "url": {
            "type": "string",
            "description": "The page's public URL once published."
          }
        }
      },
      "PlatformWebsitePageSeo": {
        "type": "object",
        "description": "What the published page will actually put in its `<head>`, after every fallback has been applied - the authored fields alone do not answer \"is my SEO right?\". Present when fetching a single page. Read-only.",
        "properties": {
          "metaTitle": {
            "type": "string",
            "description": "The `<title>`, after falling back to the page title."
          },
          "metaDescription": {
            "type": "string",
            "nullable": true,
            "description": "After falling back to `seoSettings.siteDescription`."
          },
          "ogImage": {
            "type": "string",
            "nullable": true,
            "description": "After falling back to `seoSettings.defaultOgImage`."
          },
          "canonicalUrl": {
            "type": "string",
            "description": "The `rel=canonical` the default-locale render emits, locale prefix included."
          },
          "indexable": {
            "type": "boolean",
            "description": "Whether search engines are asked to index this page."
          },
          "notIndexableReason": {
            "type": "string",
            "nullable": true,
            "enum": [
              "page_noindex",
              "site_unpublished",
              "site_inactive"
            ],
            "description": "Why `indexable` is false. An unpublished or switched-off site is not indexable however the page is configured."
          },
          "localizedLocales": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Locales carrying their own metaTitle/metaDescription overrides."
          }
        }
      },
      "PlatformWebsite": {
        "type": "object",
        "description": "A website belonging to the organization. Page content, layout and theme tokens describe the **draft**. `url`, `published`, `activeReleaseVersion` and `lastPublishedAt` describe what the public is currently being served. `name` and `clubId` are live row fields — they take effect without a publish.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string",
            "description": "Platform host label - the site answers on `<slug>.1club.me`."
          },
          "domain": {
            "type": "string",
            "nullable": true,
            "description": "Custom domain, when one is pointed at this site."
          },
          "isDefault": {
            "type": "boolean",
            "description": "True for the site an organization-wide caller means by \"the website\". Exactly one per organization."
          },
          "isActive": {
            "type": "boolean",
            "description": "False means the site is switched off and serves nothing publicly, whatever the draft contains."
          },
          "clubId": {
            "type": "integer",
            "nullable": true,
            "description": "Club this website represents. When set, the header and footer use that club's logo instead of the organization's. Live, like `name`."
          },
          "url": {
            "type": "string",
            "description": "Public URL - the custom domain when set, else the platform host."
          },
          "previewUrl": {
            "type": "string",
            "description": "The same site rendered from the unpublished draft - the link to review edits before publishing. Carries a signed grant that expires 24 hours after this response was generated; read the website again for a fresh one. Anyone holding the link can view the draft, so it is shareable without a login but should be treated as sensitive."
          },
          "published": {
            "type": "boolean",
            "description": "Whether the site has ever been published. False means nothing is publicly reachable yet."
          },
          "activeReleaseVersion": {
            "type": "integer",
            "nullable": true
          },
          "lastPublishedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "themeSupport": {
            "type": "string",
            "enum": [
              "both",
              "light",
              "dark"
            ],
            "nullable": true
          },
          "defaultTheme": {
            "type": "string",
            "enum": [
              "light",
              "dark",
              "system"
            ],
            "nullable": true
          },
          "supportedLocales": {
            "type": "array",
            "nullable": true,
            "items": {
              "type": "string"
            },
            "description": "Locales the site serves, which is what its `hreflang` alternates and `sitemap.xml` advertise. Organization-level - see `PATCH /v1/platform/website`."
          },
          "defaultLocale": {
            "type": "string",
            "nullable": true,
            "description": "Locale served at the site root. Organization-level."
          },
          "seoSettings": {
            "type": "object",
            "description": "Site-wide SEO defaults. Each field is a fallback a page can override.",
            "additionalProperties": false,
            "properties": {
              "siteDescription": {
                "type": "string",
                "description": "Meta-description fallback, and the `description` in the site's structured data."
              },
              "defaultOgImage": {
                "type": "string",
                "description": "Social-share image for pages with no `ogImage` of their own."
              },
              "verification": {
                "type": "object",
                "description": "Search-console ownership tokens, rendered as meta tags on every page.",
                "properties": {
                  "google": {
                    "type": "string"
                  },
                  "bing": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "pages": {
            "type": "array",
            "description": "Present when fetching one website; omitted from the site list.",
            "items": {
              "$ref": "#/components/schemas/PlatformWebsitePage"
            }
          },
          "layout": {
            "type": "object",
            "description": "Header and footer, rendered on every page.",
            "properties": {
              "header": {
                "$ref": "#/components/schemas/PlatformWebsiteSection"
              },
              "footer": {
                "$ref": "#/components/schemas/PlatformWebsiteSection"
              }
            }
          },
          "hasCustomCss": {
            "type": "boolean"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformWebsiteRelease": {
        "type": "object",
        "description": "A published version of the website. The public site renders the release with `isActive: true`.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "version": {
            "type": "integer"
          },
          "note": {
            "type": "string",
            "nullable": true
          },
          "isActive": {
            "type": "boolean"
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When this release last went live. An ordinary publish amends the active release in place, so this moves while `createdAt` does not."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "description": "A stable, machine-readable reason, when the error has one (e.g. `CONTACT_EXISTS`)."
          },
          "details": {
            "type": "object",
            "additionalProperties": true,
            "description": "Structured values behind the error. A 409 naming an existing record carries its id here, e.g. `contactId`."
          }
        }
      },
      "WebsiteSectionFieldCondition": {
        "type": "object",
        "description": "When a field is relevant, as a comparison against a SIBLING field of the same section. Deliberately data rather than an expression, and deliberately unable to reach platform data or anything resolved at render time, so the server, the editor and a model all answer it the same way. Exactly one form per object.",
        "properties": {
          "field": {
            "type": "string",
            "description": "The sibling field this condition reads. Always resolves before the field carrying the condition."
          },
          "equals": {
            "description": "Relevant when the sibling equals this value."
          },
          "oneOf": {
            "type": "array",
            "items": {},
            "description": "Relevant when the sibling is one of these values."
          },
          "isEmpty": {
            "type": "boolean",
            "description": "Relevant when the sibling is (true) or is not (false) unset, blank or an empty array."
          },
          "minItems": {
            "type": "integer",
            "description": "Relevant when the sibling is a list holding at least this many items."
          },
          "allOf": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebsiteSectionFieldCondition"
            }
          },
          "anyOf": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebsiteSectionFieldCondition"
            }
          }
        }
      },
      "WebsiteSectionField": {
        "type": "object",
        "description": "One config field of a website section. This is the ONLY description of the field: its control, its value space, where it belongs in an editor, whether it translates, and when it applies. Nothing about a field is documented elsewhere.",
        "properties": {
          "key": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "string",
              "text",
              "number",
              "select",
              "string_list",
              "boolean",
              "range",
              "url",
              "color",
              "image",
              "image_list",
              "date",
              "entity",
              "entity_list",
              "object_list",
              "header",
              "paragraph"
            ],
            "description": "`header` and `paragraph` store nothing — they structure and explain an editing panel."
          },
          "options": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Allowed values for `select`."
          },
          "defaultValue": {
            "description": "What a new section starts with. See the catalog's `defaults` for the resolved config."
          },
          "group": {
            "type": "string",
            "enum": [
              "content",
              "data",
              "layout",
              "style",
              "advanced"
            ],
            "description": "Where the admin editor places the field. Advisory and editor-driven: a field may move between groups as the editor changes, so do not key behaviour on it."
          },
          "prominence": {
            "type": "string",
            "enum": [
              "card",
              "panel",
              "site"
            ]
          },
          "order": {
            "type": "integer",
            "description": "Ascending display order. A conditional field always sorts after the field its condition names."
          },
          "primary": {
            "type": "boolean",
            "description": "The section’s defining choice - the one that reshapes the whole section, such as a hero’s `variant`. At most one per section type."
          },
          "width": {
            "type": "string",
            "enum": [
              "full",
              "half"
            ]
          },
          "translatable": {
            "type": "boolean",
            "description": "Whether this value carries per-locale overrides in the section’s `translations` map."
          },
          "entityType": {
            "type": "string",
            "enum": [
              "club",
              "block",
              "document",
              "classType",
              "planCategory",
              "areaType",
              "instructorType",
              "instructor",
              "event",
              "class",
              "post",
              "signupForm",
              "contactCustomField",
              "contact",
              "program",
              "review"
            ],
            "description": "For `entity` / `entity_list`: which platform record the value references."
          },
          "contactFilterType": {
            "type": "string",
            "enum": [
              "contact",
              "member",
              "staff",
              "lead",
              "lapsed",
              "drop_in"
            ]
          },
          "itemFields": {
            "type": "array",
            "description": "For `object_list`: the shape of one item. Recursive, so a nav item’s dropdown children and a footer link group are declared rather than described in prose.",
            "items": {
              "$ref": "#/components/schemas/WebsiteSectionField"
            }
          },
          "maxItems": {
            "type": "integer"
          },
          "min": {
            "type": "number"
          },
          "max": {
            "type": "number"
          },
          "step": {
            "type": "number"
          },
          "unit": {
            "type": "string",
            "description": "For `range`: the suffix shown beside the value (e.g. \"%\")."
          },
          "visibleIf": {
            "$ref": "#/components/schemas/WebsiteSectionFieldCondition"
          },
          "deprecated": {
            "type": "boolean",
            "description": "Superseded: an existing section keeps its value and it still renders, but do not set it on a new section. The type’s `notes` name the replacement."
          }
        }
      },
      "PlatformIdentity": {
        "type": "object",
        "description": "Describes the authorized organization, the scopes granted to the bearer credential, and the catalog of available platform resources.",
        "properties": {
          "organization": {
            "type": "object",
            "nullable": true,
            "description": "The organization this request acts in. Null only for an MCP connection reaching several organizations, called without the `X-1Club-Organization-Id` header.",
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "currency": {
                "type": "string",
                "description": "ISO 4217 code the organization trades in (e.g. \"EUR\"). Every monetary amount on this API - booking `payment.amount`, plan and product prices, transaction totals - is expressed in it, and no other endpoint repeats it. Read it once when you connect."
              },
              "language": {
                "type": "string",
                "enum": [
                  "en",
                  "bg",
                  "cs",
                  "de",
                  "es",
                  "fr"
                ],
                "description": "The organization's default language: the one it writes to its members in. Write anything members will read (a message, a subject) in it, whatever language the caller works in."
              }
            }
          },
          "organizations": {
            "type": "array",
            "description": "Every organization the credential may act in: an API key's own, or every organization an MCP connection's user is staff of. A connection reaching several names the one each request acts in with the `X-1Club-Organization-Id` header.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "name": {
                  "type": "string"
                },
                "access": {
                  "type": "string",
                  "enum": [
                    "staff"
                  ],
                  "description": "Only in a `search` by 1club staff: an organization they are not a member of, which they may act in as staff."
                },
                "unavailable": {
                  "type": "string",
                  "enum": [
                    "ORGANIZATION_NOT_ACTIVE",
                    "PLAN_FEATURE_LOCKED"
                  ],
                  "description": "Set only when `organization` is null: a call naming this organization would be refused, for this reason."
                }
              }
            }
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Scopes granted to the bearer credential - an API key or an MCP OAuth grant - exactly as held (e.g. \"classes:read\"). A full-access key holds the single wildcard scope \"*\"; read `effectiveScopes` to see what that resolves to. An MCP grant never holds \"*\": the wildcard is expanded at consent so each capability can be shown and approved."
          },
          "fullAccess": {
            "type": "boolean",
            "description": "True when the credential holds the wildcard scope \"*\", granting every scope including ones added after it was issued."
          },
          "effectiveScopes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The scopes this credential can actually use - identical to `scopes` for a narrow grant, and the full expansion of \"*\" for a full-access key. Check a capability against this list, not `scopes`."
          },
          "resources": {
            "type": "array",
            "description": "Catalog of resources and the actions each supports.",
            "items": {
              "type": "object",
              "properties": {
                "resource": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "actions": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      },
      "PlatformTransaction": {
        "type": "object",
        "description": "A billing transaction with amounts, payment status, and links to the originating booking or membership.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "uuid": {
            "type": "string",
            "format": "uuid",
            "description": "Stable unguessable identifier. Prefer this over `id` when storing a reference."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "What the transaction is for, in English, built from what it links to: the part of the booking it pays for and the visit, the plan and the period it pays for, the product or the check-in; a reversal reads `Reversal: ...` with the share it gives back. For a settlement, or anything else linked to none of those, it is the text it was created with. Read it as a label, not as an identifier: it follows the records' current names."
          },
          "transactionType": {
            "type": "string",
            "nullable": true,
            "description": "TransactionType enum value (e.g. booking_creation, membership_creation, product_sale, membership_recurrence, etc.). A settlement recorded with `POST /v1/platform/transactions` is `settlement`."
          },
          "bookingId": {
            "type": "integer",
            "nullable": true
          },
          "membershipId": {
            "type": "integer",
            "nullable": true
          },
          "contactId": {
            "type": "integer",
            "nullable": true,
            "description": "The customer charged, when there is one."
          },
          "clubId": {
            "type": "integer",
            "nullable": true,
            "description": "Set on a settlement only; other transactions take their club from their booking or membership."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "date": {
            "type": "string",
            "format": "date-time",
            "description": "The day the charge counts on in every money report: when it was sold, a booking's visit, or the start of the membership period it pays for."
          },
          "dueDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "The day an unpaid charge falls due (midnight UTC naming the calendar day), set only where that is later than `date`: a Season Pass sold ahead is dated at its sale and owed from the day it starts. Null means it is due on `date`."
          },
          "paymentStatus": {
            "type": "string",
            "enum": [
              "pending",
              "paid",
              "void",
              "failed",
              "settled",
              "overdue",
              "partially_paid",
              "refunded",
              "cancelled"
            ]
          },
          "amount": {
            "type": "string",
            "description": "Pre-tax amount as a decimal string (e.g. \"25.00\"). Serialized as a string to preserve precision."
          },
          "taxAmount": {
            "type": "string",
            "description": "Tax portion as a decimal string."
          },
          "totalAmount": {
            "type": "string",
            "description": "Total billed amount as a decimal string (amount + taxAmount)."
          }
        }
      },
      "PlatformBooking": {
        "type": "object",
        "description": "A booking created through the platform API. Recorded with a booking transaction so it counts for revenue, marked paid (settled against a payment method named after the caller's API key, so the club can reconcile what each partner collected) or unpaid (outstanding) per the caller. Collection stays with the caller; what it collected and what it gave back on cancellation are reported in `payment`.",
        "properties": {
          "bookingId": {
            "type": "integer",
            "description": "1club booking id"
          },
          "bookingUuid": {
            "type": "string",
            "format": "uuid",
            "description": "Stable unguessable identifier. Prefer this over `bookingId` when storing a reference."
          },
          "status": {
            "type": "string",
            "description": "Booking status (e.g. confirmed, cancelled)"
          },
          "areaId": {
            "type": "integer",
            "nullable": true,
            "description": "Area id"
          },
          "classId": {
            "type": "integer",
            "nullable": true,
            "description": "The class occurrence this booking attends, when it is a class booking. Every attendee holds their own booking row against the same `classId`, and `classes` rows are per-occurrence - so this is what tells two classes running in the same hour apart. Join it against GET /v1/platform/classes, or read the staff roster with GET /v1/platform/classes/{id}/bookings."
          },
          "eventId": {
            "type": "integer",
            "nullable": true,
            "description": "The event this booking attends, when it is an event booking. Read the attendee list with GET /v1/platform/events/{id}/bookings."
          },
          "eventTicketId": {
            "type": "integer",
            "nullable": true,
            "description": "The event ticket the seat was sold on, when the event sells tickets"
          },
          "orderId": {
            "type": "integer",
            "nullable": true,
            "description": "The order the booking was sold on: one per sale, holding the customer's seat and any guests'. Every class enrolment and event registration made through this API has one; null for a booking sold on none (a court or coach booked through POST /v1/platform/bookings)."
          },
          "seatBookingIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Every seat the sale holds, the customer's own first. Only on the answer to a seat sale (POST /v1/platform/classes/{id}/bookings, POST /v1/platform/events/{id}/bookings); the guests' seats carry no contact, and the class's or the event's roster lists them all."
          },
          "maxPlayers": {
            "type": "integer",
            "nullable": true,
            "description": "How many players the booking takes, the organizer included, when it differs from the area type's `defaultMaxPlayers`: `2` on a court booked for singles (area types with `allowsSingles`). `null` means the area type's own limit. Adding a player past it is refused."
          },
          "instructorId": {
            "type": "integer",
            "nullable": true,
            "description": "Instructor leading the session, when one is attached"
          },
          "contactId": {
            "type": "integer",
            "nullable": true,
            "description": "Contact the booking is for"
          },
          "startTime": {
            "type": "string",
            "format": "date-time"
          },
          "endTime": {
            "type": "string",
            "format": "date-time"
          },
          "customer": {
            "allOf": [
              {
                "$ref": "#/components/schemas/PlatformContact"
              }
            ],
            "nullable": true,
            "description": "The booking's customer, identical to what GET /v1/platform/contacts/{id} returns. Present only when the request passes `include=customer`, which additionally requires the `contacts:read` scope; `null` when the booking has no contact. Use it to import a window of bookings without a contact lookup per row."
          },
          "money": {
            "type": "object",
            "description": "What the booking costs and how it was paid. Present only with `include=money`, which additionally requires the `transactions:read` scope. `billed` is always `paid + outstanding`, on the same basis as the admin's Booking audit: tax-inclusive, net of refunds, so a cancelled booking bills only the Cancellation Charge it kept.",
            "properties": {
              "billed": {
                "type": "number"
              },
              "billedExTax": {
                "type": "number"
              },
              "paid": {
                "type": "number",
                "description": "Money the club kept: collected, net of refunds."
              },
              "outstanding": {
                "type": "number",
                "description": "Still owed on the booking. A closed charge owes nothing."
              },
              "paymentState": {
                "type": "string",
                "description": "paid, partial, unpaid, refunded, covered or free."
              },
              "paymentStatus": {
                "type": "string",
                "nullable": true,
                "description": "The charges' own payment statuses, `/`-joined."
              },
              "charges": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "transactionId": {
                      "type": "integer"
                    },
                    "transactionType": {
                      "type": "string",
                      "nullable": true
                    },
                    "payerContactId": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Who the charge is on: the organizer, or a player paying their own share."
                    },
                    "date": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "paymentStatus": {
                      "type": "string"
                    },
                    "amount": {
                      "type": "number",
                      "description": "What the charge bills, after any cancellation credit against it."
                    },
                    "paidAmount": {
                      "type": "number"
                    },
                    "refundedAmount": {
                      "type": "number",
                      "description": "Returned from its payments by a refund."
                    },
                    "outstandingAmount": {
                      "type": "number"
                    },
                    "invoiceIds": {
                      "type": "array",
                      "items": {
                        "type": "integer"
                      }
                    },
                    "orderId": {
                      "type": "integer",
                      "nullable": true
                    }
                  }
                }
              },
              "credits": {
                "type": "array",
                "description": "Cancellation credits: what a cancellation took off a charge.",
                "items": {
                  "type": "object",
                  "properties": {
                    "transactionId": {
                      "type": "integer"
                    },
                    "chargeTransactionId": {
                      "type": "integer",
                      "nullable": true
                    },
                    "amount": {
                      "type": "number"
                    },
                    "paymentStatus": {
                      "type": "string"
                    },
                    "date": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              },
              "payments": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "paymentId": {
                      "type": "integer"
                    },
                    "amount": {
                      "type": "number"
                    },
                    "status": {
                      "type": "string"
                    },
                    "method": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string",
                      "nullable": true
                    },
                    "reference": {
                      "type": "string",
                      "nullable": true
                    },
                    "paidAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "transactionIds": {
                      "type": "array",
                      "items": {
                        "type": "integer"
                      }
                    }
                  }
                }
              },
              "refunds": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "refundId": {
                      "type": "integer"
                    },
                    "transactionId": {
                      "type": "integer",
                      "nullable": true
                    },
                    "paymentId": {
                      "type": "integer"
                    },
                    "amount": {
                      "type": "number"
                    },
                    "destination": {
                      "type": "string",
                      "enum": [
                        "stripe",
                        "wallet",
                        "cash",
                        "manual"
                      ]
                    },
                    "reason": {
                      "type": "string",
                      "nullable": true
                    },
                    "refundedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "cancellation": {
            "type": "object",
            "description": "The cancellation terms stamped on the booking and how it was cancelled. Present only with `include=cancellation`.",
            "properties": {
              "terms": {
                "type": "object",
                "nullable": true,
                "description": "The terms the customer accepted with the booking - not the club's policy today, which may since have changed. `null` for an event ticket, whose event keeps its own terms, and for a booking accepted before terms were stamped.",
                "properties": {
                  "acceptedAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "rules": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "hoursInAdvance": {
                          "type": "number"
                        },
                        "refundPercentage": {
                          "type": "number"
                        },
                        "description": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "deadlines": {
                    "type": "array",
                    "description": "Every band that refunds something, as the moment to cancel by, widest notice first.",
                    "items": {
                      "type": "object",
                      "properties": {
                        "until": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "refundPercentage": {
                          "type": "number"
                        }
                      }
                    }
                  },
                  "freeCancellationUntil": {
                    "type": "string",
                    "format": "date-time",
                    "nullable": true,
                    "description": "The last moment a cancellation refunds in full; `null` when no band does."
                  },
                  "cancellationCutoffAt": {
                    "type": "string",
                    "format": "date-time",
                    "nullable": true,
                    "description": "From this moment the customer can no longer cancel the booking themselves; only staff can. `null` when the terms set no cutoff."
                  },
                  "fullyCovered": {
                    "type": "boolean",
                    "description": "A membership or pass covered the whole booking."
                  },
                  "collectsFromWallet": {
                    "type": "boolean",
                    "description": "The Cancellation Charge is taken from the Wallet."
                  },
                  "waiver": {
                    "type": "object",
                    "nullable": true,
                    "properties": {
                      "at": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "byUserId": {
                        "type": "integer",
                        "nullable": true
                      },
                      "reason": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "cancelled": {
                "type": "object",
                "nullable": true,
                "description": "`null` while the booking is not cancelled.",
                "properties": {
                  "at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "by": {
                    "type": "object",
                    "nullable": true,
                    "properties": {
                      "userId": {
                        "type": "integer"
                      },
                      "name": {
                        "type": "string"
                      }
                    }
                  },
                  "reason": {
                    "type": "string",
                    "nullable": true
                  },
                  "noticeHours": {
                    "type": "number",
                    "description": "Hours between the cancellation and the start; negative when it came after the start."
                  },
                  "refundPercentage": {
                    "type": "number",
                    "nullable": true
                  },
                  "refundAmount": {
                    "type": "number",
                    "nullable": true
                  },
                  "policyWaived": {
                    "type": "boolean"
                  },
                  "notes": {
                    "type": "string",
                    "nullable": true
                  }
                }
              }
            }
          },
          "payment": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "paid",
                  "unpaid",
                  "no_charge"
                ],
                "description": "`no_charge` means there is nothing to collect: either nothing was ever owed (a free area, an amount of 0) or an entitlement covers it - a membership or external program the attendee already holds, which is why a covered booking can carry a price and still owe nothing. `paid` counts every financially closed transaction status (`paid`, `settled`, `refunded`), and every charge type, not only the one this API records."
              },
              "amount": {
                "type": "number",
                "nullable": true,
                "description": "The booking's recorded price in the organization's currency; `status` is what says whether anything was collectable. Where the price is 0 but a real charge exists - an external program's per-visit fee lives entirely in its transaction - the ledger total is reported instead."
              },
              "paidAmount": {
                "type": "number",
                "description": "What has been collected on the booking, gross, before any refund. `0` when nothing has."
              },
              "refundedAmount": {
                "type": "number",
                "description": "What has been returned to the customer, across every refund recorded. `paidAmount - refundedAmount` is what the club kept."
              },
              "reference": {
                "type": "string",
                "nullable": true,
                "description": "The collecting partner's own id for the payment, when one reported it through this API (`payment.reference`); null for money 1club collected itself."
              },
              "fee": {
                "type": "number",
                "nullable": true,
                "description": "What the collecting partner kept out of the amount, when it reported one (`payment.fee`)."
              }
            }
          }
        }
      },
      "PlatformBookingUpdate": {
        "type": "object",
        "description": "An edit to a booking. Every field is optional; send only what changes. A body with nothing but `notifyCustomer` is refused.",
        "properties": {
          "startTime": {
            "type": "string",
            "format": "date-time",
            "description": "New start. With `scope=all_future`, every later occurrence takes this time of day on its own date; change the weekday with `recurrence.daysOfWeek`."
          },
          "endTime": {
            "type": "string",
            "format": "date-time",
            "description": "New end. Must be after the start, stored or sent."
          },
          "areaId": {
            "type": "integer",
            "description": "Move the booking to this area (from GET /v1/platform/areas). Must be an area this API can sell, as on create."
          },
          "instructorId": {
            "type": "integer",
            "nullable": true,
            "description": "Attach this instructor to the session (from GET /v1/platform/instructors), or `null` to take the instructor off it. Must be free at the time."
          },
          "contactId": {
            "type": "integer",
            "description": "Reassign the booking to this contact (from GET /v1/platform/contacts). The outstanding charge, if any, moves with it."
          },
          "notes": {
            "type": "string",
            "maxLength": 2000
          },
          "amount": {
            "type": "number",
            "maximum": 1000000,
            "description": "The booking's new price, before tax, in the club's currency - your own figure, kept as sent. Omit it to keep the price you recorded on a booking this API created, or to have a booking taken through 1club re-quoted by the club's pricing engine when the slot, area, instructor or contact changes. Cannot be set on a booking a membership covers."
          },
          "recurrence": {
            "type": "object",
            "description": "Make a one-off booking recur, or (with `scope=all_future`) rewrite the cadence or end condition of an existing series. The series starts at the booking's own start time, so there is no start date here. `daysOfWeek` is required for a weekly pattern, and a day repeated in it counts once. Not accepted on a booking an API key created.",
            "required": [
              "frequency",
              "interval"
            ],
            "properties": {
              "frequency": {
                "type": "string",
                "enum": [
                  "daily",
                  "weekly",
                  "monthly"
                ]
              },
              "interval": {
                "type": "integer",
                "minimum": 1,
                "description": "Every N days / weeks / months"
              },
              "daysOfWeek": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "sunday",
                    "monday",
                    "tuesday",
                    "wednesday",
                    "thursday",
                    "friday",
                    "saturday"
                  ]
                },
                "description": "For a weekly pattern, the days it runs on"
              },
              "endDate": {
                "type": "string",
                "format": "date-time",
                "description": "Last date of the series, with `ends.type: until`"
              },
              "ends": {
                "type": "object",
                "required": [
                  "type"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "until",
                      "after",
                      "never"
                    ],
                    "description": "`until` runs to `endDate`, `after` runs for `occurrences` sessions, `never` extends on a rolling window"
                  },
                  "occurrences": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 520,
                    "description": "With `after`: how many sessions the series holds, counted from its start"
                  }
                }
              }
            }
          },
          "notifyCustomer": {
            "type": "boolean",
            "description": "Tell the customer their booking changed - email with the updated calendar invite plus the in-app and WhatsApp notification. Only sent when the edit names a time, area, instructor or class. Off by default for an API key, on by default over an OAuth connection, as on create."
          }
        }
      },
      "PlatformBookingListItem": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PlatformBooking"
          },
          {
            "type": "object",
            "properties": {
              "clubId": {
                "type": "integer",
                "nullable": true
              },
              "source": {
                "type": "string",
                "nullable": true,
                "description": "Channel that created the booking (api, admin, portal, app, kiosk, network, website, integration)."
              },
              "notes": {
                "type": "string",
                "nullable": true
              },
              "createdAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        ]
      },
      "PlatformBookingPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformBookingListItem"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total bookings matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformReportChange": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "number"
          },
          "percent": {
            "type": "number",
            "nullable": true,
            "description": "Null when the comparison period had none."
          }
        }
      },
      "PlatformRevenueFigures": {
        "type": "object",
        "properties": {
          "revenue": {
            "type": "number",
            "description": "Recognised ex-tax, net of refunds and Wallet-funded parts."
          },
          "collected": {
            "type": "number",
            "description": "The part of it already paid, on the same basis."
          },
          "uncollected": {
            "type": "number"
          },
          "collectionRate": {
            "type": "number",
            "nullable": true,
            "description": "`collected / revenue`, 0-1."
          },
          "sales": {
            "type": "integer"
          },
          "averageSale": {
            "type": "number",
            "nullable": true
          }
        }
      },
      "PlatformRevenueBreakdown": {
        "type": "object",
        "properties": {
          "revenue": {
            "type": "number"
          },
          "collected": {
            "type": "number"
          },
          "sales": {
            "type": "integer"
          },
          "share": {
            "type": "number",
            "description": "Share of the period's revenue, 0-1."
          },
          "previousRevenue": {
            "type": "number",
            "description": "In the comparison period; absent without one."
          },
          "change": {
            "$ref": "#/components/schemas/PlatformReportChange"
          }
        }
      },
      "PlatformRevenueReport": {
        "type": "object",
        "properties": {
          "period": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "format": "date"
              },
              "to": {
                "type": "string",
                "format": "date"
              },
              "days": {
                "type": "integer"
              }
            }
          },
          "chart": {
            "$ref": "#/components/schemas/PlatformReportChart"
          },
          "moreCharts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformReportChart"
            },
            "description": "With `charts=all`: every other picture the answer can draw, after `chart`."
          },
          "timezone": {
            "type": "string",
            "description": "The clock the days are read on."
          },
          "currency": {
            "type": "string"
          },
          "totals": {
            "$ref": "#/components/schemas/PlatformRevenueFigures"
          },
          "comparison": {
            "type": "object",
            "nullable": true,
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "previous_period",
                  "previous_year"
                ]
              },
              "period": {
                "type": "object",
                "description": "The compared days, as `from` / `to` say them too.",
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date"
                  },
                  "to": {
                    "type": "string",
                    "format": "date"
                  }
                }
              },
              "from": {
                "type": "string",
                "format": "date",
                "description": "First compared day."
              },
              "to": {
                "type": "string",
                "format": "date",
                "description": "Last compared day."
              },
              "basis": {
                "type": "object",
                "description": "The days of the report's own period the comparison is set against: all of them, or those up to the organization's today for a period still running.",
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date"
                  },
                  "to": {
                    "type": "string",
                    "format": "date"
                  }
                }
              },
              "totals": {
                "$ref": "#/components/schemas/PlatformRevenueFigures"
              },
              "change": {
                "type": "object",
                "properties": {
                  "revenue": {
                    "$ref": "#/components/schemas/PlatformReportChange"
                  },
                  "collected": {
                    "$ref": "#/components/schemas/PlatformReportChange"
                  },
                  "sales": {
                    "$ref": "#/components/schemas/PlatformReportChange"
                  }
                }
              }
            }
          },
          "byStream": {
            "type": "array",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/PlatformRevenueBreakdown"
                },
                {
                  "type": "object",
                  "properties": {
                    "stream": {
                      "type": "string",
                      "enum": [
                        "bookings",
                        "memberships",
                        "passes",
                        "drop_ins",
                        "products",
                        "external_programs",
                        "settlements",
                        "other"
                      ]
                    }
                  }
                }
              ]
            }
          },
          "byClub": {
            "type": "array",
            "description": "Absent when the report is narrowed to one club.",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/PlatformRevenueBreakdown"
                },
                {
                  "type": "object",
                  "properties": {
                    "clubId": {
                      "type": "integer",
                      "nullable": true
                    },
                    "clubName": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              ]
            }
          },
          "byAccount": {
            "type": "array",
            "description": "Which revenue account the money was filed to; a sale stored with no account counts as the default account. Absent when the report is narrowed to one account.",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/PlatformRevenueBreakdown"
                },
                {
                  "type": "object",
                  "properties": {
                    "revenueAccountId": {
                      "type": "integer",
                      "nullable": true
                    },
                    "accountName": {
                      "type": "string",
                      "nullable": true
                    },
                    "accountCode": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              ]
            }
          },
          "byPaymentMethod": {
            "type": "array",
            "description": "What collected the money. A sale paid by several methods counts under the one that paid most; 'Unattributed' is collected with no real-money payment behind it.",
            "items": {
              "type": "object",
              "properties": {
                "method": {
                  "type": "string"
                },
                "channel": {
                  "type": "string",
                  "nullable": true
                },
                "collected": {
                  "type": "number"
                },
                "share": {
                  "type": "number"
                }
              }
            }
          },
          "topItems": {
            "type": "array",
            "description": "What sold most: a class or court, a plan, a product.",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/PlatformRevenueBreakdown"
                },
                {
                  "type": "object",
                  "properties": {
                    "stream": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    }
                  }
                }
              ]
            }
          },
          "trend": {
            "type": "object",
            "properties": {
              "granularity": {
                "type": "string",
                "enum": [
                  "day",
                  "week",
                  "month"
                ]
              },
              "weekStartsOn": {
                "type": "integer",
                "minimum": 0,
                "maximum": 6,
                "description": "The weekday a weekly bucket starts on (0 = Sunday), from the organization's country; Monday without one."
              },
              "points": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "start": {
                      "type": "string",
                      "format": "date"
                    },
                    "revenue": {
                      "type": "number"
                    },
                    "collected": {
                      "type": "number"
                    },
                    "sales": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "movers": {
            "type": "array",
            "description": "The streams, clubs and items whose revenue moved most against the comparison period, largest move first. Empty without a comparison.",
            "items": {
              "type": "object",
              "properties": {
                "dimension": {
                  "type": "string",
                  "enum": [
                    "stream",
                    "club",
                    "item"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "revenue": {
                  "type": "number"
                },
                "previousRevenue": {
                  "type": "number"
                },
                "change": {
                  "$ref": "#/components/schemas/PlatformReportChange"
                }
              }
            }
          }
        }
      },
      "PlatformUtilization": {
        "type": "object",
        "description": "Percent of what there was to fill, one decimal: class seats taken, court and room hours booked, coach hours booked. Null when there was nothing to fill.",
        "properties": {
          "class": {
            "type": "number",
            "nullable": true
          },
          "area": {
            "type": "number",
            "nullable": true
          },
          "instructor": {
            "type": "number",
            "nullable": true
          }
        }
      },
      "PlatformActivityFigures": {
        "type": "object",
        "properties": {
          "bookings": {
            "type": "integer",
            "description": "Bookings starting in the period and not cancelled: class seats, courts and rooms, sessions with a coach."
          },
          "confirmedBookings": {
            "type": "integer"
          },
          "pendingBookings": {
            "type": "integer"
          },
          "cancelledBookings": {
            "type": "integer",
            "description": "Bookings starting in the period that were cancelled."
          },
          "checkins": {
            "type": "integer",
            "description": "Check-ins, on the day of the visit."
          },
          "visitors": {
            "type": "integer",
            "description": "Distinct contacts with a booking counted in `bookings` or a check-in."
          },
          "utilization": {
            "$ref": "#/components/schemas/PlatformUtilization"
          }
        }
      },
      "PlatformActivityReport": {
        "type": "object",
        "properties": {
          "period": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "format": "date"
              },
              "to": {
                "type": "string",
                "format": "date"
              },
              "days": {
                "type": "integer"
              }
            }
          },
          "chart": {
            "$ref": "#/components/schemas/PlatformReportChart"
          },
          "moreCharts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformReportChart"
            },
            "description": "With `charts=all`: every other picture the answer can draw, after `chart`."
          },
          "timezone": {
            "type": "string",
            "description": "The clock the days are read on: the organization's timezone, as on the admin analytics dashboards."
          },
          "totals": {
            "$ref": "#/components/schemas/PlatformActivityFigures"
          },
          "comparison": {
            "type": "object",
            "nullable": true,
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "previous_period",
                  "previous_year"
                ]
              },
              "period": {
                "type": "object",
                "description": "The compared days, as `from` / `to` say them too.",
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date"
                  },
                  "to": {
                    "type": "string",
                    "format": "date"
                  }
                }
              },
              "from": {
                "type": "string",
                "format": "date",
                "description": "First compared day."
              },
              "to": {
                "type": "string",
                "format": "date",
                "description": "Last compared day."
              },
              "basis": {
                "type": "object",
                "description": "The days of the report's own period the comparison is set against: all of them, or those up to the organization's today for a period still running.",
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date"
                  },
                  "to": {
                    "type": "string",
                    "format": "date"
                  }
                }
              },
              "totals": {
                "$ref": "#/components/schemas/PlatformActivityFigures"
              },
              "change": {
                "type": "object",
                "properties": {
                  "bookings": {
                    "$ref": "#/components/schemas/PlatformReportChange"
                  },
                  "cancelledBookings": {
                    "$ref": "#/components/schemas/PlatformReportChange"
                  },
                  "checkins": {
                    "$ref": "#/components/schemas/PlatformReportChange"
                  },
                  "visitors": {
                    "$ref": "#/components/schemas/PlatformReportChange"
                  }
                }
              }
            }
          },
          "trend": {
            "type": "object",
            "properties": {
              "granularity": {
                "type": "string",
                "enum": [
                  "day",
                  "week",
                  "month"
                ]
              },
              "weekStartsOn": {
                "type": "integer",
                "minimum": 0,
                "maximum": 6,
                "description": "The weekday a weekly bucket starts on (0 = Sunday), from the organization's country; Monday without one."
              },
              "points": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "start": {
                      "type": "string",
                      "format": "date"
                    },
                    "bookings": {
                      "type": "integer"
                    },
                    "checkins": {
                      "type": "integer"
                    },
                    "utilization": {
                      "$ref": "#/components/schemas/PlatformUtilization"
                    }
                  }
                }
              }
            }
          },
          "byWeekday": {
            "type": "array",
            "description": "The average day of each weekday in the period, Sunday first.",
            "items": {
              "type": "object",
              "properties": {
                "weekday": {
                  "type": "string",
                  "example": "Mon"
                },
                "averageBookings": {
                  "type": "number"
                },
                "averageCheckins": {
                  "type": "number"
                }
              }
            }
          }
        }
      },
      "PlatformMembershipFigures": {
        "type": "object",
        "properties": {
          "added": {
            "type": "integer",
            "description": "Created in the period, whatever became of them since, except a checkout still waiting for its first payment."
          },
          "cancelled": {
            "type": "integer",
            "description": "Cancelled in the period, immediately or at the end of the paid period. A cancellation undone since is not counted."
          },
          "activeAtStart": {
            "type": "integer"
          },
          "activeAtEnd": {
            "type": "integer",
            "description": "At the end of the period, or now when it has not ended yet."
          },
          "cancellationRate": {
            "type": "number",
            "nullable": true,
            "description": "Of those active at the start, the percent cancelled in the period. Null with none active."
          }
        }
      },
      "PlatformMembershipsReport": {
        "type": "object",
        "properties": {
          "period": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "format": "date"
              },
              "to": {
                "type": "string",
                "format": "date"
              },
              "days": {
                "type": "integer"
              }
            }
          },
          "chart": {
            "$ref": "#/components/schemas/PlatformReportChart"
          },
          "moreCharts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformReportChart"
            },
            "description": "With `charts=all`: every other picture the answer can draw, after `chart`."
          },
          "timezone": {
            "type": "string",
            "description": "The clock the days are read on: the organization's timezone, as on the admin analytics dashboards."
          },
          "totals": {
            "$ref": "#/components/schemas/PlatformMembershipFigures"
          },
          "byKind": {
            "type": "array",
            "description": "Memberships (recurring), Passes and Drop-Ins apart.",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/PlatformMembershipFigures"
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "membership",
                        "pass",
                        "drop_in"
                      ]
                    }
                  }
                }
              ]
            }
          },
          "byPlan": {
            "type": "array",
            "description": "The plans that moved most - added plus cancelled - largest first.",
            "items": {
              "type": "object",
              "properties": {
                "planId": {
                  "type": "integer"
                },
                "planName": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "membership",
                    "pass",
                    "drop_in"
                  ]
                },
                "added": {
                  "type": "integer"
                },
                "cancelled": {
                  "type": "integer"
                },
                "activeAtEnd": {
                  "type": "integer"
                }
              }
            }
          },
          "comparison": {
            "type": "object",
            "nullable": true,
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "previous_period",
                  "previous_year"
                ]
              },
              "period": {
                "type": "object",
                "description": "The compared days, as `from` / `to` say them too.",
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date"
                  },
                  "to": {
                    "type": "string",
                    "format": "date"
                  }
                }
              },
              "from": {
                "type": "string",
                "format": "date",
                "description": "First compared day."
              },
              "to": {
                "type": "string",
                "format": "date",
                "description": "Last compared day."
              },
              "basis": {
                "type": "object",
                "description": "The days of the report's own period the comparison is set against: all of them, or those up to the organization's today for a period still running.",
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date"
                  },
                  "to": {
                    "type": "string",
                    "format": "date"
                  }
                }
              },
              "totals": {
                "$ref": "#/components/schemas/PlatformMembershipFigures"
              },
              "change": {
                "type": "object",
                "properties": {
                  "added": {
                    "$ref": "#/components/schemas/PlatformReportChange"
                  },
                  "cancelled": {
                    "$ref": "#/components/schemas/PlatformReportChange"
                  },
                  "activeAtEnd": {
                    "$ref": "#/components/schemas/PlatformReportChange"
                  }
                }
              }
            }
          },
          "trend": {
            "type": "object",
            "properties": {
              "granularity": {
                "type": "string",
                "enum": [
                  "day",
                  "week",
                  "month"
                ]
              },
              "weekStartsOn": {
                "type": "integer",
                "minimum": 0,
                "maximum": 6,
                "description": "The weekday a weekly bucket starts on (0 = Sunday), from the organization's country; Monday without one."
              },
              "points": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "start": {
                      "type": "string",
                      "format": "date"
                    },
                    "added": {
                      "type": "integer"
                    },
                    "cancelled": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "PlatformMembersFigures": {
        "type": "object",
        "properties": {
          "newCustomers": {
            "type": "integer",
            "description": "Contacts who became a Member or a Drop-in for the first time."
          },
          "newMembers": {
            "type": "integer",
            "description": "Contacts who became a Member for the first time, a Drop-in taking their first membership included."
          }
        }
      },
      "PlatformMembersReport": {
        "type": "object",
        "properties": {
          "period": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "format": "date"
              },
              "to": {
                "type": "string",
                "format": "date"
              },
              "days": {
                "type": "integer"
              }
            }
          },
          "chart": {
            "$ref": "#/components/schemas/PlatformReportChart"
          },
          "moreCharts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformReportChart"
            },
            "description": "With `charts=all`: every other picture the answer can draw, after `chart`."
          },
          "timezone": {
            "type": "string",
            "description": "The clock the days are read on: the organization's timezone, as on the admin analytics dashboards."
          },
          "ageBands": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The age bands the counts, contact types, new customers and trend were narrowed to; empty for everyone."
          },
          "current": {
            "type": "object",
            "description": "Right now, whatever the period.",
            "properties": {
              "members": {
                "type": "integer",
                "description": "Contacts holding a live recurring membership or season pass."
              },
              "dropIns": {
                "type": "integer",
                "description": "Contacts holding a live pass or drop-in, or who visited in the last 30 days, without a membership."
              },
              "billableMembers": {
                "type": "integer",
                "description": "Members plus Drop-ins: every customer."
              },
              "byType": {
                "type": "array",
                "description": "How many contacts hold each contact type: contact, lead, drop_in, member, lapsed.",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "contact",
                        "lead",
                        "drop_in",
                        "member",
                        "lapsed"
                      ]
                    },
                    "count": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "totals": {
            "$ref": "#/components/schemas/PlatformMembersFigures"
          },
          "comparison": {
            "type": "object",
            "nullable": true,
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "previous_period",
                  "previous_year"
                ]
              },
              "period": {
                "type": "object",
                "description": "The compared days, as `from` / `to` say them too.",
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date"
                  },
                  "to": {
                    "type": "string",
                    "format": "date"
                  }
                }
              },
              "from": {
                "type": "string",
                "format": "date",
                "description": "First compared day."
              },
              "to": {
                "type": "string",
                "format": "date",
                "description": "Last compared day."
              },
              "basis": {
                "type": "object",
                "description": "The days of the report's own period the comparison is set against: all of them, or those up to the organization's today for a period still running.",
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date"
                  },
                  "to": {
                    "type": "string",
                    "format": "date"
                  }
                }
              },
              "totals": {
                "$ref": "#/components/schemas/PlatformMembersFigures"
              },
              "change": {
                "type": "object",
                "properties": {
                  "newCustomers": {
                    "$ref": "#/components/schemas/PlatformReportChange"
                  },
                  "newMembers": {
                    "$ref": "#/components/schemas/PlatformReportChange"
                  }
                }
              }
            }
          },
          "trend": {
            "type": "object",
            "description": "The counts at the end of each day, week or month. When a period ends partway through a week or month, its last point is the count at the end of the period's last day.",
            "properties": {
              "granularity": {
                "type": "string",
                "enum": [
                  "day",
                  "week",
                  "month"
                ]
              },
              "weekStartsOn": {
                "type": "integer",
                "minimum": 0,
                "maximum": 6,
                "description": "The weekday a weekly bucket starts on (0 = Sunday), from the organization's country; Monday without one."
              },
              "points": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "start": {
                      "type": "string",
                      "format": "date"
                    },
                    "members": {
                      "type": "integer"
                    },
                    "dropIns": {
                      "type": "integer"
                    },
                    "billableMembers": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "lifecycle": {
            "type": "object",
            "nullable": true,
            "description": "Moves between contact types in the period. Null when the caller lacks `contacts:read`.",
            "properties": {
              "upgrades": {
                "type": "integer",
                "description": "Drop-in to Member."
              },
              "downgrades": {
                "type": "integer",
                "description": "Member to Drop-in."
              },
              "lapsed": {
                "type": "integer",
                "description": "Member or Drop-in to Lapsed."
              },
              "wonBack": {
                "type": "integer",
                "description": "A customer again after having lapsed."
              }
            }
          },
          "churn": {
            "type": "object",
            "nullable": true,
            "description": "The period's churn, the admin Customer lifecycle report's: contacts whose recurring membership ended in the period with no other recurring membership following within the grace window, whatever the reason. Pass and drop-in holders lapse rather than churn, so they are `lifecycle.lapsed`, never counted here. Null when the caller lacks `contacts:read`.",
            "properties": {
              "churned": {
                "type": "integer",
                "description": "Contacts whose recurring membership ended in the period with nothing after it within the grace window. Includes a contact who joined and left within the period."
              },
              "activeAtStart": {
                "type": "integer",
                "description": "Contacts holding a running recurring membership on the period's first day."
              },
              "rate": {
                "type": "number",
                "nullable": true,
                "description": "Of the contacts active at the start, the percentage who churned in the period, to one decimal, so never above 100. Null when nobody was active at the start."
              },
              "graceDays": {
                "type": "integer",
                "description": "Days after a membership's last covered day within which a following recurring membership keeps its holder from counting as churned."
              },
              "historyFrom": {
                "type": "string",
                "format": "date",
                "nullable": true,
                "description": "The first day the membership status history covers, on the organization's clock: `reasons` and `frozen` count from it. Null when the organization has no history yet."
              },
              "reasons": {
                "type": "object",
                "nullable": true,
                "description": "The churned contacts by why they left, one count per reason; a breakdown of `churned`, never a filter on it. Null when the period ended before the status history began, since the reason was never recorded. A period across that day breaks down only what ended since.",
                "properties": {
                  "cancelled_by_member": {
                    "type": "integer",
                    "description": "The member chose to end it."
                  },
                  "cancelled_by_staff": {
                    "type": "integer",
                    "description": "Staff ended it, changed it to an ended status while editing it, or cancelled its unpaid order."
                  },
                  "cancelled_at_period_end": {
                    "type": "integer",
                    "description": "Cancelled for the end of its period, with no record of who chose it."
                  },
                  "refunded": {
                    "type": "integer",
                    "description": "Its order was cancelled and the money that had settled went back."
                  },
                  "expired": {
                    "type": "integer",
                    "description": "The term ran out: a membership that did not renew, with no cancellation behind it."
                  },
                  "other": {
                    "type": "integer",
                    "description": "A platform flow ended it with no more specific cause, such as an archived contact."
                  },
                  "unknown": {
                    "type": "integer",
                    "description": "A move nobody annotated with a reason."
                  }
                }
              },
              "frozen": {
                "type": "integer",
                "nullable": true,
                "description": "Memberships that went into a freeze in the period. Null when the period ended before the status history began."
              }
            }
          }
        }
      },
      "PlatformContactWithOverview": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PlatformContact"
          },
          {
            "type": "object",
            "properties": {
              "overview": {
                "type": "object",
                "description": "What staff see on the contact's profile before serving them, present only with `include=overview`.",
                "properties": {
                  "severity": {
                    "type": "string",
                    "enum": [
                      "error",
                      "warning"
                    ],
                    "nullable": true,
                    "description": "The loudest alert; null when there is nothing to say."
                  },
                  "alerts": {
                    "type": "array",
                    "description": "Most pressing first. `kind` is one of archived, access_suspended, amount_due (`amount`), deposit_shortfall (`held`, `required`, `shortfall`), rental_overdue / rental_out (`rentals[]`), required_document_unsigned / optional_document_unsigned / required_field_missing (`requirements[]`). `amount_due` is raised when something has fallen due and is still unpaid, with the same figure as `money.amountDue`. Alerts inform; they never block a sale.",
                    "items": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string"
                        },
                        "severity": {
                          "type": "string",
                          "enum": [
                            "error",
                            "warning"
                          ]
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "money": {
                    "type": "object",
                    "nullable": true,
                    "description": "Null when the key lacks `transactions:read`.",
                    "properties": {
                      "currency": {
                        "type": "string"
                      },
                      "amountDue": {
                        "type": "number",
                        "description": "What has fallen due and is still unpaid, as the profile shows it. Never reduced by Wallet credit."
                      },
                      "upcomingAmountDue": {
                        "type": "number",
                        "description": "Unpaid charges not fallen due yet: a booking whose visit has not started, or a charge whose due date is still ahead. Not part of `amountDue`."
                      },
                      "walletBalance": {
                        "type": "number"
                      },
                      "deposit": {
                        "type": "object",
                        "properties": {
                          "requiredAmount": {
                            "type": "number"
                          },
                          "depositHeld": {
                            "type": "number"
                          },
                          "availableToSpend": {
                            "type": "number"
                          },
                          "shortfall": {
                            "type": "number"
                          }
                        }
                      },
                      "totalBilled": {
                        "type": "number"
                      },
                      "totalPaid": {
                        "type": "number"
                      },
                      "transactions": {
                        "type": "integer",
                        "description": "Every transaction on the contact, void and reversal rows included."
                      }
                    }
                  },
                  "activity": {
                    "type": "object",
                    "properties": {
                      "lastVisitAt": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                      },
                      "bookings": {
                        "type": "integer",
                        "description": "Bookings that are not cancelled."
                      },
                      "checkins": {
                        "type": "integer"
                      },
                      "classCheckins": {
                        "type": "integer"
                      },
                      "activeMemberships": {
                        "type": "integer",
                        "description": "Plans still worth acting on, of any kind."
                      },
                      "memberships": {
                        "type": "integer",
                        "description": "Recurring plans held, any status."
                      },
                      "passes": {
                        "type": "integer"
                      },
                      "dropIns": {
                        "type": "integer"
                      },
                      "documents": {
                        "type": "integer"
                      }
                    }
                  },
                  "missingContactDetails": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "phone",
                        "email"
                      ]
                    }
                  },
                  "withheld": {
                    "type": "array",
                    "description": "What was left out because the key lacks its scope.",
                    "items": {
                      "type": "object",
                      "properties": {
                        "family": {
                          "type": "string",
                          "enum": [
                            "money",
                            "rentals"
                          ]
                        },
                        "scope": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "PlatformContact": {
        "type": "object",
        "description": "A contact (customer) in the organization. Reference the `id` as `contactId` when creating a booking.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "uuid": {
            "type": "string",
            "format": "uuid",
            "description": "Stable unguessable identifier. Prefer this over `id` when storing a reference."
          },
          "name": {
            "type": "string"
          },
          "firstName": {
            "type": "string"
          },
          "lastName": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "type": {
            "type": "string",
            "nullable": true,
            "description": "Derived contact type (e.g. contact, member, lead). `archived` marks a retired contact — hidden from the list and from search, but still readable by id."
          },
          "pipelineStageId": {
            "type": "integer",
            "nullable": true,
            "description": "The sales pipeline stage the contact is in, or null when they are not in the pipeline."
          },
          "pipelineLostReason": {
            "type": "string",
            "enum": [
              "price",
              "timing",
              "chose_competitor",
              "location",
              "no_response",
              "not_interested",
              "not_a_fit",
              "other"
            ],
            "nullable": true,
            "description": "Why the lead was lost, while they are in the Lost stage. Null outside it, or when no reason was given."
          },
          "pipelineLostNote": {
            "type": "string",
            "nullable": true,
            "description": "The note given with the lost reason."
          },
          "sourceId": {
            "type": "integer",
            "nullable": true,
            "description": "Where the contact came from."
          },
          "assignedToId": {
            "type": "integer",
            "nullable": true,
            "description": "The staff member (organization user id) following the contact up."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformPipelineStage": {
        "type": "object",
        "description": "A column of the sales pipeline. Open stages are where leads are worked; the one Lost stage (kind `cold`) holds leads that were lost, each with the reason it was given. A lead leaves the pipeline on its own when it pays for something.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "color": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "open",
              "cold"
            ]
          },
          "isDefault": {
            "type": "boolean",
            "description": "The stage new leads start in."
          },
          "sortOrder": {
            "type": "integer"
          },
          "contactCount": {
            "type": "integer"
          }
        }
      },
      "PlatformContactSource": {
        "type": "object",
        "description": "Where contacts come from (a website form, a referral, a walk-in).",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "color": {
            "type": "string"
          },
          "isActive": {
            "type": "boolean"
          },
          "sortOrder": {
            "type": "integer"
          }
        }
      },
      "PlatformArchiveIncomplete": {
        "type": "object",
        "description": "A 409 with code `ARCHIVE_INCOMPLETE`. The contact IS archived — only the release of what it held is unfinished. Repeat the same DELETE (the same `Idempotency-Key` is fine, a partial result is never replayed) to reconcile what is listed.",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "enum": [
              "ARCHIVE_INCOMPLETE"
            ]
          },
          "details": {
            "type": "object",
            "properties": {
              "outstanding": {
                "type": "array",
                "description": "What is still live on the archived contact.",
                "items": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "membership",
                        "booking",
                        "participation"
                      ]
                    },
                    "id": {
                      "type": "integer",
                      "description": "The membership id, or the booking id for a booking or participation."
                    }
                  }
                }
              }
            }
          }
        }
      },
      "PlatformContactCreate": {
        "type": "object",
        "description": "Fields accepted when creating a contact. At least one of `email` or `phone` is required so the person stays reachable and findable.",
        "required": [
          "firstName"
        ],
        "properties": {
          "firstName": {
            "type": "string",
            "maxLength": 255,
            "description": "Given name. The display name is always recomputed from first + last."
          },
          "lastName": {
            "type": "string",
            "maxLength": 255
          },
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 255,
            "description": "Unique within the organization. Cannot be changed for a contact whose email is also their 1club login."
          },
          "phone": {
            "type": "string",
            "maxLength": 50,
            "description": "Canonicalized to E.164 when the organization is configured for it."
          },
          "pipelineStageId": {
            "type": "integer",
            "description": "Put the new contact in this sales pipeline stage (GET /v1/platform/pipeline-stages), which makes them a lead."
          },
          "pipelineLostReason": {
            "type": "string",
            "enum": [
              "price",
              "timing",
              "chose_competitor",
              "location",
              "no_response",
              "not_interested",
              "not_a_fit",
              "other"
            ],
            "description": "Why the lead was lost. Only with a `pipelineStageId` naming the Lost stage (kind `cold`); sent with any other stage it is refused. Optional: a move to Lost without it reads as unknown. On a contact already in Lost it replaces the recorded reason."
          },
          "pipelineLostNote": {
            "type": "string",
            "maxLength": 500,
            "description": "What the reason leaves out. Required when `pipelineLostReason` is `other`."
          },
          "sourceId": {
            "type": "integer",
            "description": "Where the contact came from (GET /v1/platform/contact-sources)."
          },
          "assignedToId": {
            "type": "integer",
            "description": "The staff member (organization user id) following the contact up."
          }
        }
      },
      "PlatformContactUpdate": {
        "type": "object",
        "description": "Fields accepted when updating a contact. Send only what changes; an omitted field is left alone, and `null` clears `lastName`, `email` or `phone`. At least one field is required, and the contact must keep at least one of `email` or `phone`. Clearing the family name stores it as an empty string rather than null, so a cleared `lastName` reads back as `\"\"`.",
        "minProperties": 1,
        "properties": {
          "firstName": {
            "type": "string",
            "maxLength": 255,
            "description": "Given name. The display name is always recomputed from first + last."
          },
          "lastName": {
            "type": "string",
            "maxLength": 255,
            "nullable": true
          },
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 255,
            "description": "Unique within the organization. Cannot be changed for a contact whose email is also their 1club login.",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "maxLength": 50,
            "description": "Canonicalized to E.164 when the organization is configured for it.",
            "nullable": true
          },
          "pipelineStageId": {
            "type": "integer",
            "description": "Move the contact to this sales pipeline stage (GET /v1/platform/pipeline-stages); null takes them out of the pipeline.",
            "nullable": true
          },
          "pipelineLostReason": {
            "type": "string",
            "enum": [
              "price",
              "timing",
              "chose_competitor",
              "location",
              "no_response",
              "not_interested",
              "not_a_fit",
              "other"
            ],
            "description": "Why the lead was lost. Only with a `pipelineStageId` naming the Lost stage (kind `cold`); sent with any other stage it is refused. Optional: a move to Lost without it reads as unknown. On a contact already in Lost it replaces the recorded reason."
          },
          "pipelineLostNote": {
            "type": "string",
            "maxLength": 500,
            "description": "What the reason leaves out. Required when `pipelineLostReason` is `other`."
          },
          "sourceId": {
            "type": "integer",
            "description": "Where the contact came from (GET /v1/platform/contact-sources).",
            "nullable": true
          },
          "assignedToId": {
            "type": "integer",
            "description": "The staff member (organization user id) following the contact up.",
            "nullable": true
          }
        }
      },
      "PlatformContactPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformContact"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total contacts matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformInstructorSummary": {
        "type": "object",
        "description": "An instructor (coach) in the organization, as returned by the instructors resource. Reference the `id` as `instructorId` when creating a booking. Leaner than the `PlatformInstructor` profile embedded in class payloads: this carries only what is needed to pick and price a coach.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string",
            "description": "Public display name when set, otherwise the linked contact name."
          },
          "clubId": {
            "type": "integer",
            "nullable": true,
            "description": "Club the instructor belongs to; null when org-wide."
          },
          "instructorTypeId": {
            "type": "integer",
            "nullable": true,
            "description": "The kind of coach, from GET /v1/platform/instructor-types; null for one nobody has filed."
          },
          "sports": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "hourlyRate": {
            "type": "number",
            "nullable": true,
            "description": "Added to the area price when pricing a booking with this instructor, unless `priceIncludesArea` is true."
          },
          "priceIncludesArea": {
            "type": "boolean",
            "description": "When true, `hourlyRate` is an all-in price that already covers the booked area - the area's price is not added on top of it."
          },
          "bookability": {
            "type": "string",
            "enum": [
              "No_one",
              "Admin_only",
              "Member_only",
              "Public"
            ],
            "description": "Who may book one-to-one sessions with this instructor. `Admin_only` means the club reserves those bookings to its own staff, so a customer-initiated booking is rejected; an API key acts for the organization and may still create one. `No_one` means nobody may, an API key included: the instructor only teaches classes."
          },
          "isBookable": {
            "type": "boolean",
            "deprecated": true,
            "description": "Derived from `bookability`: true when it is `Member_only` or `Public`. Prefer `bookability`, which distinguishes members from the public."
          },
          "maxConcurrentBookings": {
            "type": "integer"
          },
          "maxPlayers": {
            "type": "integer",
            "deprecated": true,
            "description": "Read-only. Taken from the instructor type, where it is set (PATCH /v1/platform/instructor-types/{id}); sending it on an instructor create or update is refused with a 400. How many people one session with them may bring, the person booking included."
          },
          "operatingHours": {
            "type": "object",
            "description": "Per-day-of-week availability schedule"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Private",
              "Member_only",
              "Public"
            ],
            "description": "Who may see the instructor on member-facing surfaces. `bookability` never outruns it."
          },
          "isActive": {
            "type": "boolean",
            "description": "False for a retired instructor: hidden from the list by default, not bookable, history kept."
          },
          "locations": {
            "type": "array",
            "description": "Where a Professional (an independent instructor) teaches. Pass an `id` as `instructorLocationId` to schedule a class there. Empty for a coach at a club.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "place",
                    "address",
                    "mobile",
                    "online"
                  ],
                  "description": "`mobile`: the instructor travels to the client."
                },
                "name": {
                  "type": "string",
                  "nullable": true,
                  "description": "The gym or studio, for a `place`."
                },
                "placeSlug": {
                  "type": "string",
                  "nullable": true
                },
                "address": {
                  "type": "string",
                  "nullable": true
                },
                "city": {
                  "type": "string",
                  "nullable": true
                },
                "latitude": {
                  "type": "number",
                  "nullable": true,
                  "description": "For `mobile`, the centre of the area served, rounded to about a kilometre."
                },
                "longitude": {
                  "type": "number",
                  "nullable": true
                },
                "radiusKm": {
                  "type": "number",
                  "nullable": true,
                  "description": "For `mobile`, how far from the centre the instructor travels."
                },
                "bufferMinutes": {
                  "type": "integer",
                  "nullable": true,
                  "description": "Minutes the instructor keeps free before a session here, to travel to it."
                },
                "meetingUrl": {
                  "type": "string",
                  "nullable": true,
                  "description": "For `online`, the link a client joins a session by."
                }
              }
            }
          }
        }
      },
      "PlatformInstructorCreate": {
        "type": "object",
        "description": "Fields accepted when creating an instructor. Only `contactId` is required. Unknown fields are rejected, and `sendInvitation`, `organizationUserId`, `role`, `color` and `isBookable` are refused by name - this API creates a bookable coach and never a staff-portal user. `maxPlayers` is refused by name too: it is set on the instructor type.",
        "required": [
          "contactId"
        ],
        "properties": {
          "contactId": {
            "type": "integer",
            "description": "The person, who must already be a contact in this organization. Not editable afterwards."
          },
          "clubId": {
            "type": "integer",
            "nullable": true,
            "description": "Club the instructor works at; null means every club in the organization."
          },
          "instructorTypeId": {
            "type": "integer",
            "nullable": true,
            "description": "The kind of coach, from GET /v1/platform/instructor-types. null leaves them unfiled, which is legal but loses the grouping every roster view reads from and the default revenue account their sessions would post to."
          },
          "sports": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 50
          },
          "displayName": {
            "type": "string",
            "nullable": true,
            "maxLength": 120,
            "description": "Public-facing name. Defaults to \"<first name> <last initial>.\" from the contact."
          },
          "hourlyRate": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "description": "What a **member pays** for an hour of one-to-one time with them. Not what the club pays the coach - that is a pay rate policy. Added to the area price unless `priceIncludesArea` is true."
          },
          "bookability": {
            "type": "string",
            "enum": [
              "No_one",
              "Admin_only",
              "Member_only",
              "Public"
            ],
            "description": "Who may book one-to-one sessions with them. `No_one` means nobody may, staff and API keys included: a coach who only teaches classes. Never outruns `visibility`: narrowing one pulls the other down with it, and deactivating the instructor retires this to `Admin_only` (a `No_one` coach stays `No_one`). The read-only `isBookable` is derived from this and cannot be written."
          },
          "priceIncludesArea": {
            "type": "boolean",
            "description": "When true, `hourlyRate` already covers the booked area, which is then not charged on top."
          },
          "maxConcurrentBookings": {
            "type": "integer",
            "minimum": 1
          },
          "operatingHours": {
            "type": "object",
            "description": "Per-day-of-week availability schedule",
            "additionalProperties": true
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Private",
              "Member_only",
              "Public"
            ]
          },
          "isActive": {
            "type": "boolean",
            "description": "False retires the instructor: they leave the listings and stop being bookable, and their history is kept. There is no delete."
          }
        }
      },
      "PlatformInstructorUpdate": {
        "type": "object",
        "description": "Fields accepted when updating an instructor. Send only what changes; an omitted field is left alone. At least one field is required, and unknown fields are rejected. `contactId` is absent on purpose: re-pointing a profile at another person would transfer their bookings and pay. `maxPlayers` is refused by name: it is set on the instructor type.",
        "minProperties": 1,
        "properties": {
          "clubId": {
            "type": "integer",
            "nullable": true,
            "description": "Club the instructor works at; null means every club in the organization."
          },
          "instructorTypeId": {
            "type": "integer",
            "nullable": true,
            "description": "The kind of coach, from GET /v1/platform/instructor-types. null leaves them unfiled, which is legal but loses the grouping every roster view reads from and the default revenue account their sessions would post to."
          },
          "sports": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 50
          },
          "displayName": {
            "type": "string",
            "nullable": true,
            "maxLength": 120,
            "description": "Public-facing name. Defaults to \"<first name> <last initial>.\" from the contact."
          },
          "hourlyRate": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "description": "What a **member pays** for an hour of one-to-one time with them. Not what the club pays the coach - that is a pay rate policy. Added to the area price unless `priceIncludesArea` is true."
          },
          "bookability": {
            "type": "string",
            "enum": [
              "No_one",
              "Admin_only",
              "Member_only",
              "Public"
            ],
            "description": "Who may book one-to-one sessions with them. `No_one` means nobody may, staff and API keys included: a coach who only teaches classes. Never outruns `visibility`: narrowing one pulls the other down with it, and deactivating the instructor retires this to `Admin_only` (a `No_one` coach stays `No_one`). The read-only `isBookable` is derived from this and cannot be written."
          },
          "priceIncludesArea": {
            "type": "boolean",
            "description": "When true, `hourlyRate` already covers the booked area, which is then not charged on top."
          },
          "maxConcurrentBookings": {
            "type": "integer",
            "minimum": 1
          },
          "operatingHours": {
            "type": "object",
            "description": "Per-day-of-week availability schedule",
            "additionalProperties": true
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Private",
              "Member_only",
              "Public"
            ]
          },
          "isActive": {
            "type": "boolean",
            "description": "False retires the instructor: they leave the listings and stop being bookable, and their history is kept. There is no delete."
          }
        }
      },
      "PlatformInstructorPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformInstructorSummary"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total instructors matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformFormQuestion": {
        "type": "object",
        "description": "One question on a fill-in form, as read. Resend it with its `id` to keep it.",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Keep this: answers are stored against it."
          },
          "label": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "text",
              "textarea",
              "yes_no",
              "select",
              "boolean",
              "date",
              "number",
              "email",
              "phone",
              "url",
              "time"
            ]
          },
          "required": {
            "type": "boolean"
          },
          "placeholder": {
            "type": "string",
            "nullable": true
          },
          "helpText": {
            "type": "string",
            "nullable": true
          },
          "sectionHeading": {
            "type": "string",
            "nullable": true,
            "description": "Starts a new section above this question."
          },
          "options": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The choices of a `select` question."
          },
          "contactCustomFieldId": {
            "type": "integer",
            "nullable": true,
            "description": "A member profile field this question's answer is also saved to, linked in the admin portal. Send it back unchanged (or leave it out) to keep the link, or null to remove it."
          },
          "translations": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        }
      },
      "PlatformFormQuestionWrite": {
        "type": "object",
        "required": [
          "label",
          "type",
          "required"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "integer",
            "description": "An existing question of this form, to keep it. Leave out for a new question."
          },
          "label": {
            "type": "string",
            "maxLength": 300
          },
          "type": {
            "type": "string",
            "enum": [
              "text",
              "textarea",
              "yes_no",
              "select",
              "boolean",
              "date",
              "number",
              "email",
              "phone",
              "url",
              "time"
            ]
          },
          "required": {
            "type": "boolean",
            "description": "Whether it must be answered. Always sent: there is no default."
          },
          "placeholder": {
            "type": "string",
            "nullable": true,
            "maxLength": 200
          },
          "helpText": {
            "type": "string",
            "nullable": true,
            "maxLength": 500
          },
          "sectionHeading": {
            "type": "string",
            "nullable": true,
            "maxLength": 200
          },
          "options": {
            "type": "array",
            "nullable": true,
            "maxItems": 50,
            "items": {
              "type": "string",
              "maxLength": 200
            },
            "description": "Required for `select`. Not translatable: the choice is also the stored answer."
          },
          "contactCustomFieldId": {
            "type": "integer",
            "nullable": true,
            "description": "Keep or remove an existing link to a member profile field: send the value read from GET (or leave it out) to keep it, or null to remove it. Setting a new link is done in the admin portal (`FORM_QUESTION_LINK_NOT_SETTABLE`)."
          },
          "translations": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "description": "Per-locale wording. Translatable fields: label, placeholder, helpText, sectionHeading."
          }
        }
      },
      "PlatformFormQuestionsPut": {
        "type": "object",
        "required": [
          "questions"
        ],
        "additionalProperties": false,
        "properties": {
          "questions": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/PlatformFormQuestionWrite"
            },
            "description": "Every question the form should ask, in order."
          },
          "removeQuestionIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Existing questions to delete. Every existing question must be either resent by id or listed here (`FORM_QUESTION_OMITTED`)."
          }
        }
      },
      "PlatformForm": {
        "type": "object",
        "description": "A form: a page people fill in, live at `publicUrl`.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "slug": {
            "type": "string",
            "description": "The last part of `publicUrl`. Fixed once the form exists."
          },
          "createsAccount": {
            "type": "boolean",
            "description": "true for a sign-up form (registers the person, can sell); false for a fill-in form (collects answers). Fixed once the form exists."
          },
          "publicUrl": {
            "type": "string",
            "nullable": true,
            "description": "Where the form is filled in, on the organization's own website or member portal. It is live: anyone with the link can use it. null when the organization has neither switched on, so nothing can open the form until one is."
          },
          "name": {
            "type": "string",
            "maxLength": 200,
            "description": "Internal name, shown to staff in the admin portal."
          },
          "title": {
            "type": "string",
            "nullable": true,
            "maxLength": 200,
            "description": "Heading at the top of the form. Blank or null falls back to the wizard's own wording."
          },
          "subtitle": {
            "type": "string",
            "nullable": true,
            "maxLength": 200,
            "description": "Sub-heading under the title. Blank or null falls back to the wizard's own wording."
          },
          "planStepTitle": {
            "type": "string",
            "nullable": true,
            "maxLength": 200,
            "description": "Heading above the plan picker (sign-up forms). Blank or null falls back to the wizard's own wording."
          },
          "classTypeStepTitle": {
            "type": "string",
            "nullable": true,
            "maxLength": 200,
            "description": "Heading above the program picker, or the class-type picker on a form that still lists class types (sign-up forms). Blank or null falls back to the wizard's own wording."
          },
          "planIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 100,
            "description": "Sign-up forms only. Plans the form sells, from GET /v1/platform/plans. Each must be active, publicly visible and not a season plan (`FORM_PLAN_NOT_SELLABLE` names each refused id and why). When any are set, the person must choose one to finish."
          },
          "programIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 100,
            "description": "Sign-up forms only. Programs offered to a new student, from GET /v1/platform/programs: they pick what they join, their choice is kept on their contact, and they land on the timetable filtered to it. Nothing is booked. Replaces `classTypeIds`."
          },
          "classTypeIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 100,
            "description": "Sign-up forms only, for forms made before programs: class types offered as an interest, from GET /v1/platform/class-types. A form that lists programs offers those instead. Nothing is booked."
          },
          "productIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 100,
            "description": "Sign-up forms only. Products the form sells, from GET /v1/platform/products. Each must be active, publicly visible and sold as a product (`FORM_PRODUCT_NOT_SELLABLE`)."
          },
          "registrationFor": {
            "type": "string",
            "enum": [
              "individual",
              "child",
              "both"
            ],
            "description": "Who the form registers: the person filling it in, only their children, or both."
          },
          "signatureMethod": {
            "type": "string",
            "enum": [
              "draw",
              "type",
              "check"
            ],
            "description": "How documents are signed: drawn, typed name, or a checkbox."
          },
          "collectsDocuments": {
            "type": "boolean",
            "description": "Whether the form asks for the organization's documents and a signature. Which documents is set by the organization's document rules."
          },
          "requiresAuthentication": {
            "type": "boolean",
            "description": "Fill-in forms only: the person must be signed in to fill it in. Refused on a sign-up form (`FORM_AUTHENTICATION_FILL_IN_ONLY`)."
          },
          "notifyStaff": {
            "type": "boolean",
            "description": "Fill-in forms only: admins and managers get a User Form Submitted alert for every response. Left out on create, it is on for a form that puts people in the pipeline and off otherwise. Refused on a sign-up form (`FORM_NOTIFY_STAFF_FILL_IN_ONLY`), which is announced as a New User Signup instead."
          },
          "combineSelectionAndDetails": {
            "type": "boolean",
            "description": "Put the \"choose what to buy\" step and the details step on one page. Needs a form that sells something (`FORM_NOTHING_TO_COMBINE`)."
          },
          "displayMode": {
            "type": "string",
            "enum": [
              "page",
              "dialog"
            ],
            "description": "How a link to the form opens: as its own page, or as a dialog over the page it was opened from."
          },
          "videoUrl": {
            "type": "string",
            "nullable": true,
            "maxLength": 500,
            "description": "A Cloudinary video URL from the media library, shown as a step before review. null removes the video step."
          },
          "videoRequired": {
            "type": "boolean",
            "description": "The person cannot continue until the video has played to the end. Needs a video (`FORM_VIDEO_REQUIRED_WITHOUT_VIDEO`)."
          },
          "videoTitle": {
            "type": "string",
            "nullable": true,
            "maxLength": 200,
            "description": "Heading above the video. Blank or null falls back to the wizard's own wording."
          },
          "fieldOverrides": {
            "type": "object",
            "nullable": true,
            "additionalProperties": false,
            "description": "Fill-in forms only (`FORM_FIELD_OVERRIDES_FILL_IN_ONLY`; an empty object is accepted and ignored on a sign-up form, which asks the organization's own sign-up fields instead). Which built-in contact fields the form asks: `required` asks it, `hidden` does not. A fill-in form cannot ask one optionally. `address` asks the whole postal address. On update the map is merged: the fields you send change and the rest stay as they are, so send `hidden` to stop asking one. null clears every override.",
            "properties": {
              "firstName": {
                "type": "string",
                "enum": [
                  "required",
                  "hidden"
                ]
              },
              "lastName": {
                "type": "string",
                "enum": [
                  "required",
                  "hidden"
                ]
              },
              "email": {
                "type": "string",
                "enum": [
                  "required",
                  "hidden"
                ]
              },
              "phone": {
                "type": "string",
                "enum": [
                  "required",
                  "hidden"
                ]
              },
              "dateOfBirth": {
                "type": "string",
                "enum": [
                  "required",
                  "hidden"
                ]
              },
              "gender": {
                "type": "string",
                "enum": [
                  "required",
                  "hidden"
                ]
              },
              "address": {
                "type": "string",
                "enum": [
                  "required",
                  "hidden"
                ]
              }
            }
          },
          "translations": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "description": "Per-locale wording, as `{ \"es\": { \"title\": \"...\" } }`. Replaces the whole map. Translatable fields: title, subtitle, planStepTitle, classTypeStepTitle, videoTitle; any other key is refused (`INVALID_TRANSLATIONS`)."
          },
          "packageIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Read-only here: packages are added in the admin portal."
          },
          "submissionCount": {
            "type": "integer",
            "description": "How many people have completed it. The answers are not served by this API."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "questions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformFormQuestion"
            },
            "description": "In order. On a single-form read and on every write; not in the list."
          }
        }
      },
      "PlatformFormCreate": {
        "type": "object",
        "description": "Fields accepted when creating a form. Unknown fields are refused, and `packageIds`, `customFieldIds` and `showFamilyMembers` are refused by name with the reason. Set questions afterwards with PUT /v1/platform/forms/{id}/questions.",
        "required": [
          "name",
          "createsAccount"
        ],
        "additionalProperties": false,
        "properties": {
          "createsAccount": {
            "type": "boolean",
            "description": "Required and permanent. true: a sign-up form, which registers whoever completes it and can sell plans and products. false: a fill-in form, which only collects answers."
          },
          "slug": {
            "type": "string",
            "maxLength": 120,
            "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
            "description": "Optional; derived from the name when left out. A taken slug is a 409 (`FORM_SLUG_TAKEN`)."
          },
          "name": {
            "type": "string",
            "maxLength": 200,
            "description": "Internal name, shown to staff in the admin portal."
          },
          "title": {
            "type": "string",
            "nullable": true,
            "maxLength": 200,
            "description": "Heading at the top of the form. Blank or null falls back to the wizard's own wording."
          },
          "subtitle": {
            "type": "string",
            "nullable": true,
            "maxLength": 200,
            "description": "Sub-heading under the title. Blank or null falls back to the wizard's own wording."
          },
          "planStepTitle": {
            "type": "string",
            "nullable": true,
            "maxLength": 200,
            "description": "Heading above the plan picker (sign-up forms). Blank or null falls back to the wizard's own wording."
          },
          "classTypeStepTitle": {
            "type": "string",
            "nullable": true,
            "maxLength": 200,
            "description": "Heading above the program picker, or the class-type picker on a form that still lists class types (sign-up forms). Blank or null falls back to the wizard's own wording."
          },
          "planIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 100,
            "description": "Sign-up forms only. Plans the form sells, from GET /v1/platform/plans. Each must be active, publicly visible and not a season plan (`FORM_PLAN_NOT_SELLABLE` names each refused id and why). When any are set, the person must choose one to finish."
          },
          "programIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 100,
            "description": "Sign-up forms only. Programs offered to a new student, from GET /v1/platform/programs: they pick what they join, their choice is kept on their contact, and they land on the timetable filtered to it. Nothing is booked. Replaces `classTypeIds`."
          },
          "classTypeIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 100,
            "description": "Sign-up forms only, for forms made before programs: class types offered as an interest, from GET /v1/platform/class-types. A form that lists programs offers those instead. Nothing is booked."
          },
          "productIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 100,
            "description": "Sign-up forms only. Products the form sells, from GET /v1/platform/products. Each must be active, publicly visible and sold as a product (`FORM_PRODUCT_NOT_SELLABLE`)."
          },
          "registrationFor": {
            "type": "string",
            "enum": [
              "individual",
              "child",
              "both"
            ],
            "description": "Who the form registers: the person filling it in, only their children, or both."
          },
          "signatureMethod": {
            "type": "string",
            "enum": [
              "draw",
              "type",
              "check"
            ],
            "description": "How documents are signed: drawn, typed name, or a checkbox."
          },
          "collectsDocuments": {
            "type": "boolean",
            "description": "Whether the form asks for the organization's documents and a signature. Which documents is set by the organization's document rules."
          },
          "requiresAuthentication": {
            "type": "boolean",
            "description": "Fill-in forms only: the person must be signed in to fill it in. Refused on a sign-up form (`FORM_AUTHENTICATION_FILL_IN_ONLY`)."
          },
          "notifyStaff": {
            "type": "boolean",
            "description": "Fill-in forms only: admins and managers get a User Form Submitted alert for every response. Left out on create, it is on for a form that puts people in the pipeline and off otherwise. Refused on a sign-up form (`FORM_NOTIFY_STAFF_FILL_IN_ONLY`), which is announced as a New User Signup instead."
          },
          "combineSelectionAndDetails": {
            "type": "boolean",
            "description": "Put the \"choose what to buy\" step and the details step on one page. Needs a form that sells something (`FORM_NOTHING_TO_COMBINE`)."
          },
          "displayMode": {
            "type": "string",
            "enum": [
              "page",
              "dialog"
            ],
            "description": "How a link to the form opens: as its own page, or as a dialog over the page it was opened from."
          },
          "videoUrl": {
            "type": "string",
            "nullable": true,
            "maxLength": 500,
            "description": "A Cloudinary video URL from the media library, shown as a step before review. null removes the video step."
          },
          "videoRequired": {
            "type": "boolean",
            "description": "The person cannot continue until the video has played to the end. Needs a video (`FORM_VIDEO_REQUIRED_WITHOUT_VIDEO`)."
          },
          "videoTitle": {
            "type": "string",
            "nullable": true,
            "maxLength": 200,
            "description": "Heading above the video. Blank or null falls back to the wizard's own wording."
          },
          "fieldOverrides": {
            "type": "object",
            "nullable": true,
            "additionalProperties": false,
            "description": "Fill-in forms only (`FORM_FIELD_OVERRIDES_FILL_IN_ONLY`; an empty object is accepted and ignored on a sign-up form, which asks the organization's own sign-up fields instead). Which built-in contact fields the form asks: `required` asks it, `hidden` does not. A fill-in form cannot ask one optionally. `address` asks the whole postal address. On update the map is merged: the fields you send change and the rest stay as they are, so send `hidden` to stop asking one. null clears every override.",
            "properties": {
              "firstName": {
                "type": "string",
                "enum": [
                  "required",
                  "hidden"
                ]
              },
              "lastName": {
                "type": "string",
                "enum": [
                  "required",
                  "hidden"
                ]
              },
              "email": {
                "type": "string",
                "enum": [
                  "required",
                  "hidden"
                ]
              },
              "phone": {
                "type": "string",
                "enum": [
                  "required",
                  "hidden"
                ]
              },
              "dateOfBirth": {
                "type": "string",
                "enum": [
                  "required",
                  "hidden"
                ]
              },
              "gender": {
                "type": "string",
                "enum": [
                  "required",
                  "hidden"
                ]
              },
              "address": {
                "type": "string",
                "enum": [
                  "required",
                  "hidden"
                ]
              }
            }
          },
          "translations": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "description": "Per-locale wording, as `{ \"es\": { \"title\": \"...\" } }`. Replaces the whole map. Translatable fields: title, subtitle, planStepTitle, classTypeStepTitle, videoTitle; any other key is refused (`INVALID_TRANSLATIONS`)."
          }
        }
      },
      "PlatformFormUpdate": {
        "type": "object",
        "description": "Fields accepted when updating a form. Send only what changes. `slug` and `createsAccount` are refused by name: both are fixed once the form exists.",
        "minProperties": 1,
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 200,
            "description": "Internal name, shown to staff in the admin portal."
          },
          "title": {
            "type": "string",
            "nullable": true,
            "maxLength": 200,
            "description": "Heading at the top of the form. Blank or null falls back to the wizard's own wording."
          },
          "subtitle": {
            "type": "string",
            "nullable": true,
            "maxLength": 200,
            "description": "Sub-heading under the title. Blank or null falls back to the wizard's own wording."
          },
          "planStepTitle": {
            "type": "string",
            "nullable": true,
            "maxLength": 200,
            "description": "Heading above the plan picker (sign-up forms). Blank or null falls back to the wizard's own wording."
          },
          "classTypeStepTitle": {
            "type": "string",
            "nullable": true,
            "maxLength": 200,
            "description": "Heading above the program picker, or the class-type picker on a form that still lists class types (sign-up forms). Blank or null falls back to the wizard's own wording."
          },
          "planIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 100,
            "description": "Sign-up forms only. Plans the form sells, from GET /v1/platform/plans. Each must be active, publicly visible and not a season plan (`FORM_PLAN_NOT_SELLABLE` names each refused id and why). When any are set, the person must choose one to finish."
          },
          "programIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 100,
            "description": "Sign-up forms only. Programs offered to a new student, from GET /v1/platform/programs: they pick what they join, their choice is kept on their contact, and they land on the timetable filtered to it. Nothing is booked. Replaces `classTypeIds`."
          },
          "classTypeIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 100,
            "description": "Sign-up forms only, for forms made before programs: class types offered as an interest, from GET /v1/platform/class-types. A form that lists programs offers those instead. Nothing is booked."
          },
          "productIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 100,
            "description": "Sign-up forms only. Products the form sells, from GET /v1/platform/products. Each must be active, publicly visible and sold as a product (`FORM_PRODUCT_NOT_SELLABLE`)."
          },
          "registrationFor": {
            "type": "string",
            "enum": [
              "individual",
              "child",
              "both"
            ],
            "description": "Who the form registers: the person filling it in, only their children, or both."
          },
          "signatureMethod": {
            "type": "string",
            "enum": [
              "draw",
              "type",
              "check"
            ],
            "description": "How documents are signed: drawn, typed name, or a checkbox."
          },
          "collectsDocuments": {
            "type": "boolean",
            "description": "Whether the form asks for the organization's documents and a signature. Which documents is set by the organization's document rules."
          },
          "requiresAuthentication": {
            "type": "boolean",
            "description": "Fill-in forms only: the person must be signed in to fill it in. Refused on a sign-up form (`FORM_AUTHENTICATION_FILL_IN_ONLY`)."
          },
          "notifyStaff": {
            "type": "boolean",
            "description": "Fill-in forms only: admins and managers get a User Form Submitted alert for every response. Left out on create, it is on for a form that puts people in the pipeline and off otherwise. Refused on a sign-up form (`FORM_NOTIFY_STAFF_FILL_IN_ONLY`), which is announced as a New User Signup instead."
          },
          "combineSelectionAndDetails": {
            "type": "boolean",
            "description": "Put the \"choose what to buy\" step and the details step on one page. Needs a form that sells something (`FORM_NOTHING_TO_COMBINE`)."
          },
          "displayMode": {
            "type": "string",
            "enum": [
              "page",
              "dialog"
            ],
            "description": "How a link to the form opens: as its own page, or as a dialog over the page it was opened from."
          },
          "videoUrl": {
            "type": "string",
            "nullable": true,
            "maxLength": 500,
            "description": "A Cloudinary video URL from the media library, shown as a step before review. null removes the video step."
          },
          "videoRequired": {
            "type": "boolean",
            "description": "The person cannot continue until the video has played to the end. Needs a video (`FORM_VIDEO_REQUIRED_WITHOUT_VIDEO`)."
          },
          "videoTitle": {
            "type": "string",
            "nullable": true,
            "maxLength": 200,
            "description": "Heading above the video. Blank or null falls back to the wizard's own wording."
          },
          "fieldOverrides": {
            "type": "object",
            "nullable": true,
            "additionalProperties": false,
            "description": "Fill-in forms only (`FORM_FIELD_OVERRIDES_FILL_IN_ONLY`; an empty object is accepted and ignored on a sign-up form, which asks the organization's own sign-up fields instead). Which built-in contact fields the form asks: `required` asks it, `hidden` does not. A fill-in form cannot ask one optionally. `address` asks the whole postal address. On update the map is merged: the fields you send change and the rest stay as they are, so send `hidden` to stop asking one. null clears every override.",
            "properties": {
              "firstName": {
                "type": "string",
                "enum": [
                  "required",
                  "hidden"
                ]
              },
              "lastName": {
                "type": "string",
                "enum": [
                  "required",
                  "hidden"
                ]
              },
              "email": {
                "type": "string",
                "enum": [
                  "required",
                  "hidden"
                ]
              },
              "phone": {
                "type": "string",
                "enum": [
                  "required",
                  "hidden"
                ]
              },
              "dateOfBirth": {
                "type": "string",
                "enum": [
                  "required",
                  "hidden"
                ]
              },
              "gender": {
                "type": "string",
                "enum": [
                  "required",
                  "hidden"
                ]
              },
              "address": {
                "type": "string",
                "enum": [
                  "required",
                  "hidden"
                ]
              }
            }
          },
          "translations": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "description": "Per-locale wording, as `{ \"es\": { \"title\": \"...\" } }`. Replaces the whole map. Translatable fields: title, subtitle, planStepTitle, classTypeStepTitle, videoTitle; any other key is refused (`INVALID_TRANSLATIONS`)."
          }
        }
      },
      "PlatformFormPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformForm"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total forms matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformMembership": {
        "type": "object",
        "description": "A customer's membership on a plan. The plan is snapshotted onto it at creation, so allowance and coverage behave exactly as they do for a membership sold in 1club.",
        "properties": {
          "membershipId": {
            "type": "integer"
          },
          "membershipUuid": {
            "type": "string",
            "format": "uuid",
            "description": "Stable unguessable identifier. Prefer this over `membershipId` when storing a reference."
          },
          "contactId": {
            "type": "integer",
            "description": "Customer the membership belongs to"
          },
          "planId": {
            "type": "integer"
          },
          "planName": {
            "type": "string",
            "nullable": true
          },
          "clubId": {
            "type": "integer",
            "nullable": true,
            "description": "Club the membership is limited to; null when it applies organization-wide."
          },
          "status": {
            "type": "string",
            "description": "active, paused, cancelled, expired, used, pending, or pending_payment"
          },
          "startDate": {
            "type": "string",
            "format": "date-time"
          },
          "endDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "renewalDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "autoRenew": {
            "type": "boolean"
          },
          "price": {
            "type": "number",
            "nullable": true
          },
          "billingFrequency": {
            "type": "string"
          },
          "customPeriod": {
            "type": "integer",
            "nullable": true,
            "description": "With `billingFrequency: custom`, how many `customPeriodUnit` a period lasts; otherwise null."
          },
          "customPeriodUnit": {
            "type": "string",
            "nullable": true,
            "description": "days, weeks or months, with `billingFrequency: custom`; otherwise null."
          },
          "maxUses": {
            "type": "number",
            "nullable": true,
            "description": "Session allowance snapshotted from the plan; null when unlimited. With several `allowances`, their total."
          },
          "usesRemaining": {
            "type": "number",
            "nullable": true,
            "description": "Sessions left; with several `allowances`, their total."
          },
          "usesAdjustment": {
            "type": "number",
            "description": "Sessions staff gave (or took back) this allowance period, on top of maxUses. Why usesRemaining can exceed maxUses."
          },
          "allowances": {
            "type": "array",
            "description": "Its session counters: one for an ordinary membership, several for one sold from a plan like 5 Yoga + 4 Pilates, each with its own balance.",
            "items": {
              "type": "object",
              "properties": {
                "allowanceId": {
                  "type": "integer",
                  "nullable": true,
                  "description": "Null on a membership with one allowance."
                },
                "validFor": {
                  "type": "object",
                  "additionalProperties": true,
                  "description": "What this allowance covers."
                },
                "maxUses": {
                  "type": "number",
                  "nullable": true
                },
                "usesRemaining": {
                  "type": "number",
                  "nullable": true
                },
                "usesAdjustment": {
                  "type": "number"
                },
                "sessionUnit": {
                  "type": "string",
                  "nullable": true
                }
              }
            }
          },
          "sessionLengthMinutes": {
            "type": "integer",
            "nullable": true,
            "description": "How long one visit lasts at the door, in minutes from its first entry; null until the end of the club's day."
          },
          "shareWithAccount": {
            "type": "boolean",
            "description": "Whether the people on the holder's account can use it too."
          },
          "commitmentEndsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the member's minimum commitment is met - they cannot cancel online before it; null for none. Counted from the start date and pushed out by pauses."
          },
          "commitmentMonths": {
            "type": "integer",
            "nullable": true,
            "description": "The term agreed, in months; null when there is none."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformMembershipPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformMembership"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total memberships matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformPlan": {
        "type": "object",
        "description": "A membership plan. It carries its own price, joining fee, billing frequency and session allowance, so creating a membership only has to name the plan and the customer.",
        "properties": {
          "planId": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "clubId": {
            "type": "integer",
            "nullable": true,
            "description": "Club the plan is limited to; null when organization-wide."
          },
          "seasonId": {
            "type": "integer",
            "nullable": true,
            "description": "Set when the plan sells a season, and the marker that it is **not** for sale through this API: a season pass costs the sum of the slots the buyer picks, so the plan's own `price` is 0 and a membership created against it would put a member on a large contract for nothing. `GET /v1/platform/plans` excludes these; get-by-id resolves one so a membership already sold against it can be explained. Check it before treating any plan as sellable."
          },
          "planCategoryId": {
            "type": "integer",
            "nullable": true,
            "description": "Category the plan is grouped under on price lists; null when ungrouped."
          },
          "revenueAccountId": {
            "type": "integer",
            "nullable": true,
            "description": "Ledger account a sale posts to; null means the organization's default account is used at the time of the sale."
          },
          "price": {
            "type": "number",
            "description": "Charged each billing period."
          },
          "signupFee": {
            "type": "number",
            "description": "Charged once when the membership starts, on top of the price."
          },
          "billingFrequency": {
            "type": "string"
          },
          "isActive": {
            "type": "boolean",
            "description": "False for a retired plan that is no longer sold."
          },
          "maxUses": {
            "type": "number",
            "nullable": true,
            "description": "Session allowance a membership gets; null when unlimited. With several `allowances`, their total."
          },
          "sessionUnit": {
            "type": "string",
            "nullable": true,
            "description": "What a use is counted in - a booking or an hour. Null when the plan has several `allowances`."
          },
          "validityPeriod": {
            "type": "integer",
            "nullable": true,
            "description": "Days the membership stays valid, when time-limited."
          },
          "autoRenews": {
            "type": "boolean",
            "description": "Whether a membership on this plan renews by default."
          },
          "renewalDaysInAdvance": {
            "type": "integer"
          },
          "requirePaymentUpfront": {
            "type": "boolean"
          },
          "featured": {
            "type": "boolean",
            "description": "Whether the club highlights this plan as \"Most popular\" on its price lists."
          },
          "isIntroOffer": {
            "type": "boolean",
            "description": "Whether the plan is an intro offer for first-time customers, as the First visits report counts it."
          },
          "customPeriod": {
            "type": "integer",
            "nullable": true
          },
          "customPeriodUnit": {
            "type": "string",
            "nullable": true
          },
          "minimumTermMonths": {
            "type": "integer",
            "nullable": true,
            "description": "Months a buyer commits to before the membership may end, counted from its start; null for none."
          },
          "features": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Private",
              "Member_only",
              "Public"
            ]
          },
          "validFor": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Booking resource scopes and optional type filters covered by the plan. Null when it has several `allowances`."
          },
          "allowances": {
            "type": "array",
            "description": "The plan's session counters: one for an ordinary plan, several for one like 5 Yoga + 4 Pilates a month. Their coverage never overlaps.",
            "items": {
              "type": "object",
              "properties": {
                "allowanceId": {
                  "type": "integer",
                  "nullable": true,
                  "description": "Null on a plan with one allowance, which lives on the plan itself."
                },
                "validFor": {
                  "type": "object",
                  "additionalProperties": true
                },
                "maxUses": {
                  "type": "number",
                  "nullable": true,
                  "description": "Sessions it grants each period; null when unlimited."
                },
                "sessionUnit": {
                  "type": "string",
                  "nullable": true
                }
              }
            }
          },
          "sports": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "PlatformPlanPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformPlan"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total plans matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformProduct": {
        "type": "object",
        "description": "A product the organization sells over the counter.",
        "properties": {
          "productId": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "clubId": {
            "type": "integer",
            "nullable": true,
            "description": "Club the product is sold at; null when available organization-wide."
          },
          "categoryId": {
            "type": "integer",
            "nullable": true,
            "description": "Product category it is grouped under."
          },
          "brandId": {
            "type": "integer",
            "nullable": true
          },
          "sku": {
            "type": "string",
            "nullable": true,
            "description": "Stock-keeping code, if the gym uses one."
          },
          "barcode": {
            "type": "string",
            "nullable": true,
            "description": "Scanned at the till. Unique across everything scannable in the organization."
          },
          "price": {
            "type": "number",
            "description": "What a customer pays, in the organization currency."
          },
          "costPrice": {
            "type": "number",
            "nullable": true,
            "description": "What the gym pays for it; null when not tracked. Never shown to customers."
          },
          "isActive": {
            "type": "boolean",
            "description": "False for a product taken off the till without deleting its history."
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Public",
              "Member_only",
              "Private"
            ],
            "description": "Who may see it on customer-facing surfaces."
          },
          "images": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "features": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "taxRateId": {
            "type": "integer",
            "nullable": true,
            "description": "Per-product VAT rate; takes precedence over the revenue account default at the till."
          },
          "revenueAccountId": {
            "type": "integer",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformProductPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformProduct"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total products matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformProductCreate": {
        "type": "object",
        "description": "Fields accepted when creating a product. Only `name` and `price` are required; the defaults shown are what an omitted field becomes.",
        "required": [
          "name",
          "price"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "description": {
            "type": "string",
            "maxLength": 5000
          },
          "price": {
            "type": "number",
            "minimum": 0
          },
          "costPrice": {
            "type": "number",
            "minimum": 0,
            "nullable": true
          },
          "clubId": {
            "type": "integer",
            "nullable": true,
            "description": "Limit the product to one club; null sells it everywhere."
          },
          "categoryId": {
            "type": "integer",
            "nullable": true,
            "description": "From GET /v1/platform/product-categories"
          },
          "brandId": {
            "type": "integer",
            "nullable": true
          },
          "sku": {
            "type": "string",
            "maxLength": 64,
            "nullable": true,
            "description": "Stock-keeping code. Scannable at the till, so it must be unused by any other product, package, plan or access card in the organization."
          },
          "barcode": {
            "type": "string",
            "maxLength": 64,
            "nullable": true,
            "description": "Must be unused by any other product, package, plan or access card in the organization."
          },
          "isActive": {
            "type": "boolean",
            "default": true
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Public",
              "Member_only",
              "Private"
            ],
            "default": "Public"
          },
          "taxRateId": {
            "type": "integer",
            "nullable": true
          },
          "revenueAccountId": {
            "type": "integer",
            "nullable": true
          },
          "images": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            },
            "description": "Replaces the whole list. Use already-hosted URLs."
          },
          "features": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Replaces the whole list."
          }
        }
      },
      "PlatformProductUpdate": {
        "type": "object",
        "description": "Fields accepted when updating a product. Send only what changes; `null` clears a nullable field, and an omitted field is left alone. At least one field is required.",
        "minProperties": 1,
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "description": {
            "type": "string",
            "maxLength": 5000
          },
          "price": {
            "type": "number",
            "minimum": 0
          },
          "costPrice": {
            "type": "number",
            "minimum": 0,
            "nullable": true
          },
          "clubId": {
            "type": "integer",
            "nullable": true,
            "description": "Limit the product to one club; null sells it everywhere."
          },
          "categoryId": {
            "type": "integer",
            "nullable": true,
            "description": "From GET /v1/platform/product-categories"
          },
          "brandId": {
            "type": "integer",
            "nullable": true
          },
          "sku": {
            "type": "string",
            "maxLength": 64,
            "nullable": true,
            "description": "Stock-keeping code. Scannable at the till, so it must be unused by any other product, package, plan or access card in the organization."
          },
          "barcode": {
            "type": "string",
            "maxLength": 64,
            "nullable": true,
            "description": "Must be unused by any other product, package, plan or access card in the organization."
          },
          "isActive": {
            "type": "boolean"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Public",
              "Member_only",
              "Private"
            ]
          },
          "taxRateId": {
            "type": "integer",
            "nullable": true
          },
          "revenueAccountId": {
            "type": "integer",
            "nullable": true
          },
          "images": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            },
            "description": "Replaces the whole list. Use already-hosted URLs."
          },
          "features": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Replaces the whole list."
          }
        }
      },
      "PlatformArea": {
        "type": "object",
        "description": "An area - a court, a studio, a lane. One shape for the list, get-by-id, create and update.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "clubId": {
            "type": "integer"
          },
          "areaTypeId": {
            "type": "integer",
            "nullable": true,
            "description": "The kind of area, from GET /v1/platform/area-types. Decides `sports` and the default price."
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "maintenance",
              "inactive"
            ],
            "description": "Only an `active` area is bookable, and only those appear in the list. The other two resolve by id."
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Private",
              "Member_only",
              "Public"
            ],
            "description": "The list shows only `Public` areas; the others resolve by id."
          },
          "sports": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Sports the area is bookable for, from its area type."
          },
          "pricePerHour": {
            "type": "number",
            "nullable": true
          },
          "maxConcurrentBookings": {
            "type": "integer",
            "description": "Bookings and classes the area holds at once; 0 means unlimited."
          },
          "timezone": {
            "type": "string",
            "description": "IANA timezone the operating hours are expressed in (the club's, falling back to the organization's). Convert a local wall time in this zone when sending `startTime`/`endTime` to POST /v1/platform/bookings."
          },
          "operatingHours": {
            "type": "object",
            "description": "Per-day-of-week opening schedule",
            "additionalProperties": true
          },
          "isDefault": {
            "type": "boolean",
            "description": "Whether this is the club's Default Area. At most one per club; a club may have none."
          },
          "images": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The area's photos, in display order."
          }
        }
      },
      "PlatformAreaCreate": {
        "type": "object",
        "description": "Fields accepted when creating an area. The defaults shown are what an omitted field becomes. Unknown fields are rejected.",
        "required": [
          "name",
          "clubId",
          "areaTypeId"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "areaTypeId": {
            "type": "integer",
            "description": "From GET /v1/platform/area-types. Decides which sports the area is bookable for and what it is priced from, so resolve it rather than guessing."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 5000
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "maintenance",
              "inactive"
            ],
            "description": "Only an `active` area is bookable. `maintenance` and `inactive` take it out of availability without losing its history - this is how a court is closed indefinitely, where an area block closes it for a stated window.",
            "default": "active"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Private",
              "Member_only",
              "Public"
            ],
            "default": "Public"
          },
          "pricePerHour": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "description": "Overrides the area type's default hourly price; null falls back to it."
          },
          "operatingHours": {
            "type": "object",
            "description": "Per-day-of-week opening schedule, in the club's timezone. Intersected with the club's own hours - an area is never bookable outside them.",
            "additionalProperties": true
          },
          "maxConcurrentBookings": {
            "type": "integer",
            "minimum": 0,
            "description": "How many bookings and classes may hold the area at the same time. 1 for an ordinary court; 0 means unlimited (an open gym floor) and is the default for an area with no type."
          },
          "isDefault": {
            "type": "boolean",
            "description": "Make this the club's Default Area - the door-access area a check-in on a General Plan uses when the club has several active areas. `true` moves the flag off the club's previous default; `false` leaves the club with none."
          },
          "images": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "type": "string",
              "format": "uri"
            },
            "description": "The area's photos, shown on its website page and booking calendar. Absolute http(s) URLs, ideally from GET /v1/platform/media. Replaces the whole list."
          },
          "clubId": {
            "type": "integer",
            "description": "Club the area belongs to, from GET /v1/platform/clubs. Not editable afterwards."
          }
        }
      },
      "PlatformAreaUpdate": {
        "type": "object",
        "description": "Fields accepted when updating an area. Send only what changes; an omitted field is left alone. At least one field is required, and unknown fields are rejected. `clubId` is absent on purpose - moving a court to another club would strand its bookings, class holds and blocks at the old one.",
        "minProperties": 1,
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "areaTypeId": {
            "type": "integer",
            "description": "From GET /v1/platform/area-types. Decides which sports the area is bookable for and what it is priced from, so resolve it rather than guessing."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 5000
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "maintenance",
              "inactive"
            ],
            "description": "Only an `active` area is bookable. `maintenance` and `inactive` take it out of availability without losing its history - this is how a court is closed indefinitely, where an area block closes it for a stated window."
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Private",
              "Member_only",
              "Public"
            ]
          },
          "pricePerHour": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "description": "Overrides the area type's default hourly price; null falls back to it."
          },
          "operatingHours": {
            "type": "object",
            "description": "Per-day-of-week opening schedule, in the club's timezone. Intersected with the club's own hours - an area is never bookable outside them.",
            "additionalProperties": true
          },
          "maxConcurrentBookings": {
            "type": "integer",
            "minimum": 0,
            "description": "How many bookings and classes may hold the area at the same time. 1 for an ordinary court; 0 means unlimited (an open gym floor) and is the default for an area with no type."
          },
          "isDefault": {
            "type": "boolean",
            "description": "Make this the club's Default Area - the door-access area a check-in on a General Plan uses when the club has several active areas. `true` moves the flag off the club's previous default; `false` leaves the club with none."
          },
          "images": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "type": "string",
              "format": "uri"
            },
            "description": "The area's photos, shown on its website page and booking calendar. Absolute http(s) URLs, ideally from GET /v1/platform/media. Replaces the whole list."
          }
        }
      },
      "PlatformAreaType": {
        "type": "object",
        "description": "A kind of area, and the defaults every area of that kind inherits. One shape for the list, get-by-id, create and update.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string",
            "description": "Stable key, derived from the name when a create does not send one. A rename never moves it."
          },
          "sortOrder": {
            "type": "integer",
            "description": "Position in the order staff set in Settings, 1 first. Lists come back in this order; change it with the type's PUT .../order."
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "revenueAccountId": {
            "type": "integer",
            "nullable": true,
            "description": "Where a booking on this kind of area posts. Null falls back to the organization's default account."
          },
          "areaCount": {
            "type": "integer",
            "description": "Areas currently of this type, whatever their status."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "sports": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Sports an area of this type can be booked for."
          },
          "isBookable": {
            "type": "boolean",
            "description": "False for a type that is not booked at all (a storeroom, a corridor). Do not build bookable inventory on one."
          },
          "defaultPricePerHour": {
            "type": "number",
            "nullable": true,
            "description": "Hourly price an area of this type starts from; an area may override it."
          },
          "defaultMaxPlayers": {
            "type": "integer",
            "nullable": true,
            "description": "How many people a slot on this type normally takes."
          },
          "allowsSingles": {
            "type": "boolean",
            "description": "Whether a booking on this type may be made for singles (2 players) instead of doubles. Only read when defaultMaxPlayers is 4; leave it off for padel."
          },
          "maxConcurrentBookings": {
            "type": "integer",
            "description": "How many bookings and classes may hold an area of this type at once. 1 for an ordinary court; 0 means unlimited."
          },
          "bookingAudience": {
            "$ref": "#/components/schemas/PlatformContactAudience"
          }
        }
      },
      "PlatformAreaTypeCreate": {
        "type": "object",
        "description": "Fields accepted when creating an area type. Only `name` is required; `slug` is derived from it when omitted, and suffixed if that is taken. The defaults shown are what an omitted field becomes, and unknown fields are rejected.",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "slug": {
            "type": "string",
            "maxLength": 120,
            "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
            "description": "Stable key. Derived from the name when omitted; send one only when something outside 1club already refers to it. An explicit slug that clashes is a 409, and a rename never moves it."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 2000
          },
          "revenueAccountId": {
            "type": "integer",
            "nullable": true,
            "description": "Where a booking on this kind of area posts, from GET /v1/platform/revenue-accounts. Leave it unset and the sale posts to whichever account the organization has marked default, resolved at the time of the sale."
          },
          "sports": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "string"
            },
            "description": "Canonical sport ids an area of this type can be booked for, e.g. [\"padel\"]. This is what makes the areas bookable for a sport at all; an unrecognised value is rejected rather than stored."
          },
          "isBookable": {
            "type": "boolean",
            "default": true,
            "description": "False for a kind of space that is not booked at all (a storeroom, a corridor)."
          },
          "defaultPricePerHour": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "description": "Hourly price an area of this type starts from. An area may override it."
          },
          "defaultMaxPlayers": {
            "type": "integer",
            "nullable": true,
            "minimum": 1,
            "maximum": 1000,
            "description": "How many people a slot on this type normally takes."
          },
          "allowsSingles": {
            "type": "boolean",
            "default": false,
            "description": "Whether a booking on this type may be made for singles (2 players) instead of doubles. Only read when defaultMaxPlayers is 4; leave it off for padel."
          },
          "maxConcurrentBookings": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "default": 0,
            "description": "How many bookings and classes may hold an area of this type at once, and what a new area of the type starts with. 1 for an ordinary court; 0 means unlimited."
          },
          "bookingAudience": {
            "$ref": "#/components/schemas/PlatformContactAudience"
          }
        }
      },
      "PlatformAreaTypeUpdate": {
        "type": "object",
        "description": "Fields accepted when updating an area type. Send only what changes; `null` clears a nullable field, an omitted field is left alone, and at least one is required. A rename does not move `slug`. Every area of the type inherits `sports`, `defaultPricePerHour`, `defaultMaxPlayers` and `isBookable`, so changing one of those reprices or re-sports every area at once and emits an availability change for each. `sports` replaces the whole list.",
        "minProperties": 1,
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "slug": {
            "type": "string",
            "maxLength": 120,
            "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
            "description": "Stable key. Derived from the name when omitted; send one only when something outside 1club already refers to it. An explicit slug that clashes is a 409, and a rename never moves it."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 2000
          },
          "revenueAccountId": {
            "type": "integer",
            "nullable": true,
            "description": "Where a booking on this kind of area posts, from GET /v1/platform/revenue-accounts. Leave it unset and the sale posts to whichever account the organization has marked default, resolved at the time of the sale."
          },
          "sports": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "string"
            },
            "description": "Canonical sport ids an area of this type can be booked for, e.g. [\"padel\"]. This is what makes the areas bookable for a sport at all; an unrecognised value is rejected rather than stored."
          },
          "isBookable": {
            "type": "boolean",
            "default": true,
            "description": "False for a kind of space that is not booked at all (a storeroom, a corridor)."
          },
          "defaultPricePerHour": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "description": "Hourly price an area of this type starts from. An area may override it."
          },
          "defaultMaxPlayers": {
            "type": "integer",
            "nullable": true,
            "minimum": 1,
            "maximum": 1000,
            "description": "How many people a slot on this type normally takes."
          },
          "allowsSingles": {
            "type": "boolean",
            "default": false,
            "description": "Whether a booking on this type may be made for singles (2 players) instead of doubles. Only read when defaultMaxPlayers is 4; leave it off for padel."
          },
          "maxConcurrentBookings": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "default": 0,
            "description": "How many bookings and classes may hold an area of this type at once, and what a new area of the type starts with. 1 for an ordinary court; 0 means unlimited."
          },
          "bookingAudience": {
            "$ref": "#/components/schemas/PlatformContactAudience"
          }
        }
      },
      "PlatformClassTypeCreate": {
        "type": "object",
        "description": "Fields accepted when creating a class type. Only `name` is required; `slug` is derived from it when omitted, and suffixed if that is taken. The defaults shown are what an omitted field becomes, and unknown fields are rejected.",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "slug": {
            "type": "string",
            "maxLength": 120,
            "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
            "description": "Stable key. Derived from the name when omitted; send one only when something outside 1club already refers to it. An explicit slug that clashes is a 409, and a rename never moves it."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 2000
          },
          "revenueAccountId": {
            "type": "integer",
            "nullable": true,
            "description": "Where a sale on this kind of class posts, from GET /v1/platform/revenue-accounts. Leave it unset and the sale posts to whichever account the organization has marked default, resolved at the time of the sale."
          },
          "maxPartySize": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000,
            "default": 1,
            "description": "How many people one booking may bring, including the booker."
          },
          "showSpotsLeft": {
            "type": "boolean",
            "default": false,
            "description": "Whether member-facing class rows always show how many places are left. Off, a count appears only when the class is nearly full."
          },
          "allowMultiDay": {
            "type": "boolean",
            "default": false,
            "description": "Whether a class of this kind may run across more than one calendar day."
          },
          "cancelIfAttendanceZero": {
            "type": "boolean",
            "default": false,
            "description": "Whether a class with nobody booked cancels itself."
          },
          "cancelIfAttendanceZeroHoursInAdvance": {
            "type": "integer",
            "minimum": 0,
            "maximum": 720,
            "default": 0,
            "description": "Hours before the start that cancellation runs. Meaningless unless `cancelIfAttendanceZero`."
          },
          "bookingAudience": {
            "$ref": "#/components/schemas/PlatformContactAudience"
          },
          "sport": {
            "type": "string",
            "nullable": true,
            "description": "The sport classes of this kind are for, a canonical sport id such as \"jiu-jitsu\". A default only: each class still carries its own `sport`. An unrecognised value is rejected."
          },
          "ageGroups": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "baby",
                "preschool",
                "child",
                "preteen",
                "junior",
                "adult",
                "senior"
              ]
            },
            "description": "Who a class of this kind is for: every age band it suits (baby 0–2, preschool 3–5, child 6–9, preteen 10–12, junior 13–17, adult 18–64, senior 65+), the same bands the age smart tags use. Stored youngest first, each once; a class for every age lists all of them, and an empty list means the club has not said. Search on the 1club network filters on it."
          },
          "ageGroup": {
            "type": "string",
            "nullable": true,
            "deprecated": true,
            "enum": [
              "infant",
              "child",
              "junior",
              "adult",
              "senior",
              "all_ages"
            ],
            "description": "Deprecated - use `ageGroups`. The single age group from before a class type could name several bands, kept for one release. Read: the old value that names exactly `ageGroups` (`infant` is baby and preschool, `child` is child and preteen, `all_ages` is every band), else null. Write: read only when `ageGroups` is absent, mapped the same way, null clearing. Sending back the value a read reported changes nothing, and it never replaces bands no old value names - set those with `ageGroups`."
          },
          "difficulty": {
            "type": "string",
            "nullable": true,
            "enum": [
              "beginner",
              "intermediate",
              "advanced",
              "all_levels"
            ],
            "description": "How hard a class of this kind is. Search on the 1club network filters on it. Not a rank: see `programId`."
          },
          "programId": {
            "type": "integer",
            "nullable": true,
            "description": "The program this kind of class belongs to, from GET /v1/platform/programs. Its sessions count toward the program's progression track. Plans cover class types, not programs, so moving a class type between programs changes no plan."
          },
          "progressionTrackId": {
            "type": "integer",
            "nullable": true,
            "deprecated": true,
            "description": "Deprecated: set `programId` instead; the track a class type counts toward is its program's. Still accepted when `programId` is absent: a track puts the class type in the organization's one program counting toward that track (400 when none or several do), and null takes it out of its program."
          }
        }
      },
      "PlatformClassTypeUpdate": {
        "type": "object",
        "description": "Fields accepted when updating a class type. Send only what changes; `null` clears a nullable field, an omitted field is left alone, and at least one is required. A rename does not move `slug`. Every field applies to classes already scheduled as this type, not only to new ones.",
        "minProperties": 1,
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "slug": {
            "type": "string",
            "maxLength": 120,
            "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
            "description": "Stable key. Derived from the name when omitted; send one only when something outside 1club already refers to it. An explicit slug that clashes is a 409, and a rename never moves it."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 2000
          },
          "revenueAccountId": {
            "type": "integer",
            "nullable": true,
            "description": "Where a sale on this kind of class posts, from GET /v1/platform/revenue-accounts. Leave it unset and the sale posts to whichever account the organization has marked default, resolved at the time of the sale."
          },
          "maxPartySize": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000,
            "default": 1,
            "description": "How many people one booking may bring, including the booker."
          },
          "showSpotsLeft": {
            "type": "boolean",
            "default": false,
            "description": "Whether member-facing class rows always show how many places are left. Off, a count appears only when the class is nearly full."
          },
          "allowMultiDay": {
            "type": "boolean",
            "default": false,
            "description": "Whether a class of this kind may run across more than one calendar day."
          },
          "cancelIfAttendanceZero": {
            "type": "boolean",
            "default": false,
            "description": "Whether a class with nobody booked cancels itself."
          },
          "cancelIfAttendanceZeroHoursInAdvance": {
            "type": "integer",
            "minimum": 0,
            "maximum": 720,
            "default": 0,
            "description": "Hours before the start that cancellation runs. Meaningless unless `cancelIfAttendanceZero`."
          },
          "bookingAudience": {
            "$ref": "#/components/schemas/PlatformContactAudience"
          },
          "sport": {
            "type": "string",
            "nullable": true,
            "description": "The sport classes of this kind are for, a canonical sport id such as \"jiu-jitsu\". A default only: each class still carries its own `sport`. An unrecognised value is rejected."
          },
          "ageGroups": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "baby",
                "preschool",
                "child",
                "preteen",
                "junior",
                "adult",
                "senior"
              ]
            },
            "description": "Who a class of this kind is for: every age band it suits (baby 0–2, preschool 3–5, child 6–9, preteen 10–12, junior 13–17, adult 18–64, senior 65+), the same bands the age smart tags use. Stored youngest first, each once; a class for every age lists all of them, and an empty list means the club has not said. Search on the 1club network filters on it."
          },
          "ageGroup": {
            "type": "string",
            "nullable": true,
            "deprecated": true,
            "enum": [
              "infant",
              "child",
              "junior",
              "adult",
              "senior",
              "all_ages"
            ],
            "description": "Deprecated - use `ageGroups`. The single age group from before a class type could name several bands, kept for one release. Read: the old value that names exactly `ageGroups` (`infant` is baby and preschool, `child` is child and preteen, `all_ages` is every band), else null. Write: read only when `ageGroups` is absent, mapped the same way, null clearing. Sending back the value a read reported changes nothing, and it never replaces bands no old value names - set those with `ageGroups`."
          },
          "difficulty": {
            "type": "string",
            "nullable": true,
            "enum": [
              "beginner",
              "intermediate",
              "advanced",
              "all_levels"
            ],
            "description": "How hard a class of this kind is. Search on the 1club network filters on it. Not a rank: see `programId`."
          },
          "programId": {
            "type": "integer",
            "nullable": true,
            "description": "The program this kind of class belongs to, from GET /v1/platform/programs. Its sessions count toward the program's progression track. Plans cover class types, not programs, so moving a class type between programs changes no plan."
          },
          "progressionTrackId": {
            "type": "integer",
            "nullable": true,
            "deprecated": true,
            "description": "Deprecated: set `programId` instead; the track a class type counts toward is its program's. Still accepted when `programId` is absent: a track puts the class type in the organization's one program counting toward that track (400 when none or several do), and null takes it out of its program."
          }
        }
      },
      "PlatformInstructorTypeCreate": {
        "type": "object",
        "description": "Fields accepted when creating an instructor type. Only `name` is required; `slug` is derived from it when omitted, and suffixed if that is taken. The defaults shown are what an omitted field becomes, and unknown fields are rejected.",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "slug": {
            "type": "string",
            "maxLength": 120,
            "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
            "description": "Stable key. Derived from the name when omitted; send one only when something outside 1club already refers to it. An explicit slug that clashes is a 409, and a rename never moves it."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 2000
          },
          "revenueAccountId": {
            "type": "integer",
            "nullable": true,
            "description": "Where a session with a coach of this kind posts, from GET /v1/platform/revenue-accounts. Leave it unset and the sale posts to whichever account the organization has marked default, resolved at the time of the sale."
          },
          "maxConcurrentBookings": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 1,
            "description": "How many one-to-one sessions a coach of this kind may hold in the same slot."
          },
          "maxPlayers": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20,
            "default": 1,
            "description": "How many people one session with a coach of this kind may bring, the person booking included. 1 is one-to-one. A session with them and no area may be booked for any group up to this; a session on an area takes the area's own player limit instead."
          }
        }
      },
      "PlatformInstructorTypeUpdate": {
        "type": "object",
        "description": "Fields accepted when updating an instructor type. Send only what changes; `null` clears a nullable field, an omitted field is left alone, and at least one is required. A rename does not move `slug`. `maxConcurrentBookings` is the shape of the type; what a booking is checked against is each instructor's own value. `maxPlayers` is not: every instructor of the type reads it live, so changing it changes every one of their sessions.",
        "minProperties": 1,
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "slug": {
            "type": "string",
            "maxLength": 120,
            "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
            "description": "Stable key. Derived from the name when omitted; send one only when something outside 1club already refers to it. An explicit slug that clashes is a 409, and a rename never moves it."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 2000
          },
          "revenueAccountId": {
            "type": "integer",
            "nullable": true,
            "description": "Where a session with a coach of this kind posts, from GET /v1/platform/revenue-accounts. Leave it unset and the sale posts to whichever account the organization has marked default, resolved at the time of the sale."
          },
          "maxConcurrentBookings": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 1,
            "description": "How many one-to-one sessions a coach of this kind may hold in the same slot."
          },
          "maxPlayers": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20,
            "default": 1,
            "description": "How many people one session with a coach of this kind may bring, the person booking included. 1 is one-to-one. A session with them and no area may be booked for any group up to this; a session on an area takes the area's own player limit instead."
          }
        }
      },
      "PlatformClassType": {
        "type": "object",
        "description": "A kind of class the organization runs. Reference the `id` as `classTypeId` on a class, or in `classTypeIds` on a class pay rate policy. One shape for the list, get-by-id, create and update.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string",
            "description": "Stable key, derived from the name when a create does not send one. A rename never moves it."
          },
          "sortOrder": {
            "type": "integer",
            "description": "Position in the order staff set in Settings, 1 first. Lists come back in this order; change it with the type's PUT .../order."
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "revenueAccountId": {
            "type": "integer",
            "nullable": true,
            "description": "Where a sale on this kind of class posts. Null falls back to the organization's default account."
          },
          "classCount": {
            "type": "integer",
            "description": "Classes currently run as this type, past and future."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "maxPartySize": {
            "type": "integer",
            "description": "How many people one booking on a class of this kind may bring, including the booker."
          },
          "showSpotsLeft": {
            "type": "boolean",
            "description": "Whether member-facing class rows always show how many places are left. Off, a count appears only when the class is nearly full."
          },
          "allowMultiDay": {
            "type": "boolean",
            "description": "Whether a class of this kind may run across more than one calendar day."
          },
          "cancelIfAttendanceZero": {
            "type": "boolean",
            "description": "Whether a class with nobody booked cancels itself."
          },
          "cancelIfAttendanceZeroHoursInAdvance": {
            "type": "integer",
            "description": "Hours before the start that cancellation runs. Meaningless unless `cancelIfAttendanceZero`."
          },
          "bookingAudience": {
            "$ref": "#/components/schemas/PlatformContactAudience"
          },
          "sport": {
            "type": "string",
            "nullable": true,
            "description": "The sport classes of this kind are for, a canonical sport id such as \"jiu-jitsu\". A default only: each class still carries its own `sport`. An unrecognised value is rejected."
          },
          "ageGroups": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "baby",
                "preschool",
                "child",
                "preteen",
                "junior",
                "adult",
                "senior"
              ]
            },
            "description": "Who a class of this kind is for: every age band it suits (baby 0–2, preschool 3–5, child 6–9, preteen 10–12, junior 13–17, adult 18–64, senior 65+), the same bands the age smart tags use. Stored youngest first, each once; a class for every age lists all of them, and an empty list means the club has not said. Search on the 1club network filters on it."
          },
          "ageGroup": {
            "type": "string",
            "nullable": true,
            "deprecated": true,
            "enum": [
              "infant",
              "child",
              "junior",
              "adult",
              "senior",
              "all_ages"
            ],
            "description": "Deprecated - use `ageGroups`. The single age group from before a class type could name several bands, kept for one release. Read: the old value that names exactly `ageGroups` (`infant` is baby and preschool, `child` is child and preteen, `all_ages` is every band), else null. Write: read only when `ageGroups` is absent, mapped the same way, null clearing. Sending back the value a read reported changes nothing, and it never replaces bands no old value names - set those with `ageGroups`."
          },
          "difficulty": {
            "type": "string",
            "nullable": true,
            "enum": [
              "beginner",
              "intermediate",
              "advanced",
              "all_levels"
            ],
            "description": "How hard a class of this kind is. Search on the 1club network filters on it. Not a rank: see `programId`."
          },
          "programId": {
            "type": "integer",
            "nullable": true,
            "description": "The program this kind of class belongs to, from GET /v1/platform/programs. Its sessions count toward the program's progression track. Plans cover class types, not programs, so moving a class type between programs changes no plan."
          },
          "progressionTrackId": {
            "type": "integer",
            "nullable": true,
            "readOnly": true,
            "description": "The progression track sessions of this kind count toward: its program's. Null counts toward none. Set it on the program."
          }
        }
      },
      "PlatformProgram": {
        "type": "object",
        "description": "What a student joins, e.g. \"Kids BJJ (7-12)\": a group of class types whose sessions count toward one progression track, and what the club website lists. Reference the `id` as `programId` on a class type. One shape for the list, get-by-id, create and update.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string",
            "description": "Stable key, derived from the name when a create does not send one. A rename never moves it."
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "imageUrl": {
            "type": "string",
            "nullable": true,
            "description": "Cover image shown where the program is listed, e.g. the website."
          },
          "color": {
            "type": "string",
            "nullable": true,
            "description": "Hex colour the program is shown in, e.g. \"#2563eb\"."
          },
          "sortOrder": {
            "type": "integer",
            "description": "Where the program is listed, lowest first."
          },
          "minAge": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "maximum": 120,
            "description": "Youngest age the program is for, in years. Display only: it does not gate booking."
          },
          "maxAge": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "maximum": 120,
            "description": "Oldest age the program is for, in years. Display only."
          },
          "progressionTrackId": {
            "type": "integer",
            "nullable": true,
            "description": "The progression track the sessions of its class types count toward, from GET /v1/platform/progression-tracks. Once any program points at a track, only sessions of those programs count toward its ranks. Must be a track the organization uses."
          },
          "classTypeCount": {
            "type": "integer",
            "description": "Class types in the program."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformProgramCreate": {
        "type": "object",
        "description": "Fields accepted when creating a program. Only `name` is required; `slug` is derived from it when omitted, and suffixed if that is taken. The defaults shown are what an omitted field becomes, and unknown fields are rejected.",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "slug": {
            "type": "string",
            "maxLength": 100
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "imageUrl": {
            "type": "string",
            "nullable": true,
            "description": "Cover image shown where the program is listed, e.g. the website."
          },
          "color": {
            "type": "string",
            "nullable": true,
            "description": "Hex colour the program is shown in, e.g. \"#2563eb\"."
          },
          "sortOrder": {
            "type": "integer",
            "description": "Where the program is listed, lowest first."
          },
          "minAge": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "maximum": 120,
            "description": "Youngest age the program is for, in years. Display only: it does not gate booking."
          },
          "maxAge": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "maximum": 120,
            "description": "Oldest age the program is for, in years. Display only."
          },
          "progressionTrackId": {
            "type": "integer",
            "nullable": true,
            "description": "The progression track the sessions of its class types count toward, from GET /v1/platform/progression-tracks. Once any program points at a track, only sessions of those programs count toward its ranks. Must be a track the organization uses."
          }
        }
      },
      "PlatformProgramUpdate": {
        "type": "object",
        "description": "Fields accepted when updating a program. Send only what changes; `null` clears a nullable field, an omitted field is left alone, and at least one is required. A rename does not move `slug`.",
        "minProperties": 1,
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "slug": {
            "type": "string",
            "maxLength": 100
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "imageUrl": {
            "type": "string",
            "nullable": true,
            "description": "Cover image shown where the program is listed, e.g. the website."
          },
          "color": {
            "type": "string",
            "nullable": true,
            "description": "Hex colour the program is shown in, e.g. \"#2563eb\"."
          },
          "sortOrder": {
            "type": "integer",
            "description": "Where the program is listed, lowest first."
          },
          "minAge": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "maximum": 120,
            "description": "Youngest age the program is for, in years. Display only: it does not gate booking."
          },
          "maxAge": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "maximum": 120,
            "description": "Oldest age the program is for, in years. Display only."
          },
          "progressionTrackId": {
            "type": "integer",
            "nullable": true,
            "description": "The progression track the sessions of its class types count toward, from GET /v1/platform/progression-tracks. Once any program points at a track, only sessions of those programs count toward its ranks. Must be a track the organization uses."
          }
        }
      },
      "PlatformProgressionTrack": {
        "type": "object",
        "description": "A ladder of ranks in one discipline that the organization uses. Reference the `id` as `progressionTrackId` on a program to make the sessions of its class types count toward these ranks.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "sport": {
            "type": "string",
            "description": "Canonical sport id the ladder belongs to, e.g. \"jiu-jitsu\"."
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "custom": {
            "type": "boolean",
            "description": "True for the organization's own track, or its copy of a template; false for a global template."
          },
          "enabled": {
            "type": "boolean",
            "description": "Whether the organization uses it: always for its own tracks, and for a template once enabled."
          },
          "levelCount": {
            "type": "integer",
            "description": "How many ranks the ladder has."
          },
          "programIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Programs counting toward this track."
          },
          "classTypeIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Class types whose sessions count toward this track: those of its programs. Empty means every session counts; once any is linked, only sessions of the linked types do."
          }
        }
      },
      "PlatformProgressionLevel": {
        "type": "object",
        "description": "One rank on a progression track.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "skill": {
            "type": "string",
            "description": "The rank, e.g. \"Blue Belt\"."
          },
          "level": {
            "type": "string",
            "description": "The step within the rank when the discipline has one, e.g. \"3rd Dan\"; usually empty."
          },
          "name": {
            "type": "string",
            "description": "`skill` and `level` together, as the dashboard shows them."
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "color": {
            "type": "string",
            "nullable": true,
            "description": "Hex colour, e.g. \"#2563eb\"."
          },
          "requiredSessions": {
            "type": "integer",
            "nullable": true,
            "description": "Sessions a member attends at the rank below before they are eligible for this one."
          },
          "requiredDays": {
            "type": "integer",
            "nullable": true,
            "description": "Days a member holds the rank below before they are eligible for this one."
          },
          "ageOutLevelId": {
            "type": "integer",
            "nullable": true,
            "description": "The rank members continue at on the track this one ages out onto; that track's first rank when null."
          }
        }
      },
      "PlatformProgressionTrackDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PlatformProgressionTrack"
          },
          {
            "type": "object",
            "properties": {
              "maxStripes": {
                "type": "integer",
                "description": "Most stripes a member earns within a rank; 0 when the discipline has none."
              },
              "ageOutAge": {
                "type": "integer",
                "nullable": true,
                "description": "The age at which members continue on `ageOutTrackId`."
              },
              "ageOutTrackId": {
                "type": "integer",
                "nullable": true
              },
              "templateId": {
                "type": "integer",
                "nullable": true,
                "description": "The global template this track was copied from."
              },
              "levels": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PlatformProgressionLevel"
                },
                "description": "The ladder, lowest rank first."
              }
            }
          }
        ]
      },
      "PlatformProgressionLevelWrite": {
        "type": "object",
        "description": "A level in a saved ladder. With `id` an existing level is kept and only the fields sent change; without, a new one is added and `skill` is required.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "skill": {
            "type": "string",
            "maxLength": 100
          },
          "level": {
            "type": "string",
            "maxLength": 100
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "color": {
            "type": "string",
            "nullable": true
          },
          "requiredSessions": {
            "type": "integer",
            "nullable": true,
            "minimum": 1
          },
          "requiredDays": {
            "type": "integer",
            "nullable": true,
            "minimum": 1
          },
          "ageOutLevelId": {
            "type": "integer",
            "nullable": true
          }
        }
      },
      "PlatformProgressionTrackUpdate": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "For a global template only, and the only field it takes: start or stop using it."
          },
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "sport": {
            "type": "string",
            "description": "Canonical sport id, e.g. \"jiu-jitsu\"."
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "maxStripes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10
          },
          "ageOutAge": {
            "type": "integer",
            "nullable": true,
            "minimum": 1,
            "maximum": 100
          },
          "ageOutTrackId": {
            "type": "integer",
            "nullable": true,
            "description": "Another track the organization uses, that members continue on at `ageOutAge`."
          },
          "levels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformProgressionLevelWrite"
            },
            "description": "The whole ladder, lowest rank first. A level left out is removed."
          }
        }
      },
      "PlatformProgressionTrackCreate": {
        "type": "object",
        "description": "A new track needs `name` and `sport`; a copy of a template needs only `fromTemplateId`.",
        "properties": {
          "fromTemplateId": {
            "type": "integer",
            "description": "A global template to copy into the organization's own. Not with `levels`."
          },
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "sport": {
            "type": "string",
            "description": "Canonical sport id, e.g. \"jiu-jitsu\"."
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "maxStripes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10
          },
          "ageOutAge": {
            "type": "integer",
            "nullable": true,
            "minimum": 1,
            "maximum": 100
          },
          "ageOutTrackId": {
            "type": "integer",
            "nullable": true
          },
          "levels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformProgressionLevelWrite"
            },
            "description": "The ladder, lowest rank first."
          }
        }
      },
      "PlatformPromotionProgress": {
        "type": "object",
        "nullable": true,
        "description": "How close a member is to the next rank, against each requirement it sets. Null at the track's top rank, or when the next rank sets no requirement.",
        "properties": {
          "nextLevel": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer"
              },
              "skill": {
                "type": "string"
              },
              "level": {
                "type": "string"
              },
              "color": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "sessions": {
            "type": "integer",
            "description": "Sessions attended since the current rank was earned."
          },
          "requiredSessions": {
            "type": "integer",
            "nullable": true
          },
          "days": {
            "type": "integer",
            "description": "Days at the current rank, on the club's clock."
          },
          "requiredDays": {
            "type": "integer",
            "nullable": true
          },
          "learnedItems": {
            "type": "integer",
            "description": "Skills of the next rank's curriculum learned."
          },
          "requiredItems": {
            "type": "integer",
            "nullable": true
          },
          "eligible": {
            "type": "boolean",
            "description": "Every requirement the next rank sets is met. A signal only: the rank changes when staff give it."
          }
        }
      },
      "PlatformTrackMember": {
        "type": "object",
        "properties": {
          "contact": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer"
              },
              "firstName": {
                "type": "string"
              },
              "lastName": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "levelId": {
            "type": "integer"
          },
          "levelName": {
            "type": "string"
          },
          "color": {
            "type": "string",
            "nullable": true
          },
          "stripes": {
            "type": "integer"
          },
          "earnedOn": {
            "type": "string",
            "format": "date",
            "description": "The calendar date the rank was earned."
          },
          "promotionProgress": {
            "$ref": "#/components/schemas/PlatformPromotionProgress"
          }
        }
      },
      "PlatformTrackMemberPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTrackMember"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total members matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformContactProgression": {
        "type": "object",
        "properties": {
          "contactId": {
            "type": "integer"
          },
          "ranks": {
            "type": "array",
            "description": "The current rank on each track the organization uses.",
            "items": {
              "type": "object",
              "properties": {
                "trackId": {
                  "type": "integer"
                },
                "trackName": {
                  "type": "string"
                },
                "levelId": {
                  "type": "integer"
                },
                "levelName": {
                  "type": "string"
                },
                "color": {
                  "type": "string",
                  "nullable": true
                },
                "stripes": {
                  "type": "integer"
                },
                "earnedOn": {
                  "type": "string",
                  "format": "date"
                },
                "promotionProgress": {
                  "$ref": "#/components/schemas/PlatformPromotionProgress"
                }
              }
            }
          },
          "timeline": {
            "type": "array",
            "description": "Every rank and stripe recorded, latest earned first.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "trackId": {
                  "type": "integer"
                },
                "trackName": {
                  "type": "string"
                },
                "levelId": {
                  "type": "integer"
                },
                "levelName": {
                  "type": "string"
                },
                "stripes": {
                  "type": "integer"
                },
                "earnedOn": {
                  "type": "string",
                  "format": "date"
                }
              }
            }
          }
        }
      },
      "PlatformProgressionRankRequest": {
        "type": "object",
        "required": [
          "contactIds"
        ],
        "description": "Exactly one of `levelId` and `next`.",
        "properties": {
          "contactIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "minItems": 1,
            "maxItems": 100
          },
          "levelId": {
            "type": "integer",
            "description": "The rank to give, a level of this track."
          },
          "next": {
            "type": "boolean",
            "description": "True for each member's own next rank, stripes back to zero."
          },
          "stripes": {
            "type": "integer",
            "minimum": 0,
            "description": "Stripes at `levelId`, up to the track's `maxStripes`."
          },
          "earnedOn": {
            "type": "string",
            "format": "date",
            "description": "The calendar date it was earned; today when omitted. May be in the past."
          },
          "notifyMember": {
            "type": "boolean",
            "default": true,
            "description": "Tell the member about a move forward. False when recording ranks they already hold."
          }
        }
      },
      "PlatformProgressionRankResult": {
        "type": "object",
        "properties": {
          "assigned": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "contactId": {
                  "type": "integer"
                },
                "levelId": {
                  "type": "integer"
                }
              }
            }
          },
          "skipped": {
            "type": "array",
            "description": "Left as they were by `next`: no rank on the track to move up from (`no_rank`), already at its top (`top_rank`), or holding a rank or stripe earned after `earnedOn` (`later_assignment`), which a step dated earlier would never replace.",
            "items": {
              "type": "object",
              "properties": {
                "contactId": {
                  "type": "integer"
                },
                "reason": {
                  "type": "string",
                  "enum": [
                    "no_rank",
                    "top_rank",
                    "later_assignment"
                  ]
                }
              }
            }
          },
          "failed": {
            "type": "array",
            "description": "Failed; everyone else was still ranked.",
            "items": {
              "type": "object",
              "properties": {
                "contactId": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "PlatformInstructorType": {
        "type": "object",
        "description": "A kind of coach the organization has. Reference the `id` as `instructorTypeId` on an instructor. One shape for the list, get-by-id, create and update.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string",
            "description": "Stable key, derived from the name when a create does not send one. A rename never moves it."
          },
          "sortOrder": {
            "type": "integer",
            "description": "Position in the order staff set in Settings, 1 first. Lists come back in this order; change it with the type's PUT .../order."
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "revenueAccountId": {
            "type": "integer",
            "nullable": true,
            "description": "Where a session with a coach of this kind posts. Null falls back to the organization's default account."
          },
          "instructorCount": {
            "type": "integer",
            "description": "Coaches currently filed under this type, active and retired."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "maxConcurrentBookings": {
            "type": "integer",
            "description": "How many one-to-one sessions a coach of this kind may hold in the same slot. What a booking is actually checked against is the instructor's own value; this is the shape of the type, not an override."
          },
          "maxPlayers": {
            "type": "integer",
            "description": "How many people one session with a coach of this kind may bring, the person booking included. 1 is one-to-one. A session with them and no area may be booked for any group up to this; a session on an area takes the area's own player limit instead."
          }
        }
      },
      "PlatformTypeOrder": {
        "type": "object",
        "description": "A new order for the organization's instructor, class or area types.",
        "required": [
          "orderedIds"
        ],
        "additionalProperties": false,
        "properties": {
          "orderedIds": {
            "type": "array",
            "minItems": 1,
            "maxItems": 500,
            "items": {
              "type": "integer"
            },
            "description": "The type ids, first to last. A type left out keeps its place after the listed ones."
          }
        }
      },
      "PlatformContactAudience": {
        "type": "object",
        "description": "Who something applies to, as a set of predicates a contact must match. `null` means everybody. The same shape a promotion segment and an automation entry condition use. `membershipPlanIds` is which plan the contact must HOLD, not which plan a purchase discounts.",
        "nullable": true,
        "properties": {
          "memberTypes": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "string"
            },
            "description": "Values of the contact's `type`, e.g. `member`, `lead`."
          },
          "tags": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "oneOf": [
                {
                  "type": "string",
                  "maxLength": 100
                },
                {
                  "type": "integer"
                }
              ]
            },
            "description": "Tag ids or names the contact carries."
          },
          "membershipPlanIds": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "type": "integer"
            },
            "description": "Membership plans the contact must hold, from GET /v1/platform/plans."
          },
          "membershipPlanCategoryIds": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "type": "integer"
            },
            "description": "Plan categories the contact must hold a plan in."
          },
          "progressionLevelIds": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "type": "integer"
            },
            "description": "Progression levels the contact must hold, each counting that level or above on its track: \"blue belt and up\". The contact's current rank is its latest earned one."
          }
        }
      },
      "PlatformPayRatePolicyEarnings": {
        "type": "object",
        "description": "What the coach earns, and for what unit of work. `kind` decides which of the rate fields apply and which are rejected: an `individual` policy takes `perSession`, `perAdditionalPlayer` and `sessionRevenuePercentage`, a `class` policy takes `perClass`, `perBooking` and `classRevenuePercentage`. At least one of the applicable rates must be greater than zero, and `kind` cannot be changed once the policy exists.",
        "required": [
          "kind"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "individual",
              "class"
            ]
          },
          "perSession": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "description": "Individual policies: a flat amount for each private session."
          },
          "perAdditionalPlayer": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "description": "Individual policies: added to `perSession` for each person beyond the first in the group a session with no area was booked for (see the instructor type `maxPlayers`). A one-to-one session earns nothing from it."
          },
          "sessionRevenuePercentage": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "maximum": 100,
            "description": "Individual policies: a share of what the session took (see `sessionRevenueBase`)."
          },
          "sessionRevenueBase": {
            "type": "string",
            "enum": [
              "session",
              "coach_charge"
            ],
            "default": "session",
            "description": "Individual policies: what `sessionRevenuePercentage` is a share of. `session` (the default) is the whole session's price, court included. `coach_charge` is only the coach's own charge - the coach half of a court booked with a coach - so 100% pays a coach exactly the fee the member paid for them. Left out of an update, it stays as it was."
          },
          "perClass": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "description": "Class policies: a flat amount for running the class at all."
          },
          "perBooking": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "description": "Class policies: a flat amount for each attendee."
          },
          "classRevenuePercentage": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "maximum": 100,
            "description": "Class policies: a share of what the class took."
          }
        }
      },
      "PlatformPayRateEntranceScope": {
        "type": "object",
        "description": "One way an attendee got in, narrowing what a policy pays for. `membershipPlanId` applies only to `membership`, and `externalProgramId` only to `external_program`; sending the wrong pairing is a 400.",
        "required": [
          "entranceMethod"
        ],
        "properties": {
          "entranceMethod": {
            "type": "string",
            "enum": [
              "direct_payment",
              "membership",
              "external_program"
            ]
          },
          "membershipPlanId": {
            "type": "integer",
            "nullable": true,
            "description": "Narrow to one membership plan, from GET /v1/platform/plans."
          },
          "externalProgramId": {
            "type": "integer",
            "nullable": true,
            "description": "Narrow to one external program."
          }
        }
      },
      "PlatformPayRatePolicy": {
        "type": "object",
        "description": "A rule for what the club pays a coach. Not an instructor's `hourlyRate`, which is what a member pays for an hour of their time. Each coverage list means \"everything\" when empty: no `instructors` makes it the organization default, no `classTypes` covers every class type, no `entranceScopes` covers every way in.",
        "properties": {
          "policyId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "individual",
              "class"
            ]
          },
          "earnings": {
            "$ref": "#/components/schemas/PlatformPayRatePolicyEarnings"
          },
          "requirePaidBooking": {
            "type": "boolean"
          },
          "instructors": {
            "type": "array",
            "description": "Coaches this policy covers. Empty means every coach with no policy of their own.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "name": {
                  "type": "string",
                  "nullable": true
                }
              }
            }
          },
          "classTypes": {
            "type": "array",
            "description": "Class types it covers. Empty means every class type.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "name": {
                  "type": "string"
                }
              }
            }
          },
          "entranceScopes": {
            "type": "array",
            "description": "How the attendee got in. Empty means every route in.",
            "items": {
              "$ref": "#/components/schemas/PlatformPayRateEntranceScope"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformPayRatePolicyCreate": {
        "type": "object",
        "description": "Fields accepted when creating a pay rate policy. `instructorIds` must be present: an empty list is the organization default and applies to every coach without a policy of their own, so it has to be asked for rather than fallen into. The other coverage lists mean \"everything\" when omitted.",
        "required": [
          "name",
          "earnings",
          "instructorIds"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "earnings": {
            "$ref": "#/components/schemas/PlatformPayRatePolicyEarnings"
          },
          "requirePaidBooking": {
            "type": "boolean",
            "default": false,
            "description": "When true, attendance that was never paid for earns the coach nothing."
          },
          "instructorIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Coaches this policy covers. An empty list makes it the organization default, applying to every coach with no policy of their own."
          },
          "classTypeIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Class types it covers, from GET /v1/platform/class-types. Empty covers every class type. Rejected on an `individual` policy, which has no classes to scope."
          },
          "entranceScopes": {
            "type": "array",
            "description": "How the attendee got in. Empty covers every route in.",
            "items": {
              "$ref": "#/components/schemas/PlatformPayRateEntranceScope"
            }
          }
        }
      },
      "PlatformPayRatePolicyUpdate": {
        "type": "object",
        "description": "Fields accepted when updating a pay rate policy. Send only what changes; an omitted field is left alone, and any list that IS sent replaces the whole set. `earnings.kind` must match the policy's existing kind.",
        "minProperties": 1,
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "earnings": {
            "$ref": "#/components/schemas/PlatformPayRatePolicyEarnings"
          },
          "requirePaidBooking": {
            "type": "boolean",
            "default": false,
            "description": "When true, attendance that was never paid for earns the coach nothing."
          },
          "instructorIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Coaches this policy covers. An empty list makes it the organization default, applying to every coach with no policy of their own."
          },
          "classTypeIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Class types it covers, from GET /v1/platform/class-types. Empty covers every class type. Rejected on an `individual` policy, which has no classes to scope."
          },
          "entranceScopes": {
            "type": "array",
            "description": "How the attendee got in. Empty covers every route in.",
            "items": {
              "$ref": "#/components/schemas/PlatformPayRateEntranceScope"
            }
          }
        }
      },
      "PlatformPayLedgerLine": {
        "type": "object",
        "description": "One unit of work a coach is paid for - a private session, a class, or an attendee of a class - and what it paid under the coach's pay rate policy. `pending` is work the paid-booking gate is holding back: `totalAmount` is what it will pay once the member settles, and nothing is owed yet.",
        "properties": {
          "instructorId": {
            "type": "integer"
          },
          "instructorName": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "individual_booking",
              "class_booking",
              "class_session",
              "class_checkin"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "earned",
              "pending"
            ]
          },
          "bookingId": {
            "type": "integer",
            "nullable": true
          },
          "checkinId": {
            "type": "integer",
            "nullable": true
          },
          "classId": {
            "type": "integer",
            "nullable": true
          },
          "className": {
            "type": "string",
            "nullable": true
          },
          "classTypeId": {
            "type": "integer",
            "nullable": true
          },
          "club": {
            "type": "object",
            "nullable": true,
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "area": {
            "type": "object",
            "nullable": true,
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "entranceMethod": {
            "type": "string",
            "nullable": true,
            "enum": [
              "direct_payment",
              "membership",
              "external_program"
            ]
          },
          "startTime": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "endTime": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "revenueBase": {
            "type": "number",
            "nullable": true,
            "description": "What the work took, before the coach was paid - the base a revenue percentage applies to."
          },
          "components": {
            "type": "array",
            "description": "How `totalAmount` was reached: each rate that applied and what it added.",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "amount": {
                  "type": "number"
                },
                "rate": {
                  "type": "number",
                  "nullable": true
                },
                "baseAmount": {
                  "type": "number",
                  "nullable": true
                }
              }
            }
          },
          "totalAmount": {
            "type": "number"
          }
        }
      },
      "PlatformShiftBreak": {
        "type": "object",
        "required": [
          "name",
          "startTime",
          "endTime"
        ],
        "properties": {
          "name": {
            "type": "string",
            "example": "Lunch"
          },
          "startTime": {
            "type": "string",
            "example": "12:00",
            "description": "Wall-clock `HH:mm` on a template; an ISO instant on a shift."
          },
          "endTime": {
            "type": "string",
            "example": "12:30"
          }
        }
      },
      "PlatformShiftTemplate": {
        "type": "object",
        "description": "A named shift a roster is built from, on the wall clock of the club it is worked at.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "clubId": {
            "type": "integer",
            "nullable": true,
            "description": "Null means every club of the organization."
          },
          "name": {
            "type": "string"
          },
          "startTime": {
            "type": "string",
            "example": "06:00"
          },
          "endTime": {
            "type": "string",
            "example": "14:00"
          },
          "color": {
            "type": "string"
          },
          "displayOrder": {
            "type": "integer"
          },
          "isActive": {
            "type": "boolean"
          },
          "breaks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformShiftBreak"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformShiftTemplateWrite": {
        "type": "object",
        "description": "A shift template. On create `name`, `startTime` and `endTime` are required; on update send only what changes, and `breaks`, when sent, replaces the whole set.",
        "properties": {
          "name": {
            "type": "string"
          },
          "clubId": {
            "type": "integer",
            "nullable": true
          },
          "startTime": {
            "type": "string",
            "example": "06:00",
            "description": "`HH:mm`, 24-hour"
          },
          "endTime": {
            "type": "string",
            "example": "14:00",
            "description": "`HH:mm`, 24-hour, after `startTime`"
          },
          "color": {
            "type": "string"
          },
          "displayOrder": {
            "type": "integer"
          },
          "isActive": {
            "type": "boolean"
          },
          "breaks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformShiftBreak"
            },
            "description": "Each inside the shift window."
          }
        }
      },
      "PlatformShiftRotationSlot": {
        "type": "object",
        "required": [
          "weekIndex",
          "dayOfWeek"
        ],
        "properties": {
          "weekIndex": {
            "type": "integer",
            "description": "Zero-based week of the cycle, below `cycleWeeks`."
          },
          "dayOfWeek": {
            "type": "string",
            "enum": [
              "monday",
              "tuesday",
              "wednesday",
              "thursday",
              "friday",
              "saturday",
              "sunday"
            ]
          },
          "shiftTemplateId": {
            "type": "integer",
            "nullable": true,
            "description": "The shift worked that day. Null, or a day with no slot, is a day off."
          },
          "shiftTemplateName": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          }
        }
      },
      "PlatformShiftRotation": {
        "type": "object",
        "description": "A weekly pattern of shifts, one to twelve weeks long, that coaches are assigned to.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "clubId": {
            "type": "integer",
            "nullable": true
          },
          "name": {
            "type": "string"
          },
          "cycleWeeks": {
            "type": "integer"
          },
          "weekStartsOn": {
            "type": "integer",
            "description": "0 is Sunday, 1 Monday."
          },
          "anchorDate": {
            "type": "string",
            "format": "date",
            "description": "The first day of week 1 of the cycle."
          },
          "isActive": {
            "type": "boolean"
          },
          "slots": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformShiftRotationSlot"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformShiftRotationWrite": {
        "type": "object",
        "description": "A rotation. On create `name` and `cycleWeeks` are required; on update send only what changes, and `slots`, when sent, replaces the whole pattern.",
        "properties": {
          "name": {
            "type": "string"
          },
          "clubId": {
            "type": "integer",
            "nullable": true
          },
          "cycleWeeks": {
            "type": "integer",
            "minimum": 1,
            "maximum": 12
          },
          "weekStartsOn": {
            "type": "integer",
            "minimum": 0,
            "maximum": 6
          },
          "anchorDate": {
            "type": "string",
            "format": "date",
            "description": "First day of week 1. Defaults to today."
          },
          "isActive": {
            "type": "boolean"
          },
          "slots": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformShiftRotationSlot"
            }
          }
        }
      },
      "PlatformShiftRotationAssignment": {
        "type": "object",
        "description": "A coach on a rotation over a range of days.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "instructorId": {
            "type": "integer"
          },
          "instructorName": {
            "type": "string"
          },
          "rotationId": {
            "type": "integer"
          },
          "rotationName": {
            "type": "string"
          },
          "cycleOffset": {
            "type": "integer",
            "description": "Zero-based week of the cycle the coach starts on."
          },
          "effectiveFrom": {
            "type": "string",
            "format": "date"
          },
          "effectiveTo": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Null is open-ended."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformShiftRotationAssignmentResult": {
        "type": "object",
        "properties": {
          "assignment": {
            "$ref": "#/components/schemas/PlatformShiftRotationAssignment"
          },
          "generated": {
            "type": "object",
            "description": "Shifts materialized on the staff roster by this write.",
            "properties": {
              "created": {
                "type": "integer"
              },
              "updated": {
                "type": "integer"
              },
              "skipped": {
                "type": "integer"
              }
            }
          }
        }
      },
      "PlatformInstructorShift": {
        "type": "object",
        "description": "One shift on the staff roster: when a coach works on one day. This is what their availability reads.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "instructorId": {
            "type": "integer"
          },
          "instructorName": {
            "type": "string",
            "nullable": true
          },
          "clubId": {
            "type": "integer",
            "nullable": true
          },
          "date": {
            "type": "string",
            "format": "date",
            "description": "The day the shift starts on, on the club clock."
          },
          "startTime": {
            "type": "string",
            "format": "date-time"
          },
          "endTime": {
            "type": "string",
            "format": "date-time"
          },
          "breaks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformShiftBreak"
            }
          },
          "source": {
            "type": "string",
            "enum": [
              "rotation",
              "manual"
            ]
          },
          "rotationAssignmentId": {
            "type": "integer",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "scheduled",
              "cancelled"
            ]
          },
          "isOverride": {
            "type": "boolean",
            "description": "Edited by hand: regenerating the rotation leaves it as it is."
          },
          "note": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "PlatformInstructorTimeOff": {
        "type": "object",
        "description": "A window a coach cannot be booked in, whatever their staff roster says.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "instructorId": {
            "type": "integer"
          },
          "instructorName": {
            "type": "string",
            "nullable": true
          },
          "startTime": {
            "type": "string",
            "format": "date-time"
          },
          "endTime": {
            "type": "string",
            "format": "date-time"
          },
          "note": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformInstructorTimeOffConflict": {
        "type": "object",
        "description": "A booking or class already on the coach diary inside a time-off window. Time off leaves it in place.",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "booking",
              "class"
            ]
          },
          "id": {
            "type": "integer",
            "description": "The booking id, or the class id."
          },
          "startTime": {
            "type": "string",
            "format": "date-time"
          },
          "endTime": {
            "type": "string",
            "format": "date-time"
          },
          "className": {
            "type": "string",
            "nullable": true
          },
          "areaName": {
            "type": "string",
            "nullable": true
          },
          "attendeeCount": {
            "type": "integer"
          },
          "seasonId": {
            "type": "integer",
            "nullable": true,
            "description": "Set on a week of a contracted Season Slot, which is moved to another coach rather than cancelled."
          }
        }
      },
      "PlatformPlanCategory": {
        "type": "object",
        "description": "How membership plans are grouped - the headings on a price list and the sections of a plans page.",
        "properties": {
          "categoryId": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "sortOrder": {
            "type": "integer",
            "description": "Ascending display order; ties fall back to name."
          },
          "planCount": {
            "type": "integer",
            "description": "Membership plans currently in this category, active and retired."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformRevenueAccount": {
        "type": "object",
        "description": "One account in the organization's chart of accounts. Reference the `id` as `revenueAccountId` on a membership plan, a product, a class type, an area type or an instructor type to decide where its sales post.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "description": "The chart-of-accounts code, which is how the club's bookkeeper names the account. Unique within the organization."
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "isActive": {
            "type": "boolean",
            "description": "False for an account retired from the chart. Still valid on existing rows; do not attach it to something new. Never false on the default."
          },
          "isDefault": {
            "type": "boolean",
            "description": "Where a sale posts when nothing on the item names an account. Exactly one account holds it, and it is always active."
          }
        }
      },
      "PlatformRevenueAccountCreate": {
        "type": "object",
        "description": "Fields accepted when creating a revenue account. `name` and `code` are required, and the code must be free within the organization. Unknown fields are rejected. The billing entity an account belongs to is not settable here - it is inherited, and re-pointing one rewrites who is selling.",
        "required": [
          "name",
          "code"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "code": {
            "type": "string",
            "maxLength": 50,
            "description": "The bookkeeper's code for the account, e.g. \"4000\". Unique within the organization; a clash is a 409."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 2000
          },
          "isActive": {
            "type": "boolean",
            "default": true,
            "description": "False retires the account. Everything already pointing at it keeps pointing at it; there is no delete. Refused for any request that would leave the default inactive - including the first account in an empty chart, which is always made the default."
          },
          "isDefault": {
            "type": "boolean",
            "default": false,
            "description": "Where a sale posts when the item names no account. Setting it true moves the default off whichever account currently holds it, in the same transaction and behind a per-organization lock. Ignored when the chart has no default yet - the first account always takes it, since creating one is the only way to give the organization a default. The default must be active, so anything landing an inactive one is refused."
          }
        }
      },
      "PlatformRevenueAccountUpdate": {
        "type": "object",
        "description": "Fields accepted when updating a revenue account. Send only what changes; an omitted field is left alone, and at least one is required. `isDefault: false` is refused only when this is the last account holding the default, or when the only other one is retired: the organization must be left with an active default. An organization carrying more than one default - possible from before this rule, or from a clone - can have the extras cleared, which is how that state is repaired.",
        "minProperties": 1,
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "code": {
            "type": "string",
            "maxLength": 50,
            "description": "The bookkeeper's code for the account, e.g. \"4000\". Unique within the organization; a clash is a 409."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 2000
          },
          "isActive": {
            "type": "boolean",
            "default": true,
            "description": "False retires the account. Everything already pointing at it keeps pointing at it; there is no delete. Refused for any request that would leave the default inactive - including the first account in an empty chart, which is always made the default."
          },
          "isDefault": {
            "type": "boolean",
            "default": false,
            "description": "Where a sale posts when the item names no account. Setting it true moves the default off whichever account currently holds it, in the same transaction and behind a per-organization lock. Ignored when the chart has no default yet - the first account always takes it, since creating one is the only way to give the organization a default. The default must be active, so anything landing an inactive one is refused."
          }
        }
      },
      "PlatformClubProfileUpdate": {
        "type": "object",
        "description": "Fields of a club's profile. Send only what changes; at least one is required. Text fields take null to clear. Unknown fields are rejected.",
        "minProperties": 1,
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "subtitle": {
            "type": "string",
            "nullable": true,
            "maxLength": 200
          },
          "gettingThere": {
            "type": "string",
            "nullable": true,
            "maxLength": 1000,
            "description": "How to reach the club, in the club's own words - parking, the nearest stop and station. Plain text; line breaks are kept. Shown on the club's website page."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 5000,
            "description": "Plain text; each blank-line-separated paragraph becomes a paragraph"
          },
          "address": {
            "type": "string",
            "nullable": true
          },
          "city": {
            "type": "string",
            "nullable": true
          },
          "state": {
            "type": "string",
            "nullable": true
          },
          "postalCode": {
            "type": "string",
            "nullable": true
          },
          "country": {
            "type": "string",
            "nullable": true
          },
          "countryCode": {
            "type": "string",
            "nullable": true,
            "description": "ISO 3166-1 alpha-2, e.g. `BG`"
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "format": "email",
            "nullable": true
          },
          "website": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "timezone": {
            "type": "string",
            "description": "IANA timezone, e.g. `Europe/Sofia`. Derived from the address when the address changes and this is not sent."
          },
          "operatingHours": {
            "type": "object",
            "description": "Opening hours by lower-case weekday; a day left out keeps its hours.",
            "properties": {
              "monday": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "openTime": {
                    "type": "string",
                    "example": "07:00"
                  },
                  "closeTime": {
                    "type": "string",
                    "example": "22:00"
                  },
                  "is24Hours": {
                    "type": "boolean"
                  }
                }
              },
              "tuesday": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "openTime": {
                    "type": "string",
                    "example": "07:00"
                  },
                  "closeTime": {
                    "type": "string",
                    "example": "22:00"
                  },
                  "is24Hours": {
                    "type": "boolean"
                  }
                }
              },
              "wednesday": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "openTime": {
                    "type": "string",
                    "example": "07:00"
                  },
                  "closeTime": {
                    "type": "string",
                    "example": "22:00"
                  },
                  "is24Hours": {
                    "type": "boolean"
                  }
                }
              },
              "thursday": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "openTime": {
                    "type": "string",
                    "example": "07:00"
                  },
                  "closeTime": {
                    "type": "string",
                    "example": "22:00"
                  },
                  "is24Hours": {
                    "type": "boolean"
                  }
                }
              },
              "friday": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "openTime": {
                    "type": "string",
                    "example": "07:00"
                  },
                  "closeTime": {
                    "type": "string",
                    "example": "22:00"
                  },
                  "is24Hours": {
                    "type": "boolean"
                  }
                }
              },
              "saturday": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "openTime": {
                    "type": "string",
                    "example": "07:00"
                  },
                  "closeTime": {
                    "type": "string",
                    "example": "22:00"
                  },
                  "is24Hours": {
                    "type": "boolean"
                  }
                }
              },
              "sunday": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "openTime": {
                    "type": "string",
                    "example": "07:00"
                  },
                  "closeTime": {
                    "type": "string",
                    "example": "22:00"
                  },
                  "is24Hours": {
                    "type": "boolean"
                  }
                }
              }
            }
          },
          "amenities": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sports": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Sport ids, e.g. `padel`, `yoga`"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "inactive"
            ],
            "description": "`inactive` hides the club from members while staff keep running it"
          }
        }
      },
      "PlatformStaffMember": {
        "type": "object",
        "properties": {
          "userId": {
            "type": "integer"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "role": {
            "type": "string",
            "enum": [
              "admin",
              "manager",
              "front_desk",
              "sales",
              "instructor"
            ]
          },
          "isOwner": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "description": "The membership status, e.g. `active`, or `invited` until the invitation is accepted"
          }
        }
      },
      "PlatformRolePermissionSet": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "admin",
              "manager",
              "front_desk",
              "sales",
              "instructor"
            ]
          },
          "modified": {
            "type": "boolean",
            "description": "True when the organization changed the role from 1club's default"
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Everything the role may do, as `module.action.scope`"
          }
        }
      },
      "PlatformRolePermissions": {
        "type": "object",
        "properties": {
          "roles": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformRolePermissionSet"
            }
          },
          "catalog": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            },
            "description": "The permissions a role can be given, by module"
          }
        }
      },
      "PlatformNotificationSettings": {
        "type": "object",
        "properties": {
          "roles": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string"
                },
                "userCount": {
                  "type": "integer",
                  "description": "How many people have the role"
                },
                "modified": {
                  "type": "boolean",
                  "description": "True when any of the role's categories differs from 1club's default"
                },
                "policies": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "category": {
                        "type": "string"
                      },
                      "isEnabled": {
                        "type": "boolean"
                      },
                      "channels": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "app",
                            "email",
                            "sms"
                          ]
                        }
                      },
                      "isLocked": {
                        "type": "boolean"
                      },
                      "isConfigured": {
                        "type": "boolean",
                        "description": "False while the organization keeps the default"
                      },
                      "overriddenUserCount": {
                        "type": "integer",
                        "description": "People in the role whose own choice outranks this default"
                      }
                    }
                  }
                }
              }
            }
          },
          "availableChannels": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "PlatformCustomField": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string",
            "description": "The field key, which a value is addressed by"
          },
          "label": {
            "type": "string",
            "description": "What staff and members read"
          },
          "type": {
            "type": "string",
            "enum": [
              "text",
              "textarea",
              "number",
              "boolean",
              "select",
              "date",
              "time",
              "email",
              "url",
              "phone"
            ]
          },
          "options": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "A `select` field's choices"
          },
          "required": {
            "type": "boolean"
          },
          "requireOnSignup": {
            "type": "boolean",
            "description": "Asked by every sign-up form"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Private",
              "Member_only",
              "Public"
            ],
            "description": "`Private`: staff only. Otherwise members see and edit it in the portal."
          },
          "appliesTo": {
            "type": "string",
            "enum": [
              "self",
              "dependent",
              "both"
            ],
            "description": "At sign-up: asked of the account holder, of each family member, or both"
          },
          "contactTypes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "member",
                "staff",
                "lead",
                "contact",
                "lapsed",
                "drop_in"
              ]
            },
            "description": "The contact types it applies to; empty means every contact"
          },
          "placeholder": {
            "type": "string",
            "nullable": true
          },
          "defaultValue": {
            "type": "string",
            "nullable": true
          },
          "isActive": {
            "type": "boolean"
          },
          "sortOrder": {
            "type": "integer"
          }
        }
      },
      "PlatformCustomFieldWrite": {
        "type": "object",
        "description": "A contact custom field. `name` and `type` are required on create; on update send only what changes. Unknown fields are rejected.",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "label": {
            "type": "string",
            "maxLength": 200,
            "description": "Defaults to the name"
          },
          "type": {
            "type": "string",
            "enum": [
              "text",
              "textarea",
              "number",
              "boolean",
              "select",
              "date",
              "time",
              "email",
              "url",
              "phone"
            ]
          },
          "options": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 100
          },
          "required": {
            "type": "boolean"
          },
          "requireOnSignup": {
            "type": "boolean"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Private",
              "Member_only",
              "Public"
            ]
          },
          "appliesTo": {
            "type": "string",
            "enum": [
              "self",
              "dependent",
              "both"
            ]
          },
          "contactTypes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "member",
                "staff",
                "lead",
                "contact",
                "lapsed",
                "drop_in"
              ]
            }
          },
          "placeholder": {
            "type": "string",
            "maxLength": 200
          },
          "defaultValue": {
            "type": "string",
            "maxLength": 500
          },
          "isActive": {
            "type": "boolean"
          }
        }
      },
      "PlatformContactCustomFieldValues": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "fieldId": {
                  "type": "integer"
                },
                "name": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "value": {
                  "type": "string",
                  "nullable": true
                }
              }
            }
          }
        }
      },
      "PlatformTag": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "manual",
              "system",
              "interest"
            ],
            "description": "`manual`: put on by people. `system`: a smart tag, applied from the smart tag rules. `interest`: applied from what a person books."
          },
          "color": {
            "type": "string",
            "nullable": true,
            "description": "Hex colour, e.g. `#3b82f6`"
          },
          "contactCount": {
            "type": "integer",
            "description": "How many contacts carry it now"
          }
        }
      },
      "PlatformTagWrite": {
        "type": "object",
        "description": "A manual tag. `name` is required on create; on update send only what changes.",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "color": {
            "type": "string",
            "nullable": true,
            "pattern": "^#[0-9a-fA-F]{6}$"
          }
        }
      },
      "PlatformContactTagsChange": {
        "type": "object",
        "required": [
          "contactIds",
          "tags"
        ],
        "properties": {
          "contactIds": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "type": "integer"
            }
          },
          "tags": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "items": {
              "oneOf": [
                {
                  "type": "integer",
                  "description": "A tag id"
                },
                {
                  "type": "string",
                  "description": "A tag name"
                }
              ]
            }
          }
        }
      },
      "PlatformContactTagsResult": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "contactId": {
                  "type": "integer"
                },
                "tags": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "integer"
                      },
                      "name": {
                        "type": "string"
                      },
                      "type": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "PlatformSmartTagSettings": {
        "type": "object",
        "description": "The smart tag rules, by category. Each tagged category is `{ enabled, tags: [{ id, name, color, ...threshold }] }`; `engagement` (attendance) also carries the `period` in days its tiers count visits over; `interest` is `{ enabled, minBookings }`; `scoring` is `{ enabled }`, switching on the engagement score, which is read from visits over the attendance period. On a PATCH, send only the categories that change.",
        "properties": {
          "engagement": {
            "type": "object",
            "additionalProperties": true
          },
          "financial": {
            "type": "object",
            "additionalProperties": true
          },
          "lifecycle": {
            "type": "object",
            "additionalProperties": true
          },
          "level": {
            "type": "object",
            "additionalProperties": true
          },
          "membership": {
            "type": "object",
            "additionalProperties": true
          },
          "age": {
            "type": "object",
            "additionalProperties": true
          },
          "newContact": {
            "type": "object",
            "additionalProperties": true
          },
          "paymentMethod": {
            "type": "object",
            "additionalProperties": true
          },
          "relationship": {
            "type": "object",
            "additionalProperties": true
          },
          "language": {
            "type": "object",
            "additionalProperties": true
          },
          "progression": {
            "type": "object",
            "additionalProperties": true
          },
          "assessment": {
            "type": "object",
            "additionalProperties": true
          },
          "trend": {
            "type": "object",
            "additionalProperties": true
          },
          "birthday": {
            "type": "object",
            "additionalProperties": true
          },
          "spending": {
            "type": "object",
            "additionalProperties": true
          },
          "atRisk": {
            "type": "object",
            "additionalProperties": true
          },
          "sessions": {
            "type": "object",
            "additionalProperties": true
          },
          "source": {
            "type": "object",
            "additionalProperties": true
          },
          "staleLead": {
            "type": "object",
            "additionalProperties": true
          },
          "engaged": {
            "type": "object",
            "additionalProperties": true
          },
          "unresponsive": {
            "type": "object",
            "additionalProperties": true
          },
          "review": {
            "type": "object",
            "additionalProperties": true
          },
          "interest": {
            "type": "object",
            "additionalProperties": true
          },
          "scoring": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "PlatformPaymentMethod": {
        "type": "object",
        "description": "One of the organization's own payment methods - a tender staff record by hand, such as cash or a bank transfer.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "description": "How reports and imports name the method. Unique within the organization."
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Private",
              "Member_only",
              "Public"
            ],
            "description": "`Private`: staff only (the till, check-in). `Member_only` and `Public`: also offered to members paying for a booking."
          }
        }
      },
      "PlatformPaymentMethodCreate": {
        "type": "object",
        "description": "Fields accepted when creating a payment method. Unknown fields are rejected.",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "What staff and members see, e.g. \"Bank transfer\""
          },
          "code": {
            "type": "string",
            "pattern": "^[a-z0-9_]+$",
            "maxLength": 50,
            "description": "Lower-case letters, digits and underscores. Derived from the name when omitted on create. Must be free within the organization."
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Private",
              "Member_only",
              "Public"
            ],
            "description": "Who may choose it. Defaults to `Private` (staff only) on create."
          }
        }
      },
      "PlatformPaymentMethodUpdate": {
        "type": "object",
        "description": "Fields accepted when updating a payment method. Send only what changes; at least one field is required.",
        "minProperties": 1,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "What staff and members see, e.g. \"Bank transfer\""
          },
          "code": {
            "type": "string",
            "pattern": "^[a-z0-9_]+$",
            "maxLength": 50,
            "description": "Lower-case letters, digits and underscores. Derived from the name when omitted on create. Must be free within the organization."
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Private",
              "Member_only",
              "Public"
            ],
            "description": "Who may choose it. Defaults to `Private` (staff only) on create."
          }
        }
      },
      "PlatformMemberAccount": {
        "type": "object",
        "description": "A household or company account: the family or employer a group of contacts belongs to, which an invoice can be addressed to.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "type": {
            "type": "string",
            "enum": [
              "household",
              "company",
              "organization"
            ],
            "description": "`organization` is a legacy type: it is listed, but not created here."
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "primaryContactId": {
            "type": "integer",
            "nullable": true,
            "description": "The member the account is addressed to by default"
          },
          "legalName": {
            "type": "string",
            "nullable": true,
            "maxLength": 200
          },
          "taxNumber": {
            "type": "string",
            "nullable": true,
            "maxLength": 100,
            "description": "VAT or tax id"
          },
          "registrationNumber": {
            "type": "string",
            "nullable": true,
            "maxLength": 100,
            "description": "Company registration number"
          },
          "billingEmail": {
            "type": "string",
            "nullable": true,
            "format": "email"
          },
          "notes": {
            "type": "string",
            "nullable": true,
            "maxLength": 2000
          },
          "memberCount": {
            "type": "integer"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformMemberAccountDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PlatformMemberAccount"
          },
          {
            "type": "object",
            "properties": {
              "members": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "contactId": {
                      "type": "integer"
                    },
                    "name": {
                      "type": "string",
                      "nullable": true
                    },
                    "email": {
                      "type": "string",
                      "nullable": true
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "adult",
                        "dependent",
                        "admin",
                        "employee"
                      ]
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "PlatformMemberAccountPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformMemberAccount"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total accounts matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformMemberAccountCreate": {
        "type": "object",
        "description": "Fields accepted when creating an account. Unknown fields are rejected.",
        "required": [
          "type",
          "contactId"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "household",
              "company"
            ]
          },
          "name": {
            "type": "string",
            "maxLength": 200,
            "description": "Required for a company. A household without one is named after its first member."
          },
          "contactId": {
            "type": "integer",
            "description": "The first member, who becomes the primary contact"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "adult",
              "dependent",
              "admin",
              "employee"
            ],
            "description": "The first member's role. Defaults to owner for a household and employee for a company."
          },
          "legalName": {
            "type": "string",
            "nullable": true,
            "maxLength": 200
          },
          "taxNumber": {
            "type": "string",
            "nullable": true,
            "maxLength": 100,
            "description": "VAT or tax id"
          },
          "registrationNumber": {
            "type": "string",
            "nullable": true,
            "maxLength": 100,
            "description": "Company registration number"
          },
          "billingEmail": {
            "type": "string",
            "nullable": true,
            "format": "email"
          },
          "notes": {
            "type": "string",
            "nullable": true,
            "maxLength": 2000
          }
        }
      },
      "PlatformMemberAccountUpdate": {
        "type": "object",
        "description": "Fields accepted when updating an account. Send only what changes; at least one field is required.",
        "minProperties": 1,
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "primaryContactId": {
            "type": "integer",
            "description": "Must already be a member of the account"
          },
          "legalName": {
            "type": "string",
            "nullable": true,
            "maxLength": 200
          },
          "taxNumber": {
            "type": "string",
            "nullable": true,
            "maxLength": 100,
            "description": "VAT or tax id"
          },
          "registrationNumber": {
            "type": "string",
            "nullable": true,
            "maxLength": 100,
            "description": "Company registration number"
          },
          "billingEmail": {
            "type": "string",
            "nullable": true,
            "format": "email"
          },
          "notes": {
            "type": "string",
            "nullable": true,
            "maxLength": 2000
          }
        }
      },
      "PlatformProductCategory": {
        "type": "object",
        "description": "How products are grouped - the tabs on the till and the sections of a shop page.",
        "properties": {
          "categoryId": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "sortOrder": {
            "type": "integer",
            "description": "Ascending display order; ties fall back to name."
          },
          "productCount": {
            "type": "integer",
            "description": "Products currently in this category, active and inactive."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformCheckin": {
        "type": "object",
        "description": "An attendance record for a booking, class, membership, or direct gym visit.",
        "properties": {
          "checkinId": {
            "type": "integer"
          },
          "contactId": {
            "type": "integer",
            "nullable": true
          },
          "clubId": {
            "type": "integer"
          },
          "classId": {
            "type": "integer",
            "nullable": true
          },
          "bookingId": {
            "type": "integer",
            "nullable": true
          },
          "membershipId": {
            "type": "integer",
            "nullable": true
          },
          "externalProgramId": {
            "type": "integer",
            "nullable": true
          },
          "entranceMethod": {
            "type": "string",
            "nullable": true
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "contact": {
            "type": "object",
            "nullable": true,
            "additionalProperties": true
          },
          "club": {
            "type": "object",
            "additionalProperties": true
          },
          "class": {
            "type": "object",
            "nullable": true,
            "additionalProperties": true
          },
          "booking": {
            "type": "object",
            "nullable": true,
            "additionalProperties": true
          },
          "membership": {
            "type": "object",
            "nullable": true,
            "additionalProperties": true
          },
          "externalProgram": {
            "type": "object",
            "nullable": true,
            "additionalProperties": true
          }
        }
      },
      "PlatformCheckinPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformCheckin"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total check-ins matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformInvoiceTotals": {
        "type": "object",
        "description": "Invoices in one currency, added up. Amounts in different currencies are never summed together.",
        "properties": {
          "currency": {
            "type": "string"
          },
          "count": {
            "type": "integer"
          },
          "subtotal": {
            "type": "number",
            "description": "Before tax"
          },
          "taxAmount": {
            "type": "number"
          },
          "totalAmount": {
            "type": "number",
            "description": "Tax included"
          }
        }
      },
      "PlatformInvoiceSummary": {
        "type": "object",
        "properties": {
          "timezone": {
            "type": "string",
            "description": "The organization's timezone, whose calendar days the range is read on"
          },
          "startDate": {
            "type": "string",
            "format": "date"
          },
          "endDate": {
            "type": "string",
            "format": "date"
          },
          "billingEntityId": {
            "type": "integer",
            "nullable": true
          },
          "invoiced": {
            "type": "array",
            "description": "One entry per currency; void and cancelled invoices excluded. Empty when nothing was invoiced.",
            "items": {
              "$ref": "#/components/schemas/PlatformInvoiceTotals"
            }
          },
          "byStatus": {
            "type": "array",
            "description": "Every status present in the range, per currency, void and cancelled included",
            "items": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string"
                },
                "currency": {
                  "type": "string"
                },
                "count": {
                  "type": "integer"
                },
                "totalAmount": {
                  "type": "number"
                }
              }
            }
          },
          "overdue": {
            "type": "array",
            "description": "Unpaid invoices in the range whose due date has passed, per currency",
            "items": {
              "type": "object",
              "properties": {
                "currency": {
                  "type": "string"
                },
                "count": {
                  "type": "integer"
                },
                "totalAmount": {
                  "type": "number"
                }
              }
            }
          },
          "byBillingEntity": {
            "type": "array",
            "description": "`invoiced`, split by the billing entity that issued each invoice",
            "items": {
              "type": "object",
              "properties": {
                "billingEntityId": {
                  "type": "integer"
                },
                "name": {
                  "type": "string",
                  "nullable": true
                },
                "invoiced": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PlatformInvoiceTotals"
                  }
                }
              }
            }
          }
        }
      },
      "PlatformInvoice": {
        "type": "object",
        "description": "A fiscal invoice. Pro-formas are never returned.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "invoiceNumber": {
            "type": "string"
          },
          "invoiceDate": {
            "type": "string",
            "format": "date",
            "description": "The calendar day the invoice belongs to, on the organization's clock"
          },
          "dueDate": {
            "type": "string",
            "format": "date"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "paid",
              "void",
              "failed",
              "settled",
              "overdue",
              "partially_paid",
              "refunded",
              "cancelled"
            ]
          },
          "overdue": {
            "type": "boolean",
            "description": "Unpaid and past its due date"
          },
          "currency": {
            "type": "string"
          },
          "subtotal": {
            "type": "number"
          },
          "taxAmount": {
            "type": "number"
          },
          "totalAmount": {
            "type": "number"
          },
          "sentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "contact": {
            "type": "object",
            "nullable": true,
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "billingEntity": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              }
            }
          }
        }
      },
      "PlatformInvoiceDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PlatformInvoice"
          },
          {
            "type": "object",
            "properties": {
              "lineItems": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "description": {
                      "type": "string"
                    },
                    "quantity": {
                      "type": "number"
                    },
                    "unitPrice": {
                      "type": "number"
                    },
                    "totalAmount": {
                      "type": "number"
                    }
                  }
                }
              },
              "payments": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "amount": {
                      "type": "number"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "paymentDate": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "PlatformInvoicePage": {
        "allOf": [
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PlatformInvoice"
                }
              },
              "total": {
                "type": "integer",
                "description": "Total invoices matching the filters, ignoring pagination"
              },
              "limit": {
                "type": "integer"
              },
              "offset": {
                "type": "integer"
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "timezone": {
                "type": "string"
              },
              "startDate": {
                "type": "string",
                "format": "date"
              },
              "endDate": {
                "type": "string",
                "format": "date"
              }
            }
          }
        ]
      },
      "PlatformPricingRuleScope": {
        "type": "object",
        "description": "A set of resources the rule prices. `areas`, `instructors`, `clubs` and `classTypes` name ids of that kind, all in this organization. A rule with several scopes applies to a booking any of them covers.",
        "required": [
          "type",
          "ids"
        ],
        "additionalProperties": false,
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "areas",
              "instructors",
              "clubs",
              "classTypes"
            ]
          },
          "ids": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 500
          }
        }
      },
      "PlatformPricingRuleCondition": {
        "description": "One condition a booking must meet for the rule to apply. Weekday names are lowercase English; times are 24-hour HH:mm in the club timezone (`24:00` ends a window at midnight); dates are YYYY-MM-DD.",
        "oneOf": [
          {
            "type": "object",
            "description": "A time-of-day window, optionally on certain weekdays. By default (`match: segment`) it is a price band: the booking is split at its edges and only the part inside is priced by the rule. `start` applies the rule to the whole booking when it starts inside the window; `within` only when it fits entirely inside. Send startTime and endTime together, and name weekdays, a window, or both. A window cannot run past midnight.",
            "required": [
              "type",
              "config"
            ],
            "additionalProperties": false,
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "weekdays-time"
                ]
              },
              "config": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "weekdays": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "monday",
                        "tuesday",
                        "wednesday",
                        "thursday",
                        "friday",
                        "saturday",
                        "sunday"
                      ]
                    },
                    "maxItems": 7,
                    "description": "Days the window applies on. Empty or omitted means every day."
                  },
                  "startTime": {
                    "type": "string",
                    "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                  },
                  "endTime": {
                    "type": "string",
                    "pattern": "^(([01]\\d|2[0-3]):[0-5]\\d|24:00)$",
                    "description": "Exclusive: a slot starting at endTime is outside the window."
                  },
                  "match": {
                    "type": "string",
                    "enum": [
                      "segment",
                      "start",
                      "within"
                    ]
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "description": "The booking starts on one of these weekdays.",
            "required": [
              "type",
              "config"
            ],
            "additionalProperties": false,
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "days-of-week"
                ]
              },
              "config": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "days"
                ],
                "properties": {
                  "days": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "monday",
                        "tuesday",
                        "wednesday",
                        "thursday",
                        "friday",
                        "saturday",
                        "sunday"
                      ]
                    },
                    "maxItems": 7,
                    "minItems": 1
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "description": "The whole booking is at least `threshold` hours long, and at most `maxThreshold` when sent. Equal values name one exact length.",
            "required": [
              "type",
              "config"
            ],
            "additionalProperties": false,
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "duration-threshold"
                ]
              },
              "config": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "threshold"
                ],
                "properties": {
                  "threshold": {
                    "type": "number",
                    "minimum": 0
                  },
                  "maxThreshold": {
                    "type": "number",
                    "minimum": 0
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "description": "A session with a coach and no court is booked for between `min` and `max` people (inclusive). The rule then prices the group as a whole. A court or class always counts as one.",
            "required": [
              "type",
              "config"
            ],
            "additionalProperties": false,
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "group-size"
                ]
              },
              "config": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "min"
                ],
                "properties": {
                  "min": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "max": {
                    "type": "integer",
                    "minimum": 1
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "description": "The booking falls between these dates, inclusive. Send either bound or both.",
            "required": [
              "type",
              "config"
            ],
            "additionalProperties": false,
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "date-range"
                ]
              },
              "config": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "startDate": {
                    "type": "string",
                    "format": "date"
                  },
                  "endDate": {
                    "type": "string",
                    "format": "date"
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "description": "A member rate: the person booking holds one of these membership plans. A walk-in with no plan never matches.",
            "required": [
              "type",
              "config"
            ],
            "additionalProperties": false,
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "plan"
                ]
              },
              "config": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "planIds"
                ],
                "properties": {
                  "planIds": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "maxItems": 500,
                    "description": "Membership plan ids from GET /v1/platform/plans.",
                    "minItems": 1
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "description": "The court is booked together with a coach - one of these, or any coach when the list is empty or omitted. Pair it with an `areas` scope.",
            "required": [
              "type",
              "config"
            ],
            "additionalProperties": false,
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "with-instructor"
                ]
              },
              "config": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "instructorIds": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "maxItems": 500,
                    "description": "Instructor ids from GET /v1/platform/instructors."
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Who the booking is for: the contact matches this audience - carries one of `tags`, is one of `memberTypes`, and so on (every list sent must match). Name at least one. Plans are refused here: name a plan with the `plan` condition, which also counts a plan bought in the same checkout. An anonymous booking never matches, and a quote must name `contactId` to be priced by it. For a per-person exception, add a second rule on their own tag and give the first rule a higher `priority` number - the lower number wins.",
            "required": [
              "type",
              "config"
            ],
            "additionalProperties": false,
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "contact-audience"
                ]
              },
              "config": {
                "type": "object",
                "additionalProperties": false,
                "minProperties": 1,
                "properties": {
                  "memberTypes": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 20,
                    "description": "Contact types, e.g. `member`, `lead`."
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "type": "integer"
                        },
                        {
                          "type": "string",
                          "maxLength": 100
                        }
                      ]
                    },
                    "maxItems": 50,
                    "description": "Tag ids or names the contact carries."
                  },
                  "pipelineStageIds": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "maxItems": 50,
                    "description": "Sales pipeline stages the contact is in (GET /v1/platform/pipeline-stages)."
                  },
                  "sourceIds": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "maxItems": 50,
                    "description": "Where the contact came from (GET /v1/platform/contact-sources)."
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "description": "Demand pricing: how much of the area is still free over the next `daysAhead` days, as a percentage, compared with `percent`.",
            "required": [
              "type",
              "config"
            ],
            "additionalProperties": false,
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "availability"
                ]
              },
              "config": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "daysAhead",
                  "percent",
                  "operator"
                ],
                "properties": {
                  "daysAhead": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "percent": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "operator": {
                    "type": "string",
                    "enum": [
                      ">",
                      "<",
                      ">=",
                      "<="
                    ]
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "description": "How many days ahead the booking is made, compared with `days`. `>` 14 is an early-bird rate; `<` 2 a last-minute one.",
            "required": [
              "type",
              "config"
            ],
            "additionalProperties": false,
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "booking-timing"
                ]
              },
              "config": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "days",
                  "operator"
                ],
                "properties": {
                  "days": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "operator": {
                    "type": "string",
                    "enum": [
                      ">",
                      "<",
                      ">=",
                      "<="
                    ]
                  }
                }
              }
            }
          },
          {
            "type": "object",
            "description": "The slot is in low demand (more than half the area free) or high demand.",
            "required": [
              "type",
              "config"
            ],
            "additionalProperties": false,
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "demand-level"
                ]
              },
              "config": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "level"
                ],
                "properties": {
                  "level": {
                    "type": "string",
                    "enum": [
                      "low",
                      "high"
                    ]
                  }
                }
              }
            }
          }
        ]
      },
      "PlatformPricingRule": {
        "type": "object",
        "description": "One rule of the organization's price list. It applies to the resources its `scopes` name (none means every area, coach and class) when every one of its `conditions` holds; when several rules match one slot, the lowest `priority` wins. Rules are silent: members see the resulting price, never the rule's name.",
        "properties": {
          "ruleId": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "isActive": {
            "type": "boolean"
          },
          "priority": {
            "type": "integer",
            "description": "Lower wins."
          },
          "adjustmentType": {
            "type": "string",
            "enum": [
              "percentage",
              "fixed",
              "absolute"
            ]
          },
          "percentageAdjustment": {
            "type": "number",
            "nullable": true,
            "description": "Set on percentage rules; null on the others."
          },
          "fixedAmountAdjustment": {
            "type": "number",
            "nullable": true,
            "description": "The per-hour delta of a fixed rule or the hourly price of an absolute one; null on percentage rules."
          },
          "scopes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformPricingRuleScope"
            }
          },
          "conditions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformPricingRuleCondition"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformPricingRulePage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformPricingRule"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total pricing rules matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformPricingRuleCreate": {
        "type": "object",
        "description": "Fields accepted when creating a pricing rule. `scopes` must be present: an empty list applies the rule to every area, coach and class, so it has to be asked for. Send only the amount field your `adjustmentType` reads. Unknown fields are rejected.",
        "required": [
          "name",
          "adjustmentType",
          "scopes"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Internal name, shown to staff in the admin portal. Never shown to members."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 2000,
            "description": "Internal note. null clears it."
          },
          "isActive": {
            "type": "boolean",
            "description": "A switched-off rule prices nothing but is kept. Defaults to true on create."
          },
          "priority": {
            "type": "integer",
            "description": "Precedence when several rules match one slot: LOWER wins. Give the most specific rule the smallest number. Defaults to 0 on create."
          },
          "adjustmentType": {
            "type": "string",
            "enum": [
              "percentage",
              "fixed",
              "absolute"
            ],
            "description": "`absolute` states the hourly price outright; `fixed` adds an amount per hour; `percentage` moves the price by a percentage."
          },
          "percentageAdjustment": {
            "type": "number",
            "minimum": -100,
            "maximum": 100,
            "description": "Percentage rules only: -10 is 10% off, 20 is 20% more."
          },
          "fixedAmountAdjustment": {
            "type": "number",
            "nullable": true,
            "description": "Fixed rules: the amount added per hour, negative for a discount. Absolute rules: the hourly price, zero or more. Scaled by the booking length."
          },
          "scopes": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/PlatformPricingRuleScope"
            },
            "description": "Which resources the rule prices. Empty means every area, coach and class. Replaces the whole list when sent on an update."
          },
          "conditions": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/PlatformPricingRuleCondition"
            },
            "description": "When the rule applies; every condition must hold. Empty or omitted means always. Replaces the whole list when sent on an update."
          }
        }
      },
      "PlatformPricingRuleUpdate": {
        "type": "object",
        "description": "Fields accepted when updating a pricing rule. Send only what changes; an omitted field is left alone, and at least one is required. A changed adjustment is judged on the rule it produces. Unknown fields are rejected.",
        "minProperties": 1,
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Internal name, shown to staff in the admin portal. Never shown to members."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 2000,
            "description": "Internal note. null clears it."
          },
          "isActive": {
            "type": "boolean",
            "description": "A switched-off rule prices nothing but is kept. Defaults to true on create."
          },
          "priority": {
            "type": "integer",
            "description": "Precedence when several rules match one slot: LOWER wins. Give the most specific rule the smallest number. Defaults to 0 on create."
          },
          "adjustmentType": {
            "type": "string",
            "enum": [
              "percentage",
              "fixed",
              "absolute"
            ],
            "description": "`absolute` states the hourly price outright; `fixed` adds an amount per hour; `percentage` moves the price by a percentage."
          },
          "percentageAdjustment": {
            "type": "number",
            "minimum": -100,
            "maximum": 100,
            "description": "Percentage rules only: -10 is 10% off, 20 is 20% more."
          },
          "fixedAmountAdjustment": {
            "type": "number",
            "nullable": true,
            "description": "Fixed rules: the amount added per hour, negative for a discount. Absolute rules: the hourly price, zero or more. Scaled by the booking length."
          },
          "scopes": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/PlatformPricingRuleScope"
            },
            "description": "Which resources the rule prices. Empty means every area, coach and class. Replaces the whole list when sent on an update."
          },
          "conditions": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/PlatformPricingRuleCondition"
            },
            "description": "When the rule applies; every condition must hold. Empty or omitted means always. Replaces the whole list when sent on an update."
          }
        }
      },
      "PlatformPricingQuoteRequest": {
        "type": "object",
        "description": "A booking to price. Name what is booked with `areaId`, `instructorId` or `classId`; every id must belong to this organization. Unknown fields are rejected.",
        "required": [
          "startTime",
          "endTime"
        ],
        "additionalProperties": false,
        "properties": {
          "startTime": {
            "type": "string",
            "format": "date-time",
            "description": "ISO date-time with an offset."
          },
          "endTime": {
            "type": "string",
            "format": "date-time",
            "description": "After startTime, and at most 24 hours later."
          },
          "areaId": {
            "type": "integer",
            "description": "The area (court, room) being booked."
          },
          "instructorId": {
            "type": "integer",
            "description": "The coach being booked. With areaId, a court booked with a coach."
          },
          "classId": {
            "type": "integer",
            "description": "A class being booked into."
          },
          "classTypeId": {
            "type": "integer",
            "description": "Price as this class type. Derived from classId when left out."
          },
          "planIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 20,
            "description": "Price as a holder of these plans, without naming a person."
          },
          "contactId": {
            "type": "integer",
            "description": "Price for this person: their plans unlock member rates and may cover the booking. Also requires the `contacts:read` scope."
          },
          "clubId": {
            "type": "integer",
            "description": "The club the booking lands in. Only matters for a coach who works at every club."
          },
          "groupSize": {
            "type": "integer",
            "minimum": 1,
            "description": "How many people a session with a coach and no court is for."
          },
          "ignoreMembershipCoverage": {
            "type": "boolean",
            "description": "Quote the list price even when a membership would cover the booking."
          }
        }
      },
      "PlatformPricingQuote": {
        "type": "object",
        "description": "What a booking would cost, from the same calculator checkout uses. Nothing is booked or held.",
        "properties": {
          "basePrice": {
            "type": "number",
            "description": "The resource's own rate for the booking, before any rule."
          },
          "finalPrice": {
            "type": "number",
            "description": "The price after every rule, before tax is added."
          },
          "appliedRules": {
            "type": "array",
            "description": "The rules that moved the price, in the order they applied. A rule pricing several time bands appears once per band.",
            "items": {
              "type": "object",
              "properties": {
                "ruleId": {
                  "type": "integer"
                },
                "ruleName": {
                  "type": "string"
                },
                "adjustmentType": {
                  "type": "string",
                  "nullable": true,
                  "enum": [
                    "percentage",
                    "fixed",
                    "absolute",
                    null
                  ]
                },
                "percentageAdjustment": {
                  "type": "number",
                  "nullable": true
                },
                "fixedAmountAdjustment": {
                  "type": "number",
                  "nullable": true,
                  "description": "The delta the rule applied, also for an absolute rule."
                },
                "amount": {
                  "type": "number",
                  "description": "What the rule moved the price by, negative for a discount."
                },
                "priceAfter": {
                  "type": "number",
                  "description": "The price after this rule."
                }
              }
            }
          },
          "tax": {
            "type": "object",
            "nullable": true,
            "description": "Tax on the price, or null when none applies.",
            "properties": {
              "rate": {
                "type": "number",
                "description": "Percentage."
              },
              "amount": {
                "type": "number"
              },
              "name": {
                "type": "string",
                "nullable": true,
                "description": "The label the organization gave the rate, e.g. \"VAT\"."
              },
              "inclusive": {
                "type": "boolean",
                "description": "True when finalPrice already includes the tax."
              },
              "totalWithTax": {
                "type": "number"
              }
            }
          },
          "membershipCoverage": {
            "type": "object",
            "description": "Whether a membership the contact holds would cover the booking, making it free to them.",
            "properties": {
              "covered": {
                "type": "boolean"
              },
              "membershipId": {
                "type": "integer",
                "nullable": true
              },
              "membershipName": {
                "type": "string",
                "nullable": true
              },
              "sessionUnit": {
                "type": "string",
                "nullable": true,
                "enum": [
                  "session",
                  "hour",
                  null
                ]
              },
              "requiredUnits": {
                "type": "number",
                "nullable": true,
                "description": "Sessions or hours the booking would use."
              },
              "usesRemainingBefore": {
                "type": "number",
                "nullable": true,
                "description": "What the membership has left before this booking; null when unlimited."
              },
              "note": {
                "type": "string",
                "nullable": true
              }
            }
          }
        }
      },
      "PlatformBookingPolicy": {
        "type": "object",
        "description": "The rules a booking is held to: cancellation terms, payment timing, booking window, slot grid and check-in rules. Scoped on WHAT it governs (`validFor`) and WHO (`audience`), narrowed to `clubIds`; when several apply, the most specific wins. An `event` policy instead decides what event tickets refund.",
        "properties": {
          "policyId": {
            "type": "integer"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Internal name, shown to staff in the admin portal."
          },
          "kind": {
            "type": "string",
            "enum": [
              "booking",
              "event"
            ],
            "description": "`booking` (the default) governs bookings of courts, coaches and classes. `event` decides only what event tickets refund on cancellation, and takes no validFor or audience."
          },
          "clubIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 500,
            "description": "Clubs the policy applies at. Empty means every club. Required on create."
          },
          "validFor": {
            "type": "object",
            "nullable": false,
            "additionalProperties": false,
            "description": "What the policy governs. `{}` means every booking. Always `{}` on an event policy.",
            "properties": {
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "classes",
                    "areas",
                    "instructors"
                  ]
                },
                "maxItems": 3
              },
              "classTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "maxItems": 500,
                "description": "Class type ids, from GET /v1/platform/class-types."
              },
              "areaTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "maxItems": 500,
                "description": "Area type ids, from GET /v1/platform/area-types."
              },
              "instructorTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "maxItems": 500,
                "description": "Instructor type ids, from GET /v1/platform/instructor-types."
              }
            }
          },
          "eventIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 500,
            "description": "Event policies only: the events it covers. Empty means every event."
          },
          "audience": {
            "type": "object",
            "nullable": true,
            "additionalProperties": false,
            "description": "Who the policy governs. null means everyone. Always null on an event policy.",
            "properties": {
              "memberTypes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "contact",
                    "member",
                    "staff",
                    "lead",
                    "lapsed",
                    "drop_in",
                    "archived"
                  ]
                },
                "maxItems": 20
              },
              "tags": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "integer"
                    }
                  ]
                },
                "maxItems": 50
              },
              "membershipPlanIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "maxItems": 50
              },
              "membershipPlanCategoryIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "maxItems": 50
              },
              "pipelineStageIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "maxItems": 50
              },
              "sourceIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "maxItems": 50
              }
            }
          },
          "cancellationRules": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "object",
              "required": [
                "hoursInAdvance",
                "refundPercentage"
              ],
              "additionalProperties": false,
              "properties": {
                "hoursInAdvance": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 8760,
                  "description": "Notice, in hours before the booking starts, this band requires."
                },
                "refundPercentage": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 100,
                  "description": "Share of the booking price refunded when the member cancels with at least that much notice."
                },
                "description": {
                  "type": "string",
                  "maxLength": 500
                }
              }
            },
            "description": "The refund ladder. The first band whose notice the member met decides the refund; meeting none refunds nothing. `hoursInAdvance` must be distinct and refunds may not grow as the booking approaches. Empty is free cancellation at any time; every band at 0% is non-refundable (canonically one band, 0 hours at 0%)."
          },
          "cancellationCutoffHours": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "maximum": 8760,
            "description": "How many hours before the start members can no longer cancel a booking themselves; staff still can. null (or 0) is no cutoff. Stamped on each booking when it is made, so a cutoff added later never applies to bookings already made."
          },
          "forcePayment": {
            "type": "string",
            "enum": [
              "none",
              "at_booking",
              "at_checkin"
            ],
            "description": "`at_booking` sends members to an online card checkout before the booking is confirmed, and needs an online card payment provider at the policy clubs. `at_checkin` takes payment on arrival."
          },
          "chargeAdvanceDays": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "maximum": 365,
            "description": "Days before each occurrence of a recurring booking that its charge is written. null uses the platform default of 3. Not used while payment is taken at booking."
          },
          "minBookingSlotMinutes": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "description": "Shortest booking allowed. A whole number of steps, and at most maxBookingSlotMinutes."
          },
          "maxBookingSlotMinutes": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "description": "Longest booking allowed."
          },
          "bookingDurationStepMinutes": {
            "type": "integer",
            "nullable": true,
            "enum": [
              30,
              60,
              null
            ],
            "description": "The step a booking length grows by."
          },
          "maxBookInAdvanceDays": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "description": "How many days ahead members may book. null is no limit."
          },
          "minBookingNoticeHours": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "description": "How late before the start members may still book. null is no limit."
          },
          "waiveNoticeWhenBooked": {
            "type": "boolean",
            "description": "Lift minBookingNoticeHours for a class someone has already booked, since it is confirmed to run."
          },
          "checkInRequired": {
            "type": "boolean",
            "description": "A booking not checked in by the end of the day is marked a no-show."
          },
          "autoCheckIn": {
            "type": "boolean",
            "description": "Check the booking in automatically when it starts."
          },
          "allowAnonymousBookings": {
            "type": "boolean",
            "description": "Staff may book without naming a contact."
          },
          "allowGuestBookings": {
            "type": "boolean",
            "description": "Logged-out visitors may book without an account or password, giving their details at checkout."
          },
          "allowWalkInCheckins": {
            "type": "boolean",
            "description": "Staff may check in a contact who has no booking."
          },
          "allowAnonymousCheckins": {
            "type": "boolean",
            "description": "Staff may check in a visitor with no contact record."
          },
          "allowedProductCategoryIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 500,
            "description": "Product categories offered with the booking confirmation. Empty offers none."
          },
          "waitlistClaimWindowMinutes": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "description": "Minutes the first person on a waitlist has to claim a place that opens shortly before a class. null uses the default of 15."
          },
          "upsellAvailablePlans": {
            "type": "boolean",
            "description": "Offer plans at booking."
          },
          "upsellPlanIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 500,
            "description": "The plans offered at booking."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformBookingPolicyPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformBookingPolicy"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total booking policies matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformBookingPolicyCreate": {
        "type": "object",
        "description": "Fields accepted when creating a booking policy. `clubIds` must be present: an empty list applies the policy at every club, where it takes over from the policy that governed there, so it has to be asked for. Everything else takes the policy default when omitted. Unknown fields are rejected.",
        "required": [
          "name",
          "clubIds"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Internal name, shown to staff in the admin portal."
          },
          "kind": {
            "type": "string",
            "enum": [
              "booking",
              "event"
            ],
            "description": "`booking` (the default) governs bookings of courts, coaches and classes. `event` decides only what event tickets refund on cancellation, and takes no validFor or audience."
          },
          "clubIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 500,
            "description": "Clubs the policy applies at. Empty means every club. Required on create."
          },
          "validFor": {
            "type": "object",
            "nullable": true,
            "additionalProperties": false,
            "description": "What the policy governs. No `scopes` means every booking. Each scope listed (`classes`, `areas`, `instructors`) takes in bookings of that kind, all of them unless its type list (`classTypes`, `areaTypes`, `instructorTypes`) narrows it; a type list must not be empty and must belong to a listed scope. null on a write is the same as `{}`.",
            "properties": {
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "classes",
                    "areas",
                    "instructors"
                  ]
                },
                "maxItems": 3
              },
              "classTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "maxItems": 500,
                "description": "Class type ids, from GET /v1/platform/class-types."
              },
              "areaTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "maxItems": 500,
                "description": "Area type ids, from GET /v1/platform/area-types."
              },
              "instructorTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "maxItems": 500,
                "description": "Instructor type ids, from GET /v1/platform/instructor-types."
              }
            }
          },
          "eventIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 500,
            "description": "Event policies only: the events it covers. Empty means every event."
          },
          "audience": {
            "type": "object",
            "nullable": true,
            "additionalProperties": false,
            "description": "Who the policy governs. Every list set must match: a contact of one of `memberTypes`, carrying one of `tags`, holding one of `membershipPlanIds` (or a plan in `membershipPlanCategoryIds`), and so on. null means everyone. A policy with an audience never applies to an anonymous booking.",
            "properties": {
              "memberTypes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "contact",
                    "member",
                    "staff",
                    "lead",
                    "lapsed",
                    "drop_in",
                    "archived"
                  ]
                },
                "maxItems": 20
              },
              "tags": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "integer"
                    }
                  ]
                },
                "maxItems": 50
              },
              "membershipPlanIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "maxItems": 50
              },
              "membershipPlanCategoryIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "maxItems": 50
              },
              "pipelineStageIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "maxItems": 50
              },
              "sourceIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "maxItems": 50
              }
            }
          },
          "cancellationRules": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "object",
              "required": [
                "hoursInAdvance",
                "refundPercentage"
              ],
              "additionalProperties": false,
              "properties": {
                "hoursInAdvance": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 8760,
                  "description": "Notice, in hours before the booking starts, this band requires."
                },
                "refundPercentage": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 100,
                  "description": "Share of the booking price refunded when the member cancels with at least that much notice."
                },
                "description": {
                  "type": "string",
                  "maxLength": 500
                }
              }
            },
            "description": "The refund ladder. The first band whose notice the member met decides the refund; meeting none refunds nothing. `hoursInAdvance` must be distinct and refunds may not grow as the booking approaches. Empty is free cancellation at any time; every band at 0% is non-refundable (canonically one band, 0 hours at 0%)."
          },
          "cancellationCutoffHours": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "maximum": 8760,
            "description": "How many hours before the start members can no longer cancel a booking themselves; staff still can. null (or 0) is no cutoff. Stamped on each booking when it is made, so a cutoff added later never applies to bookings already made."
          },
          "forcePayment": {
            "type": "string",
            "enum": [
              "none",
              "at_booking",
              "at_checkin"
            ],
            "description": "`at_booking` sends members to an online card checkout before the booking is confirmed, and needs an online card payment provider at the policy clubs. `at_checkin` takes payment on arrival."
          },
          "chargeAdvanceDays": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "maximum": 365,
            "description": "Days before each occurrence of a recurring booking that its charge is written. null uses the platform default of 3. Not used while payment is taken at booking."
          },
          "minBookingSlotMinutes": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "description": "Shortest booking allowed. A whole number of steps, and at most maxBookingSlotMinutes."
          },
          "maxBookingSlotMinutes": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "description": "Longest booking allowed."
          },
          "bookingDurationStepMinutes": {
            "type": "integer",
            "nullable": true,
            "enum": [
              30,
              60,
              null
            ],
            "description": "The step a booking length grows by."
          },
          "maxBookInAdvanceDays": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "description": "How many days ahead members may book. null is no limit."
          },
          "minBookingNoticeHours": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "description": "How late before the start members may still book. null is no limit."
          },
          "waiveNoticeWhenBooked": {
            "type": "boolean",
            "description": "Lift minBookingNoticeHours for a class someone has already booked, since it is confirmed to run."
          },
          "checkInRequired": {
            "type": "boolean",
            "description": "A booking not checked in by the end of the day is marked a no-show."
          },
          "autoCheckIn": {
            "type": "boolean",
            "description": "Check the booking in automatically when it starts."
          },
          "allowAnonymousBookings": {
            "type": "boolean",
            "description": "Staff may book without naming a contact."
          },
          "allowGuestBookings": {
            "type": "boolean",
            "description": "Logged-out visitors may book without an account or password, giving their details at checkout."
          },
          "allowWalkInCheckins": {
            "type": "boolean",
            "description": "Staff may check in a contact who has no booking."
          },
          "allowAnonymousCheckins": {
            "type": "boolean",
            "description": "Staff may check in a visitor with no contact record."
          },
          "allowedProductCategoryIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 500,
            "description": "Product categories offered with the booking confirmation. Empty offers none."
          },
          "waitlistClaimWindowMinutes": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "description": "Minutes the first person on a waitlist has to claim a place that opens shortly before a class. null uses the default of 15."
          },
          "upsellAvailablePlans": {
            "type": "boolean",
            "description": "Offer plans at booking."
          },
          "upsellPlanIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 500,
            "description": "The plans offered at booking."
          }
        }
      },
      "PlatformBookingPolicyUpdate": {
        "type": "object",
        "description": "Fields accepted when updating a booking policy. Send only what changes; an omitted field is left alone, and at least one is required. Lists and the validFor and audience objects replace what is stored. Unknown fields are rejected.",
        "minProperties": 1,
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Internal name, shown to staff in the admin portal."
          },
          "kind": {
            "type": "string",
            "enum": [
              "booking",
              "event"
            ],
            "description": "`booking` (the default) governs bookings of courts, coaches and classes. `event` decides only what event tickets refund on cancellation, and takes no validFor or audience."
          },
          "clubIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 500,
            "description": "Clubs the policy applies at. Empty means every club. Required on create."
          },
          "validFor": {
            "type": "object",
            "nullable": true,
            "additionalProperties": false,
            "description": "What the policy governs. No `scopes` means every booking. Each scope listed (`classes`, `areas`, `instructors`) takes in bookings of that kind, all of them unless its type list (`classTypes`, `areaTypes`, `instructorTypes`) narrows it; a type list must not be empty and must belong to a listed scope. null on a write is the same as `{}`.",
            "properties": {
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "classes",
                    "areas",
                    "instructors"
                  ]
                },
                "maxItems": 3
              },
              "classTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "maxItems": 500,
                "description": "Class type ids, from GET /v1/platform/class-types."
              },
              "areaTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "maxItems": 500,
                "description": "Area type ids, from GET /v1/platform/area-types."
              },
              "instructorTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "maxItems": 500,
                "description": "Instructor type ids, from GET /v1/platform/instructor-types."
              }
            }
          },
          "eventIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 500,
            "description": "Event policies only: the events it covers. Empty means every event."
          },
          "audience": {
            "type": "object",
            "nullable": true,
            "additionalProperties": false,
            "description": "Who the policy governs. Every list set must match: a contact of one of `memberTypes`, carrying one of `tags`, holding one of `membershipPlanIds` (or a plan in `membershipPlanCategoryIds`), and so on. null means everyone. A policy with an audience never applies to an anonymous booking.",
            "properties": {
              "memberTypes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "contact",
                    "member",
                    "staff",
                    "lead",
                    "lapsed",
                    "drop_in",
                    "archived"
                  ]
                },
                "maxItems": 20
              },
              "tags": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "integer"
                    }
                  ]
                },
                "maxItems": 50
              },
              "membershipPlanIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "maxItems": 50
              },
              "membershipPlanCategoryIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "maxItems": 50
              },
              "pipelineStageIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "maxItems": 50
              },
              "sourceIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "maxItems": 50
              }
            }
          },
          "cancellationRules": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "object",
              "required": [
                "hoursInAdvance",
                "refundPercentage"
              ],
              "additionalProperties": false,
              "properties": {
                "hoursInAdvance": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 8760,
                  "description": "Notice, in hours before the booking starts, this band requires."
                },
                "refundPercentage": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 100,
                  "description": "Share of the booking price refunded when the member cancels with at least that much notice."
                },
                "description": {
                  "type": "string",
                  "maxLength": 500
                }
              }
            },
            "description": "The refund ladder. The first band whose notice the member met decides the refund; meeting none refunds nothing. `hoursInAdvance` must be distinct and refunds may not grow as the booking approaches. Empty is free cancellation at any time; every band at 0% is non-refundable (canonically one band, 0 hours at 0%)."
          },
          "cancellationCutoffHours": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "maximum": 8760,
            "description": "How many hours before the start members can no longer cancel a booking themselves; staff still can. null (or 0) is no cutoff. Stamped on each booking when it is made, so a cutoff added later never applies to bookings already made."
          },
          "forcePayment": {
            "type": "string",
            "enum": [
              "none",
              "at_booking",
              "at_checkin"
            ],
            "description": "`at_booking` sends members to an online card checkout before the booking is confirmed, and needs an online card payment provider at the policy clubs. `at_checkin` takes payment on arrival."
          },
          "chargeAdvanceDays": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "maximum": 365,
            "description": "Days before each occurrence of a recurring booking that its charge is written. null uses the platform default of 3. Not used while payment is taken at booking."
          },
          "minBookingSlotMinutes": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "description": "Shortest booking allowed. A whole number of steps, and at most maxBookingSlotMinutes."
          },
          "maxBookingSlotMinutes": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "description": "Longest booking allowed."
          },
          "bookingDurationStepMinutes": {
            "type": "integer",
            "nullable": true,
            "enum": [
              30,
              60,
              null
            ],
            "description": "The step a booking length grows by."
          },
          "maxBookInAdvanceDays": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "description": "How many days ahead members may book. null is no limit."
          },
          "minBookingNoticeHours": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "description": "How late before the start members may still book. null is no limit."
          },
          "waiveNoticeWhenBooked": {
            "type": "boolean",
            "description": "Lift minBookingNoticeHours for a class someone has already booked, since it is confirmed to run."
          },
          "checkInRequired": {
            "type": "boolean",
            "description": "A booking not checked in by the end of the day is marked a no-show."
          },
          "autoCheckIn": {
            "type": "boolean",
            "description": "Check the booking in automatically when it starts."
          },
          "allowAnonymousBookings": {
            "type": "boolean",
            "description": "Staff may book without naming a contact."
          },
          "allowGuestBookings": {
            "type": "boolean",
            "description": "Logged-out visitors may book without an account or password, giving their details at checkout."
          },
          "allowWalkInCheckins": {
            "type": "boolean",
            "description": "Staff may check in a contact who has no booking."
          },
          "allowAnonymousCheckins": {
            "type": "boolean",
            "description": "Staff may check in a visitor with no contact record."
          },
          "allowedProductCategoryIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 500,
            "description": "Product categories offered with the booking confirmation. Empty offers none."
          },
          "waitlistClaimWindowMinutes": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "description": "Minutes the first person on a waitlist has to claim a place that opens shortly before a class. null uses the default of 15."
          },
          "upsellAvailablePlans": {
            "type": "boolean",
            "description": "Offer plans at booking."
          },
          "upsellPlanIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 500,
            "description": "The plans offered at booking."
          }
        }
      },
      "PlatformEffectiveBookingPolicy": {
        "type": "object",
        "description": "The policy that governs the booking described, or null when none applies.",
        "properties": {
          "policy": {
            "allOf": [
              {
                "$ref": "#/components/schemas/PlatformBookingPolicy"
              }
            ],
            "nullable": true
          }
        }
      },
      "PlatformDocumentRuleFilters": {
        "type": "object",
        "description": "Who the rule asks. Every axis means everyone when empty; a member must match every axis the rule sets.",
        "properties": {
          "contactTypes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Contact types asked."
          },
          "planIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Membership plans: a member holding an active membership of any of them is asked."
          },
          "tags": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "string"
                }
              ]
            },
            "description": "Tag ids, or (on older rules) tag names matched by name."
          },
          "householdRoles": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Household roles asked: owner, adult or dependent."
          }
        }
      },
      "PlatformDocumentRuleFiltersWrite": {
        "type": "object",
        "description": "Who the rule asks. Every axis means everyone when empty or left out. Sent as one object that replaces the stored filters wholesale: an axis left out is cleared. Plan and tag ids must be the organization's (an id already on the rule is kept even if it no longer exists).",
        "additionalProperties": false,
        "properties": {
          "contactTypes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "member",
                "drop_in",
                "lead",
                "staff",
                "lapsed",
                "contact"
              ]
            }
          },
          "planIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Plan ids, from /v1/platform/plans."
          },
          "tags": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "string"
                }
              ]
            },
            "description": "Tag ids. A string is matched against tag names, the shape older rules were saved in; prefer ids."
          },
          "householdRoles": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "owner",
                "adult",
                "dependent"
              ]
            }
          }
        }
      },
      "PlatformDocumentRuleDocument": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Content id, of type `document`."
          },
          "title": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "Only a `published` document is asked of anybody; a draft on a rule is skipped until it is published."
          }
        }
      },
      "PlatformDocumentRule": {
        "type": "object",
        "description": "A document rule: which members are asked to read and accept which documents, and how.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "isActive": {
            "type": "boolean"
          },
          "mandatoryToAccept": {
            "type": "boolean",
            "description": "true: members must accept to finish setting up their account. false: optional, they may decline."
          },
          "requiresTypedNameAcceptance": {
            "type": "boolean",
            "description": "Members type their full name to accept. Only ever true on a mandatory rule."
          },
          "requiredForEntry": {
            "type": "boolean",
            "description": "An unsigned matching member cannot check themselves in. Only ever true on a mandatory rule."
          },
          "consentChannel": {
            "type": "string",
            "nullable": true,
            "enum": [
              "marketing_email",
              "marketing_sms",
              "whatsapp",
              null
            ],
            "description": "The marketing channel each answer is written to. Only ever set on an optional rule."
          },
          "filters": {
            "$ref": "#/components/schemas/PlatformDocumentRuleFilters"
          },
          "documentIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "The documents the rule requires, ascending."
          },
          "documents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformDocumentRuleDocument"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformDocumentRuleCreate": {
        "type": "object",
        "description": "Fields accepted when creating a document rule. Unknown fields are refused.",
        "required": [
          "name",
          "documentIds"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Internal name, shown to staff in the admin portal."
          },
          "documentIds": {
            "type": "array",
            "minItems": 1,
            "maxItems": 50,
            "items": {
              "type": "integer"
            },
            "description": "The documents the rule requires: content ids of type `document` in this organization. Duplicates are ignored. Replaces the whole set when sent on an update."
          },
          "isActive": {
            "type": "boolean",
            "description": "A switched-off rule asks nobody. Defaults to true on create."
          },
          "mandatoryToAccept": {
            "type": "boolean",
            "description": "true: members must accept before they can finish setting up their account. false: optional - members may decline. Defaults to true on create."
          },
          "requiresTypedNameAcceptance": {
            "type": "boolean",
            "description": "Members must scroll to the end and type their full name, instead of ticking a box. Mandatory rules only."
          },
          "requiredForEntry": {
            "type": "boolean",
            "description": "A matching member who has not signed cannot check themselves in (tablet, member QR, portal, door access) until they do. Staff check-in is never refused. Mandatory rules only."
          },
          "consentChannel": {
            "type": "string",
            "nullable": true,
            "enum": [
              "marketing_email",
              "marketing_sms",
              "whatsapp",
              null
            ],
            "description": "Optional rules only: each member's answer is also written to this channel's marketing consent. null records nothing."
          },
          "filters": {
            "$ref": "#/components/schemas/PlatformDocumentRuleFiltersWrite"
          }
        }
      },
      "PlatformDocumentRuleUpdate": {
        "type": "object",
        "description": "Fields accepted when updating a document rule. Send only what changes; `documentIds` and `filters` replace the stored value wholesale. Unknown fields are refused.",
        "minProperties": 1,
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Internal name, shown to staff in the admin portal."
          },
          "documentIds": {
            "type": "array",
            "minItems": 1,
            "maxItems": 50,
            "items": {
              "type": "integer"
            },
            "description": "The documents the rule requires: content ids of type `document` in this organization. Duplicates are ignored. Replaces the whole set when sent on an update."
          },
          "isActive": {
            "type": "boolean",
            "description": "A switched-off rule asks nobody. Defaults to true on create."
          },
          "mandatoryToAccept": {
            "type": "boolean",
            "description": "true: members must accept before they can finish setting up their account. false: optional - members may decline. Defaults to true on create."
          },
          "requiresTypedNameAcceptance": {
            "type": "boolean",
            "description": "Members must scroll to the end and type their full name, instead of ticking a box. Mandatory rules only."
          },
          "requiredForEntry": {
            "type": "boolean",
            "description": "A matching member who has not signed cannot check themselves in (tablet, member QR, portal, door access) until they do. Staff check-in is never refused. Mandatory rules only."
          },
          "consentChannel": {
            "type": "string",
            "nullable": true,
            "enum": [
              "marketing_email",
              "marketing_sms",
              "whatsapp",
              null
            ],
            "description": "Optional rules only: each member's answer is also written to this channel's marketing consent. null records nothing."
          },
          "filters": {
            "$ref": "#/components/schemas/PlatformDocumentRuleFiltersWrite"
          }
        }
      },
      "PlatformDocumentRulePage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformDocumentRule"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total document rules matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformTemplateBlock": {
        "type": "object",
        "description": "One block of a block-editor body.",
        "required": [
          "type",
          "data"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 100
          },
          "type": {
            "type": "string",
            "enum": [
              "paragraph",
              "header",
              "list",
              "image",
              "quote",
              "code",
              "delimiter",
              "table",
              "warning",
              "button",
              "embed",
              "columns",
              "raw"
            ]
          },
          "data": {
            "type": "object",
            "additionalProperties": true,
            "description": "The block's fields, e.g. `{ text }` for a paragraph, `{ text, level }` for a header, `{ text, url }` for a button, `{ html }` for raw HTML."
          },
          "tunes": {
            "type": "object",
            "additionalProperties": true,
            "description": "Presentation tweaks such as alignment."
          }
        }
      },
      "PlatformTemplateContent": {
        "type": "object",
        "description": "A template body: `html`, `blocks`, or both.",
        "additionalProperties": false,
        "properties": {
          "html": {
            "type": "string"
          },
          "blocks": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "blocks"
            ],
            "properties": {
              "time": {
                "type": "number"
              },
              "version": {
                "type": "string"
              },
              "blocks": {
                "type": "array",
                "maxItems": 500,
                "items": {
                  "$ref": "#/components/schemas/PlatformTemplateBlock"
                }
              }
            }
          }
        }
      },
      "PlatformTemplate": {
        "type": "object",
        "description": "A reusable message template.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "message",
              "transactional",
              "receipt"
            ],
            "description": "`receipt` is a legacy type: listed where it exists, never created."
          },
          "subject": {
            "type": "string",
            "nullable": true
          },
          "previewText": {
            "type": "string",
            "nullable": true
          },
          "content": {
            "$ref": "#/components/schemas/PlatformTemplateContent"
          },
          "contentType": {
            "type": "string",
            "enum": [
              "html",
              "text"
            ]
          },
          "systemTemplateKey": {
            "type": "string",
            "nullable": true,
            "description": "Set on the organization's own copy of a system email: the key of the email it replaces, which is then sent as this template."
          },
          "translatedLocales": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Locales with their own copy of this template. Per-locale copy is managed in the admin portal."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformTemplateCreate": {
        "type": "object",
        "description": "Fields accepted when creating a template. Unknown fields are refused.",
        "required": [
          "name",
          "content"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Name, shown to staff when picking a template."
          },
          "type": {
            "type": "string",
            "enum": [
              "message",
              "transactional"
            ],
            "description": "`message`: applied in the message composer. `transactional`: sent by automations. Decides which `{{variables}}` the template may use.",
            "default": "message"
          },
          "subject": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Email subject. May use variables. null clears it."
          },
          "previewText": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "The line an inbox shows after the subject. null clears it."
          },
          "content": {
            "description": "The body. A string is HTML (or plain text with `contentType: text`). The object form is `{ html }` and/or `{ blocks }` in the block editor's format. An HTML block over the email size limit is refused (`CONTENT_TOO_LARGE`), and so is a button whose link has a `{{variable}}` inside the address rather than as the whole address (`LINK_HAS_BURIED_VARIABLE`).",
            "oneOf": [
              {
                "type": "string",
                "maxLength": 500000
              },
              {
                "$ref": "#/components/schemas/PlatformTemplateContent"
              }
            ]
          },
          "contentType": {
            "type": "string",
            "enum": [
              "html",
              "text"
            ],
            "description": "How a string body is read.",
            "default": "html"
          }
        }
      },
      "PlatformTemplateUpdate": {
        "type": "object",
        "description": "Fields accepted when updating a template. Send only what changes; `content` replaces the whole body. The type of an organization's copy of a system email cannot change.",
        "minProperties": 1,
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Name, shown to staff when picking a template."
          },
          "type": {
            "type": "string",
            "enum": [
              "message",
              "transactional"
            ],
            "description": "`message`: applied in the message composer. `transactional`: sent by automations. Decides which `{{variables}}` the template may use."
          },
          "subject": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "Email subject. May use variables. null clears it."
          },
          "previewText": {
            "type": "string",
            "nullable": true,
            "maxLength": 255,
            "description": "The line an inbox shows after the subject. null clears it."
          },
          "content": {
            "description": "The body. A string is HTML (or plain text with `contentType: text`). The object form is `{ html }` and/or `{ blocks }` in the block editor's format. An HTML block over the email size limit is refused (`CONTENT_TOO_LARGE`), and so is a button whose link has a `{{variable}}` inside the address rather than as the whole address (`LINK_HAS_BURIED_VARIABLE`).",
            "oneOf": [
              {
                "type": "string",
                "maxLength": 500000
              },
              {
                "$ref": "#/components/schemas/PlatformTemplateContent"
              }
            ]
          },
          "contentType": {
            "type": "string",
            "enum": [
              "html",
              "text"
            ],
            "description": "How a string body is read."
          }
        }
      },
      "PlatformTemplatePage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformTemplate"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total templates matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformTemplateVariable": {
        "type": "object",
        "description": "A `{{name}}` placeholder a template may use, expanded per recipient when the message is rendered.",
        "properties": {
          "name": {
            "type": "string",
            "description": "Written in a template as `{{name}}`."
          },
          "description": {
            "type": "string",
            "description": "What it expands to."
          },
          "category": {
            "type": "string",
            "enum": [
              "contact",
              "organization",
              "message",
              "booking",
              "membership",
              "form"
            ]
          }
        }
      },
      "PlatformSystemTemplate": {
        "type": "object",
        "description": "An email 1club sends on the organization's behalf that it may replace with its own copy.",
        "properties": {
          "key": {
            "type": "string",
            "description": "Stable identifier, e.g. `booking-confirmation`."
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "description": "When it is sent."
          },
          "subject": {
            "type": "string",
            "nullable": true,
            "description": "The built-in subject, with its variables."
          },
          "previewText": {
            "type": "string",
            "nullable": true,
            "description": "The built-in preview text."
          },
          "variables": {
            "type": "array",
            "description": "The variables this email's renderer supplies, which the organization's copy may use.",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "required": {
                  "type": "boolean",
                  "description": "Always supplied when the email is sent."
                }
              }
            }
          },
          "hasOverride": {
            "type": "boolean",
            "description": "Whether the organization has its own copy, which is then what gets sent."
          },
          "overrideTemplateId": {
            "type": "integer",
            "nullable": true,
            "description": "The id of that copy, to read or edit as a template."
          }
        }
      },
      "PlatformEventTicket": {
        "type": "object",
        "description": "A way in to an event, at a fixed price.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "price": {
            "type": "number",
            "description": "Net price; 0 is free."
          },
          "capacity": {
            "type": "integer",
            "nullable": true,
            "description": "Places this ticket sells; null when unlimited."
          },
          "revenueAccountId": {
            "type": "integer",
            "nullable": true,
            "description": "Where its income is booked, from GET /v1/platform/revenue-accounts."
          },
          "sortOrder": {
            "type": "integer"
          },
          "translations": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "description": "Per-locale wording, as { \"es\": { \"title\": \"...\" } }. Replaces the whole map when sent."
          },
          "soldCount": {
            "type": "integer",
            "description": "Active bookings holding this ticket. On a single-event read and on writes; not in the list."
          }
        }
      },
      "PlatformEventTicketWrite": {
        "type": "object",
        "required": [
          "name"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "integer",
            "description": "An existing ticket of this event, to keep and update it. Leave out for a new ticket."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 500
          },
          "price": {
            "type": "number",
            "minimum": 0,
            "nullable": true,
            "description": "Net price; 0 or omitted is free."
          },
          "capacity": {
            "type": "integer",
            "minimum": 1,
            "nullable": true,
            "description": "Places this ticket sells; omit for unlimited."
          },
          "revenueAccountId": {
            "type": "integer",
            "nullable": true,
            "description": "Must belong to the organization."
          },
          "sortOrder": {
            "type": "integer",
            "description": "Display order; defaults to the position in the list."
          },
          "translations": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "description": "Per-locale wording, as { \"es\": { \"title\": \"...\" } }. Replaces the whole map when sent."
          }
        }
      },
      "PlatformEvent": {
        "type": "object",
        "description": "A one-off occasion a club puts on, sold through tickets. Counts only: who booked is not part of an event.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "slug": {
            "type": "string",
            "description": "The last part of the public URL; follows the title."
          },
          "title": {
            "type": "string"
          },
          "summary": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "object",
            "description": "An Editor.js document: { blocks: [{ type, data }] }.",
            "required": [
              "blocks"
            ],
            "properties": {
              "time": {
                "type": "number"
              },
              "blocks": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "type",
                    "data"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "example": "paragraph"
                    },
                    "data": {
                      "type": "object"
                    },
                    "tunes": {
                      "type": "object"
                    }
                  }
                }
              },
              "version": {
                "type": "string"
              }
            },
            "nullable": true
          },
          "descriptionText": {
            "type": "string",
            "nullable": true,
            "description": "`description` as plain text."
          },
          "coverImage": {
            "type": "string",
            "nullable": true
          },
          "location": {
            "type": "string",
            "nullable": true
          },
          "clubId": {
            "type": "integer",
            "nullable": true
          },
          "club": {
            "type": "object",
            "nullable": true,
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "startTime": {
            "type": "string",
            "format": "date-time"
          },
          "endTime": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "live",
              "cancelled"
            ],
            "description": "draft: members see nothing. live: published. cancelled: called off, its bookings cancelled."
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Public",
              "Member_only",
              "Private"
            ]
          },
          "featured": {
            "type": "boolean"
          },
          "bookable": {
            "type": "boolean"
          },
          "paymentCollection": {
            "type": "string",
            "enum": [
              "online",
              "on_arrival",
              "member_choice"
            ]
          },
          "sports": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "notifyStaff": {
            "type": "boolean"
          },
          "translations": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "description": "Per-locale wording, as { \"es\": { \"title\": \"...\" } }. Replaces the whole map when sent."
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When it was first published."
          },
          "publicUrl": {
            "type": "string",
            "nullable": true,
            "description": "The member-facing page. null unless the event is live, or when the organization publishes neither a website nor a member portal."
          },
          "instructors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "name": {
                  "type": "string",
                  "nullable": true
                }
              }
            }
          },
          "areas": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "name": {
                  "type": "string"
                }
              }
            }
          },
          "tickets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformEventTicket"
            },
            "description": "Active tickets, in display order."
          },
          "bookedCount": {
            "type": "integer",
            "description": "Active bookings (confirmed, pending, checked in) across all tickets."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformEventCreate": {
        "type": "object",
        "description": "Fields accepted when creating an event. It is always created as a draft. Unknown fields are refused.",
        "required": [
          "title",
          "startTime",
          "endTime"
        ],
        "additionalProperties": false,
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Changing it changes the slug, and with it the public URL."
          },
          "summary": {
            "type": "string",
            "nullable": true,
            "maxLength": 500,
            "description": "Plain-text teaser shown on cards and in notifications."
          },
          "description": {
            "nullable": true,
            "description": "Plain text (a blank line starts a new paragraph) or an Editor.js document. null clears it.",
            "oneOf": [
              {
                "type": "string",
                "maxLength": 20000
              },
              {
                "type": "object",
                "description": "An Editor.js document: { blocks: [{ type, data }] }.",
                "required": [
                  "blocks"
                ],
                "properties": {
                  "time": {
                    "type": "number"
                  },
                  "blocks": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "type",
                        "data"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string",
                          "example": "paragraph"
                        },
                        "data": {
                          "type": "object"
                        },
                        "tunes": {
                          "type": "object"
                        }
                      }
                    }
                  },
                  "version": {
                    "type": "string"
                  }
                }
              }
            ]
          },
          "coverImage": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "description": "Image URL, e.g. from the media library."
          },
          "location": {
            "type": "string",
            "nullable": true,
            "maxLength": 300,
            "description": "Free text; the event may take place away from any club."
          },
          "clubId": {
            "type": "integer",
            "nullable": true,
            "description": "The club it belongs to; null for an organization-wide or off-site event. Decides the timezone wall-clock times are read in, and on create must still be taking events."
          },
          "startTime": {
            "type": "string",
            "description": "Start. With an offset or Z it is an exact instant; without one (2026-06-01T18:00:00) it is the wall clock at the event's club, in the club's timezone - or the organization's when the event names no club.",
            "example": "2026-06-01T18:00:00"
          },
          "endTime": {
            "type": "string",
            "description": "End, after the start. With an offset or Z it is an exact instant; without one (2026-06-01T18:00:00) it is the wall clock at the event's club, in the club's timezone - or the organization's when the event names no club.",
            "example": "2026-06-01T18:00:00"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Public",
              "Member_only",
              "Private"
            ],
            "description": "Who sees it once live: anyone, signed-in members only, or nobody (reachable by staff only). Defaults to Public."
          },
          "featured": {
            "type": "boolean",
            "description": "Promote it on the website and portal."
          },
          "bookable": {
            "type": "boolean",
            "description": "Whether places can be booked. An event with tickets always is, and a bookable event must have at least one ticket."
          },
          "paymentCollection": {
            "type": "string",
            "enum": [
              "online",
              "on_arrival",
              "member_choice"
            ],
            "description": "How paid tickets are paid: online at booking, at the desk on arrival, or the buyer chooses. Free tickets never charge."
          },
          "sports": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Sport ids, e.g. padel, tennis."
          },
          "translations": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "description": "Per-locale wording, as { \"es\": { \"title\": \"...\", \"summary\": \"...\" } }. The description is translated per block, under positional keys such as \"block.0.text\" and \"block.1.items.0\" (each with a \"src:\"-prefixed stamp of the text it was made from); a block translation that no longer matches the description is dropped on save. Replaces the whole map when sent; null clears it."
          },
          "instructorIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Coaches running it. Each must belong to the organization. Replaces the whole list when sent."
          },
          "areaIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Areas (courts, rooms) it occupies for its whole window while live. Each must belong to the organization. Replaces the whole list when sent."
          },
          "tickets": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/PlatformEventTicketWrite"
            },
            "description": "Every ticket the event should sell. Replaces the set: resend each ticket you keep with its id; one without an id is new; one left out is retired (deactivated if it has bookings, deleted if not)."
          },
          "notifyStaff": {
            "type": "boolean",
            "description": "Email admins and managers when a booking for this event is confirmed."
          }
        }
      },
      "PlatformEventUpdate": {
        "type": "object",
        "description": "Fields accepted when updating an event. Send only what changes. Unknown fields are refused.",
        "minProperties": 1,
        "additionalProperties": false,
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Changing it changes the slug, and with it the public URL."
          },
          "summary": {
            "type": "string",
            "nullable": true,
            "maxLength": 500,
            "description": "Plain-text teaser shown on cards and in notifications."
          },
          "description": {
            "nullable": true,
            "description": "Plain text (a blank line starts a new paragraph) or an Editor.js document. null clears it.",
            "oneOf": [
              {
                "type": "string",
                "maxLength": 20000
              },
              {
                "type": "object",
                "description": "An Editor.js document: { blocks: [{ type, data }] }.",
                "required": [
                  "blocks"
                ],
                "properties": {
                  "time": {
                    "type": "number"
                  },
                  "blocks": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "type",
                        "data"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string",
                          "example": "paragraph"
                        },
                        "data": {
                          "type": "object"
                        },
                        "tunes": {
                          "type": "object"
                        }
                      }
                    }
                  },
                  "version": {
                    "type": "string"
                  }
                }
              }
            ]
          },
          "coverImage": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "description": "Image URL, e.g. from the media library."
          },
          "location": {
            "type": "string",
            "nullable": true,
            "maxLength": 300,
            "description": "Free text; the event may take place away from any club."
          },
          "clubId": {
            "type": "integer",
            "nullable": true,
            "description": "The club it belongs to; null for an organization-wide or off-site event. Decides the timezone wall-clock times are read in, and on create must still be taking events."
          },
          "startTime": {
            "type": "string",
            "description": "Start. With an offset or Z it is an exact instant; without one (2026-06-01T18:00:00) it is the wall clock at the event's club, in the club's timezone - or the organization's when the event names no club.",
            "example": "2026-06-01T18:00:00"
          },
          "endTime": {
            "type": "string",
            "description": "End, after the start. With an offset or Z it is an exact instant; without one (2026-06-01T18:00:00) it is the wall clock at the event's club, in the club's timezone - or the organization's when the event names no club.",
            "example": "2026-06-01T18:00:00"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Public",
              "Member_only",
              "Private"
            ],
            "description": "Who sees it once live: anyone, signed-in members only, or nobody (reachable by staff only). Defaults to Public."
          },
          "featured": {
            "type": "boolean",
            "description": "Promote it on the website and portal."
          },
          "bookable": {
            "type": "boolean",
            "description": "Whether places can be booked. An event with tickets always is, and a bookable event must have at least one ticket."
          },
          "paymentCollection": {
            "type": "string",
            "enum": [
              "online",
              "on_arrival",
              "member_choice"
            ],
            "description": "How paid tickets are paid: online at booking, at the desk on arrival, or the buyer chooses. Free tickets never charge."
          },
          "sports": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Sport ids, e.g. padel, tennis."
          },
          "translations": {
            "type": "object",
            "nullable": true,
            "additionalProperties": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "description": "Per-locale wording, as { \"es\": { \"title\": \"...\", \"summary\": \"...\" } }. The description is translated per block, under positional keys such as \"block.0.text\" and \"block.1.items.0\" (each with a \"src:\"-prefixed stamp of the text it was made from); a block translation that no longer matches the description is dropped on save. Replaces the whole map when sent; null clears it."
          },
          "instructorIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Coaches running it. Each must belong to the organization. Replaces the whole list when sent."
          },
          "areaIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "Areas (courts, rooms) it occupies for its whole window while live. Each must belong to the organization. Replaces the whole list when sent."
          },
          "tickets": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/PlatformEventTicketWrite"
            },
            "description": "Every ticket the event should sell. Replaces the set: resend each ticket you keep with its id; one without an id is new; one left out is retired (deactivated if it has bookings, deleted if not)."
          },
          "notifyStaff": {
            "type": "boolean",
            "description": "Email admins and managers when a booking for this event is confirmed."
          }
        }
      },
      "PlatformEventPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformEvent"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total events matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformMessageSegment": {
        "type": "object",
        "additionalProperties": false,
        "description": "An audience resolved at the moment a member of staff sends the draft, so it includes whoever matches by then. Every criterion narrows it; **an empty object is every contact in the organization**. Mutually exclusive with `contactIds`.",
        "properties": {
          "type": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Contact types, e.g. member, lead."
          },
          "clubId": {
            "type": "integer",
            "description": "Contacts of this club."
          },
          "tags": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "string"
                }
              ]
            },
            "maxItems": 50,
            "description": "Tag ids."
          },
          "membershipPlanIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 50,
            "description": "Holding a current membership on any of these plans."
          },
          "membershipPlanCategoryIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 50,
            "description": "Holding a current membership in any of these plan categories."
          },
          "pipelineStageIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 50,
            "description": "In any of these pipeline stages."
          },
          "sourceIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 50,
            "description": "Came from any of these contact sources."
          },
          "progressionLevelIds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "maxItems": 50,
            "description": "At any of these progression levels or above on its track (\"blue belt and up\")."
          }
        }
      },
      "PlatformMessageRecipient": {
        "type": "object",
        "description": "One person on a Message and how it landed for them.",
        "properties": {
          "contactId": {
            "type": "integer"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "deliveryStatus": {
            "type": "string",
            "description": "queued until sent; then what the provider reported (sent, processed, delivered, deferred, bounced, dropped, failed, spam, unsubscribed), or skipped when it was never sent to this person."
          },
          "engagementStatus": {
            "type": "string",
            "nullable": true,
            "enum": [
              "open",
              "click",
              "unsubscribe",
              "spamreport"
            ],
            "description": "What the person did with it, where the channel reports it."
          },
          "skippedReason": {
            "type": "string",
            "nullable": true,
            "description": "Why it was not sent to this person (unsubscribed, suppressed, no address on file)."
          },
          "sentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "deliveredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "openedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "clickedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "bouncedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "failedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "unsubscribedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "PlatformMessage": {
        "type": "object",
        "description": "An email, SMS or WhatsApp Message. This API writes drafts only; it never sends one.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "uuid": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "description": "email, sms or whatsapp"
          },
          "direction": {
            "type": "string",
            "enum": [
              "outbound",
              "inbound"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "sent"
            ],
            "description": "draft: waiting for a member of staff to send it in the admin app; editable. sent: gone out (or received), read-only."
          },
          "subject": {
            "type": "string",
            "description": "Empty for SMS and WhatsApp."
          },
          "content": {
            "type": "object",
            "description": "The body as stored. On a single read and on writes; not in the list.",
            "properties": {
              "html": {
                "type": "string",
                "nullable": true
              },
              "blocks": {
                "type": "object",
                "description": "Editor.js blocks: { blocks: [{ type, data }] }.",
                "required": [
                  "blocks"
                ],
                "properties": {
                  "time": {
                    "type": "number"
                  },
                  "blocks": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "type",
                        "data"
                      ],
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string",
                          "example": "paragraph"
                        },
                        "data": {
                          "type": "object"
                        },
                        "tunes": {
                          "type": "object"
                        }
                      }
                    }
                  },
                  "version": {
                    "type": "string"
                  }
                },
                "nullable": true
              }
            }
          },
          "preview": {
            "type": "string",
            "description": "The start of the body as plain text."
          },
          "source": {
            "type": "string",
            "nullable": true,
            "description": "`api` for a draft written through this API or MCP; other values for Messages written in 1club; null when not recorded."
          },
          "sender": {
            "type": "object",
            "nullable": true,
            "description": "The member of staff the Message is attributed to. For an API-key draft, the person who created the key.",
            "properties": {
              "userId": {
                "type": "integer"
              },
              "name": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "audience": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "manual",
                  "segment"
                ],
                "description": "manual: the contacts in `recipients`. segment: whoever matches `segment` when it is sent."
              },
              "segment": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/PlatformMessageSegment"
                  }
                ],
                "nullable": true,
                "description": "The filter of a segment audience; null for a manual one."
              }
            }
          },
          "recipientCount": {
            "type": "integer"
          },
          "recipients": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformMessageRecipient"
            },
            "description": "On a single read and on writes; not in the list. Empty on a segment draft, whose audience is resolved when it is sent."
          },
          "replyToMessageId": {
            "type": "integer",
            "nullable": true,
            "description": "The Message this one replies to, within a conversation."
          },
          "sentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When it went out; null for a draft."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformMessageDraftCreate": {
        "type": "object",
        "description": "A new draft. It is never sent through this API: a member of staff reviews and sends it in the admin app. Name the audience with exactly one of `contactIds` or `segment`.",
        "required": [
          "type",
          "content"
        ],
        "additionalProperties": false,
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "email",
              "sms",
              "whatsapp"
            ],
            "description": "The channel, fixed once drafted. Push notifications cannot be composed."
          },
          "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Required for email."
          },
          "content": {
            "description": "The body. A string is HTML for email (sanitized) and plain text for SMS and WhatsApp. Or an object with `html` and/or Editor.js `blocks`, the shape the admin composer saves.",
            "oneOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "html": {
                    "type": "string"
                  },
                  "blocks": {
                    "type": "object",
                    "description": "Editor.js blocks: { blocks: [{ type, data }] }.",
                    "required": [
                      "blocks"
                    ],
                    "properties": {
                      "time": {
                        "type": "number"
                      },
                      "blocks": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "required": [
                            "type",
                            "data"
                          ],
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "type": {
                              "type": "string",
                              "example": "paragraph"
                            },
                            "data": {
                              "type": "object"
                            },
                            "tunes": {
                              "type": "object"
                            }
                          }
                        }
                      },
                      "version": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            ]
          },
          "contactIds": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5000,
            "items": {
              "type": "integer"
            },
            "description": "A hand-picked audience: contact ids, each in this organization. Mutually exclusive with `segment`."
          },
          "segment": {
            "$ref": "#/components/schemas/PlatformMessageSegment"
          }
        }
      },
      "PlatformMessageDraftUpdate": {
        "type": "object",
        "description": "Changes to a draft. Send only what changes. Sending `contactIds` or `segment` replaces the audience. The channel cannot change.",
        "minProperties": 1,
        "additionalProperties": false,
        "properties": {
          "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "content": {
            "description": "The body. A string is HTML for email (sanitized) and plain text for SMS and WhatsApp. Or an object with `html` and/or Editor.js `blocks`, the shape the admin composer saves.",
            "oneOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "html": {
                    "type": "string"
                  },
                  "blocks": {
                    "type": "object",
                    "description": "Editor.js blocks: { blocks: [{ type, data }] }.",
                    "required": [
                      "blocks"
                    ],
                    "properties": {
                      "time": {
                        "type": "number"
                      },
                      "blocks": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "required": [
                            "type",
                            "data"
                          ],
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "type": {
                              "type": "string",
                              "example": "paragraph"
                            },
                            "data": {
                              "type": "object"
                            },
                            "tunes": {
                              "type": "object"
                            }
                          }
                        }
                      },
                      "version": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            ]
          },
          "contactIds": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5000,
            "items": {
              "type": "integer"
            },
            "description": "A hand-picked audience: contact ids, each in this organization. Mutually exclusive with `segment`."
          },
          "segment": {
            "$ref": "#/components/schemas/PlatformMessageSegment"
          }
        }
      },
      "PlatformMessagePage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformMessage"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total messages matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformCompetitor": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "website": {
            "type": "string",
            "nullable": true,
            "description": "The website the weekly watch reads"
          },
          "googlePlaceId": {
            "type": "string",
            "nullable": true
          },
          "logoUrl": {
            "type": "string",
            "nullable": true,
            "description": "Their logo, as the last reading of their website found it"
          },
          "clubId": {
            "type": "integer",
            "nullable": true,
            "description": "The organization's club it competes with; null for all of them"
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "lastCheckedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When their website was last read; null until the first reading lands (about a minute after adding)"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "google": {
            "type": "object",
            "nullable": true,
            "description": "The club's Google rating, read live and cached for a day at most. Null when it has no Google place or Google did not answer.",
            "properties": {
              "rating": {
                "type": "number",
                "nullable": true,
                "description": "Out of 5"
              },
              "ratingCount": {
                "type": "integer",
                "nullable": true,
                "description": "How many reviews the rating rests on"
              }
            }
          },
          "latestChanges": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "One thing a reading found changed on the website since the reading before.",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "price_changed",
                    "price_added",
                    "price_removed",
                    "offer_added",
                    "offer_removed",
                    "service_added",
                    "service_removed"
                  ]
                },
                "name": {
                  "type": "string",
                  "description": "The price, offer or service, as the website names it"
                },
                "before": {
                  "type": "string",
                  "description": "The price before, on `price_changed` and `price_removed`"
                },
                "after": {
                  "type": "string",
                  "description": "The price now, on `price_changed` and `price_added`"
                }
              }
            },
            "description": "What the latest reading found changed on their website"
          }
        }
      },
      "PlatformCompetitorDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PlatformCompetitor"
          },
          {
            "type": "object",
            "properties": {
              "snapshots": {
                "type": "array",
                "description": "The latest readings of their website, newest first (at most 12)",
                "items": {
                  "type": "object",
                  "properties": {
                    "capturedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "sourceUrls": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "The pages, files and searches the reading was made from"
                    },
                    "facts": {
                      "type": "object",
                      "properties": {
                        "prices": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "price": {
                                "type": "string",
                                "description": "As the website writes it"
                              },
                              "period": {
                                "type": "string"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "membership",
                                  "pass",
                                  "drop_in",
                                  "court_hour",
                                  "private_session"
                                ]
                              },
                              "amount": {
                                "type": "number"
                              },
                              "currency": {
                                "type": "string"
                              },
                              "sport": {
                                "type": "string"
                              },
                              "concession": {
                                "type": "boolean",
                                "description": "A child's, student's, senior's, family's or group's price"
                              },
                              "source": {
                                "type": "string",
                                "description": "The page it was read from"
                              }
                            }
                          }
                        },
                        "offers": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "services": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "changes": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "description": "One thing a reading found changed on the website since the reading before.",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "price_changed",
                              "price_added",
                              "price_removed",
                              "offer_added",
                              "offer_removed",
                              "service_added",
                              "service_removed"
                            ]
                          },
                          "name": {
                            "type": "string",
                            "description": "The price, offer or service, as the website names it"
                          },
                          "before": {
                            "type": "string",
                            "description": "The price before, on `price_changed` and `price_removed`"
                          },
                          "after": {
                            "type": "string",
                            "description": "The price now, on `price_changed` and `price_added`"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "PlatformCompetitorList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformCompetitor"
            },
            "description": "Every competitor on the list, by name"
          },
          "ownClubs": {
            "type": "array",
            "description": "The organization's own clubs' Google standing, to compare against",
            "items": {
              "type": "object",
              "properties": {
                "clubId": {
                  "type": "integer"
                },
                "clubName": {
                  "type": "string"
                },
                "onGoogle": {
                  "type": "boolean",
                  "description": "Whether the club is linked to its Google place"
                },
                "logoUrl": {
                  "type": "string",
                  "nullable": true
                },
                "rating": {
                  "type": "number",
                  "nullable": true
                },
                "ratingCount": {
                  "type": "integer",
                  "nullable": true
                }
              }
            }
          },
          "importableFromReport": {
            "type": "integer",
            "description": "Clubs the latest AI visibility report suggested that are not on the list yet"
          },
          "limit": {
            "type": "integer",
            "description": "How many competitors the list holds at most"
          },
          "available": {
            "type": "boolean",
            "description": "Whether the plan has Competitors (Grow). Without it the list can be read, edited and pruned, but nothing is added and no website is read."
          }
        }
      },
      "PlatformCompetitorCreate": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "website": {
            "type": "string",
            "nullable": true,
            "maxLength": 500,
            "description": "The club's own website, not a social profile. Changing it discards the readings of the old one."
          },
          "googlePlaceId": {
            "type": "string",
            "nullable": true,
            "maxLength": 300,
            "description": "Their Google place id, for the rating and reviews. On create without a website, the website comes from the place."
          },
          "clubId": {
            "type": "integer",
            "nullable": true,
            "description": "The organization's club it competes with; null for all of them"
          },
          "notes": {
            "type": "string",
            "nullable": true,
            "maxLength": 2000
          }
        }
      },
      "PlatformCompetitorUpdate": {
        "type": "object",
        "minProperties": 1,
        "description": "Send only what changes; a field left out is left alone.",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "website": {
            "type": "string",
            "nullable": true,
            "maxLength": 500,
            "description": "The club's own website, not a social profile. Changing it discards the readings of the old one."
          },
          "googlePlaceId": {
            "type": "string",
            "nullable": true,
            "maxLength": 300,
            "description": "Their Google place id, for the rating and reviews. On create without a website, the website comes from the place."
          },
          "clubId": {
            "type": "integer",
            "nullable": true,
            "description": "The organization's club it competes with; null for all of them"
          },
          "notes": {
            "type": "string",
            "nullable": true,
            "maxLength": 2000
          }
        }
      },
      "PlatformCompetitorMarket": {
        "type": "object",
        "description": "Every club's prices compared, competitors and the organization's own. A benchmark is one thing two or more clubs price, in one unit; each club is compared at its cheapest regular price.",
        "properties": {
          "currency": {
            "type": "string",
            "description": "The organization's currency, which every amount is in"
          },
          "benchmarks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "membership",
                    "pass",
                    "drop_in",
                    "court_hour",
                    "private_session"
                  ]
                },
                "term": {
                  "type": "string",
                  "nullable": true,
                  "enum": [
                    "month",
                    "term",
                    "year",
                    null
                  ],
                  "description": "A membership's length: `month`, `term` (3 to 9 months) or `year`"
                },
                "sport": {
                  "type": "string",
                  "nullable": true
                },
                "median": {
                  "type": "number",
                  "description": "The market median, per unit"
                },
                "min": {
                  "type": "number"
                },
                "max": {
                  "type": "number"
                },
                "count": {
                  "type": "integer",
                  "description": "How many clubs list it"
                }
              }
            }
          },
          "entries": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "own": {
                  "type": "boolean",
                  "description": "One of the organization's own clubs"
                },
                "clubId": {
                  "type": "integer",
                  "nullable": true
                },
                "competitorId": {
                  "type": "integer",
                  "nullable": true
                },
                "name": {
                  "type": "string"
                },
                "logoUrl": {
                  "type": "string",
                  "nullable": true
                },
                "rating": {
                  "type": "number",
                  "nullable": true
                },
                "reviews": {
                  "type": "integer",
                  "nullable": true
                },
                "prices": {
                  "type": "object",
                  "description": "Its price for each benchmark it lists, by benchmark key",
                  "additionalProperties": {
                    "type": "object",
                    "properties": {
                      "benchmark": {
                        "type": "string"
                      },
                      "kind": {
                        "type": "string",
                        "enum": [
                          "membership",
                          "pass",
                          "drop_in",
                          "court_hour",
                          "private_session"
                        ]
                      },
                      "term": {
                        "type": "string",
                        "nullable": true,
                        "enum": [
                          "month",
                          "term",
                          "year",
                          null
                        ],
                        "description": "A membership's length: `month`, `term` (3 to 9 months) or `year`"
                      },
                      "sport": {
                        "type": "string",
                        "nullable": true
                      },
                      "unitAmount": {
                        "type": "number",
                        "description": "Per month, visit, hour or session"
                      },
                      "name": {
                        "type": "string"
                      },
                      "label": {
                        "type": "string",
                        "nullable": true,
                        "description": "As the competitor's website writes it; null for the organization's own"
                      },
                      "concession": {
                        "type": "boolean"
                      },
                      "source": {
                        "type": "string",
                        "nullable": true
                      }
                    }
                  }
                },
                "priceIndex": {
                  "type": "integer",
                  "nullable": true,
                  "description": "Its prices against the market median, where 100 is the median: 88 is 12% below the market. The median of its ratios across every benchmark it lists."
                }
              }
            }
          },
          "refreshing": {
            "type": "boolean",
            "description": "Readings made before prices were compared this way are being redone; read again in a minute"
          }
        }
      },
      "PlatformCompetitorAnalysis": {
        "type": "object",
        "properties": {
          "reviews": {
            "type": "object",
            "description": "What the competitor's latest Google reviews say",
            "properties": {
              "loved": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "complaints": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "count": {
                "type": "integer",
                "description": "How many reviews were read"
              }
            }
          },
          "comparison": {
            "type": "object",
            "description": "The organization against the competitor, from both clubs' reviews and websites",
            "properties": {
              "ahead": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "behind": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "nextSteps": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "PlatformPromotion": {
        "type": "object",
        "properties": {
          "promotionId": {
            "type": "integer"
          },
          "name": {
            "type": "string",
            "description": "What members see beside the discounted price"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "type": {
            "type": "string",
            "enum": [
              "discount",
              "voucher"
            ],
            "description": "`discount` comes off what is bought; `voucher` is an amount the member keeps as credit"
          },
          "discountFormat": {
            "type": "string",
            "nullable": true,
            "enum": [
              "percent",
              "amount",
              null
            ],
            "description": "A discount's form; null on a voucher, whose value is an amount"
          },
          "value": {
            "type": "number",
            "description": "The percentage off, or the amount in the organization's currency"
          },
          "code": {
            "type": "string",
            "nullable": true,
            "description": "The promo code a member types; null when there is none"
          },
          "autoApply": {
            "type": "boolean",
            "description": "Applies itself at checkout, without a code"
          },
          "startsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "endsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "scheduled",
              "live",
              "ended"
            ],
            "description": "Where the promotion is in its date range now"
          },
          "redemptionCount": {
            "type": "integer",
            "description": "How many times it has been redeemed"
          },
          "maxRedemptions": {
            "type": "integer",
            "nullable": true,
            "description": "The most it may be redeemed in all; null for no limit"
          },
          "maxRedemptionsPerContact": {
            "type": "integer",
            "nullable": true,
            "description": "The most one member may redeem it; null for no limit"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Public",
              "Member_only",
              "Private"
            ],
            "description": "Who sees it offered. Defaults to Public"
          },
          "validFor": {
            "type": "object",
            "additionalProperties": false,
            "description": "What it applies to. Bookings qualify through `scopes`, narrowed by the type ids and `clubIds` (empty = every one). A plan purchase qualifies only when named in `planIds`, or with `allPlans`.",
            "properties": {
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "classes",
                    "areas",
                    "instructors"
                  ]
                }
              },
              "classTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Class type ids"
              },
              "areaTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Area type ids"
              },
              "instructorTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Instructor type ids"
              },
              "clubIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Clubs whose bookings qualify; empty = every club"
              },
              "planIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Plans whose purchase it discounts"
              },
              "allPlans": {
                "type": "boolean",
                "description": "Every plan purchase. Ignored when planIds is not empty; not allowed with autoApply"
              }
            }
          },
          "segmentFilter": {
            "type": "object",
            "additionalProperties": false,
            "description": "Who it is for: a buyer must match every list sent. `{}` is everyone.",
            "properties": {
              "memberTypes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "contact",
                    "member",
                    "staff",
                    "lead",
                    "lapsed",
                    "drop_in",
                    "archived"
                  ]
                }
              },
              "tags": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "integer"
                    }
                  ]
                },
                "description": "Tag names or ids"
              },
              "membershipPlanIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Plans the buyer must already hold"
              },
              "membershipPlanCategoryIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              "pipelineStageIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              "sourceIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              "progressionLevelIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              }
            }
          },
          "conditions": {
            "type": "object",
            "additionalProperties": false,
            "description": "When a booking qualifies. Each condition judges the whole booking.",
            "properties": {
              "minPeople": {
                "type": "integer",
                "minimum": 2
              },
              "timeWindow": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "startTime",
                  "endTime"
                ],
                "description": "On the club's clock. `match` start (the default): the booking starts inside it; within: it fits inside it",
                "properties": {
                  "weekdays": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "monday",
                        "tuesday",
                        "wednesday",
                        "thursday",
                        "friday",
                        "saturday",
                        "sunday"
                      ]
                    }
                  },
                  "startTime": {
                    "type": "string",
                    "example": "08:00",
                    "description": "HH:mm"
                  },
                  "endTime": {
                    "type": "string",
                    "example": "16:00",
                    "description": "HH:mm"
                  },
                  "match": {
                    "type": "string",
                    "enum": [
                      "start",
                      "within"
                    ]
                  }
                }
              },
              "bookingLength": {
                "type": "object",
                "additionalProperties": false,
                "description": "Inclusive bounds on the booking length, in minutes",
                "properties": {
                  "minMinutes": {
                    "type": "integer",
                    "nullable": true
                  },
                  "maxMinutes": {
                    "type": "integer",
                    "nullable": true
                  }
                }
              },
              "firstBookingOnly": {
                "type": "boolean",
                "description": "Only for someone with no earlier booking"
              },
              "firstPurchaseOnly": {
                "type": "boolean",
                "description": "Only for someone who never held one of the plans it targets. Left out: on for autoApply, off for a code"
              }
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformPromotionPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformPromotion"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total promotions matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformExternalProgram": {
        "type": "object",
        "description": "A third party - MultiSport, a municipal scheme, a corporate wellness card - that pays for members' visits.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "clubId": {
            "type": "integer",
            "nullable": true,
            "description": "null: honoured at every club."
          },
          "club": {
            "type": "object",
            "nullable": true,
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "isActive": {
            "type": "boolean",
            "description": "An inactive program cannot be chosen for new bookings or check-ins."
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Private",
              "Member_only",
              "Public"
            ]
          },
          "coveredAmountPerVisit": {
            "type": "number",
            "nullable": true,
            "description": "A fixed amount the program pays per visit. null with `coveredPercentPerVisit`: the whole visit."
          },
          "coveredPercentPerVisit": {
            "type": "number",
            "nullable": true,
            "description": "The share of the visit's price the program pays, as a percentage. The member pays the rest."
          },
          "validFor": {
            "type": "object",
            "properties": {
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "classes",
                    "areas",
                    "instructors"
                  ]
                },
                "description": "What members may use it for. No scopes: a program for check-ins only, never offered when booking."
              },
              "classTypeIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Within `classes`, only these class types. Empty means every one."
              },
              "areaTypeIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Within `areas`, only these area types. Empty means every one."
              },
              "instructorTypeIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Within `instructors`, only these instructor types. Empty means every one."
              }
            }
          },
          "validWindows": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "weekdays"
              ],
              "properties": {
                "weekdays": {
                  "type": "array",
                  "minItems": 1,
                  "items": {
                    "type": "string",
                    "enum": [
                      "monday",
                      "tuesday",
                      "wednesday",
                      "thursday",
                      "friday",
                      "saturday",
                      "sunday"
                    ]
                  },
                  "example": [
                    "monday",
                    "tuesday",
                    "wednesday",
                    "thursday",
                    "friday"
                  ]
                },
                "startTime": {
                  "type": "string",
                  "example": "06:00",
                  "description": "HH:mm, inclusive. Leave out together with endTime for all day."
                },
                "endTime": {
                  "type": "string",
                  "example": "16:00",
                  "description": "HH:mm, exclusive, or 24:00 for midnight. A window never runs past midnight."
                }
              }
            },
            "description": "When it can be used. Empty: any time."
          },
          "operatingHours": {
            "type": "object",
            "deprecated": true,
            "additionalProperties": {
              "type": "object",
              "properties": {
                "enabled": {
                  "type": "boolean"
                },
                "openTime": {
                  "type": "string",
                  "example": "06:00"
                },
                "closeTime": {
                  "type": "string",
                  "example": "22:00"
                },
                "is24Hours": {
                  "type": "boolean"
                }
              }
            },
            "description": "Deprecated: `validWindows` as one window per weekday. `{}` for no windows; a day with more than one window reads as its earliest."
          },
          "knownProgram": {
            "type": "string",
            "nullable": true,
            "enum": [
              "multisport",
              null
            ]
          },
          "cardFormat": {
            "type": "string",
            "nullable": true,
            "enum": [
              "number",
              "multisport",
              null
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformExternalProgramCreate": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "code"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "The club's label for it, shown to staff and members."
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z0-9_-]+$",
            "description": "Short identifier, unique in the organization: lowercase letters, digits, hyphens and underscores."
          },
          "clubId": {
            "type": "integer",
            "nullable": true,
            "description": "The one club it is honoured at. null: every club."
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Private",
              "Member_only",
              "Public"
            ],
            "description": "`Public` and `Member_only`: members can choose it themselves. `Private`: only staff can apply it. Defaults to `Public` on create."
          },
          "coveredAmountPerVisit": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "exclusiveMinimum": true,
            "description": "A fixed amount the program pays per visit, tax included; the member pays the rest of the price. Exclusive with `coveredPercentPerVisit`; both null: the program pays for the whole visit."
          },
          "coveredPercentPerVisit": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "maximum": 100,
            "description": "The share of the visit's price the program pays, as a percentage: of what a direct payment would charge, pricing rules applied. The member pays the rest. Exclusive with `coveredAmountPerVisit`."
          },
          "validFor": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "classes",
                    "areas",
                    "instructors"
                  ]
                },
                "description": "What members may use it for. No scopes: a program for check-ins only, never offered when booking."
              },
              "classTypeIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Within `classes`, only these class types. Empty means every one."
              },
              "areaTypeIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Within `areas`, only these area types. Empty means every one."
              },
              "instructorTypeIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Within `instructors`, only these instructor types. Empty means every one."
              }
            },
            "description": "Replaces the stored value wholesale when sent on an update."
          },
          "validWindows": {
            "type": "array",
            "maxItems": 14,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "weekdays"
              ],
              "properties": {
                "weekdays": {
                  "type": "array",
                  "minItems": 1,
                  "items": {
                    "type": "string",
                    "enum": [
                      "monday",
                      "tuesday",
                      "wednesday",
                      "thursday",
                      "friday",
                      "saturday",
                      "sunday"
                    ]
                  },
                  "example": [
                    "monday",
                    "tuesday",
                    "wednesday",
                    "thursday",
                    "friday"
                  ]
                },
                "startTime": {
                  "type": "string",
                  "example": "06:00",
                  "description": "HH:mm, inclusive. Leave out together with endTime for all day."
                },
                "endTime": {
                  "type": "string",
                  "example": "16:00",
                  "description": "HH:mm, exclusive, or 24:00 for midnight. A window never runs past midnight."
                }
              }
            },
            "description": "When it can be used: weekday + time windows, any one of which admits a visit that starts inside it, so a day can hold two (06:00 – 09:00 and 19:00 – 22:00). Empty: any time. Replaces the stored value when sent."
          },
          "operatingHours": {
            "type": "object",
            "nullable": true,
            "deprecated": true,
            "additionalProperties": false,
            "properties": {
              "monday": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "openTime": {
                    "type": "string",
                    "example": "06:00"
                  },
                  "closeTime": {
                    "type": "string",
                    "example": "22:00"
                  },
                  "is24Hours": {
                    "type": "boolean"
                  }
                }
              },
              "tuesday": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "openTime": {
                    "type": "string",
                    "example": "06:00"
                  },
                  "closeTime": {
                    "type": "string",
                    "example": "22:00"
                  },
                  "is24Hours": {
                    "type": "boolean"
                  }
                }
              },
              "wednesday": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "openTime": {
                    "type": "string",
                    "example": "06:00"
                  },
                  "closeTime": {
                    "type": "string",
                    "example": "22:00"
                  },
                  "is24Hours": {
                    "type": "boolean"
                  }
                }
              },
              "thursday": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "openTime": {
                    "type": "string",
                    "example": "06:00"
                  },
                  "closeTime": {
                    "type": "string",
                    "example": "22:00"
                  },
                  "is24Hours": {
                    "type": "boolean"
                  }
                }
              },
              "friday": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "openTime": {
                    "type": "string",
                    "example": "06:00"
                  },
                  "closeTime": {
                    "type": "string",
                    "example": "22:00"
                  },
                  "is24Hours": {
                    "type": "boolean"
                  }
                }
              },
              "saturday": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "openTime": {
                    "type": "string",
                    "example": "06:00"
                  },
                  "closeTime": {
                    "type": "string",
                    "example": "22:00"
                  },
                  "is24Hours": {
                    "type": "boolean"
                  }
                }
              },
              "sunday": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "openTime": {
                    "type": "string",
                    "example": "06:00"
                  },
                  "closeTime": {
                    "type": "string",
                    "example": "22:00"
                  },
                  "is24Hours": {
                    "type": "boolean"
                  }
                }
              }
            },
            "description": "Deprecated: use `validWindows`. One window per weekday, converted to `validWindows` (a day switched off is left out, `{}` clears them, null changes nothing). Not together with `validWindows`."
          },
          "knownProgram": {
            "type": "string",
            "nullable": true,
            "enum": [
              "multisport",
              null
            ],
            "description": "Which known program this is, such as MultiSport; null for the club's own. An organization has at most one of each, and it is only offered where its cards are supported (MultiSport: Bulgaria)."
          },
          "cardFormat": {
            "type": "string",
            "nullable": true,
            "enum": [
              "number",
              "multisport",
              null
            ],
            "description": "The card members carry for it. A known program reads its own card; any other program only `number`. null: no cards."
          }
        }
      },
      "PlatformExternalProgramUpdate": {
        "type": "object",
        "additionalProperties": false,
        "minProperties": 1,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "The club's label for it, shown to staff and members."
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[a-z0-9_-]+$",
            "description": "Short identifier, unique in the organization: lowercase letters, digits, hyphens and underscores."
          },
          "clubId": {
            "type": "integer",
            "nullable": true,
            "description": "The one club it is honoured at. null: every club."
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Private",
              "Member_only",
              "Public"
            ],
            "description": "`Public` and `Member_only`: members can choose it themselves. `Private`: only staff can apply it. Defaults to `Public` on create."
          },
          "coveredAmountPerVisit": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "exclusiveMinimum": true,
            "description": "A fixed amount the program pays per visit, tax included; the member pays the rest of the price. Exclusive with `coveredPercentPerVisit`; both null: the program pays for the whole visit."
          },
          "coveredPercentPerVisit": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "maximum": 100,
            "description": "The share of the visit's price the program pays, as a percentage: of what a direct payment would charge, pricing rules applied. The member pays the rest. Exclusive with `coveredAmountPerVisit`."
          },
          "validFor": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "classes",
                    "areas",
                    "instructors"
                  ]
                },
                "description": "What members may use it for. No scopes: a program for check-ins only, never offered when booking."
              },
              "classTypeIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Within `classes`, only these class types. Empty means every one."
              },
              "areaTypeIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Within `areas`, only these area types. Empty means every one."
              },
              "instructorTypeIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Within `instructors`, only these instructor types. Empty means every one."
              }
            },
            "description": "Replaces the stored value wholesale when sent on an update."
          },
          "validWindows": {
            "type": "array",
            "maxItems": 14,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "weekdays"
              ],
              "properties": {
                "weekdays": {
                  "type": "array",
                  "minItems": 1,
                  "items": {
                    "type": "string",
                    "enum": [
                      "monday",
                      "tuesday",
                      "wednesday",
                      "thursday",
                      "friday",
                      "saturday",
                      "sunday"
                    ]
                  },
                  "example": [
                    "monday",
                    "tuesday",
                    "wednesday",
                    "thursday",
                    "friday"
                  ]
                },
                "startTime": {
                  "type": "string",
                  "example": "06:00",
                  "description": "HH:mm, inclusive. Leave out together with endTime for all day."
                },
                "endTime": {
                  "type": "string",
                  "example": "16:00",
                  "description": "HH:mm, exclusive, or 24:00 for midnight. A window never runs past midnight."
                }
              }
            },
            "description": "When it can be used: weekday + time windows, any one of which admits a visit that starts inside it, so a day can hold two (06:00 – 09:00 and 19:00 – 22:00). Empty: any time. Replaces the stored value when sent."
          },
          "operatingHours": {
            "type": "object",
            "nullable": true,
            "deprecated": true,
            "additionalProperties": false,
            "properties": {
              "monday": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "openTime": {
                    "type": "string",
                    "example": "06:00"
                  },
                  "closeTime": {
                    "type": "string",
                    "example": "22:00"
                  },
                  "is24Hours": {
                    "type": "boolean"
                  }
                }
              },
              "tuesday": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "openTime": {
                    "type": "string",
                    "example": "06:00"
                  },
                  "closeTime": {
                    "type": "string",
                    "example": "22:00"
                  },
                  "is24Hours": {
                    "type": "boolean"
                  }
                }
              },
              "wednesday": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "openTime": {
                    "type": "string",
                    "example": "06:00"
                  },
                  "closeTime": {
                    "type": "string",
                    "example": "22:00"
                  },
                  "is24Hours": {
                    "type": "boolean"
                  }
                }
              },
              "thursday": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "openTime": {
                    "type": "string",
                    "example": "06:00"
                  },
                  "closeTime": {
                    "type": "string",
                    "example": "22:00"
                  },
                  "is24Hours": {
                    "type": "boolean"
                  }
                }
              },
              "friday": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "openTime": {
                    "type": "string",
                    "example": "06:00"
                  },
                  "closeTime": {
                    "type": "string",
                    "example": "22:00"
                  },
                  "is24Hours": {
                    "type": "boolean"
                  }
                }
              },
              "saturday": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "openTime": {
                    "type": "string",
                    "example": "06:00"
                  },
                  "closeTime": {
                    "type": "string",
                    "example": "22:00"
                  },
                  "is24Hours": {
                    "type": "boolean"
                  }
                }
              },
              "sunday": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "openTime": {
                    "type": "string",
                    "example": "06:00"
                  },
                  "closeTime": {
                    "type": "string",
                    "example": "22:00"
                  },
                  "is24Hours": {
                    "type": "boolean"
                  }
                }
              }
            },
            "description": "Deprecated: use `validWindows`. One window per weekday, converted to `validWindows` (a day switched off is left out, `{}` clears them, null changes nothing). Not together with `validWindows`."
          },
          "knownProgram": {
            "type": "string",
            "nullable": true,
            "enum": [
              "multisport",
              null
            ],
            "description": "Which known program this is, such as MultiSport; null for the club's own. An organization has at most one of each, and it is only offered where its cards are supported (MultiSport: Bulgaria)."
          },
          "cardFormat": {
            "type": "string",
            "nullable": true,
            "enum": [
              "number",
              "multisport",
              null
            ],
            "description": "The card members carry for it. A known program reads its own card; any other program only `number`. null: no cards."
          },
          "isActive": {
            "type": "boolean",
            "description": "false stops it being chosen for new bookings and check-ins; visits already recorded stay."
          }
        }
      },
      "PlatformReportChart": {
        "type": "object",
        "description": "A picture of the answer, drawn from its own figures (never a second computation) in the caller's language: a member of staff's own when they chose one, otherwise the organization's. Present only when the request asks with `charts=summary` or `charts=all` (the default is `none`), and when the answer has something to draw. Every figure it shows is in `alt` and in the answer itself.",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "trend",
              "kpis",
              "grid",
              "bars"
            ],
            "description": "A trend over the period, the headline figures, an hour by weekday grid, or a breakdown as bars."
          },
          "title": {
            "type": "string"
          },
          "alt": {
            "type": "string",
            "description": "The picture in words: every figure it shows."
          },
          "width": {
            "type": "integer",
            "description": "In px at 1x."
          },
          "height": {
            "type": "integer",
            "description": "In px at 1x."
          },
          "svg": {
            "type": "string",
            "description": "The picture as an SVG document: a white card with a hairline border. Each trend point carries `data-point` (its day), `data-series` and `data-value`; each grid cell `data-cell` (`<weekday>-<hour>`)."
          },
          "png": {
            "type": "string",
            "format": "byte",
            "description": "The picture as a PNG at 2x, base64, when the request sent `X-1Club-Chart-Image: png`; absent when it would weigh more than 600 KB."
          }
        }
      },
      "PlatformTaxFigures": {
        "type": "object",
        "properties": {
          "sales": {
            "type": "number",
            "description": "Ex-tax, net of refunds and Wallet credit."
          },
          "nonTaxable": {
            "type": "number",
            "description": "The part of the sales that carried no tax: no rate, or a 0% one."
          },
          "taxable": {
            "type": "number"
          },
          "tax": {
            "type": "number"
          },
          "total": {
            "type": "number",
            "description": "Sales plus tax."
          }
        }
      },
      "PlatformTaxReport": {
        "type": "object",
        "properties": {
          "period": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "format": "date"
              },
              "to": {
                "type": "string",
                "format": "date"
              },
              "days": {
                "type": "integer"
              }
            }
          },
          "chart": {
            "$ref": "#/components/schemas/PlatformReportChart"
          },
          "moreCharts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformReportChart"
            },
            "description": "With `charts=all`: every other picture the answer can draw, after `chart`."
          },
          "timezone": {
            "type": "string",
            "description": "The clock the days are read on."
          },
          "currency": {
            "type": "string"
          },
          "sections": {
            "type": "string",
            "enum": [
              "account",
              "rate",
              "club"
            ]
          },
          "rows": {
            "type": "string",
            "enum": [
              "day",
              "month"
            ]
          },
          "groups": {
            "type": "array",
            "description": "One per revenue account, tax rate or club, as `sections` asks.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer",
                  "nullable": true,
                  "description": "Null for the sales with no account, rate or club."
                },
                "name": {
                  "type": "string",
                  "nullable": true
                },
                "code": {
                  "type": "string",
                  "nullable": true,
                  "description": "The revenue account's bookkeeping code."
                },
                "rate": {
                  "type": "number",
                  "nullable": true,
                  "description": "The tax rate as a fraction (0.07)."
                },
                "rows": {
                  "type": "array",
                  "items": {
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/PlatformTaxFigures"
                      },
                      {
                        "type": "object",
                        "properties": {
                          "start": {
                            "type": "string",
                            "format": "date"
                          }
                        }
                      }
                    ]
                  }
                },
                "subtotal": {
                  "$ref": "#/components/schemas/PlatformTaxFigures"
                }
              }
            }
          },
          "total": {
            "$ref": "#/components/schemas/PlatformTaxFigures"
          },
          "byRate": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "taxRateId": {
                  "type": "integer",
                  "nullable": true
                },
                "name": {
                  "type": "string",
                  "nullable": true
                },
                "rate": {
                  "type": "number",
                  "nullable": true
                },
                "sales": {
                  "type": "number"
                },
                "tax": {
                  "type": "number"
                }
              }
            }
          }
        }
      },
      "PlatformTaxCharges": {
        "type": "object",
        "properties": {
          "period": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "format": "date"
              },
              "to": {
                "type": "string",
                "format": "date"
              },
              "days": {
                "type": "integer"
              }
            }
          },
          "timezone": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "total": {
            "type": "integer",
            "description": "Every line of the period, across all pages."
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "rows": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "transactionId": {
                  "type": "integer"
                },
                "day": {
                  "type": "string",
                  "format": "date",
                  "description": "The day the sale is filed on, on the organization's clock."
                },
                "transactionType": {
                  "type": "string",
                  "nullable": true
                },
                "paymentStatus": {
                  "type": "string"
                },
                "item": {
                  "type": "string",
                  "description": "What was sold: the class or court, the plan, the product."
                },
                "contactId": {
                  "type": "integer",
                  "nullable": true
                },
                "contactName": {
                  "type": "string",
                  "nullable": true
                },
                "clubId": {
                  "type": "integer",
                  "nullable": true
                },
                "clubName": {
                  "type": "string",
                  "nullable": true
                },
                "billingEntityId": {
                  "type": "integer"
                },
                "revenueAccountId": {
                  "type": "integer",
                  "nullable": true,
                  "description": "Null for a sale stored with no account, which counts as the default account."
                },
                "accountName": {
                  "type": "string",
                  "nullable": true
                },
                "accountCode": {
                  "type": "string",
                  "nullable": true
                },
                "taxRateId": {
                  "type": "integer",
                  "nullable": true
                },
                "taxRateName": {
                  "type": "string",
                  "nullable": true
                },
                "taxRate": {
                  "type": "number",
                  "nullable": true,
                  "description": "As a fraction (0.07)."
                },
                "sales": {
                  "type": "number",
                  "description": "What the sale is worth now, ex-tax: charged less credited."
                },
                "tax": {
                  "type": "number"
                },
                "total": {
                  "type": "number"
                },
                "charged": {
                  "type": "object",
                  "properties": {
                    "net": {
                      "type": "number"
                    },
                    "tax": {
                      "type": "number"
                    },
                    "gross": {
                      "type": "number"
                    }
                  }
                },
                "credited": {
                  "type": "object",
                  "properties": {
                    "net": {
                      "type": "number"
                    },
                    "tax": {
                      "type": "number"
                    },
                    "gross": {
                      "type": "number"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "PlatformAmountDueReport": {
        "type": "object",
        "properties": {
          "asOf": {
            "type": "string",
            "format": "date",
            "description": "Today on the organization's clock: the figures are the ledger now."
          },
          "currency": {
            "type": "string"
          },
          "byPerson": {
            "type": "boolean",
            "description": "Whether each person has a row of their own, rather than a household row."
          },
          "walletShown": {
            "type": "boolean",
            "description": "Whether Wallet balances are shown: not when the report is narrowed to a company other than the default one."
          },
          "totals": {
            "type": "object",
            "description": "Over every row of the report, not only this page.",
            "properties": {
              "amountDue": {
                "type": "number"
              },
              "aging": {
                "$ref": "#/components/schemas/PlatformAmountDueAging"
              },
              "threeMonthsOrMore": {
                "type": "number",
                "description": "Owed for three months or more."
              },
              "owing": {
                "type": "integer",
                "description": "Rows that owe something."
              },
              "wallet": {
                "type": "number",
                "nullable": true
              }
            }
          },
          "total": {
            "type": "integer",
            "description": "Every row of the report, across all pages."
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "rows": {
            "type": "array",
            "description": "Biggest Amount Due first, then the people holding only Wallet money, by balance.",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "household",
                    "contact"
                  ]
                },
                "id": {
                  "type": "integer",
                  "description": "The household's member account id, or the contact's id."
                },
                "name": {
                  "type": "string"
                },
                "contactId": {
                  "type": "integer",
                  "nullable": true,
                  "description": "The person the row is addressed to: the household's owner, or the contact."
                },
                "amountDue": {
                  "type": "number"
                },
                "aging": {
                  "$ref": "#/components/schemas/PlatformAmountDueAging"
                },
                "wallet": {
                  "type": "number",
                  "nullable": true,
                  "description": "The Wallet balance of everyone on the row; null when the Wallet is not shown."
                },
                "charges": {
                  "type": "array",
                  "description": "What the row owes, oldest first.",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "integer",
                        "description": "The transaction (charge) id."
                      },
                      "contactId": {
                        "type": "integer"
                      },
                      "contactName": {
                        "type": "string"
                      },
                      "dueDay": {
                        "type": "string",
                        "format": "date",
                        "description": "The day it fell due, on the organization's clock."
                      },
                      "bucket": {
                        "type": "string",
                        "enum": [
                          "current",
                          "month1",
                          "month2",
                          "month3",
                          "month4Plus"
                        ]
                      },
                      "description": {
                        "type": "string",
                        "nullable": true
                      },
                      "transactionType": {
                        "type": "string",
                        "nullable": true
                      },
                      "outstanding": {
                        "type": "number",
                        "description": "What is still owed on it."
                      },
                      "bookingId": {
                        "type": "integer",
                        "nullable": true
                      },
                      "membershipId": {
                        "type": "integer",
                        "nullable": true
                      },
                      "orderId": {
                        "type": "integer",
                        "nullable": true
                      },
                      "checkinId": {
                        "type": "integer",
                        "nullable": true
                      },
                      "accountId": {
                        "type": "integer",
                        "nullable": true,
                        "description": "The member account (a household or company) the charge is billed to, when it is billed to one."
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "PlatformAmountDueAging": {
        "type": "object",
        "description": "The Amount Due by how long it has been owed, by the month each charge fell due.",
        "properties": {
          "current": {
            "type": "number"
          },
          "month1": {
            "type": "number"
          },
          "month2": {
            "type": "number"
          },
          "month3": {
            "type": "number"
          },
          "month4Plus": {
            "type": "number"
          }
        }
      },
      "PlatformBookingAudit": {
        "type": "object",
        "properties": {
          "period": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "format": "date"
              },
              "to": {
                "type": "string",
                "format": "date"
              }
            }
          },
          "summary": {
            "type": "object",
            "description": "Over every booking of the period, before the row filters (paymentState, type, status) narrow the rows.",
            "properties": {
              "totalBookings": {
                "type": "integer"
              },
              "payableBookings": {
                "type": "integer",
                "description": "Bookings that bill something: not covered by a membership or a programme."
              },
              "totalBilled": {
                "type": "number",
                "nullable": true,
                "description": "What the payable bookings bill, incl. tax. Null without `transactions:read`."
              },
              "outstandingAmount": {
                "type": "number",
                "nullable": true,
                "description": "What they still owe. Null without `transactions:read`."
              },
              "unpaidCount": {
                "type": "integer",
                "description": "Payable bookings still owing something."
              },
              "paidCount": {
                "type": "integer"
              },
              "coveredCount": {
                "type": "integer"
              },
              "refundedCount": {
                "type": "integer"
              },
              "cancelledCount": {
                "type": "integer"
              }
            }
          },
          "typeOptions": {
            "type": "array",
            "description": "Each resource type the period holds, with the `value` the `type` filter takes.",
            "items": {
              "type": "object",
              "properties": {
                "category": {
                  "type": "string",
                  "enum": [
                    "court",
                    "class",
                    "private",
                    "event",
                    "other"
                  ]
                },
                "label": {
                  "type": "string"
                },
                "labelKey": {
                  "type": "string",
                  "nullable": true
                },
                "value": {
                  "type": "string",
                  "example": "court|Padel"
                }
              }
            }
          },
          "total": {
            "type": "integer",
            "description": "Every row the filters keep, across all pages."
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "rows": {
            "type": "array",
            "description": "Still-owing first, then the most recent first.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer",
                  "description": "The booking id."
                },
                "startTime": {
                  "type": "string",
                  "format": "date-time"
                },
                "endTime": {
                  "type": "string",
                  "format": "date-time"
                },
                "status": {
                  "type": "string",
                  "example": "confirmed",
                  "description": "confirmed, pending, checked_in, no_show or cancelled."
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "court",
                    "class",
                    "private",
                    "event",
                    "other"
                  ]
                },
                "typeLabel": {
                  "type": "string",
                  "description": "The area type, class type or instructor type the booking is of."
                },
                "typeLabelKey": {
                  "type": "string",
                  "nullable": true,
                  "description": "`other` for a booking of no kind the audit names; `typeLabel` is then the English word."
                },
                "resourceName": {
                  "type": "string",
                  "description": "The court, class, instructor or event booked."
                },
                "sport": {
                  "type": "string",
                  "nullable": true
                },
                "clubName": {
                  "type": "string",
                  "nullable": true
                },
                "contactId": {
                  "type": "integer",
                  "nullable": true,
                  "description": "The customer."
                },
                "contact": {
                  "type": "object",
                  "nullable": true,
                  "description": "Who the customer is. Null without `contacts:read`, as `include=customer` on a booking.",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "name": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string",
                      "nullable": true
                    },
                    "profileImage": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                },
                "bookedBy": {
                  "type": "string",
                  "nullable": true,
                  "description": "The member of staff or member who made the booking, when known."
                },
                "source": {
                  "type": "string",
                  "nullable": true
                },
                "marketingSource": {
                  "type": "string",
                  "nullable": true
                },
                "entranceMethod": {
                  "type": "string",
                  "nullable": true
                },
                "paymentState": {
                  "type": "string",
                  "enum": [
                    "covered",
                    "free",
                    "unpaid",
                    "partial",
                    "paid",
                    "refunded"
                  ]
                },
                "amount": {
                  "type": "number",
                  "nullable": true,
                  "description": "What the booking bills incl. tax, net of refunds: paid plus outstanding. Null without `transactions:read`."
                },
                "paid": {
                  "type": "number",
                  "nullable": true,
                  "description": "Collected on its charges, net of refunds. Null without `transactions:read`."
                },
                "outstanding": {
                  "type": "number",
                  "nullable": true,
                  "description": "Still owed on its charges. Null without `transactions:read`."
                },
                "paymentStatus": {
                  "type": "string",
                  "nullable": true,
                  "description": "Its charges' payment status. Null without `transactions:read`."
                },
                "paymentMethod": {
                  "type": "string",
                  "nullable": true,
                  "description": "The payment methods used, by name. Null without `transactions:read`."
                },
                "paymentMethods": {
                  "type": "array",
                  "nullable": true,
                  "description": "The same methods with what each is. Null without `transactions:read`.",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "channel": {
                        "type": "string"
                      },
                      "code": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "PlatformAtRiskReport": {
        "type": "object",
        "properties": {
          "asOf": {
            "type": "string",
            "format": "date"
          },
          "totals": {
            "type": "object",
            "properties": {
              "people": {
                "type": "integer"
              },
              "monthlyValue": {
                "type": "number",
                "description": "What their memberships are worth a month, ex-tax."
              }
            }
          },
          "thresholds": {
            "type": "object",
            "description": "The organization's own rules for its At Risk and Declining smart tags.",
            "properties": {
              "atRiskDays": {
                "type": "integer",
                "nullable": true
              },
              "decliningMinPrevious": {
                "type": "integer",
                "nullable": true
              },
              "decliningMaxPercent": {
                "type": "number",
                "nullable": true
              },
              "periodDays": {
                "type": "integer"
              }
            }
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "signal": {
                  "type": "string",
                  "enum": [
                    "at_risk",
                    "declining"
                  ]
                },
                "name": {
                  "type": "string"
                },
                "color": {
                  "type": "string",
                  "nullable": true
                }
              }
            }
          },
          "signals": {
            "type": "object",
            "description": "Which signals the organization has switched on.",
            "properties": {
              "at_risk": {
                "type": "boolean"
              },
              "declining": {
                "type": "boolean"
              }
            }
          },
          "rowsScope": {
            "type": "string",
            "enum": [
              "contacts:read"
            ],
            "description": "The scope the rows need: without it `rows` and `total` are null and the figures come alone."
          },
          "total": {
            "type": "integer",
            "nullable": true,
            "description": "Every row, across all pages; null when the rows are withheld."
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "rows": {
            "type": "array",
            "nullable": true,
            "items": {
              "type": "object",
              "properties": {
                "contactId": {
                  "type": "integer"
                },
                "name": {
                  "type": "string",
                  "nullable": true,
                  "description": "Null when the contact has no name."
                },
                "email": {
                  "type": "string",
                  "nullable": true
                },
                "signals": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "at_risk",
                      "declining"
                    ]
                  }
                },
                "lastVisitDay": {
                  "type": "string",
                  "format": "date",
                  "nullable": true
                },
                "visitsThisPeriod": {
                  "type": "integer"
                },
                "visitsPreviousPeriod": {
                  "type": "integer"
                },
                "planName": {
                  "type": "string",
                  "nullable": true
                },
                "planKind": {
                  "type": "string",
                  "nullable": true
                },
                "monthlyValue": {
                  "type": "number",
                  "nullable": true
                },
                "taggedAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "taggedDay": {
                  "type": "string",
                  "format": "date"
                }
              }
            }
          }
        }
      },
      "PlatformRenewalsReport": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "format": "date",
            "description": "Today, on the organization's clock."
          },
          "to": {
            "type": "string",
            "format": "date",
            "description": "The window's last day."
          },
          "days": {
            "type": "integer",
            "enum": [
              7,
              14,
              30,
              60
            ]
          },
          "totals": {
            "type": "object",
            "description": "Per group: how many, and what they are worth a month, ex-tax.",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "count": {
                  "type": "integer"
                },
                "monthlyValue": {
                  "type": "number"
                }
              }
            }
          },
          "rowsScope": {
            "type": "string",
            "enum": [
              "contacts:read"
            ],
            "description": "The scope the rows need: without it `rows` and `total` are null and the figures come alone."
          },
          "total": {
            "type": "integer",
            "nullable": true,
            "description": "Every row, across all pages; null when the rows are withheld."
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "rows": {
            "type": "array",
            "nullable": true,
            "items": {
              "type": "object",
              "properties": {
                "contactId": {
                  "type": "integer"
                },
                "name": {
                  "type": "string",
                  "nullable": true,
                  "description": "Null when the contact has no name."
                },
                "email": {
                  "type": "string",
                  "nullable": true
                },
                "membershipId": {
                  "type": "integer"
                },
                "planName": {
                  "type": "string"
                },
                "planKind": {
                  "type": "string"
                },
                "group": {
                  "type": "string",
                  "enum": [
                    "ending",
                    "cancelled",
                    "pass_running_out",
                    "auto_renews"
                  ]
                },
                "endDay": {
                  "type": "string",
                  "format": "date",
                  "nullable": true
                },
                "usesRemaining": {
                  "type": "number",
                  "nullable": true
                },
                "sessionUnit": {
                  "type": "string",
                  "enum": [
                    "booking",
                    "hour"
                  ]
                },
                "autoRenew": {
                  "type": "boolean"
                },
                "monthlyValue": {
                  "type": "number",
                  "nullable": true
                }
              }
            }
          }
        }
      },
      "PlatformPromotionEligibilityReport": {
        "type": "object",
        "properties": {
          "asOf": {
            "type": "string",
            "format": "date"
          },
          "contactsWithBirthDate": {
            "type": "integer",
            "description": "How many listed members have a date of birth, which the age bands read."
          },
          "tracks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "trackId": {
                  "type": "integer"
                },
                "trackName": {
                  "type": "string"
                },
                "sport": {
                  "type": "string",
                  "nullable": true
                },
                "description": {
                  "type": "string",
                  "nullable": true
                },
                "summary": {
                  "type": "object",
                  "properties": {
                    "eligible": {
                      "type": "integer"
                    },
                    "stalled": {
                      "type": "integer"
                    },
                    "promoted": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Promoted in the period; null without one."
                    },
                    "medianDaysAtLevel": {
                      "type": "integer",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "rowsScope": {
            "type": "string",
            "enum": [
              "contacts:read"
            ],
            "description": "The scope the rows need: without it `rows` and `total` are null and the figures come alone."
          },
          "total": {
            "type": "integer",
            "nullable": true,
            "description": "Every row, across all pages; null when the rows are withheld."
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "rows": {
            "type": "array",
            "nullable": true,
            "description": "A member on each track they hold a rank on.",
            "items": {
              "type": "object",
              "properties": {
                "contactId": {
                  "type": "integer"
                },
                "name": {
                  "type": "string",
                  "nullable": true,
                  "description": "Null when the contact has no name."
                },
                "email": {
                  "type": "string",
                  "nullable": true
                },
                "trackId": {
                  "type": "integer"
                },
                "trackName": {
                  "type": "string"
                },
                "currentLevel": {
                  "type": "object",
                  "nullable": true
                },
                "history": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  }
                },
                "promotion": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "eligible",
                        "on_track",
                        "stalled",
                        "no_requirement"
                      ]
                    },
                    "nextLevel": {
                      "type": "object",
                      "nullable": true
                    },
                    "sessions": {
                      "type": "integer",
                      "nullable": true
                    },
                    "requiredSessions": {
                      "type": "integer",
                      "nullable": true
                    },
                    "daysAtLevel": {
                      "type": "integer"
                    },
                    "medianDays": {
                      "type": "integer",
                      "nullable": true
                    }
                  }
                },
                "messageTo": {
                  "type": "object",
                  "description": "Who a message reaches: the member, or the guardian of a child."
                }
              }
            }
          }
        }
      },
      "PlatformCancellationFigures": {
        "type": "object",
        "properties": {
          "bookings": {
            "type": "integer"
          },
          "cancelled": {
            "type": "integer"
          },
          "cancellationRate": {
            "type": "number",
            "description": "Percent of `bookings`."
          },
          "late": {
            "type": "integer",
            "description": "Cancelled with less notice than a full refund needs."
          },
          "lateRate": {
            "type": "number"
          },
          "noShows": {
            "type": "integer",
            "nullable": true,
            "description": "Null where no policy requires check-in: no-shows are not tracked."
          },
          "noShowRate": {
            "type": "number",
            "nullable": true
          },
          "chargesKept": {
            "type": "number",
            "description": "Kept on cancelled and missed bookings, net of refunds, incl. tax."
          },
          "stillOwed": {
            "type": "number"
          },
          "refunds": {
            "type": "number"
          }
        }
      },
      "PlatformCancellationsReport": {
        "type": "object",
        "properties": {
          "period": {
            "type": "object",
            "properties": {
              "from": {
                "type": "string",
                "format": "date"
              },
              "to": {
                "type": "string",
                "format": "date"
              }
            }
          },
          "timezone": {
            "type": "string"
          },
          "totals": {
            "$ref": "#/components/schemas/PlatformCancellationFigures"
          },
          "lateWindows": {
            "type": "array",
            "description": "The rules the cancellations were judged late by.",
            "items": {
              "type": "object"
            }
          },
          "byClassType": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformCancellationsRow"
            }
          },
          "byArea": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformCancellationsRow"
            }
          },
          "bySlot": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformCancellationsRow"
            }
          },
          "rowsScope": {
            "type": "string",
            "enum": [
              "contacts:read"
            ],
            "description": "The scope the rows need: without it `rows` and `total` are null and the figures come alone."
          },
          "total": {
            "type": "integer",
            "nullable": true,
            "description": "Every row, across all pages; null when the rows are withheld."
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "rows": {
            "type": "array",
            "nullable": true,
            "description": "By customer: the customers who cancel most, each with their contactId, name and email.",
            "items": {
              "$ref": "#/components/schemas/PlatformCancellationsCustomerRow"
            }
          }
        }
      },
      "PlatformCancellationsRow": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "label": {
            "type": "string",
            "nullable": true,
            "description": "The row's own name; null when `labelKey` names it."
          },
          "labelKey": {
            "type": "string",
            "nullable": true
          },
          "weekday": {
            "type": "integer",
            "description": "By time slot only: ISO weekday, 1 is Monday."
          },
          "hour": {
            "type": "integer",
            "description": "By time slot only, on the organization's clock."
          },
          "bookings": {
            "type": "integer"
          },
          "cancelled": {
            "type": "integer"
          },
          "cancellationRate": {
            "type": "number",
            "description": "Percent of `bookings`."
          },
          "late": {
            "type": "integer",
            "description": "Cancelled with less notice than a full refund needs."
          },
          "lateRate": {
            "type": "number"
          },
          "noShows": {
            "type": "integer",
            "nullable": true,
            "description": "Null where no policy requires check-in: no-shows are not tracked."
          },
          "noShowRate": {
            "type": "number",
            "nullable": true
          },
          "chargesKept": {
            "type": "number",
            "description": "Kept on cancelled and missed bookings, net of refunds, incl. tax."
          },
          "stillOwed": {
            "type": "number"
          },
          "refunds": {
            "type": "number"
          }
        }
      },
      "PlatformCancellationsCustomerRow": {
        "description": "A customer of the By customer view: who they are, as on every people report's rows, then their figures.",
        "allOf": [
          {
            "type": "object",
            "properties": {
              "contactId": {
                "type": "integer"
              },
              "name": {
                "type": "string",
                "nullable": true,
                "description": "Null when the contact has no name."
              },
              "email": {
                "type": "string",
                "nullable": true
              }
            }
          },
          {
            "$ref": "#/components/schemas/PlatformCancellationFigures"
          }
        ]
      },
      "PlatformContactNote": {
        "type": "object",
        "description": "A note the club's staff wrote on a contact. Personal data; can hold health details.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "contactId": {
            "type": "integer"
          },
          "contactName": {
            "type": "string",
            "nullable": true
          },
          "note": {
            "type": "string"
          },
          "noteDate": {
            "type": "string",
            "format": "date-time",
            "description": "The date the note is about, as the staff set it"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformContactNotePage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformContactNote"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total notes matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformFormSubmission": {
        "type": "object",
        "description": "One person's answers to a form, or an invitation to fill it in that is still pending. Personal data; can hold health declarations.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "formId": {
            "type": "integer"
          },
          "formName": {
            "type": "string"
          },
          "contactId": {
            "type": "integer",
            "nullable": true,
            "description": "The contact it was filed against or, for a visitor the club did not know, the lead it created"
          },
          "contactName": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "submitted"
            ]
          },
          "submittedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "null while pending"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "answers": {
            "type": "array",
            "description": "In the order asked: built-in fields (by key), then custom fields (by name), then the form questions (by label). Empty answers are left out.",
            "items": {
              "type": "object",
              "properties": {
                "question": {
                  "type": "string"
                },
                "answer": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "PlatformFormSubmissionPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformFormSubmission"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total submissions matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformReview": {
        "type": "object",
        "description": "A review of one of the organization's clubs, left in 1club or imported. Names its author; personal data.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "clubId": {
            "type": "integer"
          },
          "clubName": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "description": "Where it was left: `1club`, or the platform it was imported from, such as `google`"
          },
          "rating": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5
          },
          "instructorRating": {
            "type": "integer",
            "nullable": true
          },
          "facilityRating": {
            "type": "integer",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "comment": {
            "type": "string",
            "nullable": true
          },
          "authorName": {
            "type": "string",
            "nullable": true
          },
          "reply": {
            "type": "object",
            "nullable": true,
            "description": "The club's public reply; null when there is none",
            "properties": {
              "text": {
                "type": "string"
              },
              "repliedAt": {
                "type": "string",
                "format": "date-time",
                "nullable": true
              }
            }
          },
          "privateNote": {
            "type": "string",
            "nullable": true,
            "description": "What the reviewer told the club alone; never shown to the public"
          },
          "isPublic": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PlatformReviewPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformReview"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total reviews matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformAutomation": {
        "type": "object",
        "description": "An automation: something that happens on its own when its trigger fires.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "category": {
            "type": "string",
            "enum": [
              "SYSTEM",
              "CUSTOM"
            ],
            "description": "SYSTEM for a built-in automation, CUSTOM for one the club made"
          },
          "systemKey": {
            "type": "string",
            "nullable": true,
            "description": "Names a built-in automation; null for one the club made"
          },
          "triggerType": {
            "type": "string",
            "description": "What starts it"
          },
          "triggerConfig": {
            "type": "object",
            "additionalProperties": true,
            "description": "The trigger's settings"
          },
          "isActive": {
            "type": "boolean"
          },
          "lastTriggeredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "PlatformAutomationPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformAutomation"
            }
          },
          "total": {
            "type": "integer",
            "description": "Total automations matching the filters, ignoring pagination"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          }
        }
      },
      "PlatformAutomationDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PlatformAutomation"
          },
          {
            "type": "object",
            "properties": {
              "entryCondition": {
                "type": "object",
                "nullable": true,
                "additionalProperties": true,
                "description": "Who may enter a run, beyond the trigger; null when anyone the trigger fires for may"
              },
              "goal": {
                "type": "object",
                "nullable": true,
                "additionalProperties": true,
                "description": "What ends a run as achieved; null when it has none"
              },
              "exitEvents": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                },
                "description": "Events that stop a run still in progress"
              },
              "steps": {
                "type": "array",
                "description": "In flow order: the top-level steps by position, then the steps inside each branch, by parent step and position",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "stepType": {
                      "type": "string"
                    },
                    "position": {
                      "type": "integer"
                    },
                    "parentStepId": {
                      "type": "integer",
                      "nullable": true,
                      "description": "The branching step this one sits under; null at the top level"
                    },
                    "branchKey": {
                      "type": "string",
                      "nullable": true,
                      "description": "Which branch of the parent step"
                    },
                    "config": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "PlatformPromotionCreate": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "type",
          "value"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "description": "What members see beside the discounted price"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "code": {
            "type": "string",
            "nullable": true,
            "minLength": 2,
            "maxLength": 40,
            "pattern": "^[A-Za-z0-9_-]+$",
            "description": "The promo code a member types; unique in the organization"
          },
          "type": {
            "type": "string",
            "enum": [
              "discount",
              "voucher"
            ]
          },
          "discountFormat": {
            "type": "string",
            "nullable": true,
            "enum": [
              "percent",
              "amount",
              null
            ],
            "description": "Required on a discount; a voucher has none"
          },
          "value": {
            "type": "number",
            "minimum": 0.01,
            "description": "The percentage off (at most 100), or the amount in the organization's currency"
          },
          "startsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "endsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "maxRedemptions": {
            "type": "integer",
            "minimum": 1,
            "nullable": true,
            "description": "The most it may be redeemed in all; null for no limit"
          },
          "maxRedemptionsPerContact": {
            "type": "integer",
            "minimum": 1,
            "nullable": true,
            "description": "The most one member may redeem it; null for no limit"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Public",
              "Member_only",
              "Private"
            ],
            "description": "Who sees it offered. Defaults to Public"
          },
          "validFor": {
            "type": "object",
            "additionalProperties": false,
            "description": "What it applies to. Bookings qualify through `scopes`, narrowed by the type ids and `clubIds` (empty = every one). A plan purchase qualifies only when named in `planIds`, or with `allPlans`.",
            "properties": {
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "classes",
                    "areas",
                    "instructors"
                  ]
                }
              },
              "classTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Class type ids"
              },
              "areaTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Area type ids"
              },
              "instructorTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Instructor type ids"
              },
              "clubIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Clubs whose bookings qualify; empty = every club"
              },
              "planIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Plans whose purchase it discounts"
              },
              "allPlans": {
                "type": "boolean",
                "description": "Every plan purchase. Ignored when planIds is not empty; not allowed with autoApply"
              }
            }
          },
          "segmentFilter": {
            "type": "object",
            "additionalProperties": false,
            "description": "Who it is for: a buyer must match every list sent. `{}` is everyone.",
            "properties": {
              "memberTypes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "contact",
                    "member",
                    "staff",
                    "lead",
                    "lapsed",
                    "drop_in",
                    "archived"
                  ]
                }
              },
              "tags": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "integer"
                    }
                  ]
                },
                "description": "Tag names or ids"
              },
              "membershipPlanIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Plans the buyer must already hold"
              },
              "membershipPlanCategoryIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              "pipelineStageIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              "sourceIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              "progressionLevelIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              }
            }
          },
          "conditions": {
            "type": "object",
            "additionalProperties": false,
            "description": "When a booking qualifies. Each condition judges the whole booking.",
            "properties": {
              "minPeople": {
                "type": "integer",
                "minimum": 2
              },
              "timeWindow": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "startTime",
                  "endTime"
                ],
                "description": "On the club's clock. `match` start (the default): the booking starts inside it; within: it fits inside it",
                "properties": {
                  "weekdays": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "monday",
                        "tuesday",
                        "wednesday",
                        "thursday",
                        "friday",
                        "saturday",
                        "sunday"
                      ]
                    }
                  },
                  "startTime": {
                    "type": "string",
                    "example": "08:00",
                    "description": "HH:mm"
                  },
                  "endTime": {
                    "type": "string",
                    "example": "16:00",
                    "description": "HH:mm"
                  },
                  "match": {
                    "type": "string",
                    "enum": [
                      "start",
                      "within"
                    ]
                  }
                }
              },
              "bookingLength": {
                "type": "object",
                "additionalProperties": false,
                "description": "Inclusive bounds on the booking length, in minutes",
                "properties": {
                  "minMinutes": {
                    "type": "integer",
                    "nullable": true
                  },
                  "maxMinutes": {
                    "type": "integer",
                    "nullable": true
                  }
                }
              },
              "firstBookingOnly": {
                "type": "boolean",
                "description": "Only for someone with no earlier booking"
              },
              "firstPurchaseOnly": {
                "type": "boolean",
                "description": "Only for someone who never held one of the plans it targets. Left out: on for autoApply, off for a code"
              }
            }
          },
          "autoApply": {
            "type": "boolean",
            "description": "Applies itself at checkout without a code. Only a discount, and only with a booking scope or named planIds"
          }
        }
      },
      "PlatformPromotionUpdate": {
        "type": "object",
        "additionalProperties": false,
        "minProperties": 1,
        "description": "Send only what changes. validFor, segmentFilter and conditions each replace the whole object when sent.",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "description": "What members see beside the discounted price"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "code": {
            "type": "string",
            "nullable": true,
            "minLength": 2,
            "maxLength": 40,
            "pattern": "^[A-Za-z0-9_-]+$",
            "description": "The promo code a member types; unique in the organization"
          },
          "type": {
            "type": "string",
            "enum": [
              "discount",
              "voucher"
            ]
          },
          "discountFormat": {
            "type": "string",
            "nullable": true,
            "enum": [
              "percent",
              "amount",
              null
            ],
            "description": "Required on a discount; a voucher has none"
          },
          "value": {
            "type": "number",
            "minimum": 0.01,
            "description": "The percentage off (at most 100), or the amount in the organization's currency"
          },
          "startsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "endsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "maxRedemptions": {
            "type": "integer",
            "minimum": 1,
            "nullable": true,
            "description": "The most it may be redeemed in all; null for no limit"
          },
          "maxRedemptionsPerContact": {
            "type": "integer",
            "minimum": 1,
            "nullable": true,
            "description": "The most one member may redeem it; null for no limit"
          },
          "visibility": {
            "type": "string",
            "enum": [
              "Public",
              "Member_only",
              "Private"
            ],
            "description": "Who sees it offered. Defaults to Public"
          },
          "validFor": {
            "type": "object",
            "additionalProperties": false,
            "description": "What it applies to. Bookings qualify through `scopes`, narrowed by the type ids and `clubIds` (empty = every one). A plan purchase qualifies only when named in `planIds`, or with `allPlans`.",
            "properties": {
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "classes",
                    "areas",
                    "instructors"
                  ]
                }
              },
              "classTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Class type ids"
              },
              "areaTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Area type ids"
              },
              "instructorTypes": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Instructor type ids"
              },
              "clubIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Clubs whose bookings qualify; empty = every club"
              },
              "planIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Plans whose purchase it discounts"
              },
              "allPlans": {
                "type": "boolean",
                "description": "Every plan purchase. Ignored when planIds is not empty; not allowed with autoApply"
              }
            }
          },
          "segmentFilter": {
            "type": "object",
            "additionalProperties": false,
            "description": "Who it is for: a buyer must match every list sent. `{}` is everyone.",
            "properties": {
              "memberTypes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "contact",
                    "member",
                    "staff",
                    "lead",
                    "lapsed",
                    "drop_in",
                    "archived"
                  ]
                }
              },
              "tags": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "integer"
                    }
                  ]
                },
                "description": "Tag names or ids"
              },
              "membershipPlanIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                },
                "description": "Plans the buyer must already hold"
              },
              "membershipPlanCategoryIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              "pipelineStageIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              "sourceIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              },
              "progressionLevelIds": {
                "type": "array",
                "items": {
                  "type": "integer"
                }
              }
            }
          },
          "conditions": {
            "type": "object",
            "additionalProperties": false,
            "description": "When a booking qualifies. Each condition judges the whole booking.",
            "properties": {
              "minPeople": {
                "type": "integer",
                "minimum": 2
              },
              "timeWindow": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "startTime",
                  "endTime"
                ],
                "description": "On the club's clock. `match` start (the default): the booking starts inside it; within: it fits inside it",
                "properties": {
                  "weekdays": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "monday",
                        "tuesday",
                        "wednesday",
                        "thursday",
                        "friday",
                        "saturday",
                        "sunday"
                      ]
                    }
                  },
                  "startTime": {
                    "type": "string",
                    "example": "08:00",
                    "description": "HH:mm"
                  },
                  "endTime": {
                    "type": "string",
                    "example": "16:00",
                    "description": "HH:mm"
                  },
                  "match": {
                    "type": "string",
                    "enum": [
                      "start",
                      "within"
                    ]
                  }
                }
              },
              "bookingLength": {
                "type": "object",
                "additionalProperties": false,
                "description": "Inclusive bounds on the booking length, in minutes",
                "properties": {
                  "minMinutes": {
                    "type": "integer",
                    "nullable": true
                  },
                  "maxMinutes": {
                    "type": "integer",
                    "nullable": true
                  }
                }
              },
              "firstBookingOnly": {
                "type": "boolean",
                "description": "Only for someone with no earlier booking"
              },
              "firstPurchaseOnly": {
                "type": "boolean",
                "description": "Only for someone who never held one of the plans it targets. Left out: on for autoApply, off for a code"
              }
            }
          },
          "autoApply": {
            "type": "boolean",
            "description": "Applies itself at checkout without a code. Only a discount, and only with a booking scope or named planIds"
          }
        }
      },
      "PlatformBrandBook": {
        "type": "object",
        "properties": {
          "primaryColor": {
            "type": "string",
            "nullable": true
          },
          "darkPrimaryColor": {
            "type": "string",
            "nullable": true
          },
          "accentColor": {
            "type": "string",
            "nullable": true
          },
          "headerColor": {
            "type": "string",
            "nullable": true
          },
          "darkHeaderColor": {
            "type": "string",
            "nullable": true
          },
          "backgroundColor": {
            "type": "string",
            "nullable": true
          },
          "textColor": {
            "type": "string",
            "nullable": true
          },
          "darkBackgroundColor": {
            "type": "string",
            "nullable": true
          },
          "darkTextColor": {
            "type": "string",
            "nullable": true
          },
          "logoUrl": {
            "type": "string",
            "nullable": true,
            "description": "The logo for light backgrounds"
          },
          "logoDarkUrl": {
            "type": "string",
            "nullable": true,
            "description": "The logo for dark backgrounds"
          },
          "logoAltText": {
            "type": "string",
            "nullable": true
          },
          "iconUrl": {
            "type": "string",
            "nullable": true,
            "description": "The square Icon, for square and round frames such as avatars and app icons"
          },
          "faviconUrl": {
            "type": "string",
            "nullable": true,
            "readOnly": true,
            "description": "The Icon as a square PNG for browser tabs. Derived from iconUrl."
          },
          "fontFamily": {
            "type": "string",
            "nullable": true
          },
          "headingFontFamily": {
            "type": "string",
            "nullable": true
          },
          "keepBrandColors": {
            "type": "boolean",
            "description": "A template's look leaves the brand colours alone and the in-app assistants are told to. A theme write that names a colour still applies."
          },
          "toneOfVoice": {
            "type": "string",
            "enum": [
              "professional",
              "friendly",
              "casual",
              "formal"
            ],
            "nullable": true
          },
          "guidelines": {
            "type": "string",
            "nullable": true,
            "maxLength": 4000,
            "description": "The organization's own writing guidelines: form of address, words to use or avoid, anything else. Line breaks are kept."
          }
        }
      }
    },
    "responses": {
      "PlatformBadRequest": {
        "description": "Invalid request (bad parameters, or a body that fails validation)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PlatformError"
            }
          }
        }
      },
      "PlatformUnauthorized": {
        "description": "Invalid or missing API key",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PlatformError"
            }
          }
        }
      },
      "PlatformForbidden": {
        "description": "The API key is missing the scope this endpoint requires",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PlatformError"
            }
          }
        }
      },
      "PlatformNotFound": {
        "description": "The requested resource does not exist in this organization",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PlatformError"
            }
          }
        }
      },
      "PlatformConflict": {
        "description": "The request conflicts with existing state, or reuses an Idempotency-Key with a different body",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PlatformError"
            }
          }
        }
      },
      "PlatformRateLimited": {
        "description": "Rate limit exceeded",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PlatformError"
            }
          }
        }
      }
    }
  },
  "security": [
    {
      "customerApiAuth": []
    },
    {
      "platformOAuth": []
    }
  ],
  "paths": {
    "/v1/platform/area-blocks": {
      "get": {
        "operationId": "listAreaBlocks",
        "summary": "List area blocks",
        "description": "Returns the blocks overlapping a window - the time-ranged unavailability of a court, the counterpart of instructor time off. A block with `areaId: null` is club-wide and closes every area in `clubId`; expand it against the club's areas the same way availability does. Filtering by `areaId` includes the club-wide blocks covering that area, so the result is everything that closes it.\n",
        "tags": [
          "Area Blocks"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "from",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Window start (ISO date-time)"
          },
          {
            "in": "query",
            "name": "to",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Window end (ISO date-time). At most 31 days after `from`."
          },
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only return blocks for this club"
          },
          {
            "in": "query",
            "name": "areaId",
            "schema": {
              "type": "integer"
            },
            "description": "Only return blocks affecting this area (club-wide ones included)"
          }
        ],
        "responses": {
          "200": {
            "description": "List of area blocks",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "integer"
                      },
                      "clubId": {
                        "type": "integer"
                      },
                      "areaId": {
                        "type": "integer",
                        "nullable": true,
                        "description": "Null means every area in the club"
                      },
                      "areaName": {
                        "type": "string",
                        "nullable": true
                      },
                      "startTime": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "endTime": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "note": {
                        "type": "string",
                        "nullable": true
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "API key is missing the required `areas:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createAreaBlock",
        "summary": "Create an area block",
        "description": "Closes a court, or a whole club, for a time range. Send `areaId` to close one court (its club is derived), or `clubId` with `areaId` omitted/null to close every court in that club with a single record. Existing bookings in the window are left alone - a block stops NEW bookings; cancel or move the affected bookings separately.\n",
        "tags": [
          "Area Blocks"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "startTime",
                  "endTime"
                ],
                "properties": {
                  "areaId": {
                    "type": "integer",
                    "nullable": true,
                    "description": "The court to close. Omit or send null for a club-wide block."
                  },
                  "clubId": {
                    "type": "integer",
                    "description": "Required when `areaId` is omitted or null; otherwise derived from the area."
                  },
                  "startTime": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "endTime": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "note": {
                    "type": "string",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Block created"
          },
          "400": {
            "description": "Invalid body, or `clubId` missing for a club-wide block",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "API key is missing the required `areas:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "Club or area not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/platform/area-blocks/{blockId}": {
      "delete": {
        "operationId": "deleteAreaBlock",
        "summary": "Delete an area block",
        "description": "Removes a block, reopening the court(s) it covered for booking. Idempotent from the caller's perspective only in the sense that a second delete returns 404 - the first one already reopened the slot.\n",
        "tags": [
          "Area Blocks"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "blockId",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Block deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid block id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "API key is missing the required `areas:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "Block not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/platform/area-types": {
      "get": {
        "operationId": "listAreaTypes",
        "summary": "List area types",
        "description": "Returns the organization's area types - the kinds of space it books, such as \"Padel court\" or \"Studio\". Resolve one here, then pass its `id` as `areaTypeId` when creating an area: the type is what decides which sports the new area can be booked for and what it is priced from, so it is not a label.\n\nEvery type is returned, `isBookable: false` ones included, because an existing area may be of one and its type still has to be explicable. Do not build bookable inventory on a type that is not bookable.\n\nThere is no paging: an organization has a handful of these.\n",
        "tags": [
          "Areas"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Every area type in the organization, in the order staff set in Settings",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformAreaType"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `areas:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createAreaType",
        "summary": "Create an area type",
        "description": "Adds a kind of space the organization books. List the existing types first: an organization is seeded with one per sport its clubs offer, and a second \"Padel court\" splits inventory that should be one group.\n\n`sports` is what makes areas of this type bookable for a sport at all, and it is canonicalized - send `padel`, not `Padel`. An unknown sport is refused rather than stored as a value nothing will match. `slug` is optional and derived from the name when omitted. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Areas"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformAreaTypeCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Area type created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformAreaType"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `areas:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "An explicit `slug` is already used by another area type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/area-types/{id}": {
      "get": {
        "operationId": "getAreaType",
        "summary": "Get an area type",
        "description": "Returns one area type and how many areas are of it, whatever their status.",
        "tags": [
          "Areas"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The area type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformAreaType"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `areas:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateAreaType",
        "summary": "Update an area type",
        "description": "Changes an area type. Send only what changes; an omitted field is left alone, `null` clears a nullable one, and at least one field is required.\n\nThis is a wide edit. Every area of the type inherits `sports`, `defaultPricePerHour`, `defaultMaxPlayers` and `isBookable`, so changing one of those reprices or re-sports every court on it at once - and each affected area emits an availability change, which partners consuming the reconciliation feed will pull. `sports` replaces the whole list rather than adding to it. A rename leaves `slug` alone.\n",
        "tags": [
          "Areas"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformAreaTypeUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated area type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformAreaType"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `areas:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "An explicit `slug` is already used by another area type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/area-types/order": {
      "put": {
        "operationId": "updateAreaTypeOrder",
        "summary": "Reorder area types",
        "description": "Sets the order of the organization's area types: the ids, first to last. Every list of them follows it - this API, the 1club admin, the club's website and member apps. A type left out (one added since you read the list) keeps its place after the listed ones. Returns the list as it now stands.\n",
        "tags": [
          "Areas"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformTypeOrder"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Every area type in the organization, in the new order",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformAreaType"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `areas:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/areas": {
      "get": {
        "operationId": "listAreas",
        "summary": "List bookable areas",
        "description": "Returns the organization's bookable areas (e.g. padel courts). Optionally filter by club or sport (e.g. `padel`). Use the returned area `id` as `areaId` when creating a booking.\n\nBookable is the filter: an area is listed only while it is `active`, publicly visible, and of a bookable area type (or of no type at all). An area closed for maintenance, or one just created `Private`, is absent here but still readable from the create or update that wrote it.\n",
        "tags": [
          "Areas"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only return areas belonging to this club"
          },
          {
            "in": "query",
            "name": "sport",
            "schema": {
              "type": "string"
            },
            "description": "Only return areas whose area type lists this sport (e.g. \"padel\")"
          }
        ],
        "responses": {
          "200": {
            "description": "List of bookable areas",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PlatformArea"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "API key is missing the required `areas:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createArea",
        "summary": "Create an area",
        "description": "Adds a bookable area - a court, a studio, a lane - to one of the organization's clubs. `clubId` comes from GET /v1/platform/clubs and `areaTypeId` from GET /v1/platform/area-types; both must belong to this organization. The area type is what decides which sports the area can be booked for and what it is priced from, so resolve it first rather than guessing.\n\nThe new area enters partner availability feeds immediately, with an `availability_changes` entry written in the same transaction - so a partner reconciling against the change cursor sees the court appear.\n\nCreated areas default to `active` and `Public`. An area created `maintenance`, `inactive` or non-public is returned here and resolves by id, but will not appear in GET /v1/platform/areas, which lists only what is bookable today. Supports the `Idempotency-Key` header.\n\nNeeds `areas:write`, the same scope that blocks and unblocks areas. Existing grants therefore gain this the moment it ships; an OAuth connection made before it will not, because a grant expands the wildcard at consent time - reconnect to pick it up.\n",
        "tags": [
          "Areas"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformAreaCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Area created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformArea"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `areas:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/areas/{areaId}/availability": {
      "get": {
        "operationId": "getAreaAvailability",
        "summary": "Get area availability",
        "description": "Returns the area's club timezone, operating hours, the intervals already taken (`busy`), and computed open `slots` (with remaining capacity) for the window. Send `If-None-Match` with the last `version` you saw to get a cheap `304` when nothing changed. 1club remains the source of truth: booking creation re-checks availability atomically and rejects conflicts.\n",
        "tags": [
          "Areas"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "areaId",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Area id"
          },
          {
            "in": "query",
            "name": "from",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Window start (ISO date-time)"
          },
          {
            "in": "query",
            "name": "to",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Window end (ISO date-time). At most 31 days after `from`."
          },
          {
            "in": "query",
            "name": "slotMinutes",
            "required": false,
            "schema": {
              "type": "integer",
              "enum": [
                15,
                30,
                60,
                90,
                120
              ],
              "default": 60
            },
            "description": "Granularity of computed slots in minutes."
          }
        ],
        "responses": {
          "200": {
            "description": "Area availability",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "areaId": {
                      "type": "integer"
                    },
                    "from": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "to": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "timezone": {
                      "type": "string",
                      "description": "IANA timezone the hours are expressed in"
                    },
                    "maxConcurrentBookings": {
                      "type": "integer",
                      "description": "Bookings and classes the area holds at once; 0 means unlimited"
                    },
                    "version": {
                      "type": "string",
                      "description": "Consistency token (highest change sequence for this area)"
                    },
                    "operatingHours": {
                      "type": "object",
                      "description": "Per-day-of-week opening schedule"
                    },
                    "busy": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "startTime": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "endTime": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "subject": {
                            "type": "string",
                            "enum": [
                              "member_booking",
                              "class",
                              "event",
                              "area_block"
                            ],
                            "description": "What holds the court for this interval, in the same vocabulary as `details.conflicts[].subject` on a refused create. `class` is a scheduled class holding its court - which is a booking row underneath, so it is not distinguishable by shape - and `area_block` is the club closing the court (maintenance, a private hire) rather than a sale. No id or name is attached - an availability read is not a read of who booked; use GET /v1/platform/bookings for the rows you may see.\n"
                          }
                        }
                      }
                    },
                    "slots": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "start": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "end": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "capacity": {
                            "type": "integer",
                            "nullable": true,
                            "description": "Null when the area is unlimited"
                          },
                          "remaining": {
                            "type": "integer",
                            "nullable": true,
                            "description": "Null when the area is unlimited"
                          },
                          "bookable": {
                            "type": "boolean"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "304": {
            "description": "Not modified (matched `If-None-Match`)"
          },
          "400": {
            "description": "Invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "API key is missing the required `areas:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "Area not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/platform/areas/{areaId}": {
      "get": {
        "operationId": "getArea",
        "summary": "Get an area",
        "description": "Returns one area by id, whatever its state. Unlike GET /v1/platform/areas, which shows only what can be booked today, this resolves an area that is under maintenance, closed, or not publicly visible - so an area created or edited through this API can always be read back. `status` and `visibility` say which case it is.\n",
        "tags": [
          "Areas"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "areaId",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Area id"
          }
        ],
        "responses": {
          "200": {
            "description": "The area",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformArea"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `areas:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateArea",
        "summary": "Update an area",
        "description": "Edits an area. Send only what changes; an omitted field is left alone. Setting `status` to `maintenance` or `inactive`, or narrowing `visibility`, takes the area out of availability - which is the durable way to close a court indefinitely, where an area block closes it for a stated window.\n\nAny edit to hours, status, visibility, capacity or area type writes an `availability_changes` entry alongside the row, so partners see it on their next reconciliation.\n\n`clubId` is not editable: moving a court to another club would strand its bookings, class holds and blocks at the old one. There is no delete either - an area carries booking history, so close it with `status` instead. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Areas"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "areaId",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Area id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformAreaUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated area",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformArea"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `areas:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/availability": {
      "get": {
        "operationId": "getAvailability",
        "summary": "Get club-wide availability grid",
        "description": "Returns computed open slots for every bookable area in one call, so you can render a whole calendar without a request per court. Filter by `clubId` and/or `sport`. Each area carries its own `version`; the top-level `cursor` is the reconciliation cursor to pass to `/availability/changes` next.\n",
        "tags": [
          "Areas"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only include areas belonging to this club"
          },
          {
            "in": "query",
            "name": "sport",
            "schema": {
              "type": "string"
            },
            "description": "Only include areas whose type lists this sport (e.g. \"padel\")"
          },
          {
            "in": "query",
            "name": "from",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Window start (ISO date-time)"
          },
          {
            "in": "query",
            "name": "to",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Window end (ISO date-time). At most 31 days after `from`."
          },
          {
            "in": "query",
            "name": "slotMinutes",
            "schema": {
              "type": "integer",
              "enum": [
                15,
                30,
                60,
                90,
                120
              ],
              "default": 60
            },
            "description": "Granularity of computed slots in minutes."
          }
        ],
        "responses": {
          "200": {
            "description": "Club availability grid",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "clubId": {
                      "type": "integer",
                      "nullable": true
                    },
                    "timezone": {
                      "type": "string"
                    },
                    "from": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "to": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "cursor": {
                      "type": "string",
                      "description": "Reconciliation cursor at read time"
                    },
                    "areas": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "areaId": {
                            "type": "integer"
                          },
                          "name": {
                            "type": "string"
                          },
                          "sports": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "pricePerHour": {
                            "type": "number",
                            "nullable": true
                          },
                          "maxConcurrentBookings": {
                            "type": "integer",
                            "description": "Bookings and classes the area holds at once; 0 means unlimited"
                          },
                          "version": {
                            "type": "string"
                          },
                          "operatingHours": {
                            "type": "object"
                          },
                          "busy": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "startTime": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "endTime": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "subject": {
                                  "type": "string",
                                  "enum": [
                                    "member_booking",
                                    "class",
                                    "event",
                                    "area_block"
                                  ],
                                  "description": "What holds the court for this interval, in the same vocabulary as `details.conflicts[].subject` on a refused create. `class` is a scheduled class holding its court - which is a booking row underneath, so it is not distinguishable by shape - and `area_block` is the club closing the court (maintenance, a private hire) rather than a sale. No id or name is attached - an availability read is not a read of who booked; use GET /v1/platform/bookings for the rows you may see.\n"
                                }
                              }
                            }
                          },
                          "slots": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "start": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "end": {
                                  "type": "string",
                                  "format": "date-time"
                                },
                                "capacity": {
                                  "type": "integer",
                                  "nullable": true,
                                  "description": "Null when the area is unlimited"
                                },
                                "remaining": {
                                  "type": "integer",
                                  "nullable": true,
                                  "description": "Null when the area is unlimited"
                                },
                                "bookable": {
                                  "type": "boolean"
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "API key is missing the required `areas:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/platform/availability/changes": {
      "get": {
        "operationId": "listAvailabilityChanges",
        "summary": "Availability change feed (reconciliation)",
        "description": "Returns the availability changes for your organization with `sequence > since`, in order. Use it to catch up after missed webhooks: pass the last `cursor` you processed, apply the returned changes by re-pulling `/availability` for the affected areas/windows, then store the new `cursor`. This feed is the authoritative backstop for the webhook stream.\n",
        "tags": [
          "Areas"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "since",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Cursor to read after (0 for the beginning of retention)."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "default": 100,
              "maximum": 500
            },
            "description": "Max changes to return."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of availability changes",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "changes": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "sequence": {
                            "type": "string"
                          },
                          "clubId": {
                            "type": "integer",
                            "nullable": true
                          },
                          "areaId": {
                            "type": "integer"
                          },
                          "from": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "to": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "reason": {
                            "type": "string"
                          },
                          "occurredAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "cursor": {
                      "type": "string"
                    },
                    "hasMore": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "API key is missing the required `areas:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/platform/booking-policies": {
      "get": {
        "operationId": "listBookingPolicies",
        "summary": "List booking policies",
        "description": "The organization's booking policies, newest first. A policy is the rules a booking is held to: its cancellation terms (`cancellationRules`), when payment is taken (`forcePayment`), how far ahead and how late members may book, the slot lengths on offer, and the check-in rules.\n\nEach policy is scoped on two axes that combine: WHAT it governs (`validFor` - classes, areas and/or instructors, optionally narrowed to types; empty means every booking) and WHO (`audience` - contact types, tags, plans held; null means everyone), and is narrowed to `clubIds` (empty means every club). When several apply, the most specific wins: a club-specific policy first, then what and who, then what, then who, then the unscoped default; a tie goes to the newest. To see which one governs a particular booking, use `GET /v1/platform/booking-policies/effective`.\n\nA policy with `kind: event` is different: it decides only what an event ticket's cancellation refunds, for the events in `eventIds` (empty means every event). A booking policy never governs a ticket.\n",
        "tags": [
          "Booking Policies"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only policies that can apply at this club - the ones linked to it, plus those linked to no club"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of booking policies",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformBookingPolicyPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `booking-policies:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createBookingPolicy",
        "summary": "Create a booking policy",
        "description": "Adds a booking policy. It governs new bookings at once; a booking already made keeps the cancellation terms it was made under.\n\n`name` and `clubIds` are required. `clubIds: []` links the policy to no club, which makes it apply at every club - and as the newer of two equally specific policies it takes over from the one that governed there - so that has to be asked for, never fallen into by leaving the field out. Every other field may be omitted and takes the policy default: free cancellation, no payment forced, every flag off, governing every booking for everyone.\n\nThe rules a policy must meet: cancellation rules have distinct `hoursInAdvance` and refunds that never grow as the booking approaches (all at 0% is a non-refundable policy); `bookingDurationStepMinutes` is 30 or 60; `minBookingSlotMinutes` is at most `maxBookingSlotMinutes` and a whole number of steps; `chargeAdvanceDays` is at most 365; `forcePayment: at_booking` needs an online card payment provider at the policy's clubs (code `BOOKING_POLICY_NEEDS_ONLINE_PAYMENT`). Every id - clubs, types, events, plans, product categories - must belong to this organization. An `event` policy takes no `validFor` and no `audience`. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Booking Policies"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformBookingPolicyCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Booking policy created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformBookingPolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `booking-policies:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/booking-policies/effective": {
      "get": {
        "operationId": "getEffectiveBookingPolicy",
        "summary": "Resolve the effective booking policy",
        "description": "The one policy that governs a booking, resolved exactly as booking, check-in and cancellation resolve it. Name the club and what is being booked: `areaId` for a court or room, `instructorId` for a session with a coach, `classId` for a class. A coach named with an area is judged as the coach's booking. Add `contactId` to apply the policies whose `audience` that person is in; without it, a policy with an audience never applies. With nothing but `clubId`, only policies that govern every booking are candidates.\n\nWith `eventId` (and only `clubId` beside it), the answer is instead the event policy that decides what that event's tickets refund.\n\n`policy` is null when nothing applies: no cancellation rules then means free cancellation for a booking, while for an event ticket the organizer decides. Every id must belong to this organization, and an area or class must be at the club named.\n",
        "tags": [
          "Booking Policies"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "clubId",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "The club the booking is at"
          },
          {
            "in": "query",
            "name": "areaId",
            "schema": {
              "type": "integer"
            },
            "description": "The area (court, room) being booked"
          },
          {
            "in": "query",
            "name": "instructorId",
            "schema": {
              "type": "integer"
            },
            "description": "The coach being booked"
          },
          {
            "in": "query",
            "name": "classId",
            "schema": {
              "type": "integer"
            },
            "description": "The class being booked into. Not combinable with areaId or instructorId."
          },
          {
            "in": "query",
            "name": "contactId",
            "schema": {
              "type": "integer"
            },
            "description": "The person booking, for policies with an audience. Also requires the `contacts:read` scope."
          },
          {
            "in": "query",
            "name": "eventId",
            "schema": {
              "type": "integer"
            },
            "description": "Resolve the cancellation policy for this event's tickets instead. Send with clubId only."
          }
        ],
        "responses": {
          "200": {
            "description": "The governing policy, or null when none applies",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformEffectiveBookingPolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `booking-policies:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/booking-policies/{id}": {
      "get": {
        "operationId": "getBookingPolicy",
        "summary": "Get a booking policy",
        "description": "One booking policy, with its clubs, scope and every rule it sets.",
        "tags": [
          "Booking Policies"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club booking policy id"
          }
        ],
        "responses": {
          "200": {
            "description": "The booking policy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformBookingPolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `booking-policies:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateBookingPolicy",
        "summary": "Update a booking policy",
        "description": "Edits a booking policy. Send only what changes; an omitted field is left alone. Lists (`clubIds`, `eventIds`, `cancellationRules`, `allowedProductCategoryIds`, `upsellPlanIds`) and the `validFor` and `audience` objects **replace** what is stored when sent - read the policy first and send the whole value you want. `null` clears a number or the audience.\n\nThe same rules as on create apply, judged against the policy as it will stand: a new step must still divide the stored minimum slot. Changing `kind` clears what the other kind carried (an audience when it becomes an event policy, event ids when it becomes a booking policy). Bookings already made keep the cancellation terms they were made under.\n",
        "tags": [
          "Booking Policies"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club booking policy id"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformBookingPolicyUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated booking policy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformBookingPolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `booking-policies:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteBookingPolicy",
        "summary": "Delete a booking policy",
        "description": "Deletes a policy for good. The bookings it governed fall to the next most specific policy that applies, or to none - which means free cancellation and no forced payment. A booking already made keeps the cancellation terms it was made under.\n",
        "tags": [
          "Booking Policies"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club booking policy id"
          }
        ],
        "responses": {
          "204": {
            "description": "Booking policy deleted"
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `booking-policies:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/booking-policies/{id}/duplicate": {
      "post": {
        "operationId": "duplicateBookingPolicy",
        "summary": "Duplicate a booking policy",
        "description": "Copies a policy, clubs and every rule included, as \"<name> (copy)\". The copy is exactly as specific as the original and newer, so it is the one that governs until one of them changes - edit the copy's scope or rules straight away. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Booking Policies"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club booking policy id"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "responses": {
          "201": {
            "description": "The copy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformBookingPolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `booking-policies:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/bookings": {
      "post": {
        "operationId": "createBooking",
        "summary": "Create a booking",
        "description": "Creates a booking on an area (e.g. a padel court), optionally with an instructor leading the session, or with an instructor alone and no area (a private lesson where no court is booked) - send `areaId`, `instructorId`, or both. A booking with no area is placed at the instructor's club; for an instructor who works across clubs, name it with `clubId` (it can be left out when the organization has one club, and is refused with `CLUB_REQUIRED` when it has several). Identify the customer with `contactId` (resolve it via GET /v1/platform/contacts) or, for callers that do not track 1club ids, with an inline `customer` matched to a contact by email and created if new - exactly one of the two.\n\nA booking transaction is recorded so the booking counts for revenue: `paid` marks it settled against a payment method named after your API key (no gateway call), so the club can see and reconcile what you collected separately from every other channel; `unpaid` leaves it outstanding. `amount` is the price the customer paid for the booking, before any fee you kept, and defaults to the computed price for the slot - the area's price, plus the instructor's hourly rate when one is attached. With `unpaid` and no `amount`, the booking is paid for the way the club's own staff would default it: a membership of the customer's that covers it is used (one session is spent and nothing is owed), and otherwise the price is recorded as owed. With an API key that needs the customer named by `contactId`: an inline `customer` is matched by an email anyone can type, so it never spends a membership and the price is recorded as owed. Send your own payment id as `payment.reference` and your commission as `payment.fee`: the sale is recorded at `amount`, and the fee is what the club reconciles against your payout statement.\n\nThis API assumes the calling system enforces its own booking rules, so 1club's member-facing policy (minimum notice, maximum days in advance, operating-hours envelope, slots that have already ended, instructor availability) is not applied - which is what lets an existing schedule be recorded as-is.\n\nWhat the club physically has is never overridden, and a booking that breaks one of these is refused with `400` and a populated `details.conflicts[]`: the area's concurrency capacity (`AREA_AT_CAPACITY`), a court the club has blocked for maintenance or a private hire (`AREA_BLOCKED`), the instructor already booked or teaching (`INSTRUCTOR_AT_CAPACITY`, `INSTRUCTOR_TEACHING_CLASS`), whether an instructor takes one-on-one bookings, and the slot alignment the area requires. A live event on the court or run by the instructor takes one of their places, so it counts toward `AREA_AT_CAPACITY` and `INSTRUCTOR_AT_CAPACITY` and is listed in `details.conflicts[]` with `subject: event`. There is no override parameter: a conflict is a refusal, not a warning.\n",
        "tags": [
          "Bookings"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response instead of creating a second booking"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "startTime",
                  "endTime",
                  "payment"
                ],
                "properties": {
                  "areaId": {
                    "type": "integer",
                    "description": "Area id (from GET /v1/platform/areas). Required unless `instructorId` is sent."
                  },
                  "clubId": {
                    "type": "integer",
                    "description": "Club (from GET /v1/platform/clubs) for a booking with no area whose instructor works across clubs. Optional for a single-club organization. With an area, or an instructor tied to one club, the booking is placed there and a different `clubId` is refused with `CLUB_MISMATCH`; one that is not the organization's is refused with `CLUB_NOT_FOUND`.\n"
                  },
                  "startTime": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "endTime": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "contactId": {
                    "type": "integer",
                    "description": "Existing contact to book for (from GET /v1/platform/contacts). Mutually exclusive with `customer`."
                  },
                  "customer": {
                    "type": "object",
                    "description": "Inline find-or-create by email. Mutually exclusive with `contactId`.",
                    "required": [
                      "email"
                    ],
                    "properties": {
                      "email": {
                        "type": "string",
                        "format": "email"
                      },
                      "firstName": {
                        "type": "string"
                      },
                      "lastName": {
                        "type": "string"
                      },
                      "phone": {
                        "type": "string"
                      }
                    }
                  },
                  "instructorId": {
                    "type": "integer",
                    "description": "Instructor leading the session (from GET /v1/platform/instructors), or the whole booking when no `areaId` is sent. Must be bookable for one-on-one sessions."
                  },
                  "instructorIds": {
                    "type": "array",
                    "minItems": 2,
                    "maxItems": 8,
                    "items": {
                      "type": "integer"
                    },
                    "description": "Every instructor on the session when two or more coach it together, all on the same level. Each one's rate is added to the price as a charge of its own. Needs an `areaId`. With `recurrence`, every occurrence carries all of them. `instructorId` is not needed with it.\n"
                  },
                  "instructorLocationId": {
                    "type": "integer",
                    "description": "Where a session with an instructor and no area happens, for an instructor who works at several places: one of the instructor's current `locations` (from GET /v1/platform/instructors/{id}). Left out, an instructor with exactly one place is booked there. Refused with `INSTRUCTOR_LOCATION_NOT_FOUND` when it is not a current location of that instructor, and with `INSTRUCTOR_LOCATION_NOT_APPLICABLE` alongside an `areaId` or without an `instructorId`.\n"
                  },
                  "serviceAddress": {
                    "type": "string",
                    "maxLength": 500,
                    "description": "The client's address, for a session at an `instructorLocationId` of kind `mobile` (the instructor goes to the client): required there (`SERVICE_ADDRESS_REQUIRED`), and refused without an `instructorLocationId`.\n"
                  },
                  "payment": {
                    "type": "object",
                    "required": [
                      "status"
                    ],
                    "properties": {
                      "status": {
                        "type": "string",
                        "enum": [
                          "paid",
                          "unpaid"
                        ]
                      },
                      "amount": {
                        "type": "number",
                        "maximum": 1000000,
                        "description": "The price the customer paid for the booking, in the club's currency, before any fee you kept. Defaults to the area price plus the instructor's hourly rate (or, for an `unpaid` booking, nothing when a membership covers it). Stated the way the club states its prices: where the club's tax rate is exclusive, tax is added on top exactly as for a price entered in the admin portal.\n"
                      },
                      "reference": {
                        "type": "string",
                        "maxLength": 128,
                        "description": "Your own id for the payment you collected. Stored on the payment and returned on reads, so the club can reconcile it against your payout statement. Requires `status: paid`.\n"
                      },
                      "fee": {
                        "type": "number",
                        "maximum": 1000000,
                        "description": "What you kept out of `amount` - your commission. Recorded on the payment for reconciliation; it does not reduce the sale. Requires `status: paid` and an explicit `amount` it cannot exceed. Neither `reference` nor `fee` is stored on a booking that records no payment (an amount of 0, or a free area).\n"
                      }
                    }
                  },
                  "channel": {
                    "type": "string",
                    "description": "Optional channel label, stored for attribution"
                  },
                  "notes": {
                    "type": "string"
                  },
                  "notifyCustomer": {
                    "type": "boolean",
                    "description": "Tell the customer their booking is confirmed - email plus the in-app, WhatsApp and SMS notification, and the payment receipt for a `paid` booking. Off by default for an API key, since the calling system normally sends its own confirmation; on by default over an OAuth connection, where a staff member is booking through an assistant and their member expects to hear from the club. The club's own staff alerts are separate: see `alertStaff`.\n"
                  },
                  "alertStaff": {
                    "type": "boolean",
                    "description": "Alert the club's staff to this booking (their User Bookings notification). On by default; pass `false` for the club's own writes, such as importing bookings or syncing them from another system, so staff are not alerted once per booking.\n"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Booking created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformBooking"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, or the slot cannot be sold. A scheduling refusal carries a machine-readable `code` and a populated `details.conflicts[]` naming what overlaps (`resource`, `resourceId`, `subject`, and the counterpart's own `startTime`/`endTime`). Each conflict also carries the counterpart's `id` and `label` (the booking and its customer's name, or the class or event and its name), which are `null` unless the credential can read that counterpart: `bookings:read` for a booking, `classes:read` for a class or an event, `areas:read` for a block. Detect a taken slot on the presence of `details.conflicts[]` rather than on a list of codes, which grows as new kinds of occupancy are modelled.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `bookings:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "An `Idempotency-Key` was reused with a different request body. Scheduling conflicts are `400`, not `409`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "get": {
        "operationId": "listBookings",
        "summary": "List bookings",
        "description": "Returns bookings that overlap the requested window - including one that started before `from` and is still running - ordered by start time. Each bound is an ISO date-time, or a bare `YYYY-MM-DD` read as midnight UTC. When `from`/`to` are omitted the window defaults to the next 7 days, and passing one derives the other.\n\nA single request may span at most 93 days. To cover a longer range, walk it in consecutive windows of 93 days or less, paging each window with `limit`/`offset` against the `total` it reports. A booking running across the boundary between two windows is returned by both, so de-duplicate by `id` when combining them. Ordering is stable (`startTime`, then id), so paging is well defined for a window that is not being written to; bookings created or cancelled mid-walk can still shift rows across page boundaries.\n\nBookings from every channel are returned, each tagged with `source`. That is deliberate: a caller reconciling its own writes has to be able to see member- and staff-created bookings to know whether a slot was already taken. Whether the writes (cancel, add/remove participant) reach those bookings too depends on the credential: an API key may only mutate the bookings it created (`source: api`), while a staff member acting through an authorized 1club assistant may mutate any of the organization's.\n\nA class booking carries the occurrence it attends as `classId`. Every attendee of a class holds their own booking row against the same `classId`, and `classes` rows are per-occurrence, so that is what tells two groups running in the same hour apart - filter by it, or read the roster from the class side with GET /v1/platform/classes/{id}/bookings.\n",
        "tags": [
          "Bookings"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "from",
            "schema": {
              "type": "string"
            },
            "description": "Start of the window, as an ISO date-time or `YYYY-MM-DD`. A booking still running at this time is included. Defaults to `to - 7d`, or now."
          },
          {
            "in": "query",
            "name": "to",
            "schema": {
              "type": "string"
            },
            "description": "Exclusive end of the window, as an ISO date-time or `YYYY-MM-DD`; a booking starting at this time is not included. Defaults to `from + 7d`."
          },
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only bookings at this club"
          },
          {
            "in": "query",
            "name": "areaId",
            "schema": {
              "type": "integer"
            },
            "description": "Only bookings on this area"
          },
          {
            "in": "query",
            "name": "classId",
            "schema": {
              "type": "integer"
            },
            "description": "Only the attendees of this class occurrence. Equivalent to GET /v1/platform/classes/{id}/bookings, which additionally resolves each attendee's name and check-in.\n"
          },
          {
            "in": "query",
            "name": "eventId",
            "schema": {
              "type": "integer"
            },
            "description": "Only bookings for this event"
          },
          {
            "in": "query",
            "name": "instructorId",
            "schema": {
              "type": "integer"
            },
            "description": "Only bookings led by this instructor, alone or with other instructors"
          },
          {
            "in": "query",
            "name": "contactId",
            "schema": {
              "type": "integer"
            },
            "description": "Only bookings for this contact"
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            },
            "description": "Only bookings with this status (e.g. confirmed, pending, cancelled)"
          },
          {
            "in": "query",
            "name": "include",
            "schema": {
              "type": "string",
              "pattern": "^(customer|money|cancellation)(,(customer|money|cancellation))*$",
              "example": "customer,money,cancellation"
            },
            "description": "Comma-separated expansions to embed on each booking, loaded once for the whole page. `customer` is the booking's customer, identical to what GET /v1/platform/contacts/{id} returns, and needs `contacts:read`. `money` is what the booking billed, what was paid and what is still outstanding, with the charges, cancellation credits, payments and refunds behind those figures, and needs `transactions:read`. `cancellation` is the cancellation terms stamped on the booking when it was accepted (with the deadlines they give, and until when it cancels for free) and, once cancelled, who cancelled it, when, why, with how much notice and at what refund. An expansion whose scope the key lacks is refused with 403 rather than left out.\n"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Maximum number of bookings to return"
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "Number of bookings to skip"
          }
        ],
        "responses": {
          "200": {
            "description": "Page of bookings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformBookingPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `bookings:read` scope, or an `include` was sent without the scope it needs",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/bookings/{id}/cancel": {
      "post": {
        "operationId": "cancelBooking",
        "summary": "Cancel a booking",
        "description": "Cancels the booking by its 1club id. Idempotent: cancelling an already-cancelled booking succeeds.\n\nWhich bookings are cancellable depends on the credential. An API key may cancel only the bookings it created (`source: api`); anything else is reported as not found. A staff member acting through an authorized 1club assistant may cancel any of the organization's bookings, as they can in the admin portal.\n\nRefunds follow the money. On a booking this API created, 1club never held the payment, so it moves none - but it records what you gave back, so the club's revenue matches yours. Cancelling with an API key records a refund of everything collected unless `refund.amount` says otherwise: send the amount you actually returned to keep a cancellation fee, or `0` if you kept it all, and your own refund id as `refund.reference`. Over a staff credential nothing is recorded unless `refund` is sent. On a booking taken through 1club (member portal, app, front desk), the club is the one cancelling: an unpaid booking owes nothing unless `keepCancellationCharge` is true. A paid booking the cancellation policy would keep money from needs an explicit `keepCancellationCharge` - `false` refunds it in full, `true` applies the policy - and without one the call is refused (409 `CANCELLATION_CHARGE_DECISION_REQUIRED`), exactly as the admin portal asks. `refund` is ignored there.\n\nA class enrolment or an event registration made with guests (POST /v1/platform/classes/{id}/bookings, POST /v1/platform/events/{id}/bookings) is one purchase: cancelling any of its seats cancels all of them, and `refund.amount` is what came back for the whole registration, recorded across its seats in proportion to what each was paid.\n\nA booking that has already been checked in cannot be cancelled (409) - voiding a check-in is an admin-portal action. One occurrence of a recurring booking is cancelled, not the series.\n",
        "tags": [
          "Bookings"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club booking id (returned by create)"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "maxLength": 500,
                    "description": "Why the booking is cancelled, recorded on the cancellation and shown to staff wherever the booking's cancellation is (and returned by `include=cancellation`). Defaults to a note naming the API as the channel.\n"
                  },
                  "notifyCustomer": {
                    "type": "boolean",
                    "description": "Tell the customer their booking was cancelled - email plus the in-app and WhatsApp notification. Defaults to off for a booking this API created, since callers normally send their own notice, and to on for a booking taken through 1club, whose customer expects to hear it from the club. The club's own staff alerts are separate: see `alertStaff`.\n"
                  },
                  "alertStaff": {
                    "type": "boolean",
                    "description": "Alert the club's staff to this cancellation (their User Bookings notification). On by default; pass `false` for the club's own writes, such as a sync from another system.\n"
                  },
                  "keepCancellationCharge": {
                    "type": "boolean",
                    "description": "On a booking taken through 1club: `true` applies the club's cancellation policy, so a late cancellation keeps its charge; `false` refunds what was paid in full and forgives the rest. Left out, an unpaid booking owes nothing, and a paid one the policy would keep money from is refused with 409 `CANCELLATION_CHARGE_DECISION_REQUIRED`. Ignored on a booking this API created.\n"
                  },
                  "refund": {
                    "type": "object",
                    "description": "What you returned to the customer, on a booking you collected the money for. Omit it to record a full refund of what was collected (API key) or nothing (staff credential).\n",
                    "properties": {
                      "amount": {
                        "type": "number",
                        "maximum": 1000000,
                        "description": "The amount returned to the customer. `0` records no refund (you kept the whole payment as a cancellation fee). Cannot exceed what was collected (`400 AMOUNT_EXCEEDS_REFUNDABLE`).\n"
                      },
                      "reference": {
                        "type": "string",
                        "maxLength": 128,
                        "description": "Your own id for the refund."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Booking cancelled",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "bookingId": {
                      "type": "integer"
                    },
                    "status": {
                      "type": "string",
                      "example": "cancelled"
                    },
                    "refundedAmount": {
                      "type": "number",
                      "description": "What this call recorded as returned to the customer; `0` when nothing was."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `bookings:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "The booking was paid and the cancellation policy would keep some of it, so `keepCancellationCharge` must say what happens to the money (`CANCELLATION_CHARGE_DECISION_REQUIRED`, with the bookings in `details.bookingIds`); or it has already been checked in, so it cannot be cancelled (`BOOKING_ALREADY_CHECKED_IN`); or it is managed by another API key that owns its own records, so only that key may release it (`BOOKING_EXTERNALLY_MANAGED`, with the managing integration's name in `details.managedBy`).\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/bookings/{id}": {
      "delete": {
        "operationId": "deleteBooking",
        "summary": "Delete a booking",
        "description": "Permanently removes a booking entered by mistake or as a test, as if it had never been made - unlike cancelling, which keeps it on the books. Its charges and cancellation records are deleted with it, and so are its players, check-ins, the instructor's pay for it and the door access it granted. It cannot be undone.\n\nRefused with `409 BOOKING_HAS_PAYMENTS` while any of its charges was paid or has a payment, invoice, Wallet movement or refund behind it: cancel it and refund instead, so the sale stays in the books. Refused with `409 BOOKING_ON_OPEN_ORDER` (or `409 CHARGE_ON_OPEN_ORDER`) while an open order still holds it or one of its charges, and one seat of a registration with guests with `409 BOOKING_HAS_SEATS` until the registration is cancelled. Charges recorded on its check-ins count as its own. A visit it drew from a pass, the organizer's or a player's, goes back on the pass unless it was cancelled, and its External Program usages are deleted with it. An API key may delete only bookings made through the API, and never one another key manages (`409 BOOKING_EXTERNALLY_MANAGED`). For a member of staff, it needs the Extended level of booking delete, which only admins hold by default.\n",
        "tags": [
          "Bookings"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The booking and its charges were deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id",
                    "deletedTransactionIds"
                  ],
                  "properties": {
                    "id": {
                      "type": "integer",
                      "description": "The deleted booking's id"
                    },
                    "deletedTransactionIds": {
                      "type": "array",
                      "items": {
                        "type": "integer"
                      },
                      "description": "The charges deleted with it"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid booking ID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `bookings:delete` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "Booking not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "Paid or invoiced, on an open order, a seat of a live registration, or managed by another key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "get": {
        "operationId": "getBooking",
        "summary": "Get a booking",
        "description": "Returns the current state of a booking (including payment status) by its 1club id - any of the organization's bookings, whichever channel created it. Nothing here is absent from the list endpoint, which has always returned every source.\n",
        "tags": [
          "Bookings"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club booking id"
          },
          {
            "in": "query",
            "name": "include",
            "schema": {
              "type": "string",
              "pattern": "^(customer|money|cancellation)(,(customer|money|cancellation))*$",
              "example": "customer,money,cancellation"
            },
            "description": "Comma-separated expansions to embed on the booking. `customer` is the booking's customer, identical to what GET /v1/platform/contacts/{id} returns, and needs `contacts:read`. `money` is what the booking billed, what was paid and what is still outstanding, with the charges, cancellation credits, payments and refunds behind those figures, and needs `transactions:read`. `cancellation` is the cancellation terms stamped on the booking when it was accepted (with the deadlines they give, and until when it cancels for free) and, once cancelled, who cancelled it, when, why, with how much notice and at what refund. An expansion whose scope the key lacks is refused with 403 rather than left out.\n"
          }
        ],
        "responses": {
          "200": {
            "description": "Booking state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformBookingListItem"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `bookings:read` scope, or an `include` was sent without the scope it needs",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateBooking",
        "summary": "Update a booking",
        "description": "Edits a booking by its 1club id: reschedule it, move it to another area, attach or remove an instructor, reassign the contact, change its notes or price, or make it recur. Send only the fields that change. Reaches the same bookings as cancel: an API key only those it created, a staff member through an authorized 1club assistant any of the organization's.\n\nThe edit follows the admin portal's rules. A cancelled booking is final, and a booking on a class takes its time and price from the class. As on create, the club's member-facing policy (operating hours, instructor availability) is not applied, but an occupied or blocked court, or a coach who is already booked, is refused with `details.conflicts[]`.\n\nMoney follows the edit. `amount` reprices the booking to your figure. Without it, a booking this API created keeps its price, and a booking taken through 1club is re-quoted when the slot, area, instructor or contact changes. The charge is then reconciled: an increase on a paid booking leaves the difference outstanding, and a decrease below what was paid needs a refund, which this endpoint does not perform. Payment status cannot be changed here.\n\nRecurring bookings. `recurrence` on a one-off booking makes it the first occurrence of a series. On an occurrence of a series, `scope=all_future` applies the edit to this occurrence and every later one that has not started yet (earlier dates keep what they have): a new `startTime`/`endTime` gives each that time of day on its own date (the weekday changes only through `recurrence.daysOfWeek`), a new area or instructor is checked against every date, and a new `recurrence` rewrites the cadence or end condition; days dropped from a weekly pattern are cancelled with their refund. A series bound to a recurring class follows the class and cannot be re-timed, and a booking an API key created cannot be made to recur at all (`RECURRENCE_NOT_AVAILABLE_TO_MANAGING_KEY`): 1club would be generating occurrences that key never created, so each one is its own booking. An edit whose series has already run touches nothing.\n",
        "tags": [
          "Bookings"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club booking id"
          },
          {
            "in": "query",
            "name": "scope",
            "schema": {
              "type": "string",
              "enum": [
                "this_instance",
                "all_future"
              ],
              "default": "this_instance"
            },
            "description": "For an occurrence of a recurring booking, whether the edit applies to it alone or to it and every later not-yet-started occurrence of the series (see the description)"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformBookingUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The booking after the edit - for a series edit, the occurrence you named",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformBooking"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, or an edit that cannot hold: `BOOKING_CANCELLED`, `BOOKING_ON_CLASS_NOT_RESCHEDULABLE`, `BOOKING_NEEDS_RESOURCE`, `BOOKING_COVERED_CANNOT_PRICE`, `CLASS_AT_CAPACITY`, `AREA_NOT_FOUND`, `CONTACT_NOT_FOUND`, `RECURRENCE_REQUIRES_SERIES_SCOPE` (a `recurrence` sent to an occurrence without `scope=all_future`), `RECURRENCE_NOT_AVAILABLE_TO_MANAGING_KEY`, `DISCOUNTED_BOOKING_TO_SERIES` (a `recurrence` sent to a booking that carries a discount - take the discount off first), `SERIES_EXTERNAL_PROGRAM_UNSUPPORTED` (a `recurrence` sent to a booking on an external program, which pays visits one booking at a time), `PROMOTION_NOT_REDEEMABLE` in `error` (a `contactId` the booking's discount cannot pass to, with the reason in `code`), or a taken slot, which carries `details.conflicts[]` as on create.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `bookings:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "The booking is managed by another API key that owns its own records (`BOOKING_EXTERNALLY_MANAGED`, with the managing integration's name in `details.managedBy`); or the new price is below what has already been paid on the booking (`BOOKING_CHARGE_OVERPAID`), which needs a refund rather than an edit; or a part-paid or invoiced charge cannot be rewritten (`BOOKING_CHARGE_NEEDS_ADJUSTMENT`); or an `Idempotency-Key` was reused with a different request body.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/bookings/{id}/cancellation-charge/waive": {
      "post": {
        "operationId": "waiveCancellationCharge",
        "summary": "Waive a booking's Cancellation Charge",
        "description": "Lets the member off what a cancelled or missed (`no_show`) booking still owes under its cancellation terms, as the club's staff do from the booking: the unpaid charge is withdrawn, anything already taken from the member's Wallet for it is given back, and the reason is recorded on the booking. Money the member paid upfront stays paid. Waiving a booking already waived changes nothing. A booking that is not cancelled or missed, or carries no cancellation terms, is a 404. An API key reaches only the bookings it made through the API, and never another key's managed booking.\n",
        "tags": [
          "Bookings"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "reason"
                ],
                "properties": {
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1000,
                    "description": "Why it is waived, recorded on the booking."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The booking's cancellation outcome after the waiver",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "bookingId",
                    "outcome",
                    "retainedAmount",
                    "walletDeduction",
                    "amountDue"
                  ],
                  "properties": {
                    "bookingId": {
                      "type": "integer"
                    },
                    "outcome": {
                      "type": "string",
                      "enum": [
                        "cancelled",
                        "no_show"
                      ]
                    },
                    "retainedAmount": {
                      "type": "number",
                      "description": "What the club keeps for the booking, tax included"
                    },
                    "walletDeduction": {
                      "type": "number",
                      "description": "Still taken from the Wallet for it (0 once waived)"
                    },
                    "amountDue": {
                      "type": "number",
                      "description": "What the member still owes for it (0 once waived)"
                    },
                    "terms": {
                      "type": "object",
                      "nullable": true,
                      "description": "The cancellation terms the booking was accepted on",
                      "properties": {
                        "waiver": {
                          "type": "object",
                          "properties": {
                            "at": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "byUserId": {
                              "type": "integer",
                              "nullable": true,
                              "description": "The member of staff who waived it; null for an API key"
                            },
                            "reason": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid booking ID, or no reason",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `bookings:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "Booking not found, or it has no Cancellation Charge to waive",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "Managed by another key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/bookings/{id}/participants": {
      "get": {
        "operationId": "listBookingParticipants",
        "summary": "List the additional players on a booking",
        "description": "Returns the extra players on a booking - any of the organization's, whichever channel created it. The person the booking is for (the organizer) is on the booking itself as `contactId` and is not repeated here. Only the add and remove writes are restricted to bookings this API created.\n\nThis lists the co-players sharing *one* booking (a doubles court). The attendees of a class each hold their own booking - read those with GET /v1/platform/classes/{id}/bookings.\n",
        "tags": [
          "Bookings"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club booking id"
          }
        ],
        "responses": {
          "200": {
            "description": "The booking's additional players",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "contactId": {
                        "type": "integer"
                      },
                      "name": {
                        "type": "string"
                      },
                      "status": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `bookings:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createBookingParticipant",
        "summary": "Add a player to a booking",
        "description": "Adds another player to a booking - for a doubles court, the three players joining the organizer. The contact must already exist (create it via POST /v1/platform/contacts). The total, counting the organizer, is capped by the area type's maximum players.\n\nReaches the same bookings as cancel: an API key may only add to the ones it created, a staff member acting through an authorized 1club assistant to any of the organization's.\n",
        "tags": [
          "Bookings"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club booking id"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "contactId"
                ],
                "properties": {
                  "contactId": {
                    "type": "integer",
                    "description": "Contact to add as a player"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Player added",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "bookingId": {
                      "type": "integer"
                    },
                    "contactId": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `bookings:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "$ref": "#/components/responses/PlatformConflict"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/bookings/{id}/participants/{contactId}": {
      "delete": {
        "operationId": "deleteBookingParticipant",
        "summary": "Remove a player from a booking",
        "description": "Removes an additional player from a booking. Reaches the same bookings as cancel: an API key may only remove from the ones it created, a staff member acting through an authorized 1club assistant from any of the organization's.\n",
        "tags": [
          "Bookings"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club booking id"
          },
          {
            "in": "path",
            "name": "contactId",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Contact to remove"
          }
        ],
        "responses": {
          "204": {
            "description": "Player removed"
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `bookings:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "The booking is managed by another API key that owns its own records (`BOOKING_EXTERNALLY_MANAGED`), so its roster is only that key's to change. The managing integration's name is in `details.managedBy`.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/checkins": {
      "get": {
        "operationId": "listCheckins",
        "summary": "List check-ins",
        "description": "Lists attendance records for the organization, newest first.",
        "tags": [
          "Check-ins"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "contactId",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "classId",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "bookingId",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "startDate",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "in": "query",
            "name": "endDate",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Page of check-ins",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformCheckinPage"
                }
              }
            }
          },
          "403": {
            "description": "Missing `checkins:read` scope"
          }
        }
      },
      "post": {
        "operationId": "createCheckin",
        "summary": "Check in a booking or a member",
        "description": "Records attendance, in one of two ways. Send exactly one of `bookingId` or `contactId`. Supports the `Idempotency-Key` header.\n\n**An existing booking** (`bookingId`): records attendance for the booking during its configured check-in window. The booking must be `confirmed` or `pending`, and its payment and duplicate-attendance rules still apply.\n\n**A visit with no booking** (`contactId` and `clubId`): checks a member in at the club on their membership, the way the front desk's direct check-in does, and spends one session from it. Name the membership with `membershipId`, or leave it out to use the member's own covering membership (one with nothing owed is preferred). To record the visit against a zero-fee external program instead, send `externalProgramId`. The membership must not be limited to particular classes, areas or instructors, must have sessions left, and must have nothing owed on it - a member who owes is checked in at the front desk, where staff can see the balance. Nothing is charged. To check someone into a class or an area, book it first and check that booking in.\n",
        "tags": [
          "Check-ins"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "title": "Booking check-in",
                    "required": [
                      "bookingId"
                    ],
                    "properties": {
                      "bookingId": {
                        "type": "integer"
                      },
                      "clubId": {
                        "type": "integer",
                        "description": "Required only for a clubless event booking when no club can otherwise be derived. Must belong to the authorized organization."
                      }
                    }
                  },
                  {
                    "type": "object",
                    "title": "Check-in without a booking",
                    "required": [
                      "contactId",
                      "clubId"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "contactId": {
                        "type": "integer",
                        "description": "The member checking in"
                      },
                      "clubId": {
                        "type": "integer",
                        "description": "The club they are checking in at. Must belong to the authorized organization."
                      },
                      "membershipId": {
                        "type": "integer",
                        "description": "The membership to spend the visit from. Omit to use the member's own covering membership."
                      },
                      "externalProgramId": {
                        "type": "integer",
                        "description": "A zero-fee external program to record the visit against instead of a membership. At most one of membershipId and externalProgramId."
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Check-in created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformCheckin"
                }
              }
            }
          },
          "400": {
            "description": "The body names both or neither of `bookingId` and `contactId`; the booking is not `confirmed` or `pending` or has an unpaid balance; `clubId` is missing or not in this organization; or the membership is not one a visit without a booking can use (`MEMBERSHIP_NOT_ELIGIBLE`), owes money (`MEMBERSHIP_UNPAID`), or the member has none (`NO_COVERING_MEMBERSHIP`)"
          },
          "403": {
            "description": "Missing `checkins:write` scope or check-in is outside the allowed window"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "Booking is already checked in"
          }
        }
      }
    },
    "/v1/platform/checkins/{id}": {
      "get": {
        "operationId": "getCheckin",
        "summary": "Get a check-in",
        "tags": [
          "Check-ins"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Check-in details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformCheckin"
                }
              }
            }
          },
          "403": {
            "description": "Missing `checkins:read` scope"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          }
        }
      }
    },
    "/v1/platform/class-types": {
      "get": {
        "operationId": "listClassTypes",
        "summary": "List class types",
        "description": "Returns the organization's class types - the kinds of class it runs, such as \"Padel clinic\" or \"Yoga\". Resolve one here to fill in `classTypeId` when creating a class, or `classTypeIds` when scoping a class pay rate policy to particular kinds of class.\n\nA class type is not a label: it decides how many people one booking may bring, whether an empty class cancels itself and how long beforehand, and which account the class posts to - so read the whole record before choosing one rather than matching on the name.\n\nThere is no paging: an organization has a handful of these.\n",
        "tags": [
          "Classes"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Every class type in the organization, in the order staff set in Settings",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformClassType"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `classes:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createClassType",
        "summary": "Create a class type",
        "description": "Adds a kind of class the organization runs. List the existing types first - a club rarely wants two types meaning the same thing, and this endpoint will happily create a duplicate name.\n\n`slug` is optional and derived from the name when omitted, suffixed if that is taken. Send one explicitly only when something outside 1club already refers to it; an explicit slug that clashes is a 409 rather than a row quietly filed under a different key. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Classes"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformClassTypeCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Class type created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformClassType"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `classes:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "An explicit `slug` is already used by another class type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/class-types/{id}": {
      "get": {
        "operationId": "getClassType",
        "summary": "Get a class type",
        "description": "Returns one class type and how many classes are run as it, past and future.",
        "tags": [
          "Classes"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The class type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformClassType"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `classes:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateClassType",
        "summary": "Update a class type",
        "description": "Changes a class type. Send only what changes; an omitted field is left alone, `null` clears a nullable one, and at least one field is required.\n\nEvery field here applies to classes already scheduled as this type, not only to new ones: lowering `maxPartySize` does not evict anybody already booked, but it does cap the next booking, and changing `revenueAccountId` moves where future sales post without rewriting the ones already taken. A rename leaves `slug` alone - it is a stable key, so it moves only when you send one.\n",
        "tags": [
          "Classes"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformClassTypeUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated class type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformClassType"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `classes:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "An explicit `slug` is already used by another class type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/class-types/order": {
      "put": {
        "operationId": "updateClassTypeOrder",
        "summary": "Reorder class types",
        "description": "Sets the order of the organization's class types: the ids, first to last. Every list of them follows it - this API, the 1club admin, the club's website and member apps. A type left out (one added since you read the list) keeps its place after the listed ones. Returns the list as it now stands.\n",
        "tags": [
          "Classes"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformTypeOrder"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Every class type in the organization, in the new order",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformClassType"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `classes:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/classes": {
      "get": {
        "operationId": "listClasses",
        "summary": "List classes",
        "description": "Returns the organization's class occurrences, ordered by start time. One row is one occurrence - a weekly class materializes a row per session, linked by `recurrenceId` and `occurrenceIndex` - so a row's `id` is what a booking's `classId` points at.\n\nThe window is open by default: with neither bound the whole schedule is in scope, past included, because this endpoint serves operators reconciling what happened rather than members shopping for a slot. `startDate` keeps occurrences still running at or after it, `endDate` keeps occurrences starting before it (exclusive), and each accepts an ISO date-time or a bare `YYYY-MM-DD` read as midnight UTC. Overlap, not containment, so a long or multi-day class shows up on every day it covers.\n\nPage with `limit`/`offset` against the `total` the response reports. Ordering is stable (`startTime`, then id).\n\nEvery class the organization owns is in scope - member-only and private occurrences included, and those at a deactivated club - because the key holder is the operator, not a visitor. `locale` resolves `name` and `description`; the full `translations` blob is returned either way.\n",
        "tags": [
          "Classes"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "startDate",
            "schema": {
              "type": "string"
            },
            "description": "Keep occurrences ending after this instant. ISO date-time or `YYYY-MM-DD`. Omit for no lower bound."
          },
          {
            "in": "query",
            "name": "endDate",
            "schema": {
              "type": "string"
            },
            "description": "Keep occurrences starting before this instant (exclusive). ISO date-time or `YYYY-MM-DD`. Omit for no upper bound."
          },
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only classes at this club"
          },
          {
            "in": "query",
            "name": "classTypeId",
            "schema": {
              "type": "integer"
            },
            "description": "Only classes of this class type"
          },
          {
            "in": "query",
            "name": "instructorId",
            "schema": {
              "type": "integer"
            },
            "description": "Only classes this instructor is assigned to teach"
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "cancelled"
              ]
            },
            "description": "Only classes with this status. A cancelled occurrence keeps its bookings."
          },
          {
            "in": "query",
            "name": "sport",
            "schema": {
              "type": "string"
            },
            "description": "Only classes for this sport"
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string"
            },
            "description": "Case-insensitive match on the class name or its class type's name"
          },
          {
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string"
            },
            "description": "Locale for translated fields (e.g. \"en\", \"es\")"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Maximum number of classes to return"
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "Number of classes to skip"
          }
        ],
        "responses": {
          "200": {
            "description": "Page of classes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformClassPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `classes:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createClass",
        "summary": "Create a class",
        "description": "Creates a class. Times must be ISO 8601 instants with an explicit offset. Supports the `Idempotency-Key` header.\n\nWithout `recurrence` this creates one occurrence. With it, one request creates the whole repeating series - do not call this once per week. `startTime`/`endTime` stay required either way: they are the template slot, giving every occurrence its time of day and its duration, and the series starts from `startTime` (so there is no separate start date). A weekly rule whose `daysOfWeek` do not include that day puts the first occurrence on the first listed day at or after it.\n\nA bounded series (`ends.type` of `until` or `after`) is materialized in full inside this request, so it is capped at 520 occurrences - over that the request is refused with `RECURRENCE_TOO_MANY_OCCURRENCES` rather than silently truncated. An open-ended series (`ends` omitted, or `ends.type: \"never\"`) materializes a rolling window and extends itself, so only the first weeks exist immediately.\n\n`ends.occurrences` counts **occurrences, not weeks**, across every day in `daysOfWeek` - twelve weeks of a Monday-and-Wednesday class is `24`. To end on a date instead, use `ends.type: \"until\"` with an `endDate` and skip the arithmetic.\n\nThe area is checked for a clash on the **first** occurrence only - the same rule the admin dashboard applies. Later occurrences are written without re-checking the court, so a series can land on a slot that is already held in a later week; read GET /v1/platform/areas/{areaId}/availability for the window first if that matters.\n\nThe response is the first occurrence, and for a recurring create it also carries `series.occurrencesCreated` - what this request actually wrote. Compare it with what you asked for: an occurrence at a club that is closed, or past its closing date, is skipped rather than failing the create. Read the rest of the series back with GET /v1/platform/classes filtered on the `recurrenceId` it carries.\n",
        "tags": [
          "Classes"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformClassCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Class created. For a recurring create, the first occurrence of the new series.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformClass"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "403": {
            "description": "Missing `classes:write` scope"
          },
          "409": {
            "description": "The area is already occupied for the requested slot"
          }
        }
      }
    },
    "/v1/platform/classes/{id}/bookings": {
      "get": {
        "operationId": "listClassBookings",
        "summary": "List a class's roster",
        "description": "Returns who is booked into one class occurrence, whether they were checked in, and what they paid - the roster, from the class side. This is the answer to \"two groups run at 10:00, who is in which\": every attendee holds their own booking row against this class's id.\n\nAttendees only: the occurrence's own area hold and any instructor slot are excluded by the same predicate that decides capacity, so the roster is drawn from exactly the population the class's `bookedCount` counts.\n\nDo not expect `total` to equal `bookedCount`. Capacity counts `confirmed`, `pending` and `checked_in`, and adds standalone walk-in check-ins that have no booking to list; the roster also keeps `no_show`, because whether someone was enrolled and failed to turn up is what an attendance reconciliation is asking. Cancelled seats are the one status left out, unless `status=cancelled` asks for them.\n\nRequires both `classes:read` and `bookings:read`: it is a class sub-resource that returns booking data. `contactEmail` additionally needs `contacts:read` and is null without it - a name identifies who is on the roster, an email address is contact PII and stays behind the scope that guards it elsewhere.\n",
        "tags": [
          "Classes"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Class id"
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            },
            "description": "Only attendees with this booking status (e.g. confirmed, checked_in, cancelled). Defaults to every status but cancelled."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            },
            "description": "Maximum number of attendees to return"
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "Number of attendees to skip"
          }
        ],
        "responses": {
          "200": {
            "description": "Page of attendees",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformClassBookingPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `classes:read` or `bookings:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createClassBooking",
        "summary": "Book a customer into a class",
        "description": "Enrols one customer in a class occurrence, with any guests they bring - the booking the club's own staff make when they add someone to a class. Every seat takes the class's time, club and price; capacity for the whole party, the class type's party size (`CLASS_PARTY_TOO_LARGE`), the class's booking policy, a waitlist entry the customer already holds (converted into this booking) and the \"already on this class\" check all apply exactly as they do in the admin portal. Identify the customer with `contactId` (resolve it via GET /v1/platform/contacts) or with an inline `customer` matched to a contact by email and created if new - exactly one of the two.\n\n`quantity` counts the places, the customer's own included: `3` is the customer and two guests. The seats are sold as one order, so the guests' seats carry no contact, show the customer as who bought them, and are released with the customer's seat when it is cancelled.\n\nPayment works as on POST /v1/platform/bookings: `paid` records the seats as settled against a payment method named after your API key (no gateway call), with your `reference` on each seat's payment and your `fee` shared over them; `unpaid` leaves them outstanding. `amount` is what the whole enrolment cost, shared over the seats in proportion to their price. With `unpaid` and no `amount`, the customer's seat is paid for the way the club's own staff would default it: a membership of the customer's that covers the class is used (one session is spent and nothing is owed), and otherwise the class price is recorded as owed; a guest's seat always owes the class price. With an API key that needs the customer named by `contactId`: an inline `customer` never spends a membership, and the class price is recorded as owed.\n\nA full class, a cancelled one and one that has already run are refused; nothing here overrides them. Returns the customer's own seat, as POST /v1/platform/bookings returns a booking, with `classId`, `orderId` and `seatBookingIds` (every seat of the enrolment) set.\n",
        "tags": [
          "Classes"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Class occurrence id (from GET /v1/platform/classes)"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "payment"
                ],
                "properties": {
                  "quantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 50,
                    "default": 1,
                    "description": "How many places, the customer's own included. Capped by the class type's party size."
                  },
                  "contactId": {
                    "type": "integer",
                    "description": "Existing contact to book for (from GET /v1/platform/contacts). Mutually exclusive with `customer`."
                  },
                  "customer": {
                    "type": "object",
                    "description": "Inline find-or-create by email. Mutually exclusive with `contactId`.",
                    "required": [
                      "email"
                    ],
                    "properties": {
                      "email": {
                        "type": "string",
                        "format": "email"
                      },
                      "firstName": {
                        "type": "string"
                      },
                      "lastName": {
                        "type": "string"
                      },
                      "phone": {
                        "type": "string"
                      }
                    }
                  },
                  "payment": {
                    "type": "object",
                    "required": [
                      "status"
                    ],
                    "properties": {
                      "status": {
                        "type": "string",
                        "enum": [
                          "paid",
                          "unpaid"
                        ]
                      },
                      "amount": {
                        "type": "number",
                        "maximum": 1000000,
                        "description": "What the whole enrolment cost, in the club's currency, before any fee you kept; shared over the seats in proportion to their price. Defaults to the class price per seat (or, for the customer's `unpaid` seat, nothing when a membership covers it). Stated the way the club states its prices: where the club's tax rate is exclusive, tax is added on top.\n"
                      },
                      "reference": {
                        "type": "string",
                        "maxLength": 128,
                        "description": "Your own id for the payment you collected. Requires `status` paid."
                      },
                      "fee": {
                        "type": "number",
                        "maximum": 1000000,
                        "description": "What you kept out of `amount` - your commission. Requires `status` paid and an explicit `amount` it cannot exceed.\n"
                      }
                    }
                  },
                  "notes": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "notifyCustomer": {
                    "type": "boolean",
                    "description": "Tell the customer they are booked - email plus the in-app, WhatsApp and SMS notification. Off by default for an API key, on by default over an OAuth connection, as on POST /v1/platform/bookings.\n"
                  },
                  "alertStaff": {
                    "type": "boolean",
                    "description": "Alert the club's staff to this booking (their User Bookings notification). On by default; pass `false` for the club's own writes, such as importing bookings or syncing them from another system, so staff are not alerted once per booking.\n"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Booking created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformBooking"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request; the class is cancelled (`CLASS_CANCELLED`) or has already run (`BOOKING_ALREADY_ENDED`); or the contact cannot be booked.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `bookings:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "The class is full, or the customer is already booked on it, teaching it or checked in to it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/classes/{id}": {
      "get": {
        "operationId": "getClass",
        "summary": "Get a class by ID",
        "description": "Returns a single class occurrence. The class must belong to the organization the API key belongs to. Read its roster with GET /v1/platform/classes/{id}/bookings.\n",
        "tags": [
          "Classes"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Class ID"
          },
          {
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string"
            },
            "description": "Locale for translations"
          }
        ],
        "responses": {
          "200": {
            "description": "Class details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformClass"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `classes:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateClass",
        "summary": "Update a class",
        "description": "Updates one occurrence, or this and all future occurrences when `scope=all_future`. A recurring class defaults to `this_instance`, so a series-wide edit must ask for it explicitly.\n\nWith `scope=all_future`, `recurrence` moves where the series ends - `ends` plus `endDate`, the same fields a create takes. Send it on its own: a body that also carries class fields is refused, so an end change never half-applies. Only the end: a `frequency`, `interval` or `daysOfWeek` is refused, and to change a cadence you delete the remaining series and create it again. A later end writes the new occurrences; an earlier one removes the occurrences past it, and is refused with 409 when any of those has an active booking or waitlist entry (cancel them first) - nothing a member holds is cancelled as a side effect. The occurrence named must be one the series keeps, and the end cannot fall before a session that has already run.\n\nThe response to an end change carries `series.occurrencesCreated` and `series.occurrencesRemoved`. As on a create, an occurrence at a club that is closed is skipped rather than failing the request, so compare the count with what you expected.\n",
        "tags": [
          "Classes"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "scope",
            "schema": {
              "type": "string",
              "enum": [
                "this_instance",
                "all_future"
              ],
              "default": "this_instance"
            },
            "description": "Whether the update applies to this occurrence only or to this and every later one in the series"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformClassUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Class updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformClass"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "403": {
            "description": "Missing `classes:write` scope"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "The new time double-books the area, or an occurrence a new series end would remove has active bookings or waitlist entries"
          }
        }
      },
      "delete": {
        "operationId": "deleteClass",
        "summary": "Delete a class",
        "description": "Deletes one occurrence, or this and all future occurrences when `scope=all_future`.",
        "tags": [
          "Classes"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "scope",
            "schema": {
              "type": "string",
              "enum": [
                "this_instance",
                "all_future"
              ],
              "default": "this_instance"
            },
            "description": "Whether the delete applies to this occurrence only or to this and every later one in the series"
          }
        ],
        "responses": {
          "204": {
            "description": "Class deleted"
          },
          "403": {
            "description": "Missing `classes:write` scope"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "Class has active bookings or waitlist entries"
          }
        }
      }
    },
    "/v1/platform/clubs": {
      "get": {
        "operationId": "listClubs",
        "summary": "List clubs",
        "description": "Every club of the organization associated with the API token, by name, whatever its status. Use it to find the `slug` the other club endpoints take, and the `id` that areas, classes and instructors are attached to. Each club carries its booking-card labels, so this is also how to read them back.\n",
        "tags": [
          "Clubs"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The organization's clubs",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformClubSummary"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `clubs:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/clubs/{slug}": {
      "get": {
        "operationId": "getClub",
        "summary": "Get club details by slug",
        "description": "Returns club details including amenities, rating, images and the club's booking-card labels. The club must be active and belong to the organization associated with the API token.\n",
        "tags": [
          "Clubs"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Club slug"
          },
          {
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string"
            },
            "description": "Locale for the club's translated text (subtitle, description, getting there) and amenity names"
          }
        ],
        "responses": {
          "200": {
            "description": "Club details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformClub"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "API key is missing the required `clubs:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "Club not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateClub",
        "summary": "Update a club's booking-card labels",
        "description": "Changes the club's own words for the booking cards members choose from under \"What would you like to book?\": the private training, group activities and areas cards. Send only what changes; an omitted field is left alone. Live immediately on the website, the member portal, the mobile app and 1club.me - the same setting as Settings > Clubs > the club > Booking labels in the 1club admin portal.\n\nA label is a title only. The line under each card stays the platform's (a count such as \"4 available\", or the club's class type names under group activities), and a card for a named area type always shows that type's name. Translations merge into what the club has, so a request touches only the locales and label fields it names. Nothing else about the club can be changed here.\n",
        "tags": [
          "Clubs"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Club slug, from GET /v1/platform/clubs"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformClubBookingLabelsUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The club with its labels as saved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformClubSummary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `organization:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/clubs/{slug}/profile": {
      "patch": {
        "operationId": "updateClubProfile",
        "summary": "Update a club's profile",
        "description": "Edits what members read about a club and where it is: its name, description, contact details, address, opening hours, amenities and sports, and whether it is open to members (`active`) or run by staff only (`inactive`). Send only what changes. Live at once on the website, the member portal, the app and 1club.me - the same write as Settings > Clubs in the 1club admin portal.\n\nMoving the address moves the map pin and the club's timezone with it, unless `timezone` is sent too. For a club listed on 1club.me, changes to its listing's fields are held for review and the listing keeps its approved values until then (`pendingReview`); a change that would leave the listing missing a required field is refused. Closing a club for good, its slug, its billing entity and its kiosk settings are not changed here. Requires `clubs:write`.\n",
        "tags": [
          "Clubs"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Club slug, from GET /v1/platform/clubs"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformClubProfileUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The club after the change, with anything held for review",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/PlatformClubSummary"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "pendingReview": {
                          "type": "object",
                          "nullable": true,
                          "description": "The 1club.me listing changes waiting for review, or null"
                        },
                        "missingForListing": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Fields a 1club.me listing still needs"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `clubs:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/competitors": {
      "get": {
        "operationId": "listCompetitors",
        "summary": "List competitors",
        "description": "Every competitor the organization follows, by name: its website, its Google rating (read live, cached for a day), when its website was last read and what that reading found changed. `ownClubs` is the organization's own clubs' Google standing to compare against. `available` is false when the plan does not have Competitors (Grow): the list can still be read, edited and pruned, but nothing is added and no website is read. Requires `competitors:read`.\n",
        "tags": [
          "Competitors"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The organization's competitors",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformCompetitorList"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `competitors:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createCompetitor",
        "summary": "Add a competitor",
        "description": "Adds a club to follow. Its website is read in the background within about a minute, then every week; `lastCheckedAt` stays null until the first reading lands. Give its own website, not a social profile (400, code `competitor_website_invalid`), or its Google place id, which brings the website with it. A club already on the list by place or website is a 409 (code `competitor_exists`); a full list of 10 is a 400 (code `competitor_limit`). Requires `competitors:write`. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Competitors"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformCompetitorCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The competitor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformCompetitor"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `competitors:write` scope, or the plan does not have Competitors (code `plan_not_grow`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "This club is already on the list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/competitors/market": {
      "get": {
        "operationId": "getCompetitorMarket",
        "summary": "Compare prices with the market",
        "description": "Every club's prices side by side, competitors and the organization's own, in the organization's currency. Prices are grouped into benchmarks - one thing two or more clubs price, in one unit (a monthly membership, a visit, an hour of a padel court) - and each club is compared at its cheapest regular price, a concession only where it lists nothing else.\n\n`priceIndex` is a club's prices against the market median, where 100 is the median: 88 means 12% below the market. Read it with the club's Google `rating` for its value: a club rated above the market but priced below it gives more than it charges for. A caller holding `competitors:write` also has outdated readings redone in the background (`refreshing` is then true). Requires `competitors:read`.\n",
        "tags": [
          "Competitors"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The market comparison",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformCompetitorMarket"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `competitors:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/competitors/import-ai-report": {
      "post": {
        "operationId": "createCompetitorImportAiReport",
        "summary": "Import competitors from the AI report",
        "description": "Adds the nearby clubs the organization's latest AI visibility report found, skipping those already on the list, up to the list's limit of 10. Their websites are read in the background. Requires `competitors:write`.\n",
        "tags": [
          "Competitors"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "responses": {
          "200": {
            "description": "How many were added",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "imported": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `competitors:write` scope, or the plan does not have Competitors (code `plan_not_grow`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/competitors/{id}": {
      "get": {
        "operationId": "getCompetitor",
        "summary": "Get a competitor",
        "description": "One competitor with its latest readings of its website, newest first: the prices, offers and services each found, the pages it read them from, and what changed since the reading before. Requires `competitors:read`.\n",
        "tags": [
          "Competitors"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Competitor id"
          }
        ],
        "responses": {
          "200": {
            "description": "The competitor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformCompetitorDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `competitors:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateCompetitor",
        "summary": "Update a competitor",
        "description": "Changes what is stored about a competitor; send only what changes. A new website discards the readings of the old one, which describe another site, and is read again. Requires `competitors:write`.\n",
        "tags": [
          "Competitors"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Competitor id"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformCompetitorUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The competitor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformCompetitor"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `competitors:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "Another competitor on the list has this place or website",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteCompetitor",
        "summary": "Remove a competitor",
        "description": "Takes a competitor off the list, with its price history. Requires `competitors:write`.\n",
        "tags": [
          "Competitors"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Competitor id"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "responses": {
          "204": {
            "description": "Removed"
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `competitors:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/competitors/{id}/analysis": {
      "get": {
        "operationId": "listCompetitorAnalysis",
        "summary": "Analyse a competitor's reviews",
        "description": "What the competitor's latest Google reviews praise and complain about, and how the organization compares: where it is ahead, where the competitor is, and what to do next. Written by a model in `language` and cached while the reviews and readings behind it stay the same. 503 (code `ai_unavailable`) when the model is not available. At most 30 new analyses an hour per organization; one already written does not count. Requires `competitors:read`.\n",
        "tags": [
          "Competitors"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Competitor id"
          },
          {
            "in": "query",
            "name": "language",
            "schema": {
              "type": "string",
              "enum": [
                "en",
                "bg",
                "es",
                "fr",
                "de",
                "cs"
              ],
              "default": "en"
            },
            "description": "The language the analysis is written in"
          }
        ],
        "responses": {
          "200": {
            "description": "The analysis",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformCompetitorAnalysis"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `competitors:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/competitors/{id}/refresh": {
      "post": {
        "operationId": "createCompetitorRefresh",
        "summary": "Read a competitor's website again",
        "description": "Asks Google for the competitor's rating again and reads its website now rather than at the next weekly reading. Once every few minutes per competitor: sooner is a 429 (code `competitor_refresh_cooldown`). Requires `competitors:write`.\n",
        "tags": [
          "Competitors"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Competitor id"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "responses": {
          "204": {
            "description": "Read again"
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `competitors:write` scope, or the plan does not have Competitors (code `plan_not_grow`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "description": "Read a few minutes ago, or the rate limit was exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/platform/contacts": {
      "get": {
        "operationId": "listContacts",
        "summary": "List and search contacts",
        "description": "Returns the organization's contacts ordered by name, or with `sort=newest` most recently added first, excluding archived ones. Use `type` to list only members, leads or another contact type. Use `search` to match on name, email, or phone - matching is case-insensitive and cross-script, so `ivan` also matches `Иван`. Resolve a customer here and pass the returned `id` as `contactId` when creating a booking. Use `tags` and `excludeTags` to list who carries a tag or who carries none of several - smart tags included, so `tags=Past Due&tags=Overdue` lists who owes money.\n",
        "tags": [
          "Contacts"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string",
              "maxLength": 120
            },
            "description": "Match on name, email, or phone"
          },
          {
            "in": "query",
            "name": "tags",
            "style": "form",
            "explode": true,
            "schema": {
              "type": "array",
              "maxItems": 50,
              "items": {
                "type": "string"
              }
            },
            "example": [
              "Past Due",
              "Overdue"
            ],
            "description": "Tag names as `GET /tags` lists them, in any case, the parameter repeated once per name. Only contacts carrying at least one of them are returned. A smart tag nobody carries yet matches nobody. An unknown name is a 400 suggesting the closest tag names.\n"
          },
          {
            "in": "query",
            "name": "excludeTags",
            "style": "form",
            "explode": true,
            "schema": {
              "type": "array",
              "maxItems": 50,
              "items": {
                "type": "string"
              }
            },
            "example": [
              "Card",
              "SEPA Debit"
            ],
            "description": "Tag names, in any case, the parameter repeated once per name. Only contacts carrying none of them are returned. A smart tag nobody carries yet excludes nobody. An unknown name is a 400 suggesting the closest tag names.\n"
          },
          {
            "in": "query",
            "name": "type",
            "style": "form",
            "explode": true,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "member",
                  "drop_in",
                  "lapsed",
                  "lead",
                  "contact"
                ]
              }
            },
            "example": [
              "member"
            ],
            "description": "Only contacts of these types, the parameter repeated once per type"
          },
          {
            "in": "query",
            "name": "sort",
            "schema": {
              "type": "string",
              "enum": [
                "name",
                "newest"
              ],
              "default": "name"
            },
            "description": "`name` A to Z, or `newest`: the most recently added first, by `createdAt`\n"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            },
            "description": "Maximum number of contacts to return"
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "Number of contacts to skip"
          }
        ],
        "responses": {
          "200": {
            "description": "Page of contacts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformContactPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createContact",
        "summary": "Create a contact",
        "description": "Creates a contact in the organization. At least one of `email` or `phone` is required so the person stays reachable and findable. Creating a contact whose email already exists returns 409 (`code` CONFLICT), and so does one whose phone number already belongs to a contact with the same name (`code` CONTACT_EXISTS; a shared number under a different name - a household - is accepted). Both name the existing contact in `details.contactId`. Search first, then reference the existing id. A `phone` is stored in international form (`+359877762016`) when it is a valid number for the organization's country, and as given otherwise. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Contacts"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformContactCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Contact created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformContact"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "$ref": "#/components/responses/PlatformConflict"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/contacts/{id}": {
      "get": {
        "operationId": "getContact",
        "summary": "Get a contact",
        "description": "Returns a single contact by its 1club id. With `include=overview` it also returns the contact's overview as `overview` - what staff see on the contact's profile before serving them: the alerts (an Amount Due, a Wallet below its Required Deposit, gear overdue, a required document unsigned, a required profile field missing, access suspended, archived), the money (Amount Due, Wallet balance, deposit, billed and paid to date), activity counts and the last visit, and the contact details the record lacks.\n\nMoney needs `transactions:read` and gear needs `products:read` on top of `contacts:read`. Without them the rest is still returned, and `withheld` names what was left out and the scope it needs, so a missing alert is never mistaken for nothing to report.\n",
        "tags": [
          "Contacts"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club contact id"
          },
          {
            "in": "query",
            "name": "include",
            "schema": {
              "type": "string",
              "enum": [
                "overview"
              ]
            },
            "description": "Embed the contact's overview as `overview`."
          }
        ],
        "responses": {
          "200": {
            "description": "The contact",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformContactWithOverview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateContact",
        "summary": "Update a contact",
        "description": "Edits a contact's name and contact details. Send only what changes - `null` clears `lastName`, `email` or `phone`, and an omitted field is left alone. The display name is always recomputed from `firstName` and `lastName`, the phone is canonicalized, and a contact must keep at least one of `email` or `phone`, so an edit cannot leave the person unreachable. Clearing `lastName` stores an empty string rather than null, so it reads back as `\"\"`.\n\nRefused edits: an `email` already used by another contact in the organization (409); any change to the `email` of a contact whose address is also their 1club login (400) - that address is changed by the person themselves; and clearing a field the organization has marked required for staff (400, naming the `field`). An archived contact cannot be edited. `pipelineStageId` moves the contact in the sales pipeline (from `GET /v1/platform/pipeline-stages`); `null` takes them out of it. A contact who has never been a customer is a Lead while they are in the pipeline, so this can change `type`. Moving them to the Lost stage takes an optional `pipelineLostReason` (and `pipelineLostNote`, required for `other`); a reason sent with any other stage is refused (400). On a contact already in Lost, the reason replaces the recorded one. `sourceId` and `assignedToId` set where they came from and which staff member follows them up.\n",
        "tags": [
          "Contacts"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club contact id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformContactUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated contact",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformContact"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "$ref": "#/components/responses/PlatformConflict"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteContact",
        "summary": "Archive a contact",
        "description": "Retires a contact. Nothing is destroyed: the contact is archived, which drops them out of the contacts list and out of every search, while their transaction history stays intact - so the response is the contact itself, now with `type` `archived`, rather than an empty body. Archiving also releases everything they hold on the forward schedule - active memberships, bookings they organized, and bookings they are only a player on - and none of that is restored by un-archiving, which is done in 1club.\n\nTo preview the impact, `GET /v1/platform/memberships?contactId={id}` lists the memberships that will be cancelled, and `GET /v1/platform/bookings?contactId={id}` the bookings that will be. Neither is an exhaustive preview, so treat them as indicative: the bookings list matches only bookings the contact **organized** - never the ones they are an additional player on, which are released too - and it defaults to a **7-day** window, so pass `from` and `to` (up to 93 days per request, consecutive windows beyond that) to see further out.\n\nA release can fail on an individual membership or booking without blocking the archive - the contact is retired either way, so a stuck booking cannot leave it active. That answers **409 `ARCHIVE_INCOMPLETE`** (not a 200) with the unreleased items in `details.outstanding`, precisely so the result is never cached against an `Idempotency-Key`: **repeat the same request to reconcile.** On an already archived contact the release runs again instead of short-circuiting, which is what makes the retry finish the job. A repeat call after a 200 is a no-op.\n\nNeeds its own `contacts:delete` scope for that reason; `contacts:write` alone cannot retire a member. Two contacts are refused rather than archived, because each needs a decision the call cannot make: a **staff member or owner** who can reach the admin portal (archiving would revoke that login - remove their access in 1club first); an **instructor** whose profile still has upcoming classes or recurring templates (reassign those first); and a contact **paying part of a split bill** on a future booking (settle that split first, since taking someone off a bill moves money and archiving moves none). An ordinary member with a portal login is *not* refused - that is most of the people worth archiving.\n",
        "tags": [
          "Contacts"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club contact id"
          },
          {
            "in": "query",
            "name": "keepCancellationCharge",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "Archiving cancels the contact's future bookings. For a paid one the cancellation policy would keep money from, say what happens to it: `false` refunds it in full, `true` applies the policy. Without it such an archive is refused (409 `CANCELLATION_CHARGE_DECISION_REQUIRED`) and nothing changes. Unpaid bookings owe nothing either way unless it is `true`.\n"
          }
        ],
        "responses": {
          "200": {
            "description": "The contact is archived and everything it held was released",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformContact"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:delete` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "Either the archive was refused outright (`CONFLICT` - the contact can reach the admin portal, their instructor profile still has upcoming assignments, or they are paying part of a split bill; resolve it in 1club, then retry; or `CANCELLATION_CHARGE_DECISION_REQUIRED` - a paid future booking needs `keepCancellationCharge`), or the contact WAS archived and the release did not finish (`ARCHIVE_INCOMPLETE`; repeat the request to reconcile). Read `code` to tell them apart - one means nothing happened, the other means the archive did.\n",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/PlatformError"
                    },
                    {
                      "$ref": "#/components/schemas/PlatformArchiveIncomplete"
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/content": {
      "get": {
        "operationId": "listContent",
        "summary": "List content",
        "description": "Returns content for the organization. By default this is the public view: published items with `Public` visibility, the same thing a website visitor could see.\nTo manage content you need the rest of it - pass `status=all` for drafts and `visibility=all` for member-only and private items, and for items with an `audience`, which the public view leaves out. Both require the `content:write` scope, since they expose material the organization has not published.\nTranslations are separate items sharing one slug, each with its own `language` (see `POST /v1/platform/content`). `locale` *resolves* them - it returns one item per slug, the best match for that locale. To see every variant instead, omit `locale` and read each item's `language`; to list one language only, pass `language` (`language=none` for the untagged base items).\n",
        "tags": [
          "Content"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string",
              "enum": [
                "post",
                "faq",
                "document",
                "block",
                "how-to-guide"
              ]
            },
            "description": "Filter by content type"
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "published",
                "draft",
                "all"
              ]
            },
            "description": "Defaults to `published`. `draft` and `all` require `content:write`."
          },
          {
            "in": "query",
            "name": "visibility",
            "schema": {
              "type": "string",
              "enum": [
                "Public",
                "Member_only",
                "Private",
                "all"
              ]
            },
            "description": "Defaults to public-only. Anything else requires `content:write`."
          },
          {
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string"
            },
            "description": "Resolve translations for this locale - one item per slug, preferring the variant in this language, then the untagged one, then English.\n"
          },
          {
            "in": "query",
            "name": "language",
            "schema": {
              "type": "string"
            },
            "description": "Return only variants tagged with this language, or `none` for the untagged base items. A filter, not a resolution - use it to find what has not been translated yet. Cannot be combined with `locale`, which asks the opposite question.\n"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            },
            "description": "Max results (1-100, default 100)"
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of content",
            "headers": {
              "X-Total-Count": {
                "description": "How many items match the filters, before `limit`/`offset` are applied.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PlatformContent"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid filter or pagination parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing `content:read`, or `content:write` for unpublished/non-public filters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createContent",
        "summary": "Create content",
        "description": "Creates a post, FAQ, document, block or how-to guide.\nSend the body as either `contentBlocks` (Editor.js blocks, what the admin editor writes) or `contentHtml` - not both. A `block` created here is what a website `block` section renders: reference it by the slug this returns.\nThe slug is derived from the title when omitted, and de-duplicated with a numeric suffix rather than rejected - read the returned `slug` rather than assuming the one you sent. Non-Latin titles transliterate (\"Работно време\" becomes `rabotno-vreme`), so a title in any language yields a usable URL.\nTo translate an item, create a second one with the **same slug** and a `language`. The two are one piece of content in two languages, and the public site serves whichever matches the visitor's locale.\n",
        "tags": [
          "Content"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "title"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "post",
                      "faq",
                      "document",
                      "block",
                      "how-to-guide"
                    ]
                  },
                  "title": {
                    "type": "string"
                  },
                  "slug": {
                    "type": "string",
                    "description": "Derived from the title when omitted"
                  },
                  "contentBlocks": {
                    "type": "array",
                    "description": "Editor.js blocks, e.g. [{ type: 'paragraph', data: { text: 'Hello' } }]",
                    "items": {
                      "type": "object"
                    }
                  },
                  "contentHtml": {
                    "type": "string",
                    "description": "HTML body, as an alternative to contentBlocks"
                  },
                  "excerpt": {
                    "type": "string",
                    "nullable": true
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "images": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "URLs from the media library - never invented URLs"
                  },
                  "imageNameQueries": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Media library search terms, resolved to URLs and merged into images"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "published",
                      "draft"
                    ]
                  },
                  "visibility": {
                    "type": "string",
                    "enum": [
                      "Public",
                      "Member_only",
                      "Private"
                    ]
                  },
                  "audience": {
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/PlatformContactAudience"
                      }
                    ],
                    "nullable": true,
                    "description": "Who may read it on the portal and website. Anyone outside it, signed-out visitors included, never sees it. Shared by every translation of the slug. Null or empty is everyone its visibility allows."
                  },
                  "metaTitle": {
                    "type": "string",
                    "nullable": true,
                    "description": "SEO title. Falls back to the item's title."
                  },
                  "metaDescription": {
                    "type": "string",
                    "nullable": true,
                    "description": "SEO description. Falls back to `excerpt`."
                  },
                  "canonicalUrl": {
                    "type": "string",
                    "format": "uri",
                    "nullable": true,
                    "description": "Absolute URL this item canonicalizes to, for content that also lives elsewhere and should be indexed there instead. Leave unset for original content - the page then canonicalizes to itself.\n"
                  },
                  "language": {
                    "type": "string",
                    "nullable": true,
                    "description": "Locale code (`bg`, `de`, ...) marking this item as the variant of its slug for that language. Translations are separate items sharing one slug: send the **same slug** as the item you are translating, or the two are unrelated rows. Uniqueness is per (slug, language), so the same slug with a new language is accepted rather than de-duplicated. Leave unset for the base item, which every locale falls back to.\n"
                  },
                  "featured": {
                    "type": "boolean"
                  },
                  "faqs": {
                    "type": "array",
                    "maxItems": 20,
                    "description": "Posts only - the post's questions and answers, shown after its text in an accordion and described to search engines as FAQPage data. Plain text; blank lines separate an answer's paragraphs. A 400 for other types.\n",
                    "items": {
                      "$ref": "#/components/schemas/PostFaq"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created content item",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformContent"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, or both contentBlocks and contentHtml were sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `content:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/content/{slug}": {
      "get": {
        "operationId": "getContent",
        "summary": "Get published content by slug",
        "description": "Returns a single published, publicly-visible content item by slug - the public view. Use the list endpoint with `status=all` to reach drafts.\n",
        "tags": [
          "Content"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Content slug"
          },
          {
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string"
            },
            "description": "Locale for content resolution"
          }
        ],
        "responses": {
          "200": {
            "description": "Content item",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformContent"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `content:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "Content not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/content/{contentId}": {
      "patch": {
        "operationId": "updateContent",
        "summary": "Update content",
        "description": "Updates a content item by id - the numeric `id` from the list endpoint, not the slug. Only the fields you send change.\n`tags` and `images` replace their arrays wholesale. Switching `status` to `draft` takes the item off the public site without deleting it.\n",
        "tags": [
          "Content"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "contentId",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "slug": {
                    "type": "string"
                  },
                  "contentBlocks": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  },
                  "contentHtml": {
                    "type": "string"
                  },
                  "excerpt": {
                    "type": "string",
                    "nullable": true
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "images": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "imageNameQueries": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "published",
                      "draft"
                    ]
                  },
                  "visibility": {
                    "type": "string",
                    "enum": [
                      "Public",
                      "Member_only",
                      "Private"
                    ]
                  },
                  "audience": {
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/PlatformContactAudience"
                      }
                    ],
                    "nullable": true,
                    "description": "Who may read it on the portal and website. Anyone outside it, signed-out visitors included, never sees it. Shared by every translation of the slug. Null or empty is everyone its visibility allows."
                  },
                  "metaTitle": {
                    "type": "string",
                    "nullable": true,
                    "description": "SEO title. Falls back to the item's title."
                  },
                  "metaDescription": {
                    "type": "string",
                    "nullable": true,
                    "description": "SEO description. Falls back to `excerpt`."
                  },
                  "canonicalUrl": {
                    "type": "string",
                    "format": "uri",
                    "nullable": true,
                    "description": "Absolute URL this item canonicalizes to, for content that also lives elsewhere and should be indexed there instead. Leave unset for original content - the page then canonicalizes to itself.\n"
                  },
                  "language": {
                    "type": "string",
                    "nullable": true,
                    "description": "Re-tag which language this variant is, or `null` to make it the base item every locale falls back to. A 409 when the slug already has a variant in that language.\n"
                  },
                  "featured": {
                    "type": "boolean"
                  },
                  "faqs": {
                    "type": "array",
                    "maxItems": 20,
                    "description": "Posts only - replaces the post's questions and answers; an empty list removes them. A 400 for other types.\n",
                    "items": {
                      "$ref": "#/components/schemas/PostFaq"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated content item",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformContent"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or content id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `content:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "Content not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "Another item already occupies that (slug, language) pair. Unlike create, an update never renames around a clash.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteContent",
        "summary": "Delete content",
        "description": "Permanently deletes a content item. A website `block` section still referencing its slug will render nothing, and a `document` with signatures against it should be taken out of use with `status: draft` instead - deleting it takes the signed text with it.\n",
        "tags": [
          "Content"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "contentId",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid content id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `content:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "Content not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/custom-fields": {
      "get": {
        "operationId": "listCustomFields",
        "summary": "List contact custom fields",
        "description": "The extra fields the organization keeps on its contacts, in display order, inactive ones included. `name` is how a value is addressed; `visibility` decides whether members see the field in the portal, and `requireOnSignup` whether the sign-up form asks for it. Requires `contacts:read`.\n",
        "tags": [
          "Custom Fields"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The organization's custom fields",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformCustomField"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createCustomField",
        "summary": "Create a contact custom field",
        "description": "Adds a field to every contact (or to the `contactTypes` named). A field members can see that is `required` must also be `requireOnSignup`, and `requireOnSignup` needs a member-visible `visibility`: otherwise a new member could never fill it in. A `select` field needs `options`. Requires `contacts:write`. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Custom Fields"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformCustomFieldWrite"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Custom field created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformCustomField"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/custom-fields/{id}": {
      "get": {
        "operationId": "getCustomField",
        "summary": "Get a contact custom field",
        "description": "One custom field. Requires `contacts:read`.",
        "tags": [
          "Custom Fields"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The custom field",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformCustomField"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateCustomField",
        "summary": "Update a contact custom field",
        "description": "Changes a custom field. Send only what changes. The required and sign-up rules are checked on the field as it would be after the change. Requires `contacts:write`.\n",
        "tags": [
          "Custom Fields"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformCustomFieldWrite"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The custom field as saved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformCustomField"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteCustomField",
        "summary": "Delete a contact custom field",
        "description": "Deletes the field and every contact's value for it. To stop using a field but keep what was recorded, set `isActive: false` instead. Requires `contacts:delete`.\n",
        "tags": [
          "Custom Fields"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Custom field deleted"
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:delete` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/contacts/{contactId}/custom-fields": {
      "get": {
        "operationId": "listContactCustomFields",
        "summary": "Get a contact's custom field values",
        "description": "The values recorded on one contact, one per field that has one. Requires `contacts:read`.",
        "tags": [
          "Custom Fields"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "contactId",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The contact's values",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformContactCustomFieldValues"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateContactCustomFields",
        "summary": "Set a contact's custom field values",
        "description": "Sets the values named and leaves the contact's other values alone. Name each field by `fieldId` or by its `name`; `null` or an empty string clears a value. Each value is checked against its field's rules (length, pattern, a `select` field's options). Answers with every value the contact now has. Requires `contacts:write`.\n",
        "tags": [
          "Custom Fields"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "contactId",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "values"
                ],
                "properties": {
                  "values": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 50,
                    "items": {
                      "type": "object",
                      "required": [
                        "value"
                      ],
                      "properties": {
                        "fieldId": {
                          "type": "integer"
                        },
                        "name": {
                          "type": "string"
                        },
                        "value": {
                          "type": "string",
                          "nullable": true
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The contact's values after the change",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformContactCustomFieldValues"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/document-rules": {
      "get": {
        "operationId": "listDocumentRules",
        "summary": "List document rules",
        "description": "The organization's document rules, newest first. A rule makes one or more published documents (waivers, terms, consents - CMS content of type `document`, see `/v1/platform/content`) something a matching member is asked to read and accept.\n\n`filters` decides who is asked. Each axis - contact type, membership plan, tag, household role - means **everyone** when empty, and a member must match every axis the rule sets. A rule is either mandatory (`mandatoryToAccept`: the member cannot finish setting up their account until they accept; it may also demand a typed name, and be `requiredForEntry`, which keeps an unsigned member from checking themselves in) or optional (the member may decline; it may record consent for a marketing `consentChannel`).\n\nFilter by `documentId` to find every rule that asks for one document.\n",
        "tags": [
          "Document Rules"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "isActive",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            },
            "description": "Only active (`true`) or only switched-off (`false`) rules"
          },
          {
            "in": "query",
            "name": "documentId",
            "schema": {
              "type": "integer"
            },
            "description": "Only the rules that require this document (a content id of type `document`)"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of document rules",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformDocumentRulePage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `document-rules:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createDocumentRule",
        "summary": "Create a document rule",
        "description": "Makes one or more documents something the matching members are asked to accept. Every document must be one of the organization's content items of type `document`; only a published one is ever asked of anybody. Every `filters.planIds` entry and every numeric `filters.tags` entry must be one of the organization's plans and tags.\n\n`mandatoryToAccept` defaults to true. `requiresTypedNameAcceptance` and `requiredForEntry` exist only on a mandatory rule, and `consentChannel` only on an optional one: asking for either on the wrong kind of rule is a 400 with code `DOCUMENT_RULE_FLAGS_CONFLICT`, rather than a rule saved without what you asked for.\n\nA rule that is active, mandatory and required for entry starts refusing self check-in (tablet, member QR, portal, door access) to every matching member who has not signed, as soon as it is saved. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Document Rules"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformDocumentRuleCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Document rule created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformDocumentRule"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `document-rules:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/document-rules/{id}": {
      "get": {
        "operationId": "getDocumentRule",
        "summary": "Get a document rule",
        "description": "One document rule, with the documents it requires and the audience its filters select.",
        "tags": [
          "Document Rules"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Document rule id"
          }
        ],
        "responses": {
          "200": {
            "description": "The document rule",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformDocumentRule"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `document-rules:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateDocumentRule",
        "summary": "Update a document rule",
        "description": "Edits a document rule. Send only what changes; an omitted field is left alone, and an empty body is a 400.\n\n`documentIds` and `filters` each **replace** the stored value wholesale when sent: `filters` is one object, and an axis you leave out of it is cleared (it then means everyone). Read the rule first and send the whole filter set you want. A plan or tag id already on the rule is kept even if it no longer exists; one you add must be the organization's.\n\nSwitching a rule to optional (`mandatoryToAccept: false`) also switches off its typed-name and entry requirements; switching it to mandatory clears its `consentChannel`. Explicitly asking for a combination that cannot exist is a 400 with code `DOCUMENT_RULE_FLAGS_CONFLICT`. Changing a rule never un-signs anybody: signatures already made stay on file.\n",
        "tags": [
          "Document Rules"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Document rule id"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformDocumentRuleUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated document rule",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformDocumentRule"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `document-rules:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteDocumentRule",
        "summary": "Delete a document rule",
        "description": "Deletes a document rule. Members are no longer asked for its documents under it (another rule may still ask for the same document), and an entry rule stops refusing self check-in. Signatures and declines already made stay on file, and the documents themselves are not touched. To pause a rule instead, PATCH `isActive: false`.\n",
        "tags": [
          "Document Rules"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Document rule id"
          }
        ],
        "responses": {
          "204": {
            "description": "Document rule deleted"
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `document-rules:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/events": {
      "get": {
        "operationId": "listEvents",
        "summary": "List events",
        "description": "Returns the organization's events - one-off occasions such as an open day, a social or a tournament weekend, sold through tickets - in start order, earliest first.\n\n`status` is `draft` (not visible to members), `live` (published) or `cancelled`. `from` and `to` select the events that overlap the window, so an event already running at `from` is included. Each accepts an ISO date (`2026-05-01`, read as midnight UTC) or date-time.\n\nEach event carries `bookedCount`, its active bookings across all tickets. Who booked is not served here: attendees are personal data, read with GET /v1/platform/events/{id}/bookings on the `bookings:read` scope.\n",
        "tags": [
          "Events"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "live",
                "cancelled"
              ]
            },
            "description": "Only events in this state"
          },
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only events at this club (organization-wide events, which name no club, are left out)"
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string",
              "maxLength": 120
            },
            "description": "Match on title or location"
          },
          {
            "in": "query",
            "name": "from",
            "schema": {
              "type": "string"
            },
            "description": "Only events still running at or after this date or date-time"
          },
          {
            "in": "query",
            "name": "to",
            "schema": {
              "type": "string"
            },
            "description": "Only events starting at or before this date or date-time"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of events",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformEventPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `events:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createEvent",
        "summary": "Create an event",
        "description": "Creates an event as a **draft**: members see nothing until it is published with POST /v1/platform/events/{id}/publish.\n\n`startTime` and `endTime` with an offset (`2026-06-01T18:00:00+02:00`, or `Z`) are exact instants. Without one (`2026-06-01T18:00:00`) they are the wall clock at the event's club, in the club's own timezone - or the organization's for an event that names no club. The club, every instructor, every area and every ticket's revenue account must belong to the organization, and a new event's club must still be taking events (not closed, and not past its closing date).\n\nTo sell places, add `tickets`: an event with at least one ticket is bookable, and a `bookable` event must have one. `description` is plain text (blank lines start a new paragraph) or an Editor.js document. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Events"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformEventCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Event created as a draft",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformEvent"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `events:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "$ref": "#/components/responses/PlatformConflict"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/events/{id}": {
      "get": {
        "operationId": "getEvent",
        "summary": "Get an event",
        "description": "Returns one event with its tickets, coaches and areas. Each ticket carries `soldCount`, its active bookings, so what is left to sell is `capacity - soldCount` for a ticket with a capacity. Counts only: the attendee list is GET /v1/platform/events/{id}/bookings.\n",
        "tags": [
          "Events"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club event id"
          }
        ],
        "responses": {
          "200": {
            "description": "The event",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformEvent"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `events:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateEvent",
        "summary": "Update an event",
        "description": "Edits an event in any state. Send only what changes; an empty body is refused. Wall-clock times are read in the timezone of the club the event will belong to after the edit. A live event's change of time or areas takes effect on the schedule at once.\n\n`tickets`, `instructorIds` and `areaIds` each **replace** the whole set when sent, so read the event first. Resend every ticket you keep with its `id`; a ticket without one is new, and an `id` the event does not have is refused (`EVENT_TICKET_NOT_ON_EVENT`). A ticket left out is retired: deactivated when it has bookings, so they keep it, deleted when it has none. Changing the title changes the slug, and with it `publicUrl`.\n",
        "tags": [
          "Events"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club event id"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformEventUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated event",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformEvent"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `events:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "$ref": "#/components/responses/PlatformConflict"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteEvent",
        "summary": "Delete an event",
        "description": "Deletes an event for good. Only an event nobody has ever booked: any booking, a cancelled one included, is financial history, so such an event is a 409 (`EVENT_TRANSITION_REFUSED`) and must be cancelled instead. Deleting a live event frees the areas it was holding.\n",
        "tags": [
          "Events"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club event id"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "responses": {
          "204": {
            "description": "Event deleted"
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `events:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "The event has bookings; cancel it instead (code `EVENT_TRANSITION_REFUSED`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/events/{id}/publish": {
      "post": {
        "operationId": "publishEvent",
        "summary": "Publish an event",
        "description": "Makes a draft live: it appears on the organization's website and member portal (as its `visibility` allows) and its tickets go on sale. This is visible to members immediately. Publishing a live event changes nothing; a cancelled event cannot be published again (409) - duplicate it instead.\n",
        "tags": [
          "Events"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club event id"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "responses": {
          "200": {
            "description": "The event, now live",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformEvent"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `events:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "The event is cancelled (code `EVENT_TRANSITION_REFUSED`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/events/{id}/unpublish": {
      "post": {
        "operationId": "unpublishEvent",
        "summary": "Unpublish an event",
        "description": "Takes a live event back to draft, hiding it from members. Only a live event, and only while nobody holds an active booking for it: an event people have booked must be cancelled instead, which tells them. Both refusals are a 409 with code `EVENT_TRANSITION_REFUSED`.\n",
        "tags": [
          "Events"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club event id"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "responses": {
          "200": {
            "description": "The event, back to draft",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformEvent"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `events:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "The event is not live, or has active bookings (code `EVENT_TRANSITION_REFUSED`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/events/{id}/cancel": {
      "post": {
        "operationId": "cancelEvent",
        "summary": "Cancel an event",
        "description": "Calls the event off. **Every active booking for it is cancelled**, and a tournament played at it is cancelled with it. Nobody is refunded automatically: refunds stay a staff decision in the admin portal. A cancelled event cannot be published again. Cancelling an event that is already cancelled changes nothing.\n",
        "tags": [
          "Events"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club event id"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "responses": {
          "200": {
            "description": "The cancelled event",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformEvent"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `events:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/events/{id}/duplicate": {
      "post": {
        "operationId": "duplicateEvent",
        "summary": "Duplicate an event",
        "description": "Copies an event into a new **draft** titled \"{title} (copy)\", with the same schedule, description, tickets, coaches, areas and settings, and a new slug. Nothing of the original's runtime state is copied: no bookings, not published. Edit the copy's dates with PATCH, then publish it. Works on a cancelled event too, which is how one is run again.\n",
        "tags": [
          "Events"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club id of the event to copy"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "responses": {
          "201": {
            "description": "The new draft",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformEvent"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `events:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/events/{id}/bookings": {
      "get": {
        "operationId": "listEventBookings",
        "summary": "List an event's attendees",
        "description": "Returns who holds a seat at one event, on which ticket, whether they were checked in, and what they paid - the attendee list, from the event side. Every seat is its own booking row against the event. A guest ticket bought on someone else's order has no contact; `bookerName` is who bought it.\n\nDo not expect `total` to equal the event's `bookedCount`: that counts `confirmed`, `pending` and `checked_in`, while this list also keeps `no_show`. Cancelled seats are left out unless `status=cancelled` asks for them.\n\nRequires `bookings:read`, as a class's roster does. `contactEmail` additionally needs `contacts:read` and is null without it.\n",
        "tags": [
          "Events"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club event id"
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string"
            },
            "description": "Only seats with this booking status (e.g. confirmed, checked_in, no_show, cancelled). Defaults to every status but cancelled."
          },
          {
            "in": "query",
            "name": "ticketId",
            "schema": {
              "type": "integer"
            },
            "description": "Only seats sold on this ticket"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            },
            "description": "Maximum number of attendees to return"
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "Number of attendees to skip"
          }
        ],
        "responses": {
          "200": {
            "description": "Page of attendees",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformEventBookingPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `bookings:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createEventBooking",
        "summary": "Register a customer for an event",
        "description": "Registers one customer at a live, bookable event, with any guests they bring - the registration the club's own staff make. Every place is a seat on one of the event's tickets, at the event's time and club and the ticket's price; the event's capacity and each ticket's apply. Identify the customer with `contactId` (resolve it via GET /v1/platform/contacts) or with an inline `customer` matched to a contact by email and created if new - exactly one of the two. A customer may register more than once, so registering them again books more places.\n\nPlaces are `ticketId` with a `quantity` (`3` is the customer and two guests), or `tickets` across several ticket types; the customer's own seat is the first place of the first ticket, and the guests' seats carry no contact. A ticket is required for every place when the event sells tickets, which every bookable event does; read the ticket ids and what is left on each (`capacity - soldCount`) from GET /v1/platform/events/{id}.\n\nPayment works as on POST /v1/platform/bookings: `paid` records the places as settled against a payment method named after your API key (no gateway call), with your `reference` on each seat's payment and your `fee` shared over them; `unpaid` leaves them outstanding. `amount` is what the whole registration cost, shared over the seats in proportion to their ticket price. No membership ever covers an event, so an `unpaid` registration with no `amount` owes the ticket prices.\n\nA draft or cancelled event (`EVENT_NOT_LIVE`), one that takes no bookings (`EVENT_NOT_BOOKABLE`), one that has ended (`BOOKING_ALREADY_ENDED`) and a ticket or event without room for every place are refused; nothing here overrides them. Returns the customer's own seat, as POST /v1/platform/bookings returns a booking, with `eventId`, `eventTicketId` and `seatBookingIds` (every seat of the registration) set. Cancelling any seat with POST /v1/platform/bookings/{id}/cancel cancels the whole registration.\n",
        "tags": [
          "Events"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club event id"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "payment"
                ],
                "properties": {
                  "ticketId": {
                    "type": "integer",
                    "description": "The ticket the places are sold on, from the event's `tickets`. Required when the event sells tickets, unless `tickets` is sent."
                  },
                  "quantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 50,
                    "default": 1,
                    "description": "How many places on `ticketId`, the customer's own included."
                  },
                  "tickets": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 20,
                    "description": "Places across several ticket types, instead of `ticketId` and `quantity`. Each ticket once; at most 50 places in all. The customer's own seat is the first place of the first entry.\n",
                    "items": {
                      "type": "object",
                      "required": [
                        "ticketId",
                        "quantity"
                      ],
                      "properties": {
                        "ticketId": {
                          "type": "integer"
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 50
                        }
                      }
                    }
                  },
                  "contactId": {
                    "type": "integer",
                    "description": "Existing contact to book for (from GET /v1/platform/contacts). Mutually exclusive with `customer`."
                  },
                  "customer": {
                    "type": "object",
                    "description": "Inline find-or-create by email. Mutually exclusive with `contactId`.",
                    "required": [
                      "email"
                    ],
                    "properties": {
                      "email": {
                        "type": "string",
                        "format": "email"
                      },
                      "firstName": {
                        "type": "string"
                      },
                      "lastName": {
                        "type": "string"
                      },
                      "phone": {
                        "type": "string"
                      }
                    }
                  },
                  "payment": {
                    "type": "object",
                    "required": [
                      "status"
                    ],
                    "properties": {
                      "status": {
                        "type": "string",
                        "enum": [
                          "paid",
                          "unpaid"
                        ]
                      },
                      "amount": {
                        "type": "number",
                        "maximum": 1000000,
                        "description": "What the whole registration cost, in the club's currency, before any fee you kept; shared over the seats in proportion to their ticket price. Defaults to the ticket prices. Stated the way the club states its prices: where the club's tax rate is exclusive, tax is added on top.\n"
                      },
                      "reference": {
                        "type": "string",
                        "maxLength": 128,
                        "description": "Your own id for the payment you collected. Requires `status` paid."
                      },
                      "fee": {
                        "type": "number",
                        "maximum": 1000000,
                        "description": "What you kept out of `amount` - your commission. Requires `status` paid and an explicit `amount` it cannot exceed.\n"
                      }
                    }
                  },
                  "notes": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "notifyCustomer": {
                    "type": "boolean",
                    "description": "Tell the customer they are booked - email plus the in-app, WhatsApp and SMS notification. Off by default for an API key, on by default over an OAuth connection, as on POST /v1/platform/bookings.\n"
                  },
                  "alertStaff": {
                    "type": "boolean",
                    "description": "Alert the club's staff to this booking (their User Bookings notification). On by default; pass `false` for the club's own writes, such as importing bookings or syncing them from another system, so staff are not alerted once per booking.\n"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Booking created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformBooking"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request; the event is not live (`EVENT_NOT_LIVE`), takes no bookings (`EVENT_NOT_BOOKABLE`) or has ended (`BOOKING_ALREADY_ENDED`); the ticket is missing (`EVENT_TICKET_REQUIRED`) or not one of the event's (`EVENT_TICKET_NOT_ON_EVENT`); or the contact cannot be booked.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `bookings:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "A ticket does not have room for its places (`EVENT_TICKET_SOLD_OUT`), or the event does not (`EVENT_FULL`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/external-programs": {
      "get": {
        "operationId": "listExternalPrograms",
        "summary": "List external programs",
        "description": "The organization's external programs, by name: the third parties - MultiSport, a municipal scheme, a corporate wellness card - that pay for members' visits. A booking or check-in made on one records it as the entrance method, and the club bills the program for those visits.\n",
        "tags": [
          "External Programs"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only programs tied to this club. Programs honoured at every club are left out."
          },
          {
            "in": "query",
            "name": "isActive",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "External programs",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformExternalProgram"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `external-programs:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createExternalProgram",
        "summary": "Create an external program",
        "description": "Adds a program members can use to pay for visits. It starts active, and is offered on a booking only for what `validFor.scopes` names; a program with no scopes is for check-ins only. Every type id in `validFor` must be one of the organization's, and `clubId` one of its clubs. `validWindows` says when it can be used (weekends only, off-peak hours); with none it can be used any time.\n\nA `code` another program already has is refused with `409 CONFLICT`. A `knownProgram` the organization already has is refused with `409 KNOWN_PROGRAM_TAKEN`, and one not offered in the club's country with `400 KNOWN_PROGRAM_UNAVAILABLE`. A `cardFormat` the program cannot read is `400 CARD_FORMAT_NOT_ALLOWED`. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "External Programs"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformExternalProgramCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "External program created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformExternalProgram"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `external-programs:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "The code or the known program is already taken in this organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/external-programs/{id}": {
      "get": {
        "operationId": "getExternalProgram",
        "summary": "Get an external program",
        "tags": [
          "External Programs"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "External program id"
          }
        ],
        "responses": {
          "200": {
            "description": "The external program",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformExternalProgram"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `external-programs:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateExternalProgram",
        "summary": "Update an external program",
        "description": "Edits an external program. Send only what changes; an omitted field is left alone, and an empty body is a 400. `validFor` and `validWindows` each **replace** the stored value when sent, so read the program first and send the whole value you want.\n\nA new price applies to visits recorded from then on; visits already recorded keep what they were charged. Once members hold cards on the program its `knownProgram` can no longer change (`409 PROGRAM_HAS_CARDS`). The other refusals are as on create.\n",
        "tags": [
          "External Programs"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "External program id"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformExternalProgramUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated external program",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformExternalProgram"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `external-programs:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "The code or the known program is already taken, or members hold cards on it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteExternalProgram",
        "summary": "Delete an external program",
        "description": "Deletes a program nobody has used. A program with visits, bookings or members' cards on it keeps them - the visits are what the club bills the program from - so it is deactivated instead, exactly as `PATCH isActive: false` would; `deleted` says which happened.\n",
        "tags": [
          "External Programs"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "External program id"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted, or deactivated because it has been used",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id",
                    "deleted"
                  ],
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "deleted": {
                      "type": "boolean",
                      "description": "false: it had been used, so it was deactivated instead."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `external-programs:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/forms": {
      "get": {
        "operationId": "listForms",
        "summary": "List forms",
        "description": "The organization's forms, newest first. A form with `createsAccount: true` is a sign-up form: it registers whoever completes it and can sell plans and products. One with `createsAccount: false` is a fill-in form that only collects answers. `publicUrl` is where each one is filled in, and every form is live there. Questions are not included; read a single form for them.\n",
        "tags": [
          "Forms"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string",
              "maxLength": 120
            },
            "description": "Match on name or slug, case-insensitive"
          },
          {
            "in": "query",
            "name": "createsAccount",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            },
            "description": "Only sign-up forms (`true`) or only fill-in forms (`false`)"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of forms",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformFormPage"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `forms:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createForm",
        "summary": "Create a form",
        "description": "Creates a form. It is **live immediately** at the returned `publicUrl`: there is no draft, so confirm the content with the club before creating one. `publicUrl` is null when the organization has neither a member portal nor a live website: the form is created, but nothing can open it until one is switched on.\n\n`createsAccount` is required and permanent. `true` makes a sign-up form, which registers whoever completes it and sells what it offers: completing one with a plan creates a real membership, or asks for payment when the plan is paid up front. Only active, publicly visible, non-season plans and active, publicly visible products can be offered; anything else is a 400 naming each refused id and why. `false` makes a fill-in form, which offers nothing, collects answers to its questions (set them with PUT /v1/platform/forms/{id}/questions), and creates a lead for a visitor it does not know.\n\n`slug` is optional and derived from the name when left out. A slug you name that is already taken is a 409 rather than a quiet `-2`. Read the `slug` and `publicUrl` from the response. Supports the `Idempotency-Key` header.\n\nNeeds the `forms:write` scope, which is new. An API key holding the `*` wildcard picks it up automatically; an OAuth connection made before it shipped has to be re-authorized.\n",
        "tags": [
          "Forms"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformFormCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Form created, and live",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformForm"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `forms:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "The slug is already used by another form (`FORM_SLUG_TAKEN`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/forms/{id}": {
      "get": {
        "operationId": "getForm",
        "summary": "Get a form",
        "description": "One form with its questions, in order. Keep each question's `id`: to change the questions you resend every one you are keeping by id. `submissionCount` is how many people have completed it; the answers themselves are not served by this API.\n",
        "tags": [
          "Forms"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club form id"
          }
        ],
        "responses": {
          "200": {
            "description": "The form",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformForm"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `forms:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateForm",
        "summary": "Update a form",
        "description": "Edits a form. Send only what changes; an omitted field is left alone. The change is live immediately.\n\n`slug` and `createsAccount` cannot be changed: the slug is the address people were given, and the kind decides what the form is. Offerings on a sign-up form are held to the same bar as on create, and a fill-in form offers nothing. There is no delete: deleting a form deletes every submission made through it, so it stays in the 1club admin portal.\n",
        "tags": [
          "Forms"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club form id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformFormUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated form",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformForm"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `forms:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/forms/{id}/questions": {
      "put": {
        "operationId": "updateFormQuestions",
        "summary": "Set a fill-in form's questions",
        "description": "Sets the questions of a fill-in form (`createsAccount: false`), in the order given. The change is live immediately.\n\nResend every question you are keeping **with its `id`**, and list the ones to delete in `removeQuestionIds`. A question is never deleted by being left out: a list that is missing an existing question is a 400 (`FORM_QUESTION_OMITTED`) naming it. The ids matter because answers are stored against them, so a question resent without its id is a new question and the answers already given stop being linked to it. Deleting a question keeps past submissions readable with the wording they were asked under.\n\nA sign-up form has no questions of its own (`FORM_QUESTIONS_FILL_IN_ONLY`).\n",
        "tags": [
          "Forms"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club form id"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformFormQuestionsPut"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The form, with its new questions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformForm"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `forms:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/instructor-shifts": {
      "get": {
        "operationId": "listInstructorShifts",
        "summary": "List the staff roster",
        "description": "Returns the shifts coaches are on between two days, both included, spanning at most 93 days. These are what a coach's availability reads: a coach on a rotation is bookable only within a shift, less its breaks. Cancelled shifts are left out unless asked for.\n",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "from",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "to",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "instructorId",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "includeCancelled",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of the shifts in the window, by day and start time",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformInstructorShift"
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createInstructorShift",
        "summary": "Add a shift",
        "description": "Puts a coach on one extra shift, outside any rotation - cover for someone, an extra session. The day it is filed on is the day it starts on the coach's clock. Breaks are wall-clock `HH:mm` inside the shift.\n",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "instructorId",
                  "startTime",
                  "endTime"
                ],
                "properties": {
                  "instructorId": {
                    "type": "integer"
                  },
                  "clubId": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Defaults to the coach's own club"
                  },
                  "startTime": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "endTime": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "breaks": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/PlatformShiftBreak"
                    }
                  },
                  "note": {
                    "type": "string",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created shift",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformInstructorShift"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/instructor-shifts/{id}": {
      "get": {
        "operationId": "getInstructorShift",
        "summary": "Get a shift",
        "description": "Returns one shift on the staff roster, with its breaks as instants, where it came from (a rotation or added by hand) and whether it was edited by hand.\n",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The shift",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformInstructorShift"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateInstructorShift",
        "summary": "Edit a shift",
        "description": "Changes one shift's times, breaks, status or note. The shift becomes an override that regenerating its rotation leaves alone. Moving the start without sending `breaks` moves the existing breaks with it.\n",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "minProperties": 1,
                "properties": {
                  "startTime": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "endTime": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "scheduled",
                      "cancelled"
                    ]
                  },
                  "breaks": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/PlatformShiftBreak"
                    }
                  },
                  "note": {
                    "type": "string",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated shift",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformInstructorShift"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteInstructorShift",
        "summary": "Delete a shift",
        "description": "Removes a shift from the staff roster. Meant for a shift added by hand: a generated one deleted here comes back the next time its rotation is regenerated, so cancel it instead.\n",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/instructor-shifts/{id}/cancel": {
      "post": {
        "operationId": "cancelInstructorShift",
        "summary": "Cancel a shift",
        "description": "Takes the coach off one shift. The shift stays on the staff roster as cancelled, so regenerating the rotation does not put it back. Bookings already inside it are left as they are.\n",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The cancelled shift",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformInstructorShift"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/instructor-time-off": {
      "get": {
        "operationId": "listInstructorTimeOff",
        "summary": "List instructor time off",
        "description": "Returns the time off overlapping two days on the organization's clock, both included, spanning at most 93 days. A coach cannot be booked inside their time off, whatever their staff roster says.\n",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "from",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "to",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "in": "query",
            "name": "instructorId",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of the time off in the window, by start",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformInstructorTimeOff"
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createInstructorTimeOff",
        "summary": "Book a coach off",
        "description": "Stops new bookings with the coach inside the window. What is already on their diary there is not moved or cancelled: it comes back as `conflicts`, for the caller to reassign or cancel through the bookings and classes endpoints.\n",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "instructorId",
                  "startTime",
                  "endTime"
                ],
                "properties": {
                  "instructorId": {
                    "type": "integer"
                  },
                  "startTime": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "endTime": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "note": {
                    "type": "string",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The time off, and what it collides with",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/PlatformInstructorTimeOff"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "conflicts": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/PlatformInstructorTimeOffConflict"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/instructor-time-off/{id}": {
      "patch": {
        "operationId": "updateInstructorTimeOff",
        "summary": "Change instructor time off",
        "description": "Moves, shortens or extends the window. Like booking a coach off, it leaves existing bookings in place and returns everything the window now covers as `conflicts`.\n",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "minProperties": 1,
                "properties": {
                  "startTime": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "endTime": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "note": {
                    "type": "string",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated time off, and everything its window now collides with",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/PlatformInstructorTimeOff"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "conflicts": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/PlatformInstructorTimeOffConflict"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteInstructorTimeOff",
        "summary": "Remove instructor time off",
        "description": "The coach becomes bookable again inside the window, as their staff roster allows.",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Removed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/instructor-types": {
      "get": {
        "operationId": "listInstructorTypes",
        "summary": "List instructor types",
        "description": "Returns the organization's instructor types - the kinds of coach it has, such as \"Padel coach\" or \"Personal trainer\". Resolve one here to fill in `instructorTypeId` when creating or updating an instructor.\n\nAn organization is seeded with a set derived from the sports its clubs offer, so read this list before adding to it: a second \"Tennis coach\" under a slightly different name splits a roster that should be one group. There is no paging - an organization has a handful of these.\n",
        "tags": [
          "Instructors"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Every instructor type in the organization, in the order staff set in Settings",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformInstructorType"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `instructors:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createInstructorType",
        "summary": "Create an instructor type",
        "description": "Adds a kind of coach. List the existing types first - most organizations already have one for each sport their clubs offer, and this endpoint will happily create a near-duplicate.\n\n`slug` is optional and derived from the name when omitted, suffixed if that is taken; an explicit slug that clashes is a 409. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Instructors"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformInstructorTypeCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Instructor type created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformInstructorType"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `instructors:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "An explicit `slug` is already used by another instructor type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/instructor-types/{id}": {
      "get": {
        "operationId": "getInstructorType",
        "summary": "Get an instructor type",
        "description": "Returns one instructor type and how many coaches are filed under it, active and retired.",
        "tags": [
          "Instructors"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The instructor type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformInstructorType"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `instructors:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateInstructorType",
        "summary": "Update an instructor type",
        "description": "Changes an instructor type. Send only what changes; an omitted field is left alone, `null` clears a nullable one, and at least one field is required. A rename leaves `slug` alone - it is a stable key, so it moves only when you send one.\n\n`maxConcurrentBookings` here is the shape of the type. What a booking is actually checked against is the instructor's own value, so changing this does not retroactively widen or narrow the coaches already on it.\n",
        "tags": [
          "Instructors"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformInstructorTypeUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated instructor type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformInstructorType"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `instructors:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "An explicit `slug` is already used by another instructor type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/instructor-types/order": {
      "put": {
        "operationId": "updateInstructorTypeOrder",
        "summary": "Reorder instructor types",
        "description": "Sets the order of the organization's instructor types: the ids, first to last. Every list of them follows it - this API, the 1club admin, the club's website and member apps. A type left out (one added since you read the list) keeps its place after the listed ones. Returns the list as it now stands.\n",
        "tags": [
          "Instructors"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformTypeOrder"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Every instructor type in the organization, in the new order",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformInstructorType"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `instructors:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/instructors": {
      "get": {
        "operationId": "listInstructors",
        "summary": "List and search instructors",
        "description": "Returns the organization's active instructors. Use `search` to match on name - case-insensitive and cross-script, so `maya` also matches `Мая`. Resolve a coach here and pass the returned `id` as `instructorId` when creating a booking. `bookability` says who may book them: `Admin_only` means the club reserves those bookings to its own staff, and an API key acts for the organization itself, so it may still create one; `No_one` means nobody may, an API key included, because the coach only teaches classes. Create one with POST /v1/platform/instructors - which makes a bookable coach and nothing more: no staff-portal login comes with it.\n\nOnly active instructors are listed by default. One retired with `isActive: false` is hidden here until `includeInactive=true` asks for it, and always resolves by id - so the caller that just retired a coach can read them back and undo it. Every row reports `isActive` and `visibility`.\n",
        "tags": [
          "Instructors"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string",
              "maxLength": 120
            },
            "description": "Match on instructor name"
          },
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only instructors assigned to this club"
          },
          {
            "in": "query",
            "name": "instructorTypeId",
            "schema": {
              "type": "integer"
            },
            "description": "Only coaches of this kind, from GET /v1/platform/instructor-types"
          },
          {
            "in": "query",
            "name": "sport",
            "schema": {
              "type": "string"
            },
            "description": "Only instructors who list this sport (e.g. \"padel\")"
          },
          {
            "in": "query",
            "name": "bookableOnly",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            },
            "description": "When \"true\", only instructors a customer may book (`bookability` `Member_only` or `Public`)"
          },
          {
            "in": "query",
            "name": "includeInactive",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            },
            "description": "When \"true\", also return retired instructors (`isActive` false), which are hidden by default. Use it to find a coach you just retired."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            },
            "description": "Maximum number of instructors to return"
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "Number of instructors to skip"
          }
        ],
        "responses": {
          "200": {
            "description": "Page of instructors",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformInstructorPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `instructors:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createInstructor",
        "summary": "Create an instructor",
        "description": "Makes a bookable instructor (a coach) out of an existing contact. Resolve or create that contact first with the contacts resource, then pass its id as `contactId` - an instructor profile hangs off a person the organization already knows, and the name on it is theirs.\n\n**This grants no access to the staff portal.** The instructor gets no login, no role, no `organization_users` row and no invitation email; they are inventory that can be booked and paid, not a user. `sendInvitation`, `organizationUserId`, `role` and `color` are refused rather than ignored, so a payload copied from the admin API fails loudly. Invite a coach to the portal from the 1club admin portal instead.\n\n`hourlyRate` is what a **member pays** for an hour of one-to-one time, not what the club pays the coach - see POST /v1/platform/pay-rate-policies for the latter.\n\nOne instructor per contact. A contact that already has one is a 409 naming the existing profile, including when that profile is inactive: bringing a retired coach back is a PATCH, so whoever does it can see the rates and hours they are restoring. Supports the `Idempotency-Key` header.\n\nNeeds the `instructors:write` scope, which is new. An API key holding the `*` wildcard picks it up automatically; an OAuth connection does not, because the wildcard is expanded at consent time - that connection has to be re-authorized before this endpoint is reachable.\n",
        "tags": [
          "Instructors"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformInstructorCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Instructor created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformInstructorSummary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `instructors:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "This contact already has an instructor profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/instructors/{id}": {
      "get": {
        "operationId": "getInstructor",
        "summary": "Get an instructor",
        "description": "Returns a single instructor by its 1club id. Retired instructors resolve here too - check `isActive` before offering one, since the list hides them by default.\n",
        "tags": [
          "Instructors"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club instructor id"
          }
        ],
        "responses": {
          "200": {
            "description": "The instructor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformInstructorSummary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `instructors:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateInstructor",
        "summary": "Update an instructor",
        "description": "Edits an instructor's bookable profile - their sports, their member-facing rate, their availability, who may book them. Send only what changes; an omitted field is left alone.\n\nRetire a coach with `isActive: false` and bring them back with `isActive: true`; there is no delete, because an instructor carries bookings, classes and pay history. Two invariants are applied on the way through, so read the response rather than assuming the payload landed verbatim: deactivating always retires `bookability` to `Admin_only` (or leaves it at `No_one`), and `bookability` never outruns `visibility` - making someone `Private` pulls a `Public` bookability down with it.\n\n`contactId` is not editable: the profile is bound to one person, and re-pointing it would silently transfer their bookings and their pay. The staff-portal fields are refused here for the same reasons as on the create.\n",
        "tags": [
          "Instructors"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club instructor id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformInstructorUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated instructor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformInstructorSummary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `instructors:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/invoices/summary": {
      "get": {
        "operationId": "getInvoiceSummary",
        "summary": "Summarize what was invoiced",
        "description": "Totals of the organization's fiscal invoices over a range of calendar days on the organization's own clock (`timezone` in the response). Both bounds are inclusive `YYYY-MM-DD` dates; with neither, the range is today, and with one, it is that single day. A range may span at most 93 days.\n\nAn invoice belongs to the day its invoice date names: a date entered without a time files on that date, and an invoice raised from a sale files on the organization's local day. Pro-formas are never included.\n\n`invoiced` excludes `void` and `cancelled` invoices; `byStatus` lists every status, those included. Every amount is grouped by currency - totals in different currencies are never added together. `overdue` counts unpaid invoices in the range whose due date has passed. `byBillingEntity` splits `invoiced` by the company that issued each invoice.\n",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "startDate",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "First day, inclusive. Defaults to endDate, or today."
          },
          {
            "in": "query",
            "name": "endDate",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Last day, inclusive. Defaults to startDate."
          },
          {
            "in": "query",
            "name": "billingEntityId",
            "schema": {
              "type": "integer"
            },
            "description": "Only invoices issued by this billing entity"
          }
        ],
        "responses": {
          "200": {
            "description": "Invoice totals for the range",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformInvoiceSummary"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "Missing `invoices:read` scope"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/invoices": {
      "get": {
        "operationId": "listInvoices",
        "summary": "List invoices",
        "description": "Lists the organization's fiscal invoices over a range of calendar days, newest first. The days are read exactly as `GET /invoices/summary` reads them, so for the same range and filters this returns the invoices the summary counted. Pro-formas are never included.\n",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "startDate",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "First day, inclusive. Defaults to endDate, or today."
          },
          {
            "in": "query",
            "name": "endDate",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Last day, inclusive. Defaults to startDate."
          },
          {
            "in": "query",
            "name": "billingEntityId",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "contactId",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "paid",
                "void",
                "failed",
                "settled",
                "overdue",
                "partially_paid",
                "refunded",
                "cancelled"
              ]
            },
            "description": "The invoice's status. `overdue` is derived, as each invoice's `overdue` field is: an unpaid invoice (pending, partially paid or overdue) whose due day is behind today on the organization's clock. Every other status matches the stored status.\n"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Page of invoices",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformInvoicePage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "Missing `invoices:read` scope"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/invoices/{id}": {
      "get": {
        "operationId": "getInvoice",
        "summary": "Get an invoice",
        "description": "One fiscal invoice with its line items and the payments recorded against it.",
        "tags": [
          "Invoices"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Invoice",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformInvoiceDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "Missing `invoices:read` scope"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/me": {
      "get": {
        "operationId": "getMe",
        "summary": "Describe the API key's organization and granted scopes",
        "description": "Returns the organization the API key belongs to, the scopes granted to the key, and the catalog of resources/actions the platform API exposes. Requires a valid API key but no specific scope - use it to verify a key and discover what it can access.\n\n`organizations` lists every organization the credential may act in: an API key's own, or - for an MCP connection, which acts as its user - every organization that user is staff of. A connection reaching several names the one each request acts in with the `X-1Club-Organization-Id` header, and may do there what its user's permissions allow; called without it, this endpoint answers with `organization: null`, marks each organization a call could not act in with `unavailable` (`ORGANIZATION_NOT_ACTIVE` or `PLAN_FEATURE_LOCKED`), and every other endpoint refuses with `ORGANIZATION_REQUIRED`. `search` narrows the list by name; for 1club staff it also finds organizations they are not a member of, marked `access: staff`.\n\nA full-access key holds the single wildcard scope `*`. Test a capability against `effectiveScopes`, which expands the wildcard, rather than against `scopes`, which reports the grant verbatim.\n",
        "tags": [
          "Account"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "search",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 100
            },
            "description": "Narrow `organizations` to names containing this text."
          }
        ],
        "responses": {
          "200": {
            "description": "API key identity and granted scopes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformIdentity"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "Organization not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/platform/media": {
      "get": {
        "operationId": "listMedia",
        "summary": "List media",
        "description": "The organization's media library, newest first. Pass `search` to match by name or alt text, which is how you find the URL for an image to put on a website section - never invent an image URL.\nA `search` returns the best matches ranked by relevance rather than a page of results, so `offset` does not apply to it and `total` reports how many matched.\n",
        "tags": [
          "Media"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string"
            },
            "description": "Match against name and alt text"
          },
          {
            "in": "query",
            "name": "mediaType",
            "schema": {
              "type": "string",
              "enum": [
                "image",
                "video"
              ]
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            },
            "description": "Max results (1-100, default 50)"
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Media and the total count",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "media": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformMedia"
                      }
                    },
                    "total": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `media:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createMedia",
        "summary": "Register a file in the media library",
        "description": "Adds an already-hosted file to the library so website sections and content can reference it. The API does not accept file uploads - upload to your image host first (the admin editor uses Cloudinary) and register the resulting URL here.\nIdempotent per URL: registering one the organization already has updates whatever metadata you send and returns the existing item, with `created: false`.\n",
        "tags": [
          "Media"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Absolute http(s) URL of the file"
                  },
                  "name": {
                    "type": "string",
                    "description": "Display name. Derived from the URL when omitted - this is what `search` matches on, so a descriptive name is worth sending."
                  },
                  "altText": {
                    "type": "string",
                    "nullable": true,
                    "description": "Alternative text, used by screen readers and searched alongside the name"
                  },
                  "caption": {
                    "type": "string",
                    "nullable": true
                  },
                  "mediaType": {
                    "type": "string",
                    "enum": [
                      "image",
                      "video"
                    ],
                    "description": "Inferred from the URL extension when omitted"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The registered media item",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/PlatformMedia"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "created": {
                          "type": "boolean",
                          "description": "False when the URL was already in the library"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Missing or non-http(s) URL",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `media:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/media/{mediaId}": {
      "get": {
        "operationId": "getMedia",
        "summary": "Get one media item",
        "tags": [
          "Media"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "mediaId",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The media item",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformMedia"
                }
              }
            }
          },
          "400": {
            "description": "Invalid media id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `media:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "Media not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateMedia",
        "summary": "Update media metadata",
        "description": "Changes the name, alt text or caption. The file itself and its URL are immutable - register a new item to replace a file.\nAlt text is worth filling in: it is what screen readers announce, and it is searched alongside the name when finding an image to place.\n",
        "tags": [
          "Media"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "mediaId",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "altText": {
                    "type": "string",
                    "nullable": true
                  },
                  "caption": {
                    "type": "string",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated media item",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformMedia"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body or media id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `media:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "Media not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteMedia",
        "summary": "Delete a media item",
        "description": "Removes the item from the library **and deletes the file from Cloudinary**. This cannot be undone, and any website section or content item still referencing the URL will render a broken image - check before deleting.\nNeeds its own `media:delete` scope for that reason; `media:write` alone is not enough.\n",
        "tags": [
          "Media"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "mediaId",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid media id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `media:delete` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "Media not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/member-accounts": {
      "get": {
        "operationId": "listMemberAccounts",
        "summary": "List household and company accounts",
        "description": "The organization's household and company accounts: the family or employer a group of contacts belongs to, which an invoice can be addressed to. Pass `contactId` to see the accounts one contact belongs to. Requires `contacts:read`.\n",
        "tags": [
          "Member Accounts"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string",
              "enum": [
                "household",
                "company"
              ]
            }
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string",
              "maxLength": 120
            },
            "description": "Part of the account name"
          },
          {
            "in": "query",
            "name": "contactId",
            "schema": {
              "type": "integer"
            },
            "description": "Only accounts this contact is a member of"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of accounts, by name",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformMemberAccountPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createMemberAccount",
        "summary": "Create a household or company account",
        "description": "Creates an account with its first member, who becomes the primary contact. A company needs a name; a household without one is named after its first member. The first member is owner of a household and employee of a company unless `role` says otherwise - an admin can act for every other member from the member apps, so grant it deliberately.\n\nRequires `contacts:write`. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Member Accounts"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformMemberAccountCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Account created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformMemberAccountDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/member-accounts/{id}": {
      "get": {
        "operationId": "getMemberAccount",
        "summary": "Get a household or company account",
        "description": "One account with its members and their roles. Requires `contacts:read`.",
        "tags": [
          "Member Accounts"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformMemberAccountDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateMemberAccount",
        "summary": "Update a household or company account",
        "description": "Renames an account, changes its primary contact (who must already be a member) or its billing details. Send only what changes. Requires `contacts:write`.\n",
        "tags": [
          "Member Accounts"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformMemberAccountUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The account as saved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformMemberAccountDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteMemberAccount",
        "summary": "Delete a household or company account",
        "description": "Deletes the account and ungroups its members. The members stay as contacts, and invoices and charges addressed to the account keep their rows without it. Requires `contacts:delete`.\n",
        "tags": [
          "Member Accounts"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Account deleted"
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/member-accounts/{id}/members": {
      "post": {
        "operationId": "createMemberAccountMember",
        "summary": "Add a member to an account",
        "description": "Adds an existing contact to the account. Roles are owner, adult or dependent for a household and admin or employee for a company; left out, a household member is an adult (owner when the account has nobody yet) and a company member an employee. A contact may belong to several accounts, but to each only once. Requires `contacts:write`.\n",
        "tags": [
          "Member Accounts"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "contactId"
                ],
                "properties": {
                  "contactId": {
                    "type": "integer"
                  },
                  "role": {
                    "type": "string",
                    "enum": [
                      "owner",
                      "adult",
                      "dependent",
                      "admin",
                      "employee"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The account with its members",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformMemberAccountDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "The contact is already a member of this account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/member-accounts/{id}/members/{contactId}": {
      "patch": {
        "operationId": "updateMemberAccountMember",
        "summary": "Change a member's role",
        "description": "Changes the role of one member, within the roles the account's type allows. Requires `contacts:write`.",
        "tags": [
          "Member Accounts"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "path",
            "name": "contactId",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "role"
                ],
                "properties": {
                  "role": {
                    "type": "string",
                    "enum": [
                      "owner",
                      "adult",
                      "dependent",
                      "admin",
                      "employee"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The account with its members",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformMemberAccountDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteMemberAccountMember",
        "summary": "Remove a member from an account",
        "description": "Takes a contact out of the account; the contact itself stays. Removing the primary contact leaves the account without one until another member is set as primary. Requires `contacts:write`.\n",
        "tags": [
          "Member Accounts"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "path",
            "name": "contactId",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The account with its remaining members",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformMemberAccountDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/memberships": {
      "get": {
        "operationId": "listMemberships",
        "summary": "List memberships",
        "description": "Returns the organization's memberships, most recently started first. Filter by customer, plan, or status to find the one you need.\n",
        "tags": [
          "Memberships"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "contactId",
            "schema": {
              "type": "integer"
            },
            "description": "Only memberships belonging to this customer"
          },
          {
            "in": "query",
            "name": "planId",
            "schema": {
              "type": "integer"
            },
            "description": "Only memberships on this plan"
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "active",
                "expired",
                "cancelled",
                "used",
                "paused",
                "pending_payment"
              ]
            },
            "description": "Only memberships with this status"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Page of memberships",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformMembershipPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `memberships:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createMembership",
        "summary": "Create a membership",
        "description": "Puts a customer on a plan. The plan is snapshotted onto the membership exactly as it is when sold in 1club - club, session allowance, coverage, billing frequency and renewal window - so the membership draws down booking allowance identically.\n\n`paid` records a payment against the External / API method with no gateway call; `unpaid` leaves the membership's transactions outstanding. The total charged is the period amount plus any joining fee, both taken from the plan unless overridden. Collection and refunds stay with you.\n\nWhen nothing is owed at all - a free plan with no joining fee, or an `amount` of 0 on such a plan - the membership is created active straight away rather than awaiting a payment that will never come.\n\nSupports the `Idempotency-Key` header.\n",
        "tags": [
          "Memberships"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "contactId",
                  "planId",
                  "payment"
                ],
                "properties": {
                  "contactId": {
                    "type": "integer",
                    "description": "Customer to give the membership to (from GET /v1/platform/contacts)"
                  },
                  "planId": {
                    "type": "integer",
                    "description": "Plan to put them on"
                  },
                  "startDate": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Defaults to today in the organization's timezone"
                  },
                  "autoRenew": {
                    "type": "boolean",
                    "description": "Defaults to the plan's setting"
                  },
                  "overrides": {
                    "type": "object",
                    "description": "The membership's own snapshot of the plan. Omit any field to take the plan's value; the admin Add membership dialog works the same way, so a negotiated sale is a normal case. Look the plan up first with GET /v1/platform/plans to see what you are overriding.\n",
                    "properties": {
                      "amount": {
                        "type": "number",
                        "maximum": 1000000,
                        "description": "Charged each period; defaults to the plan's price"
                      },
                      "signupFee": {
                        "type": "number",
                        "maximum": 1000000,
                        "description": "Charged once on top of `amount`; defaults to the plan's joining fee, 0 waives it"
                      },
                      "maxUses": {
                        "type": "number",
                        "nullable": true,
                        "description": "Session allowance; defaults to the plan's, null for unlimited"
                      },
                      "usesRemaining": {
                        "type": "number",
                        "nullable": true,
                        "description": "Sessions left now; defaults to the full allowance. Set it lower when migrating a partly-used package."
                      },
                      "sessionUnit": {
                        "type": "string",
                        "enum": [
                          "booking",
                          "hour"
                        ],
                        "description": "Whether a use is a booking or an hour; defaults to the plan's"
                      },
                      "commitmentMonths": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 120,
                        "nullable": true,
                        "description": "Minimum term in months, counted from `startDate`, before the member may cancel; defaults to the plan's `minimumTermMonths`. null sells it with no commitment. Only a renewing plan carries one: a term on a plan that does not renew is refused (400).\n"
                      }
                    }
                  },
                  "payment": {
                    "type": "object",
                    "required": [
                      "status"
                    ],
                    "properties": {
                      "status": {
                        "type": "string",
                        "enum": [
                          "paid",
                          "unpaid"
                        ],
                        "description": "`paid` records money you already collected. An API key's customer is not sent a payment receipt for it - you issue your own; over an OAuth connection they are, as they would be for a sale at the club.\n"
                      },
                      "reference": {
                        "type": "string",
                        "maxLength": 128,
                        "description": "Your own id for the payment you collected, for the club to reconcile against your payout statement. Requires `status: paid`.\n"
                      },
                      "fee": {
                        "type": "number",
                        "maximum": 1000000,
                        "description": "What you kept out of the amount - your commission. Recorded for reconciliation; it does not reduce the sale. Requires `status: paid` and an explicit `overrides.amount` it cannot exceed. Not stored when nothing is owed (a free plan).\n"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Membership created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformMembership"
                }
              }
            }
          },
          "400": {
            "description": "Contact or plan not found in this organization, or the contact is archived",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `memberships:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "$ref": "#/components/responses/PlatformConflict"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/memberships/{id}": {
      "get": {
        "operationId": "getMembership",
        "summary": "Get a membership",
        "description": "Returns a single membership by its 1club id, including its remaining session allowance.",
        "tags": [
          "Memberships"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The membership",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformMembership"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `memberships:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateMembership",
        "summary": "Update a membership",
        "description": "Changes whether the membership renews, its commitment, what it covers and counts, and whether it is active, paused, or cancelled. Cancelling stamps the cancellation date, as cancelling in 1club does.\n\nCoverage and allowance edits change this membership's own snapshot of the plan, never the plan or anyone else's membership. A new coverage decides what is spent from here on; sessions already spent stay spent.\n\nA billing change applies from the next renewal: the period already paid for stays, a renewal already raised and not yet due is voided and raised again on the new billing, and the price and session allowance per period do not change. A renewal already emailed as a payment link stands, and the new billing follows it.\n\nChanging the plan or the price is not supported: that is a priced change needing proration, invoicing and possibly a refund. Do it in 1club instead.\n",
        "tags": [
          "Memberships"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "paused",
                      "cancelled"
                    ],
                    "description": "Statuses the platform derives itself (expired, used, pending_payment) cannot be set here. Send `status` on its own - `autoRenew`, the allowance fields and the commitment fields cannot be combined with it, because a status transition sets them itself. `active` only applies to a paused membership.\n"
                  },
                  "cancelMode": {
                    "type": "string",
                    "enum": [
                      "immediate",
                      "end_of_period"
                    ],
                    "default": "end_of_period",
                    "description": "Only valid with `status: cancelled`. Keep access until the paid period ends, or end it today."
                  },
                  "applyEarlyCancellationCharge": {
                    "type": "boolean",
                    "default": false,
                    "description": "Only valid with `status: cancelled`. Raise the early cancellation charge the club's membership policy sets for ending a membership before its minimum commitment, as an owed charge on the member's account. Without it the cancellation is recorded with that charge waived."
                  },
                  "resumeAt": {
                    "type": "string",
                    "format": "date-time",
                    "nullable": true,
                    "description": "Only valid with `status: paused`. When the pause lifts by itself; must be in the future."
                  },
                  "autoRenew": {
                    "type": "boolean"
                  },
                  "maxUses": {
                    "type": "number",
                    "nullable": true,
                    "description": "Session allowance; null for unlimited"
                  },
                  "usesRemaining": {
                    "type": "number",
                    "nullable": true,
                    "description": "Sessions left, for setting a balance migrated in. Only together with maxUses"
                  },
                  "validFor": {
                    "type": "object",
                    "description": "What it covers, replaced whole. `scopes` picks classes, areas and/or instructors; `classTypes`, `areaTypes` and `instructorTypes` narrow a scope to those type ids, and a scope with no list covers every type in it. No scopes means general coverage (direct entry), refused (400) unless the plan's own coverage is general. Refused (400) on a membership with several allowances.\n",
                    "properties": {
                      "scopes": {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "classes",
                            "areas",
                            "instructors"
                          ]
                        }
                      },
                      "classTypes": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "areaTypes": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      },
                      "instructorTypes": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        }
                      }
                    }
                  },
                  "sessionUnit": {
                    "type": "string",
                    "enum": [
                      "booking",
                      "hour"
                    ],
                    "description": "Whether a use is a booking or an hour; a change recounts what is left in the new unit. Refused (400) on a membership with several allowances, and on general coverage, where a check-in always counts one use.\n"
                  },
                  "sessionLengthMinutes": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1440,
                    "nullable": true,
                    "description": "How long one visit lasts at the door, from its first entry; null until the end of the club's day. Refused (400) unless the membership counts sessions per booking.\n"
                  },
                  "shareWithAccount": {
                    "type": "boolean",
                    "description": "Whether the people on the holder's account can use it too"
                  },
                  "billingFrequency": {
                    "type": "string",
                    "enum": [
                      "one_time",
                      "weekly",
                      "monthly",
                      "quarterly",
                      "annually",
                      "custom"
                    ],
                    "description": "How it bills from the next renewal. `one_time` stops renewal, so it ends with the period already paid for. Refused (400) on a season pass, a paused or ended membership, or one already set to end, and where no period is still running for the new billing to follow on from. Also refused on a membership that counts sessions when moving it to `one_time`, or when it has no charge on record, because sessions already spent would be counted again. Where the minimum term would no longer outlast one payment, send `commitmentMonths` with it.\n"
                  },
                  "customPeriod": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 3650,
                    "nullable": true,
                    "description": "With `billingFrequency` custom, how many `customPeriodUnit` a period lasts"
                  },
                  "customPeriodUnit": {
                    "type": "string",
                    "enum": [
                      "days",
                      "weeks",
                      "months"
                    ],
                    "nullable": true,
                    "description": "With `billingFrequency` custom, the unit of `customPeriod`"
                  },
                  "allowances": {
                    "type": "array",
                    "description": "On a membership with several allowances, in place of `validFor`, `maxUses`, `usesRemaining` and `sessionUnit`. Name only the allowances that change; what is left out stays as it is. No two may cover the same type. What is used stays used: a count raised by two leaves two more.\n",
                    "items": {
                      "type": "object",
                      "required": [
                        "id"
                      ],
                      "properties": {
                        "id": {
                          "type": "integer",
                          "description": "The `allowanceId` on the membership"
                        },
                        "validFor": {
                          "type": "object",
                          "description": "What this allowance covers, replaced whole, in the shape of `validFor` above",
                          "additionalProperties": true
                        },
                        "maxUses": {
                          "type": "number",
                          "nullable": true,
                          "description": "Sessions each period; null for unlimited"
                        },
                        "sessionUnit": {
                          "type": "string",
                          "enum": [
                            "booking",
                            "hour"
                          ]
                        }
                      }
                    }
                  },
                  "commitmentMonths": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 120,
                    "nullable": true,
                    "description": "A new minimum term in months, counted from the membership's start date; null removes the commitment. Refused (400) on a membership that does not renew.\n"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated membership",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformMembership"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, or no fields to change",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `memberships:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/memberships/{id}/session-adjustments": {
      "post": {
        "operationId": "createMembershipSessionAdjustment",
        "summary": "Adjust a membership's sessions",
        "description": "Gives a pass sessions or takes some back, with a reason, recorded on the membership as staff adjustments in 1club are. The adjustment lasts for the current allowance period; the next one starts from the allowance again.\n\nSupports the `Idempotency-Key` header.\n",
        "tags": [
          "Memberships"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "units",
                  "reason"
                ],
                "properties": {
                  "units": {
                    "type": "number",
                    "minimum": -1000,
                    "maximum": 1000,
                    "description": "Sessions given (positive) or taken back (negative); hours on an hourly pass. Not zero."
                  },
                  "reason": {
                    "type": "string",
                    "maxLength": 500,
                    "description": "Why, recorded with the adjustment"
                  },
                  "allowanceId": {
                    "type": "integer",
                    "description": "Which allowance, on a membership with several; required there"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The adjusted membership",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformMembership"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, or the sessions cannot be adjusted: an unlimited membership, one that has ended, more taken back than are left, or no `allowanceId` on a membership with several\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `memberships:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/messages": {
      "get": {
        "operationId": "listMessages",
        "summary": "List messages",
        "description": "Returns the organization's Messages - email, SMS and WhatsApp, drafts and sent, outbound and inbound - newest first. Each row carries a plain text `preview`, its `audience` and `recipientCount`; the body and the per-recipient delivery status come with GET /v1/platform/messages/{id}.\n\nThis API never sends a Message. Drafts written here (`source: api`) wait in the admin app for a member of staff to review and send.\n",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "sent"
              ]
            },
            "description": "Only drafts, or only Messages that have gone out (inbound ones are stored as sent)"
          },
          {
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string",
              "enum": [
                "email",
                "sms",
                "whatsapp"
              ]
            },
            "description": "Only this channel"
          },
          {
            "in": "query",
            "name": "contactId",
            "schema": {
              "type": "integer"
            },
            "description": "Only Messages this contact is a recipient of"
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string",
              "maxLength": 120
            },
            "description": "Match on subject, a recipient name, the sender name or words in the body; the body search reads at most the 1000 newest matches"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of Messages",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformMessagePage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `messages:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createMessage",
        "summary": "Create a message draft",
        "description": "Writes a **draft**. It is never sent by this API: there is no send endpoint. The draft appears in the admin app, where a member of staff reviews it and sends it. Tell whoever asked for it that it is waiting there.\n\nName the audience with exactly one of `contactIds` (specific contacts, all of which must belong to the organization, at most 5,000) or `segment` (a filter resolved when the draft is sent - **an empty `segment` is every contact**). `type` is `email`, `sms` or `whatsapp`; push notifications cannot be composed. An email needs a `subject`. `content` is a string (HTML for email, which is sanitized; text for SMS and WhatsApp) or an object with `html` or Editor.js `blocks`.\n\nThe draft is attributed to a member of staff: the one an assistant is acting for, or for an API key the person who created the key - refused (403) when they are no longer an active member of the organization. It is stamped `source: api`. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformMessageDraftCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Draft created. Not sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformMessage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `messages:write` scope, a contact is not in this organization, or the key's creator can no longer be named as the draft's author\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "$ref": "#/components/responses/PlatformConflict"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/messages/{id}": {
      "get": {
        "operationId": "getMessage",
        "summary": "Get a message",
        "description": "Returns one Message with its body and its recipients, each with how the Message landed for them: `deliveryStatus` (queued until sent, then what the provider reported, or `skipped` with a `skippedReason` when it was never sent to that person) and `engagementStatus` (open, click, unsubscribe, spamreport) where the channel reports it.\n\nA segment draft has no recipients yet: its audience is resolved when a member of staff sends it.\n",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club message id"
          }
        ],
        "responses": {
          "200": {
            "description": "The Message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformMessage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `messages:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateMessage",
        "summary": "Update a message draft",
        "description": "Edits a draft. Send only what changes; an empty body is refused. A Message that has been sent cannot be changed (409, `MESSAGE_NOT_DRAFT`), and nothing here sends one. The channel is fixed: write a new draft to change it.\n\nSending `contactIds` or `segment` replaces the audience and switches the draft to that kind of audience. An API key may edit only drafts written through the API (403 otherwise), so a draft a member of staff started stays theirs; an assistant acting for a member of staff may edit any.\n",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club message id"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformMessageDraftUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated draft. Not sent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformMessage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `messages:write` scope, a contact is not in this organization, or the key may not change a draft started in 1club\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "The Message is not a draft (code `MESSAGE_NOT_DRAFT`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteMessage",
        "summary": "Delete a message draft",
        "description": "Deletes a draft. A Message that has been sent stays on record and cannot be deleted (409, `MESSAGE_NOT_DRAFT`). An API key may delete only drafts written through the API (403 otherwise).\n",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club message id"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "responses": {
          "204": {
            "description": "Draft deleted"
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `messages:write` scope, or may not delete a draft started in 1club",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "The Message is not a draft (code `MESSAGE_NOT_DRAFT`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/notification-settings": {
      "get": {
        "operationId": "listNotificationSettings",
        "summary": "Get notification settings",
        "description": "For each role (admin, manager, front_desk, sales, instructor, member), the notification categories its people get and, for each, whether it is on, on which channels (`app`, `email`, `sms`), and whether it is locked so people cannot change it themselves. These are defaults: they reach everyone in the role who has not chosen for themselves, and `overriddenUserCount` says how many have. `isConfigured` is false where the organization still has 1club's default. Categories that begin `user_` are staff alerts about members (e.g. `user_booking`, a member booked or cancelled); `booking` is a member's own booking confirmations and changes. Requires `notifications:read`.\n",
        "tags": [
          "Notifications"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Every role's notification settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformNotificationSettings"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `notifications:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateNotificationSettings",
        "summary": "Update a notification setting",
        "description": "Changes one category's default for one role and keeps the rest. Send only what changes. An enabled category needs at least one channel; WhatsApp is never set here, because a person has to opt in to it themselves. The new default reaches everyone in the role who has not chosen for themselves; use the apply endpoint to overwrite those who have. Requires `notifications:write`.\n",
        "tags": [
          "Notifications"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "role",
                  "category"
                ],
                "properties": {
                  "role": {
                    "type": "string",
                    "enum": [
                      "admin",
                      "manager",
                      "front_desk",
                      "sales",
                      "instructor",
                      "member"
                    ]
                  },
                  "category": {
                    "type": "string",
                    "description": "A category the role gets, from GET /v1/platform/notification-settings"
                  },
                  "isEnabled": {
                    "type": "boolean"
                  },
                  "channels": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "app",
                        "email",
                        "sms"
                      ]
                    }
                  },
                  "isLocked": {
                    "type": "boolean",
                    "description": "Stop people in the role changing it themselves"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The category's setting for the role, as saved"
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `notifications:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/notification-settings/apply": {
      "post": {
        "operationId": "createNotificationSettingApply",
        "summary": "Apply notification settings to everyone in a role",
        "description": "Writes the role's saved settings onto every person in the role, replacing the choices they made themselves - so afterwards everyone in the role gets exactly the saved settings. Limit it to some categories with `categories`; a category the role has no saved setting for is refused. Not undone by changing the setting back. Requires `notifications:write`.\n",
        "tags": [
          "Notifications"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "role"
                ],
                "properties": {
                  "role": {
                    "type": "string",
                    "enum": [
                      "admin",
                      "manager",
                      "front_desk",
                      "sales",
                      "instructor",
                      "member"
                    ]
                  },
                  "categories": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The categories applied and how many people they were written to",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "categories": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "affected": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `notifications:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/pay-ledger": {
      "get": {
        "operationId": "listPayLedger",
        "summary": "List what coaches earned",
        "description": "Returns the pay ledger for a period: one line per unit of work a coach is paid for (a private session, a class, an attendee of a class), with what it paid under their pay rate policy and how. A pay rate policy is the rule; this is the money it produced.\n\nThe period is whole days on the organization's clock, both included, at most 93 days, and a line is in the period its session ended in. Work the paid-booking gate is still holding back is `pending`, at what it will pay once the member settles; `totals` keeps it apart from what is `earned`, and covers every page.\n\nNeeds `transactions:read` (the lines are per booking and per coach, which the totals-only `analytics:read` does not cover) and `staff:read` (it is what each member of staff is paid).\n",
        "tags": [
          "Pay Rate Policies"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "from",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "First day of the period, e.g. 2026-09-01"
          },
          {
            "in": "query",
            "name": "to",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Last day of the period, included, e.g. 2026-09-30"
          },
          {
            "in": "query",
            "name": "instructorId",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "earned",
                "pending"
              ]
            },
            "description": "Only earned lines, or only pending ones. Totals are unaffected."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of ledger lines, and the period's totals",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformPayLedgerLine"
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "totals": {
                      "type": "object",
                      "properties": {
                        "earned": {
                          "type": "number"
                        },
                        "pending": {
                          "type": "number"
                        },
                        "byInstructor": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "instructorId": {
                                "type": "integer"
                              },
                              "instructorName": {
                                "type": "string"
                              },
                              "earned": {
                                "type": "number"
                              },
                              "pending": {
                                "type": "number"
                              },
                              "lines": {
                                "type": "integer"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing `transactions:read`, or `staff:read` (`requiredScope` names which)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/pay-rate-policies": {
      "get": {
        "operationId": "listPayRatePolicies",
        "summary": "List pay rate policies",
        "description": "Returns the organization's pay rate policies - the rules for what the club pays its coaches. This is not an instructor's `hourlyRate`, which is what a member pays for an hour of their time; the two travel in opposite directions.\n\nA policy earns a coach either a flat amount per unit of work (a private session, a class, an attendee) or a percentage of what that work took, and covers a slice of the schedule described by three independent filters. Each one means **everything** when it is empty: no `instructors` named makes it the organization's default policy, applying to every coach who has none of their own; no `classTypes` covers every kind of class; no `entranceScopes` covers every way an attendee got in.\n\nFiltering by `instructorId` returns the policies that actually decide that coach's pay - the ones naming them, plus the default policies that would otherwise apply.\n\nThere is no paging: an organization has a handful of these. What a coach has actually accrued is the pay ledger, `GET /v1/platform/pay-ledger`.\n",
        "tags": [
          "Pay Rate Policies"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "instructorId",
            "schema": {
              "type": "integer"
            },
            "description": "Only the policies that decide this instructor's pay"
          },
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "type": "string",
              "enum": [
                "individual",
                "class"
              ]
            },
            "description": "Only policies for one-to-one sessions, or only those for classes"
          }
        ],
        "responses": {
          "200": {
            "description": "The organization's pay rate policies",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformPayRatePolicy"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "Missing the required `instructors:read` scope, or, for a member of staff signed in over MCP, `staff:read` (`requiredScope` names which)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createPayRatePolicy",
        "summary": "Create a pay rate policy",
        "description": "Creates a rule for what the club pays its coaches. `earnings.kind` picks what the policy is about and which rates it accepts: `individual` for one-to-one sessions (`perSession`, `perAdditionalPlayer`, `sessionRevenuePercentage`) and `class` for group classes (`perClass`, `perBooking`, `classRevenuePercentage`). At least one rate must be non-zero, and an individual policy cannot be scoped by class type.\n\n`instructorIds` must be sent. An empty list makes this the organization's default policy - it then applies to every coach who has no policy of their own, and creating it re-resolves every coach's pay - so that has to be asked for, never fallen into by omitting the field. `classTypeIds` and `entranceScopes` may be omitted; empty covers every class type or every way in.\n\nTwo policies may not claim the same coach for overlapping work. That is a 409 with code `PAY_RATE_POLICY_COLLISION`, carrying the coaches involved and the policy each one is already on, so the caller can say which assignment to undo. Supports the `Idempotency-Key` header.\n\nNeeds `instructors:write` - the same scope that creates a coach, because both are \"how this organization staffs and pays its sessions\". An OAuth connection made before that scope shipped has to be re-authorized.\n",
        "tags": [
          "Pay Rate Policies"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformPayRatePolicyCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Pay rate policy created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPayRatePolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `instructors:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "An instructor on this policy is already covered by another one for the same work",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/pay-rate-policies/{id}": {
      "get": {
        "operationId": "getPayRatePolicy",
        "summary": "Get a pay rate policy",
        "description": "Returns one pay rate policy, with the coaches, class types and entrance routes it covers.",
        "tags": [
          "Pay Rate Policies"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Pay rate policy id"
          }
        ],
        "responses": {
          "200": {
            "description": "The pay rate policy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPayRatePolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "Missing the required `instructors:read` scope, or, for a member of staff signed in over MCP, `staff:read` (`requiredScope` names which)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updatePayRatePolicy",
        "summary": "Update a pay rate policy",
        "description": "Edits a pay rate policy. Send only what changes; an omitted field is left alone. `instructorIds`, `classTypeIds` and `entranceScopes` each **replace** the whole list when sent - there is no element-wise merge for a set, so read the policy first and send the list you want.\n\n`earnings.kind` cannot change once the policy exists: an individual policy and a class policy earn against different units of work, so switching one would silently re-price everything it covers. Create the other kind instead. Sending `classTypeIds` to an individual policy is refused for the same reason it is on create. Both are 400s.\n\nA change that puts a coach on two overlapping policies is a 409 with code `PAY_RATE_POLICY_COLLISION`. Changing rates re-resolves the coach's not-yet-finalized pay from today onward; days already closed stay frozen.\n",
        "tags": [
          "Pay Rate Policies"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Pay rate policy id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformPayRatePolicyUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated pay rate policy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPayRatePolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `instructors:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "The change puts an instructor on two overlapping policies",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/pay-rate-policies/{id}/instructors": {
      "post": {
        "operationId": "assignPayRatePolicyInstructors",
        "summary": "Put instructors on a pay rate policy",
        "description": "Adds coaches to a policy, leaving the ones already on it alone - the additive counterpart of PATCH, which replaces the whole list. Adding a coach who is already covered by another policy for the same work is a 409 with code `PAY_RATE_POLICY_COLLISION`.\n\nNote that adding the first coach to a policy that named none narrows it: an empty list means \"every coach without a policy of their own\", so it stops being the organization's default.\n",
        "tags": [
          "Pay Rate Policies"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Pay rate policy id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "instructorIds"
                ],
                "properties": {
                  "instructorIds": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "integer"
                    },
                    "description": "Instructors to add. Already-assigned ones are left as they are."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The policy, with its instructors as they now stand",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPayRatePolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `instructors:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "An instructor is already covered by another policy for the same work",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/pay-rate-policies/{id}/instructors/{instructorId}": {
      "delete": {
        "operationId": "removePayRatePolicyInstructor",
        "summary": "Take an instructor off a pay rate policy",
        "description": "Removes one coach from a policy. Their not-yet-finalized pay re-resolves to whichever policy covers them next, or to nothing if none does; days already closed stay frozen.\n\nRemoving the last named coach does not disable the policy - it turns it into the organization's default, applying to every coach without one of their own. The response shows the policy as it now stands, which is where that is visible.\n",
        "tags": [
          "Pay Rate Policies"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Pay rate policy id"
          },
          {
            "in": "path",
            "name": "instructorId",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club instructor id"
          }
        ],
        "responses": {
          "200": {
            "description": "The policy, with its instructors as they now stand",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPayRatePolicy"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `instructors:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/payment-methods": {
      "get": {
        "operationId": "listPaymentMethods",
        "summary": "List payment methods",
        "description": "The organization's own payment methods: the tenders staff record by hand, such as cash, the card machine on the counter or a bank transfer. Card payments through a connected provider (Stripe, myPOS, DatecsPay) and the Wallet are the platform's and follow from the provider being connected, so they are not listed and cannot be changed here.\n\nA method's `visibility` decides who can choose it: `Private` is staff only (the till, check-in), while `Member_only` and `Public` also offer it to members paying for a booking.\n\nReadable with `transactions:read`, since every transaction already names its method, or with `payment-methods:write`.\n",
        "tags": [
          "Payment Methods"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The organization's payment methods, by name",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformPaymentMethod"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key holds neither `transactions:read` nor `payment-methods:write`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createPaymentMethod",
        "summary": "Create a payment method",
        "description": "Adds a tender staff can record payments with, such as \"Bank transfer\". `code` is how reports and imports name it and must be free within the organization; leave it out and it is derived from the name (`bank_transfer`). New methods are `Private` (staff only) unless `visibility` says otherwise.\n\nRequires `payment-methods:write`. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Payment Methods"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformPaymentMethodCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Payment method created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPaymentMethod"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `payment-methods:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "Another payment method in this organization already uses that `code`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/payment-methods/{id}": {
      "get": {
        "operationId": "getPaymentMethod",
        "summary": "Get a payment method",
        "description": "One of the organization's own payment methods. Readable with `transactions:read` or `payment-methods:write`.",
        "tags": [
          "Payment Methods"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The payment method",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPaymentMethod"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key holds neither `transactions:read` nor `payment-methods:write`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updatePaymentMethod",
        "summary": "Update a payment method",
        "description": "Renames a payment method, changes its code, or changes who may choose it. Send only what changes. Payments already recorded keep pointing at the method, so a rename shows on them too. Requires `payment-methods:write`.\n",
        "tags": [
          "Payment Methods"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformPaymentMethodUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The payment method as saved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPaymentMethod"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `payment-methods:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "Another payment method in this organization already uses that `code`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deletePaymentMethod",
        "summary": "Delete a payment method",
        "description": "Removes a payment method nobody has paid with yet. One with payments recorded against it is refused with a 409, because those payments would lose the tender they were taken with; set it `Private` instead to stop members choosing it. Requires `payment-methods:write`.\n",
        "tags": [
          "Payment Methods"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Payment method deleted"
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `payment-methods:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "Payments have been recorded with this method",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/pipeline-stages": {
      "get": {
        "operationId": "listPipelineStages",
        "summary": "List sales pipeline stages",
        "description": "Returns the organization's sales pipeline stages in board order, each with how many contacts are in it. Pass a stage's `id` as `pipelineStageId` when creating or updating a contact. Open stages are where leads are worked; there is exactly one Cold stage for leads that went quiet. A contact who has never been a customer is a lead while they are in any stage, and leaves the pipeline on their own once they pay for something.\n",
        "tags": [
          "Contacts"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Every pipeline stage, in board order",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformPipelineStage"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/contact-sources": {
      "get": {
        "operationId": "listContactSources",
        "summary": "List contact sources",
        "description": "Returns where the organization's contacts come from, in display order. Pass a source's `id` as `sourceId` when creating or updating a contact.\n",
        "tags": [
          "Contacts"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Every contact source, in display order",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformContactSource"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/plan-categories": {
      "get": {
        "operationId": "listPlanCategories",
        "summary": "List membership plan categories",
        "description": "Returns every membership plan category in the organization, in display order - the headings on a price list and the sections of a plans page. Resolve a category here, then pass its `categoryId` as `planCategoryId` when creating or updating a plan.\n\nThere is no paging: an organization has a handful of these, and a caller composing a price list wants all of them. Carries the `plans` scopes rather than one of its own - nobody grants \"may edit categories but not plans\".\n",
        "tags": [
          "Plans"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Every plan category, in display order",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformPlanCategory"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `plans:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createPlanCategory",
        "summary": "Create a membership plan category",
        "description": "Adds a membership plan category. Omit `sortOrder` and it goes to the end of the list, which is what you want unless you are rebuilding the whole ordering. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Plans"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 255
                  },
                  "sortOrder": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Display position; defaults to the end of the list"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Plan category created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPlanCategory"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `plans:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/plan-categories/{id}": {
      "get": {
        "operationId": "getPlanCategory",
        "summary": "Get a membership plan category",
        "description": "Returns a single plan category and how many membership plans sit in it.",
        "tags": [
          "Plans"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The plan category",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPlanCategory"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `plans:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updatePlanCategory",
        "summary": "Update a membership plan category",
        "description": "Renames a category or moves it in the display order. The plans in it are unaffected.",
        "tags": [
          "Plans"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "minProperties": 1,
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 255
                  },
                  "sortOrder": {
                    "type": "integer",
                    "minimum": 0
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated plan category",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPlanCategory"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `plans:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/plans": {
      "get": {
        "operationId": "listPlans",
        "summary": "List and search membership plans",
        "description": "Returns the organization's membership plans. Resolve a plan here, then pass its `planId` to POST /v1/platform/memberships - the plan carries its own price, joining fee, billing frequency and session allowance, so the sale does not restate any of it.\n\nOnly plans the gym still sells are returned by default - a retired plan is not something an integration should surface or sell. Pass `includeInactive=true` to see retired plans as well, which is how you find a plan again after retiring it. Use the write endpoints below to create, update, retire, or delete plans.\n",
        "tags": [
          "Plans"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string",
              "maxLength": 120
            },
            "description": "Match on plan name or description"
          },
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only plans sellable at this club - the plans limited to it plus the organization-wide ones"
          },
          {
            "in": "query",
            "name": "sport",
            "schema": {
              "type": "string"
            },
            "description": "Only plans listing this sport (e.g. \"padel\")"
          },
          {
            "in": "query",
            "name": "includeInactive",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "default": "false"
            },
            "description": "Include retired plans, which are hidden by default. Retired means `isActive` is false.\n"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Page of plans",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPlanPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `plans:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createPlan",
        "summary": "Create a membership plan",
        "description": "Creates a membership plan for the organization. Supports the `Idempotency-Key` header.",
        "tags": [
          "Plans"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformPlanCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Plan created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPlan"
                }
              }
            }
          },
          "403": {
            "description": "Missing `plans:write` scope"
          }
        }
      }
    },
    "/v1/platform/plans/{id}": {
      "get": {
        "operationId": "getPlan",
        "summary": "Get a membership plan",
        "description": "Returns a single plan, including what a membership on it costs and what it grants. Retired plans resolve here too - hiding them is the list's job, and a caller that just retired a plan still needs to read it back or undo it.\n",
        "tags": [
          "Plans"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The plan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPlan"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `plans:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updatePlan",
        "summary": "Update a membership plan",
        "description": "Updates a membership plan. Send only what changes; an omitted field is left alone.\n\nA **season plan** can be reached here even though GET /v1/platform/plans never lists one, because an id resolves by GET /v1/platform/plans/{id}. Those carry rules an ordinary plan does not: a season plan must bill `one_time`, belong to the season's own club, and count sessions in hours. An edit that would break one is refused with a 400 naming the rule (`SEASON_PLAN_BILLING_FREQUENCY`, `SEASON_PLAN_CLUB_MISMATCH`, `SEASON_PLAN_SESSION_UNIT`, …) rather than saved - a mis-set season plan does not error later, it sells a season pass with the wrong renewal behaviour or at the wrong venue. Renaming one, or retiring it with `isActive`, is unaffected.\n",
        "tags": [
          "Plans"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformPlanUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Plan updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPlan"
                }
              }
            }
          },
          "403": {
            "description": "Missing `plans:write` scope"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          }
        }
      },
      "delete": {
        "operationId": "deletePlan",
        "summary": "Delete a membership plan",
        "description": "Delete a plan with no dependent records. Set `isActive` to false to retire a plan that is already in use - a retired plan is still readable by id, and `includeInactive=true` brings it back into the list.\n",
        "tags": [
          "Plans"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Plan deleted"
          },
          "403": {
            "description": "Missing `plans:write` scope"
          },
          "409": {
            "description": "Plan is still referenced"
          }
        }
      }
    },
    "/v1/platform/pricing-rules": {
      "get": {
        "operationId": "listPricingRules",
        "summary": "List pricing rules",
        "description": "The organization's price list: the rules that set or move what a slot costs. An `absolute` rule states the hourly price outright; `percentage` and `fixed` rules move the price they are handed. A rule applies to the resources its `scopes` name (none means every area, coach and class) when every one of its `conditions` holds.\n\nRules are listed in order of precedence, the same order the admin list shows: lowest `priority` first, and in a tie a rule aimed at particular people (a `plan` or `contact-audience` condition) before one that is not, then the older. An `absolute` rule sets the hourly price first, whatever its priority; `percentage` and `fixed` rules then move it in this order. Rules are silent - a member sees the resulting price, never a rule's name. To see what a booking would actually cost with every rule applied, use `POST /v1/platform/pricing-rules/quote`.\n",
        "tags": [
          "Pricing Rules"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string",
              "maxLength": 120
            },
            "description": "Match on the rule name, case-insensitive"
          },
          {
            "in": "query",
            "name": "isActive",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            },
            "description": "Only rules that are switched on (`true`) or off (`false`)"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of pricing rules",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPricingRulePage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `pricing-rules:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createPricingRule",
        "summary": "Create a pricing rule",
        "description": "Adds a rule to the price list. It applies to new quotes and bookings at once; bookings already made keep the price they were made at.\n\n`adjustmentType` decides what the rule says: `absolute` states the hourly price outright (in `fixedAmountAdjustment`), `fixed` adds that amount per hour (negative for a discount), and `percentage` moves the price by `percentageAdjustment`, -100 to 100. Send only the field your type reads; the other is refused.\n\n`scopes` must be sent: it says which areas, coaches, clubs or class types the rule prices, and an empty list makes it apply to every one of them - so that has to be asked for. `conditions` narrow when it applies; every condition must hold. When several rules match one slot, the lowest `priority` wins; left out, a new rule goes one place after the last, so it never jumps ahead of the order staff set. Every id a rule names - in a scope, a `plan` condition or a `with-instructor` condition - must belong to this organization.\n\nA time-of-day condition (`weekdays-time`) is a price band by default: the booking is split at the band's edges and only the part inside it is priced by the rule. Set `match` to `start` or `within` to judge the whole booking instead. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Pricing Rules"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformPricingRuleCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Pricing rule created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPricingRule"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `pricing-rules:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/pricing-rules/quote": {
      "post": {
        "operationId": "quoteBookingPrice",
        "summary": "Quote a booking price",
        "description": "What a booking would cost, priced by the same calculator checkout uses: the resource's base rate, every pricing rule that applies, tax, and whether a membership the contact holds would cover it. Nothing is booked or held. Use it to check a rule does what was meant after writing it.\n\nName what is being booked with `areaId`, `instructorId` or `classId` (an area with an instructor prices an area booked with a coach). Pass `contactId` to price for a particular person - their plans unlock member rates and may cover the booking outright - or `planIds` to ask \"what would a holder of this plan pay?\" without naming anyone. `ignoreMembershipCoverage` quotes the list price even when a membership would cover it. `clubId` is the club the booking lands in, which only matters for a coach who works at every club.\n\nEvery id must belong to this organization. A booking is quoted for at most 24 hours.\n",
        "tags": [
          "Pricing Rules"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformPricingQuoteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The quoted price, with the rules that produced it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPricingQuote"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `pricing-rules:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/pricing-rules/{id}": {
      "get": {
        "operationId": "getPricingRule",
        "summary": "Get a pricing rule",
        "description": "One pricing rule, with its scopes and conditions.",
        "tags": [
          "Pricing Rules"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club pricing rule id"
          }
        ],
        "responses": {
          "200": {
            "description": "The pricing rule",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPricingRule"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `pricing-rules:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updatePricingRule",
        "summary": "Update a pricing rule",
        "description": "Edits a pricing rule. Send only what changes; an omitted field is left alone. `scopes` and `conditions` each **replace** the whole list when sent - read the rule first and send the list you want.\n\nA change to the adjustment is judged on the rule it produces: switching to `fixed` or `absolute` needs an amount (sent, or already stored), and switching to `percentage` needs the percentage in the same request. Renaming or switching off a rule is always allowed. The change applies to new quotes and bookings at once.\n",
        "tags": [
          "Pricing Rules"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club pricing rule id"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformPricingRuleUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated pricing rule",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPricingRule"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `pricing-rules:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deletePricingRule",
        "summary": "Delete a pricing rule",
        "description": "Removes a rule from the price list for good. New quotes and bookings stop using it at once; bookings already made keep the price they were made at. To take a rule out of use but keep it, set `isActive` to false instead.\n",
        "tags": [
          "Pricing Rules"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club pricing rule id"
          }
        ],
        "responses": {
          "204": {
            "description": "Pricing rule deleted"
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `pricing-rules:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/product-categories": {
      "get": {
        "operationId": "listProductCategories",
        "summary": "List product categories",
        "description": "Returns every product category in the organization, in display order - the tabs on the till and the sections of a shop page. Resolve a category here, then pass its `categoryId` when creating a product or filtering the catalogue.\n\nThere is no paging: an organization has a handful of these, and a caller composing a menu wants all of them.\n",
        "tags": [
          "Products"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Every product category, in display order",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformProductCategory"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `products:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createProductCategory",
        "summary": "Create a product category",
        "description": "Adds a product category. Omit `sortOrder` and it goes to the end of the list, which is what you want unless you are rebuilding the whole ordering. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Products"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 255
                  },
                  "sortOrder": {
                    "type": "integer",
                    "minimum": 0,
                    "description": "Display position; defaults to the end of the list"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Product category created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformProductCategory"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `products:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/product-categories/{id}": {
      "get": {
        "operationId": "getProductCategory",
        "summary": "Get a product category",
        "description": "Returns a single product category and how many products sit in it.",
        "tags": [
          "Products"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The product category",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformProductCategory"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `products:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateProductCategory",
        "summary": "Update a product category",
        "description": "Renames a category or moves it in the display order. Products in it are unaffected.",
        "tags": [
          "Products"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "minProperties": 1,
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 255
                  },
                  "sortOrder": {
                    "type": "integer",
                    "minimum": 0
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated product category",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformProductCategory"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `products:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/products": {
      "get": {
        "operationId": "listProducts",
        "summary": "List and search products",
        "description": "Returns the organization's products - everything it sells over the counter, from drinks to racket grips. `search` matches name and description as a substring, and `sku` and `barcode` exactly - a partial code matches nothing, since a scan code is only useful whole.\n\nUnlike plans, deactivated products are returned too: an integration managing a catalogue has to be able to find what it switched off in order to reprice or restore it. Filter with `isActive=true` for what is currently on sale.\n",
        "tags": [
          "Products"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string",
              "maxLength": 120
            },
            "description": "Substring of the name or description, or an exact SKU or barcode"
          },
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only products limited to this club"
          },
          {
            "in": "query",
            "name": "categoryId",
            "schema": {
              "type": "integer"
            },
            "description": "Only products in this product category"
          },
          {
            "in": "query",
            "name": "brandId",
            "schema": {
              "type": "integer"
            },
            "description": "Only products of this brand"
          },
          {
            "in": "query",
            "name": "isActive",
            "schema": {
              "type": "boolean"
            },
            "description": "Only products that are (or are not) on sale"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Page of products",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformProductPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `products:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createProduct",
        "summary": "Create a product",
        "description": "Adds a product to the catalogue. `name` and `price` are all that is required; everything else refines how it behaves at the till and on customer-facing surfaces.\n\n`clubId`, `categoryId`, `brandId`, `taxRateId` and `revenueAccountId` must reference rows in this organization - a `400` names the first one that does not. A `barcode` **or `sku`** already claimed by another product, package, plan or access card is a `409`: both are scannable at the till, so a scanned code has to mean exactly one thing.\n\nCreating a product does not give it stock - putting units on the shelf is done in the admin portal. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Products"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformProductCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Product created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformProduct"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `products:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "$ref": "#/components/responses/PlatformConflict"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/products/{id}": {
      "get": {
        "operationId": "getProduct",
        "summary": "Get a product",
        "description": "Returns a single product, including its price, cost price, category, and stock-keeping codes.",
        "tags": [
          "Products"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The product",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformProduct"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `products:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateProduct",
        "summary": "Update a product",
        "description": "Changes the fields you send and leaves the rest alone - nothing is required. Send `null` to clear a nullable field (`categoryId`, `barcode`, `costPrice`, ...); omit it to keep what is there. `images` and `features` are arrays and replace wholesale, so read the product first if you are adding to one.\n\nA `barcode` or `sku` is only checked for collisions when you actually send it, so re-saving a product without touching its codes never conflicts with itself.\n\nSet `isActive: false` to retire a product rather than deleting it - that keeps its sales history intact and takes it off the till.\n",
        "tags": [
          "Products"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformProductUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated product",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformProduct"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `products:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "$ref": "#/components/responses/PlatformConflict"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/products/{id}/availability": {
      "get": {
        "operationId": "getProductAvailability",
        "summary": "Get how many are left to sell",
        "description": "Returns the number of units of a product that can be sold right now at each club.\n\nThis is the only view of stock on this API - receiving deliveries, corrections and the ledger behind them stay in the admin portal. It is also not simply the shelf count: a product assembled from a recipe has no shelf, and its figure is the limit its scarcest ingredient imposes, floored to whole units.\n\n`available: null` means the product is not stock-tracked at that club, so the till will sell it freely - it does not mean the product has run out.\n",
        "tags": [
          "Products"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Per-club availability",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "productId": {
                      "type": "integer"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "clubId": {
                            "type": "integer"
                          },
                          "available": {
                            "type": "integer",
                            "nullable": true,
                            "description": "Units sellable now; null when the product is not stock-tracked at this club."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `products:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/programs": {
      "get": {
        "operationId": "listPrograms",
        "summary": "List programs",
        "description": "Returns the organization's programs - what a student joins, such as \"Kids BJJ (7-12)\" or \"Adult BJJ\". A program groups class types, and the sessions of its class types count toward its progression track. Resolve one here to fill in `programId` on a class type. There is no paging: an organization has a handful of these. Listed in their display order.\n",
        "tags": [
          "Classes"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Every program in the organization, in display order",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformProgram"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `classes:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createProgram",
        "summary": "Create a program",
        "description": "Adds a program. List the existing ones first - a club rarely wants two programs meaning the same thing. Then put class types in it by setting their `programId`. `slug` is optional and derived from the name when omitted, suffixed if that is taken; an explicit slug that clashes is a 409. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Classes"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformProgramCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Program created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformProgram"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `classes:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "An explicit `slug` is already used by another program",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/programs/{id}": {
      "get": {
        "operationId": "getProgram",
        "summary": "Get a program",
        "description": "Returns one program and how many class types it holds.",
        "tags": [
          "Classes"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The program",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformProgram"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `classes:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateProgram",
        "summary": "Update a program",
        "description": "Changes a program. Send only what changes; an omitted field is left alone, `null` clears a nullable one, and at least one field is required. Changing `progressionTrackId` changes which ranks the sessions of its class types count toward, for every member, back to their current rank's earned date. A rename leaves `slug` alone - it is a stable key a website link may already use.\n",
        "tags": [
          "Classes"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformProgramUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated program",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformProgram"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `classes:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "An explicit `slug` is already used by another program",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/progression-tracks": {
      "get": {
        "operationId": "listProgressionTracks",
        "summary": "List progression tracks",
        "description": "Returns the progression tracks the organization uses - its own and the global templates it has enabled - each a ladder of ranks in one discipline (a belt system, a swim-stage scheme). Pass its `id` as `progressionTrackId` when creating or updating a program to make the sessions of its class types count toward its ranks. With `includeTemplates=true` every global template is listed too, `enabled` saying which the organization uses.\n\nEach track lists the programs counting toward it in `programIds`, and their class types in `classTypeIds`. An empty list means every session counts; once any program with class types is linked, only sessions of those types do. There is no paging: an organization has a handful of these. Carries the `classes` scopes rather than one of its own.\n",
        "tags": [
          "Classes"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "includeTemplates",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            },
            "description": "Also list the global templates the organization has not enabled."
          }
        ],
        "responses": {
          "200": {
            "description": "The progression tracks",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformProgressionTrack"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `classes:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createProgressionTrack",
        "summary": "Create a progression track",
        "description": "Creates one of the organization's own tracks, with `name`, `sport` and usually its whole ladder in `levels`. Or pass a global template's id as `fromTemplateId` to copy it into the organization's own (what the dashboard's \"Customize\" does): the copy takes the template's levels, members' ranks on the template move onto the copy, programs linked to the template count toward the copy, and the template is disabled. Any other field sent changes the copy, except `levels`: the copy's levels have ids only once it exists, so change them with a PATCH. A save that is refused writes nothing. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Classes"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformProgressionTrackCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new track and its ladder",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformProgressionTrackDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `classes:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/progression-tracks/{id}": {
      "get": {
        "operationId": "getProgressionTrack",
        "summary": "Get a progression track",
        "description": "One track with its ladder, lowest rank first: each level's name, colour and the promotion requirement members meet at the rank below before they are eligible for it. Answers for a global template the organization has not enabled too, so it can be looked at before it is enabled or copied.\n",
        "tags": [
          "Classes"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The track and its ladder",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformProgressionTrackDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `classes:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateProgressionTrack",
        "summary": "Update a progression track",
        "description": "Changes one of the organization's own tracks. Send only what changes. A `levels` list is the whole ladder, lowest rank first: a level with an `id` is kept (only the fields it sends change), one without is added, and one left out is removed - refused with a 409 when members hold it. Removing a level drops its curriculum.\n\nA global template is read-only: the one field it takes is `enabled`, to start or stop using it. Disabling one members hold ranks on is a 409. To change a template, copy it with `fromTemplateId` on create.\n",
        "tags": [
          "Classes"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformProgressionTrackUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The track and its ladder",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformProgressionTrackDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `classes:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "A level left out of `levels` is held by members, or a template being disabled still has members ranked on it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/progression-tracks/{id}/members": {
      "get": {
        "operationId": "listProgressionTrackMembers",
        "summary": "List a track's members",
        "description": "Everyone whose current rank is on the track, lowest rank first, each with their level, stripes, the date they earned it and how close they are to the next rank against its promotion requirement. `levelId` narrows to one rank (\"every yellow belt\"); `eligibleOnly=true` to those who meet every requirement the next rank sets (\"who is eligible for grading\"). Archived contacts are left out. Requires `contacts:read`.\n",
        "tags": [
          "Contacts"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "levelId",
            "schema": {
              "type": "integer"
            },
            "description": "Only members whose current rank is this level of the track."
          },
          {
            "in": "query",
            "name": "eligibleOnly",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            },
            "description": "Only members who meet every requirement the next rank sets."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of the track's members",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTrackMemberPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/progression-tracks/{id}/ranks": {
      "post": {
        "operationId": "createProgressionTrackRank",
        "summary": "Give members a rank",
        "description": "Gives up to 100 members a rank on the track: one named `levelId` (with `stripes`), or `next: true` for each member's own next rank with stripes back to zero, as after a grading. `earnedOn` backdates it (a club recording belts it awarded before); it defaults to today. Each one is added to the member's timeline as the dashboard does, and a move forward tells the member unless `notifyMember` is false - send false when recording ranks members already hold. One member's failure never stops the rest: the result says who was ranked, skipped and failed. Requires `contacts:write`.\n",
        "tags": [
          "Contacts"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformProgressionRankRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Who was ranked, skipped and failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformProgressionRankResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/contacts/{contactId}/progression": {
      "get": {
        "operationId": "getContactProgression",
        "summary": "Get a contact's ranks",
        "description": "The member's current rank on each track the organization uses - level, stripes, the date it was earned and how close they are to the next rank - and their timeline of every rank and stripe recorded, latest earned first. Requires `contacts:read`.\n",
        "tags": [
          "Contacts"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "contactId",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The contact's ranks and timeline",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformContactProgression"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/promotions": {
      "get": {
        "operationId": "listPromotions",
        "summary": "List promotions",
        "description": "The organization's promotions, newest first: money off that a member reaches by typing its promo code or that applies itself at checkout (`autoApply`). A `discount` comes off what is bought, as a percentage or an amount (`discountFormat`); a `voucher` is an amount the member keeps as credit.\n\n`status` places a promotion in its date range: `scheduled` before it starts, `live` while it runs, `ended` after it ends.\n",
        "tags": [
          "Promotions"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string",
              "maxLength": 120
            },
            "description": "Match on the name or the promo code, case-insensitive"
          },
          {
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string",
              "enum": [
                "discount",
                "voucher"
              ]
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "scheduled",
                "live",
                "ended"
              ]
            },
            "description": "Only promotions at this point of their date range"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of promotions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPromotionPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `promotions:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createPromotion",
        "summary": "Create a promotion",
        "description": "Adds a promotion. A `discount` needs `discountFormat`: `percent` takes `value` off as a percentage (at most 100), `amount` takes `value` off in the organization's currency. A `voucher` is `value` in credit the member keeps, and has no `discountFormat`.\n\n`validFor` says what it applies to. Bookings qualify through `scopes` (`classes`, `areas`, `instructors`), narrowed by `classTypes`, `areaTypes`, `instructorTypes` and `clubIds`. A plan purchase qualifies only when named in `planIds`, or with `allPlans`. `segmentFilter` says who it is for (`{}` is everyone) and `conditions` when a booking qualifies.\n\nA member reaches it by typing its `code`, or it applies itself at checkout with `autoApply`, which only a discount can, and which needs a booking scope or named plans. It is live to members as soon as its dates allow. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Promotions"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformPromotionCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Promotion created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPromotion"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `promotions:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "$ref": "#/components/responses/PlatformConflict"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/promotions/{id}": {
      "get": {
        "operationId": "getPromotion",
        "summary": "Get a promotion",
        "description": "One promotion, with its promo code, dates and redemptions.",
        "tags": [
          "Promotions"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club promotion id"
          }
        ],
        "responses": {
          "200": {
            "description": "The promotion",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPromotion"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `promotions:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updatePromotion",
        "summary": "Update a promotion",
        "description": "Edits a promotion. Send only what changes; an omitted field is left alone. `validFor`, `segmentFilter` and `conditions` each **replace** the whole object when sent - read the promotion first and send the object you want. The change is judged on the promotion it produces, and applies to every purchase from then on; redemptions already made keep their amount. To stop a promotion, set `endsAt`.\n",
        "tags": [
          "Promotions"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club promotion id"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformPromotionUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated promotion",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPromotion"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `promotions:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "$ref": "#/components/responses/PlatformConflict"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deletePromotion",
        "summary": "Delete a promotion",
        "description": "Removes a promotion that was never redeemed. One that was is part of the revenue history and is refused with a 409: end it instead by setting `endsAt`.\n",
        "tags": [
          "Promotions"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club promotion id"
          }
        ],
        "responses": {
          "204": {
            "description": "Promotion deleted"
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `promotions:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "$ref": "#/components/responses/PlatformConflict"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/reports/revenue": {
      "get": {
        "operationId": "getRevenueReport",
        "summary": "Revenue report for a period",
        "description": "What the organization earned over a period, and from what, where and how it compares - in one request rather than a walk of the transactions list.\n\nRevenue is recognised ex-tax on the day of the sale, on the organization's own clock, net of refunds and of anything Wallet credit paid for. `collected` is the part of it already paid, on the same basis, so `uncollected` is what the period sold that has not been paid yet. These are the figures of the admin's daily revenue chart for the same days.\n\nThe period is compared with the neighbouring period of the same shape (`compare=previous_period`, the default): a calendar month with the month before, part of a month from its 1st with the same days of the month before, any other run of days with as many days just before it; or with the same dates a year earlier (`previous_year`). A period still running is compared with the same elapsed part of the other, both cut at the organization's today, and nothing is compared while its first day is not over (`comparison` is null). `comparison.from` / `to` are the compared days and `comparison.basis` the days of this period they were set against. Every breakdown row then carries its revenue in the compared period and the change, and `movers` lists the streams, clubs and items that moved most.\n\nBreakdowns: by revenue stream (`byStream`, every stream listed: `bookings` with their cancellation charges, `memberships`, `passes`, `drop_ins` including visits paid at the door, `products`, `external_programs` - the per-visit fee an external programme pays - `settlements` - revenue a partner collected outside 1club and reported as one sum - and `other`), by club (unless `clubId` narrows the report to one), by revenue account (unless `revenueAccountId` narrows it to one), by the payment method that collected the money, and the top items sold (a class or court, a plan, a product).\n\n`trend` buckets the period by day, week or month - by default up to 31 days by day, up to 90 by week, anything longer by month - and says which in `trend.granularity`; a week starts on the organization's first weekday, from its country (`trend.weekStartsOn`, 0 = Sunday), Monday without one.\n\nAmounts are in the organization's `currency`. Readable with `analytics:read`, as the admin's Revenue report is. A period may span at most 366 days. Reports have their own limit of 20 requests a minute, on top of the platform's.\n",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "from",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "First day of the period (`YYYY-MM-DD`), on the organization's clock."
          },
          {
            "in": "query",
            "name": "to",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Last day of the period, inclusive."
          },
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only the revenue of this club - its bookings, plans, check-ins and the sales rung up there."
          },
          {
            "in": "query",
            "name": "billingEntityId",
            "schema": {
              "type": "integer"
            },
            "description": "Only the revenue of this selling company, for an organization that trades through more than one."
          },
          {
            "in": "query",
            "name": "revenueAccountId",
            "schema": {
              "type": "integer"
            },
            "description": "Only the revenue filed to this account, e.g. coach time on a separate line from court hire. A sale stored with no account counts as the default account."
          },
          {
            "in": "query",
            "name": "compare",
            "schema": {
              "type": "string",
              "enum": [
                "previous_period",
                "previous_year",
                "none"
              ],
              "default": "previous_period"
            },
            "description": "What to compare the period with."
          },
          {
            "in": "query",
            "name": "granularity",
            "schema": {
              "type": "string",
              "enum": [
                "day",
                "week",
                "month"
              ]
            },
            "description": "How `trend` buckets the period. Chosen from the period's length when omitted."
          },
          {
            "in": "query",
            "name": "topItems",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 10
            },
            "description": "How many items `topItems` lists."
          },
          {
            "in": "query",
            "name": "charts",
            "schema": {
              "type": "string",
              "enum": [
                "none",
                "summary",
                "all"
              ],
              "default": "none"
            },
            "description": "Whether the answer carries pictures, as `chart` (and `moreCharts`) beside its figures - none (the default), the one chart of the answer, or every one. Opt-in, so a caller that never draws one pays nothing for it; the figures are the same either way."
          },
          {
            "in": "header",
            "name": "X-1Club-Chart-Image",
            "schema": {
              "type": "string",
              "enum": [
                "png"
              ]
            },
            "description": "Send `png` to have each picture carry its PNG (`png`, base64, at 2x) beside the SVG, for a client that shows images but does not draw SVG."
          }
        ],
        "responses": {
          "200": {
            "description": "The revenue report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformRevenueReport"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key lacks `analytics:read`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/reports/activity": {
      "get": {
        "operationId": "getActivityReport",
        "summary": "Activity report for a period",
        "description": "How busy the organization was over a period - bookings, check-ins, the people behind them and how full its classes, courts and coaches were - in one request rather than a count of the bookings and check-ins lists.\n\nThese are the figures of the admin's Historical dashboard for the same days. `bookings` are the bookings starting in the period and not cancelled (class seats, courts and rooms, sessions with a coach; the holds the platform places for a class's court and coach are no one's booking and are left out), `checkins` the check-ins on the day of the visit, and `visitors` the distinct contacts with either. Utilization is what was booked over what there was to fill across the whole period: class seats taken of the seats offered, and court, room and coach hours booked of the hours open. A cancelled class offers no seats.\n\nThe period is compared with the neighbouring period of the same shape (`compare=previous_period`, the default): a calendar month with the month before, part of a month from its 1st with the same days of the month before, any other run of days with as many days just before it; or with the same dates a year earlier (`previous_year`). A period still running is compared with the same elapsed part of the other, both cut at the organization's today, and nothing is compared while its first day is not over (`comparison` is null). `comparison.from` / `to` are the compared days and `comparison.basis` the days of this period they were set against. `trend` buckets the period by day, week or month - by default up to 31 days by day, up to 90 by week, anything longer by month; a week starts on the organization's first weekday, from its country (`trend.weekStartsOn`, 0 = Sunday), Monday without one - and `byWeekday` gives the average day of each weekday.\n\nDays are the club's own calendar days, on the organization's clock. A period may span at most 366 days. Reports have their own limit of 20 requests a minute, on top of the platform's.\n",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "from",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "First day of the period (`YYYY-MM-DD`), on the organization's own clock."
          },
          {
            "in": "query",
            "name": "to",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Last day of the period, inclusive."
          },
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only this club's bookings, check-ins and capacity."
          },
          {
            "in": "query",
            "name": "compare",
            "schema": {
              "type": "string",
              "enum": [
                "previous_period",
                "previous_year",
                "none"
              ],
              "default": "previous_period"
            },
            "description": "What to compare the period with."
          },
          {
            "in": "query",
            "name": "granularity",
            "schema": {
              "type": "string",
              "enum": [
                "day",
                "week",
                "month"
              ]
            },
            "description": "How `trend` buckets the period. Chosen from the period's length when omitted."
          },
          {
            "in": "query",
            "name": "charts",
            "schema": {
              "type": "string",
              "enum": [
                "none",
                "summary",
                "all"
              ],
              "default": "none"
            },
            "description": "Whether the answer carries pictures, as `chart` (and `moreCharts`) beside its figures - none (the default), the one chart of the answer, or every one. Opt-in, so a caller that never draws one pays nothing for it; the figures are the same either way."
          },
          {
            "in": "header",
            "name": "X-1Club-Chart-Image",
            "schema": {
              "type": "string",
              "enum": [
                "png"
              ]
            },
            "description": "Send `png` to have each picture carry its PNG (`png`, base64, at 2x) beside the SVG, for a client that shows images but does not draw SVG."
          }
        ],
        "responses": {
          "200": {
            "description": "The report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformActivityReport"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `analytics:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/reports/memberships": {
      "get": {
        "operationId": "getMembershipsReport",
        "summary": "Memberships report for a period",
        "description": "How the organization's memberships moved over a period: how many were added and cancelled, how many were active when it began and ended, and what share of those active at the start were cancelled in it - for recurring Memberships, Passes and Drop-Ins apart (`byKind`) and together (`totals`), and for the plans that moved most (`byPlan`).\n\n`added` counts the memberships created in the period, whatever became of them since, except a checkout still waiting for its first payment - the Memberships series of the admin's Historical dashboard. `cancelled` counts the cancellations recorded in the period, immediate or at the end of the paid period; one undone since is not counted. A membership is active at a moment when it has started, is not past its end date and has not been stopped (cancelled outright, or a Pass with every entry used); a paused membership is active, one still waiting for its first payment is not. Money is not here: what memberships earned is in the revenue report's `memberships`, `passes` and `drop_ins` streams.\n\nThe period is compared with the neighbouring period of the same shape (`compare=previous_period`, the default): a calendar month with the month before, part of a month from its 1st with the same days of the month before, any other run of days with as many days just before it; or with the same dates a year earlier (`previous_year`). A period still running is compared with the same elapsed part of the other, both cut at the organization's today, and nothing is compared while its first day is not over (`comparison` is null). `comparison.from` / `to` are the compared days and `comparison.basis` the days of this period they were set against. `trend` buckets the additions and cancellations by day, week or month - by default up to 31 days by day, up to 90 by week, anything longer by month; a week starts on the organization's first weekday, from its country (`trend.weekStartsOn`, 0 = Sunday), Monday without one. Days are the club's own calendar days, on the organization's clock. A period may span at most 366 days. Reports have their own limit of 20 requests a minute, on top of the platform's.\n",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "from",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "First day of the period (`YYYY-MM-DD`), on the organization's own clock."
          },
          {
            "in": "query",
            "name": "to",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Last day of the period, inclusive."
          },
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only the memberships held at this club: its own and the organization-wide ones, which hold at every club."
          },
          {
            "in": "query",
            "name": "compare",
            "schema": {
              "type": "string",
              "enum": [
                "previous_period",
                "previous_year",
                "none"
              ],
              "default": "previous_period"
            },
            "description": "What to compare the period with."
          },
          {
            "in": "query",
            "name": "granularity",
            "schema": {
              "type": "string",
              "enum": [
                "day",
                "week",
                "month"
              ]
            },
            "description": "How `trend` buckets the period. Chosen from the period's length when omitted."
          },
          {
            "in": "query",
            "name": "topPlans",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 10
            },
            "description": "How many plans `byPlan` lists."
          },
          {
            "in": "query",
            "name": "charts",
            "schema": {
              "type": "string",
              "enum": [
                "none",
                "summary",
                "all"
              ],
              "default": "none"
            },
            "description": "Whether the answer carries pictures, as `chart` (and `moreCharts`) beside its figures - none (the default), the one chart of the answer, or every one. Opt-in, so a caller that never draws one pays nothing for it; the figures are the same either way."
          },
          {
            "in": "header",
            "name": "X-1Club-Chart-Image",
            "schema": {
              "type": "string",
              "enum": [
                "png"
              ]
            },
            "description": "Send `png` to have each picture carry its PNG (`png`, base64, at 2x) beside the SVG, for a client that shows images but does not draw SVG."
          }
        ],
        "responses": {
          "200": {
            "description": "The report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformMembershipsReport"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `analytics:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/reports/members": {
      "get": {
        "operationId": "getMembersReport",
        "summary": "Members report for a period",
        "description": "The organization's customers over a period: how many Members (holding a recurring membership or season pass) and Drop-ins (holding a pass, or visiting, without one) it has now, with how many contacts hold each contact type (`current.byType`, leads and lapsed included), how many became a customer or a Member for the first time in the period, and how the counts moved.\n\n`newCustomers` is the admin Members dashboard's New customers: contacts who became a Member or a Drop-in for the first time, so a regular coming back after a quiet month is not new. `newMembers` is the same rule for Members alone, so a Drop-in taking their first membership counts. `trend` is the dashboard's growth chart, the counts at the end of each day, week or month: by the period's length unless `granularity` is given (up to 31 days by day, up to 90 by week, longer by month), with a week starting on `trend.weekStartsOn`, the organization's first weekday. When a period ends partway through a week or month, its last point is the count at the end of the period's last day. `ageBands` narrows the counts, the contact types, the new customers and the trend to the contacts in those bands on the period's last day (today for a period still running), leaving out those with no date of birth; `lifecycle` and `churn` stay organization-wide. With `contacts:read` as well, `lifecycle` adds the Customer lifecycle report's moves between contact types: upgrades, downgrades, lapses and win-backs, and `churn` adds its churn: the contacts whose recurring membership ended in the period with no other one following within `graceDays`, the `rate` among those active on the first day, and `reasons` for why they left. Pass and drop-in holders lapse rather than churn, so `churn` never counts them. `reasons` and `frozen` come from the membership status history, which began on the day it was introduced, so both are null for a period that ended before `historyFrom`; the figure itself is there for any period.\n\nOrganization-wide: a contact belongs to the organization, not to one of its clubs. Days are the club's own calendar days, on the organization's clock. A period may span at most 366 days. Reports have their own limit of 20 requests a minute, on top of the platform's.\n",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "from",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "First day of the period (`YYYY-MM-DD`), on the organization's own clock."
          },
          {
            "in": "query",
            "name": "to",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Last day of the period, inclusive."
          },
          {
            "in": "query",
            "name": "compare",
            "schema": {
              "type": "string",
              "enum": [
                "previous_period",
                "previous_year",
                "none"
              ],
              "default": "previous_period"
            },
            "description": "What to compare the period with."
          },
          {
            "in": "query",
            "name": "granularity",
            "schema": {
              "type": "string",
              "enum": [
                "day",
                "week",
                "month"
              ]
            },
            "description": "How `trend` steps through the period. When omitted, up to 31 days by day, up to 90 by week, longer by month."
          },
          {
            "in": "query",
            "name": "ageBands",
            "schema": {
              "type": "string"
            },
            "description": "Only the customers in these age bands, comma-separated. None is everyone."
          },
          {
            "in": "query",
            "name": "charts",
            "schema": {
              "type": "string",
              "enum": [
                "none",
                "summary",
                "all"
              ],
              "default": "none"
            },
            "description": "Whether the answer carries pictures, as `chart` (and `moreCharts`) beside its figures - none (the default), the one chart of the answer, or every one. Opt-in, so a caller that never draws one pays nothing for it; the figures are the same either way."
          },
          {
            "in": "header",
            "name": "X-1Club-Chart-Image",
            "schema": {
              "type": "string",
              "enum": [
                "png"
              ]
            },
            "description": "Send `png` to have each picture carry its PNG (`png`, base64, at 2x) beside the SVG, for a client that shows images but does not draw SVG."
          }
        ],
        "responses": {
          "200": {
            "description": "The report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformMembersReport"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `analytics:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/reports/definitions": {
      "get": {
        "operationId": "listMetricDefinitions",
        "summary": "What each report figure counts",
        "description": "Every metric the analytics reports define, with its family and the English sentence that says what it counts and what it does not: the definitions behind the info icons of the admin's report cards. Read one in full, in another language, with `GET /v1/platform/reports/definitions/{metric}`.\n\nA definition is not a figure, so this needs only `analytics:read`. It does not count against the reports' own rate limit.\n",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Every metric, by key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "metrics"
                  ],
                  "properties": {
                    "metrics": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "key",
                          "title",
                          "family",
                          "sentence"
                        ],
                        "properties": {
                          "key": {
                            "type": "string",
                            "example": "collected"
                          },
                          "title": {
                            "type": "string",
                            "example": "Collected"
                          },
                          "family": {
                            "type": "string",
                            "enum": [
                              "money",
                              "time",
                              "places",
                              "customers",
                              "email"
                            ]
                          },
                          "sentence": {
                            "type": "string",
                            "description": "What the metric counts in English."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `analytics:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/platform/reports/definitions/{metric}": {
      "get": {
        "operationId": "getMetricDefinition",
        "summary": "What one report figure counts",
        "description": "One metric's definition: the sentence that says what it counts and what it does not (in the asked language, English when none is asked), its family, the admin report pages that show it, and the rule of the platform's definitions it states. An unknown key is a 400 naming the nearest keys.\n\nA definition is not a figure, so this needs only `analytics:read`. It does not count against the reports' own rate limit.\n",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "metric",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The metric's key, from `GET /v1/platform/reports/definitions` (e.g. `collected`, `churnRate`)."
          },
          {
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string",
              "enum": [
                "en",
                "es",
                "fr",
                "de",
                "bg",
                "cs"
              ],
              "default": "en"
            },
            "description": "The language of `sentence`."
          }
        ],
        "responses": {
          "200": {
            "description": "The definition",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "key",
                    "title",
                    "family",
                    "sentence",
                    "locale",
                    "reports",
                    "rule"
                  ],
                  "properties": {
                    "key": {
                      "type": "string",
                      "example": "collected"
                    },
                    "title": {
                      "type": "string",
                      "description": "The metric's English name",
                      "example": "Collected"
                    },
                    "family": {
                      "type": "string",
                      "enum": [
                        "money",
                        "time",
                        "places",
                        "customers",
                        "email"
                      ]
                    },
                    "sentence": {
                      "type": "string",
                      "description": "What the metric counts."
                    },
                    "locale": {
                      "type": "string",
                      "enum": [
                        "en",
                        "es",
                        "fr",
                        "de",
                        "bg",
                        "cs"
                      ],
                      "description": "The language `sentence` is in."
                    },
                    "reports": {
                      "type": "array",
                      "description": "The admin report pages whose cards show it.",
                      "items": {
                        "type": "string",
                        "example": "/analytics/billing/dashboard"
                      }
                    },
                    "rule": {
                      "type": "object",
                      "nullable": true,
                      "description": "The written rule the sentence states, null where none is written yet.",
                      "required": [
                        "adr",
                        "section",
                        "title"
                      ],
                      "properties": {
                        "adr": {
                          "type": "string",
                          "example": "ADR 0053"
                        },
                        "section": {
                          "type": "string",
                          "example": "Money"
                        },
                        "title": {
                          "type": "string",
                          "example": "Collected"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `analytics:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/platform/revenue-accounts": {
      "get": {
        "operationId": "listRevenueAccounts",
        "summary": "List revenue accounts",
        "description": "Returns the organization's chart of accounts, ordered by code. This is how a `revenueAccountId` is resolved before creating or updating a membership plan or a product - a sale of that item then posts to the account named here.\n\nAdding or renaming an account changes how every future sale is reported and what the club's accountant reconciles against, so the writes are gated on `revenue-accounts:write`, which nothing else grants. There is no delete: every historical row pointing at an account would be stranded, so an account is taken out of use with `isActive: false`.\n\nRetired accounts are included, flagged with `isActive: false`: an existing plan or product may still point at one, so the id has to stay explicable. Do not attach one to something new.\n\nReadable with any scope that carries a revenue account id: the `plans`, `products`, `classes`, `areas` and `instructors` scopes (read *and* write - they are granted independently), plus `transactions:read` and `revenue-accounts:write`. Every one of those resources either reports `revenueAccountId` or accepts it, so requiring one scope in particular would leave a key able to set an account it cannot look up. There is no `revenue-accounts:read`.\n\nLeaving `revenueAccountId` unset is a valid choice: the sale then posts to whichever account the organization has marked `isDefault`, resolved at the time of the sale rather than frozen onto the item.\n",
        "tags": [
          "Revenue Accounts"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Every revenue account, ordered by code",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformRevenueAccount"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key holds no scope that carries a revenue account id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createRevenueAccount",
        "summary": "Create a revenue account",
        "description": "Adds an account to the chart of accounts. `code` is what the club's bookkeeper reconciles against and must be free within the organization - a clash is a 409, not a second account under the same code.\n\nSending `isDefault: true` moves the default off whichever account currently holds it, in the same transaction and behind a per-organization lock, so concurrent promotions cannot both win. The default is where a sale posts when the item names no account, resolved at the time of the sale rather than frozen onto the item, so moving it changes where future unattributed sales land and leaves the ones already taken alone.\n\nTwo things about the default are decided for you. An organization whose chart has no default yet gets one from this call whatever `isDefault` says, since creating an account is the only way to give it one - so the first account in an empty chart is always the default, and is therefore always created active. And a default can never be inactive, so `isActive: false` is refused for any request that would land one, whether `isDefault` was sent or inferred.\n\nRequires `revenue-accounts:write`. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Revenue Accounts"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformRevenueAccountCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Revenue account created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformRevenueAccount"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `revenue-accounts:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "Another account in this organization already uses that `code`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/revenue-accounts/{id}": {
      "get": {
        "operationId": "getRevenueAccount",
        "summary": "Get a revenue account",
        "description": "Returns one account from the chart of accounts, retired ones included. Readable with any scope that carries an account id, exactly as the list is - including `revenue-accounts:write`, so a key that maintains the chart can read back what it wrote.\n",
        "tags": [
          "Revenue Accounts"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The revenue account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformRevenueAccount"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key holds no scope that carries a revenue account id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateRevenueAccount",
        "summary": "Update a revenue account",
        "description": "Changes an account. Send only what changes; an omitted field is left alone, and at least one field is required.\n\nThree things this will refuse. A `code` another account already uses is a 409. `isDefault: false` on the *last* account holding the default is a 400: an organization with no default has nowhere to post a sale that names no account. (An organization carrying more than one default - possible from before these rules, or from a clone - can have the extras cleared, which is how that state is repaired.) And anything that would leave the default inactive - retiring the current default, or promoting a retired account - is a 400, because the readers that resolve the default match on `isDefault` alone and would go on posting sales to an account this API calls retired. Move the default onto another account first, or reactivate and promote in the same call.\n\nRetiring an account (`isActive: false`) is otherwise how one is taken out of use. Everything already pointing at it keeps pointing at it - the flag is what tells a caller not to attach it to something new.\n\nRequires `revenue-accounts:write`.\n",
        "tags": [
          "Revenue Accounts"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformRevenueAccountUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated revenue account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformRevenueAccount"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `revenue-accounts:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "Another account in this organization already uses that `code`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/setup-checklist": {
      "get": {
        "operationId": "getSetupChecklist",
        "summary": "Get the club setup checklist",
        "description": "The steps the organization takes to go live, in seven stages (club, spaces, sales, marketing, members, experience, launch). The spaces stage follows its kind of club (`journey`: racket, gym, studio, martial-arts, climbing, wellness, or general); the rest are the same for every club. An independent coach's organization (`professional`) has its own steps in every stage and no members stage. An `optional` step is left out of `completed` and `total`. Each step is `done` when the organization's data shows it or someone marked it done, `skipped` when someone marked it not needed, and `todo` otherwise; `mark` is what was set by hand. Each step carries the admin page it is done on (`pageUrl`, a full address; `page`, the same as a path) and its guide (`guide`, a docs.1club.ai URL). Requires `clubs:read`.\n",
        "tags": [
          "Setup"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The setup checklist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "journey": {
                      "type": "string",
                      "enum": [
                        "racket",
                        "gym",
                        "studio",
                        "martial-arts",
                        "climbing",
                        "wellness",
                        "general",
                        "professional"
                      ]
                    },
                    "completed": {
                      "type": "integer",
                      "description": "Steps done or skipped"
                    },
                    "total": {
                      "type": "integer"
                    },
                    "groups": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string",
                            "enum": [
                              "club",
                              "spaces",
                              "sales",
                              "marketing",
                              "members",
                              "experience",
                              "launch"
                            ]
                          },
                          "items": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "key": {
                                  "type": "string",
                                  "example": "court_format"
                                },
                                "state": {
                                  "type": "string",
                                  "enum": [
                                    "done",
                                    "todo",
                                    "skipped"
                                  ]
                                },
                                "mark": {
                                  "type": "string",
                                  "enum": [
                                    "done",
                                    "skipped"
                                  ],
                                  "nullable": true
                                },
                                "optional": {
                                  "type": "boolean"
                                },
                                "page": {
                                  "type": "string",
                                  "example": "/settings/clubs/area-types"
                                },
                                "pageUrl": {
                                  "type": "string",
                                  "example": "https://admin.1club.ai/settings/clubs/area-types"
                                },
                                "guide": {
                                  "type": "string",
                                  "example": "https://docs.1club.ai/settings/areas"
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `clubs:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/setup-checklist/steps/{step}": {
      "put": {
        "operationId": "updateSetupChecklistStep",
        "summary": "Mark a setup step",
        "description": "Marks one step of the setup checklist `done` (for a step the data cannot show, or one done elsewhere) or `skipped` (not needed at this club), or clears the mark with `null`. A step the data shows done stays done whatever is marked. Applies at once for everyone in the organization. Answers with the whole checklist. Requires `organization:write`.\n",
        "tags": [
          "Setup"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "step",
            "required": true,
            "schema": {
              "type": "string",
              "example": "external_programs"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "mark"
                ],
                "properties": {
                  "mark": {
                    "type": "string",
                    "enum": [
                      "done",
                      "skipped"
                    ],
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The setup checklist after the change"
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `organization:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/shift-rotation-assignments": {
      "get": {
        "operationId": "listShiftRotationAssignments",
        "summary": "List rotation assignments",
        "description": "Returns which coach is on which rotation, and over which days.",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "instructorId",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "rotationId",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The assignments",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformShiftRotationAssignment"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createShiftRotationAssignment",
        "summary": "Assign a coach to a rotation",
        "description": "Puts a coach on a rotation from `effectiveFrom` (to `effectiveTo`, or open-ended) and materializes their shifts on the staff roster: to the end date, or eight weeks ahead for an open-ended assignment, extended nightly. From then on the coach is bookable only within those shifts. A coach is on one rotation at a time: dates overlapping another of their assignments are refused with a 409.\n",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "instructorId",
                  "rotationId",
                  "effectiveFrom"
                ],
                "properties": {
                  "instructorId": {
                    "type": "integer"
                  },
                  "rotationId": {
                    "type": "integer"
                  },
                  "cycleOffset": {
                    "type": "integer",
                    "description": "Zero-based week of the cycle the coach starts on. Defaults to 0."
                  },
                  "effectiveFrom": {
                    "type": "string",
                    "format": "date"
                  },
                  "effectiveTo": {
                    "type": "string",
                    "format": "date",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The assignment, and the shifts it generated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformShiftRotationAssignmentResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "The coach already has an assignment overlapping these dates; `details.assignmentId` names it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/shift-rotation-assignments/{id}": {
      "patch": {
        "operationId": "updateShiftRotationAssignment",
        "summary": "Update a rotation assignment",
        "description": "Moves the coach to another rotation, shifts where in the cycle they start, or changes the dates, then regenerates their staff roster. Shifts edited by hand are left as they are.\n",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "minProperties": 1,
                "properties": {
                  "rotationId": {
                    "type": "integer"
                  },
                  "cycleOffset": {
                    "type": "integer"
                  },
                  "effectiveFrom": {
                    "type": "string",
                    "format": "date"
                  },
                  "effectiveTo": {
                    "type": "string",
                    "format": "date",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The assignment, and the shifts it generated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformShiftRotationAssignmentResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "The new dates overlap another of the coach's assignments",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteShiftRotationAssignment",
        "summary": "Remove a rotation assignment",
        "description": "Takes the coach off the rotation and removes the shifts it generated. Shifts edited or added by hand stay on the staff roster.\n",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Removed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/shift-rotations": {
      "get": {
        "operationId": "listShiftRotations",
        "summary": "List shift rotations",
        "description": "Returns the weekly shift patterns coaches are assigned to. A rotation is one to twelve weeks long; each slot puts a shift template on one weekday of one week of the cycle, and a day with no slot is a day off.\n",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only rotations for this club, and those for every club"
          },
          {
            "in": "query",
            "name": "includeInactive",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The organization's rotations",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformShiftRotation"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createShiftRotation",
        "summary": "Create a shift rotation",
        "description": "Adds a weekly shift pattern. Nobody works it until a coach is assigned with `POST /v1/platform/shift-rotation-assignments`.\n",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/PlatformShiftRotationWrite"
                  },
                  {
                    "type": "object",
                    "required": [
                      "name",
                      "cycleWeeks"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created rotation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformShiftRotation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/shift-rotations/{id}": {
      "get": {
        "operationId": "getShiftRotation",
        "summary": "Get a shift rotation",
        "description": "Returns one rotation with its full pattern - which shift template falls on which weekday of each week of the cycle.",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The rotation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformShiftRotation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateShiftRotation",
        "summary": "Update a shift rotation",
        "description": "Send only what changes; `slots`, when sent, replaces the whole pattern. The staff roster of every coach on the rotation is regenerated from the new pattern, leaving shifts edited by hand as they are.\n",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformShiftRotationWrite"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated rotation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformShiftRotation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteShiftRotation",
        "summary": "Delete a shift rotation",
        "description": "Refused with a 409 while any coach is still assigned to it; remove the assignments first.",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "$ref": "#/components/responses/PlatformConflict"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/shift-templates": {
      "get": {
        "operationId": "listShiftTemplates",
        "summary": "List shift templates",
        "description": "Returns the named shifts the staff roster is built from (\"Morning, 06:00-14:00\", with its breaks). A template's times are the wall clock of the club the shift is worked at. Inactive templates are left out unless asked for.\n",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only templates for this club, and those for every club"
          },
          {
            "in": "query",
            "name": "includeInactive",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The organization's shift templates",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformShiftTemplate"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createShiftTemplate",
        "summary": "Create a shift template",
        "description": "Adds a named shift with its breaks. On its own it puts nobody to work: place it on the days of a rotation, then assign coaches to the rotation.\n",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/PlatformShiftTemplateWrite"
                  },
                  {
                    "type": "object",
                    "required": [
                      "name",
                      "startTime",
                      "endTime"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created template",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformShiftTemplate"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/shift-templates/{id}": {
      "get": {
        "operationId": "getShiftTemplate",
        "summary": "Get a shift template",
        "description": "Returns one shift template with its breaks, on the wall clock of the club it is worked at.",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The shift template",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformShiftTemplate"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateShiftTemplate",
        "summary": "Update a shift template",
        "description": "Send only what changes; `breaks`, when sent, replaces the whole set. Shifts already on the staff roster keep the times they were generated with until their rotation is next regenerated.\n",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformShiftTemplateWrite"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated template",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformShiftTemplate"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteShiftTemplate",
        "summary": "Delete a shift template",
        "description": "Deletes the template, or, when a rotation still places it on a day, deactivates it instead so that rotation keeps its pattern; `deactivated` says which happened.\n",
        "tags": [
          "Staff Roster"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted, or deactivated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "deactivated": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlatformForbidden"
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/staff": {
      "get": {
        "operationId": "getStaff",
        "summary": "List staff",
        "description": "Everyone with access to the organization's admin portal, with their role (`admin`, `manager`, `front_desk`, `sales` or `instructor`) and whether they are an owner. Members are not listed. Requires `staff:read`.\n",
        "tags": [
          "Staff"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The organization's staff",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformStaffMember"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `staff:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/staff/{userId}/role": {
      "patch": {
        "operationId": "updateStaffRole",
        "summary": "Change a staff member's role",
        "description": "Gives a member of staff another role: admin in every club, or a staff role in the clubs `clubIds` names. Saved exactly as the admin's Edit dialog saves it, with the same limits: nobody changes their own role, a manager may act only on roles below manager and promote up to manager, only someone who may assign admin may make an owner, and the last owner stays an owner. Takes effect when the person's session next refreshes. Requires `staff:write`. Only a person can make this change - an OAuth connection or the in-app assistant, never an API key, which is refused with a 403 whatever scopes it holds.\n",
        "tags": [
          "Staff"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "role"
                ],
                "properties": {
                  "role": {
                    "type": "string",
                    "enum": [
                      "admin",
                      "manager",
                      "front_desk",
                      "sales",
                      "instructor"
                    ]
                  },
                  "isOwner": {
                    "type": "boolean",
                    "description": "Make (or keep) them an owner. Only with role admin."
                  },
                  "clubIds": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "integer"
                    },
                    "description": "The clubs a manager, front_desk, sales or instructor role applies in; any other club loses their role. Left out, the clubs they already work in, or the organization's only club. Ignored for admin."
                  },
                  "preserveInstructorCapability": {
                    "type": "boolean",
                    "description": "When making an instructor an admin, keep their instructor profile so they stay bookable. Without it the profile is deactivated."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The member of staff with their new role",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/PlatformStaffMember"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "instructorStatus": {
                          "type": "string",
                          "nullable": true,
                          "enum": [
                            "reactivated",
                            "deactivated",
                            "preserved",
                            "unchanged",
                            null
                          ],
                          "description": "What happened to their instructor profile, or null when neither role is instructor"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "Missing `staff:write`, an API key, or a change the acting person's own role does not allow",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "Making them an instructor needs their instructor profile first; the role was not changed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/role-permissions": {
      "get": {
        "operationId": "listRolePermissions",
        "summary": "Get role permissions",
        "description": "What each staff role is allowed to do, as permissions that read `module.action.scope` (`booking.update.standard`), with whether the organization has changed the role from its default; and the catalog of permissions a role can be given. `manage` includes every other action on its module, and `organization` scope includes `club`, which includes `own`. Requires `staff:read`.\n",
        "tags": [
          "Staff"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Each role's permissions, and the catalog",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformRolePermissions"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `staff:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/role-permissions/{role}": {
      "patch": {
        "operationId": "updateRolePermission",
        "summary": "Change a role's permissions",
        "description": "Grants and revokes permissions on the manager, front desk or instructor role, keeping the rest of what it holds; the admin role always holds everything. Only permissions in the catalog can be granted. Applies to everyone with the role when their session next refreshes. Requires `staff:write`, and a person who may edit permissions in 1club (an admin or an owner). Only a person can make this change - an OAuth connection or the in-app assistant, never an API key.\n",
        "tags": [
          "Staff"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "role",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "manager",
                "front_desk",
                "sales",
                "instructor"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "grant": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Permissions to add, e.g. \"billing.read.standard\""
                  },
                  "revoke": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Permissions to take away"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The role's permissions after the change",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformRolePermissionSet"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "Missing `staff:write`, an API key, or a person who may not edit permissions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteRolePermission",
        "summary": "Reset a role's permissions",
        "description": "Puts the manager, front desk or instructor role back to 1club's default permissions, dropping every change the organization made to it. Requires `staff:write`, and a person who may edit permissions. Only a person can make this change - an OAuth connection or the in-app assistant, never an API key.\n",
        "tags": [
          "Staff"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "role",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "manager",
                "front_desk",
                "sales",
                "instructor"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The role's default permissions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformRolePermissionSet"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "Missing `staff:write`, an API key, or a person who may not edit permissions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/tags": {
      "get": {
        "operationId": "listTags",
        "summary": "List tags",
        "description": "Every tag the organization uses, by name, with how many contacts carry each. `type` says who applies it: `manual` tags are put on by people; `system` (smart) tags by the tagging engine from the organization's smart tag rules; `interest` tags from what a person books. The smart tags of a category the organization has switched off are left out, since nobody carries them. Requires `contacts:read`.\n",
        "tags": [
          "Tags"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string",
              "enum": [
                "manual",
                "system",
                "interest"
              ]
            },
            "description": "Only tags of this type"
          }
        ],
        "responses": {
          "200": {
            "description": "The organization's tags, by name",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformTag"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createTag",
        "summary": "Create a tag",
        "description": "Adds a manual tag, which staff can then put on contacts. A name another manual tag already has is a 409. Requires `contacts:write`. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Tags"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformTagWrite"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Tag created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTag"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "A manual tag with that name already exists",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/tags/{id}": {
      "patch": {
        "operationId": "updateTag",
        "summary": "Update a tag",
        "description": "Renames a manual tag or changes its colour. Contacts carrying it keep it under the new name. Smart and interest tags are not changed here: they are named in the smart tag rules. Requires `contacts:write`.\n",
        "tags": [
          "Tags"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformTagWrite"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The tag as saved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTag"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "Another manual tag already has that name",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteTag",
        "summary": "Delete a tag",
        "description": "Deletes a manual tag and takes it off every contact carrying it. Not undone by creating the tag again: the contacts would have to be tagged again. Requires `contacts:delete`.\n",
        "tags": [
          "Tags"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Tag deleted"
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:delete` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/contact-tags/add": {
      "post": {
        "operationId": "createContactTagAdd",
        "summary": "Tag contacts",
        "description": "Puts tags on up to 100 contacts, keeping every tag they already carry. Name a tag by id or by name; a name no tag has is created as a manual tag. Smart and interest tags are refused: the tagging engine applies them from the organization's rules and would undo a hand-made change. Answers with each contact's tags as they now stand. Requires `contacts:write`.\n",
        "tags": [
          "Tags"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformContactTagsChange"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Each contact's tags after the change",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformContactTagsResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/contact-tags/remove": {
      "post": {
        "operationId": "createContactTagRemove",
        "summary": "Untag contacts",
        "description": "Takes tags off up to 100 contacts, keeping the rest. A contact not carrying a tag is left as it is; a name no tag has is a 400. Smart and interest tags are refused, as when adding. Requires `contacts:write`.\n",
        "tags": [
          "Tags"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformContactTagsChange"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Each contact's tags after the change",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformContactTagsResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/smart-tag-settings": {
      "get": {
        "operationId": "listSmartTagSettings",
        "summary": "Get smart tag rules",
        "description": "The rules the tagging engine applies smart tags by, per category: whether the category is on, and each tag's id, name, colour and threshold (for example a lifecycle tag's `minDays`, an engagement tag's `minVisits` over `period` days). A category the organization never saved shows its defaults. Requires `contacts:read`.\n",
        "tags": [
          "Tags"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The smart tag rules",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformSmartTagSettings"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateSmartTagSettings",
        "summary": "Update smart tag rules",
        "description": "Changes some categories of the smart tag rules and keeps the rest. Each category sent is merged field by field into the organization's, so `{ \"engagement\": { \"enabled\": true } }` switches one category on; a `tags` list sent replaces that category's list, so read the rules first and send the whole list back with your edits. A tag keeps its `id` across a rename. Contacts are re-tagged by the next tagging pass, not at once. Requires `contacts:write`.\n",
        "tags": [
          "Tags"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformSmartTagSettings"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The smart tag rules as saved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformSmartTagSettings"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/templates": {
      "get": {
        "operationId": "listTemplates",
        "summary": "List message templates",
        "description": "The organization's reusable message templates, by name. Deleted templates are not listed.\n\n`type` says where a template is used and so which `{{variables}}` it may contain: a `message` template is applied in the message composer, a `transactional` one is sent by automations and system emails. A template with a `systemTemplateKey` is the organization's own copy of one of the emails 1club sends on its behalf (see `GET /v1/platform/templates/system`), and is what gets sent instead of the built-in version. `receipt` is a legacy type: listed where it exists, never created.\n",
        "tags": [
          "Templates"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string",
              "enum": [
                "message",
                "transactional",
                "receipt"
              ]
            },
            "description": "Only templates of this type"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of templates",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTemplatePage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `templates:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createTemplate",
        "summary": "Create a message template",
        "description": "Creates a reusable template. `type` defaults to `message` (applied in the message composer); `transactional` is for automations. Every `{{variable}}` in the subject, preview text and body must be one the type resolves - see `GET /v1/platform/templates/variables` - or the write is a 400 with code `TEMPLATE_VARIABLE_NOT_ALLOWED` naming the offenders and the allowed set.\n\n`content` is a string (HTML, or plain text with `contentType: text`) or `{ html }` / `{ blocks }` in the block editor's format. An HTML block over the email size limit is a 400 (`CONTENT_TOO_LARGE`), and so is a button whose link has a `{{variable}}` inside the address rather than as the whole address (`LINK_HAS_BURIED_VARIABLE`).\n\nCustomizing templates is not available on the Free plan (403, code `PLAN_FEATURE_LOCKED`). To customize a system email, use `POST /v1/platform/templates/system/{key}/copy` instead. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Templates"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformTemplateCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Template created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTemplate"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `templates:write` scope, or the organization's plan does not include customizing templates (code `PLAN_FEATURE_LOCKED`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/templates/variables": {
      "get": {
        "operationId": "listTemplateVariables",
        "summary": "List the variables a template may use",
        "description": "The `{{variables}}` a template may contain, each with what it expands to. Which variables exist depends on what renders the copy, so ask for one of: a template `type` (what an org-authored template of that type resolves), or a `systemTemplateKey` (what that system email's renderer supplies - the variables the organization's copy of it may use).\n\nA write that uses any other variable is refused with code `TEMPLATE_VARIABLE_NOT_ALLOWED`: an unresolved variable would reach the recipient as the literal text `{{name}}`.\n",
        "tags": [
          "Templates"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string",
              "enum": [
                "message",
                "transactional",
                "receipt"
              ]
            },
            "description": "The template type. Send this or `systemTemplateKey`."
          },
          {
            "in": "query",
            "name": "systemTemplateKey",
            "schema": {
              "type": "string"
            },
            "description": "A key from `GET /v1/platform/templates/system`. Send this or `type`."
          }
        ],
        "responses": {
          "200": {
            "description": "The variables",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformTemplateVariable"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `templates:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/templates/system": {
      "get": {
        "operationId": "listSystemTemplates",
        "summary": "List the customizable system emails",
        "description": "The emails 1club sends on the organization's behalf that it may replace with its own copy - a booking confirmation, a payment confirmation, a welcome email. `hasOverride` says whether the organization already has its own copy, and `overrideTemplateId` is that template's id: read or edit it with the template endpoints. Without one, the built-in email is sent.\n\nTo start a copy, `POST /v1/platform/templates/system/{key}/copy`.\n",
        "tags": [
          "Templates"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The customizable system emails",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformSystemTemplate"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `templates:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/templates/system/{key}/copy": {
      "post": {
        "operationId": "copySystemTemplate",
        "summary": "Customize a system email",
        "description": "Creates the organization's own copy of a system email, seeded with the built-in subject, preview text and body blocks. From then on the copy is what gets sent; edit it with `PATCH /v1/platform/templates/{id}`, and delete it to go back to the built-in email.\n\nThere is one copy per email: asking again is a 409 with code `TEMPLATE_OVERRIDE_EXISTS`, carrying the existing copy's id as `details.templateId`. Customizing templates is not available on the Free plan (403, code `PLAN_FEATURE_LOCKED`). Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Templates"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "key",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "A system email key from `GET /v1/platform/templates/system`"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 255,
                    "description": "Name for the copy. Defaults to the system email's name."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The organization's copy, as a template",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTemplate"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `templates:write` scope, or the organization's plan does not include customizing templates (code `PLAN_FEATURE_LOCKED`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "409": {
            "description": "The organization already has its copy of this email (code `TEMPLATE_OVERRIDE_EXISTS`, its id in `details.templateId`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/templates/{id}": {
      "get": {
        "operationId": "getTemplate",
        "summary": "Get a message template",
        "description": "One template, with its whole body. A deleted template is a 404.",
        "tags": [
          "Templates"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Template id"
          }
        ],
        "responses": {
          "200": {
            "description": "The template",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTemplate"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `templates:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateTemplate",
        "summary": "Update a message template",
        "description": "Edits a template. Send only what changes; an empty body is a 400. `content` replaces the whole body when sent. `subject` or `previewText` set to null clears it.\n\nVariables are checked against the type the template will have: the fields you send when the type stays, the whole template when it changes. The type of an organization's copy of a system email cannot change (`TEMPLATE_TYPE_LOCKED`). Editing the body does not touch the per-locale copies managed in the admin portal. Not available on the Free plan (403, code `PLAN_FEATURE_LOCKED`).\n",
        "tags": [
          "Templates"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Template id"
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlatformTemplateUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated template",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTemplate"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `templates:write` scope, or the organization's plan does not include customizing templates (code `PLAN_FEATURE_LOCKED`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteTemplate",
        "summary": "Delete a message template",
        "description": "Removes a template: it is no longer listed or offered, while messages already sent from it keep their record of it. Deleting the organization's copy of a system email puts the built-in email back in use. Allowed on every plan.\n",
        "tags": [
          "Templates"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Template id"
          }
        ],
        "responses": {
          "204": {
            "description": "Template deleted"
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `templates:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/transactions": {
      "get": {
        "operationId": "listTransactions",
        "summary": "List transactions for the organization",
        "description": "Returns transactions for the organization associated with the API token, filtered by transaction creation time and ordered by `createdAt` descending, then by id. Each bound is an ISO date-time, or a bare `YYYY-MM-DD` read as midnight UTC. `startDate` is inclusive and `endDate` is exclusive. When both are omitted, the window defaults to the last 24 hours (`endDate = now`, `startDate = now - 24h`); when only one is given, the other is derived from that same 24-hour span.\n\nA single request may span at most 93 days. Cover a longer range in consecutive windows, passing the previous window's `endDate` as the next one's `startDate` - because the upper bound is exclusive, that chains without counting a boundary transaction twice.\n\nFiltering by `contactId`, `bookingId` or `membershipId` lists that record's transactions. With one of those and no `startDate`/`endDate`, there is no window at all: every transaction of the contact, booking or membership comes back, newest first. Send a bound to window it as usual.\n\nNote that this endpoint returns a bare array with no total - a full page (`limit` rows) means there are probably more, so keep advancing `offset` until a short page comes back.\n\nOrdering is total (`createdAt` descending, then id), so `offset` paging is well defined for a fixed set of rows. It is not stable against concurrent writes: rows are ordered newest first, so a transaction created part-way through a walk lands on the first page and shifts every later row down by one, which can push an unread row past an `offset` already passed. Pass an explicit `endDate` in the past rather than relying on the `now` default - anything written after it falls outside the window and cannot shift the pages underneath you.\n",
        "tags": [
          "Transactions"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "startDate",
            "schema": {
              "type": "string"
            },
            "description": "Inclusive lower bound on transaction `createdAt`, as an ISO date-time or `YYYY-MM-DD`. Defaults to `endDate - 24h`, or to no bound when filtering by contact, booking or membership."
          },
          {
            "in": "query",
            "name": "endDate",
            "schema": {
              "type": "string"
            },
            "description": "Exclusive upper bound on transaction `createdAt`, as an ISO date-time or `YYYY-MM-DD`. Defaults to `now`, or to no bound when filtering by contact, booking or membership."
          },
          {
            "in": "query",
            "name": "paymentStatus",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "paid",
                "void",
                "failed",
                "settled",
                "overdue",
                "partially_paid",
                "refunded",
                "cancelled"
              ]
            },
            "description": "Filter by payment status. When omitted, all statuses are returned."
          },
          {
            "in": "query",
            "name": "contactId",
            "schema": {
              "type": "integer"
            },
            "description": "Only transactions charged to this contact (the payer). Lifts the default window when no date bound is sent."
          },
          {
            "in": "query",
            "name": "bookingId",
            "schema": {
              "type": "integer"
            },
            "description": "Only this booking's transactions - its charge, and any cancellation credit against it. Lifts the default window when no date bound is sent."
          },
          {
            "in": "query",
            "name": "membershipId",
            "schema": {
              "type": "integer"
            },
            "description": "Only this membership's transactions - its sale, renewals, signup fee and adjustments. Lifts the default window when no date bound is sent."
          },
          {
            "in": "query",
            "name": "transactionType",
            "schema": {
              "type": "string",
              "enum": [
                "booking_creation",
                "booking_cancellation",
                "membership_creation",
                "membership_recurrence",
                "membership_signup_fee",
                "membership_price_adjustment",
                "membership_cancellation",
                "membership_early_cancellation",
                "product_sale",
                "external_program_entry",
                "checkin_creation",
                "settlement"
              ]
            },
            "description": "Only transactions of this kind."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 100
            },
            "description": "Maximum number of transactions to return."
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "Number of transactions to skip."
          }
        ],
        "responses": {
          "200": {
            "description": "List of transactions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PlatformTransaction"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid query parameters (e.g. malformed date, window > 93 days)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "API key is missing the required `transactions:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createTransaction",
        "summary": "Record a settlement",
        "description": "Records revenue you collected outside 1club as one sum for a club - for example a period's takings for bookings you recorded at 0. It is a paid transaction of type `settlement` on the club, settled against your key's payment method, and counts in the club's revenue under the revenue account you name. It is not split across bookings or customers.\n\n`amount` is what customers paid, tax included; the tax is taken out at the revenue account's rate. A `payment.reference` your key already recorded is refused with `409 DUPLICATE_REFERENCE` (`details.transactionId` names the existing one). No receipt is sent. Supports the `Idempotency-Key` header.\n",
        "tags": [
          "Transactions"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "clubId",
                  "date",
                  "amount",
                  "revenueAccountId",
                  "payment"
                ],
                "properties": {
                  "clubId": {
                    "type": "integer"
                  },
                  "contactId": {
                    "type": "integer",
                    "description": "The customer the whole sum belongs to, if there is one."
                  },
                  "date": {
                    "type": "string",
                    "format": "date",
                    "description": "The day it is reported on."
                  },
                  "amount": {
                    "type": "number",
                    "description": "What was collected, tax included."
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 500,
                    "description": "Defaults to your key's name."
                  },
                  "revenueAccountId": {
                    "type": "integer",
                    "description": "The account the revenue posts to; its tax rate applies."
                  },
                  "payment": {
                    "type": "object",
                    "required": [
                      "status",
                      "reference"
                    ],
                    "properties": {
                      "status": {
                        "type": "string",
                        "enum": [
                          "paid"
                        ]
                      },
                      "reference": {
                        "type": "string",
                        "maxLength": 128,
                        "description": "Your id for the money, e.g. a payout id."
                      },
                      "fee": {
                        "type": "number",
                        "description": "Your commission. Recorded, does not reduce the revenue."
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Settlement recorded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTransaction"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `transactions:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "The reference is already recorded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/transactions/{id}": {
      "get": {
        "operationId": "getTransaction",
        "summary": "Get a transaction by ID",
        "description": "Returns a single transaction. The transaction must belong to the organization associated with the API token.\n",
        "tags": [
          "Transactions"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "Transaction ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Transaction details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTransaction"
                }
              }
            }
          },
          "400": {
            "description": "Invalid transaction ID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "403": {
            "description": "API key is missing the required `transactions:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "Transaction not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteTransaction",
        "summary": "Delete an unpaid charge",
        "description": "Removes a charge raised by mistake from the ledger. Only a charge nothing has happened to can be deleted: unpaid (`pending`, `overdue` or `failed`) or already `void`, and with no payment, invoice, Wallet entry, refund or other charge referring to it, and on no open order (`409 CHARGE_ON_OPEN_ORDER`) - anything else is refused with `409 TRANSACTION_HAS_RECORDS`, and should be voided instead. A paid charge is refused with `409 PAID_TRANSACTION_REQUIRES_REFUND`, and a settled or cancelled one with `409 CLOSED_TRANSACTION_NOT_DELETABLE`. An API key reaches only the charges of bookings it made through the API, as on a void.\n\nWhen the charge was the last one of a pass that was never paid, the pass is cancelled with it, with its bookings still ahead; `releasedMembershipIds` names them. Deleting cannot be undone: to keep a record that the charge existed, void it.\n",
        "tags": [
          "Transactions"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The charge was deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id",
                    "releasedMembershipIds"
                  ],
                  "properties": {
                    "id": {
                      "type": "integer",
                      "description": "The deleted transaction's id"
                    },
                    "releasedMembershipIds": {
                      "type": "array",
                      "items": {
                        "type": "integer"
                      },
                      "description": "Never-paid passes cancelled because this was their last charge"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid transaction ID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `transactions:delete` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "Transaction not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "Paid (refund it instead), closed out, or referred to by a payment, invoice or other record (void it instead)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/transactions/{id}/refund": {
      "post": {
        "operationId": "refundTransaction",
        "summary": "Refund a settlement",
        "description": "Records money given back out of a settlement your key recorded, reducing the club's revenue by it. Nothing is moved. Omit `amount` to refund everything still refundable. A `reference` already recorded on this settlement is refused with `409 DUPLICATE_REFERENCE`; send an `Idempotency-Key` too, so two retries in flight at once cannot both be recorded.\n",
        "tags": [
          "Transactions"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          },
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "reference"
                ],
                "properties": {
                  "amount": {
                    "type": "number",
                    "description": "Tax included. Defaults to everything still refundable."
                  },
                  "reference": {
                    "type": "string",
                    "maxLength": 128,
                    "description": "Your refund id."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Refund recorded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTransaction"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, or more than is still refundable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `transactions:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "No settlement with this id was recorded by your key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "Already refunded in full, or the reference is already recorded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/transactions/{id}/void": {
      "post": {
        "operationId": "createTransactionVoid",
        "summary": "Void an unpaid charge",
        "description": "Marks a charge as never owed: it leaves the member's amount due, bill runs and revenue. Nothing is deleted - the transaction stays in the ledger with `paymentStatus: void`. Only an unpaid charge can be voided (`pending`, `overdue` or `failed`). A paid one is refused with `409 PAID_TRANSACTION_REQUIRES_REFUND`, since voiding it would erase a real sale, and a settled or cancelled one with `409 CLOSED_TRANSACTION_NOT_VOIDABLE`. An API key reaches only the charges of bookings it made through the API, and never another key's managed booking; any other charge is a 404.\n\nWhen the charge was the last one of a pass that was never paid, the pass is cancelled with it, with its bookings still ahead; `releasedMembershipIds` names them.\n",
        "tags": [
          "Transactions"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The voided transaction",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/PlatformTransaction"
                    },
                    {
                      "type": "object",
                      "required": [
                        "releasedMembershipIds"
                      ],
                      "properties": {
                        "releasedMembershipIds": {
                          "type": "array",
                          "items": {
                            "type": "integer"
                          },
                          "description": "Never-paid passes cancelled because this was their last charge"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid transaction ID",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `transactions:delete` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "Transaction not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "Already void, paid (refund it instead), or closed out",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/transactions/{id}/record-payment": {
      "post": {
        "operationId": "recordPayment",
        "summary": "Record a payment for a charge",
        "description": "Records that the member paid what a charge still owes, with one of your organization's own payment methods - money already taken at the desk, such as cash, a card on your own terminal or a bank transfer. The whole outstanding is recorded, the charge becomes `paid` and the member is sent a receipt. Nothing is charged: to take the money from a member's saved card, use `charge-saved-card`. A method that takes the money itself (Stripe, the Wallet) is refused with `400 TENDER_NOT_RECORDABLE`, a charge that owes nothing (or no longer owes what was read, because another payment landed first) with `409 CHARGE_NOT_OWED`, one with no contact with `400 CHARGE_HAS_NO_CONTACT`, and one a payment is already being taken for, such as a saved card being charged or one whose outcome Stripe has not confirmed, with `409 PAYMENT_IN_PROGRESS`: wait for that payment to settle. An API key reaches only the charges of bookings it made through the API; any other charge is a 404.\n",
        "tags": [
          "Transactions"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "paymentMethodDefinitionId"
                ],
                "properties": {
                  "paymentMethodDefinitionId": {
                    "type": "integer",
                    "description": "One of your payment methods recorded by hand, from `GET /v1/platform/payment-methods`."
                  },
                  "paymentDate": {
                    "type": "string",
                    "format": "date",
                    "description": "The day the money arrived, `YYYY-MM-DD` on the club's clock, never after today. Defaults to now."
                  },
                  "reference": {
                    "type": "string",
                    "maxLength": 128,
                    "description": "Where the money came from: the bank transfer's or Revolut payment's own reference. Shown with the payment in 1club."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The charge, paid, with the payment recorded",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/PlatformTransaction"
                    },
                    {
                      "type": "object",
                      "required": [
                        "outstanding",
                        "payment"
                      ],
                      "properties": {
                        "outstanding": {
                          "type": "number",
                          "description": "What the charge still owes, tax included (0 once recorded)"
                        },
                        "payment": {
                          "type": "object",
                          "required": [
                            "id",
                            "status"
                          ],
                          "properties": {
                            "id": {
                              "type": "integer"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "succeeded"
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, a payment method that is not recorded by hand, a date after today, or a charge with no contact",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `payments:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "Transaction not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "The charge owes nothing (`CHARGE_NOT_OWED`), or another payment for it is being taken or awaits Stripe's answer (`PAYMENT_IN_PROGRESS`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/transactions/{id}/charge-saved-card": {
      "post": {
        "operationId": "chargeSavedCard",
        "summary": "Charge a charge to the member's saved card",
        "description": "Charges what a charge still owes to the member's saved card, taken from the account of the company the charge belongs to (a guardian's card pays a dependent's charge). The charge is merchant-initiated, with nobody present to authenticate, so a card that needs 3D Secure is declined with `authentication_required`. A same-day retry for the same amount and card is not charged twice. A card the bank refuses is an answer, not an error: `payment.status` is `failed` with Stripe's reason in `payment.failureCode`, such as `insufficient_funds`, `expired_card` or `authentication_required`. A payment Stripe has not finished, or one it could not confirm either way (the card may have been charged), is `pending` (or `processing`), never `failed`: do not take the money another way until it settles. While it is pending, recording a payment for the charge is refused with `409 PAYMENT_IN_PROGRESS`, however long Stripe takes to answer. A charge that owes nothing is refused with `409 CHARGE_NOT_OWED`, one with a payment already pending or processing with `409 PAYMENT_IN_PROGRESS`, a member with no saved card with `409 NO_SAVED_CARD`, and a charge with no contact with `400 CHARGE_HAS_NO_CONTACT`. An API key reaches only the charges of bookings it made through the API; any other charge is a 404.\n",
        "tags": [
          "Transactions"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The charge after the attempt, with how the payment went",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/PlatformTransaction"
                    },
                    {
                      "type": "object",
                      "required": [
                        "outstanding",
                        "payment"
                      ],
                      "properties": {
                        "outstanding": {
                          "type": "number",
                          "description": "What the charge still owes, tax included"
                        },
                        "payment": {
                          "type": "object",
                          "required": [
                            "id",
                            "status",
                            "failureCode"
                          ],
                          "properties": {
                            "id": {
                              "type": "integer",
                              "nullable": true,
                              "description": "The payment recorded; null when the card was refused"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "succeeded",
                                "processing",
                                "pending",
                                "failed"
                              ]
                            },
                            "failureCode": {
                              "type": "string",
                              "nullable": true,
                              "description": "Stripe's decline code, or its error code, when `status` is `failed`"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid transaction ID, or a charge with no contact",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `payments:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "Transaction not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "The charge owes nothing, a payment for it is already pending or processing, or the member has no saved card",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/website": {
      "get": {
        "operationId": "getWebsite",
        "summary": "Get the website",
        "description": "Returns one website with its page list, layout, publish state and public URLs. Omit `siteId` for the organization's default website.\n`previewUrl` renders the unpublished draft, which is how you review edits made through this API before publishing them; `url` is what the public sees and only reflects the last published release.\n",
        "tags": [
          "Website"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "siteId",
            "schema": {
              "type": "integer"
            },
            "description": "Which website, when the organization has more than one. Defaults to its default website."
          }
        ],
        "responses": {
          "200": {
            "description": "The website, its pages and its layout",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformWebsite"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `website:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "No website with that id in this organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateWebsite",
        "summary": "Update website-level settings",
        "description": "Changes the website's name, theme behaviour and site-wide SEO defaults. Every field is optional; omitted fields are left alone.\n`supportedLocales` and `defaultLocale` are **organization-level** and need the additional `organization:write` scope. They also decide which languages the member portal, the mobile app and outbound email offer, and they take effect immediately rather than on publish - so they are a separate grant from editing the draft. They are reachable here at all because they are what decides which localized URLs the website serves: a page or section translated into an unlisted locale has no URL to be served at and no `hreflang` alternate pointing to it. A `defaultLocale` outside `supportedLocales` is a 400.\nEverything else in this body edits the **draft**, `seoSettings` included - it is stored in the site's settings, so a release carries it and the public site keeps serving the previously published values until you publish.\nDeliberately cannot change the site's address (`slug`, `domain`), which website is the organization's default, or whether the site is switched on - those move a customer's public presence and are not side effects a content edit should have.\n",
        "tags": [
          "Website"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "siteId",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "themeSupport": {
                    "type": "string",
                    "enum": [
                      "both",
                      "light",
                      "dark"
                    ],
                    "description": "`both` lets a visitor switch; `light`/`dark` fixes the theme."
                  },
                  "defaultTheme": {
                    "type": "string",
                    "enum": [
                      "light",
                      "dark",
                      "system"
                    ],
                    "description": "Only meaningful when themeSupport is `both`."
                  },
                  "seoSettings": {
                    "type": "object",
                    "description": "Site-wide SEO defaults, replacing the whole object - read the current one from `GET /website` first. Every field is a fallback a page can override.\n",
                    "additionalProperties": false,
                    "properties": {
                      "siteDescription": {
                        "type": "string",
                        "nullable": true,
                        "description": "Meta description for pages that set none, and the `description` in the site's Organization / LocalBusiness / WebSite structured data.\n"
                      },
                      "defaultOgImage": {
                        "type": "string",
                        "format": "uri",
                        "nullable": true,
                        "description": "Social-share image for pages with no `ogImage`. Get a URL from `GET /media`."
                      },
                      "verification": {
                        "type": "object",
                        "nullable": true,
                        "additionalProperties": false,
                        "description": "Search-console ownership tokens, rendered as meta tags on every page.",
                        "properties": {
                          "google": {
                            "type": "string",
                            "nullable": true,
                            "description": "Google Search Console token"
                          },
                          "bing": {
                            "type": "string",
                            "nullable": true,
                            "description": "Bing Webmaster Tools token"
                          }
                        }
                      }
                    }
                  },
                  "buttonStyle": {
                    "type": "object",
                    "description": "How buttons look across the WHOLE website. Site-wide on purpose: a section chooses each button's emphasis (`primary`/`secondary`/`outline`/`ghost`), but a site with pill buttons in the hero and square ones in a CTA reads as broken. Unlike `seoSettings` this MERGES field by field, so setting the shape leaves the casing alone. An all-default style is stored as nothing, and the renderer falls back to `pill`.\n",
                    "additionalProperties": false,
                    "properties": {
                      "shape": {
                        "type": "string",
                        "enum": [
                          "pill",
                          "rounded",
                          "square"
                        ],
                        "description": "Corner treatment for every button. Defaults to `pill`."
                      },
                      "uppercase": {
                        "type": "boolean",
                        "description": "Uppercase button labels, with a little letter-spacing so they stay readable."
                      }
                    }
                  },
                  "cornerRadius": {
                    "type": "string",
                    "enum": [
                      "sharp",
                      "soft",
                      "round"
                    ],
                    "nullable": true,
                    "description": "How round every corner on the site is - section cards, media frames, form controls, and buttons on `sharp`/`round`. Defaults to `soft`, which is what every site rendered before this existed. `null` returns to the default.\n"
                  },
                  "spacing": {
                    "type": "string",
                    "enum": [
                      "compact",
                      "default",
                      "airy"
                    ],
                    "nullable": true,
                    "description": "The site's baseline vertical rhythm: the gap BETWEEN sections and the default padding inside one. A section's own `paddingY` overrides the padding half; the gap is the part no per-section control reaches. `null` returns to the default.\n"
                  },
                  "typeScale": {
                    "type": "string",
                    "enum": [
                      "compact",
                      "default",
                      "editorial"
                    ],
                    "nullable": true,
                    "description": "How large headings run relative to body text. A multiplier on the heading ladder rather than a set of sizes. `null` returns to the default.\n"
                  },
                  "clubId": {
                    "type": "integer",
                    "nullable": true,
                    "description": "Club this website represents. When set, the header and footer use that club's logo instead of the organization's. `null` clears the binding. Takes effect immediately, like `name` — logos are branding assets rather than a published token.\n"
                  },
                  "supportedLocales": {
                    "type": "array",
                    "description": "Locales this organization serves, in display order. Organization-level, requires `organization:write`, and applies immediately - see the endpoint description. Must contain `defaultLocale`.\n",
                    "items": {
                      "type": "string",
                      "enum": [
                        "en",
                        "es",
                        "fr",
                        "de",
                        "bg",
                        "cs"
                      ]
                    }
                  },
                  "defaultLocale": {
                    "type": "string",
                    "enum": [
                      "en",
                      "es",
                      "fr",
                      "de",
                      "bg",
                      "cs"
                    ],
                    "description": "Locale served at the site root. Organization-level, requires `organization:write`."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated website",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformWebsite"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing `website:write`, or `organization:write` when the body carries locale fields",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/website/sites": {
      "get": {
        "operationId": "listWebsiteSites",
        "summary": "List the organization's websites",
        "description": "Every website the organization owns, its default one first. Use this when the organization runs more than one site to find the `siteId` the other endpoints take.\n",
        "tags": [
          "Website"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "List of websites",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PlatformWebsite"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `website:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createWebsiteSite",
        "summary": "Create a website from a Website Template",
        "description": "Builds a new website from a template in `GET /templates`, as the admin's template gallery does: the template's pages, sections and look, with its sample copy rewritten for the business from its own data. A figure or claim the data cannot support is left out. The website is created offline, so nothing is public, and publishing it leaves it offline: taking it online and connecting a domain happen in the admin. Review it with `previewUrl`.\nAsking again for the same template and club, before anyone has edited the website it built, returns that website as it is, its name included, with `created: false` and a 200, rather than building another. While one is being built, asking again is answered 409. The organization's other websites are left as they are. Building takes up to a minute, and an organization can build 30 websites an hour. Requires the website:write scope.\n",
        "tags": [
          "Website"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "templateKey"
                ],
                "properties": {
                  "templateKey": {
                    "type": "string",
                    "description": "A key from GET /templates, e.g. \"gym-forge\"."
                  },
                  "name": {
                    "type": "string",
                    "description": "The website's name in the admin. Defaults to the template's name."
                  },
                  "clubId": {
                    "type": "integer",
                    "description": "Builds the website for this club: binds it and keeps its copy to that club. Omit for the whole organization."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The untouched website this template already built for this club, with `created` false",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformWebsite"
                }
              }
            }
          },
          "201": {
            "description": "The new website, its pages and its layout, with `created` true",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformWebsite"
                }
              }
            }
          },
          "400": {
            "description": "No template of that name, or a club that is not in this organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `website:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "$ref": "#/components/responses/PlatformConflict"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/website/section-types": {
      "get": {
        "operationId": "listWebsiteSectionTypes",
        "summary": "Get the section-type catalog",
        "description": "Every section type a page or layout may use, with its config fields, their allowed values, and authoring notes.\nRead this before composing sections: it is the machine-readable definition of what a `hero` or a `plans` block accepts, and section types are added over time. `content` types belong in a page's `sections`; `layout` types (header, footer) belong to the site layout and appear on every page.\n",
        "tags": [
          "Website"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Section types with their config field definitions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "content": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "layout": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "sectionTypes": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "object",
                        "properties": {
                          "fields": {
                            "type": "array",
                            "items": {
                              "$ref": "#/components/schemas/WebsiteSectionField"
                            }
                          },
                          "notes": {
                            "type": "string"
                          },
                          "deprecated": {
                            "type": "boolean",
                            "description": "Retired — still stored and rendered, never offered for a new section."
                          },
                          "presets": {
                            "type": "array",
                            "description": "Named starting points. Each `config` is an overlay on the type's defaults.",
                            "items": {
                              "type": "object",
                              "properties": {
                                "key": {
                                  "type": "string"
                                },
                                "config": {
                                  "type": "object",
                                  "additionalProperties": true
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "sharedStyle": {
                      "type": "object",
                      "description": "The style fields EVERY content section accepts, stated once instead of repeated in each entry of `sectionTypes`.\n",
                      "properties": {
                        "fields": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/WebsiteSectionField"
                          }
                        },
                        "notes": {
                          "type": "string"
                        }
                      }
                    },
                    "defaults": {
                      "type": "object",
                      "description": "The starting config for a new section, keyed by section type.",
                      "additionalProperties": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `website:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/website/theme-tokens": {
      "get": {
        "operationId": "listWebsiteThemeTokens",
        "summary": "Get the design-token catalog",
        "description": "Every design token the website accepts, what it means, what it falls back to when unset, and the template looks on offer.\nRead this before writing a theme. It is the machine-readable counterpart to `/section-types`: that one says what may go IN a page, this one says how the site LOOKS. Tokens are added over time, so read it rather than hardcoding the values.\nTwo things worth knowing before you write anything. **Unset is the normal state** — every token falls back to the organization's branding or to a value derived from the tokens above it, so a good theme sets the fewest tokens it needs and leaves the rest inherited. And **the tokens are only coherent in combinations**, which is what `looks` are for: start from one and adjust two or three tokens, rather than composing 32 from scratch.\n",
        "tags": [
          "Website"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The token catalog",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "tokens": {
                      "type": "array",
                      "description": "Every writable token.",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "description": "The control — `color`, `select` or `boolean`."
                          },
                          "group": {
                            "type": "string",
                            "description": "`palette`, `darkPalette`, `typography`, `shape` or `motion`."
                          },
                          "options": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "description": "Allowed values, for a `select`."
                          },
                          "defaultValue": {
                            "description": "What the token renders as when unset, where that is a fixed value."
                          },
                          "inheritsFrom": {
                            "type": "string",
                            "description": "What supplies the value when unset, where it is not a fixed value."
                          },
                          "order": {
                            "type": "integer"
                          },
                          "visibleIf": {
                            "type": "object",
                            "description": "When the token is relevant, as a comparison against a sibling."
                          }
                        }
                      }
                    },
                    "notes": {
                      "type": "object",
                      "description": "Authoring guidance, one entry per group.",
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "looks": {
                      "type": "array",
                      "description": "Each Website Template's base styling. `key` is the template's; apply one with `PUT /theme` and adjust from there.\n",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string"
                          },
                          "tokens": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        }
                      }
                    },
                    "fonts": {
                      "type": "array",
                      "description": "The families the site can load, with the category each belongs to — which is what a heading/body pairing is chosen on.\n",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "category": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `website:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/website/theme": {
      "get": {
        "operationId": "getWebsiteTheme",
        "summary": "Get the website's theme",
        "description": "What the site has chosen, what that resolves to once the organization's branding and the declared defaults are applied, and which of the three supplied each value.\n`sources` is the field to read before changing anything: it tells you whether a colour is one the customer picked for this website (`site`), the organization's brand colour (`branding`), or a platform default. Overwriting a `branding` value is how a site quietly stops matching the rest of the customer's brand, so prefer leaving those alone unless asked.\nA token missing from `resolved` is one whose fallback is computed by the stylesheet from the palette — the surface, muted-text and border colours — rather than one that has no value.\n",
        "tags": [
          "Website"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "siteId",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The site theme",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "stored": {
                      "type": "object",
                      "description": "Exactly what this website has set. Absent keys are inherited.",
                      "additionalProperties": true
                    },
                    "resolved": {
                      "type": "object",
                      "description": "What each token renders as, inheritance applied.",
                      "additionalProperties": true
                    },
                    "sources": {
                      "type": "object",
                      "description": "Per token: `site`, `branding` or `default`.",
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `website:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "The organization has no website"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "put": {
        "operationId": "updateWebsiteTheme",
        "summary": "Set the website's design tokens",
        "description": "Merges a flat token patch into the site's theme, optionally on top of a template's look. Read `GET /theme-tokens` first for the tokens, their allowed values and the looks.\n**This writes the draft**, like every other edit here — nothing a visitor sees changes until `POST /releases` publishes it. That is the point of tokens living on the website rather than on the organization's branding: a palette change is previewable, versioned in the release, and revertible.\nMerges field by field, so setting the heading font leaves the palette alone. Send `null` for a token to return it to what it inherits — from the organization's branding, from another token, or from the platform default. That is the only way back once a value has been written; there is no \"unset\" string.\nA `template` is the exception to that merge: it REPLACES the look rather than adding to it. Every token but the brand's is cleared first, then the template's values are written, along with its light and dark setting. Otherwise switching looks would leave the last one's dark palette underneath, a hybrid nobody chose. A hand-picked brand colour is untouched, and so are pages and content. Sections added later start from the template's styling, and `restyleSections` gives it to the sections already there.\nWhen `template` and `tokens` are both sent the look is applied first and the tokens land on top, so \"use the Forge look but keep our heading font\" is one call.\nEvery problem with a patch is reported at once rather than one at a time. Tokens are validated against the catalog: an unknown key, a value outside a token's options, a font the site cannot load, or a colour that is not a hex are all refused rather than stored — a colour CSS cannot parse does not fall back, it paints the surface transparent.\n",
        "tags": [
          "Website"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "siteId",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "template": {
                    "type": "string",
                    "description": "A Website Template key from the catalog's `looks`, whose look is applied before `tokens`."
                  },
                  "restyleSections": {
                    "type": "boolean",
                    "description": "With `template`, also give the sections already on the site its layout and style. Their words, photos and lists stay."
                  },
                  "tokens": {
                    "type": "object",
                    "description": "Token key to value. `null` returns a token to what it inherits. See `GET /theme-tokens` for the keys.\n",
                    "additionalProperties": {
                      "nullable": true,
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "boolean"
                        }
                      ]
                    }
                  }
                }
              },
              "examples": {
                "template": {
                  "summary": "Apply a template's look, keeping the brand font",
                  "value": {
                    "template": "gym-forge",
                    "tokens": {
                      "headingFontFamily": "Montserrat"
                    }
                  }
                },
                "adjust": {
                  "summary": "Flatten the surfaces and slow the motion down",
                  "value": {
                    "tokens": {
                      "shadow": "none",
                      "borderWidth": "bold",
                      "motion": "subtle"
                    }
                  }
                },
                "clear": {
                  "summary": "Go back to the organization's brand colour",
                  "value": {
                    "tokens": {
                      "primaryColor": null
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The theme after the patch, resolved",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "stored": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "resolved": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "sources": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "fadingBrandColors": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Present only after a `template` when the Brand Book keeps the brand colours. Names the kept colours that are hard to read on this look.\n"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "An unknown token, a value outside its options, or an unparseable colour",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `website:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "The organization has no website"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/website/css": {
      "get": {
        "operationId": "getWebsiteCss",
        "summary": "Get the website's custom CSS",
        "description": "Returns the site-wide custom stylesheet, or an empty string when none is set.",
        "tags": [
          "Website"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "siteId",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The custom stylesheet",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "css": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `website:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "put": {
        "operationId": "updateWebsiteCss",
        "summary": "Replace the website's custom CSS",
        "description": "Sets the site-wide stylesheet, replacing it entirely - read `GET /css` first and send the whole thing back with your changes.\nApplied globally on the public site. Target sections with `.section-{type}` (`.section-hero`, `.section-footer`) and prefer theme variables such as `var(--primary-color)` so styles survive a light/dark switch. Script tags are rejected.\n",
        "tags": [
          "Website"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "siteId",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "css"
                ],
                "properties": {
                  "css": {
                    "type": "string",
                    "description": "The complete stylesheet. Send an empty string to remove it."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored stylesheet"
          },
          "400": {
            "description": "Stylesheet too large, or contains a script tag",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `website:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/website/pages": {
      "get": {
        "operationId": "listWebsitePages",
        "summary": "List the website's pages",
        "description": "Every page on the site with its section types and SEO fields, but not the section bodies - fetch one page for those.\n",
        "tags": [
          "Website"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "siteId",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of pages",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PlatformWebsitePage"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `website:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createWebsitePage",
        "summary": "Add a page",
        "description": "Creates a page on the draft. `slug` becomes its URL path segment and must be unique on the site; it is lowercased and stripped of surrounding slashes.\nAdding a page does not link to it - update the header's `navItems` and the footer's links afterwards, or visitors will never find it.\n",
        "tags": [
          "Website"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "siteId",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "slug",
                  "title"
                ],
                "properties": {
                  "slug": {
                    "type": "string",
                    "description": "Lowercase letters, numbers and hyphens, e.g. \"personal-training\""
                  },
                  "title": {
                    "type": "string"
                  },
                  "isHomepage": {
                    "type": "boolean",
                    "description": "Makes this the homepage, clearing the flag on whichever page held it"
                  },
                  "sections": {
                    "type": "array",
                    "description": "Initial sections. See GET /section-types for the types and their config.",
                    "items": {
                      "type": "object",
                      "required": [
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "config": {
                          "type": "object"
                        },
                        "translations": {
                          "type": "object"
                        }
                      }
                    }
                  },
                  "metaTitle": {
                    "type": "string",
                    "nullable": true,
                    "description": "SEO title. Falls back to the page title."
                  },
                  "metaDescription": {
                    "type": "string",
                    "nullable": true,
                    "description": "Falls back to `seoSettings.siteDescription`."
                  },
                  "ogImage": {
                    "type": "string",
                    "nullable": true,
                    "description": "Absolute URL. Get one from GET /media rather than composing it."
                  },
                  "noindex": {
                    "type": "boolean",
                    "nullable": true,
                    "description": "Ask search engines not to index this page, and leave it out of `sitemap.xml`. For thank-you pages and campaign landing variants. The page stays publicly reachable - this is not a privacy control.\n"
                  },
                  "translations": {
                    "type": "object",
                    "nullable": true,
                    "description": "Per-locale `metaTitle`/`metaDescription`, keyed by locale: `{ \"bg\": { \"metaTitle\": \"…\" } }`. Replaces the whole map. `ogImage` is not localizable - one social card serves every locale.\nAn override only reaches a visitor for a locale the organization actually serves: check `supportedLocales` on `GET /website` and add the locale there first, or the translation has no URL to be served at.\n",
                    "additionalProperties": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "metaTitle": {
                          "type": "string"
                        },
                        "metaDescription": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created page",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformWebsitePage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid slug, invalid section type, a config value or field the section type does not offer, or the page limit is reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `website:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "A page with that slug already exists",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/website/pages/{slug}": {
      "get": {
        "operationId": "getWebsitePage",
        "summary": "Get one page",
        "description": "A single page with its full section list, config and translations.",
        "tags": [
          "Website"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "siteId",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The page",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformWebsitePage"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `website:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "No page with that slug",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "put": {
        "operationId": "updateWebsitePage",
        "summary": "Update a page",
        "description": "Updates a page on the draft. Omitted fields are left alone, so this doubles as a partial update.\n`sections`, when present, **replaces the entire list** - which is the intended way to rebuild a page: one request that either applies whole or fails whole, rather than a sequence of per-section calls that can leave the page half-edited. `translations` replaces the whole locale map for the same reason. Send `metaTitle`/`metaDescription`/`ogImage` as `null` to clear them.\n",
        "tags": [
          "Website"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "siteId",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "slug": {
                    "type": "string",
                    "description": "Renames the page, moving its public URL. Nothing redirects from the old one."
                  },
                  "title": {
                    "type": "string"
                  },
                  "isHomepage": {
                    "type": "boolean"
                  },
                  "sections": {
                    "type": "array",
                    "description": "Replaces every section on the page.",
                    "items": {
                      "type": "object",
                      "required": [
                        "type"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "config": {
                          "type": "object"
                        },
                        "translations": {
                          "type": "object"
                        }
                      }
                    }
                  },
                  "metaTitle": {
                    "type": "string",
                    "nullable": true
                  },
                  "metaDescription": {
                    "type": "string",
                    "nullable": true
                  },
                  "ogImage": {
                    "type": "string",
                    "nullable": true
                  },
                  "noindex": {
                    "type": "boolean",
                    "nullable": true,
                    "description": "Keep the page out of search indexes and `sitemap.xml`. `false` or `null` makes it indexable again."
                  },
                  "translations": {
                    "type": "object",
                    "nullable": true,
                    "description": "Per-locale `metaTitle`/`metaDescription`, keyed by locale. **Replaces the whole map** - read the page first and send every locale back, the same way `sections` works. `null` clears all overrides.\n",
                    "additionalProperties": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "metaTitle": {
                          "type": "string"
                        },
                        "metaDescription": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated page",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformWebsitePage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, invalid section type, a config value or field the section type does not offer, or an attempt to leave the site without a homepage",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `website:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "No page with that slug",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "409": {
            "description": "The requested slug is taken by another page",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteWebsitePage",
        "summary": "Delete a page",
        "description": "Removes a page from the draft. A website must keep at least one page, so the last one cannot be deleted - delete the website itself instead. The homepage cannot be deleted while other pages remain - make another page the homepage first. Remember to drop the page from the header and footer links afterwards.\n",
        "tags": [
          "Website"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "siteId",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Confirmation and the remaining page count",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "pageCount": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The page is the homepage and other pages remain",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `website:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "No page with that slug",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/website/releases": {
      "get": {
        "operationId": "listWebsiteReleases",
        "summary": "List publish history",
        "description": "Releases newest first. The one with `isActive: true` is what the public site is serving; its id is what `POST /releases/{releaseId}/rollback` takes to undo a publish.\n",
        "tags": [
          "Website"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "siteId",
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer"
            },
            "description": "Max results (1-100, default 20)"
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Releases and the total count",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "releases": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlatformWebsiteRelease"
                      }
                    },
                    "total": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid pagination parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `website:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "post": {
        "operationId": "createWebsiteRelease",
        "summary": "Publish the website",
        "description": "Makes the current draft live. Until this is called, edits made through this API are invisible to the public - this is the one endpoint that changes what visitors see, which is why it needs `website:publish` rather than `website:write`.\n`amend` (the default) overwrites the active release in place, so routine edits do not litter the history. `snapshot` cuts a new version, which is what you want before a large change so there is a version to roll back to.\nRequires the Website plan addon, the same as publishing from the admin editor.\n",
        "tags": [
          "Website"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "siteId",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mode": {
                    "type": "string",
                    "enum": [
                      "amend",
                      "snapshot"
                    ],
                    "description": "`amend` (default) updates the live release in place; `snapshot` records a new version."
                  },
                  "note": {
                    "type": "string",
                    "description": "What changed. Shown in the publish history, most useful with `snapshot`."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The release now serving the public site",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformWebsiteRelease"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the `website:publish` scope, or the organization does not have the Website plan addon",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "No website with that id in this organization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/website/pages/{slug}/sections": {
      "post": {
        "operationId": "createWebsitePageSection",
        "summary": "Add a section to a page",
        "description": "Appends a section, or inserts it at `position`. A position past the end appends rather than failing.\nFor rebuilding a page, prefer `PUT /pages/{slug}` with the full `sections` array - it is one request instead of many, and cannot leave the page half-built.\n",
        "tags": [
          "Website"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "siteId",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "description": "A content section type from GET /section-types"
                  },
                  "config": {
                    "type": "object"
                  },
                  "translations": {
                    "type": "object"
                  },
                  "position": {
                    "type": "integer",
                    "description": "0-based insert position. Omit to append."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The page, with the section in place",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformWebsitePage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid section type, a config value or field the section type does not offer, or the page's section limit is reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `website:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "No page with that slug",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/website/pages/{slug}/sections/{index}": {
      "patch": {
        "operationId": "updateWebsitePageSection",
        "summary": "Update a section's config",
        "description": "Merges the given fields into the section's existing config; fields you do not send keep their current values. Array fields are replaced wholesale, so send the whole array when changing one entry.\n`index` is the section's 0-based position as returned by `GET /pages/{slug}`. Indexes shift when sections are added or removed, so re-read the page rather than reusing a stale one.\n`translations` is how one section's copy is localized without rewriting the page. Unlike `config` it **replaces** the whole locale map, so read the section first and send back every locale you are keeping.\n",
        "tags": [
          "Website"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "index",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "siteId",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "config"
                ],
                "properties": {
                  "config": {
                    "type": "object",
                    "description": "Config fields to merge in"
                  },
                  "translations": {
                    "type": "object",
                    "description": "Per-locale overrides of this section's config, keyed by locale then field. Replaces the whole map. Leave `config` in the language the site is written in; a locale with no entry renders it as written.\n"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The page, with the section updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformWebsitePage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, a config value or field the section type does not offer, or the index is out of range",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `website:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "No page with that slug",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "delete": {
        "operationId": "deleteWebsitePageSection",
        "summary": "Remove a section from a page",
        "description": "Deletes the section at `index`. Later sections shift down by one, so re-read the page before deleting another.\n",
        "tags": [
          "Website"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "index",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "siteId",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The page, with the section gone",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformWebsitePage"
                }
              }
            }
          },
          "400": {
            "description": "The index is out of range",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `website:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "No page with that slug",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/website/layout/{slot}": {
      "put": {
        "operationId": "updateWebsiteLayout",
        "summary": "Update the site header or footer",
        "description": "The header and footer are site-level and render on every page. Config is merged into what is there, creating the slot if the site has none.\nThe link arrays (`navItems` on the header, `linkCategories`/`links` on the footer) **replace** rather than merge - read the current layout from `GET /v1/platform/website` and send the complete array, or you will drop the links you left out. Keep each link's `_id` when you send it back: translations are keyed on it, and a link without one gets a new id and loses its translations.\n`translations` localizes the header or footer the way it does a page section, and like there it **replaces** the slot's whole locale map. A link is addressed by its `_id`, which `GET /v1/platform/website` returns on every item: `navItems.<_id>.label`, `navItems.<_id>.children.<_id>.label`, `linkCategories.<_id>.links.<_id>.label`.\n",
        "tags": [
          "Website"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "slot",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "header",
                "footer"
              ]
            }
          },
          {
            "in": "query",
            "name": "siteId",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "config"
                ],
                "properties": {
                  "config": {
                    "type": "object",
                    "description": "Header or footer config. See GET /section-types for the fields."
                  },
                  "translations": {
                    "type": "object",
                    "description": "Per-locale overrides of this slot's config, keyed by locale then field path: `{ \"en\": { \"ctaTitle\": \"…\", \"navItems.<_id>.label\": \"…\" } }`. Replaces the whole map; omit it to keep the current one. Leave `config` in the language the site is written in.\n"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated layout slot"
          },
          "400": {
            "description": "Invalid slot or body, or a config value or field the header or footer does not offer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `website:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/website/releases/{releaseId}/rollback": {
      "post": {
        "operationId": "rollbackWebsiteRelease",
        "summary": "Roll back to an earlier release",
        "description": "Restores a previous release: its content becomes the draft and is published as a new version, so the rollback is itself recorded rather than rewriting history. Use `GET /releases` to find the id.\nThis discards unpublished draft edits - the draft is overwritten with the release's content.\n",
        "tags": [
          "Website"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "releaseId",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "siteId",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The new release created by the rollback",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformWebsiteRelease"
                }
              }
            }
          },
          "400": {
            "description": "Invalid release id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the `website:publish` scope, or the organization does not have the Website plan addon",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "description": "No such release on this website",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/automations": {
      "get": {
        "operationId": "listAutomations",
        "summary": "List automations",
        "description": "The organization's automations, by name: what starts each one (`triggerType`, `triggerConfig`), whether it is on, and when it last ran. Built-in ones carry a `systemKey`. Read only; read a single automation for its steps. `search` matches the name or description, case-insensitive.\n",
        "tags": [
          "Automations"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string",
              "maxLength": 120
            },
            "description": "Match on name or description, case-insensitive"
          },
          {
            "in": "query",
            "name": "isActive",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            },
            "description": "Only automations that are on (`true`) or off (`false`)"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of automations",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformAutomationPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `automations:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/automations/{id}": {
      "get": {
        "operationId": "getAutomation",
        "summary": "Get an automation",
        "description": "One automation with its steps: each step's type, its place in the flow (`position`, and `parentStepId` with `branchKey` for a step inside a branch) and its `config`.\n",
        "tags": [
          "Automations"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club automation id"
          }
        ],
        "responses": {
          "200": {
            "description": "The automation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformAutomationDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `automations:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/brand-book": {
      "get": {
        "operationId": "getBrandBook",
        "summary": "Get the Brand Book",
        "description": "How the organization looks and sounds: its branding (colours, logos, fonts) and its guidance (tone of voice, its own writing guidelines, whether it always keeps its brand colours). Read it before writing anything the organization's members or visitors will see. Requires `clubs:read` or `website:read`.\n",
        "tags": [
          "Brand Book"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "The Brand Book",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformBrandBook"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key holds neither `clubs:read` nor `website:read`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      },
      "patch": {
        "operationId": "updateBrandBook",
        "summary": "Update the Brand Book",
        "description": "Changes the fields sent and leaves the rest. Copy already written or translated stays as it is until it is rewritten. Applies at once for the whole organization. Setting `accentColor` recolours straight away every live website that has no accent of its own. Send null to clear a field. Logos and the other colours are changed on the Branding page in the dashboard. Refused with `BRANDING_UPGRADE_REQUIRED` on the Free plan. Requires `organization:write`.\n",
        "tags": [
          "Brand Book"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "accentColor": {
                    "type": "string",
                    "nullable": true,
                    "example": "#c2410c"
                  },
                  "keepBrandColors": {
                    "type": "boolean"
                  },
                  "toneOfVoice": {
                    "type": "string",
                    "enum": [
                      "professional",
                      "friendly",
                      "casual",
                      "formal"
                    ],
                    "nullable": true
                  },
                  "guidelines": {
                    "type": "string",
                    "nullable": true,
                    "maxLength": 4000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The Brand Book after the change",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformBrandBook"
                }
              }
            }
          },
          "400": {
            "description": "A field is out of range",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing `organization:write`, or the organization is on the Free plan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/contact-notes": {
      "get": {
        "operationId": "listContactNotes",
        "summary": "List contact notes",
        "description": "Notes the club's staff wrote on contacts (an injury, a preference, what was agreed on the phone), newest note date first. Read only. Notes are personal data and can hold health details: treat them as such.\n\n`search` is full text over the note: every word must appear, accents are ignored and word starts match, so `knee` finds \"knees\" and `pena` finds \"Peña\". Narrow to one person with `contactId`.\n",
        "tags": [
          "Contact notes"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "contactId",
            "schema": {
              "type": "integer"
            },
            "description": "Only notes on this contact"
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string",
              "maxLength": 120
            },
            "description": "Words in the note. Every word must appear; accents ignored; word starts match; a search reads at most the 1000 newest matches"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of notes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformContactNotePage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/form-submissions": {
      "get": {
        "operationId": "listFormSubmissions",
        "summary": "List form submissions",
        "description": "What people answered on the organization's forms, answered ones first and newest first, then invitations nobody has filled in yet (`status: pending`). Each submission's `answers` lists every question with its answer in the order the form asked it: the built-in fields (by key, such as `firstName`), then custom fields (by name), then the form's own questions (by their label). Read only. Answers are personal data and can hold health declarations: treat them as such.\n\n`contactId` matches the contact a submission was filed against and the lead a visitor's answers created. `search` is full text over the answers: every word must appear, accents are ignored and word starts match, so `knee` finds \"knees\" and `pena` finds \"Peña\".\n",
        "tags": [
          "Form submissions"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "formId",
            "schema": {
              "type": "integer"
            },
            "description": "Only submissions of this form"
          },
          {
            "in": "query",
            "name": "contactId",
            "schema": {
              "type": "integer"
            },
            "description": "Only submissions filed against, or made by, this contact"
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "submitted"
              ]
            },
            "description": "`submitted` for answered, `pending` for invitations not answered yet"
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string",
              "maxLength": 120
            },
            "description": "Words in the answers. Every word must appear; accents ignored; word starts match; a search reads at most the 1000 newest matches"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of submissions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformFormSubmissionPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `contacts:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/memberships/{id}/extensions": {
      "post": {
        "operationId": "createMembershipExtension",
        "summary": "Extend a membership",
        "description": "Moves a membership's end by whole days, with a reason, recorded on the membership as staff extensions in 1club are: the end date of a membership that stops, the next billing date of one that renews. A negative number takes back an earlier extension. An expired membership whose new end is still ahead becomes active again. To move the end to a date, send the days between the current end (`endDate`, or `renewalDate` on a renewing membership) and that date.\n\nSupports the `Idempotency-Key` header.\n",
        "tags": [
          "Memberships"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "Retry-safe key; a repeat of the same request replays the first response"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "days",
                  "reason"
                ],
                "properties": {
                  "days": {
                    "type": "integer",
                    "minimum": -3650,
                    "maximum": 3650,
                    "description": "Days added to the term (negative takes back an earlier extension). Not zero."
                  },
                  "reason": {
                    "type": "string",
                    "maxLength": 500,
                    "description": "Why, recorded with the extension"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The extended membership",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformMembership"
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, or the membership cannot be extended: it is cancelled, it is a Season Pass, it has no end or next billing date to move, or the change would end it before it starts\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `memberships:write` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/reports/tax": {
      "get": {
        "operationId": "getTaxReport",
        "summary": "Tax report for a period",
        "description": "The tax a period's sales carried, as the admin's Money › Tax report shows it: sales ex-tax, the part that carried no tax, the taxable part, the tax and the total, in sections (by revenue account, tax rate or club) with a row per day or per month, a total, and the split by tax rate.\n\nEach sale is recognised on its day on the organization's clock, net of refunds and Wallet credit, as on every revenue report. The sales behind the figures are listed by `GET /v1/platform/reports/tax/charges`.\n\nReadable with `analytics:read`. A period may span at most 366 days. Reports have their own limit of 20 requests a minute, on top of the platform's.\n",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "from",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "First day of the period (`YYYY-MM-DD`), on the organization's clock."
          },
          {
            "in": "query",
            "name": "to",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Last day of the period, inclusive."
          },
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only the sales of this club."
          },
          {
            "in": "query",
            "name": "billingEntityId",
            "schema": {
              "type": "integer"
            },
            "description": "Only the sales of this selling company, for an organization that trades through more than one."
          },
          {
            "in": "query",
            "name": "revenueAccountId",
            "schema": {
              "type": "integer"
            },
            "description": "Only the sales filed to this revenue account. A sale stored with no account counts as the default account."
          },
          {
            "in": "query",
            "name": "sections",
            "schema": {
              "type": "string",
              "enum": [
                "account",
                "rate",
                "club"
              ],
              "default": "account"
            },
            "description": "What the report is sectioned by."
          },
          {
            "in": "query",
            "name": "rows",
            "schema": {
              "type": "string",
              "enum": [
                "day",
                "month"
              ],
              "default": "day"
            },
            "description": "A row per day or per month within each section."
          },
          {
            "in": "query",
            "name": "charts",
            "schema": {
              "type": "string",
              "enum": [
                "none",
                "summary",
                "all"
              ],
              "default": "none"
            },
            "description": "Whether the answer carries pictures, as `chart` (and `moreCharts`) beside its figures - none (the default), the one chart of the answer, or every one. Opt-in, so a caller that never draws one pays nothing for it; the figures are the same either way."
          },
          {
            "in": "header",
            "name": "X-1Club-Chart-Image",
            "schema": {
              "type": "string",
              "enum": [
                "png"
              ]
            },
            "description": "Send `png` to have each picture carry its PNG (`png`, base64, at 2x) beside the SVG, for a client that shows images but does not draw SVG."
          }
        ],
        "responses": {
          "200": {
            "description": "The tax report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTaxReport"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key lacks `analytics:read`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/reports/tax/charges": {
      "get": {
        "operationId": "listTaxCharges",
        "summary": "The sales behind the Tax report",
        "description": "Every sale the Tax report for the same period and narrowing counts, one line each, by day and then by transaction: what was sold and to whom, its club, company, revenue account and tax rate, what was charged and credited (incl. tax), and what it is worth now ex-tax, its tax and total. The admin's Tax charges download, as a list.\n\nPaged with `limit` and `offset`; `total` counts every line of the period. A period of more than 500,000 lines is refused: narrow it. Readable with `transactions:read`. A period may span at most 366 days. Reports have their own limit of 20 requests a minute, on top of the platform's.\n",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "from",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "First day of the period (`YYYY-MM-DD`), on the organization's clock."
          },
          {
            "in": "query",
            "name": "to",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Last day of the period, inclusive."
          },
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only the sales of this club."
          },
          {
            "in": "query",
            "name": "billingEntityId",
            "schema": {
              "type": "integer"
            },
            "description": "Only the sales of this selling company, for an organization that trades through more than one."
          },
          {
            "in": "query",
            "name": "revenueAccountId",
            "schema": {
              "type": "integer"
            },
            "description": "Only the sales filed to this revenue account. A sale stored with no account counts as the default account."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            },
            "description": "How many lines a page holds."
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "How many lines to skip."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of the sales",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformTaxCharges"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key lacks `transactions:read`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/reports/amount-due": {
      "get": {
        "operationId": "getAmountDueReport",
        "summary": "Who owes the organization, and for how long",
        "description": "The admin's Money › Amount Due report as a list: everyone who owes something today, biggest debt first, with what they owe aged by the month each charge fell due (current, 1, 2, 3 and 4+ months), the charges behind it (each with its transaction id), and their Wallet balance beside it, never netted into it.\n\nA row is whoever receives the Statement: a contact in a household rolls up into the household's row, every member's charges together, unless `byPerson=true` lists everyone on their own row. A person's Amount Due is their Due now on their profile, to the cent. The Wallet is the default company's, so it is shown (`walletShown`) only when the report is not narrowed to another company, and people holding only Wallet money are listed after the debtors only when it is not narrowed to a club either. `owedFor` keeps only the rows owed for that long or longer, with `totals` summed over them. There is no period: the figures are the ledger now, as of `asOf`.\n\nPaged with `limit` and `offset`; `totals` and `total` count every row. Readable with `transactions:read`. Reports have their own limit of 20 requests a minute, on top of the platform's.\n",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only what is owed at this club."
          },
          {
            "in": "query",
            "name": "billingEntityId",
            "schema": {
              "type": "integer"
            },
            "description": "Only what is owed to this selling company, for an organization that trades through more than one."
          },
          {
            "in": "query",
            "name": "byPerson",
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "One row per person rather than per household."
          },
          {
            "in": "query",
            "name": "owedFor",
            "schema": {
              "type": "string",
              "enum": [
                "month1",
                "month2",
                "month3",
                "month4Plus"
              ]
            },
            "description": "Only the rows owing something for this many months or longer."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            },
            "description": "How many rows a page holds."
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "How many rows to skip."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of the report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformAmountDueReport"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key lacks `transactions:read`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/reports/booking-audit": {
      "get": {
        "operationId": "listBookingAudit",
        "summary": "Every booking of a period and where its money stands",
        "description": "The admin's Bookings › Booking audit as a list: every booking starting in the period, cancelled and no-show ones included, one row each, with what it bills, what was paid and what is still owed, and how. A booking covered by a membership or a programme is `covered` and never owes. The rows come still-owing first, then the most recent first; `summary` counts the whole period, before `paymentState`, `type` and `status` narrow the rows.\n\nDays are the organization's own. Holds the platform places for a class's court and coach are no one's booking and are left out; a seat is filed at its class's club, as on every bookings report.\n\nReadable with `bookings:read`. The amounts and how they were paid need `transactions:read` as well, and who the customer is `contacts:read`, as `include=money` and `include=customer` do on a booking: without them those fields are null, never absent. Paged with `limit` and `offset`. A period may span at most 366 days. Reports have their own limit of 20 requests a minute, on top of the platform's.\n",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "from",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "First day of the period (`YYYY-MM-DD`), on the organization's clock."
          },
          {
            "in": "query",
            "name": "to",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Last day of the period, inclusive."
          },
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only the bookings of this club."
          },
          {
            "in": "query",
            "name": "areaTypeId",
            "schema": {
              "type": "integer"
            },
            "description": "Only the bookings of this area type (a court, a room)."
          },
          {
            "in": "query",
            "name": "instructorIds",
            "schema": {
              "type": "string",
              "example": "3,7"
            },
            "description": "Only the bookings these instructors teach or coach, comma-separated."
          },
          {
            "in": "query",
            "name": "paymentState",
            "schema": {
              "type": "string",
              "enum": [
                "unpaid",
                "partial",
                "paid",
                "refunded",
                "covered",
                "free"
              ]
            },
            "description": "Only the rows whose money stands so."
          },
          {
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string",
              "example": "court|Padel"
            },
            "description": "Only the rows of one resource type, a `value` from `typeOptions`."
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "example": "no_show"
            },
            "description": "Only the rows with this booking status."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            },
            "description": "How many rows a page holds."
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "How many rows to skip."
          }
        ],
        "responses": {
          "200": {
            "description": "A page of the audit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformBookingAudit"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key lacks `bookings:read`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/reports/at-risk": {
      "get": {
        "operationId": "getAtRiskReport",
        "summary": "Who is at risk of leaving",
        "description": "The admin's Members › At-risk customers report: the Billable Members the organization's At Risk and Declining smart tags apply to today, with when they last came, their visits in the last period and the one before, their plan and what it is worth a month (ex-tax), and when they were tagged. The tags are read, never recomputed: the thresholds are the organization's own smart tag rules, returned with the report. There is no period: it is today's list.\n\nReadable with `analytics:read`. The people need `contacts:read` as well: without it `rows` and `total` are null and the figures come alone, as `get_members_report` answers its lifecycle; `rowsScope` names the scope. Paged with `limit` and `offset`. Reports have their own limit of 20 requests a minute, on top of the platform's.\n",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only the people of this club."
          },
          {
            "in": "query",
            "name": "signal",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "at_risk",
                "declining"
              ],
              "default": "all"
            },
            "description": "Only the people with this signal."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            },
            "description": "How many rows a page holds."
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "How many rows to skip."
          }
        ],
        "responses": {
          "200": {
            "description": "The report, with a page of its people",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformAtRiskReport"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key lacks `analytics:read`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/reports/renewals": {
      "get": {
        "operationId": "getRenewalsReport",
        "summary": "Which memberships end soon",
        "description": "The admin's Members › Renewals report: the memberships ending in the next `days` days with nothing after them (ending with no renewal, or cancelled at the period's end), the Passes and Drop-ins running out (ending, or with two sessions or hours left or fewer), and those that renew automatically, each in its group with its last covered day and what it is worth a month (ex-tax). Only Billable Members are listed; a membership already followed by another is not.\n\nReadable with `analytics:read`. The people need `contacts:read` as well: without it `rows` and `total` are null and the figures come alone, as `get_members_report` answers its lifecycle; `rowsScope` names the scope. Paged with `limit` and `offset`. Reports have their own limit of 20 requests a minute, on top of the platform's.\n",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "days",
            "schema": {
              "type": "integer",
              "enum": [
                7,
                14,
                30,
                60
              ],
              "default": 30
            },
            "description": "How many days ahead, from today on the organization's clock."
          },
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only the people of this club."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            },
            "description": "How many rows a page holds."
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "How many rows to skip."
          }
        ],
        "responses": {
          "200": {
            "description": "The report, with a page of its people",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformRenewalsReport"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key lacks `analytics:read`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/reports/promotion-eligibility": {
      "get": {
        "operationId": "getPromotionEligibilityReport",
        "summary": "Who is ready for their next rank",
        "description": "The admin's Members › Progression report: on each enabled progression track, every Billable Member holding a rank, with where they stand toward the next one: eligible (every requirement met), on track, stalled (longer at the rank than the track's median stay) or no requirement, their sessions and days at the rank, and their promotion log. Each track's summary counts the eligible and stalled members, and the promotions in the period when `from` and `to` are given.\n\nReadable with `analytics:read`. The people need `contacts:read` as well: without it `rows` and `total` are null and the figures come alone, as `get_members_report` answers its lifecycle; `rowsScope` names the scope. Paged with `limit` and `offset`. Reports have their own limit of 20 requests a minute, on top of the platform's.\n",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "from",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "First day of the period whose promotions the summary counts."
          },
          {
            "in": "query",
            "name": "to",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Last day of that period, inclusive."
          },
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only the people of this club."
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "example": "eligible"
            },
            "description": "Only the members with these statuses, comma-separated (eligible, on_track, stalled, no_requirement). None lists them all."
          },
          {
            "in": "query",
            "name": "ageBands",
            "schema": {
              "type": "string"
            },
            "description": "Only the members in these age bands, comma-separated."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            },
            "description": "How many rows a page holds."
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "How many rows to skip."
          }
        ],
        "responses": {
          "200": {
            "description": "The report, with a page of its people",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformPromotionEligibilityReport"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key lacks `analytics:read`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/reports/cancellations": {
      "get": {
        "operationId": "getCancellationsReport",
        "summary": "Who cancels, how late, and where",
        "description": "The admin's Bookings › Cancellations and no-shows report for a period: how many bookings were cancelled, how many late (with less notice than a full refund needs under the rules the booking was made on) and how many were no-shows (where a policy requires check-in), with the money kept, still owed and refunded, in total and by class type, area and time slot; and, as the rows, the customers who cancel most. A period may span at most 366 days.\n\nReadable with `analytics:read`. The people need `contacts:read` as well: without it `rows` and `total` are null and the figures come alone, as `get_members_report` answers its lifecycle; `rowsScope` names the scope. Paged with `limit` and `offset`. Reports have their own limit of 20 requests a minute, on top of the platform's.\n",
        "tags": [
          "Reports"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "from",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "First day of the period (`YYYY-MM-DD`), on the organization's clock."
          },
          {
            "in": "query",
            "name": "to",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Last day of the period, inclusive."
          },
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only the bookings of this club."
          },
          {
            "in": "query",
            "name": "areaTypeId",
            "schema": {
              "type": "integer"
            },
            "description": "Only the bookings of this area type."
          },
          {
            "in": "query",
            "name": "instructorIds",
            "schema": {
              "type": "string",
              "example": "3,7"
            },
            "description": "Only the bookings these instructors teach or coach, comma-separated."
          },
          {
            "in": "query",
            "name": "classTypeIds",
            "schema": {
              "type": "string"
            },
            "description": "Only the seats on these class types, comma-separated."
          },
          {
            "in": "query",
            "name": "programIds",
            "schema": {
              "type": "string"
            },
            "description": "Only the seats on these programs' class types, comma-separated."
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            },
            "description": "How many rows a page holds."
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "How many rows to skip."
          }
        ],
        "responses": {
          "200": {
            "description": "The report, with a page of its people",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformCancellationsReport"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key lacks `analytics:read`",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/reviews": {
      "get": {
        "operationId": "listReviews",
        "summary": "List reviews",
        "description": "Reviews of the organization's clubs, newest first: those members left in 1club and those imported from outside (`source`, such as `google`), with the club's public reply and the private note the reviewer left for the club alone. Read only. A review names its author and is personal data.\n\n`search` is full text over the title, comment, reply, private note and author name: every word must appear, accents are ignored and word starts match, so `knee` finds \"knees\" and `cafe` finds \"café\".\n",
        "tags": [
          "Reviews"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "clubId",
            "schema": {
              "type": "integer"
            },
            "description": "Only reviews of this club"
          },
          {
            "in": "query",
            "name": "rating",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 5
            },
            "description": "Only reviews with this overall rating"
          },
          {
            "in": "query",
            "name": "source",
            "schema": {
              "type": "string",
              "maxLength": 40
            },
            "description": "Only reviews from this source, such as `1club` or `google`"
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string",
              "maxLength": 120
            },
            "description": "Words in the review, reply, private note or author name. Every word must appear; accents ignored; word starts match; a search reads at most the 1000 newest matches"
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "in": "query",
            "name": "offset",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of reviews",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformReviewPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `reviews:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/reviews/{id}": {
      "get": {
        "operationId": "getReview",
        "summary": "Get a review",
        "description": "One review of one of the organization's clubs, with the club's reply and the private note the reviewer left for the club alone. A deleted review is a 404. A review names its author and is personal data.\n",
        "tags": [
          "Reviews"
        ],
        "security": [
          {
            "customerApiAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "1club review id"
          }
        ],
        "responses": {
          "200": {
            "description": "The review",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformReview"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/PlatformBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/PlatformUnauthorized"
          },
          "403": {
            "description": "API key is missing the required `reviews:read` scope",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlatformError"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/PlatformNotFound"
          },
          "429": {
            "$ref": "#/components/responses/PlatformRateLimited"
          }
        }
      }
    },
    "/v1/platform/website/templates": {
      "get": {
        "operationId": "listWebsiteTemplates",
        "summary": "List the Website Templates",
        "description": "Every template the gallery offers, with its business types, fonts, showcase colours and the sections on each page. Requires the website:read scope.",
        "tags": [
          "Platform Website"
        ],
        "security": [
          {
            "PlatformApiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "The template catalog"
          }
        }
      }
    },
    "/v1/platform/website/templates/{templateKey}/apply-look": {
      "post": {
        "operationId": "createWebsiteTemplateApplyLook",
        "summary": "Give the website a template's look",
        "description": "Writes the template's design tokens to the draft, replacing the look before them and leaving every page and all content alone. The club's brand colours stay unless useTemplateColors is true. Nothing is public until a release. Requires the website:write scope.",
        "tags": [
          "Platform Website"
        ],
        "security": [
          {
            "PlatformApiKey": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "templateKey",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "siteId",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "siteId": {
                    "type": "integer"
                  },
                  "useTemplateColors": {
                    "type": "boolean"
                  },
                  "restyleSections": {
                    "type": "boolean",
                    "description": "Also give the sections already on the site the template's layout and style. Their words, photos and lists stay."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The saved draft and its resolved theme. `usedTemplateColors` names the colours taken from the template, and `fadingBrandColors` the colours the Brand Book kept that are hard to read on this look.\n"
          },
          "400": {
            "description": "No template of that name"
          }
        }
      }
    },
    "/v1/platform/website/personalize-copy": {
      "post": {
        "operationId": "createWebsitePersonalizeCopy",
        "summary": "Rewrite the website's copy for the business",
        "description": "Rewrites copy still in a Website Template's words, into the draft, from the business's own data. A figure or claim its data cannot support is left out. With everything true it rewrites all the copy, including what the customer wrote. Nothing is public until a release. Requires the website:write scope.",
        "tags": [
          "Platform Website"
        ],
        "security": [
          {
            "PlatformApiKey": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "siteId",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "siteId": {
                    "type": "integer"
                  },
                  "instructions": {
                    "type": "string"
                  },
                  "everything": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "How much was rewritten, how much was left out, and the languages written"
          },
          "409": {
            "$ref": "#/components/responses/PlatformConflict"
          },
          "503": {
            "description": "The copy could not be written; nothing changed"
          }
        }
      }
    },
    "/v1/platform/website/readiness": {
      "get": {
        "operationId": "getWebsiteReadiness",
        "summary": "What the website still needs",
        "description": "The stock photos still in place, the sections hidden for lack of data, the figures with nothing to show and the links to pages that do not exist. Requires the website:read scope.",
        "tags": [
          "Platform Website"
        ],
        "security": [
          {
            "PlatformApiKey": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "siteId",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The readiness audit"
          }
        }
      }
    }
  },
  "tags": []
}
