{"openapi":"3.1.0","info":{"title":"AdBot Network","description":"API рекламной сети для Telegram-ботов: выдача нативной рекламы ботам-издателям, учёт показов и кликов, списание бюджета и начисление дохода издателю.","version":"0.1.0"},"paths":{"/v1/bots/register":{"post":{"tags":["publisher"],"summary":"Register Bot","description":"Привязка бота. Токен шифруется, наружу отдаётся только api_key.","operationId":"register_bot_v1_bots_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterIn"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/bots/claim":{"post":{"tags":["publisher"],"summary":"Claim Bot","description":"Привязать зарегистрированного бота к аккаунту владельца в кабинете.","operationId":"claim_bot_v1_bots_claim_post","parameters":[{"name":"username","in":"query","required":true,"schema":{"type":"string","title":"Username"}},{"name":"telegram_id","in":"query","required":true,"schema":{"type":"integer","title":"Telegram Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/get_ad":{"post":{"tags":["publisher"],"summary":"Get Ad","description":"Основной метод. status=empty — показывать нечего, это норма.","operationId":"get_ad_v1_get_ad_post","parameters":[{"name":"X-Api-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetAdIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/impression":{"post":{"tags":["publisher"],"summary":"Impression","description":"Подтверждение показа. Деньги списываются только здесь.\n\nРезерв забирается атомарно: повторный вызов с тем же show_id\nполучит 410 и второго списания не будет.","operationId":"impression_v1_impression_post","parameters":[{"name":"X-Api-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImpressionIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/c/{show_id}":{"get":{"tags":["publisher"],"summary":"Track Click","description":"Редирект на целевую ссылку. Повторные клики по одному показу\nне засчитываются, но редирект всё равно происходит.","operationId":"track_click_c__show_id__get","parameters":[{"name":"show_id","in":"path","required":true,"schema":{"type":"string","title":"Show Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/bots/me":{"get":{"tags":["publisher"],"summary":"Bot Me","operationId":"bot_me_v1_bots_me_get","parameters":[{"name":"X-Api-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/bots/toggle":{"post":{"tags":["publisher"],"summary":"Toggle Ads","operationId":"toggle_ads_v1_bots_toggle_post","parameters":[{"name":"X-Api-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ToggleIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/bots/rotate_key":{"post":{"tags":["publisher"],"summary":"Rotate Key","description":"Старый ключ перестаёт работать сразу после ответа.","operationId":"rotate_key_v1_bots_rotate_key_post","parameters":[{"name":"X-Api-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RotateOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/auth/telegram":{"post":{"tags":["auth"],"summary":"Telegram Login","operationId":"telegram_login_v1_auth_telegram_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Payload","description":"Поля Telegram Login Widget (id, auth_date, hash...)"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/auth/webapp":{"post":{"tags":["auth"],"summary":"Webapp Login","description":"Обмен initData Telegram Mini App на JWT кабинета.\n\nПодпись проверяется по схеме WebApp: секрет = HMAC(b\"WebAppData\", bot_token).\nАккаунт создаётся при первом входе (как в бот-кабинете: сразу\nрекламодатель и издатель).","operationId":"webapp_login_v1_auth_webapp_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebAppIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/campaigns":{"get":{"tags":["campaigns"],"summary":"List Campaigns","operationId":"list_campaigns_v1_campaigns_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Bearer <JWT из /v1/auth/telegram>","title":"Authorization"},"description":"Bearer <JWT из /v1/auth/telegram>"},{"name":"X-Telegram-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"X-Telegram-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["campaigns"],"summary":"Create Campaign","operationId":"create_campaign_v1_campaigns_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Bearer <JWT из /v1/auth/telegram>","title":"Authorization"},"description":"Bearer <JWT из /v1/auth/telegram>"},{"name":"X-Telegram-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"X-Telegram-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignIn"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/campaigns/{campaign_id}":{"get":{"tags":["campaigns"],"summary":"Get Campaign","operationId":"get_campaign_v1_campaigns__campaign_id__get","parameters":[{"name":"campaign_id","in":"path","required":true,"schema":{"type":"integer","title":"Campaign Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Bearer <JWT из /v1/auth/telegram>","title":"Authorization"},"description":"Bearer <JWT из /v1/auth/telegram>"},{"name":"X-Telegram-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"X-Telegram-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["campaigns"],"summary":"Patch Campaign","operationId":"patch_campaign_v1_campaigns__campaign_id__patch","parameters":[{"name":"campaign_id","in":"path","required":true,"schema":{"type":"integer","title":"Campaign Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Bearer <JWT из /v1/auth/telegram>","title":"Authorization"},"description":"Bearer <JWT из /v1/auth/telegram>"},{"name":"X-Telegram-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"X-Telegram-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignPatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["campaigns"],"summary":"Delete Campaign","operationId":"delete_campaign_v1_campaigns__campaign_id__delete","parameters":[{"name":"campaign_id","in":"path","required":true,"schema":{"type":"integer","title":"Campaign Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Bearer <JWT из /v1/auth/telegram>","title":"Authorization"},"description":"Bearer <JWT из /v1/auth/telegram>"},{"name":"X-Telegram-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"X-Telegram-Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/me":{"get":{"tags":["cabinet"],"summary":"Me","description":"Карточка аккаунта для шапки веб-аппа и конфигурация UI.","operationId":"me_v1_me_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Bearer <JWT из /v1/auth/telegram>","title":"Authorization"},"description":"Bearer <JWT из /v1/auth/telegram>"},{"name":"X-Telegram-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"X-Telegram-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/transactions":{"get":{"tags":["cabinet"],"summary":"Transactions","description":"Последние операции кошелька (пополнения, списания, начисления).","operationId":"transactions_v1_transactions_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Bearer <JWT из /v1/auth/telegram>","title":"Authorization"},"description":"Bearer <JWT из /v1/auth/telegram>"},{"name":"X-Telegram-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"X-Telegram-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/bots":{"get":{"tags":["cabinet"],"summary":"List Bots","description":"Боты-издатели аккаунта: статус, показы, заработок, доля.","operationId":"list_bots_v1_bots_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Bearer <JWT из /v1/auth/telegram>","title":"Authorization"},"description":"Bearer <JWT из /v1/auth/telegram>"},{"name":"X-Telegram-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"X-Telegram-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/bots/link":{"post":{"tags":["cabinet"],"summary":"Link Bot","description":"Подключить бота к своему аккаунту.\n\nТокен проверяется через Telegram API и шифруется; наружу отдаётся\nтолько api_key — один раз, в этом ответе.","operationId":"link_bot_v1_bots_link_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Bearer <JWT из /v1/auth/telegram>","title":"Authorization"},"description":"Bearer <JWT из /v1/auth/telegram>"},{"name":"X-Telegram-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"X-Telegram-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BotLinkIn"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/payouts":{"get":{"tags":["cabinet"],"summary":"List Payouts","description":"Свои заявки на выплату (новые сверху).","operationId":"list_payouts_v1_payouts_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Bearer <JWT из /v1/auth/telegram>","title":"Authorization"},"description":"Bearer <JWT из /v1/auth/telegram>"},{"name":"X-Telegram-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"X-Telegram-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["cabinet"],"summary":"Create Payout","description":"Заявка на выплату из publisher_balance. Деньги списываются сразу\nи возвращаются при отклонении админом.","operationId":"create_payout_v1_payouts_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Bearer <JWT из /v1/auth/telegram>","title":"Authorization"},"description":"Bearer <JWT из /v1/auth/telegram>"},{"name":"X-Telegram-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"X-Telegram-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayoutIn"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/payments/cryptobot/invoice":{"post":{"tags":["payments"],"summary":"Cryptobot Invoice","description":"Создать инвойс CryptoBot на amount USDT.","operationId":"cryptobot_invoice_v1_payments_cryptobot_invoice_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Bearer <JWT из /v1/auth/telegram>","title":"Authorization"},"description":"Bearer <JWT из /v1/auth/telegram>"},{"name":"X-Telegram-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"X-Telegram-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/payments/xrocket/invoice":{"post":{"tags":["payments"],"summary":"Xrocket Invoice","description":"Создать инвойс XRocket на amount USDT.","operationId":"xrocket_invoice_v1_payments_xrocket_invoice_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Bearer <JWT из /v1/auth/telegram>","title":"Authorization"},"description":"Bearer <JWT из /v1/auth/telegram>"},{"name":"X-Telegram-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"X-Telegram-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/payments/cryptobot/webhook":{"post":{"tags":["payments"],"summary":"Cryptobot Webhook","description":"Вебхук CryptoBot: подпись обязательна (HMAC, секрет = SHA256(token)).","operationId":"cryptobot_webhook_v1_payments_cryptobot_webhook_post","parameters":[{"name":"crypto-pay-api-signature","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Crypto-Pay-Api-Signature"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/payments/xrocket/webhook":{"post":{"tags":["payments"],"summary":"Xrocket Webhook","description":"Вебхук XRocket. Если подписи нет — сверяем статус инвойса через API\n(доверяем только подтверждённому «success»).","operationId":"xrocket_webhook_v1_payments_xrocket_webhook_post","parameters":[{"name":"x-rocket-pay-signature","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Rocket-Pay-Signature"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/payments/webhook":{"post":{"tags":["payments"],"summary":"Payments Webhook","operationId":"payments_webhook_v1_payments_webhook_post","parameters":[{"name":"X-Signature","in":"header","required":true,"schema":{"type":"string","title":"X-Signature"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/payments/invoice/check":{"post":{"tags":["payments"],"summary":"Invoice Check","description":"Мгновенная проверка своего инвойса (кнопка «Я оплатил» в веб-аппе):\nопрашивает провайдера и при оплате зачисляет баланс сразу, не дожидаясь\nвебхука/поллера.","operationId":"invoice_check_v1_payments_invoice_check_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Bearer <JWT из /v1/auth/telegram>","title":"Authorization"},"description":"Bearer <JWT из /v1/auth/telegram>"},{"name":"X-Telegram-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"X-Telegram-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceCheckIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/summary":{"get":{"tags":["admin"],"summary":"Summary","operationId":"summary_admin_summary_get","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer <ADBOT_ADMIN_API_TOKEN>","title":"Authorization"},"description":"Bearer <ADBOT_ADMIN_API_TOKEN>"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/moderation":{"get":{"tags":["admin"],"summary":"Moderation Queue","operationId":"moderation_queue_admin_moderation_get","parameters":[{"name":"kind","in":"query","required":false,"schema":{"anyOf":[{"type":"string","pattern":"^(creative|bot)$"},{"type":"null"}],"title":"Kind"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer <ADBOT_ADMIN_API_TOKEN>","title":"Authorization"},"description":"Bearer <ADBOT_ADMIN_API_TOKEN>"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/moderation/{task_id}/approve":{"post":{"tags":["admin"],"summary":"Approve","operationId":"approve_admin_moderation__task_id__approve_post","parameters":[{"name":"task_id","in":"path","required":true,"schema":{"type":"integer","title":"Task Id"}},{"name":"admin_id","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Admin Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer <ADBOT_ADMIN_API_TOKEN>","title":"Authorization"},"description":"Bearer <ADBOT_ADMIN_API_TOKEN>"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/moderation/{task_id}/reject":{"post":{"tags":["admin"],"summary":"Reject","operationId":"reject_admin_moderation__task_id__reject_post","parameters":[{"name":"task_id","in":"path","required":true,"schema":{"type":"integer","title":"Task Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer <ADBOT_ADMIN_API_TOKEN>","title":"Authorization"},"description":"Bearer <ADBOT_ADMIN_API_TOKEN>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RejectIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/bots":{"get":{"tags":["admin"],"summary":"List Bots","operationId":"list_bots_admin_bots_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"default":50,"title":"Limit"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer <ADBOT_ADMIN_API_TOKEN>","title":"Authorization"},"description":"Bearer <ADBOT_ADMIN_API_TOKEN>"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/bots/{bot_id}/block":{"post":{"tags":["admin"],"summary":"Block Bot","operationId":"block_bot_admin_bots__bot_id__block_post","parameters":[{"name":"bot_id","in":"path","required":true,"schema":{"type":"integer","title":"Bot Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer <ADBOT_ADMIN_API_TOKEN>","title":"Authorization"},"description":"Bearer <ADBOT_ADMIN_API_TOKEN>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlockIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/payouts":{"get":{"tags":["admin"],"summary":"List Payouts","operationId":"list_payouts_admin_payouts_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer <ADBOT_ADMIN_API_TOKEN>","title":"Authorization"},"description":"Bearer <ADBOT_ADMIN_API_TOKEN>"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/payouts/{payout_id}/approve":{"post":{"tags":["admin"],"summary":"Payout Approve","operationId":"payout_approve_admin_payouts__payout_id__approve_post","parameters":[{"name":"payout_id","in":"path","required":true,"schema":{"type":"integer","title":"Payout Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer <ADBOT_ADMIN_API_TOKEN>","title":"Authorization"},"description":"Bearer <ADBOT_ADMIN_API_TOKEN>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayoutApproveIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/payouts/{payout_id}/reject":{"post":{"tags":["admin"],"summary":"Payout Reject","operationId":"payout_reject_admin_payouts__payout_id__reject_post","parameters":[{"name":"payout_id","in":"path","required":true,"schema":{"type":"integer","title":"Payout Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer <ADBOT_ADMIN_API_TOKEN>","title":"Authorization"},"description":"Bearer <ADBOT_ADMIN_API_TOKEN>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RejectIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/accounts/{account_id}/adjust":{"post":{"tags":["admin"],"summary":"Adjust","operationId":"adjust_admin_accounts__account_id__adjust_post","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer","title":"Account Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer <ADBOT_ADMIN_API_TOKEN>","title":"Authorization"},"description":"Bearer <ADBOT_ADMIN_API_TOKEN>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdjustIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/settings":{"get":{"tags":["admin"],"summary":"Get Settings List","operationId":"get_settings_list_admin_settings_get","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer <ADBOT_ADMIN_API_TOKEN>","title":"Authorization"},"description":"Bearer <ADBOT_ADMIN_API_TOKEN>"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["admin"],"summary":"Put Setting","operationId":"put_setting_admin_settings_put","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer <ADBOT_ADMIN_API_TOKEN>","title":"Authorization"},"description":"Bearer <ADBOT_ADMIN_API_TOKEN>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SettingIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/broadcast":{"post":{"tags":["admin"],"summary":"Broadcast","description":"Возвращает список telegram_id — фактическую отправку делает бот-воркер.","operationId":"broadcast_admin_broadcast_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer <ADBOT_ADMIN_API_TOKEN>","title":"Authorization"},"description":"Bearer <ADBOT_ADMIN_API_TOKEN>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/broadcast/send":{"post":{"tags":["admin"],"summary":"Broadcast Send","description":"Отправляет рассылку через бота прямо из веб-админки.\n\nТот же поток, что в бот-админке: выбираем аккаунты и шлём сообщения\nчерез aiogram с учётом flood-лимитов Telegram (~20 сообщений/с).","operationId":"broadcast_send_admin_broadcast_send_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer <ADBOT_ADMIN_API_TOKEN>","title":"Authorization"},"description":"Bearer <ADBOT_ADMIN_API_TOKEN>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/reports/daily":{"get":{"tags":["admin"],"summary":"Reports Daily","description":"Дневные витрины сети: показы, клики, расход, доход.","operationId":"reports_daily_admin_reports_daily_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":90,"minimum":1,"default":7,"title":"Days"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer <ADBOT_ADMIN_API_TOKEN>","title":"Authorization"},"description":"Bearer <ADBOT_ADMIN_API_TOKEN>"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/reports/export.csv":{"get":{"tags":["admin"],"summary":"Reports Export","description":"CSV-выгрузка витрины: всей сети или одной кампании.","operationId":"reports_export_admin_reports_export_csv_get","parameters":[{"name":"campaign_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"title":"Campaign Id"}},{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":90,"minimum":1,"default":7,"title":"Days"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer <ADBOT_ADMIN_API_TOKEN>","title":"Authorization"},"description":"Bearer <ADBOT_ADMIN_API_TOKEN>"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/fraud/overview":{"get":{"tags":["admin"],"summary":"Fraud Stats","description":"Клики по ботам с разбивкой на обычные и подозрительные.","operationId":"fraud_stats_admin_fraud_overview_get","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer <ADBOT_ADMIN_API_TOKEN>","title":"Authorization"},"description":"Bearer <ADBOT_ADMIN_API_TOKEN>"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/health":{"get":{"tags":["system"],"summary":"Health","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"AdjustIn":{"properties":{"amount":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Amount","description":"Плюс пополнить, минус списать"},"reason":{"type":"string","maxLength":256,"minLength":3,"title":"Reason"},"admin_id":{"type":"integer","title":"Admin Id"}},"type":"object","required":["amount","reason","admin_id"],"title":"AdjustIn"},"BlockIn":{"properties":{"blocked":{"type":"boolean","title":"Blocked","default":true},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"admin_id":{"type":"integer","title":"Admin Id","default":0}},"type":"object","title":"BlockIn"},"BotLinkIn":{"properties":{"token":{"type":"string","minLength":20,"title":"Token","description":"Токен бота от @BotFather"},"category":{"type":"string","maxLength":32,"title":"Category","default":"other"}},"type":"object","required":["token"],"title":"BotLinkIn"},"BroadcastIn":{"properties":{"text":{"type":"string","maxLength":3500,"minLength":1,"title":"Text"},"only_active":{"type":"boolean","title":"Only Active","default":true},"admin_id":{"type":"integer","title":"Admin Id","default":0}},"type":"object","required":["text"],"title":"BroadcastIn"},"CampaignIn":{"properties":{"name":{"type":"string","maxLength":64,"minLength":1,"title":"Name"},"cpm":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Cpm","description":"Ставка за 1000 показов, $"},"daily_budget":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Daily Budget","default":"0"},"total_budget":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Total Budget"},"target":{"additionalProperties":true,"type":"object","title":"Target"},"text":{"type":"string","maxLength":4000,"minLength":1,"title":"Text"},"button_text":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Button Text"},"button_url":{"anyOf":[{"type":"string","maxLength":512},{"type":"null"}],"title":"Button Url"}},"type":"object","required":["name","cpm","total_budget","text"],"title":"CampaignIn"},"CampaignPatch":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":64,"minLength":1},{"type":"null"}],"title":"Name"},"cpm":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Cpm"},"daily_budget":{"anyOf":[{"type":"number","minimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Daily Budget"},"total_budget":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"},{"type":"null"}],"title":"Total Budget"},"target":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Target"},"paused":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Paused"}},"type":"object","title":"CampaignPatch"},"GetAdIn":{"properties":{"user_id":{"type":"integer","title":"User Id"},"chat_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Chat Id"},"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"}},"type":"object","required":["user_id"],"title":"GetAdIn"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ImpressionIn":{"properties":{"show_id":{"type":"string","title":"Show Id"}},"type":"object","required":["show_id"],"title":"ImpressionIn"},"InvoiceCheckIn":{"properties":{"external_id":{"type":"string","maxLength":128,"minLength":8,"title":"External Id"}},"type":"object","required":["external_id"],"title":"InvoiceCheckIn"},"InvoiceIn":{"properties":{"amount":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Amount","description":"Сумма пополнения (USDT ≈ $)"},"asset":{"type":"string","maxLength":8,"title":"Asset","default":"USDT"}},"type":"object","required":["amount"],"title":"InvoiceIn"},"PayoutApproveIn":{"properties":{"admin_comment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Admin Comment"},"admin_id":{"type":"integer","title":"Admin Id","default":0}},"type":"object","title":"PayoutApproveIn"},"PayoutIn":{"properties":{"method":{"type":"string","pattern":"^(ton|card|stars)$","title":"Method"},"destination":{"type":"string","maxLength":256,"minLength":3,"title":"Destination"},"amount":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"}],"title":"Amount"}},"type":"object","required":["method","destination","amount"],"title":"PayoutIn"},"RegisterIn":{"properties":{"token":{"type":"string","minLength":20,"title":"Token","description":"Токен от @BotFather"},"category":{"type":"string","title":"Category","default":"other"},"lang":{"type":"string","title":"Lang","default":"ru"},"audience_size":{"type":"integer","title":"Audience Size","default":0}},"type":"object","required":["token"],"title":"RegisterIn"},"RegisterOut":{"properties":{"bot_id":{"type":"integer","title":"Bot Id"},"username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Username"},"api_key":{"type":"string","title":"Api Key","description":"Показывается один раз — сохраните"},"status":{"type":"string","title":"Status"}},"type":"object","required":["bot_id","username","api_key","status"],"title":"RegisterOut"},"RejectIn":{"properties":{"reason":{"type":"string","maxLength":256,"minLength":3,"title":"Reason"},"admin_id":{"type":"integer","title":"Admin Id","default":0}},"type":"object","required":["reason"],"title":"RejectIn"},"RotateOut":{"properties":{"api_key":{"type":"string","title":"Api Key"}},"type":"object","required":["api_key"],"title":"RotateOut"},"SettingIn":{"properties":{"key":{"type":"string","title":"Key"},"value":{"type":"string","title":"Value"},"admin_id":{"type":"integer","title":"Admin Id","default":0}},"type":"object","required":["key","value"],"title":"SettingIn"},"ToggleIn":{"properties":{"enabled":{"type":"boolean","title":"Enabled"}},"type":"object","required":["enabled"],"title":"ToggleIn"},"TokenOut":{"properties":{"access_token":{"type":"string","title":"Access Token"},"token_type":{"type":"string","title":"Token Type","default":"bearer"},"expires_in":{"type":"integer","title":"Expires In"},"telegram_id":{"type":"integer","title":"Telegram Id"},"username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Username"}},"type":"object","required":["access_token","expires_in","telegram_id","username"],"title":"TokenOut"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"WebAppIn":{"properties":{"init_data":{"type":"string","minLength":10,"title":"Init Data","description":"initData из Telegram WebApp"}},"type":"object","required":["init_data"],"title":"WebAppIn"}}}}