{"openapi":"3.1.0","info":{"title":"Gym One — публичное API","version":"1.0.0","description":"Ключ выпускается в настройках клуба. Передавайте его в заголовке `Authorization: Bearer g1_live_…`. Клуб определяется ключом. Ошибки — RFC 9457 (`application/problem+json`). Время — ISO 8601 со смещением пояса клуба. Операции создания принимают заголовок `Idempotency-Key` (до 100 символов): повтор с тем же ключом в течение суток вернёт первый ответ."},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}},"schemas":{"def-0":{"type":"object","description":"RFC 9457","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string","description":"Номер запроса — сообщите его в поддержку"},"errors":{"type":"array","items":{"type":"object","additionalProperties":true}}},"title":"problem"}}},"paths":{"/visitors":{"get":{"summary":"Список посетителей","tags":["Посетители"],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"string","maxLength":200},"in":"query","name":"cursor","required":false,"description":"next_cursor из предыдущей страницы"},{"schema":{"type":"string","maxLength":40},"in":"query","name":"updated_since","required":false,"description":"ISO 8601: только изменённые начиная с этого момента"},{"schema":{"type":"string","minLength":2,"maxLength":100},"in":"query","name":"q","required":false,"description":"Часть имени"},{"schema":{"type":"string","maxLength":32},"in":"query","name":"phone","required":false,"description":"Телефон в любом формате"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":1},"name":{"type":["null","string"]},"phone":{"type":["null","string"]},"email":{"type":["null","string"]},"birthday":{"type":["null","string"],"format":"date"},"gender":{"type":["null","string"],"enum":["m","f",null]},"card_number":{"type":["null","string"]},"comment":{"type":["null","string"]},"balance":{"type":["null","number"]},"bonus_balance":{"type":["null","number"]},"allow_mailings":{"type":"boolean"},"created_at":{"type":["null","string"],"format":"date-time"},"updated_at":{"type":["null","string"],"format":"date-time"}}}},"next_cursor":{"type":["null","string"]}}}}}},"400":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"403":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"429":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}},"post":{"summary":"Создать посетителя","tags":["Посетители"],"description":"Если посетитель с таким телефоном уже есть — вернёт его (200, existing: true), нового не создаст. Согласие на рассылки не ставится: его даёт сам посетитель.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","phone"],"additionalProperties":false,"properties":{"name":{"type":"string","minLength":1,"maxLength":255},"phone":{"type":"string","maxLength":32},"email":{"type":"string","format":"email","maxLength":255},"birthday":{"type":"string","format":"date"},"gender":{"type":"string","enum":["m","f"]},"comment":{"type":"string","maxLength":2000}}}}}},"parameters":[{"schema":{"type":"string","maxLength":100},"in":"header","name":"idempotency-key","required":false,"description":"Повтор с тем же ключом в течение суток вернёт первый ответ"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer","minimum":1},"name":{"type":["null","string"]},"phone":{"type":["null","string"]},"email":{"type":["null","string"]},"birthday":{"type":["null","string"],"format":"date"},"gender":{"type":["null","string"],"enum":["m","f",null]},"card_number":{"type":["null","string"]},"comment":{"type":["null","string"]},"balance":{"type":["null","number"]},"bonus_balance":{"type":["null","number"]},"allow_mailings":{"type":"boolean"},"created_at":{"type":["null","string"],"format":"date-time"},"updated_at":{"type":["null","string"],"format":"date-time"},"existing":{"type":"boolean"}}}}}},"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer","minimum":1},"name":{"type":["null","string"]},"phone":{"type":["null","string"]},"email":{"type":["null","string"]},"birthday":{"type":["null","string"],"format":"date"},"gender":{"type":["null","string"],"enum":["m","f",null]},"card_number":{"type":["null","string"]},"comment":{"type":["null","string"]},"balance":{"type":["null","number"]},"bonus_balance":{"type":["null","number"]},"allow_mailings":{"type":"boolean"},"created_at":{"type":["null","string"],"format":"date-time"},"updated_at":{"type":["null","string"],"format":"date-time"},"existing":{"type":"boolean"}}}}}},"400":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"403":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"409":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"422":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"429":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/visitors/{id}":{"get":{"summary":"Посетитель","tags":["Посетители"],"parameters":[{"schema":{"type":"integer","minimum":1},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer","minimum":1},"name":{"type":["null","string"]},"phone":{"type":["null","string"]},"email":{"type":["null","string"]},"birthday":{"type":["null","string"],"format":"date"},"gender":{"type":["null","string"],"enum":["m","f",null]},"card_number":{"type":["null","string"]},"comment":{"type":["null","string"]},"balance":{"type":["null","number"]},"bonus_balance":{"type":["null","number"]},"allow_mailings":{"type":"boolean"},"created_at":{"type":["null","string"],"format":"date-time"},"updated_at":{"type":["null","string"],"format":"date-time"}}}}}},"400":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"403":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"429":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/subscription-types":{"get":{"summary":"Типы абонементов (что можно выдать)","tags":["Абонементы"],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"string","maxLength":200},"in":"query","name":"cursor","required":false,"description":"next_cursor из предыдущей страницы"},{"schema":{"type":"string","maxLength":40},"in":"query","name":"updated_since","required":false,"description":"ISO 8601: только изменённые начиная с этого момента"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":1},"title":{"type":["null","string"]},"description":{"type":["null","string"]},"price":{"type":["null","number"]},"duration_months":{"type":["null","integer"]},"duration_days":{"type":["null","integer"]},"visits_limit":{"type":["null","integer"],"description":"null — без ограничения посещений"},"workout_id":{"type":["null","integer"]},"trainer_id":{"type":["null","integer"]},"allow_freeze":{"type":"boolean"},"updated_at":{"type":["null","string"],"format":"date-time"}}}},"next_cursor":{"type":["null","string"]}}}}}},"400":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"403":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"429":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/subscriptions":{"get":{"summary":"Выданные абонементы","tags":["Абонементы"],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"string","maxLength":200},"in":"query","name":"cursor","required":false,"description":"next_cursor из предыдущей страницы"},{"schema":{"type":"string","maxLength":40},"in":"query","name":"updated_since","required":false,"description":"ISO 8601: только изменённые начиная с этого момента"},{"schema":{"type":"integer","minimum":1},"in":"query","name":"visitor_id","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":1},"number":{"type":["null","string"]},"visitor_id":{"type":["null","integer"]},"subscription_type_id":{"type":["null","integer"]},"title":{"type":["null","string"]},"issued_at":{"type":["null","string"],"format":"date-time"},"valid_until":{"type":["null","string"],"format":"date-time"},"visits_limit":{"type":["null","integer"],"description":"null — без ограничения посещений"},"visits_used":{"type":["null","integer"]},"status":{"type":["null","string"],"description":"active, expired, visits_ended"},"frozen":{"type":"boolean"},"price":{"type":["null","number"]},"created_at":{"type":["null","string"],"format":"date-time"},"updated_at":{"type":["null","string"],"format":"date-time"}}}},"next_cursor":{"type":["null","string"]}}}}}},"400":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"403":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"429":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}},"post":{"summary":"Выдать абонемент, оплаченный у партнёра","tags":["Абонементы"],"description":"Партнёр сам принял оплату и пробил чек. В кассе клуба появится безналичная операция без чека с пометкой «Оплачено у партнёра». Начисляются бонусы по программе лояльности клуба; процент администратору — только если передан seller_id. Посетителю уходит сообщение об абонементе.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["visitor_id","subscription_type_id"],"additionalProperties":false,"properties":{"visitor_id":{"type":"integer","minimum":1},"subscription_type_id":{"type":"integer","minimum":1},"issued_at":{"type":"string","maxLength":40,"description":"Начало действия, ISO 8601; по умолчанию — сейчас"},"price":{"type":"number","minimum":0,"maximum":10000000,"description":"Сколько заплатил посетитель; по умолчанию — цена типа"},"seller_id":{"type":"integer","minimum":1,"description":"id администратора клуба, которому начислить процент с продажи"}}}}}},"parameters":[{"schema":{"type":"string","maxLength":100},"in":"header","name":"idempotency-key","required":false,"description":"Повтор с тем же ключом в течение суток вернёт первый ответ"}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer","minimum":1},"number":{"type":["null","string"]},"visitor_id":{"type":["null","integer"]},"subscription_type_id":{"type":["null","integer"]},"title":{"type":["null","string"]},"issued_at":{"type":["null","string"],"format":"date-time"},"valid_until":{"type":["null","string"],"format":"date-time"},"visits_limit":{"type":["null","integer"],"description":"null — без ограничения посещений"},"visits_used":{"type":["null","integer"]},"status":{"type":["null","string"],"description":"active, expired, visits_ended"},"frozen":{"type":"boolean"},"price":{"type":["null","number"]},"created_at":{"type":["null","string"],"format":"date-time"},"updated_at":{"type":["null","string"],"format":"date-time"}}}}}},"400":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"403":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"409":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"422":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"429":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/subscriptions/{id}":{"get":{"summary":"Выданный абонемент","tags":["Абонементы"],"parameters":[{"schema":{"type":"integer","minimum":1},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer","minimum":1},"number":{"type":["null","string"]},"visitor_id":{"type":["null","integer"]},"subscription_type_id":{"type":["null","integer"]},"title":{"type":["null","string"]},"issued_at":{"type":["null","string"],"format":"date-time"},"valid_until":{"type":["null","string"],"format":"date-time"},"visits_limit":{"type":["null","integer"],"description":"null — без ограничения посещений"},"visits_used":{"type":["null","integer"]},"status":{"type":["null","string"],"description":"active, expired, visits_ended"},"frozen":{"type":"boolean"},"price":{"type":["null","number"]},"created_at":{"type":["null","string"],"format":"date-time"},"updated_at":{"type":["null","string"],"format":"date-time"}}}}}},"400":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"403":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"429":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/trainers":{"get":{"summary":"Тренеры и другие сотрудники клуба","tags":["Тренеры"],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"string","maxLength":200},"in":"query","name":"cursor","required":false,"description":"next_cursor из предыдущей страницы"},{"schema":{"type":"string","maxLength":40},"in":"query","name":"updated_since","required":false,"description":"ISO 8601: только изменённые начиная с этого момента"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":1},"name":{"type":["null","string"]},"phone":{"type":["null","string"]},"email":{"type":["null","string"]},"birthday":{"type":["null","string"],"format":"date"},"gender":{"type":["null","string"],"enum":["m","f",null]},"positions":{"type":["null","string"]},"specialization":{"type":["null","string"]},"comment":{"type":["null","string"]},"allow_online_record":{"type":"boolean"},"created_at":{"type":["null","string"],"format":"date-time"},"updated_at":{"type":["null","string"],"format":"date-time"}}}},"next_cursor":{"type":["null","string"]}}}}}},"400":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"403":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"429":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}},"post":{"summary":"Создать тренера (сотрудника без входа в систему)","tags":["Тренеры"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"additionalProperties":false,"properties":{"name":{"type":"string","minLength":1,"maxLength":255},"phone":{"type":"string","maxLength":32},"email":{"type":"string","format":"email","maxLength":255},"birthday":{"type":"string","format":"date"},"gender":{"type":"string","enum":["m","f"]},"specialization":{"type":"string","maxLength":2000},"comment":{"type":"string","maxLength":2000},"allow_online_record":{"type":"boolean","description":"Показывать в онлайн-записи"}}}}}},"parameters":[{"schema":{"type":"string","maxLength":100},"in":"header","name":"idempotency-key","required":false,"description":"Повтор с тем же ключом в течение суток вернёт первый ответ"}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer","minimum":1},"name":{"type":["null","string"]},"phone":{"type":["null","string"]},"email":{"type":["null","string"]},"birthday":{"type":["null","string"],"format":"date"},"gender":{"type":["null","string"],"enum":["m","f",null]},"positions":{"type":["null","string"]},"specialization":{"type":["null","string"]},"comment":{"type":["null","string"]},"allow_online_record":{"type":"boolean"},"created_at":{"type":["null","string"],"format":"date-time"},"updated_at":{"type":["null","string"],"format":"date-time"}}}}}},"400":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"403":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"409":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"422":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"429":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/trainers/{id}":{"get":{"summary":"Тренер","tags":["Тренеры"],"parameters":[{"schema":{"type":"integer","minimum":1},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer","minimum":1},"name":{"type":["null","string"]},"phone":{"type":["null","string"]},"email":{"type":["null","string"]},"birthday":{"type":["null","string"],"format":"date"},"gender":{"type":["null","string"],"enum":["m","f",null]},"positions":{"type":["null","string"]},"specialization":{"type":["null","string"]},"comment":{"type":["null","string"]},"allow_online_record":{"type":"boolean"},"created_at":{"type":["null","string"],"format":"date-time"},"updated_at":{"type":["null","string"],"format":"date-time"}}}}}},"400":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"403":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"429":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/workouts":{"get":{"summary":"Виды тренировок","tags":["Расписание"],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"string","maxLength":200},"in":"query","name":"cursor","required":false,"description":"next_cursor из предыдущей страницы"},{"schema":{"type":"string","maxLength":40},"in":"query","name":"updated_since","required":false,"description":"ISO 8601: только изменённые начиная с этого момента"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":1},"title":{"type":["null","string"]},"description":{"type":["null","string"]},"duration_minutes":{"type":["null","integer"]},"is_group":{"type":"boolean"},"price":{"type":["null","number"]},"color":{"type":["null","string"]},"allow_online_record":{"type":"boolean"},"updated_at":{"type":["null","string"],"format":"date-time"}}}},"next_cursor":{"type":["null","string"]}}}}}},"400":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"403":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"429":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/visits":{"get":{"summary":"История посещений","tags":["Посещения"],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"string","maxLength":200},"in":"query","name":"cursor","required":false,"description":"next_cursor из предыдущей страницы"},{"schema":{"type":"string","maxLength":40},"in":"query","name":"updated_since","required":false,"description":"ISO 8601: только изменённые начиная с этого момента"},{"schema":{"type":"integer","minimum":1},"in":"query","name":"visitor_id","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","minimum":1},"visitor_id":{"type":["null","integer"]},"entered_at":{"type":["null","string"],"format":"date-time"},"left_at":{"type":["null","string"],"format":"date-time"},"type":{"type":["null","string"],"description":"subs-visit — по абонементу, onetime-visit — разовое"},"subscription_id":{"type":["null","integer"]},"subscription_number":{"type":["null","string"]},"workout_id":{"type":["null","integer"]},"schedule_id":{"type":["null","integer"]},"trainer_id":{"type":["null","integer"]},"is_group_workout":{"type":"boolean"},"price":{"type":["null","number"]},"title":{"type":["null","string"]},"updated_at":{"type":["null","string"],"format":"date-time"}}}},"next_cursor":{"type":["null","string"]}}}}}},"400":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"403":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"429":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}},"post":{"summary":"Отметить вход посетителя по абонементу","tags":["Посещения"],"description":"Проверки — как в админке: абонемент не заморожен, уже действует и не истёк, остались посещения, указаны тренировка и тренер, если тип абонемента их требует. Зарплата тренеру начисляется по его схеме оплаты. Абонементы на солярий через API не отмечаются.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["visitor_id","subscription_id"],"additionalProperties":false,"properties":{"visitor_id":{"type":"integer","minimum":1},"subscription_id":{"type":"integer","minimum":1},"schedule_id":{"type":"integer","minimum":1,"description":"Групповое занятие сегодня (из GET /schedule) — тренировка и тренер возьмутся из него"},"workout_id":{"type":"integer","minimum":1},"trainer_id":{"type":"integer","minimum":1}}}}}},"parameters":[{"schema":{"type":"string","maxLength":100},"in":"header","name":"idempotency-key","required":false,"description":"Повтор с тем же ключом в течение суток вернёт первый ответ"}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer","minimum":1},"visitor_id":{"type":["null","integer"]},"entered_at":{"type":["null","string"],"format":"date-time"},"left_at":{"type":["null","string"],"format":"date-time"},"type":{"type":["null","string"],"description":"subs-visit — по абонементу, onetime-visit — разовое"},"subscription_id":{"type":["null","integer"]},"subscription_number":{"type":["null","string"]},"workout_id":{"type":["null","integer"]},"schedule_id":{"type":["null","integer"]},"trainer_id":{"type":["null","integer"]},"is_group_workout":{"type":"boolean"},"price":{"type":["null","number"]},"title":{"type":["null","string"]},"updated_at":{"type":["null","string"],"format":"date-time"}}}}}},"400":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"403":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"409":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"422":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"429":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/schedule":{"get":{"summary":"Групповые занятия на даты (не больше 31 дня), без отменённых","tags":["Расписание"],"parameters":[{"schema":{"type":"string","format":"date"},"in":"query","name":"date_from","required":true},{"schema":{"type":"string","format":"date"},"in":"query","name":"date_to","required":true},{"schema":{"type":"integer","minimum":1},"in":"query","name":"trainer_id","required":false},{"schema":{"type":"integer","minimum":1},"in":"query","name":"workout_id","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"schedule_id":{"type":"integer","minimum":1},"date":{"type":"string","format":"date"},"starts_at":{"type":"string","format":"date-time"},"ends_at":{"type":"string","format":"date-time"},"workout_id":{"type":["null","integer"]},"workout_title":{"type":["null","string"]},"trainer_id":{"type":["null","integer"]},"trainer_name":{"type":["null","string"]},"room_id":{"type":["null","integer"]},"max_visitors":{"type":["null","integer"],"description":"null — без ограничения"},"booked":{"type":"integer"},"free_places":{"type":["null","integer"],"description":"null — без ограничения"}}}}}}}}},"400":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"403":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"429":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/leads":{"post":{"summary":"Добавить заявку в воронку","tags":["Заявки"],"description":"Нужен модуль «Привлечение и продажи». Заявка встаёт на первую стадию воронки с источником «Open API»; подпись источника в аналитике — source_label, по умолчанию название ключа. Если заявка с этим телефоном (или с этой почтой без телефона) уже есть — новой не будет: к найденной добавится «повторная заявка», заявка из «Отказа» вернётся в работу (200, repeat: true).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"name":{"type":"string","maxLength":255},"phone":{"type":"string","maxLength":32},"email":{"type":"string","format":"email","maxLength":255},"comment":{"type":"string","maxLength":2000},"source_label":{"type":"string","maxLength":255,"description":"Подпись источника: сайт партнёра, рекламная кампания"},"utm_source":{"type":"string","maxLength":128},"utm_medium":{"type":"string","maxLength":128},"utm_campaign":{"type":"string","maxLength":128}}}}}},"parameters":[{"schema":{"type":"string","maxLength":100},"in":"header","name":"idempotency-key","required":false,"description":"Повтор с тем же ключом в течение суток вернёт первый ответ"}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer","minimum":1},"repeat":{"type":"boolean"}}}}}},"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer","minimum":1},"repeat":{"type":"boolean"}}}}}},"400":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"403":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"409":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"422":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"429":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/class-bookings":{"post":{"summary":"Записать посетителя на групповое занятие","tags":["Расписание"],"description":"schedule_id и date — из GET /schedule. Проверяются свободные места, повторная запись и перерыв тренера. Отменить запись можно только тем же ключом.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["schedule_id","date","visitor_id"],"additionalProperties":false,"properties":{"schedule_id":{"type":"integer","minimum":1},"date":{"type":"string","format":"date"},"visitor_id":{"type":"integer","minimum":1},"comment":{"type":"string","maxLength":500}}}}}},"parameters":[{"schema":{"type":"string","maxLength":100},"in":"header","name":"idempotency-key","required":false,"description":"Повтор с тем же ключом в течение суток вернёт первый ответ"}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer","minimum":1},"schedule_id":{"type":"integer","minimum":1},"date":{"type":"string","format":"date"},"starts_at":{"type":"string","format":"date-time"},"visitor_id":{"type":"integer","minimum":1},"workout_id":{"type":["null","integer"]},"trainer_id":{"type":["null","integer"]}}}}}},"400":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"403":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"409":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"422":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"429":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/class-bookings/{id}":{"delete":{"summary":"Отменить запись на занятие, созданную этим ключом","tags":["Расписание"],"parameters":[{"schema":{"type":"integer","minimum":1},"in":"path","name":"id","required":true}],"responses":{"204":{"description":"Default Response"},"400":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"403":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"409":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"422":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"429":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}},"/webhook":{"get":{"summary":"Текущая настройка вебхука","tags":["Вебхуки"],"description":"События: visitor.created, subscription.purchased, visit.created, workout.entered, lead.stage_changed. Запрос — POST JSON {id, type, created_at, data}; заголовки X-G1-Event, X-G1-Delivery и X-G1-Signature: t=<unix-время>,v1=<HMAC-SHA256 от «t.тело» секретом, hex>. Ответьте 2xx за 10 секунд; иначе повторим через 1 мин, 5 мин, 30 мин, 2 ч, 6 ч, 12 ч и 24 ч.","responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":["null","string"]},"events":{"type":"array","items":{"type":"string"}},"secret":{"type":"string","description":"Только при создании и при rotate_secret — сохраните, повторно не показывается"}}}}}},"400":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"403":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"429":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}},"put":{"summary":"Задать адрес и события вебхука","tags":["Вебхуки"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url","events"],"additionalProperties":false,"properties":{"url":{"type":"string","maxLength":500},"events":{"type":"array","minItems":1,"uniqueItems":true,"items":{"type":"string","enum":["visitor.created","subscription.purchased","visit.created","workout.entered","lead.stage_changed"]}},"rotate_secret":{"type":"boolean","description":"Выпустить новый секрет подписи"}}}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":["null","string"]},"events":{"type":"array","items":{"type":"string"}},"secret":{"type":"string","description":"Только при создании и при rotate_secret — сохраните, повторно не показывается"}}}}}},"400":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"403":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"429":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}},"delete":{"summary":"Отключить вебхук","tags":["Вебхуки"],"responses":{"204":{"description":"Default Response"},"400":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"401":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"403":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"404":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}},"429":{"description":"RFC 9457","content":{"application/json":{"schema":{"$ref":"#/components/schemas/def-0"}}}}}}}},"servers":[{"url":"https://api.gym-one.ru/public/v1"}],"security":[{"bearer":[]}]}