{"openapi":"3.1.0","info":{"title":"Treasury Agent API","description":"Machine-readable catalog + referral links for AI agents. Built by Olga Popova / SpacAd — Money with robots' hands.","version":"1.0.0"},"paths":{"/health":{"get":{"summary":"Health","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Health Health Get"}}}}}}},"/llms.txt":{"get":{"summary":"Llms Txt","description":"GEO: machine-readable site summary for LLM crawlers.","operationId":"llms_txt_llms_txt_get","responses":{"200":{"description":"Successful Response","content":{"text/plain":{"schema":{"type":"string"}}}}}}},"/.well-known/ai-plugin.json":{"get":{"summary":"Ai Plugin Manifest","operationId":"ai_plugin_manifest__well_known_ai_plugin_json_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/catalog/offers":{"get":{"summary":"Catalog Offers","operationId":"catalog_offers_v1_catalog_offers_get","parameters":[{"name":"agent_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Fill referral URLs for this agent","title":"Agent Id"},"description":"Fill referral URLs for this agent"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Catalog Offers V1 Catalog Offers Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/catalog/rwa":{"get":{"summary":"Catalog Rwa","operationId":"catalog_rwa_v1_catalog_rwa_get","parameters":[{"name":"agent_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Catalog Rwa V1 Catalog Rwa Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/catalog/geo-service":{"get":{"summary":"Catalog Geo","operationId":"catalog_geo_v1_catalog_geo_service_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Catalog Geo V1 Catalog Geo Service Get"}}}}}}},"/v1/stats/public":{"get":{"summary":"Public Stats","description":"Public funnel stats for outreach (TreasuryScout replies, landing page).","operationId":"public_stats_v1_stats_public_get","parameters":[{"name":"hours","in":"query","required":false,"schema":{"type":"integer","maximum":720,"minimum":1,"default":168,"title":"Hours"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicStatsOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/agents/claim/{token}":{"get":{"summary":"Claim Agent Api Key","description":"One-time API key claim (TreasuryScout auto-registration for Moltbook agents).","operationId":"claim_agent_api_key_v1_agents_claim__token__get","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentClaimOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/agents/register":{"post":{"summary":"Register Agent","description":"Open registration for AI agents — returns api_key once (or claim URL).","operationId":"register_agent_v1_agents_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRegisterIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRegisterOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/agents/me/stats":{"get":{"summary":"Agent Stats","operationId":"agent_stats_v1_agents_me_stats_get","parameters":[{"name":"X-Agent-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Agent-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentStatsOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/agents/me/clicks":{"post":{"summary":"Agent Record Click","operationId":"agent_record_click_v1_agents_me_clicks_post","parameters":[{"name":"X-Agent-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Agent-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClickIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Agent Record Click V1 Agents Me Clicks Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/leads/route":{"post":{"summary":"Route Human Lead","description":"Route a human lead from an AI agent to the next active Treasury partner (revolver).","operationId":"route_human_lead_v1_leads_route_post","parameters":[{"name":"X-Agent-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Agent-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadRouteIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadRouteOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/leads":{"get":{"summary":"Admin List Leads","operationId":"admin_list_leads_v1_admin_leads_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"X-API-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Admin List Leads V1 Admin Leads Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/agents":{"get":{"summary":"Admin List Agents","operationId":"admin_list_agents_v1_admin_agents_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"X-API-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Admin List Agents V1 Admin Agents Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/webhooks/treasury-event":{"post":{"summary":"Treasury Attribution Webhook","description":"Treasury app calls this on signup/purchase when URL had ?src=agent_…&via=…","operationId":"treasury_attribution_webhook_v1_webhooks_treasury_event_post","parameters":[{"name":"X-Treasury-Webhook-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Treasury-Webhook-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TreasuryWebhookIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Treasury Attribution Webhook V1 Webhooks Treasury Event Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"AgentClaimOut":{"properties":{"ok":{"type":"boolean","title":"Ok","default":true},"agent_id":{"type":"string","title":"Agent Id"},"api_key":{"type":"string","title":"Api Key"},"name":{"type":"string","title":"Name"},"referral_links":{"items":{"$ref":"#/components/schemas/ReferralLinkOut"},"type":"array","title":"Referral Links"},"treasury_url":{"type":"string","title":"Treasury Url"},"docs_url":{"type":"string","title":"Docs Url"},"openapi_url":{"type":"string","title":"Openapi Url"}},"type":"object","required":["agent_id","api_key","name","referral_links","treasury_url","docs_url","openapi_url"],"title":"AgentClaimOut"},"AgentRegisterIn":{"properties":{"name":{"type":"string","maxLength":120,"minLength":2,"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Description"},"contact_email":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Contact Email"},"payout_wallet":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Payout Wallet","description":"BSC or TRC20 wallet for USDT commission payouts"},"payout_pref":{"type":"string","pattern":"^(usdt|ret)$","title":"Payout Pref","default":"usdt"},"delivery":{"type":"string","pattern":"^(direct|claim_link)$","title":"Delivery","description":"direct = return api_key; claim_link = one-time claim URL (for Moltbook outreach)","default":"direct"},"moltbook_name":{"anyOf":[{"type":"string","maxLength":80},{"type":"null"}],"title":"Moltbook Name"}},"type":"object","required":["name"],"title":"AgentRegisterIn"},"AgentRegisterOut":{"properties":{"ok":{"type":"boolean","title":"Ok","default":true},"agent_id":{"type":"string","title":"Agent Id"},"api_key":{"type":"string","title":"Api Key","description":"Shown once — store securely (empty if delivery=claim_link)"},"claim_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Claim Url","description":"One-time key claim page"},"referral_links":{"items":{"$ref":"#/components/schemas/ReferralLinkOut"},"type":"array","title":"Referral Links"},"treasury_url":{"type":"string","title":"Treasury Url"},"docs_url":{"type":"string","title":"Docs Url"},"openapi_url":{"type":"string","title":"Openapi Url"}},"type":"object","required":["agent_id","api_key","referral_links","treasury_url","docs_url","openapi_url"],"title":"AgentRegisterOut"},"AgentStatsOut":{"properties":{"ok":{"type":"boolean","title":"Ok","default":true},"agent_id":{"type":"string","title":"Agent Id"},"name":{"type":"string","title":"Name"},"status":{"type":"string","title":"Status"},"clicks_total":{"type":"integer","title":"Clicks Total"},"payout_wallet":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Payout Wallet"},"payout_pref":{"type":"string","title":"Payout Pref"},"referral_links":{"items":{"$ref":"#/components/schemas/ReferralLinkOut"},"type":"array","title":"Referral Links"}},"type":"object","required":["agent_id","name","status","clicks_total","payout_wallet","payout_pref","referral_links"],"title":"AgentStatsOut"},"ClickIn":{"properties":{"product_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Product Id"}},"type":"object","title":"ClickIn"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"LeadRouteIn":{"properties":{"product_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Product Id","default":"treasury"},"human_hint":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Human Hint","description":"Optional context from the human (locale, interest)"},"locale":{"type":"string","maxLength":8,"title":"Locale","default":"en"}},"type":"object","title":"LeadRouteIn"},"LeadRouteOut":{"properties":{"ok":{"type":"boolean","title":"Ok","default":true},"lead_id":{"type":"integer","title":"Lead Id"},"partner_username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Partner Username"},"partner_telegram_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Partner Telegram Url"},"treasury_url":{"type":"string","title":"Treasury Url"},"butler_url":{"type":"string","title":"Butler Url"},"routing":{"type":"string","title":"Routing","default":"active_partner_revolver"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"}},"type":"object","required":["lead_id","partner_username","partner_telegram_url","treasury_url","butler_url"],"title":"LeadRouteOut"},"PublicStatsOut":{"properties":{"ok":{"type":"boolean","title":"Ok","default":true},"period_hours":{"type":"integer","title":"Period Hours","default":168},"agent_signups_7d":{"type":"integer","title":"Agent Signups 7D"},"human_signups_7d":{"type":"integer","title":"Human Signups 7D"},"human_purchases_7d":{"type":"integer","title":"Human Purchases 7D"},"agent_leads_7d":{"type":"integer","title":"Agent Leads 7D"},"agents_total":{"type":"integer","title":"Agents Total"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"}},"type":"object","required":["agent_signups_7d","human_signups_7d","human_purchases_7d","agent_leads_7d","agents_total"],"title":"PublicStatsOut"},"ReferralLinkOut":{"properties":{"product_id":{"type":"string","title":"Product Id"},"name":{"type":"string","title":"Name"},"url":{"type":"string","title":"Url"}},"type":"object","required":["product_id","name","url"],"title":"ReferralLinkOut"},"TreasuryWebhookIn":{"properties":{"event_type":{"type":"string","pattern":"^(signup|purchase|click)$","title":"Event Type"},"src":{"type":"string","maxLength":200,"title":"Src"},"treasury_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Treasury User Id"},"ai_agent_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ai Agent Id"},"amount_usd":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Amount Usd"},"meta":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Meta"}},"type":"object","required":["event_type","src"],"title":"TreasuryWebhookIn"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}