{"openapi":"3.1.0","info":{"title":"Proxy API","version":"0.1.0"},"paths":{"/health":{"get":{"summary":"Health","description":"Проверка доступности сервиса API (возвращает статус ok).","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Health Health Get"}}}}}}},"/me":{"get":{"summary":"Me","description":"Профиль пользователя и текущий баланс. Требуется заголовок Authorization: Bearer <token>.","operationId":"me_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserInfo"}}}}},"security":[{"HTTPBearer":[]}]}},"/countries":{"get":{"summary":"Countries","description":"Список доступных стран для покупки. Query: version (4s — IPv4 shared, 4, 6; по умолчанию 6).","operationId":"countries_countries_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"version","in":"query","required":false,"schema":{"type":"string","default":"6","title":"Version"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"string"},"title":"Response Countries Countries Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/countries/{country}/count":{"get":{"summary":"Country Count","description":"Количество доступных прокси по стране. Путь: country (ISO2). Query: version=4s/4/6 (по умолчанию 6).","operationId":"country_count_countries__country__count_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"country","in":"path","required":true,"schema":{"type":"string","title":"Country"}},{"name":"version","in":"query","required":false,"schema":{"type":"string","default":"6","title":"Version"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"integer"},"title":"Response Country Count Countries  Country  Count Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/price":{"get":{"summary":"Price","description":"Расчёт стоимости заказа с учётом наценки. Query: count (шт), period (дни), version (IPv 4s/4/6, по умолчанию 6).","operationId":"price_price_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"count","in":"query","required":true,"schema":{"type":"integer","title":"Count"}},{"name":"period","in":"query","required":true,"schema":{"type":"integer","title":"Period"}},{"name":"version","in":"query","required":false,"schema":{"type":"string","default":"6","title":"Version"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuoteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/proxies":{"get":{"summary":"Proxies","description":"Список всех прокси пользователя, сохранённых в БД бота. Требуется Authorization: Bearer <token>.","operationId":"proxies_proxies_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ProxyOut"},"type":"array","title":"Response Proxies Proxies Get"}}}}},"security":[{"HTTPBearer":[]}]}},"/proxies/export":{"get":{"summary":"Export Proxies","description":"Выгрузка прокси в формате json или txt. Query: format=txt|json (по умолчанию json), proxy_type=http|socks|socks5|all, active_only=true|false (по умолчанию false). Фильтрует прокси текущего пользователя и возвращает файл.","operationId":"export_proxies_proxies_export_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"format","in":"query","required":false,"schema":{"$ref":"#/components/schemas/ProxyExportFormat","default":"json"}},{"name":"proxy_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Proxy Type"}},{"name":"active_only","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Active Only"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/proxies/buy":{"post":{"summary":"Buy Proxies","description":"Покупка прокси. Тело: country (ISO2), period (дни), count (шт), version (4s/4/6, по умолчанию 6), proxy_type (http|socks).","operationId":"buy_proxies_proxies_buy_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuyRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/proxies/{proxy_id}/prolong":{"post":{"summary":"Prolong Proxy","description":"Продление конкретного прокси. Путь: proxy_id. Тело: period (дни). Списывает средства с баланса.","operationId":"prolong_proxy_proxies__proxy_id__prolong_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"proxy_id","in":"path","required":true,"schema":{"type":"string","title":"Proxy Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProlongRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProlongResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/proxies/{proxy_id}/ping":{"get":{"summary":"Ping Proxy","description":"Проверка TCP-подключения к host:port прокси. Путь: proxy_id. Возвращает latency_ms или null.","operationId":"ping_proxy_proxies__proxy_id__ping_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"proxy_id","in":"path","required":true,"schema":{"type":"string","title":"Proxy Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PingResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"BuyRequest":{"properties":{"country":{"type":"string","maxLength":4,"minLength":2,"title":"Country"},"period":{"type":"integer","exclusiveMinimum":0.0,"title":"Period"},"count":{"type":"integer","maximum":1000.0,"exclusiveMinimum":0.0,"title":"Count","default":1},"version":{"type":"string","pattern":"^(6|4|4s|3)$","title":"Version","default":"6"},"proxy_type":{"type":"string","pattern":"^(http|socks)$","title":"Proxy Type","default":"http"}},"type":"object","required":["country","period"],"title":"BuyRequest"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"PingResponse":{"properties":{"latency_ms":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Latency Ms"}},"type":"object","title":"PingResponse"},"ProlongRequest":{"properties":{"period":{"type":"integer","exclusiveMinimum":0.0,"title":"Period"}},"type":"object","required":["period"],"title":"ProlongRequest"},"ProlongResponse":{"properties":{"order_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Order Id"},"price_charged":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Price Charged"},"currency":{"type":"string","title":"Currency","default":"RUB"},"proxy":{"$ref":"#/components/schemas/ProxyOut"}},"type":"object","required":["price_charged","proxy"],"title":"ProlongResponse"},"ProxyExportFormat":{"type":"string","enum":["json","txt"],"title":"ProxyExportFormat"},"ProxyOut":{"properties":{"id":{"type":"string","title":"Id"},"host":{"type":"string","title":"Host"},"port":{"type":"string","title":"Port"},"login":{"type":"string","title":"Login"},"password":{"type":"string","title":"Password"},"proxy_type":{"type":"string","title":"Proxy Type"},"country":{"type":"string","title":"Country"},"version":{"type":"string","title":"Version"},"date_start":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Date Start"},"date_end":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Date End"},"active":{"type":"boolean","title":"Active","default":true},"descr":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Descr"}},"type":"object","required":["id","host","port","login","password","proxy_type","country","version"],"title":"ProxyOut"},"PurchaseResponse":{"properties":{"order_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Order Id"},"price_charged":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Price Charged"},"currency":{"type":"string","title":"Currency","default":"RUB"},"proxies":{"items":{"$ref":"#/components/schemas/ProxyOut"},"type":"array","title":"Proxies"}},"type":"object","required":["price_charged","proxies"],"title":"PurchaseResponse"},"QuoteResponse":{"properties":{"price_final":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Price Final"},"price_single":{"anyOf":[{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Price Single"},"period":{"type":"integer","title":"Period"},"count":{"type":"integer","title":"Count"},"currency":{"type":"string","title":"Currency","default":"RUB"}},"type":"object","required":["price_final","price_single","period","count"],"title":"QuoteResponse"},"UserInfo":{"properties":{"tg_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tg Id"},"username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Username"},"web_username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Web Username"},"balance":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Balance"}},"type":"object","required":["balance"],"title":"UserInfo"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}}}}