{"openapi":"3.1.0","info":{"title":"PrimeTime Media API","description":"YouTube Channel Optimization Platform","version":"1.0.0"},"paths":{"/health":{"get":{"tags":["Health Detail","Health"],"summary":"Health Check","description":"Health check endpoint for monitoring.","operationId":"health_check_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/":{"get":{"tags":["Health Detail","Health"],"summary":"Root","description":"Root endpoint - basic API status","operationId":"root__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/dashboard/revenue/summary":{"get":{"tags":["Dashboard","dashboard"],"summary":"Get Revenue Summary","description":"Get revenue summary from real invoice data","operationId":"get_revenue_summary_api_dashboard_revenue_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/dashboard/revenue/by-tier":{"get":{"tags":["Dashboard","dashboard"],"summary":"Get Revenue By Tier","description":"Get revenue broken down by creator tier from real data","operationId":"get_revenue_by_tier_api_dashboard_revenue_by_tier_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/dashboard/revenue/by-category":{"get":{"tags":["Dashboard","dashboard"],"summary":"Get Revenue By Category","description":"Get revenue broken down by content category from real data","operationId":"get_revenue_by_category_api_dashboard_revenue_by_category_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/dashboard/revenue/daily":{"get":{"tags":["Dashboard","dashboard"],"summary":"Get Revenue Daily","description":"Get daily revenue for the past 30 days from real data","operationId":"get_revenue_daily_api_dashboard_revenue_daily_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/dashboard/revenue/projections":{"get":{"tags":["Dashboard","dashboard"],"summary":"Get Revenue Projections","description":"Get revenue projections based on current data","operationId":"get_revenue_projections_api_dashboard_revenue_projections_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/dashboard/creators/summary":{"get":{"tags":["Dashboard","dashboard"],"summary":"Get Creators Summary","description":"Get creator summary from real data","operationId":"get_creators_summary_api_dashboard_creators_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/dashboard/creators/top":{"get":{"tags":["Dashboard","dashboard"],"summary":"Get Top Creators","description":"Get top creators by revenue from real data","operationId":"get_top_creators_api_dashboard_creators_top_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/dashboard/creators/by-tier":{"get":{"tags":["Dashboard","dashboard"],"summary":"Get Creators By Tier","description":"Get creator count by tier from real data","operationId":"get_creators_by_tier_api_dashboard_creators_by_tier_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/dashboard/operations/video-states":{"get":{"tags":["Dashboard","dashboard"],"summary":"Get Video States","description":"Get video optimization states from real data","operationId":"get_video_states_api_dashboard_operations_video_states_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/dashboard/timing/optimal":{"get":{"tags":["Dashboard","dashboard"],"summary":"Get Optimal Timing","description":"Get optimal timing data from real performance data","operationId":"get_optimal_timing_api_dashboard_timing_optimal_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/decision/init":{"post":{"tags":["Decision","Decision Layer"],"summary":"Initialize Decision Layer","description":"Initialize the Decision Layer components.\n\nPhase 1 Item C: the Decision Layer now auto-initializes at instance\nstartup (main.py lifespan hook), so calling this is no longer\nrequired for correctness. It is kept for manual re-initialization\n(e.g. to reload state from the database without a redeploy).\n\nReturns:\n    Success status and component info","operationId":"initialize_decision_layer_api_v1_decision_init_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized - Invalid scheduler token"},"500":{"description":"Internal Server Error"}}}},"/api/v1/decision/tick":{"post":{"tags":["Decision","Decision Layer"],"summary":"Scheduler Tick","description":"Main scheduler tick - process videos for optimization.\n\nCalled every 5 minutes by GCP Cloud Scheduler.\n\nFlow:\n1. Get ready videos from OPTIMIZE and REOPT queues\n2. For each video, run should_optimize() check\n3. Create VideoDecision for eligible videos\n4. Send to Optimization Layer\n5. Move optimized videos to MEASURE queue\n\nReturns:\n    TickResponse with processing summary","operationId":"scheduler_tick_api_v1_decision_tick_post","parameters":[{"name":"authorization","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TickResponse"}}}},"401":{"description":"Unauthorized - Invalid scheduler token"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/decision/measure":{"post":{"tags":["Decision","Decision Layer"],"summary":"Measurement Tick","description":"Measurement tick - evaluate optimization outcomes.\n\nCalled every 6 hours by GCP Cloud Scheduler.\n\nFlow:\n1. Get videos from MEASURE queue whose window has elapsed\n2. Fetch current stats from YouTube\n3. Evaluate success/failure\n4. Update Bayesian posteriors\n5. Update creator lifecycle state\n6. Move to IDLE (success) or REOPT/PAUSED (failure)\n\nReturns:\n    MeasureResponse with evaluation summary","operationId":"measurement_tick_api_v1_decision_measure_post","parameters":[{"name":"authorization","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeasureResponse"}}}},"401":{"description":"Unauthorized - Invalid scheduler token"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/decision/baseline":{"post":{"tags":["Decision","Decision Layer"],"summary":"Baseline Capture","description":"Baseline capture - capture initial metrics for new videos.\n\nCalled hourly by GCP Cloud Scheduler.\n\nFlow:\n1. Get videos from BASELINE queue\n2. Fetch current stats from YouTube\n3. Store as baseline metrics\n4. Move to OPTIMIZE queue\n\nReturns:\n    BaselineResponse with capture summary","operationId":"baseline_capture_api_v1_decision_baseline_post","parameters":[{"name":"authorization","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaselineResponse"}}}},"401":{"description":"Unauthorized - Invalid scheduler token"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/decision/algo-check":{"post":{"tags":["Decision","Decision Layer"],"summary":"Algorithm Change Check","description":"Daily ML maintenance endpoint (Phase 4 rewire).\n\nCalled daily by GCP Cloud Scheduler. Per WIRE-2 = 1'a, drift detection\nis now performed in-tick via KLDivergenceDetector (which can also\nautomatically reset segment gates on detection). This endpoint no\nlonger performs the inline CUSUM+BOCPD detection that previously\nduplicated and shadowed the KL path.\n\nWhat it does now:\n  1. Train the churn-prediction model on accumulated creator data\n  2. Re-discover dynamic segments via HDP\n  3. Report current drift status (read-only, from KL detector state)\n\nPhase 4 wiring: train_churn_model and discover_segments needed periodic\ntriggers; this is the natural daily slot. Both methods are no-ops\nuntil enough data accumulates (churn_min_creators / hdp_min_videos\ngates).","operationId":"algorithm_change_check_api_v1_decision_algo_check_post","parameters":[{"name":"authorization","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized - Invalid scheduler token"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/decision/health":{"get":{"tags":["Decision","Decision Layer"],"summary":"Health Check","description":"Health check endpoint for monitoring.\n\nReturns component status and queue sizes.","operationId":"health_check_api_v1_decision_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}},"401":{"description":"Unauthorized - Invalid scheduler token"},"500":{"description":"Internal Server Error"}}}},"/api/v1/decision/stats":{"get":{"tags":["Decision","Decision Layer"],"summary":"Get Statistics","description":"Get detailed statistics about the Decision Layer.\n\nUseful for monitoring dashboards.","operationId":"get_statistics_api_v1_decision_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized - Invalid scheduler token"},"500":{"description":"Internal Server Error"}}}},"/api/v1/decision/explain/{video_id}":{"get":{"tags":["Decision","Decision Layer"],"summary":"Explain Decision","description":"Get detailed explanation of decision for a video.\n\nUseful for debugging and customer support.\n\nArgs:\n    video_id: Database ID of the video\n    \nReturns:\n    Detailed breakdown of all decision factors","operationId":"explain_decision_api_v1_decision_explain__video_id__get","parameters":[{"name":"video_id","in":"path","required":true,"schema":{"type":"integer","title":"Video Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized - Invalid scheduler token"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/creators/list":{"get":{"tags":["Admin Creators List","admin-creators-list"],"summary":"List Creators Paginated","description":"List creators with alphabetical pagination, optional substring filter.\n\nEmpty `q` -> classic paginated list (sorted by handle).\nNon-empty `q` -> filtered list (still paginated; same shape).\n\nSubstring matching is ILIKE-based across handle, channel_name, and\nemail so the \"address-bar like\" UX matches anywhere in any of those.\nTrigram indexes from migration 041 keep this fast at scale.","operationId":"list_creators_paginated_api_admin_creators_list_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"per_page","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":5,"title":"Per Page"}},{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"description":"Optional substring filter","title":"Q"},"description":"Optional substring filter"},{"name":"include_inactive","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Inactive"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatorListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/creators":{"get":{"tags":["Admin","admin"],"summary":"List Creators","description":"List all creators - FIXED: uses yc.channel_name instead of yc.title","operationId":"list_creators_api_admin_creators_get","parameters":[{"name":"tier","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tier"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/creators/{creator_id}":{"get":{"tags":["Admin","admin"],"summary":"Get Creator","description":"Get detailed creator information","operationId":"get_creator_api_admin_creators__creator_id__get","parameters":[{"name":"creator_id","in":"path","required":true,"schema":{"type":"integer","title":"Creator Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/creators/{creator_id}/pause":{"post":{"tags":["Admin","admin"],"summary":"Pause Creator","description":"Pause creator (disable optimizations)","operationId":"pause_creator_api_admin_creators__creator_id__pause_post","parameters":[{"name":"creator_id","in":"path","required":true,"schema":{"type":"integer","title":"Creator Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/creators/{creator_id}/resume":{"post":{"tags":["Admin","admin"],"summary":"Resume Creator","description":"Resume creator (enable optimizations)","operationId":"resume_creator_api_admin_creators__creator_id__resume_post","parameters":[{"name":"creator_id","in":"path","required":true,"schema":{"type":"integer","title":"Creator Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/stats":{"get":{"tags":["Admin","admin"],"summary":"Get Admin Stats","description":"Get system statistics","operationId":"get_admin_stats_api_admin_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/jobs":{"get":{"tags":["Admin","admin"],"summary":"Get Scheduled Jobs","description":"Get scheduled jobs status","operationId":"get_scheduled_jobs_api_admin_jobs_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/jobs/{job_id}/trigger":{"post":{"tags":["Admin","admin"],"summary":"Trigger Job","description":"Manually trigger a scheduled job by ID.\n\nLooks up the job_id in JOB_TRIGGER_MAP, then makes an internal HTTP POST\nto the corresponding /api/tasks/* endpoint using the scheduler secret\nfrom Google Secret Manager. This produces the same behavior as Cloud\nScheduler firing the job on its cron schedule.\n\nReturns the task endpoint's raw response plus metadata about which\nendpoint was actually invoked.","operationId":"trigger_job_api_admin_jobs__job_id__trigger_post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/logs":{"get":{"tags":["Admin Logs","admin-logs"],"summary":"Get System Logs","description":"Get system logs with filtering.","operationId":"get_system_logs_api_admin_logs_get","parameters":[{"name":"severity","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Severity"}},{"name":"service","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Service"}},{"name":"event_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Event Type"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"hours","in":"query","required":false,"schema":{"type":"integer","maximum":168,"minimum":1,"default":24,"title":"Hours"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":200,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/analytics/dashboard":{"get":{"tags":["Admin","admin"],"summary":"Get Analytics Dashboard","description":"Get comprehensive analytics dashboard data","operationId":"get_analytics_dashboard_api_admin_analytics_dashboard_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/billing/summary":{"get":{"tags":["Admin","admin"],"summary":"Get Billing Summary","description":"Get billing summary","operationId":"get_billing_summary_api_admin_billing_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/settings/stripe-mode":{"get":{"tags":["Admin","admin"],"summary":"Get Stripe Mode","description":"Get current Stripe mode (test or live).","operationId":"get_stripe_mode_api_admin_settings_stripe_mode_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"put":{"tags":["Admin","admin"],"summary":"Update Stripe Mode","description":"Toggle Stripe between test and live mode.\n\nBody: {\"mode\": \"test\"} or {\"mode\": \"live\"}\n\nRequires: both key sets configured in Secret Manager.","operationId":"update_stripe_mode_api_admin_settings_stripe_mode_put","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/settings/monetization-check":{"get":{"tags":["Admin","admin"],"summary":"Get Monetization Check","description":"Read the system-wide monetization check toggle.\n\nWhen enabled='true' (default, production), routes/signup_flow.py rejects\nYouTube channels not in the YouTube Partner Program. When 'false',\nthe gate is bypassed — used for testing signup with non-monetized\naccounts. Stored in system_settings.monetization_check_enabled.","operationId":"get_monetization_check_api_admin_settings_monetization_check_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"put":{"tags":["Admin","admin"],"summary":"Update Monetization Check","description":"Toggle the monetization check on/off.\n\nBody: {\"enabled\": true} or {\"enabled\": false}\n\nWhen false, signup_flow bypasses the YPP probe and any YouTube\nchannel can complete signup. Use only for testing.","operationId":"update_monetization_check_api_admin_settings_monetization_check_put","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/settings/all":{"get":{"tags":["Admin","admin"],"summary":"Get All Settings","description":"Get all system_config key-value pairs.","operationId":"get_all_settings_api_admin_settings_all_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/funnel":{"get":{"tags":["Admin","admin"],"summary":"Get Funnel Analytics","description":"S3.9 — per-step counts + step-to-step conversion percentages for\nthe last `window_days`. Admin-auth gated via the router-level\n`require_admin_session` dependency. Default window is 30 days,\nconstrained to 1..365.","operationId":"get_funnel_analytics_api_admin_funnel_get","parameters":[{"name":"window_days","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"default":30,"title":"Window Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/funnel/dashboard":{"get":{"tags":["Admin","admin"],"summary":"Get Funnel Dashboard","description":"D.4 — richer funnel view for the admin dashboard. Returns per-\nstep counts WITH next-step conversion ratios, explicit dropoff\nedges with lost counts + median dwell time, and an individual-\nsessions list so Rob can click into any specific signup journey.\n\nReal-human only: filters out rows authored by users marked\nis_test_user=TRUE. Events with user_id IS NULL (anonymous visitors\npre-channel_connected) are kept.","operationId":"get_funnel_dashboard_api_admin_funnel_dashboard_get","parameters":[{"name":"window_days","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"default":30,"title":"Window Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/_test/induce_500":{"post":{"tags":["Admin","admin"],"summary":"Induce 500 For S5 5 Verification","description":"Deliberately raises an unhandled exception so the S5.4 error\nmiddleware writes a row to system_logs. Only usable by admins and\nonly outside production. See STAGE6_COMPLETE.md S6.3.","operationId":"induce_500_for_s5_5_verification_api_admin__test_induce_500_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/video-transfers":{"get":{"tags":["Admin","admin"],"summary":"List Video Transfers","description":"T3-12 (BILLING_RULES.md §10): list videos where a channel-ownership\ntransfer has been detected by SnapshotCollector.\n\nReturns videos whose `videos.detected_youtube_channel_id` differs from\nthe youtube_channel they're currently linked to. These need manual\nadmin review since automated transfer handling isn't implemented.","operationId":"list_video_transfers_api_admin_video_transfers_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/ml/status":{"get":{"tags":["Admin Ops","admin-ops"],"summary":"Get Ml Status","description":"Get ML model status\nFIXED: Handles missing video_metrics table gracefully","operationId":"get_ml_status_api_admin_ml_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/ml/bayesian/summary":{"get":{"tags":["Admin Ops","admin-ops"],"summary":"Get Bayesian Summary","description":"Get Bayesian learning summary","operationId":"get_bayesian_summary_api_admin_ml_bayesian_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/ml/arms/summary":{"get":{"tags":["Admin Ops","admin-ops"],"summary":"Get Arms Summary","description":"Get multi-armed bandit summary","operationId":"get_arms_summary_api_admin_ml_arms_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/ml/thumbnail/stats":{"get":{"tags":["Admin Ops","admin-ops"],"summary":"Get Thumbnail Stats","description":"Get thumbnail optimization stats\nFIXED: Handles missing thumbnail_evaluations table","operationId":"get_thumbnail_stats_api_admin_ml_thumbnail_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/ml/models/status":{"get":{"tags":["Admin Ops","admin-ops"],"summary":"Get Models Status","description":"Get ML models status","operationId":"get_models_status_api_admin_ml_models_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/ml/adaptation/status":{"get":{"tags":["Admin Ops","admin-ops"],"summary":"Get Adaptation Status","description":"Get ML adaptation status","operationId":"get_adaptation_status_api_admin_ml_adaptation_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/ml/shapley/summary":{"get":{"tags":["Admin Ops","admin-ops"],"summary":"Get Shapley Summary","description":"Get Shapley value analysis summary","operationId":"get_shapley_summary_api_admin_ml_shapley_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/ops/errors":{"get":{"tags":["Admin Ops","admin-ops"],"summary":"Get Ops Errors","description":"Get recent operation errors","operationId":"get_ops_errors_api_admin_ops_errors_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/ops/performance/summary":{"get":{"tags":["Admin Ops","admin-ops"],"summary":"Get Ops Performance Summary","description":"Internal pipeline performance metrics for the admin dashboard.","operationId":"get_ops_performance_summary_api_admin_ops_performance_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/ops/scheduler/metrics":{"get":{"tags":["Admin Ops","admin-ops"],"summary":"Get Scheduler Metrics","description":"Scheduler and job execution telemetry, including duration histograms when available.","operationId":"get_scheduler_metrics_api_admin_ops_scheduler_metrics_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/ops/generation/title/stats":{"get":{"tags":["Admin Ops","admin-ops"],"summary":"Get Title Generation Stats","description":"Title generation telemetry including latency/token/cost placeholders when instrumentation is absent.","operationId":"get_title_generation_stats_api_admin_ops_generation_title_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/ops/generation/thumbnail/stats":{"get":{"tags":["Admin Ops","admin-ops"],"summary":"Get Thumbnail Generation Stats V2","description":"Thumbnail generation telemetry including render latency and fallback rate.","operationId":"get_thumbnail_generation_stats_v2_api_admin_ops_generation_thumbnail_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/ops/learning/evolution":{"get":{"tags":["Admin Ops","admin-ops"],"summary":"Get Learning Evolution","description":"Learning-system evolution metrics and segment health.","operationId":"get_learning_evolution_api_admin_ops_learning_evolution_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/ops/learning/calibration":{"get":{"tags":["Admin Ops","admin-ops"],"summary":"Get Learning Calibration","description":"Predicted vs realized lift and drift metrics for monitoring model evolution.","operationId":"get_learning_calibration_api_admin_ops_learning_calibration_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/health/detailed":{"get":{"tags":["Admin Ops","admin-ops"],"summary":"Get Health Detailed","description":"Detailed health status for the admin dashboard infrastructure tiles.\nReal values for DB and queue where available; zero stubs where\ninstrumentation is not yet wired (OpenAI costs, YouTube quota, API response time).","operationId":"get_health_detailed_api_admin_health_detailed_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/fix/db-connections":{"post":{"tags":["Admin Fix","admin-fix"],"summary":"Fix Db Connections","description":"Reset idle database connections.","operationId":"fix_db_connections_api_admin_fix_db_connections_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/fix/db-pool":{"post":{"tags":["Admin Fix","admin-fix"],"summary":"Fix Db Pool","description":"Restart database connection pool.","operationId":"fix_db_pool_api_admin_fix_db_pool_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/fix/youtube-quota":{"post":{"tags":["Admin Fix","admin-fix"],"summary":"Fix Youtube Quota","description":"Pause non-critical YouTube API operations when quota is high.","operationId":"fix_youtube_quota_api_admin_fix_youtube_quota_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/fix/clear-failed-jobs":{"post":{"tags":["Admin Fix","admin-fix"],"summary":"Fix Clear Failed Jobs","description":"Clear or retry failed scheduled jobs.","operationId":"fix_clear_failed_jobs_api_admin_fix_clear_failed_jobs_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/fix/optimization-queue":{"post":{"tags":["Admin Fix","admin-fix"],"summary":"Fix Optimization Queue","description":"Clear stuck optimization queue items.","operationId":"fix_optimization_queue_api_admin_fix_optimization_queue_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/fix/stripe-sync":{"post":{"tags":["Admin Fix","admin-fix"],"summary":"Fix Stripe Sync","description":"Sync Stripe customer and payment data.","operationId":"fix_stripe_sync_api_admin_fix_stripe_sync_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/fix/clear-cache":{"post":{"tags":["Admin Fix","admin-fix"],"summary":"Fix Clear Cache","description":"Clear application caches.","operationId":"fix_clear_cache_api_admin_fix_clear_cache_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/fix/schema-migration":{"post":{"tags":["Admin Fix","admin-fix"],"summary":"Fix Schema Migration","description":"Add missing database columns and tables.","operationId":"fix_schema_migration_api_admin_fix_schema_migration_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/fix/autofix":{"post":{"tags":["Admin Fix","admin-fix"],"summary":"Autofix All","description":"Run all safe automatic fixes.","operationId":"autofix_all_api_admin_fix_autofix_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/fix/analyze/database":{"get":{"tags":["Admin Fix","admin-fix"],"summary":"Analyze Database","description":"Get detailed database diagnostics.","operationId":"analyze_database_api_admin_fix_analyze_database_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/fix/analyze/schema":{"get":{"tags":["Admin Fix","admin-fix"],"summary":"Get Database Schema","description":"Get full database schema.","operationId":"get_database_schema_api_admin_fix_analyze_schema_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/fix/analyze/optimization-queue":{"get":{"tags":["Admin Fix","admin-fix"],"summary":"Analyze Optimization Queue","description":"Get optimization queue diagnostics.","operationId":"analyze_optimization_queue_api_admin_fix_analyze_optimization_queue_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/logs/stats":{"get":{"tags":["Admin Logs","admin-logs"],"summary":"Get Log Stats","description":"Get log statistics.","operationId":"get_log_stats_api_admin_logs_stats_get","parameters":[{"name":"hours","in":"query","required":false,"schema":{"type":"integer","maximum":168,"minimum":1,"default":24,"title":"Hours"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/logs/services":{"get":{"tags":["Admin Logs","admin-logs"],"summary":"Get Available Services","description":"Get list of services that have logged.","operationId":"get_available_services_api_admin_logs_services_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/logs/event-types":{"get":{"tags":["Admin Logs","admin-logs"],"summary":"Get Event Types","description":"Get list of event types.","operationId":"get_event_types_api_admin_logs_event_types_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/logs/write":{"post":{"tags":["Admin Logs","admin-logs"],"summary":"Write Log","description":"Manually write a log entry (for testing/admin notes).","operationId":"write_log_api_admin_logs_write_post","parameters":[{"name":"severity","in":"query","required":true,"schema":{"type":"string","title":"Severity"}},{"name":"service","in":"query","required":true,"schema":{"type":"string","title":"Service"}},{"name":"message","in":"query","required":true,"schema":{"type":"string","title":"Message"}},{"name":"event_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Event Type"}},{"name":"details","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Details"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/messages":{"get":{"tags":["Admin Messages","admin-messages"],"summary":"Get All Threads","operationId":"get_all_threads_api_admin_messages_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"priority","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Priority"}},{"name":"category","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/messages/{thread_id}":{"get":{"tags":["Admin Messages","admin-messages"],"summary":"Get Thread","operationId":"get_thread_api_admin_messages__thread_id__get","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"integer","title":"Thread Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/messages/{thread_id}/reply":{"post":{"tags":["Admin Messages","admin-messages"],"summary":"Reply To Thread","operationId":"reply_to_thread_api_admin_messages__thread_id__reply_post","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"integer","title":"Thread Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageReply"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/messages/{thread_id}/status":{"put":{"tags":["Admin Messages","admin-messages"],"summary":"Update Thread Status","operationId":"update_thread_status_api_admin_messages__thread_id__status_put","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"integer","title":"Thread Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/messages/unread/count":{"get":{"tags":["Admin Messages","admin-messages"],"summary":"Get Unread Count","operationId":"get_unread_count_api_admin_messages_unread_count_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/impersonate/refresh":{"post":{"tags":["Admin Impersonation Lifecycle","admin-impersonation-lifecycle"],"summary":"Refresh Impersonation","description":"Extend the current impersonation token's TTL by another 15 min.\n\nAuthed by the imp_ token itself (NOT admin auth). Listed in\n_IMPERSONATION_WRITE_ALLOWLIST in main.py so the read-only\nmiddleware lets the request through.","operationId":"refresh_impersonation_api_admin_impersonate_refresh_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImpersonateRefreshResponse"}}}}}}},"/api/admin/impersonate/end":{"post":{"tags":["Admin Impersonation Lifecycle","admin-impersonation-lifecycle"],"summary":"End Impersonation","description":"Voluntarily end the current impersonation session.\n\nCalled when the admin clicks \"Exit\" in the impersonation banner.\nMarks the audit row with ended_at + end_reason='admin_exit' and deletes\nthe underlying user_sessions row. Like /refresh, this trusts the imp_\ntoken itself.","operationId":"end_impersonation_api_admin_impersonate_end_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/users/search":{"get":{"tags":["Admin Impersonation","admin-impersonation"],"summary":"Search Users","description":"Typeahead-grade fuzzy search across users + their primary channel.\n\nHits the trigram indexes from migration 041, returns top N by combined\nsimilarity score (highest match wins among email / name / channel).","operationId":"search_users_api_admin_users_search_get","parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string","minLength":2,"maxLength":120,"description":"Search query","title":"Q"},"description":"Search query"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":50,"minimum":1,"default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UserSearchHit"},"title":"Response Search Users Api Admin Users Search Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/impersonate/{user_id}":{"post":{"tags":["Admin Impersonation","admin-impersonation"],"summary":"Start Impersonation","description":"Start a read-only impersonation session as `user_id`.\n\nMints a token in user_sessions (so all existing auth dependencies\nJust Work) and records a row in admin_impersonation_audit. TTL is 15\nminutes; the admin can call /refresh to extend.","operationId":"start_impersonation_api_admin_impersonate__user_id__post","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"integer","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImpersonateStartResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/impersonate/active":{"get":{"tags":["Admin Impersonation","admin-impersonation"],"summary":"List Active Impersonations","description":"List currently-active impersonation sessions across all admins.\n\nUseful for the admin overview page. Read-only admins can see this.","operationId":"list_active_impersonations_api_admin_impersonate_active_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ImpersonateActiveSession"},"type":"array","title":"Response List Active Impersonations Api Admin Impersonate Active Get"}}}}}}},"/api/auth/status":{"get":{"tags":["Dashboard Auth","auth"],"summary":"Get Auth Status","operationId":"get_auth_status_api_auth_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthStatusResponse"}}}}}}},"/api/auth/me":{"get":{"tags":["Dashboard Auth","auth"],"summary":"Get Current User Info","operationId":"get_current_user_info_api_auth_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserResponse"}}}}}}},"/api/auth/login":{"get":{"tags":["Dashboard Auth","auth"],"summary":"Login Redirect","operationId":"login_redirect_api_auth_login_get","parameters":[{"name":"return_to","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Return To"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/callback":{"get":{"tags":["Dashboard Auth","auth"],"summary":"Oauth Callback","operationId":"oauth_callback_api_auth_callback_get","parameters":[{"name":"code","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"}},{"name":"state","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"State"}},{"name":"error","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/auth/logout":{"get":{"tags":["Dashboard Auth","auth"],"summary":"Logout Redirect","operationId":"logout_redirect_api_auth_logout_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["Dashboard Auth","auth"],"summary":"Logout","operationId":"logout_api_auth_logout_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/users/profile":{"get":{"tags":["Users","users"],"summary":"Get Profile","description":"Get current user's profile and connected accounts status.","operationId":"get_profile_api_users_profile_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/routes__user_routes__ProfileResponse"}}}}}},"put":{"tags":["Users","users"],"summary":"Update Profile","description":"Update user profile settings.","operationId":"update_profile_api_users_profile_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileUpdate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/routes__user_routes__ProfileResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/users/business":{"get":{"tags":["Users","users"],"summary":"Get Business Info","description":"Get business information for invoicing.","operationId":"get_business_info_api_users_business_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessInfoResponse"}}}}}},"put":{"tags":["Users","users"],"summary":"Update Business Info","description":"Update business information.","operationId":"update_business_info_api_users_business_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessInfoUpdate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessInfoResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/users/billing-settings":{"get":{"tags":["Users","users"],"summary":"Get Billing Settings","description":"Get billing preferences.","operationId":"get_billing_settings_api_users_billing_settings_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingSettingsResponse"}}}}}},"put":{"tags":["Users","users"],"summary":"Update Billing Settings","description":"Update billing preferences.","operationId":"update_billing_settings_api_users_billing_settings_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingSettingsUpdate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingSettingsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/users/optimization-preferences":{"get":{"tags":["Users","users"],"summary":"Get Optimization Preferences","description":"Get optimization preferences.","operationId":"get_optimization_preferences_api_users_optimization_preferences_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptimizationPrefsResponse"}}}}}},"put":{"tags":["Users","users"],"summary":"Update Optimization Preferences","description":"Update optimization preferences.","operationId":"update_optimization_preferences_api_users_optimization_preferences_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptimizationPrefsUpdate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptimizationPrefsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/users/sessions":{"get":{"tags":["Users","users"],"summary":"List Sessions","description":"List active sessions for the user.","operationId":"list_sessions_api_users_sessions_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/SessionResponse"},"type":"array","title":"Response List Sessions Api Users Sessions Get"}}}}}}},"/api/users/sessions/revoke-all":{"post":{"tags":["Users","users"],"summary":"Revoke All Sessions","description":"Revoke all sessions except current.","operationId":"revoke_all_sessions_api_users_sessions_revoke_all_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/users/export":{"post":{"tags":["Users","users"],"summary":"Request Data Export","description":"Request a full data export (GDPR compliance).","operationId":"request_data_export_api_users_export_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataExportResponse"}}}}}}},"/api/users/export/{export_id}":{"get":{"tags":["Users","users"],"summary":"Get Export Status","description":"Check status of a data export request.","operationId":"get_export_status_api_users_export__export_id__get","parameters":[{"name":"export_id","in":"path","required":true,"schema":{"type":"integer","title":"Export Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataExportResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/users/export/{export_id}/download":{"get":{"tags":["Users","users"],"summary":"Download Export","description":"Download a ready data export.","operationId":"download_export_api_users_export__export_id__download_get","parameters":[{"name":"export_id","in":"path","required":true,"schema":{"type":"integer","title":"Export Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/users/delete-account":{"post":{"tags":["Users","users"],"summary":"Request Account Deletion","description":"Request account deletion (GDPR Article 17 — Right to Erasure).\n\nSoft-deletes the user record immediately, then schedules background\ncleanup of all associated data within 30 days.","operationId":"request_account_deletion_api_users_delete_account_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/users/consent/withdraw":{"post":{"tags":["Users","users"],"summary":"Withdraw Consent","description":"Withdraw consent for optional data processing (GDPR Article 7(3)).\n\nDisables optional processing: analytics, optimization recommendations,\nmarketing communications. Core service delivery continues under\ncontractual basis (Article 6(1)(b)).","operationId":"withdraw_consent_api_users_consent_withdraw_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/users/processing/restrict":{"post":{"tags":["Users","users"],"summary":"Restrict Processing","description":"Restrict processing of personal data (GDPR Article 18).\n\nPauses all automated optimization and analysis. Data is retained\nbut not actively processed until restriction is lifted.","operationId":"restrict_processing_api_users_processing_restrict_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/users/processing/resume":{"post":{"tags":["Users","users"],"summary":"Resume Processing","description":"Resume processing after a restriction (GDPR Article 18(3)).","operationId":"resume_processing_api_users_processing_resume_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/billing/invoices":{"get":{"tags":["Billing","billing"],"summary":"List Invoices","description":"List invoices for the current user.","operationId":"list_invoices_api_billing_invoices_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","default":20,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/invoices/{invoice_id}":{"get":{"tags":["Billing","billing"],"summary":"Get Invoice","description":"Get invoice details with line items.","operationId":"get_invoice_api_billing_invoices__invoice_id__get","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"integer","title":"Invoice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/invoices/{invoice_id}/pdf":{"get":{"tags":["Billing","billing"],"summary":"Get Invoice Pdf Url","description":"T5-5 (BILLING_RULES.md §5): return the Stripe-hosted PDF for an invoice.\n\nAll invoices are Stripe invoices, so the PDF is always Stripe's hosted\nPDF (invoice_pdf_url / hosted_invoice_url). Redirects to it.","operationId":"get_invoice_pdf_url_api_billing_invoices__invoice_id__pdf_get","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"integer","title":"Invoice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/portal":{"post":{"tags":["Billing","billing"],"summary":"Create Portal Session","description":"Create a Stripe Customer Portal session.\n\nThe portal allows creators to:\n- Update payment methods\n- View billing history\n- Download invoices\n- Manage subscriptions (if any)","operationId":"create_portal_session_api_billing_portal_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerPortalResponse"}}}}}}},"/api/billing/payment-methods":{"get":{"tags":["Billing","billing"],"summary":"List Payment Methods","description":"List all payment methods for the current user.","operationId":"list_payment_methods_api_billing_payment_methods_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/billing/payment-methods/setup-intent":{"post":{"tags":["Billing","billing"],"summary":"Create Setup Intent","description":"Create a SetupIntent for adding a new payment method.\n\nFrontend uses this with Stripe Elements to securely collect card details.","operationId":"create_setup_intent_api_billing_payment_methods_setup_intent_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSetupIntentResponse"}}}}}}},"/api/billing/trial/confirm-card":{"post":{"tags":["Billing","billing"],"summary":"Trial Confirm Card","description":"T2-6 (BILLING_RULES.md §13): finalize card-add for a trial creator.\n\nFrontend calls this after Stripe Elements confirms a SetupIntent. We:\n  1. Verify the user is in trial_card_pending state\n  2. Verify a payment method is actually attached to their Stripe customer\n  3. Set users.card_added_at = NOW(), trial_status = 'active'\n  4. Mark the advisory invoice (if any) as status='waived'\n  5. Return the new state to the caller\n\nReal billing begins on the NEXT 26th-of-M+1 cycle. The past advisory\ncycle is waived (free) per §13 rule \"Card added within 5 days\".\n\nIdempotent: subsequent calls when state is already 'active' are no-ops\nthat return success with already_active=True.","operationId":"trial_confirm_card_api_billing_trial_confirm_card_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/billing/payment-methods/{payment_method_id}/default":{"post":{"tags":["Billing","billing"],"summary":"Set Default Payment Method","description":"Set a payment method as the default for invoices.","operationId":"set_default_payment_method_api_billing_payment_methods__payment_method_id__default_post","parameters":[{"name":"payment_method_id","in":"path","required":true,"schema":{"type":"string","title":"Payment Method Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/payment-methods/{payment_method_id}":{"delete":{"tags":["Billing","billing"],"summary":"Delete Payment Method","description":"Delete a payment method.","operationId":"delete_payment_method_api_billing_payment_methods__payment_method_id__delete","parameters":[{"name":"payment_method_id","in":"path","required":true,"schema":{"type":"string","title":"Payment Method Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/overview":{"get":{"tags":["Billing","billing"],"summary":"Get Billing Overview","description":"Get billing overview for creator dashboard.\n\nReturns:\n- Current balance (pending invoices)\n- Last payment date/amount\n- Payment method summary\n- Next invoice estimate","operationId":"get_billing_overview_api_billing_overview_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/billing/invoices/{invoice_id}/payment-url":{"get":{"tags":["Billing","billing"],"summary":"Get Invoice Payment Url","description":"Get Stripe hosted invoice URL for payment.\nReturns the URL where user can pay and optionally save their card.","operationId":"get_invoice_payment_url_api_billing_invoices__invoice_id__payment_url_get","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"integer","title":"Invoice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/status":{"get":{"tags":["Billing","billing"],"summary":"Get Billing Status","description":"Get billing status including pause info and overdue invoices.\nUsed by dashboard to show suspension banner.","operationId":"get_billing_status_api_billing_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/billing/cancel/preview":{"get":{"tags":["Billing","billing"],"summary":"Cancel Preview","description":"Show the user what their final invoice will be if they cancel now.\n\nC-2 (BILLING_RULES.md Sections 1 + 7): the final invoice is the sum of\nPrimeTime's half of cumulative lift across all unbilled attributions, not\nRPM × incremental_views. Pulled directly from optimization_attribution\nrows that AttributionEngine already wrote.\n\nRead-only. Does not change any state.","operationId":"cancel_preview_api_billing_cancel_preview_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancellationPreview"}}}}}}},"/api/billing/cancel":{"post":{"tags":["Billing","billing"],"summary":"Cancel Subscription","description":"Cancel the user's subscription.\n\nSteps:\n  1. Generate a final Stripe invoice for any unbilled completed optimizations\n  2. Mark users.is_active = FALSE, users.cancelled_at = NOW()\n  3. Mark youtube_channels.is_active = FALSE for the user's channels\n  4. Mark videos.optimization_paused = TRUE for the user's videos\n  5. Mark in-flight (status='measuring') video_optimizations as billable=FALSE\n  6. Send cancellation notification\n\nAlready-enqueued Cloud Tasks are NOT walked or deleted; the gate added\nto optimization_queue.process_single_optimization will no-op them.","operationId":"cancel_subscription_api_billing_cancel_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancellationResult"}}}}}}},"/api/tasks/daily-triage":{"post":{"tags":["Tasks","Tasks"],"summary":"Daily Triage","description":"Read the log, check invariants, self-correct the allow-list, report the rest.\n\nRuns the same logic as scripts/daily_triage.py. Findings are emitted as\nstructured log lines at ERROR/WARNING so the log-based alert policy picks\nthem up and mails the Ops channel — no separate email path, which matters\nbecause notification_service's PAYMENT_FAILED handler is stubbed and\nsend_welcome has never had a caller (NOTIF-1/EMAIL-1/2).\n\nSelf-correction is limited to two idempotent, reversible actions and every\ncorrection is re-verified; anything still failing escalates rather than\nretries.","operationId":"daily_triage_api_tasks_daily_triage_post","parameters":[{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Dry Run"}},{"name":"x-cloudscheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cloudscheduler-Secret"}},{"name":"x-scheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Scheduler-Secret"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tasks/hv-check":{"post":{"tags":["Tasks","Tasks"],"summary":"Hv Creator Check","operationId":"hv_creator_check_api_tasks_hv_check_post","parameters":[{"name":"x-cloudscheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cloudscheduler-Secret"}},{"name":"x-scheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Scheduler-Secret"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tasks/monthly-billing-cycle":{"post":{"tags":["Tasks","Tasks"],"summary":"Monthly Billing Cycle","description":"M-1 + M-4: monthly invoice generation with weekend/holiday adjustment.\n\nBILLING_RULES.md Section 3:\n  - Invoice date: 26th of M+1 calendar-basis\n  - Weekend/holiday adjustment: next business day\n\nThe Cloud Scheduler job runs DAILY (cron under our control). Each run:\n  1. Calls invoice_date_for_billing_cycle(today) to decide whether\n     today is the canonical invoice date (M-4 logic encapsulated there).\n  2. If not the invoice day, no-ops and returns success.\n  3. If it IS the invoice day, calls\n     InvoiceGenerator.generate_monthly_invoices(today).\n\nIdempotent: the generator skips any attribution row already invoiced.\nTwo firings on the same canonical day will not double-charge.","operationId":"monthly_billing_cycle_api_tasks_monthly_billing_cycle_post","parameters":[{"name":"x-cloudscheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cloudscheduler-Secret"}},{"name":"x-scheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Scheduler-Secret"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tasks/billing-true-up":{"post":{"tags":["Tasks","Tasks"],"summary":"Billing True Up","description":"M-2 + M-3: true-up and clawback within the 60-day adjustment window.\n\nBILLING_RULES.md Section 4: each prior period is re-pulled and adjusted\nvia credit/debit line on the next invoice; clawback for invalid traffic\nrefunds 50%. Period is final after 60 days.\n\nThis endpoint is currently a scaffold — it identifies the invoices in\nthe 60-day window and surfaces the count. The actual YouTube re-pull\n+ clawback writer is deferred (see InvoiceGenerator.true_up_and_clawback\ndocstring for the gating reason and follow-up shape).\n\nRecommended cron: weekly. The work is idempotent; firing it daily is\nsafe but wasteful.","operationId":"billing_true_up_api_tasks_billing_true_up_post","parameters":[{"name":"x-cloudscheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cloudscheduler-Secret"}},{"name":"x-scheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Scheduler-Secret"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tasks/trial-window-check":{"post":{"tags":["Tasks","Tasks"],"summary":"Trial Window Check","description":"T2-4 (BILLING_RULES.md §13.1): flip non-responders to trial_lapsed.\n\nRuns daily. For users in trial_card_pending where the invoice was issued\n> 10 days ago (Net 10 due date) and payment_verified is still not true,\ntransitions:\n    trial_card_pending → trial_lapsed\nsets trial_lapsed_at = NOW(). After this transition the decision-layer\nshould_optimize gate (T2-2) blocks new optimizations on those creators\non the next tick. Lapse is payment-based (the creator pays the send_invoice\nto stay), matching the invoice.paid graduation.\n\nIdempotent: the WHERE clause only matches rows still in trial_card_pending.","operationId":"trial_window_check_api_tasks_trial_window_check_post","parameters":[{"name":"x-cloudscheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cloudscheduler-Secret"}},{"name":"x-scheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Scheduler-Secret"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tasks/nightly-processing":{"post":{"tags":["Tasks","Tasks"],"summary":"Nightly Processing","operationId":"nightly_processing_api_tasks_nightly_processing_post","parameters":[{"name":"x-cloudscheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cloudscheduler-Secret"}},{"name":"x-scheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Scheduler-Secret"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tasks/nightly-step":{"post":{"tags":["Tasks","Tasks"],"summary":"Nightly Step","description":"One link of the A2 nightly chain: run a single step under its own\nscheduler_runs row, then enqueue the next step. Always returns 200 —\nthe chain (not Cloud Tasks retries) controls flow: a fatal-step failure\nends the chain; a non-fatal failure logs and continues.","operationId":"nightly_step_api_tasks_nightly_step_post","parameters":[{"name":"x-cloudscheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cloudscheduler-Secret"}},{"name":"x-scheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Scheduler-Secret"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/_NightlyStepBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tasks/synthetic-monitor":{"post":{"tags":["Tasks","Tasks"],"summary":"Synthetic Monitor","description":"Synthetic production monitor — runs read-only assertions against\ncritical endpoints + DB queries. Returns 200 if every check passes,\n500 with details if anything fails. Wired to a Cloud Scheduler job\nat */15 * * * *. Non-200 responses trigger the primetime-synthetic-\nmonitor-failure log-based metric and alert policy.","operationId":"synthetic_monitor_api_tasks_synthetic_monitor_post","parameters":[{"name":"x-cloudscheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cloudscheduler-Secret"}},{"name":"x-scheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Scheduler-Secret"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tasks/check-new-videos":{"post":{"tags":["Tasks","Tasks"],"summary":"Check New Videos Legacy","description":"Deleted 2026-05-18 (audit P2). Use /hv-creator-check instead.\n\nReturns 410 Gone to protect against stale Cloud Scheduler configs that\nmight still point here. Was silently doing the wrong work.","operationId":"check_new_videos_legacy_api_tasks_check_new_videos_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized"},"500":{"description":"Internal Server Error"}}}},"/api/tasks/process-queue":{"post":{"tags":["Tasks","Tasks"],"summary":"Process Queue Legacy","description":"Deleted 2026-05-18 (audit P2). Use the current optimization-queue\nscheduler entry-point instead. Returns 410 Gone.","operationId":"process_queue_legacy_api_tasks_process_queue_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized"},"500":{"description":"Internal Server Error"}}}},"/api/tasks/performance-check":{"post":{"tags":["Tasks","Tasks"],"summary":"Performance Check Legacy","description":"Deleted 2026-05-18 (audit P2). Use /nightly-processing instead.\nReturns 410 Gone.","operationId":"performance_check_legacy_api_tasks_performance_check_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized"},"500":{"description":"Internal Server Error"}}}},"/api/tasks/sync-channel":{"post":{"tags":["Tasks","Tasks"],"summary":"Task Sync Channel","operationId":"task_sync_channel_api_tasks_sync_channel_post","parameters":[{"name":"x-cloudscheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cloudscheduler-Secret"}},{"name":"x-scheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Scheduler-Secret"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SyncChannelRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tasks/onboard-creator":{"post":{"tags":["Tasks","Tasks"],"summary":"Task Onboard Creator","description":"Run the full onboard_creator() pipeline for one user.\n\nTriggered by a Cloud Task created in services.onboarding_dispatcher.enqueue_onboarding(),\nwhich fires from the OAuth callback at routes.dashboard_auth_routes.oauth_callback\nafter the youtube_channels INSERT.\n\nAlways calls mark_onboarding_complete (success=True or False) so the\nsafety-net row in onboarding_queue is cleared and the nightly cron does\nnot re-run this user. If THIS endpoint fails entirely (raises before\nreaching mark_onboarding_complete), nightly-processing will pick up the\nstill-pending row at 01:00 UTC.","operationId":"task_onboard_creator_api_tasks_onboard_creator_post","parameters":[{"name":"x-cloudscheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cloudscheduler-Secret"}},{"name":"x-scheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Scheduler-Secret"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardCreatorRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tasks/optimize-video":{"post":{"tags":["Tasks","Tasks"],"summary":"Task Optimize Video","operationId":"task_optimize_video_api_tasks_optimize_video_post","parameters":[{"name":"x-cloudscheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cloudscheduler-Secret"}},{"name":"x-scheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Scheduler-Secret"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptimizeVideoRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tasks/execute-optimization":{"post":{"tags":["Tasks","Tasks"],"summary":"Execute Scheduled Optimization","operationId":"execute_scheduled_optimization_api_tasks_execute_optimization_post","parameters":[{"name":"x-cloudscheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cloudscheduler-Secret"}},{"name":"x-scheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Scheduler-Secret"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteOptimizationRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tasks/schedule-optimization":{"post":{"tags":["Tasks","Tasks"],"summary":"Schedule Video Optimization","operationId":"schedule_video_optimization_api_tasks_schedule_optimization_post","parameters":[{"name":"x-cloudscheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cloudscheduler-Secret"}},{"name":"x-scheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Scheduler-Secret"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduleOptimizationRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tasks/timing-analytics":{"get":{"tags":["Tasks","Tasks"],"summary":"Get Timing Analytics","operationId":"get_timing_analytics_api_tasks_timing_analytics_get","parameters":[{"name":"segment_key","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Segment Key"}},{"name":"x-cloudscheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cloudscheduler-Secret"}},{"name":"x-scheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Scheduler-Secret"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tasks/timing-heatmap":{"get":{"tags":["Tasks","Tasks"],"summary":"Get Timing Heatmap Data","operationId":"get_timing_heatmap_data_api_tasks_timing_heatmap_get","parameters":[{"name":"segment_key","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Segment Key"}},{"name":"x-cloudscheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cloudscheduler-Secret"}},{"name":"x-scheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Scheduler-Secret"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tasks/queue-stats":{"get":{"tags":["Tasks","Tasks"],"summary":"Get Queue Statistics","operationId":"get_queue_statistics_api_tasks_queue_stats_get","parameters":[{"name":"x-cloudscheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cloudscheduler-Secret"}},{"name":"x-scheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Scheduler-Secret"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tasks/health":{"get":{"tags":["Tasks","Tasks"],"summary":"Task Health","operationId":"task_health_api_tasks_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized"},"500":{"description":"Internal Server Error"}}}},"/api/tasks/reconcile-stripe":{"post":{"tags":["Tasks","Tasks"],"summary":"Reconcile Stripe","description":"Daily reconciliation job. Wired to Cloud Scheduler at 03:00 UTC.\n\nReads the last 24h of paid invoices from BOTH our DB and Stripe, diffs\nthem, and returns a structured report. Clean = 200; any discrepancy\n= 500 with an ERROR log line that the `primetime_stripe_reconciliation_\nfailure` log-based metric picks up and routes to the ops alert policy.\n\nNEVER auto-corrects — see services/reconciliation.py docstring.","operationId":"reconcile_stripe_api_tasks_reconcile_stripe_post","parameters":[{"name":"x-cloudscheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cloudscheduler-Secret"}},{"name":"x-scheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Scheduler-Secret"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/tasks/funnel-health":{"post":{"tags":["Tasks","Tasks"],"summary":"Funnel Health","description":"Stage 3 S3.9 — compares current 30-day conversion for\noauth_clicked -> channel_connected against a baseline stored in\nSecret Manager. Returns 200 when severity is 'ok'/'seeding'/'warning';\n500 when 'critical' (fires alert via primetime_onboarding_funnel_dropoff\nlog-based metric). NEVER auto-corrects — observation only.","operationId":"funnel_health_api_tasks_funnel_health_post","parameters":[{"name":"x-cloudscheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Cloudscheduler-Secret"}},{"name":"x-scheduler-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Scheduler-Secret"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"401":{"description":"Unauthorized"},"500":{"description":"Internal Server Error"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/{channel_id}/analyze":{"post":{"tags":["Creator Analysis"],"summary":"Analyze Channel Catalog","description":"Perform full catalog analysis for a channel.\n\nThis is typically called once during creator onboarding.\n\nSteps:\n1. Fetch all videos for the channel\n2. Extract keyword profile from catalog\n3. Identify competitors\n4. Make SerpAPI batch calls (8 calls)\n5. Cache everything to database\n\nArgs:\n    channel_id: Database ID of the channel\n    \nReturns:\n    Analysis results with keyword counts and metrics","operationId":"analyze_channel_catalog__channel_id__analyze_post","parameters":[{"name":"channel_id","in":"path","required":true,"schema":{"type":"integer","title":"Channel Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalysisResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/{channel_id}/refresh":{"post":{"tags":["Creator Analysis"],"summary":"Refresh Channel Trends","description":"Refresh SerpAPI trends for a channel.\n\nUses existing keyword profile, makes fresh SerpAPI calls (8 calls).\nCalled before re-optimization campaigns or manually.\n\nArgs:\n    channel_id: Database ID of the channel\n    \nReturns:\n    Refresh results with updated metrics","operationId":"refresh_channel_trends__channel_id__refresh_post","parameters":[{"name":"channel_id","in":"path","required":true,"schema":{"type":"integer","title":"Channel Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/{channel_id}/profile":{"get":{"tags":["Creator Analysis"],"summary":"Get Channel Profile","description":"Get the cached creator profile for a channel.\n\nReturns keyword profile, competitors, and metadata.\nDoes NOT make any SerpAPI calls.\n\nArgs:\n    channel_id: Database ID of the channel\n    \nReturns:\n    Cached profile data","operationId":"get_channel_profile__channel_id__profile_get","parameters":[{"name":"channel_id","in":"path","required":true,"schema":{"type":"integer","title":"Channel Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/routes__creator_analysis_routes__ProfileResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Creator Analysis"],"summary":"Delete Channel Profile","description":"Delete the cached profile for a channel.\n\nUsed for cleanup or forcing re-analysis.\n\nArgs:\n    channel_id: Database ID of the channel\n    \nReturns:\n    Deletion result","operationId":"delete_channel_profile__channel_id__profile_delete","parameters":[{"name":"channel_id","in":"path","required":true,"schema":{"type":"integer","title":"Channel Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/{channel_id}/trends":{"get":{"tags":["Creator Analysis"],"summary":"Get Channel Trends","description":"Get cached trend data for a channel.\n\nReturns interest scores, rising queries, and related queries.\nDoes NOT make any SerpAPI calls.\n\nArgs:\n    channel_id: Database ID of the channel\n    \nReturns:\n    Cached trends data","operationId":"get_channel_trends__channel_id__trends_get","parameters":[{"name":"channel_id","in":"path","required":true,"schema":{"type":"integer","title":"Channel Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrendsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/{channel_id}/optimization-trends":{"get":{"tags":["Creator Analysis"],"summary":"Get Trends For Optimization","description":"Get trend data for video optimization.\n\nFor back catalog: Uses cached creator trends (0 SerpAPI calls)\nFor new uploads: Cached + real-time video trends (2 SerpAPI calls)\n\nArgs:\n    channel_id: Database ID of the channel\n    video_keywords: Comma-separated keywords from the video (optional)\n    is_new_upload: Whether this is a new upload (< 48 hours)\n    \nReturns:\n    Combined trend data for optimization","operationId":"get_trends_for_optimization__channel_id__optimization_trends_get","parameters":[{"name":"channel_id","in":"path","required":true,"schema":{"type":"integer","title":"Channel Id"}},{"name":"video_keywords","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Video Keywords"}},{"name":"is_new_upload","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Is New Upload"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/disputes":{"get":{"tags":["Disputes","disputes"],"summary":"List Disputes","description":"List all disputes for the current user.","operationId":"list_disputes_api_disputes_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["Disputes","disputes"],"summary":"Create Dispute","description":"Submit a dispute for an invoice.\n\nCreator can dispute specific line items with reasons and evidence.","operationId":"create_dispute_api_disputes_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDisputeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DisputeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/disputes/{dispute_id}":{"get":{"tags":["Disputes","disputes"],"summary":"Get Dispute","description":"Get dispute details including line items.","operationId":"get_dispute_api_disputes__dispute_id__get","parameters":[{"name":"dispute_id","in":"path","required":true,"schema":{"type":"integer","title":"Dispute Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/disputes/{dispute_id}/add-info":{"post":{"tags":["Disputes","disputes"],"summary":"Add Dispute Info","description":"Add additional information to an existing dispute.","operationId":"add_dispute_info_api_disputes__dispute_id__add_info_post","parameters":[{"name":"dispute_id","in":"path","required":true,"schema":{"type":"integer","title":"Dispute Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDisputeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/disputes/{dispute_id}/withdraw":{"post":{"tags":["Disputes","disputes"],"summary":"Withdraw Dispute","description":"Withdraw a dispute.","operationId":"withdraw_dispute_api_disputes__dispute_id__withdraw_post","parameters":[{"name":"dispute_id","in":"path","required":true,"schema":{"type":"integer","title":"Dispute Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/disputes/dashboard":{"get":{"tags":["Admin Disputes","admin-disputes"],"summary":"Get Dispute Dashboard","description":"Admin dispute dashboard overview.\n\nReturns counts and recent disputes for both creator disputes\nand Stripe chargebacks.","operationId":"get_dispute_dashboard_api_admin_disputes_dashboard_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/disputes/creator":{"get":{"tags":["Admin Disputes","admin-disputes"],"summary":"List Creator Disputes","description":"List creator disputes with optional status filter.","operationId":"list_creator_disputes_api_admin_disputes_creator_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":100,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/disputes/creator/{dispute_id}":{"get":{"tags":["Admin Disputes","admin-disputes"],"summary":"Get Creator Dispute Detail","description":"Get full details of a creator dispute for admin review.","operationId":"get_creator_dispute_detail_api_admin_disputes_creator__dispute_id__get","parameters":[{"name":"dispute_id","in":"path","required":true,"schema":{"type":"integer","title":"Dispute Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/disputes/creator/{dispute_id}/assign":{"post":{"tags":["Admin Disputes","admin-disputes"],"summary":"Assign Dispute","description":"Assign dispute to an admin for review.","operationId":"assign_dispute_api_admin_disputes_creator__dispute_id__assign_post","parameters":[{"name":"dispute_id","in":"path","required":true,"schema":{"type":"integer","title":"Dispute Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssignDisputeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/disputes/creator/{dispute_id}/resolve":{"post":{"tags":["Admin Disputes","admin-disputes"],"summary":"Resolve Creator Dispute","description":"Resolve a creator dispute.\n\nActions based on resolution:\n- full_credit: Void invoice or issue full refund\n- partial_credit: Issue credit note for resolution_amount\n- no_credit: Resume invoice collection","operationId":"resolve_creator_dispute_api_admin_disputes_creator__dispute_id__resolve_post","parameters":[{"name":"dispute_id","in":"path","required":true,"schema":{"type":"integer","title":"Dispute Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResolveDisputeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/disputes/creator/{dispute_id}/note":{"post":{"tags":["Admin Disputes","admin-disputes"],"summary":"Add Admin Note","description":"Add internal admin note to dispute.","operationId":"add_admin_note_api_admin_disputes_creator__dispute_id__note_post","parameters":[{"name":"dispute_id","in":"path","required":true,"schema":{"type":"integer","title":"Dispute Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DisputeNoteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/disputes/creator/{dispute_id}/respond":{"post":{"tags":["Admin Disputes","admin-disputes"],"summary":"Respond To Creator","description":"Send visible response to creator.","operationId":"respond_to_creator_api_admin_disputes_creator__dispute_id__respond_post","parameters":[{"name":"dispute_id","in":"path","required":true,"schema":{"type":"integer","title":"Dispute Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DisputeNoteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/disputes/stripe":{"get":{"tags":["Admin Disputes","admin-disputes"],"summary":"List Stripe Disputes","description":"List Stripe chargebacks.","operationId":"list_stripe_disputes_api_admin_disputes_stripe_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/disputes/stripe/{dispute_id}/submit-evidence":{"post":{"tags":["Admin Disputes","admin-disputes"],"summary":"Submit Stripe Evidence","description":"Submit evidence to Stripe for a chargeback dispute.\n\nGathers service documentation and submits to Stripe API.","operationId":"submit_stripe_evidence_api_admin_disputes_stripe__dispute_id__submit_evidence_post","parameters":[{"name":"dispute_id","in":"path","required":true,"schema":{"type":"integer","title":"Dispute Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StripeEvidenceRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/disputes/summary":{"get":{"tags":["Admin Disputes","admin-disputes"],"summary":"Get Disputes Summary","description":"Flat disputes summary for the admin dashboard tiles.\nCombines creator disputes and Stripe chargebacks into the shape\nthe dashboard expects: pending, resolved, escalated, avg_resolution_time.","operationId":"get_disputes_summary_api_admin_disputes_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/dashboard/creator":{"get":{"tags":["Creator Dashboard","dashboard"],"summary":"Get Creator Dashboard","description":"Get complete creator dashboard data.\n\nReturns all data needed to render the creator dashboard in a single call,\noptimized for performance with aggregated queries.","operationId":"get_creator_dashboard_api_dashboard_creator_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatorDashboardResponse"}}}}}}},"/api/dashboard/creator/videos/{video_id}/graph":{"get":{"tags":["Creator Dashboard","dashboard"],"summary":"Get Video Graph","description":"T5-4 (BILLING_RULES.md §5): per-video baseline-vs-actual graph payload.\n\nReturns the data the frontend needs to render the per-video click-through\nview: baseline-vs-actual daily revenue series with optimization-event\nmarkers. Authorization: video must belong to a channel owned by user_id.\n\nShape:\n  {\n    \"video_id\": int,\n    \"youtube_video_id\": str,\n    \"title\": str,\n    \"baseline_period_start\": date,\n    \"baseline_period_end\": date,\n    \"baseline_avg_daily_revenue\": float,\n    \"daily_dates\": [date, ...],          # one entry per day post-baseline\n    \"actual_daily_revenue\": [float, ...],\n    \"projected_daily_revenue\": [float, ...],  # slope-line projection from baseline\n    \"opt_event_markers\": [{\"applied_at\": iso, \"optimization_id\": int}, ...],\n    \"incremental_total\": float,\n  }\n\nSources:\n  - baseline: video_baselines (one row per video; T3-1)\n  - actual: revenue_snapshots (one row per video per day)\n  - projected: linear extrapolation from baseline.slope/intercept across\n    the actual-data date range\n  - markers: video_optimizations.applied_at where status='applied'","operationId":"get_video_graph_api_dashboard_creator_videos__video_id__graph_get","parameters":[{"name":"video_id","in":"path","required":true,"schema":{"type":"integer","title":"Video Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/dashboard/creator/videos":{"get":{"tags":["Creator Dashboard","dashboard"],"summary":"Get Dashboard Videos","description":"Get paginated list of videos for dashboard.","operationId":"get_dashboard_videos_api_dashboard_creator_videos_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Limit"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"sort_by","in":"query","required":false,"schema":{"type":"string","default":"incremental_views","title":"Sort By"}},{"name":"sort_order","in":"query","required":false,"schema":{"type":"string","default":"desc","title":"Sort Order"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/dashboard/creator/activity":{"get":{"tags":["Creator Dashboard","dashboard"],"summary":"Get Dashboard Activity","description":"Get recent activity feed for dashboard.","operationId":"get_dashboard_activity_api_dashboard_creator_activity_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/integrations/stripe/balance":{"get":{"tags":["Integrations","integrations"],"summary":"Get Stripe Balance","description":"Get real Stripe balance","operationId":"get_stripe_balance_api_admin_integrations_stripe_balance_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/integrations/stripe/fees":{"get":{"tags":["Integrations","integrations"],"summary":"Get Stripe Fees","description":"Get real Stripe fee data from balance transactions","operationId":"get_stripe_fees_api_admin_integrations_stripe_fees_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/integrations/stripe/payouts":{"get":{"tags":["Integrations","integrations"],"summary":"Get Stripe Payouts","description":"Get real Stripe payout history","operationId":"get_stripe_payouts_api_admin_integrations_stripe_payouts_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/integrations/brex/balance":{"get":{"tags":["Integrations","integrations"],"summary":"Get Brex Balance","description":"Get real Brex account balance","operationId":"get_brex_balance_api_admin_integrations_brex_balance_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/integrations/brex/transactions":{"get":{"tags":["Integrations","integrations"],"summary":"Get Brex Transactions","description":"Get real Brex transactions","operationId":"get_brex_transactions_api_admin_integrations_brex_transactions_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/integrations/brex/sync":{"post":{"tags":["Integrations","integrations"],"summary":"Sync Brex Data","description":"Force sync Brex data","operationId":"sync_brex_data_api_admin_integrations_brex_sync_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/integrations/openai/usage":{"get":{"tags":["Integrations","integrations"],"summary":"Get Openai Usage","description":"Get real OpenAI API usage from their API","operationId":"get_openai_usage_api_admin_integrations_openai_usage_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/integrations/gcp/billing/summary":{"get":{"tags":["Integrations","integrations"],"summary":"Get Gcp Billing Summary","description":"Get GCP billing summary - requires BigQuery export setup","operationId":"get_gcp_billing_summary_api_admin_integrations_gcp_billing_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/integrations/gcp/billing/by-service":{"get":{"tags":["Integrations","integrations"],"summary":"Get Gcp Billing By Service","description":"Get GCP costs broken down by service","operationId":"get_gcp_billing_by_service_api_admin_integrations_gcp_billing_by_service_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/integrations/gcp/billing/forecast":{"get":{"tags":["Integrations","integrations"],"summary":"Get Gcp Forecast","description":"Get GCP cost forecast","operationId":"get_gcp_forecast_api_admin_integrations_gcp_billing_forecast_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/integrations/gcp/billing/trend":{"get":{"tags":["Integrations","integrations"],"summary":"Get Gcp Trend","description":"Get GCP cost trend over past months","operationId":"get_gcp_trend_api_admin_integrations_gcp_billing_trend_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/integrations/gcp/billing/sync":{"post":{"tags":["Integrations","integrations"],"summary":"Sync Gcp Billing","description":"Force sync GCP billing data","operationId":"sync_gcp_billing_api_admin_integrations_gcp_billing_sync_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/integrations/financial/summary":{"get":{"tags":["Integrations","integrations"],"summary":"Get Financial Summary","description":"Get comprehensive financial summary from real data sources","operationId":"get_financial_summary_api_admin_integrations_financial_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/integrations/financial/pnl":{"get":{"tags":["Integrations","integrations"],"summary":"Get Pnl Statement","description":"Get P&L statement from real data","operationId":"get_pnl_statement_api_admin_integrations_financial_pnl_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/integrations/alerts":{"get":{"tags":["Integrations","integrations"],"summary":"Get Integration Alerts","description":"Get active alerts from all integrations","operationId":"get_integration_alerts_api_admin_integrations_alerts_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/integrations/thresholds":{"get":{"tags":["Integrations","integrations"],"summary":"Get Thresholds","description":"Get current alert thresholds","operationId":"get_thresholds_api_admin_integrations_thresholds_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["Integrations","integrations"],"summary":"Update Thresholds","description":"Update alert thresholds","operationId":"update_thresholds_api_admin_integrations_thresholds_post","requestBody":{"content":{"application/json":{"schema":{"type":"object","title":"Thresholds"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/notifications":{"get":{"tags":["Notifications","notifications"],"summary":"List Notifications","operationId":"list_notifications_api_notifications_get","parameters":[{"name":"unread_only","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Unread Only"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/notifications/unread-count":{"get":{"tags":["Notifications","notifications"],"summary":"Get Unread Count","operationId":"get_unread_count_api_notifications_unread_count_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/notifications/mark-read":{"post":{"tags":["Notifications","notifications"],"summary":"Mark Notifications Read","operationId":"mark_notifications_read_api_notifications_mark_read_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarkReadRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/notifications/mark-all-read":{"post":{"tags":["Notifications","notifications"],"summary":"Mark All Notifications Read","operationId":"mark_all_notifications_read_api_notifications_mark_all_read_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/notifications/preferences":{"get":{"tags":["Notifications","notifications"],"summary":"Get Notification Preferences","operationId":"get_notification_preferences_api_notifications_preferences_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"put":{"tags":["Notifications","notifications"],"summary":"Update Notification Preferences","operationId":"update_notification_preferences_api_notifications_preferences_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationPreferences"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/webhooks/stripe":{"post":{"tags":["Stripe Webhooks","stripe-webhooks"],"summary":"Stripe Webhook","description":"Main Stripe webhook endpoint.\nVerifies signature and routes events to handlers.","operationId":"stripe_webhook_webhooks_stripe_post","parameters":[{"name":"Stripe-Signature","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe-Signature"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/webhooks/stripe/health":{"get":{"tags":["Stripe Webhooks","stripe-webhooks"],"summary":"Webhook Health","description":"Check webhook endpoint health.","operationId":"webhook_health_webhooks_stripe_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/youtube-analytics/test-access":{"get":{"tags":["YouTube Analytics","youtube-analytics"],"summary":"Test Youtube Access","description":"Test YouTube API access availability","operationId":"test_youtube_access_api_youtube_analytics_test_access_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/youtube-analytics/authorize":{"get":{"tags":["YouTube Analytics","youtube-analytics"],"summary":"Get Auth Url","description":"Get YouTube OAuth authorization URL","operationId":"get_auth_url_api_youtube_analytics_authorize_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/youtube-analytics/performance/summary":{"get":{"tags":["YouTube Analytics","youtube-analytics"],"summary":"Get Performance Summary","description":"Get YouTube performance summary from our database\nFIXED: Uses correct column names from videos table","operationId":"get_performance_summary_api_youtube_analytics_performance_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/youtube-analytics/video/{video_id}":{"get":{"tags":["YouTube Analytics","youtube-analytics"],"summary":"Get Video Analytics","description":"Get analytics for a specific video","operationId":"get_video_analytics_api_youtube_analytics_video__video_id__get","parameters":[{"name":"video_id","in":"path","required":true,"schema":{"type":"integer","title":"Video Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/youtube-analytics/revenue/{channel_id}":{"get":{"tags":["YouTube Analytics","youtube-analytics"],"summary":"Get Channel Revenue","description":"Get revenue analytics for a channel","operationId":"get_channel_revenue_api_youtube_analytics_revenue__channel_id__get","parameters":[{"name":"channel_id","in":"path","required":true,"schema":{"type":"integer","title":"Channel Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/youtube-analytics/top-performing":{"get":{"tags":["YouTube Analytics","youtube-analytics"],"summary":"Get Top Performing Videos","description":"Get top performing videos by views","operationId":"get_top_performing_videos_api_youtube_analytics_top_performing_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"default":30,"title":"Days"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":10,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/youtube-analytics/optimization-impact":{"get":{"tags":["YouTube Analytics","youtube-analytics"],"summary":"Get Optimization Impact","description":"Get overall optimization impact metrics","operationId":"get_optimization_impact_api_youtube_analytics_optimization_impact_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/messages":{"get":{"tags":["Messaging","messaging"],"summary":"Get Creator Threads","operationId":"get_creator_threads_api_messages_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["Messaging","messaging"],"summary":"Create Thread","operationId":"create_thread_api_messages_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateThreadRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/messages/{thread_id}":{"get":{"tags":["Messaging","messaging"],"summary":"Get Thread Detail","operationId":"get_thread_detail_api_messages__thread_id__get","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"integer","title":"Thread Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/messages/{thread_id}/reply":{"post":{"tags":["Messaging","messaging"],"summary":"Reply To Thread","operationId":"reply_to_thread_api_messages__thread_id__reply_post","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"integer","title":"Thread Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReplyRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/messages/unread/count":{"get":{"tags":["Referrals"],"summary":"Get Unread Count","description":"Get unread message count for current user","operationId":"get_unread_count_api_messages_unread_count_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/referral/current-offer":{"get":{"tags":["Referrals"],"summary":"Get Current Public Offer","description":"Get the current active public referral offer.\nReturns the highest priority code with available slots.\n\nUsed by public landing page to display:\n- Current referral code\n- Slots remaining\n- Reward amounts\n\nResponse:\n- available: false = no offer, hide referral UI\n- available: true = show offer with code and slots info\n- slots_remaining: null means unlimited","operationId":"get_current_public_offer_api_referral_current_offer_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/referrals/my-code":{"get":{"tags":["Referrals"],"summary":"Get My Referral Code","description":"Get or generate creator's personal referral code","operationId":"get_my_referral_code_api_referrals_my_code_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/referrals/my-referrals":{"get":{"tags":["Referrals"],"summary":"Get My Referrals","description":"Get all referrals made by current user","operationId":"get_my_referrals_api_referrals_my_referrals_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/referrals/credits":{"get":{"tags":["Referrals"],"summary":"Get My Credits","description":"Get credit balance and transaction history","operationId":"get_my_credits_api_referrals_credits_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/referrals/transfer":{"post":{"tags":["Referrals"],"summary":"Transfer Credits","description":"Transfer credits to another creator","operationId":"transfer_credits_api_referrals_transfer_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransferRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/referrals/active-programs":{"get":{"tags":["Referrals"],"summary":"Get Active Programs","description":"Get active referral programs with banners","operationId":"get_active_programs_api_referrals_active_programs_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/referrals/validate-code":{"post":{"tags":["Referrals"],"summary":"Validate Referral Code","description":"Validate a referral code (for signup flow)","operationId":"validate_referral_code_api_referrals_validate_code_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidateCodeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/referrals/apply-code":{"post":{"tags":["Referrals"],"summary":"Apply Referral Code","description":"Apply referral code to new user (called during signup)","operationId":"apply_referral_code_api_referrals_apply_code_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyCodeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/referrals/programs":{"get":{"tags":["Referrals"],"summary":"Admin List Programs","description":"List all referral programs","operationId":"admin_list_programs_api_admin_referrals_programs_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["Referrals"],"summary":"Admin Create Program","description":"Create new referral program","operationId":"admin_create_program_api_admin_referrals_programs_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProgramRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/referrals/codes":{"get":{"tags":["Referrals"],"summary":"Admin List Codes","description":"List all referral codes with filters","operationId":"admin_list_codes_api_admin_referrals_codes_get","parameters":[{"name":"program_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Program Id"}},{"name":"creator_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Creator Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["Referrals"],"summary":"Admin Create Code","description":"Create new referral code","operationId":"admin_create_code_api_admin_referrals_codes_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCodeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/referrals/all":{"get":{"tags":["Referrals"],"summary":"Admin List All Referrals","description":"List all referrals with filters","operationId":"admin_list_all_referrals_api_admin_referrals_all_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"days","in":"query","required":false,"schema":{"type":"integer","default":90,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/referrals/pending-refunds":{"get":{"tags":["Referrals"],"summary":"Admin Pending Refunds","description":"Get referrals pending refund approval","operationId":"admin_pending_refunds_api_admin_referrals_pending_refunds_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/referrals/{referral_id}/approve-refund":{"post":{"tags":["Referrals"],"summary":"Admin Approve Refund","description":"Approve refund for qualified referral","operationId":"admin_approve_refund_api_admin_referrals__referral_id__approve_refund_post","parameters":[{"name":"referral_id","in":"path","required":true,"schema":{"type":"integer","title":"Referral Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/referrals/{referral_id}/pay-credit":{"post":{"tags":["Referrals"],"summary":"Admin Pay Credit","description":"Pay qualified referral as credit","operationId":"admin_pay_credit_api_admin_referrals__referral_id__pay_credit_post","parameters":[{"name":"referral_id","in":"path","required":true,"schema":{"type":"integer","title":"Referral Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/referrals/check-qualifications":{"post":{"tags":["Referrals"],"summary":"Admin Check All Qualifications","description":"Check qualifications for all pending referrals","operationId":"admin_check_all_qualifications_api_admin_referrals_check_qualifications_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/admin/referrals/analytics":{"get":{"tags":["Referrals"],"summary":"Admin Referral Analytics","description":"Get referral analytics","operationId":"admin_referral_analytics_api_admin_referrals_analytics_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/referrals/settings":{"get":{"tags":["Referrals"],"summary":"Admin Get Settings","description":"Get referral system settings","operationId":"admin_get_settings_api_admin_referrals_settings_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"put":{"tags":["Referrals"],"summary":"Admin Update Settings","description":"Update referral system settings","operationId":"admin_update_settings_api_admin_referrals_settings_put","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/onboarding/status":{"get":{"tags":["Onboarding","Onboarding"],"summary":"Get Onboarding Status","operationId":"get_onboarding_status_api_onboarding_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingStatusResponse"}}}}}}},"/api/onboarding/checkout":{"post":{"tags":["Onboarding","Onboarding"],"summary":"Create Checkout Session","operationId":"create_checkout_session_api_onboarding_checkout_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/onboarding/success":{"get":{"tags":["Onboarding","Onboarding"],"summary":"Checkout Success","operationId":"checkout_success_api_onboarding_success_get","parameters":[{"name":"session_id","in":"query","required":true,"schema":{"type":"string","title":"Session Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/onboarding/complete":{"post":{"tags":["Onboarding","Onboarding"],"summary":"Complete Onboarding","operationId":"complete_onboarding_api_onboarding_complete_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/analytics/dashboard":{"get":{"tags":["Analytics","analytics"],"summary":"Get Dashboard Analytics","description":"Get dashboard analytics summary.","operationId":"get_dashboard_analytics_api_analytics_dashboard_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/analytics/creator/{creator_id}":{"get":{"tags":["Analytics","analytics"],"summary":"Get Creator Analytics","description":"Get analytics for a specific creator.","operationId":"get_creator_analytics_api_analytics_creator__creator_id__get","parameters":[{"name":"creator_id","in":"path","required":true,"schema":{"type":"integer","title":"Creator Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/analytics/optimization/performance":{"get":{"tags":["Analytics","analytics"],"summary":"Get Optimization Performance","description":"Get optimization performance metrics.","operationId":"get_optimization_performance_api_analytics_optimization_performance_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/analytics/trends":{"get":{"tags":["Analytics","analytics"],"summary":"Get Trends","description":"Get trend data for specified metric.","operationId":"get_trends_api_analytics_trends_get","parameters":[{"name":"metric","in":"query","required":false,"schema":{"type":"string","pattern":"^(optimizations|views|confidence)$","default":"optimizations","title":"Metric"}},{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/analytics/recent-activity":{"get":{"tags":["Analytics","analytics"],"summary":"Get Recent Activity Endpoint","description":"Get recent optimization activity.","operationId":"get_recent_activity_endpoint_api_analytics_recent_activity_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/analytics/debug/tables":{"get":{"tags":["Analytics","analytics"],"summary":"List Tables","description":"Debug: List all database tables.","operationId":"list_tables_api_analytics_debug_tables_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/analytics/debug/columns/{table_name}":{"get":{"tags":["Analytics","analytics"],"summary":"List Columns","description":"Debug: List columns for a table.","operationId":"list_columns_api_analytics_debug_columns__table_name__get","parameters":[{"name":"table_name","in":"path","required":true,"schema":{"type":"string","title":"Table Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/analytics/debug/seed-status":{"get":{"tags":["Analytics","analytics"],"summary":"Check Seed Status","description":"Check if seed data exists.","operationId":"check_seed_status_api_analytics_debug_seed_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/channel/{channel_id}/optimize":{"post":{"tags":["Channel Ops","Channel Optimization"],"summary":"Optimize Channel","description":"Start an optimization job for a YouTube channel\n\nArgs:\n    channel_id: The database ID of the channel\n\nReturns:\n    dict: Contains job ID and initial status","operationId":"optimize_channel_channel__channel_id__optimize_post","parameters":[{"name":"channel_id","in":"path","required":true,"schema":{"type":"integer","title":"Channel Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/channel/optimization/{optimization_id}/status":{"get":{"tags":["Channel Ops","Channel Optimization"],"summary":"Get Optimization Status Endpoint","description":"Get the current status of a channel optimization job\n\nArgs:\n    optimization_id: The ID of the optimization job\n\nReturns:\n    ChannelOptimizationStatusResponse: Contains status and progress information","operationId":"get_optimization_status_endpoint_channel_optimization__optimization_id__status_get","parameters":[{"name":"optimization_id","in":"path","required":true,"schema":{"type":"integer","title":"Optimization Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelOptimizationStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/channel/{channel_id}/optimizations":{"get":{"tags":["Channel Ops","Channel Optimization"],"summary":"Get Channel Optimizations Endpoint","description":"Get recent optimization results for a channel\n\nArgs:\n    channel_id: The database ID of the channel\n    limit: Maximum number of results to return (default: 5)\n\nReturns:\n    list: Recent optimization records","operationId":"get_channel_optimizations_endpoint_channel__channel_id__optimizations_get","parameters":[{"name":"channel_id","in":"path","required":true,"schema":{"type":"integer","title":"Channel Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":5,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/channel/optimization/{optimization_id}/apply":{"post":{"tags":["Channel Ops","Channel Optimization"],"summary":"Apply Optimization To Channel","description":"Apply an optimization directly to YouTube channel metadata\n\nArgs:\n    optimization_id: The ID of the optimization to apply\n    only_description: If true, only update the description (query parameter)\n    only_keywords: If true, only update the keywords (query parameter)\n\nReturns:\n    dict: Results of the update operation","operationId":"apply_optimization_to_channel_channel_optimization__optimization_id__apply_post","parameters":[{"name":"optimization_id","in":"path","required":true,"schema":{"type":"integer","title":"Optimization Id"}},{"name":"only_description","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Only Description"}},{"name":"only_keywords","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Only Keywords"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/signup/start":{"get":{"tags":["Signup Flow","signup"],"summary":"Signup Start","description":"Sign-up entry point.\n\nTwo response modes, picked by query string:\n\n1. NO ?confirmed (or ?confirmed != \"1\") -> return _signup_explainer_page,\n   a self-contained HTML page that previews Google's account chooser +\n   consent screen and lets the user click \"Sign in with Google\" to start\n   the actual OAuth dance. The CTA on that page links to this same\n   endpoint with ?confirmed=1.\n\n2. ?confirmed=1 -> the original behavior: build the Google OAuth URL,\n   set the state cookie, log signup_started/oauth_clicked funnel events,\n   and 307 redirect to accounts.google.com.\n\nThe ?missing param is only honored on the explainer-page branch and is\na comma-separated list of scope URLs the user failed to grant on a\nprevious attempt; the page renders a warning banner with their plain-\nEnglish labels.","operationId":"signup_start_api_signup_start_get","parameters":[{"name":"ref","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ref"}},{"name":"confirmed","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Confirmed"}},{"name":"missing","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Missing"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/signup/callback":{"get":{"tags":["Signup Flow","signup"],"summary":"Signup Callback","operationId":"signup_callback_api_signup_callback_get","parameters":[{"name":"code","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"}},{"name":"state","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"State"}},{"name":"error","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},{"name":"scope","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scope"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/signup/complete":{"get":{"tags":["Signup Flow","signup"],"summary":"Signup Complete","operationId":"signup_complete_api_signup_complete_get","parameters":[{"name":"uid","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Uid"}},{"name":"session_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/signup/stripe-success":{"get":{"tags":["Signup Flow","signup"],"summary":"Stripe Success","operationId":"stripe_success_api_signup_stripe_success_get","parameters":[{"name":"session_id","in":"query","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"uid","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Uid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/demo/stream":{"get":{"tags":["Demo","Demo"],"summary":"Stream Demo Preview","description":"Stream demo preview generation via SSE.","operationId":"stream_demo_preview_api_demo_stream_get","parameters":[{"name":"channel","in":"query","required":false,"schema":{"type":"string","description":"YouTube channel handle","title":"Channel"},"description":"YouTube channel handle"},{"name":"video_id","in":"query","required":false,"schema":{"type":"string","description":"YouTube video ID","title":"Video Id"},"description":"YouTube video ID"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/demo/health":{"get":{"tags":["Demo","Demo"],"summary":"Demo Health","description":"Check demo generator health.","operationId":"demo_health_api_demo_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/gdpr/erase-request":{"post":{"tags":["GDPR","GDPR"],"summary":"Erase Request","description":"Issue a 15-min HMAC-signed erasure token to the authenticated\nuser. The token commits the caller to erasing THIS user_id —\nit cannot be replayed against a different account.\n\nWhen GDPR_ERASURE_ENABLED is FALSE (production default), returns\n503 with reason=pending_legal_review.","operationId":"erase_request_api_gdpr_erase_request_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/gdpr/erase-confirm":{"post":{"tags":["GDPR","GDPR"],"summary":"Erase Confirm","description":"Consume an erasure token issued by /erase-request and execute\nthe erasure. Rejects expired, mismatched, or malformed tokens\nwith 400.\n\nWhen GDPR_ERASURE_ENABLED is FALSE (production default), returns\n503 even before token validation — prevents an oracle leak\nabout token internals.","operationId":"erase_confirm_api_gdpr_erase_confirm_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EraseConfirmBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/gdpr/erase-status":{"get":{"tags":["GDPR","GDPR"],"summary":"Erase Status","description":"Public status endpoint — reports whether erasure is currently\nenabled in this environment and lists the action matrix for\ninspection. Unauthenticated on purpose: no PII.","operationId":"erase_status_api_gdpr_erase_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/users/me/manual-mode":{"get":{"tags":["Manual Mode","manual-mode"],"summary":"Get User Manual Mode","operationId":"get_user_manual_mode_api_users_me_manual_mode_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManualModeResponse"}}}}}},"post":{"tags":["Manual Mode","manual-mode"],"summary":"Set User Manual Mode","operationId":"set_user_manual_mode_api_users_me_manual_mode_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManualModeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManualModeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/videos/{video_id}/manual-mode":{"get":{"tags":["Manual Mode","manual-mode"],"summary":"Get Video Manual Mode","operationId":"get_video_manual_mode_api_videos__video_id__manual_mode_get","parameters":[{"name":"video_id","in":"path","required":true,"schema":{"type":"integer","title":"Video Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VideoManualModeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["Manual Mode","manual-mode"],"summary":"Set Video Manual Mode","operationId":"set_video_manual_mode_api_videos__video_id__manual_mode_post","parameters":[{"name":"video_id","in":"path","required":true,"schema":{"type":"integer","title":"Video Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManualModeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VideoManualModeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/videos/":{"get":{"tags":["Videos","videos"],"summary":"List Videos","description":"List videos with pagination - FIXED: uses youtube_video_id","operationId":"list_videos_api_videos__get","parameters":[{"name":"channel_id","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Channel Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/videos/{video_id}":{"get":{"tags":["Videos","videos"],"summary":"Get Video","description":"Get video details by ID","operationId":"get_video_api_videos__video_id__get","parameters":[{"name":"video_id","in":"path","required":true,"schema":{"type":"integer","title":"Video Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/videos/{video_id}/optimize":{"post":{"tags":["Videos","videos"],"summary":"Optimize Video","description":"Queue video for optimization","operationId":"optimize_video_api_videos__video_id__optimize_post","parameters":[{"name":"video_id","in":"path","required":true,"schema":{"type":"integer","title":"Video Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptimizeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/videos/{video_id}/optimization-status":{"get":{"tags":["Videos","videos"],"summary":"Get Optimization Status","description":"Get current optimization status for a video","operationId":"get_optimization_status_api_videos__video_id__optimization_status_get","parameters":[{"name":"video_id","in":"path","required":true,"schema":{"type":"integer","title":"Video Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/videos/{video_id}/optimization-history":{"get":{"tags":["Videos","videos"],"summary":"Get Optimization History","description":"Get all optimization history for a video","operationId":"get_optimization_history_api_videos__video_id__optimization_history_get","parameters":[{"name":"video_id","in":"path","required":true,"schema":{"type":"integer","title":"Video Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/videos/{video_id}/revert-to/{optimization_id}":{"post":{"tags":["Videos","videos"],"summary":"Revert To Specific Round","description":"Revert to a SPECIFIC historical optimization bundle (Wave A.6).\n\nLooks up video_optimizations[optimization_id], confirms it belongs to\nthe user, pushes its OPTIMIZED title/description/tags/thumbnail back to\nYouTube, and inserts a new video_optimizations row recording the revert.\n\nUse POST /{video_id}/revert (no ID) to undo the latest optimization to\nthe round-1 original.","operationId":"revert_to_specific_round_api_videos__video_id__revert_to__optimization_id__post","parameters":[{"name":"video_id","in":"path","required":true,"schema":{"type":"integer","title":"Video Id"}},{"name":"optimization_id","in":"path","required":true,"schema":{"type":"integer","title":"Optimization Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/videos/{video_id}/revert":{"post":{"tags":["Videos","videos"],"summary":"Revert Optimization","description":"Revert the most recent optimization to original content.\n\nRestores original title/description/tags/thumbnail via YouTube API,\nmarks the optimization as 'reverted', and makes it non-billable.","operationId":"revert_optimization_api_videos__video_id__revert_post","parameters":[{"name":"video_id","in":"path","required":true,"schema":{"type":"integer","title":"Video Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/videos/{video_id}/exclude":{"post":{"tags":["Videos","videos"],"summary":"Exclude Video","description":"Mark video as not eligible for optimization","operationId":"exclude_video_api_videos__video_id__exclude_post","parameters":[{"name":"video_id","in":"path","required":true,"schema":{"type":"integer","title":"Video Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/videos/{video_id}/include":{"post":{"tags":["Videos","videos"],"summary":"Include Video","description":"Mark video as eligible for optimization","operationId":"include_video_api_videos__video_id__include_post","parameters":[{"name":"video_id","in":"path","required":true,"schema":{"type":"integer","title":"Video Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/videos/{video_id}/sync":{"post":{"tags":["Videos","videos"],"summary":"Sync Video","description":"Sync video data from YouTube via user_credentials OAuth tokens.","operationId":"sync_video_api_videos__video_id__sync_post","parameters":[{"name":"video_id","in":"path","required":true,"schema":{"type":"integer","title":"Video Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/videos/{video_id}/thumbnails":{"get":{"tags":["Videos","videos"],"summary":"Get Video Thumbnails","description":"Get thumbnail options for a video","operationId":"get_video_thumbnails_api_videos__video_id__thumbnails_get","parameters":[{"name":"video_id","in":"path","required":true,"schema":{"type":"integer","title":"Video Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/videos/{video_id}/titles":{"get":{"tags":["Videos","videos"],"summary":"Get Video Titles","description":"Get title history and suggestions for a video","operationId":"get_video_titles_api_videos__video_id__titles_get","parameters":[{"name":"video_id","in":"path","required":true,"schema":{"type":"integer","title":"Video Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/videos/batch-optimize":{"post":{"tags":["Videos","videos"],"summary":"Batch Optimize","description":"Queue multiple videos for optimization. Filters out videos not owned by the caller.","operationId":"batch_optimize_api_videos_batch_optimize_post","parameters":[{"name":"optimization_type","in":"query","required":false,"schema":{"type":"string","default":"full","title":"Optimization Type"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"array","items":{"type":"integer"},"title":"Video Ids"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/videos/bulk-exclude":{"post":{"tags":["Videos","videos"],"summary":"Bulk Exclude","description":"Exclude multiple videos from optimization. Only affects videos owned by the caller.","operationId":"bulk_exclude_api_videos_bulk_exclude_post","requestBody":{"content":{"application/json":{"schema":{"items":{"type":"integer"},"type":"array","title":"Video Ids"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/videos/bulk-include":{"post":{"tags":["Videos","videos"],"summary":"Bulk Include","description":"Re-include multiple videos in optimization (un-pause).\n\nMirror of /bulk-exclude. If `video_ids` is None or empty, every currently-\npaused video owned by the user is re-included. Body shape mirrors\nbulk-exclude exactly: a bare JSON array, e.g. POST [10430, 10431].\nSending nothing (or empty array) targets every paused video this user\nowns.\n\nUsed by the creator dashboard's master \"Optimize all videos\" toggle.","operationId":"bulk_include_api_videos_bulk_include_post","requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"items":{"type":"integer"},"type":"array"},{"type":"null"}],"title":"Video Ids"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/debug/routes":{"get":{"summary":"Debug Routes","operationId":"debug_routes_debug_routes_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"AnalysisResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"channel_id":{"type":"integer","title":"Channel Id"},"videos_analyzed":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Videos Analyzed"},"primary_keywords":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Primary Keywords"},"interest_scores_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Interest Scores Count"},"rising_queries_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rising Queries Count"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["success","channel_id"],"title":"AnalysisResponse"},"ApplyCodeRequest":{"properties":{"code":{"type":"string","title":"Code"},"user_id":{"type":"integer","title":"User Id"}},"type":"object","required":["code","user_id"],"title":"ApplyCodeRequest"},"AssignDisputeRequest":{"properties":{"admin_id":{"type":"integer","title":"Admin Id"}},"type":"object","required":["admin_id"],"title":"AssignDisputeRequest"},"AuthStatusResponse":{"properties":{"is_authenticated":{"type":"boolean","title":"Is Authenticated"},"user":{"anyOf":[{"$ref":"#/components/schemas/UserResponse"},{"type":"null"}]}},"type":"object","required":["is_authenticated","user"],"title":"AuthStatusResponse"},"BaselineResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"captured":{"type":"integer","title":"Captured"},"moved_to_optimize":{"type":"integer","title":"Moved To Optimize"},"errors":{"type":"integer","title":"Errors"},"duration_ms":{"type":"number","title":"Duration Ms"}},"type":"object","required":["success","captured","moved_to_optimize","errors","duration_ms"],"title":"BaselineResponse","description":"Response from baseline capture endpoint."},"BillingSettingsResponse":{"properties":{"billing_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Billing Email"},"invoice_notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Notes"},"autopay_enabled":{"type":"boolean","title":"Autopay Enabled","default":true},"payment_reminders":{"type":"boolean","title":"Payment Reminders","default":true}},"type":"object","required":["billing_email","invoice_notes"],"title":"BillingSettingsResponse"},"BillingSettingsUpdate":{"properties":{"billing_email":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}],"title":"Billing Email"},"invoice_notes":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Invoice Notes"},"autopay_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Autopay Enabled"},"payment_reminders":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Payment Reminders"}},"type":"object","required":["billing_email","autopay_enabled","payment_reminders"],"title":"BillingSettingsUpdate"},"BillingSummary":{"properties":{"total_paid_all_time":{"type":"string","title":"Total Paid All Time"},"pending_invoices_count":{"type":"integer","title":"Pending Invoices Count"},"pending_invoices_amount":{"type":"string","title":"Pending Invoices Amount"},"estimated_next_invoice":{"type":"string","title":"Estimated Next Invoice"},"last_payment_amount":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Payment Amount"},"last_payment_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Payment Date"},"payment_method":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Payment Method"}},"type":"object","required":["total_paid_all_time","pending_invoices_count","pending_invoices_amount","estimated_next_invoice","last_payment_amount","last_payment_date","payment_method"],"title":"BillingSummary"},"BusinessInfoResponse":{"properties":{"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name"},"business_type":{"type":"string","title":"Business Type","default":"individual"},"tax_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax Id"},"address_line1":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address Line1"},"address_city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address City"},"address_state":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address State"},"address_zip":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address Zip"},"address_country":{"type":"string","title":"Address Country","default":"US"}},"type":"object","required":["business_name","tax_id","address_line1","address_city","address_state","address_zip"],"title":"BusinessInfoResponse"},"BusinessInfoUpdate":{"properties":{"business_name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Business Name"},"business_type":{"anyOf":[{"type":"string","pattern":"^(individual|llc|corporation|partnership)$"},{"type":"null"}],"title":"Business Type"},"tax_id":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Tax Id"},"address_line1":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Address Line1"},"address_city":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Address City"},"address_state":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Address State"},"address_zip":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Address Zip"},"address_country":{"anyOf":[{"type":"string","maxLength":2},{"type":"null"}],"title":"Address Country"}},"type":"object","title":"BusinessInfoUpdate"},"CancellationPreview":{"properties":{"unbilled_amount":{"type":"number","title":"Unbilled Amount"},"optimization_count":{"type":"integer","title":"Optimization Count"},"breakdown":{"items":{},"type":"array","title":"Breakdown"}},"type":"object","required":["unbilled_amount","optimization_count","breakdown"],"title":"CancellationPreview"},"CancellationResult":{"properties":{"cancelled":{"type":"boolean","title":"Cancelled"},"cancelled_at":{"type":"string","title":"Cancelled At"},"final_invoice_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Final Invoice Id"},"final_invoice_amount":{"type":"number","title":"Final Invoice Amount","default":0.0},"hosted_invoice_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hosted Invoice Url"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"}},"type":"object","required":["cancelled","cancelled_at"],"title":"CancellationResult"},"ChannelOptimizationStatusResponse":{"properties":{"id":{"type":"integer","title":"Id"},"channel_id":{"type":"integer","title":"Channel Id"},"status":{"type":"string","title":"Status"},"progress":{"type":"integer","title":"Progress"},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At"},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated At"},"original_description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Original Description"},"optimized_description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Optimized Description"},"original_keywords":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Original Keywords"},"optimized_keywords":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Optimized Keywords"},"optimization_notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Optimization Notes"},"is_applied":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Applied"},"applied_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Applied At"}},"type":"object","required":["id","channel_id","status","progress"],"title":"ChannelOptimizationStatusResponse"},"ChannelSummary":{"properties":{"id":{"type":"integer","title":"Id"},"channel_id":{"type":"string","title":"Channel Id"},"channel_name":{"type":"string","title":"Channel Name"},"thumbnail_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thumbnail Url"},"subscriber_count":{"type":"integer","title":"Subscriber Count"},"tier":{"type":"string","title":"Tier"},"category":{"type":"string","title":"Category"},"youtube_analytics_connected":{"type":"boolean","title":"Youtube Analytics Connected"},"videos_count":{"type":"integer","title":"Videos Count"},"optimized_count":{"type":"integer","title":"Optimized Count"},"active_optimizations":{"type":"integer","title":"Active Optimizations"}},"type":"object","required":["id","channel_id","channel_name","thumbnail_url","subscriber_count","tier","category","youtube_analytics_connected","videos_count","optimized_count","active_optimizations"],"title":"ChannelSummary"},"CreateCodeRequest":{"properties":{"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"program_id":{"type":"integer","title":"Program Id"},"creator_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Creator Id"},"code_type":{"type":"string","title":"Code Type","default":"individual"},"usage_limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Usage Limit"},"start_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Start Date"},"end_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"End Date"},"special_reward_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Special Reward Type"},"special_reward_value":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Special Reward Value"},"is_public":{"type":"boolean","title":"Is Public","default":false},"priority":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Priority"}},"type":"object","required":["program_id"],"title":"CreateCodeRequest"},"CreateDisputeRequest":{"properties":{"invoice_id":{"type":"integer","title":"Invoice Id"},"line_items":{"items":{"$ref":"#/components/schemas/DisputeLineItem"},"type":"array","minItems":1,"title":"Line Items"},"supporting_evidence_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Supporting Evidence Url"}},"type":"object","required":["invoice_id","line_items"],"title":"CreateDisputeRequest"},"CreateProgramRequest":{"properties":{"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"reward_type":{"type":"string","title":"Reward Type","default":"credit"},"reward_percentage":{"type":"number","title":"Reward Percentage","default":10.0},"min_spend_threshold":{"type":"number","title":"Min Spend Threshold","default":100.0},"min_optimizations_threshold":{"type":"integer","title":"Min Optimizations Threshold","default":5},"min_active_days":{"type":"integer","title":"Min Active Days","default":30},"min_channel_subscribers":{"type":"integer","title":"Min Channel Subscribers","default":0},"require_no_chargebacks":{"type":"boolean","title":"Require No Chargebacks","default":true},"is_active":{"type":"boolean","title":"Is Active","default":true},"banner_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Banner Text"},"banner_enabled":{"type":"boolean","title":"Banner Enabled","default":false}},"type":"object","required":["name"],"title":"CreateProgramRequest"},"CreateSetupIntentResponse":{"properties":{"client_secret":{"type":"string","title":"Client Secret"},"setup_intent_id":{"type":"string","title":"Setup Intent Id"}},"type":"object","required":["client_secret","setup_intent_id"],"title":"CreateSetupIntentResponse"},"CreateThreadRequest":{"properties":{"subject":{"type":"string","title":"Subject"},"body":{"type":"string","title":"Body"},"category":{"type":"string","title":"Category","default":"other"},"priority":{"type":"string","title":"Priority","default":"normal"}},"type":"object","required":["subject","body"],"title":"CreateThreadRequest"},"CreatorDashboardResponse":{"properties":{"channel":{"$ref":"#/components/schemas/ChannelSummary"},"trial":{"$ref":"#/components/schemas/TrialStatus"},"billing":{"$ref":"#/components/schemas/BillingSummary"},"forecast":{"$ref":"#/components/schemas/RevenueForecast"},"rpm_history":{"items":{"$ref":"#/components/schemas/RPMHistoryPoint"},"type":"array","title":"Rpm History"},"top_videos":{"items":{"$ref":"#/components/schemas/VideoSummary"},"type":"array","title":"Top Videos"},"total_videos":{"type":"integer","title":"Total Videos"},"total_incremental_views":{"type":"integer","title":"Total Incremental Views"},"total_revenue_generated":{"type":"string","title":"Total Revenue Generated"},"success_rate":{"type":"number","title":"Success Rate"},"pending_disputes":{"type":"integer","title":"Pending Disputes"},"unread_notifications":{"type":"integer","title":"Unread Notifications"}},"type":"object","required":["channel","trial","billing","forecast","rpm_history","top_videos","total_videos","total_incremental_views","total_revenue_generated","success_rate","pending_disputes","unread_notifications"],"title":"CreatorDashboardResponse","description":"Complete dashboard data in single response."},"CreatorListEntry":{"properties":{"user_id":{"type":"integer","title":"User Id"},"email":{"type":"string","title":"Email"},"handle":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Handle"},"channel_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel Name"},"subscriber_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Subscriber Count"},"video_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Video Count"},"is_active":{"type":"boolean","title":"Is Active"}},"type":"object","required":["user_id","email","is_active"],"title":"CreatorListEntry"},"CreatorListResponse":{"properties":{"creators":{"items":{"$ref":"#/components/schemas/CreatorListEntry"},"type":"array","title":"Creators"},"page":{"type":"integer","title":"Page"},"per_page":{"type":"integer","title":"Per Page"},"total":{"type":"integer","title":"Total"},"total_pages":{"type":"integer","title":"Total Pages"}},"type":"object","required":["creators","page","per_page","total","total_pages"],"title":"CreatorListResponse"},"CustomerPortalResponse":{"properties":{"url":{"type":"string","title":"Url"}},"type":"object","required":["url"],"title":"CustomerPortalResponse"},"DataExportResponse":{"properties":{"export_id":{"type":"integer","title":"Export Id"},"status":{"type":"string","title":"Status"},"requested_at":{"type":"string","format":"date-time","title":"Requested At"},"ready_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ready At"},"download_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Download Url"},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"}},"type":"object","required":["export_id","status","requested_at","ready_at","download_url","expires_at"],"title":"DataExportResponse"},"DisputeLineItem":{"properties":{"line_item_id":{"type":"integer","title":"Line Item Id"},"reason":{"$ref":"#/components/schemas/DisputeReason"},"claimed_value":{"anyOf":[{"type":"number"},{"type":"string"},{"type":"null"}],"title":"Claimed Value"},"explanation":{"type":"string","maxLength":1000,"title":"Explanation"}},"type":"object","required":["line_item_id","reason","explanation"],"title":"DisputeLineItem"},"DisputeNoteRequest":{"properties":{"note":{"type":"string","maxLength":2000,"title":"Note"},"internal_only":{"type":"boolean","title":"Internal Only","default":true}},"type":"object","required":["note"],"title":"DisputeNoteRequest"},"DisputeReason":{"type":"string","enum":["incorrect_views","incorrect_rpm","optimization_not_applied","video_deleted","channel_demonetized","measurement_period_wrong","duplicate_charge","other"],"title":"DisputeReason"},"DisputeResponse":{"properties":{"dispute_id":{"type":"integer","title":"Dispute Id"},"status":{"type":"string","title":"Status"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"message":{"type":"string","title":"Message"}},"type":"object","required":["dispute_id","status","created_at","message"],"title":"DisputeResponse"},"EraseConfirmBody":{"properties":{"token":{"type":"string","maxLength":512,"minLength":10,"title":"Token"}},"type":"object","required":["token"],"title":"EraseConfirmBody"},"ExecuteOptimizationRequest":{"properties":{"video_id":{"type":"integer","title":"Video Id"},"channel_id":{"type":"integer","title":"Channel Id"},"segment_key":{"type":"string","title":"Segment Key"},"content_type":{"type":"string","title":"Content Type"},"priority":{"type":"integer","title":"Priority","default":5},"optimization_round":{"type":"integer","title":"Optimization Round","default":1},"scheduled_dow":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Scheduled Dow"},"scheduled_hour":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Scheduled Hour"},"timing_method":{"type":"string","title":"Timing Method","default":"default"},"timing_confidence":{"type":"number","title":"Timing Confidence","default":0.0},"was_optimal_timing":{"type":"boolean","title":"Was Optimal Timing","default":false}},"type":"object","required":["video_id","channel_id","segment_key","content_type"],"title":"ExecuteOptimizationRequest"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HealthResponse":{"properties":{"status":{"type":"string","title":"Status"},"initialized":{"type":"boolean","title":"Initialized"},"queue_sizes":{"additionalProperties":{"type":"integer"},"type":"object","title":"Queue Sizes"},"rate_limits":{"additionalProperties":{"type":"integer"},"type":"object","title":"Rate Limits"},"bayesian_stats":{"type":"object","title":"Bayesian Stats"}},"type":"object","required":["status","initialized","queue_sizes","rate_limits","bayesian_stats"],"title":"HealthResponse","description":"Response from health check endpoint."},"ImpersonateActiveSession":{"properties":{"audit_id":{"type":"integer","title":"Audit Id"},"target_user_id":{"type":"integer","title":"Target User Id"},"target_email":{"type":"string","title":"Target Email"},"started_at":{"type":"string","format":"date-time","title":"Started At"},"refresh_count":{"type":"integer","title":"Refresh Count"},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"}},"type":"object","required":["audit_id","target_user_id","target_email","started_at","refresh_count"],"title":"ImpersonateActiveSession"},"ImpersonateRefreshResponse":{"properties":{"token":{"type":"string","title":"Token"},"expires_at":{"type":"string","format":"date-time","title":"Expires At"},"refresh_count":{"type":"integer","title":"Refresh Count"}},"type":"object","required":["token","expires_at","refresh_count"],"title":"ImpersonateRefreshResponse"},"ImpersonateStartResponse":{"properties":{"token":{"type":"string","title":"Token"},"expires_at":{"type":"string","format":"date-time","title":"Expires At"},"target_user_id":{"type":"integer","title":"Target User Id"},"target_email":{"type":"string","title":"Target Email"},"target_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target Name"}},"type":"object","required":["token","expires_at","target_user_id","target_email"],"title":"ImpersonateStartResponse"},"ManualModeRequest":{"properties":{"paused":{"type":"boolean","title":"Paused"},"reason":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Reason","description":"Optional creator-supplied reason. Stored for audit only."}},"type":"object","required":["paused"],"title":"ManualModeRequest"},"ManualModeResponse":{"properties":{"paused":{"type":"boolean","title":"Paused"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["paused","updated_at"],"title":"ManualModeResponse"},"MarkReadRequest":{"properties":{"notification_ids":{"items":{"type":"integer"},"type":"array","title":"Notification Ids"}},"type":"object","required":["notification_ids"],"title":"MarkReadRequest"},"MeasureResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"measured":{"type":"integer","title":"Measured"},"successes":{"type":"integer","title":"Successes"},"failures":{"type":"integer","title":"Failures"},"duration_ms":{"type":"number","title":"Duration Ms"},"results":{"items":{"type":"object"},"type":"array","title":"Results","default":[]}},"type":"object","required":["success","measured","successes","failures","duration_ms"],"title":"MeasureResponse","description":"Response from measurement endpoint."},"MessageReply":{"properties":{"body":{"type":"string","title":"Body"}},"type":"object","required":["body"],"title":"MessageReply"},"NotificationPreferences":{"properties":{"email_enabled":{"type":"boolean","title":"Email Enabled","default":true},"push_enabled":{"type":"boolean","title":"Push Enabled","default":true},"optimization_alerts":{"type":"boolean","title":"Optimization Alerts","default":true},"revenue_updates":{"type":"boolean","title":"Revenue Updates","default":true},"weekly_digest":{"type":"boolean","title":"Weekly Digest","default":true}},"type":"object","title":"NotificationPreferences"},"OnboardCreatorRequest":{"properties":{"user_id":{"type":"integer","title":"User Id"},"access_token":{"type":"string","title":"Access Token"},"refresh_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Refresh Token"}},"type":"object","required":["user_id","access_token"],"title":"OnboardCreatorRequest","description":"Body for /api/tasks/onboard-creator. Sent by services.onboarding_dispatcher\nwhen a Cloud Task fires after OAuth signup. Tokens are passed live so the\nhandler doesn't need to hit user_credentials again (which would race the\nOAuth callback's commit)."},"OnboardingStatusResponse":{"properties":{"onboarding_completed":{"type":"boolean","title":"Onboarding Completed"},"payment_verified":{"type":"boolean","title":"Payment Verified"},"has_payment_method":{"type":"boolean","title":"Has Payment Method"},"referral_code_applied":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Referral Code Applied"},"credit_balance":{"type":"number","title":"Credit Balance","default":0.0}},"type":"object","required":["onboarding_completed","payment_verified","has_payment_method"],"title":"OnboardingStatusResponse"},"OptimizationPrefsResponse":{"properties":{"auto_optimize":{"type":"boolean","title":"Auto Optimize","default":true},"exclude_shorts":{"type":"boolean","title":"Exclude Shorts","default":true},"min_daily_views":{"type":"integer","title":"Min Daily Views","default":500},"optimize_titles":{"type":"boolean","title":"Optimize Titles","default":true},"optimize_thumbnails":{"type":"boolean","title":"Optimize Thumbnails","default":true},"max_concurrent_optimizations":{"type":"integer","title":"Max Concurrent Optimizations","default":5}},"type":"object","title":"OptimizationPrefsResponse"},"OptimizationPrefsUpdate":{"properties":{"auto_optimize":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Auto Optimize"},"exclude_shorts":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Exclude Shorts"},"min_daily_views":{"anyOf":[{"type":"integer","maximum":100000.0,"minimum":0.0},{"type":"null"}],"title":"Min Daily Views"},"optimize_titles":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Optimize Titles"},"optimize_thumbnails":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Optimize Thumbnails"},"max_concurrent_optimizations":{"anyOf":[{"type":"integer","maximum":20.0,"minimum":1.0},{"type":"null"}],"title":"Max Concurrent Optimizations"}},"type":"object","required":["auto_optimize","exclude_shorts","optimize_titles","optimize_thumbnails"],"title":"OptimizationPrefsUpdate"},"OptimizeRequest":{"properties":{"optimization_type":{"type":"string","title":"Optimization Type","default":"full"},"priority":{"type":"integer","title":"Priority","default":5}},"type":"object","title":"OptimizeRequest"},"OptimizeVideoRequest":{"properties":{"video_id":{"type":"integer","title":"Video Id"},"youtube_video_id":{"type":"string","title":"Youtube Video Id"},"channel_id":{"type":"integer","title":"Channel Id"},"priority":{"type":"integer","title":"Priority","default":2}},"type":"object","required":["video_id","youtube_video_id","channel_id"],"title":"OptimizeVideoRequest"},"ProfileUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Name"},"timezone":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Timezone"},"language":{"anyOf":[{"type":"string","maxLength":10},{"type":"null"}],"title":"Language"}},"type":"object","title":"ProfileUpdate"},"RPMHistoryPoint":{"properties":{"date":{"type":"string","format":"date","title":"Date"},"rpm":{"type":"string","title":"Rpm"}},"type":"object","required":["date","rpm"],"title":"RPMHistoryPoint"},"RefreshResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"channel_id":{"type":"integer","title":"Channel Id"},"interest_scores_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Interest Scores Count"},"rising_queries_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rising Queries Count"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["success","channel_id"],"title":"RefreshResponse"},"ReplyRequest":{"properties":{"body":{"type":"string","title":"Body"}},"type":"object","required":["body"],"title":"ReplyRequest"},"Resolution":{"type":"string","enum":["full_credit","partial_credit","no_credit"],"title":"Resolution"},"ResolveDisputeRequest":{"properties":{"resolution":{"$ref":"#/components/schemas/Resolution"},"resolution_amount":{"anyOf":[{"type":"number"},{"type":"string"},{"type":"null"}],"title":"Resolution Amount"},"resolution_notes":{"type":"string","maxLength":2000,"title":"Resolution Notes"},"line_item_responses":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Line Item Responses"}},"type":"object","required":["resolution","resolution_notes"],"title":"ResolveDisputeRequest"},"RevenueForecast":{"properties":{"next_30_days":{"type":"string","title":"Next 30 Days"},"next_60_days":{"type":"string","title":"Next 60 Days"},"next_90_days":{"type":"string","title":"Next 90 Days"}},"type":"object","required":["next_30_days","next_60_days","next_90_days"],"title":"RevenueForecast"},"ScheduleOptimizationRequest":{"properties":{"video_id":{"type":"integer","title":"Video Id"},"channel_id":{"type":"integer","title":"Channel Id"},"segment_key":{"type":"string","title":"Segment Key"},"content_type":{"type":"string","title":"Content Type"},"priority":{"type":"integer","title":"Priority","default":5},"optimization_round":{"type":"integer","title":"Optimization Round","default":1}},"type":"object","required":["video_id","channel_id","segment_key","content_type"],"title":"ScheduleOptimizationRequest"},"SessionResponse":{"properties":{"id":{"type":"string","title":"Id"},"device":{"type":"string","title":"Device"},"location":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location"},"ip_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ip Address"},"last_active":{"type":"string","format":"date-time","title":"Last Active"},"is_current":{"type":"boolean","title":"Is Current","default":false}},"type":"object","required":["id","device","location","ip_address","last_active"],"title":"SessionResponse"},"StatusUpdate":{"properties":{"status":{"type":"string","title":"Status"}},"type":"object","required":["status"],"title":"StatusUpdate"},"StripeEvidenceRequest":{"properties":{"dispute_id":{"type":"integer","title":"Dispute Id"},"product_description":{"type":"string","title":"Product Description","default":"YouTube video optimization services"},"customer_communication":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Communication"},"additional_evidence":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Additional Evidence"}},"type":"object","required":["dispute_id"],"title":"StripeEvidenceRequest"},"SyncChannelRequest":{"properties":{"channel_id":{"type":"integer","title":"Channel Id"}},"type":"object","required":["channel_id"],"title":"SyncChannelRequest"},"TickResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"processed":{"type":"integer","title":"Processed"},"optimized":{"type":"integer","title":"Optimized"},"skipped":{"type":"integer","title":"Skipped"},"errors":{"type":"integer","title":"Errors"},"duration_ms":{"type":"number","title":"Duration Ms"},"decisions":{"items":{"type":"object"},"type":"array","title":"Decisions","default":[]},"skip_reasons":{"additionalProperties":{"type":"integer"},"type":"object","title":"Skip Reasons","default":{}}},"type":"object","required":["success","processed","optimized","skipped","errors","duration_ms"],"title":"TickResponse","description":"Response from scheduler tick endpoint."},"TransferRequest":{"properties":{"to_email":{"type":"string","title":"To Email"},"amount":{"type":"number","title":"Amount"}},"type":"object","required":["to_email","amount"],"title":"TransferRequest"},"TrendsResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"channel_id":{"type":"integer","title":"Channel Id"},"interest_scores":{"anyOf":[{"additionalProperties":{"type":"number"},"type":"object"},{"type":"null"}],"title":"Interest Scores"},"rising_queries":{"anyOf":[{"items":{"type":"object"},"type":"array"},{"type":"null"}],"title":"Rising Queries"},"related_queries":{"anyOf":[{"items":{"type":"object"},"type":"array"},{"type":"null"}],"title":"Related Queries"},"fetched_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fetched At"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["success","channel_id"],"title":"TrendsResponse"},"TrialStatus":{"properties":{"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"trial_started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Trial Started At"},"advisory_invoice_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Advisory Invoice Id"},"advisory_invoice_issued_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Advisory Invoice Issued At"},"card_added_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Card Added At"},"trial_lapsed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Trial Lapsed At"},"days_remaining":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Days Remaining"},"terminal_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Terminal At"},"billing_paused":{"type":"boolean","title":"Billing Paused","default":false}},"type":"object","title":"TrialStatus","description":"T5-1 (BILLING_RULES.md §13): trial-state info for the dashboard.\n\n`status` is one of:\n    - None / 'active' (legacy non-trial OR completed-trial creator)\n    - 'trial_awaiting_invoice' (signed up, no advisory yet)\n    - 'trial_card_pending' (advisory issued, 5-day window open)\n    - 'trial_lapsed' (card not added in time; new opts blocked)\n`days_remaining` is positive when in trial_card_pending and counts down\nfrom 5; null otherwise.\n`terminal_at` is set when smart-retry exhausted (T4-7)."},"UpdateDisputeRequest":{"properties":{"additional_info":{"type":"string","maxLength":2000,"title":"Additional Info"},"evidence_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Evidence Url"}},"type":"object","required":["additional_info"],"title":"UpdateDisputeRequest"},"UserResponse":{"properties":{"id":{"type":"integer","title":"Id"},"email":{"type":"string","title":"Email"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"is_authenticated":{"type":"boolean","title":"Is Authenticated","default":true},"has_channel":{"type":"boolean","title":"Has Channel","default":false},"channel_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Channel Id"},"channel_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel Name"},"channel_thumbnail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel Thumbnail"},"is_admin":{"type":"boolean","title":"Is Admin","default":false},"billing_paused":{"type":"boolean","title":"Billing Paused","default":false},"billing_pause_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Billing Pause Reason"}},"type":"object","required":["id","email","name"],"title":"UserResponse"},"UserSearchHit":{"properties":{"user_id":{"type":"integer","title":"User Id"},"email":{"type":"string","title":"Email"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"full_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Full Name"},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name"},"channel_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel Name"},"is_active":{"type":"boolean","title":"Is Active"},"is_admin":{"type":"boolean","title":"Is Admin"},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At"},"similarity":{"type":"number","title":"Similarity"}},"type":"object","required":["user_id","email","is_active","is_admin","similarity"],"title":"UserSearchHit"},"ValidateCodeRequest":{"properties":{"code":{"type":"string","title":"Code"}},"type":"object","required":["code"],"title":"ValidateCodeRequest"},"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"},"VideoManualModeResponse":{"properties":{"video_id":{"type":"integer","title":"Video Id"},"user_paused":{"type":"boolean","title":"User Paused"},"video_paused":{"type":"boolean","title":"Video Paused"},"effective_paused":{"type":"boolean","title":"Effective Paused"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["video_id","user_paused","video_paused","effective_paused","updated_at"],"title":"VideoManualModeResponse"},"VideoSummary":{"properties":{"id":{"type":"integer","title":"Id"},"youtube_video_id":{"type":"string","title":"Youtube Video Id"},"title":{"type":"string","title":"Title"},"thumbnail_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thumbnail Url"},"published_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Published At"},"current_views":{"type":"integer","title":"Current Views"},"baseline_views":{"type":"integer","title":"Baseline Views"},"incremental_views":{"type":"integer","title":"Incremental Views"},"state":{"type":"string","title":"State"},"optimization_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Optimization Status"},"last_optimized_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Optimized At"},"excluded":{"type":"boolean","title":"Excluded","default":false},"confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Confidence"},"queue":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Queue"},"applied_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Applied At"},"original_title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Original Title"},"optimized_title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Optimized Title"},"original_description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Original Description"},"optimized_description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Optimized Description"},"original_tags":{"anyOf":[{},{"type":"null"}],"title":"Original Tags"},"optimized_tags":{"anyOf":[{},{"type":"null"}],"title":"Optimized Tags"},"original_thumbnail_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Original Thumbnail Url"},"optimized_thumbnail_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Optimized Thumbnail Url"},"reverted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Reverted At"},"optimization_cycles":{"items":{"type":"object"},"type":"array","title":"Optimization Cycles","default":[]}},"type":"object","required":["id","youtube_video_id","title","thumbnail_url","published_at","current_views","baseline_views","incremental_views","state","optimization_status","last_optimized_at"],"title":"VideoSummary"},"_NightlyStepBody":{"properties":{"step":{"type":"integer","minimum":0.0,"title":"Step"}},"type":"object","required":["step"],"title":"_NightlyStepBody","description":"Body for /api/tasks/nightly-step. Sent by _enqueue_nightly_step."},"routes__creator_analysis_routes__ProfileResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"channel_id":{"type":"integer","title":"Channel Id"},"has_profile":{"type":"boolean","title":"Has Profile"},"keyword_profile":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Keyword Profile"},"competitors":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Competitors"},"videos_analyzed":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Videos Analyzed"},"catalog_analyzed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Catalog Analyzed At"},"trends_refreshed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Trends Refreshed At"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["success","channel_id","has_profile"],"title":"ProfileResponse"},"routes__user_routes__ProfileResponse":{"properties":{"id":{"type":"integer","title":"Id"},"email":{"type":"string","title":"Email"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"timezone":{"type":"string","title":"Timezone","default":"America/Los_Angeles"},"language":{"type":"string","title":"Language","default":"en"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"youtube_connected":{"type":"boolean","title":"Youtube Connected","default":false},"youtube_analytics_connected":{"type":"boolean","title":"Youtube Analytics Connected","default":false},"stripe_connected":{"type":"boolean","title":"Stripe Connected","default":false},"channel_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Channel Id"},"channel_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel Name"},"channel_thumbnail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel Thumbnail"},"subscriber_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Subscriber Count"},"tier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tier"},"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"},"rpm":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rpm"},"rpm_last_updated":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Rpm Last Updated"}},"type":"object","required":["id","email","name","created_at","channel_id","channel_name","channel_thumbnail","subscriber_count","tier","category","rpm","rpm_last_updated"],"title":"ProfileResponse"}}}}