{
  "x-generated": "GENERATED by docs:api (standalone src/lib/docs). Do not edit by hand: re-run `npm run docs:api`.",
  "components": {
    "responses": {
      "BadRequest": {
        "content": {
          "application/json": {
            "examples": {
              "invalid_id": {
                "summary": "A record id that isn't a valid id",
                "value": {
                  "className": "bad-request",
                  "code": 400,
                  "data": {},
                  "errors": {
                    "id": "Invalid record id."
                  },
                  "message": "Invalid record id.",
                  "name": "BadRequest"
                }
              },
              "invalid_request": {
                "summary": "A query value outside the documented schema",
                "value": {
                  "className": "bad-request",
                  "code": 400,
                  "errors": {},
                  "message": "Invalid request.",
                  "name": "BadRequest"
                }
              }
            },
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "The request is malformed (query, header or body)."
      },
      "Conflict": {
        "content": {
          "application/json": {
            "examples": {
              "in_progress": {
                "summary": "Still running",
                "value": {
                  "className": "conflict",
                  "code": 409,
                  "data": {
                    "code": "IDEMPOTENCY_IN_PROGRESS"
                  },
                  "errors": {},
                  "message": "A request with this Idempotency-Key is still being processed. Try again shortly.",
                  "name": "Conflict"
                }
              },
              "result_unavailable": {
                "summary": "Done, result not kept",
                "value": {
                  "className": "conflict",
                  "code": 409,
                  "data": {
                    "code": "IDEMPOTENCY_RESULT_UNAVAILABLE"
                  },
                  "errors": {},
                  "message": "This request was already completed, but its result can't be shown again. Refresh to see it.",
                  "name": "Conflict"
                }
              }
            },
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Same Idempotency-Key: the first request is still running, or its result wasn't kept."
      },
      "Forbidden": {
        "content": {
          "application/json": {
            "examples": {
              "access_denied": {
                "summary": "The token's owner doesn't hold the permission",
                "value": {
                  "className": "forbidden",
                  "code": 403,
                  "data": {
                    "code": "ACCESS_DENIED"
                  },
                  "errors": {},
                  "message": "You don't have permission to do this.",
                  "name": "Forbidden"
                }
              },
              "banned": {
                "summary": "Too many refused requests from this address: banned for the window",
                "value": {
                  "className": "forbidden",
                  "code": 403,
                  "data": {
                    "code": "RATE_LIMITED",
                    "retry_after_seconds": 30
                  },
                  "errors": {},
                  "message": "Rate limit exceeded, retry in 1 minute",
                  "name": "Forbidden"
                }
              },
              "route_refused": {
                "summary": "Refused by the screen's own rule",
                "value": {
                  "message": "Access denied"
                }
              },
              "scope_denied": {
                "summary": "Token scopes don't cover the permission",
                "value": {
                  "className": "forbidden",
                  "code": 403,
                  "data": {
                    "code": "API_TOKEN_SCOPE_DENIED"
                  },
                  "errors": {},
                  "message": "This API token isn't allowed to do this.",
                  "name": "Forbidden"
                }
              }
            },
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Not allowed: the token's scopes don't cover this operation, or its owner doesn't hold the permission now."
      },
      "NotFound": {
        "content": {
          "application/json": {
            "examples": {
              "feature_disabled": {
                "summary": "Feature off for this business",
                "value": {
                  "className": "not-found",
                  "code": 404,
                  "data": {
                    "code": "FEATURE_DISABLED"
                  },
                  "errors": {},
                  "message": "Not found",
                  "name": "NotFound"
                }
              },
              "not_found": {
                "summary": "No such record",
                "value": {
                  "message": "Record not found"
                }
              }
            },
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Not found, or the feature behind it is off for this business."
      },
      "PaymentRequiredPlanLimit": {
        "content": {
          "application/json": {
            "examples": {
              "expired": {
                "summary": "Subscription expired",
                "value": {
                  "className": "payment-required",
                  "code": 402,
                  "data": {
                    "code": "SUBSCRIPTION_EXPIRED"
                  },
                  "errors": {},
                  "message": "This workspace is locked.",
                  "name": "PaymentRequired"
                }
              },
              "plan_limit": {
                "summary": "Plan limit reached",
                "value": {
                  "className": "payment-required",
                  "code": 402,
                  "data": {
                    "code": "PLAN_LIMIT_REACHED",
                    "key": "records",
                    "limit": 100,
                    "used": 100
                  },
                  "errors": {},
                  "message": "Your plan's limit has been reached. Upgrade to add more.",
                  "name": "PaymentRequired"
                }
              },
              "read_only": {
                "summary": "Subscription in grace (read-only)",
                "value": {
                  "className": "payment-required",
                  "code": 402,
                  "data": {
                    "code": "SUBSCRIPTION_READ_ONLY"
                  },
                  "errors": {},
                  "message": "This workspace is read-only.",
                  "name": "PaymentRequired"
                }
              }
            },
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "The subscription allows no changes now, or the plan's limit for this kind of record is reached."
      },
      "PaymentRequiredRead": {
        "content": {
          "application/json": {
            "examples": {
              "expired": {
                "summary": "Subscription expired",
                "value": {
                  "className": "payment-required",
                  "code": 402,
                  "data": {
                    "code": "SUBSCRIPTION_EXPIRED"
                  },
                  "errors": {},
                  "message": "This workspace is locked.",
                  "name": "PaymentRequired"
                }
              }
            },
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "The business's subscription has ended (locked)."
      },
      "PaymentRequiredWrite": {
        "content": {
          "application/json": {
            "examples": {
              "expired": {
                "summary": "Subscription expired",
                "value": {
                  "className": "payment-required",
                  "code": 402,
                  "data": {
                    "code": "SUBSCRIPTION_EXPIRED"
                  },
                  "errors": {},
                  "message": "This workspace is locked.",
                  "name": "PaymentRequired"
                }
              },
              "read_only": {
                "summary": "Subscription in grace (read-only)",
                "value": {
                  "className": "payment-required",
                  "code": 402,
                  "data": {
                    "code": "SUBSCRIPTION_READ_ONLY"
                  },
                  "errors": {},
                  "message": "This workspace is read-only.",
                  "name": "PaymentRequired"
                }
              }
            },
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "The business's subscription allows no changes now (grace period: read-only; ended: locked)."
      },
      "ServerError": {
        "content": {
          "application/json": {
            "examples": {
              "server_error": {
                "summary": "Unexpected failure",
                "value": {
                  "className": "internal-server-error",
                  "code": 500,
                  "errors": {},
                  "message": "Something went wrong. Please try again.",
                  "name": "InternalServerError"
                }
              }
            },
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Something failed on the server. The message is always generic; retry later."
      },
      "TooManyRequests": {
        "content": {
          "application/json": {
            "examples": {
              "rate_limited": {
                "summary": "Per-token limit reached",
                "value": {
                  "className": "too-many-requests",
                  "code": 429,
                  "data": {
                    "code": "RATE_LIMITED",
                    "retry_after_seconds": 30
                  },
                  "errors": {},
                  "message": "RATE_LIMITED",
                  "name": "TooManyRequests"
                }
              }
            },
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "Over a rate limit. Wait `retry-after` seconds (also in `data.retry_after_seconds`) and try again.",
        "headers": {
          "retry-after": {
            "description": "Seconds to wait before retrying.",
            "schema": {
              "type": "string"
            }
          },
          "x-ratelimit-limit": {
            "description": "Requests allowed in the window (the most restrictive limit that applies).",
            "schema": {
              "type": "string"
            }
          },
          "x-ratelimit-policy": {
            "description": "Which limit is closest: token or ip.",
            "schema": {
              "type": "string"
            }
          },
          "x-ratelimit-remaining": {
            "description": "Requests left in the window.",
            "schema": {
              "type": "string"
            }
          },
          "x-ratelimit-reset": {
            "description": "When the window resets (unix seconds).",
            "schema": {
              "type": "string"
            }
          }
        }
      },
      "Unauthorized": {
        "content": {
          "application/json": {
            "examples": {
              "owner_inactive": {
                "summary": "Token unknown, revoked, expired or owner inactive",
                "value": {
                  "className": "unauthorized",
                  "code": 401,
                  "data": {
                    "code": "API_TOKEN_OWNER_INACTIVE"
                  },
                  "errors": {},
                  "message": "This API token is no longer valid.",
                  "name": "Unauthorized"
                }
              },
              "route_not_listed": {
                "summary": "This route isn't open to API tokens",
                "value": {
                  "className": "unauthorized",
                  "code": 401,
                  "data": {
                    "code": "API_TOKEN_SCOPE_DENIED"
                  },
                  "errors": {},
                  "message": "This API token isn't allowed to do this.",
                  "name": "Unauthorized"
                }
              }
            },
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "The API token can't be used: unknown, revoked, disabled or expired, its owner is no longer active, or this route isn't open to API tokens."
      },
      "Unprocessable": {
        "content": {
          "application/json": {
            "examples": {
              "key_reused": {
                "summary": "Key reused with another body",
                "value": {
                  "className": "unprocessable",
                  "code": 422,
                  "data": {
                    "code": "IDEMPOTENCY_KEY_REUSED"
                  },
                  "errors": {},
                  "message": "This Idempotency-Key was already used for a different request.",
                  "name": "Unprocessable"
                }
              }
            },
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "This Idempotency-Key was already used with a different body."
      },
      "ValidationFailed": {
        "content": {
          "application/json": {
            "examples": {
              "field_errors": {
                "summary": "Field errors",
                "value": {
                  "className": "bad-request",
                  "code": 400,
                  "data": {},
                  "errors": {
                    "name": "Name is required."
                  },
                  "message": "Please fix the highlighted fields",
                  "name": "BadRequest"
                }
              },
              "idempotency_key_invalid": {
                "summary": "A malformed Idempotency-Key (actions that use it)",
                "value": {
                  "className": "bad-request",
                  "code": 400,
                  "data": {
                    "code": "IDEMPOTENCY_KEY_INVALID"
                  },
                  "errors": {},
                  "message": "The Idempotency-Key must be 1–128 letters, digits, '.', '_', ':' or '-'.",
                  "name": "BadRequest"
                }
              }
            },
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "description": "The action refused the input: `errors` names each field and what is wrong."
      }
    },
    "schemas": {
      "Error": {
        "additionalProperties": true,
        "description": "An error answer. `message` is always there; the rest comes with every error the server's error handler shapes (a route's own refusal may carry `message` only).",
        "properties": {
          "className": {
            "type": "string"
          },
          "code": {
            "description": "The HTTP status again.",
            "type": "integer"
          },
          "data": {
            "additionalProperties": true,
            "description": "`code` is the typed error code to branch on. Some codes add keys: RATE_LIMITED → retry_after_seconds; PLAN_LIMIT_REACHED → key, limit, used.",
            "properties": {
              "code": {
                "type": "string"
              },
              "key": {
                "type": "string"
              },
              "kind": {
                "type": "string"
              },
              "limit": {
                "type": "number"
              },
              "retry_after_seconds": {
                "minimum": 1,
                "type": "integer"
              },
              "used": {
                "type": "number"
              }
            },
            "type": "object"
          },
          "errors": {
            "additionalProperties": true,
            "description": "Field key → what is wrong with it (validation refusals).",
            "type": "object"
          },
          "message": {
            "description": "Readable text; show it, never parse it.",
            "type": "string"
          },
          "name": {
            "description": "Error class, e.g. Unauthorized",
            "type": "string"
          }
        },
        "required": [
          "message"
        ],
        "type": "object"
      },
      "GymLeads": {
        "additionalProperties": true,
        "properties": {
          "_id": {
            "description": "A record id.",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": "string"
          },
          "branch_display": {
            "description": "Branch Display value worked out by the server."
          },
          "branch_id": {
            "description": "Branch ID",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": [
              "string",
              "null"
            ]
          },
          "follow_up_at": {
            "description": "Follow-up On",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "followups_stopped_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "interest": {
            "description": "Shown as: `hot` = Hot; `warm` = Warm; `cold` = Cold.",
            "enum": [
              "hot",
              "warm",
              "cold",
              null
            ],
            "type": [
              "string",
              "null"
            ]
          },
          "interested_plan": {
            "description": "A record id.",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": [
              "string",
              "null"
            ]
          },
          "interested_plan_display": {
            "description": "Interested Plan Display value worked out by the server."
          },
          "isActive": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "marketing_opt_out": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "marketing_opt_out_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "description": "Shown as: `walk_in` = Walk-in; `phone` = Phone; `instagram` = Instagram; `referral` = Referral.",
            "enum": [
              "walk_in",
              "phone",
              "instagram",
              "referral",
              null
            ],
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "enum": [
              "open",
              "joined",
              "dropped",
              null
            ],
            "type": [
              "string",
              "null"
            ]
          },
          "tenant_id": {
            "description": "A record id.",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "_id"
        ],
        "title": "GymLeads",
        "type": "object"
      },
      "GymMembers": {
        "additionalProperties": true,
        "properties": {
          "_id": {
            "description": "A record id.",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": "string"
          },
          "assigned_trainer": {
            "description": "A record id.",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": [
              "string",
              "null"
            ]
          },
          "blood_group": {
            "type": [
              "string",
              "null"
            ]
          },
          "current_end_date": {
            "description": "Membership Ends",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "current_expiring_from": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "current_membership_id": {
            "description": "A record id.",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": [
              "string",
              "null"
            ]
          },
          "current_valid_till": {
            "description": "Valid till Display value worked out by the server."
          },
          "emergency_contact": {
            "type": [
              "string",
              "null"
            ]
          },
          "full_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "gender": {
            "description": "Shown as: `male` = Male; `female` = Female; `other` = Other.",
            "enum": [
              "male",
              "female",
              "other",
              null
            ],
            "type": [
              "string",
              "null"
            ]
          },
          "goal": {
            "type": [
              "string",
              "null"
            ]
          },
          "has_due": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "home_branch": {
            "description": "Home Branch ID",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": [
              "string",
              "null"
            ]
          },
          "home_branch_display": {
            "description": "Home Branch Display value worked out by the server."
          },
          "isActive": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "join_date": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "marketing_consent": {
            "description": "Marketing Messages OK",
            "type": [
              "boolean",
              "null"
            ]
          },
          "marketing_opt_out": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "marketing_opt_out_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "photo": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "description": "Display value worked out by the server."
          },
          "tenant_id": {
            "description": "A record id.",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": [
              "string",
              "null"
            ]
          },
          "trainer_display": {
            "description": "Assigned Trainer Display value worked out by the server."
          }
        },
        "required": [
          "_id"
        ],
        "title": "GymMembers",
        "type": "object"
      },
      "GymMemberships": {
        "additionalProperties": true,
        "properties": {
          "_id": {
            "description": "A record id.",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": "string"
          },
          "addon_price_paid": {
            "description": "Add-on Price",
            "type": [
              "number",
              "null"
            ]
          },
          "amount_paid": {
            "description": "Paid",
            "type": [
              "number",
              "null"
            ]
          },
          "balance_amount": {
            "description": "Balance",
            "type": [
              "number",
              "null"
            ]
          },
          "branch_access": {
            "description": "Shown as: `home_only` = Home branch only; `all_branches` = All branches; `custom` = Custom.",
            "enum": [
              "home_only",
              "all_branches",
              "custom",
              null
            ],
            "type": [
              "string",
              "null"
            ]
          },
          "branch_access_display": {
            "description": "Branch Access List Display value worked out by the server."
          },
          "branch_access_list": {
            "description": "Branch Access List",
            "items": {
              "description": "A record id.",
              "pattern": "^[0-9a-fA-F]{24}$",
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "branch_display": {
            "description": "Branch Display value worked out by the server."
          },
          "branch_id": {
            "description": "Branch ID",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": [
              "string",
              "null"
            ]
          },
          "discount_amount": {
            "description": "Discount",
            "type": [
              "number",
              "null"
            ]
          },
          "end_date": {
            "description": "End Date",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "expiry_reminder_refused_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "invoice_due_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "invoice_id": {
            "description": "A record id.",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": [
              "string",
              "null"
            ]
          },
          "invoice_number": {
            "description": "Invoice",
            "type": [
              "string",
              "null"
            ]
          },
          "invoice_sync_due_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "isActive": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "last_dues_reminder_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "last_expiry_reminder_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "member_id": {
            "description": "A record id.",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": [
              "string",
              "null"
            ]
          },
          "member_name": {
            "description": "Member Display value worked out by the server."
          },
          "member_phone": {
            "description": "Member Phone",
            "type": [
              "string",
              "null"
            ]
          },
          "next_pack_display": {
            "description": "Next Pack Display value worked out by the server."
          },
          "payment_status": {
            "enum": [
              "pending",
              "partial",
              "paid",
              null
            ],
            "type": [
              "string",
              "null"
            ]
          },
          "plan_id": {
            "description": "A record id.",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": [
              "string",
              "null"
            ]
          },
          "plan_kind": {
            "enum": [
              "membership",
              "pt_pack",
              null
            ],
            "type": [
              "string",
              "null"
            ]
          },
          "plan_name": {
            "description": "Plan",
            "type": [
              "string",
              "null"
            ]
          },
          "price_paid": {
            "description": "Plan Price",
            "type": [
              "number",
              "null"
            ]
          },
          "reminder_days_before_expiry": {
            "type": [
              "number",
              "null"
            ]
          },
          "replaces_membership_id": {
            "description": "A record id.",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": [
              "string",
              "null"
            ]
          },
          "schedule_text": {
            "type": [
              "string",
              "null"
            ]
          },
          "sessions_total": {
            "type": [
              "number",
              "null"
            ]
          },
          "sessions_used": {
            "type": [
              "number",
              "null"
            ]
          },
          "source": {
            "description": "Shown as: `new` = New; `renewal` = Renewal.",
            "enum": [
              "new",
              "renewal",
              null
            ],
            "type": [
              "string",
              "null"
            ]
          },
          "start_date": {
            "description": "Start Date",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "description": "Display value worked out by the server."
          },
          "tenant_id": {
            "description": "A record id.",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": [
              "string",
              "null"
            ]
          },
          "total_amount": {
            "description": "Total",
            "type": [
              "number",
              "null"
            ]
          },
          "trainer_display": {
            "description": "Trainer Display value worked out by the server."
          },
          "trainer_id": {
            "description": "Trainer ID",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": [
              "string",
              "null"
            ]
          },
          "valid_till": {
            "description": "Valid till Display value worked out by the server."
          }
        },
        "required": [
          "_id"
        ],
        "title": "GymMemberships",
        "type": "object"
      },
      "GymPayments": {
        "additionalProperties": true,
        "properties": {
          "_id": {
            "description": "A record id.",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": "string"
          },
          "amount": {
            "type": [
              "number",
              "null"
            ]
          },
          "branch_display": {
            "description": "Branch Display value worked out by the server."
          },
          "branch_id": {
            "description": "A record id.",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": [
              "string",
              "null"
            ]
          },
          "date": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "isActive": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "member_id": {
            "description": "A record id.",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": [
              "string",
              "null"
            ]
          },
          "member_name": {
            "description": "Member Display value worked out by the server."
          },
          "membership_id": {
            "description": "A record id.",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": [
              "string",
              "null"
            ]
          },
          "membership_snapshot": {},
          "mode": {
            "description": "Shown as: `upi` = UPI; `cash` = Cash; `bank_transfer` = Bank transfer; `online` = Online.",
            "enum": [
              "upi",
              "cash",
              "bank_transfer",
              "online",
              null
            ],
            "type": [
              "string",
              "null"
            ]
          },
          "pay_request_id": {
            "description": "A record id.",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": [
              "string",
              "null"
            ]
          },
          "plan_name": {
            "description": "Plan",
            "type": [
              "string",
              "null"
            ]
          },
          "receipt_no": {
            "type": [
              "string",
              "null"
            ]
          },
          "recorded_by": {
            "description": "A record id.",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": [
              "string",
              "null"
            ]
          },
          "tenant_id": {
            "description": "A record id.",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": [
              "string",
              "null"
            ]
          },
          "trainer_share_amount": {
            "description": "Trainer Share",
            "type": [
              "number",
              "null"
            ]
          },
          "void_reason": {
            "description": "Reason",
            "type": [
              "string",
              "null"
            ]
          },
          "voided_at": {
            "description": "Voided On",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "voided_by": {
            "description": "A record id.",
            "pattern": "^[0-9a-fA-F]{24}$",
            "type": [
              "string",
              "null"
            ]
          },
          "voided_by_name": {
            "description": "Voided By",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "_id"
        ],
        "title": "GymPayments",
        "type": "object"
      }
    },
    "securitySchemes": {
      "apiToken": {
        "description": "An API token (`Authorization: Bearer <token>`). Each operation lists the scope (permission key) it needs; any one of several listed is enough. A preset scope `preset:<value>` stands for all its keys.",
        "scheme": "bearer",
        "type": "http",
        "x-scope-presets": [
          {
            "label": "Members — read",
            "scope": "preset:members_read",
            "scopes": [
              "page:members:view"
            ]
          },
          {
            "label": "Members — add and edit",
            "scope": "preset:members_write",
            "scopes": [
              "page:members:create",
              "page:members:edit"
            ]
          },
          {
            "label": "Memberships — read",
            "scope": "preset:memberships_read",
            "scopes": [
              "page:memberships:view"
            ]
          },
          {
            "label": "Payments — read",
            "scope": "preset:payments_read",
            "scopes": [
              "page:payments:view"
            ]
          },
          {
            "label": "Leads — add (website enquiry forms)",
            "scope": "preset:leads_write",
            "scopes": [
              "page:leads:create"
            ]
          },
          {
            "label": "Reports — read",
            "scope": "preset:reports_read",
            "scopes": [
              "dashboard:gym_reports:view"
            ]
          }
        ],
        "x-scopes": {
          "dashboard:gym_reports:view": "Needed by: getDashboardData_gym_reports",
          "page:active_members:create": "Needed by: runAction_add_member",
          "page:active_members:edit": "Needed by: runAction_edit_member",
          "page:expired_members:create": "Needed by: runAction_add_member",
          "page:expired_members:edit": "Needed by: runAction_edit_member",
          "page:expiring_members:create": "Needed by: runAction_add_member",
          "page:expiring_members:edit": "Needed by: runAction_edit_member",
          "page:leads:create": "Needed by: runAction_add_lead",
          "page:leads:view": "Needed by: getRecord_leads, listRecords_leads",
          "page:leads_follow_up_today:create": "Needed by: runAction_add_lead",
          "page:members:create": "Needed by: runAction_add_member",
          "page:members:edit": "Needed by: runAction_edit_member",
          "page:members:view": "Needed by: getRecord_members, listRecords_members",
          "page:memberships:view": "Needed by: getRecord_memberships, listRecords_memberships",
          "page:payments:view": "Needed by: getRecord_payments, listRecords_payments"
        }
      }
    }
  },
  "info": {
    "description": "**Authentication.** Send `Authorization: Bearer <API token>`. Someone in the business whose role may manage API tokens (the business decides which roles) creates the token in the app and picks its scopes (permission keys, or presets that stand for several). A token reaches only the operations below; it acts as its owner, in the owner's business, and never does more than the owner may do now.\n\n**Answers.** Each operation documents its own success shape (the record routes answer `{ total, page, per_page, records }` / `{ record }`, actions `{ success, records, meta? }`, dashboards `{ widgets, meta }`). Errors share one shape (`Error`): branch on `data.code`, show `message`.\n\n**Errors.** 400 malformed request or field errors (`errors`: field → message) · 401 token unusable · 402 subscription or plan limit · 403 scope or permission · 404 not found or feature off · 409 / 422 Idempotency-Key conflicts · 429 rate limit · 500 server failure (generic message).\n\n**Webhooks.** None yet: the platform sends no outgoing webhooks to API clients, so `webhooks` is empty.\n\n**Rate limits.** 120 requests per minute per token, and 200 requests per minute per client address. Over a limit → 429 `RATE_LIMITED` with `retry-after` (seconds) and `data.retry_after_seconds`. Every answer carries `x-ratelimit-limit`, `x-ratelimit-remaining`, `x-ratelimit-reset` and `x-ratelimit-policy`.\n\nThe server also limits every client address to 100 requests per 1 minute; repeated breaches ban the address for the window (403 with `data.code` `RATE_LIMITED`).",
    "title": "My Gym Ops API",
    "version": "1.0.0+fe013bc67ced"
  },
  "openapi": "3.1.0",
  "paths": {
    "/action/add_lead/run": {
      "post": {
        "description": "Runs “Add Enquiry” as the token's owner, in the token's business.\n\nScope: `page:leads:create` or `page:leads_follow_up_today:create` (this action only creates records). The owner must hold it too.\n\nField limits (length, range, pattern, choices) are the ones the app's forms apply; send values within them.\n\nNeeds the business feature `lead_enquiry_management` on; off → 404 FEATURE_DISABLED.\n\nThe action also has its own access rule, checked per request.",
        "operationId": "runAction_add_lead",
        "parameters": [
          {
            "description": "Send a new unique key per intended run. A retry with the same key and body answers the first run's result (header `Idempotent-Replayed: true`) instead of running again; the same key with another body → 422, while the first run is still going → 409.",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "pattern": "^[A-Za-z0-9._:-]{1,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "follow_up_at": "2026-01-15",
                "interest": "hot",
                "name": "text",
                "note": "text",
                "source": "walk_in"
              },
              "schema": {
                "additionalProperties": true,
                "description": "The form is built per request: these are the fields it can take, and which of them are required can differ per business (a missing one is answered 400 with the field named).",
                "properties": {
                  "branch_id": {
                    "description": "Branch ID."
                  },
                  "branch_name": {
                    "description": "Branch. A value from `gym_branches` (lookup)."
                  },
                  "follow_up_at": {
                    "description": "Follow-up Date.",
                    "format": "date",
                    "type": "string"
                  },
                  "interest": {
                    "description": "Interest. Shown as: `hot` = Hot; `warm` = Warm; `cold` = Cold.",
                    "enum": [
                      "hot",
                      "warm",
                      "cold"
                    ]
                  },
                  "interested_plan": {
                    "description": "Interested Plan ID."
                  },
                  "interested_plan_name": {
                    "description": "Interested Plan. A value from `gym_membership_plans` (lookup)."
                  },
                  "name": {
                    "description": "Name.",
                    "type": "string"
                  },
                  "note": {
                    "description": "Note.",
                    "type": "string"
                  },
                  "phone": {
                    "description": "Phone.",
                    "pattern": "^\\s*[ ().-]*(?:(?:(?:\\+|00)?[ ().-]*9[ ().-]*1[ ().-]*|0[ ().-]*)?(?:[0-9][ ().-]*){9}[0-9]|(?:\\+|00)[ ().-]*(?!9[ ().-]*1)[1-9](?:[ ().-]*[0-9]){6,14})[ ().-]*\\s*$",
                    "type": "string"
                  },
                  "source": {
                    "description": "Source. Shown as: `walk_in` = Walk-in; `phone` = Phone; `instagram` = Instagram; `referral` = Referral.",
                    "enum": [
                      "walk_in",
                      "phone",
                      "instagram",
                      "referral"
                    ]
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "records": [
                    {
                      "_id": "64b000000000000000000001",
                      "branch_id": "64b000000000000000000001",
                      "follow_up_at": "2026-01-15T09:30:00.000Z",
                      "followups_stopped_at": "2026-01-15T09:30:00.000Z",
                      "interest": "hot",
                      "interested_plan": "64b000000000000000000001",
                      "isActive": true,
                      "marketing_opt_out": true,
                      "marketing_opt_out_at": "2026-01-15T09:30:00.000Z",
                      "name": "text",
                      "note": "text",
                      "phone": "text",
                      "source": "walk_in",
                      "status": "open",
                      "tenant_id": "64b000000000000000000001"
                    }
                  ],
                  "success": true
                },
                "schema": {
                  "properties": {
                    "meta": {
                      "additionalProperties": true,
                      "description": "Extra outputs of the run (only when the run produced some).",
                      "type": "object"
                    },
                    "records": {
                      "description": "The records the run wrote, as stored.",
                      "items": {
                        "$ref": "#/components/schemas/GymLeads"
                      },
                      "type": "array"
                    },
                    "success": {
                      "const": true
                    }
                  },
                  "required": [
                    "success",
                    "records"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "The run finished.",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this is the stored answer of an earlier run with the same key.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-limit": {
                "description": "Requests allowed in the window (the most restrictive limit that applies).",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-policy": {
                "description": "Which limit is closest: token or ip.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-reset": {
                "description": "When the window resets (unix seconds).",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequiredWrite"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "security": [
          {
            "apiToken": [
              "page:leads:create"
            ]
          },
          {
            "apiToken": [
              "page:leads_follow_up_today:create"
            ]
          }
        ],
        "summary": "Add Enquiry",
        "tags": [
          "Leads"
        ]
      }
    },
    "/action/add_member/run": {
      "post": {
        "description": "Runs “Add Member” as the token's owner, in the token's business.\n\nScope: `page:members:create` or `page:active_members:create` or `page:expiring_members:create` or `page:expired_members:create` (this action only creates records). The owner must hold it too.\n\nField limits (length, range, pattern, choices) are the ones the app's forms apply; send values within them.\n\nThe action also has its own access rule, checked per request.",
        "operationId": "runAction_add_member",
        "parameters": [
          {
            "description": "Send a new unique key per intended run. A retry with the same key and body answers the first run's result (header `Idempotent-Replayed: true`) instead of running again; the same key with another body → 422, while the first run is still going → 409.",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "pattern": "^[A-Za-z0-9._:-]{1,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "blood_group": "",
                "discount_amount": 0,
                "gender": "male",
                "goal": "text",
                "join_date": "2026-01-15",
                "marketing_consent": true,
                "membership_start_date": "2026-01-15",
                "payment_amount": 0,
                "payment_mode": "upi",
                "start_membership": true
              },
              "schema": {
                "additionalProperties": true,
                "description": "The form is built per request: these are the fields it can take, and which of them are required can differ per business (a missing one is answered 400 with the field named).",
                "properties": {
                  "assigned_trainer": {
                    "description": "Trainer ID."
                  },
                  "assigned_trainer_name": {
                    "description": "Assigned Trainer. A value from `gym_staff` (lookup)."
                  },
                  "blood_group": {
                    "description": "Blood Group. Shown as: `` = —; `A+` = A+; `A-` = A-; `B+` = B+; `B-` = B-; `AB+` = AB+; `AB-` = AB-; `O+` = O+; `O-` = O-.",
                    "enum": [
                      "",
                      "A+",
                      "A-",
                      "B+",
                      "B-",
                      "AB+",
                      "AB-",
                      "O+",
                      "O-"
                    ]
                  },
                  "discount_amount": {
                    "description": "Discount. Between 0 and the plan price Used only when `start_membership` is `true`.",
                    "minimum": 0,
                    "type": "number"
                  },
                  "emergency_contact": {
                    "description": "Emergency Contact.",
                    "pattern": "^\\s*[ ().-]*(?:(?:(?:\\+|00)?[ ().-]*9[ ().-]*1[ ().-]*|0[ ().-]*)?(?:[0-9][ ().-]*){9}[0-9]|(?:\\+|00)[ ().-]*(?!9[ ().-]*1)[1-9](?:[ ().-]*[0-9]){6,14})[ ().-]*\\s*$",
                    "type": "string"
                  },
                  "full_name": {
                    "description": "Full Name.",
                    "maxLength": 60,
                    "minLength": 2,
                    "pattern": "^\\s*\\p{L}[\\p{L}\\p{M} .'-]*\\s*$",
                    "type": "string"
                  },
                  "gender": {
                    "description": "Gender. Shown as: `male` = Male; `female` = Female; `other` = Other.",
                    "enum": [
                      "male",
                      "female",
                      "other"
                    ]
                  },
                  "goal": {
                    "description": "Goal.",
                    "type": "string"
                  },
                  "home_branch": {
                    "description": "Home Branch ID."
                  },
                  "home_branch_name": {
                    "description": "Home Branch. A value from `gym_branches` (lookup)."
                  },
                  "join_date": {
                    "description": "Join Date.",
                    "format": "date",
                    "type": "string"
                  },
                  "marketing_consent": {
                    "description": "OK to send offers on WhatsApp. The member agreed to get offers and news from the gym. They can reply STOP any time.",
                    "type": "boolean"
                  },
                  "membership_start_date": {
                    "description": "Membership Start Date. Used only when `start_membership` is `true`.",
                    "format": "date",
                    "type": "string"
                  },
                  "payment_amount": {
                    "description": "Amount Paid Now. Leave blank to collect later. Up to the plan price after discount. Used only when `start_membership` is `true`.",
                    "minimum": 0,
                    "type": "number"
                  },
                  "payment_mode": {
                    "description": "Payment Mode. Shown as: `upi` = UPI; `cash` = Cash; `bank_transfer` = Bank Transfer. Used only when `start_membership` is `true`.",
                    "enum": [
                      "upi",
                      "cash",
                      "bank_transfer"
                    ]
                  },
                  "phone": {
                    "description": "WhatsApp Phone.",
                    "pattern": "^\\s*[ ().-]*(?:(?:(?:\\+|00)?[ ().-]*9[ ().-]*1[ ().-]*|0[ ().-]*)?(?:[0-9][ ().-]*){9}[0-9]|(?:\\+|00)[ ().-]*(?!9[ ().-]*1)[1-9](?:[ ().-]*[0-9]){6,14})[ ().-]*\\s*$",
                    "type": "string"
                  },
                  "photo": {
                    "description": "Photo."
                  },
                  "plan_id": {
                    "description": "Plan ID."
                  },
                  "plan_name": {
                    "description": "Plan. A value from `gym_membership_plans` (lookup). Used only when `start_membership` is `true`."
                  },
                  "plan_price": {
                    "description": "Plan Price."
                  },
                  "start_membership": {
                    "description": "Start a membership now. Pick a plan to make the member Active straight away",
                    "type": "boolean"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "records": [
                    {
                      "_id": "64b000000000000000000001",
                      "assigned_trainer": "64b000000000000000000001",
                      "blood_group": "text",
                      "current_end_date": "2026-01-15T09:30:00.000Z",
                      "current_expiring_from": "2026-01-15T09:30:00.000Z",
                      "current_membership_id": "64b000000000000000000001",
                      "emergency_contact": "text",
                      "full_name": "text",
                      "gender": "male",
                      "goal": "text",
                      "has_due": true,
                      "home_branch": "64b000000000000000000001",
                      "isActive": true,
                      "join_date": "2026-01-15T09:30:00.000Z",
                      "marketing_consent": true,
                      "marketing_opt_out": true,
                      "marketing_opt_out_at": "2026-01-15T09:30:00.000Z",
                      "phone": "text",
                      "photo": "text",
                      "tenant_id": "64b000000000000000000001"
                    }
                  ],
                  "success": true
                },
                "schema": {
                  "properties": {
                    "meta": {
                      "additionalProperties": true,
                      "description": "Extra outputs of the run (only when the run produced some).",
                      "type": "object"
                    },
                    "records": {
                      "description": "The records the run wrote, as stored.",
                      "items": {
                        "$ref": "#/components/schemas/GymMembers"
                      },
                      "type": "array"
                    },
                    "success": {
                      "const": true
                    }
                  },
                  "required": [
                    "success",
                    "records"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "The run finished.",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this is the stored answer of an earlier run with the same key.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-limit": {
                "description": "Requests allowed in the window (the most restrictive limit that applies).",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-policy": {
                "description": "Which limit is closest: token or ip.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-reset": {
                "description": "When the window resets (unix seconds).",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequiredWrite"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "security": [
          {
            "apiToken": [
              "page:active_members:create"
            ]
          },
          {
            "apiToken": [
              "page:expired_members:create"
            ]
          },
          {
            "apiToken": [
              "page:expiring_members:create"
            ]
          },
          {
            "apiToken": [
              "page:members:create"
            ]
          }
        ],
        "summary": "Add Member",
        "tags": [
          "Members"
        ]
      }
    },
    "/action/edit_member/run": {
      "post": {
        "description": "Runs “Edit Member” as the token's owner, in the token's business.\n\nScope: `page:members:edit` or `page:active_members:edit` or `page:expiring_members:edit` or `page:expired_members:edit`, with or without `id`. The owner must hold it too.\n\nField limits (length, range, pattern, choices) are the ones the app's forms apply; send values within them.\n\nThe action also has its own access rule, checked per request.",
        "operationId": "runAction_edit_member",
        "parameters": [
          {
            "description": "Send a new unique key per intended run. A retry with the same key and body answers the first run's result (header `Idempotent-Replayed: true`) instead of running again; the same key with another body → 422, while the first run is still going → 409.",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "pattern": "^[A-Za-z0-9._:-]{1,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "blood_group": "",
                "gender": "male",
                "goal": "text",
                "join_date": "2026-01-15",
                "marketing_consent": true
              },
              "schema": {
                "additionalProperties": true,
                "description": "The form is built per request: these are the fields it can take, and which of them are required can differ per business (a missing one is answered 400 with the field named).",
                "properties": {
                  "assigned_trainer": {
                    "description": "Trainer ID."
                  },
                  "assigned_trainer_name": {
                    "description": "Assigned Trainer. A value from `gym_staff` (lookup)."
                  },
                  "blood_group": {
                    "description": "Blood Group. Shown as: `` = —; `A+` = A+; `A-` = A-; `B+` = B+; `B-` = B-; `AB+` = AB+; `AB-` = AB-; `O+` = O+; `O-` = O-.",
                    "enum": [
                      "",
                      "A+",
                      "A-",
                      "B+",
                      "B-",
                      "AB+",
                      "AB-",
                      "O+",
                      "O-"
                    ]
                  },
                  "emergency_contact": {
                    "description": "Emergency Contact.",
                    "pattern": "^\\s*[ ().-]*(?:(?:(?:\\+|00)?[ ().-]*9[ ().-]*1[ ().-]*|0[ ().-]*)?(?:[0-9][ ().-]*){9}[0-9]|(?:\\+|00)[ ().-]*(?!9[ ().-]*1)[1-9](?:[ ().-]*[0-9]){6,14})[ ().-]*\\s*$",
                    "type": "string"
                  },
                  "full_name": {
                    "description": "Full Name.",
                    "maxLength": 60,
                    "minLength": 2,
                    "pattern": "^\\s*\\p{L}[\\p{L}\\p{M} .'-]*\\s*$",
                    "type": "string"
                  },
                  "gender": {
                    "description": "Gender. Shown as: `male` = Male; `female` = Female; `other` = Other.",
                    "enum": [
                      "male",
                      "female",
                      "other"
                    ]
                  },
                  "goal": {
                    "description": "Goal.",
                    "type": "string"
                  },
                  "home_branch": {
                    "description": "Home Branch ID."
                  },
                  "home_branch_name": {
                    "description": "Home Branch. A value from `gym_branches` (lookup)."
                  },
                  "id": {
                    "description": "The record to act on. Without it the run creates a new record.",
                    "pattern": "^[0-9a-fA-F]{24}$",
                    "type": "string"
                  },
                  "ids": {
                    "description": "The records of a bulk run.",
                    "items": {
                      "description": "A record id.",
                      "pattern": "^[0-9a-fA-F]{24}$",
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "join_date": {
                    "description": "Join Date.",
                    "format": "date",
                    "type": "string"
                  },
                  "marketing_consent": {
                    "description": "OK to send offers on WhatsApp. The member agreed to get offers and news from the gym. They can reply STOP any time.",
                    "type": "boolean"
                  },
                  "phone": {
                    "description": "WhatsApp Phone.",
                    "pattern": "^\\s*[ ().-]*(?:(?:(?:\\+|00)?[ ().-]*9[ ().-]*1[ ().-]*|0[ ().-]*)?(?:[0-9][ ().-]*){9}[0-9]|(?:\\+|00)[ ().-]*(?!9[ ().-]*1)[1-9](?:[ ().-]*[0-9]){6,14})[ ().-]*\\s*$",
                    "type": "string"
                  },
                  "photo": {
                    "description": "Photo."
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "records": [
                    {
                      "_id": "64b000000000000000000001",
                      "assigned_trainer": "64b000000000000000000001",
                      "blood_group": "text",
                      "current_end_date": "2026-01-15T09:30:00.000Z",
                      "current_expiring_from": "2026-01-15T09:30:00.000Z",
                      "current_membership_id": "64b000000000000000000001",
                      "emergency_contact": "text",
                      "full_name": "text",
                      "gender": "male",
                      "goal": "text",
                      "has_due": true,
                      "home_branch": "64b000000000000000000001",
                      "isActive": true,
                      "join_date": "2026-01-15T09:30:00.000Z",
                      "marketing_consent": true,
                      "marketing_opt_out": true,
                      "marketing_opt_out_at": "2026-01-15T09:30:00.000Z",
                      "phone": "text",
                      "photo": "text",
                      "tenant_id": "64b000000000000000000001"
                    }
                  ],
                  "success": true
                },
                "schema": {
                  "properties": {
                    "meta": {
                      "additionalProperties": true,
                      "description": "Extra outputs of the run (only when the run produced some).",
                      "type": "object"
                    },
                    "records": {
                      "description": "The records the run wrote, as stored.",
                      "items": {
                        "$ref": "#/components/schemas/GymMembers"
                      },
                      "type": "array"
                    },
                    "success": {
                      "const": true
                    }
                  },
                  "required": [
                    "success",
                    "records"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "The run finished.",
            "headers": {
              "Idempotent-Replayed": {
                "description": "`true` when this is the stored answer of an earlier run with the same key.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-limit": {
                "description": "Requests allowed in the window (the most restrictive limit that applies).",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-policy": {
                "description": "Which limit is closest: token or ip.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-reset": {
                "description": "When the window resets (unix seconds).",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequiredWrite"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Unprocessable"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "security": [
          {
            "apiToken": [
              "page:active_members:edit"
            ]
          },
          {
            "apiToken": [
              "page:expired_members:edit"
            ]
          },
          {
            "apiToken": [
              "page:expiring_members:edit"
            ]
          },
          {
            "apiToken": [
              "page:members:edit"
            ]
          }
        ],
        "summary": "Edit Member",
        "tags": [
          "Members"
        ]
      }
    },
    "/dashboard/gym_reports/data": {
      "get": {
        "description": "The data of the “Reports” dashboard for the token's business.\n\nScope: `dashboard:gym_reports:view` (its owner must hold it too).\n\nNeeds the business feature `advanced_analytics` on; off → 404 FEATURE_DISABLED.",
        "operationId": "getDashboardData_gym_reports",
        "parameters": [
          {
            "description": "Month (a dashboard filter).",
            "in": "query",
            "name": "month",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Branch (name/code; blank/'all' = all branches) (a dashboard filter).",
            "in": "query",
            "name": "branch",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "meta": {
                      "additionalProperties": true,
                      "type": "object"
                    },
                    "widgets": {
                      "additionalProperties": true,
                      "description": "Widget key → its data. A widget the owner may not see is left out.",
                      "properties": {
                        "branch_comparison": {
                          "description": "Branch Comparison (table widget)."
                        },
                        "dues_count": {
                          "description": "Pending payments (memberships) (stat widget)."
                        },
                        "dues_total": {
                          "description": "Pending payments amount (stat widget)."
                        },
                        "expense_breakdown": {
                          "description": "Expense Breakdown (table widget)."
                        },
                        "leads_best_source": {
                          "description": "Best Lead Source (stat widget)."
                        },
                        "leads_conversion": {
                          "description": "Enquiry Conversion % (stat widget)."
                        },
                        "new_joins": {
                          "description": "New Joins (stat widget)."
                        },
                        "renewals_done": {
                          "description": "Renewals Done (stat widget)."
                        },
                        "renewals_total_due": {
                          "description": "Renewals Due/Overdue (members) (stat widget)."
                        },
                        "revenue_by_plan": {
                          "description": "Revenue by Plan (payments received) (table widget)."
                        },
                        "revenue_trend": {
                          "description": "Monthly Revenue Trend (6 Months) (series widget)."
                        },
                        "revenue_trend_chart": {
                          "description": "Monthly Revenue Trend (6 Months) (chart widget)."
                        },
                        "warnings": {
                          "description": "Warnings (alert widget)."
                        }
                      },
                      "type": "object"
                    }
                  },
                  "required": [
                    "widgets",
                    "meta"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "The dashboard's data.",
            "headers": {
              "x-ratelimit-limit": {
                "description": "Requests allowed in the window (the most restrictive limit that applies).",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-policy": {
                "description": "Which limit is closest: token or ip.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-reset": {
                "description": "When the window resets (unix seconds).",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequiredRead"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "security": [
          {
            "apiToken": [
              "dashboard:gym_reports:view"
            ]
          }
        ],
        "summary": "Reports data",
        "tags": [
          "Dashboards"
        ]
      }
    },
    "/page/leads/records": {
      "get": {
        "description": "The records of “Leads” in the screen's own order unless sorted, from the token's business only. A role column limit leaves out the columns its owner can't see (filters and sort on them are ignored).\n\nNo free-text search here: filter a text column instead (contains, any case).\n\nScope: `page:leads:view` (its owner must hold it too).\n\nNeeds the business feature `lead_enquiry_management` on; off → 404 FEATURE_DISABLED.\n\nThe screen also has its own access rule, checked per request.",
        "operationId": "listRecords_leads",
        "parameters": [
          {
            "description": "Page number, from 1.",
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "default": 1,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Records per page (at most 100).",
            "in": "query",
            "name": "per_page",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "One field to sort by; prefix `-` for descending. Default: the page's own order (else newest first). Ties are broken by id, so pages never overlap.\n\nColumns: `name`, `phone`, `source`, `interest`, `status`, `follow_up_at`, `branch_display`, `interested_plan_display`, `note`.",
            "in": "query",
            "name": "sort",
            "required": false,
            "schema": {
              "pattern": "^-?[a-zA-Z_][a-zA-Z0-9_]*$",
              "type": "string"
            }
          },
          {
            "description": "Read only these fields: the others come back as null (the id always comes).",
            "explode": true,
            "in": "query",
            "name": "fields",
            "required": false,
            "schema": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "style": "form"
          },
          {
            "description": "Name: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "name",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Phone: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "phone",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Source: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them. Values: `walk_in`, `phone`, `instagram`, `referral`.",
            "in": "query",
            "name": "source",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Interest: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them. Values: `hot`, `warm`, `cold`.",
            "in": "query",
            "name": "interest",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Status: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Follow-up On: on this day (YYYY-MM-DD). Days are in the business's time zone when it sets one, else the `x-time-zone` header, else UTC.",
            "in": "query",
            "name": "follow_up_at",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Follow-up On: on or after this day.",
            "in": "query",
            "name": "follow_up_at__from",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Follow-up On: on or before this day.",
            "in": "query",
            "name": "follow_up_at__to",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Branch: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "branch_display",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Interested Plan: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "interested_plan_display",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Note: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "note",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Follow-up (a filter the server works out).",
            "in": "query",
            "name": "follow_up",
            "required": false,
            "schema": {
              "enum": [
                "due",
                "today",
                "overdue"
              ],
              "type": "string"
            }
          },
          {
            "description": "Branch (a filter the server works out).",
            "in": "query",
            "name": "branch",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "applied_filters": [
                    {
                      "label": "text",
                      "param": "text",
                      "value": "text"
                    }
                  ],
                  "page": 1,
                  "per_page": 1,
                  "records": [
                    {
                      "_id": "64b000000000000000000001",
                      "branch_id": "64b000000000000000000001",
                      "follow_up_at": "2026-01-15T09:30:00.000Z",
                      "followups_stopped_at": "2026-01-15T09:30:00.000Z",
                      "interest": "hot",
                      "interested_plan": "64b000000000000000000001",
                      "isActive": true,
                      "marketing_opt_out": true,
                      "marketing_opt_out_at": "2026-01-15T09:30:00.000Z",
                      "name": "text",
                      "note": "text",
                      "phone": "text",
                      "source": "walk_in",
                      "status": "open",
                      "tenant_id": "64b000000000000000000001"
                    }
                  ],
                  "total": 1
                },
                "schema": {
                  "properties": {
                    "applied_filters": {
                      "description": "The named filters this answer applied.",
                      "items": {
                        "properties": {
                          "label": {
                            "type": "string"
                          },
                          "param": {
                            "type": "string"
                          },
                          "value": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "page": {
                      "minimum": 1,
                      "type": "integer"
                    },
                    "per_page": {
                      "minimum": 1,
                      "type": "integer"
                    },
                    "records": {
                      "items": {
                        "$ref": "#/components/schemas/GymLeads"
                      },
                      "type": "array"
                    },
                    "total": {
                      "description": "Records matching, on every page.",
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "total",
                    "page",
                    "per_page",
                    "records"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "A page of records.",
            "headers": {
              "x-ratelimit-limit": {
                "description": "Requests allowed in the window (the most restrictive limit that applies).",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-policy": {
                "description": "Which limit is closest: token or ip.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-reset": {
                "description": "When the window resets (unix seconds).",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequiredRead"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "security": [
          {
            "apiToken": [
              "page:leads:view"
            ]
          }
        ],
        "summary": "List Leads",
        "tags": [
          "Leads"
        ]
      }
    },
    "/page/leads/records/{id}": {
      "get": {
        "description": "One record of the token's business, by id; the stored record as kept (it may carry more fields than the list).\n\nScope: `page:leads:view` (its owner must hold it too).\n\nNeeds the business feature `lead_enquiry_management` on; off → 404 FEATURE_DISABLED.\n\nThe screen also has its own access rule, checked per request.",
        "operationId": "getRecord_leads",
        "parameters": [
          {
            "description": "The record id.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-fA-F]{24}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "record": {
                    "_id": "64b000000000000000000001",
                    "branch_id": "64b000000000000000000001",
                    "follow_up_at": "2026-01-15T09:30:00.000Z",
                    "followups_stopped_at": "2026-01-15T09:30:00.000Z",
                    "interest": "hot",
                    "interested_plan": "64b000000000000000000001",
                    "isActive": true,
                    "marketing_opt_out": true,
                    "marketing_opt_out_at": "2026-01-15T09:30:00.000Z",
                    "name": "text",
                    "note": "text",
                    "phone": "text",
                    "source": "walk_in",
                    "status": "open",
                    "tenant_id": "64b000000000000000000001"
                  }
                },
                "schema": {
                  "properties": {
                    "record": {
                      "$ref": "#/components/schemas/GymLeads"
                    }
                  },
                  "required": [
                    "record"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "The record.",
            "headers": {
              "x-ratelimit-limit": {
                "description": "Requests allowed in the window (the most restrictive limit that applies).",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-policy": {
                "description": "Which limit is closest: token or ip.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-reset": {
                "description": "When the window resets (unix seconds).",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequiredRead"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "security": [
          {
            "apiToken": [
              "page:leads:view"
            ]
          }
        ],
        "summary": "Get one Leads record",
        "tags": [
          "Leads"
        ]
      }
    },
    "/page/members/records": {
      "get": {
        "description": "The records of “Members” in the screen's own order unless sorted, from the token's business only. A role column limit leaves out the columns its owner can't see (filters and sort on them are ignored).\n\nNo free-text search here: filter a text column instead (contains, any case).\n\nScope: `page:members:view` (its owner must hold it too).\n\nThe screen also has its own access rule, checked per request.",
        "operationId": "listRecords_members",
        "parameters": [
          {
            "description": "Page number, from 1.",
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "default": 1,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Records per page (at most 100).",
            "in": "query",
            "name": "per_page",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "One field to sort by; prefix `-` for descending. Default: the page's own order (else newest first). Ties are broken by id, so pages never overlap.\n\nColumns: `full_name`, `phone`, `home_branch_display`, `trainer_display`, `status`, `current_valid_till`, `has_due`, `join_date`, `gender`, `blood_group`, `emergency_contact`, `goal`, `photo`, `current_end_date`.",
            "in": "query",
            "name": "sort",
            "required": false,
            "schema": {
              "pattern": "^-?[a-zA-Z_][a-zA-Z0-9_]*$",
              "type": "string"
            }
          },
          {
            "description": "Read only these fields: the others come back as null (the id always comes).",
            "explode": true,
            "in": "query",
            "name": "fields",
            "required": false,
            "schema": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "style": "form"
          },
          {
            "description": "Full Name: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "full_name",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Phone: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "phone",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Home Branch: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "home_branch_display",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Assigned Trainer: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "trainer_display",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Status: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them. Values: `no_membership`.",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Valid till: on this day (YYYY-MM-DD). Days are in the business's time zone when it sets one, else the `x-time-zone` header, else UTC.",
            "in": "query",
            "name": "current_valid_till",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Valid till: on or after this day.",
            "in": "query",
            "name": "current_valid_till__from",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Valid till: on or before this day.",
            "in": "query",
            "name": "current_valid_till__to",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Has Due: true or false.",
            "in": "query",
            "name": "has_due",
            "required": false,
            "schema": {
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          },
          {
            "description": "Join Date: on this day (YYYY-MM-DD). Days are in the business's time zone when it sets one, else the `x-time-zone` header, else UTC.",
            "in": "query",
            "name": "join_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Join Date: on or after this day.",
            "in": "query",
            "name": "join_date__from",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Join Date: on or before this day.",
            "in": "query",
            "name": "join_date__to",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Gender: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them. Values: `male`, `female`, `other`.",
            "in": "query",
            "name": "gender",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Blood Group: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "blood_group",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Emergency Contact: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "emergency_contact",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Goal: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "goal",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Photo: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "photo",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Membership Ends: on this day (YYYY-MM-DD). Days are in the business's time zone when it sets one, else the `x-time-zone` header, else UTC.",
            "in": "query",
            "name": "current_end_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Membership Ends: on or after this day.",
            "in": "query",
            "name": "current_end_date__from",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Membership Ends: on or before this day.",
            "in": "query",
            "name": "current_end_date__to",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Filter (a filter the server works out).",
            "in": "query",
            "name": "filter",
            "required": false,
            "schema": {
              "enum": [
                "active",
                "current",
                "expiring_7d",
                "renewals_week",
                "expiring",
                "expired",
                "no_membership"
              ],
              "type": "string"
            }
          },
          {
            "description": "Branch (a filter the server works out).",
            "in": "query",
            "name": "branch",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "applied_filters": [
                    {
                      "label": "text",
                      "param": "text",
                      "value": "text"
                    }
                  ],
                  "page": 1,
                  "per_page": 1,
                  "records": [
                    {
                      "_id": "64b000000000000000000001",
                      "assigned_trainer": "64b000000000000000000001",
                      "blood_group": "text",
                      "current_end_date": "2026-01-15T09:30:00.000Z",
                      "current_expiring_from": "2026-01-15T09:30:00.000Z",
                      "current_membership_id": "64b000000000000000000001",
                      "emergency_contact": "text",
                      "full_name": "text",
                      "gender": "male",
                      "goal": "text",
                      "has_due": true,
                      "home_branch": "64b000000000000000000001",
                      "isActive": true,
                      "join_date": "2026-01-15T09:30:00.000Z",
                      "marketing_consent": true,
                      "marketing_opt_out": true,
                      "marketing_opt_out_at": "2026-01-15T09:30:00.000Z",
                      "phone": "text",
                      "photo": "text",
                      "tenant_id": "64b000000000000000000001"
                    }
                  ],
                  "total": 1
                },
                "schema": {
                  "properties": {
                    "applied_filters": {
                      "description": "The named filters this answer applied.",
                      "items": {
                        "properties": {
                          "label": {
                            "type": "string"
                          },
                          "param": {
                            "type": "string"
                          },
                          "value": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "page": {
                      "minimum": 1,
                      "type": "integer"
                    },
                    "per_page": {
                      "minimum": 1,
                      "type": "integer"
                    },
                    "records": {
                      "items": {
                        "$ref": "#/components/schemas/GymMembers"
                      },
                      "type": "array"
                    },
                    "total": {
                      "description": "Records matching, on every page.",
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "total",
                    "page",
                    "per_page",
                    "records"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "A page of records.",
            "headers": {
              "x-ratelimit-limit": {
                "description": "Requests allowed in the window (the most restrictive limit that applies).",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-policy": {
                "description": "Which limit is closest: token or ip.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-reset": {
                "description": "When the window resets (unix seconds).",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequiredRead"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "security": [
          {
            "apiToken": [
              "page:members:view"
            ]
          }
        ],
        "summary": "List Members",
        "tags": [
          "Members"
        ]
      }
    },
    "/page/members/records/{id}": {
      "get": {
        "description": "One record of the token's business, by id; the stored record as kept (it may carry more fields than the list).\n\nScope: `page:members:view` (its owner must hold it too).\n\nThe screen also has its own access rule, checked per request.",
        "operationId": "getRecord_members",
        "parameters": [
          {
            "description": "The record id.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-fA-F]{24}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "record": {
                    "_id": "64b000000000000000000001",
                    "assigned_trainer": "64b000000000000000000001",
                    "blood_group": "text",
                    "current_end_date": "2026-01-15T09:30:00.000Z",
                    "current_expiring_from": "2026-01-15T09:30:00.000Z",
                    "current_membership_id": "64b000000000000000000001",
                    "emergency_contact": "text",
                    "full_name": "text",
                    "gender": "male",
                    "goal": "text",
                    "has_due": true,
                    "home_branch": "64b000000000000000000001",
                    "isActive": true,
                    "join_date": "2026-01-15T09:30:00.000Z",
                    "marketing_consent": true,
                    "marketing_opt_out": true,
                    "marketing_opt_out_at": "2026-01-15T09:30:00.000Z",
                    "phone": "text",
                    "photo": "text",
                    "tenant_id": "64b000000000000000000001"
                  }
                },
                "schema": {
                  "properties": {
                    "record": {
                      "$ref": "#/components/schemas/GymMembers"
                    }
                  },
                  "required": [
                    "record"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "The record.",
            "headers": {
              "x-ratelimit-limit": {
                "description": "Requests allowed in the window (the most restrictive limit that applies).",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-policy": {
                "description": "Which limit is closest: token or ip.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-reset": {
                "description": "When the window resets (unix seconds).",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequiredRead"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "security": [
          {
            "apiToken": [
              "page:members:view"
            ]
          }
        ],
        "summary": "Get one Members record",
        "tags": [
          "Members"
        ]
      }
    },
    "/page/memberships/records": {
      "get": {
        "description": "The records of “Memberships” in the screen's own order unless sorted, from the token's business only. A role column limit leaves out the columns its owner can't see (filters and sort on them are ignored).\n\nNo free-text search here: filter a text column instead (contains, any case).\n\nScope: `page:memberships:view` (its owner must hold it too).\n\nThe screen also has its own access rule, checked per request.",
        "operationId": "listRecords_memberships",
        "parameters": [
          {
            "description": "Page number, from 1.",
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "default": 1,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Records per page (at most 100).",
            "in": "query",
            "name": "per_page",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "One field to sort by; prefix `-` for descending. Default: the page's own order (else newest first). Ties are broken by id, so pages never overlap.\n\nColumns: `member_name`, `plan_name`, `branch_display`, `start_date`, `valid_till`, `status`, `total_amount`, `amount_paid`, `balance_amount`, `payment_status`, `discount_amount`, `trainer_display`, `branch_access`, `sessions_total`, `sessions_used`, `end_date`.",
            "in": "query",
            "name": "sort",
            "required": false,
            "schema": {
              "pattern": "^-?[a-zA-Z_][a-zA-Z0-9_]*$",
              "type": "string"
            }
          },
          {
            "description": "Read only these fields: the others come back as null (the id always comes).",
            "explode": true,
            "in": "query",
            "name": "fields",
            "required": false,
            "schema": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "style": "form"
          },
          {
            "description": "Member: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "member_name",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Plan: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "plan_name",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Branch: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "branch_display",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Start Date: on this day (YYYY-MM-DD). Days are in the business's time zone when it sets one, else the `x-time-zone` header, else UTC.",
            "in": "query",
            "name": "start_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Start Date: on or after this day.",
            "in": "query",
            "name": "start_date__from",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Start Date: on or before this day.",
            "in": "query",
            "name": "start_date__to",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Valid till: on this day (YYYY-MM-DD). Days are in the business's time zone when it sets one, else the `x-time-zone` header, else UTC.",
            "in": "query",
            "name": "valid_till",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Valid till: on or after this day.",
            "in": "query",
            "name": "valid_till__from",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Valid till: on or before this day.",
            "in": "query",
            "name": "valid_till__to",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Status: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Total: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "total_amount",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Paid: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "amount_paid",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Balance: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "balance_amount",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Payment Status: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "payment_status",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Discount: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "discount_amount",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Trainer: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "trainer_display",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Branch Access: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them. Values: `home_only`, `all_branches`, `custom`.",
            "in": "query",
            "name": "branch_access",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Sessions Total: equal to this number. Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "sessions_total",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "description": "Sessions Used: equal to this number. Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "sessions_used",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "description": "End Date: on this day (YYYY-MM-DD). Days are in the business's time zone when it sets one, else the `x-time-zone` header, else UTC.",
            "in": "query",
            "name": "end_date",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "End Date: on or after this day.",
            "in": "query",
            "name": "end_date__from",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "End Date: on or before this day.",
            "in": "query",
            "name": "end_date__to",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "page": 1,
                  "per_page": 1,
                  "records": [
                    {
                      "_id": "64b000000000000000000001",
                      "addon_price_paid": 1,
                      "amount_paid": 1,
                      "balance_amount": 1,
                      "branch_access": "home_only",
                      "branch_access_list": [
                        "64b000000000000000000001"
                      ],
                      "branch_id": "64b000000000000000000001",
                      "discount_amount": 1,
                      "end_date": "2026-01-15T09:30:00.000Z",
                      "expiry_reminder_refused_at": "2026-01-15T09:30:00.000Z",
                      "invoice_due_at": "2026-01-15T09:30:00.000Z",
                      "invoice_id": "64b000000000000000000001",
                      "invoice_number": "text",
                      "invoice_sync_due_at": "2026-01-15T09:30:00.000Z",
                      "isActive": true,
                      "last_dues_reminder_at": "2026-01-15T09:30:00.000Z",
                      "last_expiry_reminder_at": "2026-01-15T09:30:00.000Z",
                      "member_id": "64b000000000000000000001",
                      "member_phone": "text",
                      "payment_status": "pending",
                      "plan_id": "64b000000000000000000001",
                      "plan_kind": "membership",
                      "plan_name": "text",
                      "price_paid": 1,
                      "reminder_days_before_expiry": 1,
                      "replaces_membership_id": "64b000000000000000000001",
                      "schedule_text": "text",
                      "sessions_total": 1,
                      "sessions_used": 1,
                      "source": "new",
                      "start_date": "2026-01-15T09:30:00.000Z",
                      "tenant_id": "64b000000000000000000001",
                      "total_amount": 1,
                      "trainer_id": "64b000000000000000000001"
                    }
                  ],
                  "total": 1
                },
                "schema": {
                  "properties": {
                    "page": {
                      "minimum": 1,
                      "type": "integer"
                    },
                    "per_page": {
                      "minimum": 1,
                      "type": "integer"
                    },
                    "records": {
                      "items": {
                        "$ref": "#/components/schemas/GymMemberships"
                      },
                      "type": "array"
                    },
                    "total": {
                      "description": "Records matching, on every page.",
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "total",
                    "page",
                    "per_page",
                    "records"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "A page of records.",
            "headers": {
              "x-ratelimit-limit": {
                "description": "Requests allowed in the window (the most restrictive limit that applies).",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-policy": {
                "description": "Which limit is closest: token or ip.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-reset": {
                "description": "When the window resets (unix seconds).",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequiredRead"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "security": [
          {
            "apiToken": [
              "page:memberships:view"
            ]
          }
        ],
        "summary": "List Memberships",
        "tags": [
          "Memberships"
        ]
      }
    },
    "/page/memberships/records/{id}": {
      "get": {
        "description": "One record of the token's business, by id; the stored record as kept (it may carry more fields than the list).\n\nScope: `page:memberships:view` (its owner must hold it too).\n\nThe screen also has its own access rule, checked per request.",
        "operationId": "getRecord_memberships",
        "parameters": [
          {
            "description": "The record id.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-fA-F]{24}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "record": {
                    "_id": "64b000000000000000000001",
                    "addon_price_paid": 1,
                    "amount_paid": 1,
                    "balance_amount": 1,
                    "branch_access": "home_only",
                    "branch_access_list": [
                      "64b000000000000000000001"
                    ],
                    "branch_id": "64b000000000000000000001",
                    "discount_amount": 1,
                    "end_date": "2026-01-15T09:30:00.000Z",
                    "expiry_reminder_refused_at": "2026-01-15T09:30:00.000Z",
                    "invoice_due_at": "2026-01-15T09:30:00.000Z",
                    "invoice_id": "64b000000000000000000001",
                    "invoice_number": "text",
                    "invoice_sync_due_at": "2026-01-15T09:30:00.000Z",
                    "isActive": true,
                    "last_dues_reminder_at": "2026-01-15T09:30:00.000Z",
                    "last_expiry_reminder_at": "2026-01-15T09:30:00.000Z",
                    "member_id": "64b000000000000000000001",
                    "member_phone": "text",
                    "payment_status": "pending",
                    "plan_id": "64b000000000000000000001",
                    "plan_kind": "membership",
                    "plan_name": "text",
                    "price_paid": 1,
                    "reminder_days_before_expiry": 1,
                    "replaces_membership_id": "64b000000000000000000001",
                    "schedule_text": "text",
                    "sessions_total": 1,
                    "sessions_used": 1,
                    "source": "new",
                    "start_date": "2026-01-15T09:30:00.000Z",
                    "tenant_id": "64b000000000000000000001",
                    "total_amount": 1,
                    "trainer_id": "64b000000000000000000001"
                  }
                },
                "schema": {
                  "properties": {
                    "record": {
                      "$ref": "#/components/schemas/GymMemberships"
                    }
                  },
                  "required": [
                    "record"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "The record.",
            "headers": {
              "x-ratelimit-limit": {
                "description": "Requests allowed in the window (the most restrictive limit that applies).",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-policy": {
                "description": "Which limit is closest: token or ip.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-reset": {
                "description": "When the window resets (unix seconds).",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequiredRead"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "security": [
          {
            "apiToken": [
              "page:memberships:view"
            ]
          }
        ],
        "summary": "Get one Memberships record",
        "tags": [
          "Memberships"
        ]
      }
    },
    "/page/payments/records": {
      "get": {
        "description": "The records of “Payments” in the screen's own order unless sorted, from the token's business only. A role column limit leaves out the columns its owner can't see (filters and sort on them are ignored).\n\nNo free-text search here: filter a text column instead (contains, any case).\n\nScope: `page:payments:view` (its owner must hold it too).\n\nThe screen also has its own access rule, checked per request.",
        "operationId": "listRecords_payments",
        "parameters": [
          {
            "description": "Page number, from 1.",
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "default": 1,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Records per page (at most 100).",
            "in": "query",
            "name": "per_page",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "One field to sort by; prefix `-` for descending. Default: the page's own order (else newest first). Ties are broken by id, so pages never overlap.\n\nColumns: `tenant_id`, `member_id`, `member_name`, `membership_id`, `plan_name`, `membership_snapshot`, `amount`, `mode`, `date`, `recorded_by`, `receipt_no`, `branch_id`, `pay_request_id`, `branch_display`, `trainer_share_amount`, `voided_at`, `voided_by`, `voided_by_name`, `void_reason`, `isActive`.",
            "in": "query",
            "name": "sort",
            "required": false,
            "schema": {
              "pattern": "^-?[a-zA-Z_][a-zA-Z0-9_]*$",
              "type": "string"
            }
          },
          {
            "description": "Read only these fields: the others come back as null (the id always comes).",
            "explode": true,
            "in": "query",
            "name": "fields",
            "required": false,
            "schema": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "style": "form"
          },
          {
            "description": "Tenant Id: this record id exactly. Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "tenant_id",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Member Id: this record id exactly. Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "member_id",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Member: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "member_name",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Membership Id: this record id exactly. Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "membership_id",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Plan: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "plan_name",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Membership Snapshot: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "membership_snapshot",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Amount: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "amount",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Mode: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them. Values: `upi`, `cash`, `bank_transfer`, `online`.",
            "in": "query",
            "name": "mode",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Date: on this day (YYYY-MM-DD). Days are in the business's time zone when it sets one, else the `x-time-zone` header, else UTC.",
            "in": "query",
            "name": "date",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Date: on or after this day.",
            "in": "query",
            "name": "date__from",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Date: on or before this day.",
            "in": "query",
            "name": "date__to",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Recorded By: this record id exactly. Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "recorded_by",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Receipt No: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "receipt_no",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Branch Id: this record id exactly. Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "branch_id",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Pay Request Id: this record id exactly. Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "pay_request_id",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Branch: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "branch_display",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Trainer Share: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "trainer_share_amount",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Voided On: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "voided_at",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Voided By: this record id exactly. Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "voided_by",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Voided By: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "voided_by_name",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Reason: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "void_reason",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Is Active: contains this text (any case). Several values (a JSON list such as `[\"a\",\"b\"]`, or the parameter repeated) match a record equal to any of them.",
            "in": "query",
            "name": "isActive",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Period (a filter the server works out).",
            "in": "query",
            "name": "period",
            "required": false,
            "schema": {
              "enum": [
                "today",
                "this_month"
              ],
              "type": "string"
            }
          },
          {
            "description": "Branch (a filter the server works out).",
            "in": "query",
            "name": "branch",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "applied_filters": [
                    {
                      "label": "text",
                      "param": "text",
                      "value": "text"
                    }
                  ],
                  "page": 1,
                  "per_page": 1,
                  "records": [
                    {
                      "_id": "64b000000000000000000001",
                      "amount": 1,
                      "branch_id": "64b000000000000000000001",
                      "date": "2026-01-15T09:30:00.000Z",
                      "isActive": true,
                      "member_id": "64b000000000000000000001",
                      "membership_id": "64b000000000000000000001",
                      "mode": "upi",
                      "pay_request_id": "64b000000000000000000001",
                      "plan_name": "text",
                      "receipt_no": "text",
                      "recorded_by": "64b000000000000000000001",
                      "tenant_id": "64b000000000000000000001",
                      "trainer_share_amount": 1,
                      "void_reason": "text",
                      "voided_at": "2026-01-15T09:30:00.000Z",
                      "voided_by": "64b000000000000000000001",
                      "voided_by_name": "text"
                    }
                  ],
                  "total": 1
                },
                "schema": {
                  "properties": {
                    "applied_filters": {
                      "description": "The named filters this answer applied.",
                      "items": {
                        "properties": {
                          "label": {
                            "type": "string"
                          },
                          "param": {
                            "type": "string"
                          },
                          "value": {
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "page": {
                      "minimum": 1,
                      "type": "integer"
                    },
                    "per_page": {
                      "minimum": 1,
                      "type": "integer"
                    },
                    "records": {
                      "items": {
                        "$ref": "#/components/schemas/GymPayments"
                      },
                      "type": "array"
                    },
                    "total": {
                      "description": "Records matching, on every page.",
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "total",
                    "page",
                    "per_page",
                    "records"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "A page of records.",
            "headers": {
              "x-ratelimit-limit": {
                "description": "Requests allowed in the window (the most restrictive limit that applies).",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-policy": {
                "description": "Which limit is closest: token or ip.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-reset": {
                "description": "When the window resets (unix seconds).",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequiredRead"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "security": [
          {
            "apiToken": [
              "page:payments:view"
            ]
          }
        ],
        "summary": "List Payments",
        "tags": [
          "Payments"
        ]
      }
    },
    "/page/payments/records/{id}": {
      "get": {
        "description": "One record of the token's business, by id; the stored record as kept (it may carry more fields than the list).\n\nScope: `page:payments:view` (its owner must hold it too).\n\nThe screen also has its own access rule, checked per request.",
        "operationId": "getRecord_payments",
        "parameters": [
          {
            "description": "The record id.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-fA-F]{24}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "record": {
                    "_id": "64b000000000000000000001",
                    "amount": 1,
                    "branch_id": "64b000000000000000000001",
                    "date": "2026-01-15T09:30:00.000Z",
                    "isActive": true,
                    "member_id": "64b000000000000000000001",
                    "membership_id": "64b000000000000000000001",
                    "mode": "upi",
                    "pay_request_id": "64b000000000000000000001",
                    "plan_name": "text",
                    "receipt_no": "text",
                    "recorded_by": "64b000000000000000000001",
                    "tenant_id": "64b000000000000000000001",
                    "trainer_share_amount": 1,
                    "void_reason": "text",
                    "voided_at": "2026-01-15T09:30:00.000Z",
                    "voided_by": "64b000000000000000000001",
                    "voided_by_name": "text"
                  }
                },
                "schema": {
                  "properties": {
                    "record": {
                      "$ref": "#/components/schemas/GymPayments"
                    }
                  },
                  "required": [
                    "record"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "The record.",
            "headers": {
              "x-ratelimit-limit": {
                "description": "Requests allowed in the window (the most restrictive limit that applies).",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-policy": {
                "description": "Which limit is closest: token or ip.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "string"
                }
              },
              "x-ratelimit-reset": {
                "description": "When the window resets (unix seconds).",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequiredRead"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "security": [
          {
            "apiToken": [
              "page:payments:view"
            ]
          }
        ],
        "summary": "Get one Payments record",
        "tags": [
          "Payments"
        ]
      }
    }
  },
  "servers": [
    {
      "url": "{baseUrl}",
      "variables": {
        "baseUrl": {
          "default": "https://api.example.com",
          "description": "Your app's API address."
        }
      }
    }
  ],
  "tags": [
    {
      "name": "Dashboards"
    },
    {
      "name": "Leads"
    },
    {
      "name": "Members"
    },
    {
      "name": "Memberships"
    },
    {
      "name": "Payments"
    }
  ],
  "webhooks": {}
}
