{"openapi":"3.1.0","info":{"title":"sn33api","version":"0.1.0"},"paths":{"/metrics":{"get":{"summary":"Metrics","operationId":"metrics_metrics_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/health":{"get":{"summary":"Health","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/conversation/reserve":{"post":{"tags":["conversations"],"summary":"Reserve Conversation","description":"Reserved a task bundle for a conversation.\nAttempts to serve from the pre-queued tasks first, falling back to on-demand generation.","operationId":"reserve_conversation_api_v1_conversation_reserve_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"task_override","in":"query","required":false,"schema":{"type":"string","title":"Task Override"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskBundle"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["conversations"],"summary":"Reserve Conversation","description":"Reserved a task bundle for a conversation.\nAttempts to serve from the pre-queued tasks first, falling back to on-demand generation.","operationId":"reserve_conversation_api_v1_conversation_reserve_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"task_override","in":"query","required":false,"schema":{"type":"string","title":"Task Override"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskBundle"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/conversation/record/{c_guid}":{"put":{"tags":["conversations"],"summary":"Record Cgp Result","description":"Record CGP results for a conversation.\n\nMaps the input data to the cgp_results table and stores it along with the data payload.\nIf the bundle originated from the user_request queue (task_bundle_records.job_id is set),\nalso mirrors the tags into sn33_paid_api.job_results for the external paid-API service.","operationId":"record_cgp_result_api_v1_conversation_record__c_guid__put","parameters":[{"name":"c_guid","in":"path","required":true,"schema":{"type":"string","title":"C Guid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CGPResultCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CGPResultRead"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/analytics/task-records":{"get":{"tags":["analytics"],"summary":"Get Task Record Analytics","description":"Returns aggregated analytics for task bundle records over the specified time window.","operationId":"get_task_record_analytics_api_v1_analytics_task_records_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"hours","in":"query","required":false,"schema":{"type":"integer","maximum":720,"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/v1/admin/task/weights":{"get":{"tags":["admin-task"],"summary":"Read Weights","description":"Fetch current task type weights from the database.","operationId":"read_weights_api_v1_admin_task_weights_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/TaskTypeWeight"},"type":"array","title":"Response Read Weights Api V1 Admin Task Weights Get"}}}}},"security":[{"HTTPBearer":[]}]},"put":{"tags":["admin-task"],"summary":"Update Weights","description":"Update task type weights; returns updated list.","operationId":"update_weights_api_v1_admin_task_weights_put","requestBody":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/TaskTypeWeight"},"type":"array","title":"Weights"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/TaskTypeWeight"},"type":"array","title":"Response Update Weights Api V1 Admin Task Weights Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/task/wallets":{"get":{"tags":["admin-task"],"summary":"List Wallets","description":"List paid-API source wallets (never returns private keys).","operationId":"list_wallets_api_v1_admin_task_wallets_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/WalletOut"},"type":"array","title":"Response List Wallets Api V1 Admin Task Wallets Get"}}}}},"security":[{"HTTPBearer":[]}]},"post":{"tags":["admin-task"],"summary":"Create Wallet","description":"Add a source wallet: validates the key, derives the address, stores it encrypted.","operationId":"create_wallet_api_v1_admin_task_wallets_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WalletCreate"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WalletOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/task/wallets/{wallet_id}":{"put":{"tags":["admin-task"],"summary":"Update Wallet","description":"Update a wallet's name, daily spend amount, and/or enabled flag.","operationId":"update_wallet_api_v1_admin_task_wallets__wallet_id__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"wallet_id","in":"path","required":true,"schema":{"type":"integer","title":"Wallet Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WalletUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WalletOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["admin-task"],"summary":"Delete Wallet","description":"Delete a wallet and (via cascade) its spend-batch rows.","operationId":"delete_wallet_api_v1_admin_task_wallets__wallet_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"wallet_id","in":"path","required":true,"schema":{"type":"integer","title":"Wallet Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/priorityqueue/request":{"get":{"tags":["priority-queue"],"summary":"List Requested Domains","description":"List all requested domains ordered by request count (most requested first).\n\nAdmin-only endpoint for reviewing pending domain requests.","operationId":"list_requested_domains_api_v1_priorityqueue_request_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestedDomainListResponse"}}}}},"security":[{"HTTPBearer":[]}]},"put":{"tags":["priority-queue"],"summary":"Request Domain","description":"Record a user request for a domain to be processed.\n\nUpserts the domain in the requested_domains table, incrementing the request\ncount on repeat submissions. No authentication required — intended for public use.\nAn admin can later approve the domain via PUT /reserve.","operationId":"request_domain_api_v1_priorityqueue_request_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestDomainRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestDomainResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/priorityqueue/reserve":{"put":{"tags":["priority-queue"],"summary":"Reserve Priority Queue","description":"Reserve a domain for priority processing in the CC task queue.\n\nFetches all pages for the given domain from Common Crawl and pushes the\nresulting task bundles to the priority queue, which is served ahead of the\nnormal weighted-random queue. Also marks the domain as reserved in the\nrequested_domains table if it was previously requested.","operationId":"reserve_priority_queue_api_v1_priorityqueue_reserve_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriorityQueueReserveRequest"}}},"required":true},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}}},"components":{"schemas":{"CGPResultCreate":{"properties":{"mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mode"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"},"embeddings_model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Embeddings Model"},"marker_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Marker Id"},"llm_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Llm Type"},"scoring_version":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Scoring Version"},"cgp_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cgp Version"},"netuid":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Netuid"},"hotkey":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hotkey"},"neuron_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Neuron Type"},"task_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Task Id"},"batch_number":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Batch Number"},"data":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Data"}},"type":"object","title":"CGPResultCreate"},"CGPResultRead":{"properties":{"id":{"type":"integer","title":"Id"},"status":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Status"},"batch_num":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Batch Num"},"c_guid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"C Guid"},"convo_window_index":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Convo Window Index"},"source_type":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Source Type"},"mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mode"},"hotkey":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hotkey"},"coldkey":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Coldkey"},"uid":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Uid"},"llm_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Llm Type"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"},"tags":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Tags"},"marker_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Marker Id"},"json":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Json"},"cgp_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cgp Version"},"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"},"updated_by":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Updated By"},"created_by":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Created By"}},"type":"object","required":["id","status","batch_num","c_guid","convo_window_index","source_type","mode","hotkey","coldkey","uid","llm_type","model","tags","marker_id","json","cgp_version","created_at","updated_at","updated_by","created_by"],"title":"CGPResultRead"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"PriorityQueueReserveRequest":{"properties":{"task_type":{"type":"string","enum":["conversation","survey","ner","cc"],"title":"Task Type"},"scope":{"type":"string","title":"Scope","default":"mainnet"},"payload":{"additionalProperties":true,"type":"object","title":"Payload"}},"type":"object","required":["task_type"],"title":"PriorityQueueReserveRequest"},"PromptChainStep":{"properties":{"step":{"type":"integer","title":"Step"},"id":{"type":"string","title":"Id"},"crc":{"type":"integer","title":"Crc"},"title":{"type":"string","title":"Title"},"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"type":{"type":"string","title":"Type"},"input_path":{"type":"string","title":"Input Path"},"prompt_template":{"type":"string","title":"Prompt Template"},"output_variable":{"type":"string","title":"Output Variable"},"output_type":{"type":"string","title":"Output Type"}},"type":"object","required":["step","id","crc","title","name","description","type","input_path","prompt_template","output_variable","output_type"],"title":"PromptChainStep"},"RequestDomainRequest":{"properties":{"domain":{"type":"string","title":"Domain"}},"type":"object","required":["domain"],"title":"RequestDomainRequest"},"RequestDomainResponse":{"properties":{"message":{"type":"string","title":"Message"},"domain":{"type":"string","title":"Domain"},"request_count":{"type":"integer","title":"Request Count"}},"type":"object","required":["message","domain","request_count"],"title":"RequestDomainResponse"},"RequestedDomainListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/RequestedDomainRead"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["items","total"],"title":"RequestedDomainListResponse"},"RequestedDomainRead":{"properties":{"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"domain":{"type":"string","title":"Domain"},"request_count":{"type":"integer","title":"Request Count"},"first_requested_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Requested At"},"reserved":{"type":"boolean","title":"Reserved"}},"type":"object","required":["domain","request_count","reserved"],"title":"RequestedDomainRead"},"TaggingExampleOutput":{"properties":{"tags":{"items":{"type":"string"},"type":"array","title":"Tags"},"type":{"type":"string","const":"List[str]","title":"Type"}},"type":"object","required":["tags","type"],"title":"TaggingExampleOutput"},"TaskBundle":{"properties":{"mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mode"},"api_version":{"type":"number","title":"Api Version","default":2.1},"guid":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Guid"},"source_guid":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Source Guid"},"type":{"anyOf":[{"type":"string","enum":["conversation_tagging","webpage_metadata_generation","survey_tagging","named_entities_extraction","cc"]},{"type":"null"}],"title":"Type"},"scoring_mechanism":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scoring Mechanism"},"input":{"$ref":"#/components/schemas/TaskInput"},"prompt_chain":{"anyOf":[{"items":{"$ref":"#/components/schemas/PromptChainStep"},"type":"array"},{"type":"null"}],"title":"Prompt Chain"},"example_output":{"anyOf":[{"$ref":"#/components/schemas/TaggingExampleOutput"},{"type":"null"}]},"errors":{"items":{},"type":"array","title":"Errors"},"warnings":{"items":{},"type":"array","title":"Warnings"},"data_type":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Data Type"},"min_convo_windows":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Min Convo Windows","default":0},"is_user_request":{"type":"boolean","title":"Is User Request","default":false}},"type":"object","title":"TaskBundle"},"TaskInput":{"properties":{"input_type":{"type":"string","enum":["conversation","webpage_markdown","survey","ner","document"],"title":"Input Type"},"guid":{"type":"integer","title":"Guid"},"data":{"title":"Data"},"input_categories":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Input Categories"}},"type":"object","required":["input_type","guid","data"],"title":"TaskInput"},"TaskTypeWeight":{"properties":{"task_type":{"type":"string","title":"Task Type","example":"conversation"},"weight":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Weight","example":0.7}},"type":"object","required":["task_type","weight"],"title":"TaskTypeWeight"},"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"},"WalletCreate":{"properties":{"name":{"type":"string","maxLength":128,"minLength":1,"title":"Name"},"private_key":{"type":"string","minLength":1,"title":"Private Key"},"daily_spend_amount":{"type":"number","minimum":0.0,"title":"Daily Spend Amount"},"currency":{"type":"string","title":"Currency","default":"USDC"}},"type":"object","required":["name","private_key","daily_spend_amount"],"title":"WalletCreate"},"WalletOut":{"properties":{"id":{"type":"integer","title":"Id"},"name":{"type":"string","title":"Name"},"address":{"type":"string","title":"Address"},"daily_spend_amount":{"type":"number","title":"Daily Spend Amount"},"currency":{"type":"string","title":"Currency"},"enabled":{"type":"boolean","title":"Enabled"}},"type":"object","required":["id","name","address","daily_spend_amount","currency","enabled"],"title":"WalletOut","description":"Wallet as returned by the API — never includes the private key."},"WalletUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":128,"minLength":1},{"type":"null"}],"title":"Name"},"daily_spend_amount":{"anyOf":[{"type":"number","minimum":0.0},{"type":"null"}],"title":"Daily Spend Amount"},"enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enabled"}},"type":"object","title":"WalletUpdate"}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}}}}