{"openapi":"3.1.0","info":{"title":"Polystrike API","description":"Real-time prediction market intelligence for Polymarket","version":"1.0.0","x-tiers":{"FREE":{"rate_limit":"100 requests/hour","features":"Basic metadata, limited tweets, basic predictions"},"PRO":{"rate_limit":"10,000 requests/hour","features":"Full access, trading signals, portfolio analysis"}}},"paths":{"/api/v1/meta/elon":{"get":{"tags":["metadata"],"summary":"Get Elon Meta","description":"Get metadata for active Elon tweet markets.\n\nReturns real-time tweet counts, oracle counts, and delta signals.\nNo authentication required.\n\n**Deltas:**\n- settlement_delta: real_counter - xtracker_counter (oracle lag)\n- display_delta: real_counter - ui_counter (UI lag)\n- internal_delta: ui_counter - xtracker_counter","operationId":"get_elon_meta_api_v1_meta_elon_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/meta/cruz":{"get":{"tags":["metadata"],"summary":"Get Cruz Meta","description":"Get metadata for active Ted Cruz tweet markets.\n\nReturns real-time tweet counts, oracle counts, and delta signals.\nNo authentication required.\n\n**Deltas:**\n- settlement_delta: real_counter - xtracker_counter (oracle lag)\n- display_delta: real_counter - ui_counter (UI lag)\n- internal_delta: ui_counter - xtracker_counter","operationId":"get_cruz_meta_api_v1_meta_cruz_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/signals/elon":{"get":{"tags":["signals"],"summary":"Get Elon Signals","description":"Get actionable trading signals for Elon tweet events (REDESIGNED March 2026).\n\nReturns clean, actionable signals with strategy context:\n- BUY (TWO_BUCKET): Buy predicted bucket + lower adjacent (95% WR, 5% bankroll)\n- BUY (SINGLE_BUCKET): High-conviction single bet (77% WR, 2% bankroll)\n- SELL (RISK_MANAGEMENT): Exit position with negative edge\n\nEmpty BUY/SELL arrays mean no actionable opportunities.\n\nQuery Parameters:\n- bankroll: Your bankroll in USD (1-1,000,000) for Kelly bet sizing\n- only_with_signals: Filter out events with no signals (default: false)\n\nAuthentication: PRO tier API key required","operationId":"get_elon_signals_api_v1_signals_elon_get","parameters":[{"name":"bankroll","in":"query","required":false,"schema":{"type":"number","maximum":1000000,"minimum":1,"description":"Your bankroll in USD for Kelly bet sizing. If omitted, uses default from settings.","title":"Bankroll"},"description":"Your bankroll in USD for Kelly bet sizing. If omitted, uses default from settings."},{"name":"only_with_signals","in":"query","required":false,"schema":{"type":"boolean","description":"If true, only return events with BUY or SELL signals (filter out events with no opportunities)","default":false,"title":"Only With Signals"},"description":"If true, only return events with BUY or SELL signals (filter out events with no opportunities)"},{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}},{"name":"x402","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X402"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/signals/cruz":{"get":{"tags":["signals"],"summary":"Get Cruz Signals","description":"Get actionable trading signals for Ted Cruz tweet events (REDESIGNED March 2026).\n\nReturns clean, actionable signals with strategy context:\n- BUY (TWO_BUCKET): Buy predicted bucket + lower adjacent (95% WR, 5% bankroll)\n- BUY (SINGLE_BUCKET): High-conviction single bet (77% WR, 2% bankroll)\n- SELL (RISK_MANAGEMENT): Exit position with negative edge\n\nEmpty signals array means no actionable opportunities.\n\nQuery Parameters:\n- bankroll: Your bankroll in USD (1-1,000,000) for Kelly bet sizing\n\nAuthentication: PRO tier API key required","operationId":"get_cruz_signals_api_v1_signals_cruz_get","parameters":[{"name":"bankroll","in":"query","required":false,"schema":{"type":"number","maximum":1000000,"minimum":1,"description":"Your bankroll in USD for Kelly bet sizing. If omitted, uses default from settings.","title":"Bankroll"},"description":"Your bankroll in USD for Kelly bet sizing. If omitted, uses default from settings."},{"name":"only_with_signals","in":"query","required":false,"schema":{"type":"boolean","description":"If true, only return events with BUY or SELL signals","default":false,"title":"Only With Signals"},"description":"If true, only return events with BUY or SELL signals"},{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}},{"name":"x402","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X402"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/meta/crypto":{"get":{"tags":["metadata"],"summary":"Get Crypto Meta","description":"Get metadata for crypto price markets.\n\nReturns current crypto market information.\nNo authentication required.","operationId":"get_crypto_meta_api_v1_meta_crypto_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/meta/elon/tweets":{"get":{"tags":["metadata"],"summary":"Get Tweets","description":"Get recent Elon tweets with metadata.\n\nReturns recent tweets with type flags and counting status.\n\n**Query Parameters:**\n- limit: Number of tweets (1-100, default 15)\n- offset: Pagination offset (default 0)\n\n**Tier Restrictions:**\n- FREE: Fixed at 15 latest tweets, pagination disabled\n- PRO: Full pagination support, up to 100 tweets per request\n\n**Authentication:** Optional (tier-based features)","operationId":"get_tweets_api_v1_meta_elon_tweets_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":15,"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"}},{"name":"x402","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X402"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/meta/cruz/tweets":{"get":{"tags":["metadata"],"summary":"Get Cruz Tweets","description":"Get recent Ted Cruz tweets with metadata.\n\nReturns recent tweets with type flags and counting status.\n\n**Query Parameters:**\n- limit: Number of tweets (1-100, default 15)\n- offset: Pagination offset (default 0)\n\n**Tier Restrictions:**\n- FREE: Fixed at 15 latest tweets, pagination disabled\n- PRO: Full pagination support, up to 100 tweets per request\n\n**Authentication:** Optional (tier-based features)","operationId":"get_cruz_tweets_api_v1_meta_cruz_tweets_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":15,"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"}},{"name":"x402","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X402"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/prediction/elon":{"get":{"tags":["predictions"],"summary":"Get Elon Prediction","description":"Get predictions for active Elon tweet markets.\n\nReturns Monte Carlo simulation results with forecast percentiles and trading signals.\n\n**Tier Restrictions:**\n- FREE: Limited data (no forecast percentiles, no model probabilities)\n- PRO: Full access (p5/p50/p95 forecasts, model probabilities, edge calculations)\n\n**Authentication:** Optional (tier-based features)","operationId":"get_elon_prediction_api_v1_prediction_elon_get","parameters":[{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}},{"name":"x402","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X402"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/prediction/cruz":{"get":{"tags":["predictions"],"summary":"Get Cruz Prediction","description":"Get predictions for active Ted Cruz tweet markets.\n\nReturns Monte Carlo simulation results with forecast percentiles and trading signals.\n\n**Tier Restrictions:**\n- FREE: Limited data (no forecast percentiles, no model probabilities)\n- PRO: Full access (p5/p50/p95 forecasts, model probabilities, edge calculations)\n\n**Authentication:** Optional (tier-based features)","operationId":"get_cruz_prediction_api_v1_prediction_cruz_get","parameters":[{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}},{"name":"x402","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X402"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portfolio/elon":{"get":{"tags":["portfolio"],"summary":"Get Portfolio Analysis","description":"Analyze wallet positions with EV-based recommendations (PRO tier required).\n\nReturns positions across all active Elon tweet markets with model-based analysis.\n\nQuery Parameters:\n- wallet: Ethereum wallet address (hex format, required)\n- bankroll: Your bankroll in USD (1-1,000,000) for position sizing recommendations\n\nAuthentication: PRO tier API key required\n\nCache: 5 minutes TTL (aligned with prediction snapshot updates)","operationId":"get_portfolio_analysis_api_v1_portfolio_elon_get","parameters":[{"name":"wallet","in":"query","required":true,"schema":{"type":"string","description":"Ethereum wallet address","title":"Wallet"},"description":"Ethereum wallet address"},{"name":"bankroll","in":"query","required":false,"schema":{"type":"number","maximum":1000000,"minimum":1,"description":"Your bankroll in USD for Kelly position sizing analysis. If omitted, position sizing recommendations are not provided.","title":"Bankroll"},"description":"Your bankroll in USD for Kelly position sizing analysis. If omitted, position sizing recommendations are not provided."},{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}},{"name":"x402","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X402"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portfolio/elon/rebalancing":{"get":{"tags":["portfolio"],"summary":"Get Rebalancing Summary","description":"Get rebalancing recommendations for wallet positions (PRO tier required).\n\nReturns only positions that need rebalancing (ADD_MORE or TRIM).\nFilters out positions with adjustments below the threshold.\n\nQuery Parameters:\n- wallet: Ethereum wallet address (hex format, required)\n- bankroll: Your bankroll in USD (1-1,000,000, required)\n- threshold: Minimum adjustment amount in USD (default: $5)\n\nAuthentication: PRO tier API key required\n\nUse Case: Manual rebalancing workflow","operationId":"get_rebalancing_summary_api_v1_portfolio_elon_rebalancing_get","parameters":[{"name":"wallet","in":"query","required":true,"schema":{"type":"string","description":"Ethereum wallet address","title":"Wallet"},"description":"Ethereum wallet address"},{"name":"bankroll","in":"query","required":true,"schema":{"type":"number","maximum":1000000,"minimum":1,"description":"Your bankroll in USD for Kelly position sizing","title":"Bankroll"},"description":"Your bankroll in USD for Kelly position sizing"},{"name":"threshold","in":"query","required":false,"schema":{"type":"number","maximum":100,"minimum":1,"description":"Minimum adjustment amount in USD to show (default: $5)","default":5.0,"title":"Threshold"},"description":"Minimum adjustment amount in USD to show (default: $5)"},{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}},{"name":"x402","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X402"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/health":{"get":{"tags":["system"],"summary":"Health Check","description":"Check API health status.\n\nReturns current timestamp and status.\nNo authentication required.","operationId":"health_check_api_v1_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/waitlist":{"post":{"tags":["system"],"summary":"Waitlist","description":"Join the Polystrike waitlist as an agent or human.\n\nRequest Body:\n- type: \"agent\" or \"human\" (required)\n- case: Use case description (required, max 500 chars)\n- name: Name (required for agents, max 50 chars)\n- wallet: Ethereum wallet address (required for agents, hex format)\n- email: Email address (required for humans, max 150 chars)\n\nValidation:\n- Agents must provide: name, wallet, case\n- Humans must provide: email, case\n\nNo authentication required.","operationId":"waitlist_api_v1_waitlist_post","parameters":[{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}},{"name":"x402","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X402"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaitlistRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/performance/overview":{"get":{"tags":["performance"],"summary":"Get Performance Overview","description":"Get overall model performance metrics.\n\nReturns:\n    {\n        \"error_24h\": {\"median\": 8.5, \"p90\": 15.2, \"sample_size\": 45},\n        \"error_48h\": {\"median\": 12.3, \"p90\": 22.1, \"sample_size\": 38},\n        \"error_72h\": {\"median\": 18.7, \"p90\": 31.4, \"sample_size\": 25},\n        \"win_rate\": {\"HIGH\": 83.3, \"MEDIUM\": 71.2, \"LOW\": 58.9},\n        \"last_updated\": \"2026-03-08T00:15:23Z\"\n    }","operationId":"get_performance_overview_api_v1_performance_overview_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Get Performance Overview Api V1 Performance Overview Get"}}}}}}},"/api/v1/performance/history":{"get":{"tags":["performance"],"summary":"Get Performance History","description":"Get historical performance data for charting.\n\nArgs:\n    horizon: Time horizon (24, 48, or 72 hours)\n    days: Number of days to look back\n\nReturns:\n    {\n        \"data\": [\n            {\"timestamp\": \"2026-03-01T12:00:00Z\", \"error_pct\": 8.5, \"event_id\": 241775},\n            ...\n        ],\n        \"annotations\": [\n            {\"timestamp\": \"2026-03-07T16:00:00Z\", \"label\": \"Fixed rolling window\", \"commit\": \"a3f2b1c\"},\n            ...\n        ]\n    }","operationId":"get_performance_history_api_v1_performance_history_get","parameters":[{"name":"horizon","in":"query","required":false,"schema":{"type":"integer","default":24,"title":"Horizon"}},{"name":"days","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Performance History Api V1 Performance History Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/usage/summary":{"get":{"tags":["usage"],"summary":"Get Usage Summary","description":"Get usage summary for an API key over the last N days.\n\n**Authentication:** Required (INTERNAL tier only)\n\nReturns:\n- Total requests\n- Total errors and error rate\n- Average response time\n- Total bandwidth consumed","operationId":"get_usage_summary_api_v1_usage_summary_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":90,"minimum":1,"description":"Number of days to look back","default":7,"title":"Days"},"description":"Number of days to look back"},{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}},{"name":"x402","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X402"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/usage/by-endpoint":{"get":{"tags":["usage"],"summary":"Get Usage By Endpoint","description":"Get usage breakdown by endpoint for an API key.\n\n**Authentication:** Required (INTERNAL tier only)\n\nReturns per-endpoint statistics:\n- Request count\n- Error count and rate\n- Average response time\n- Bandwidth consumed","operationId":"get_usage_by_endpoint_api_v1_usage_by_endpoint_get","parameters":[{"name":"start","in":"query","required":true,"schema":{"type":"integer","description":"Start timestamp (Unix seconds)","title":"Start"},"description":"Start timestamp (Unix seconds)"},{"name":"end","in":"query","required":true,"schema":{"type":"integer","description":"End timestamp (Unix seconds)","title":"End"},"description":"End timestamp (Unix seconds)"},{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}},{"name":"x402","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X402"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/usage/errors":{"get":{"tags":["usage"],"summary":"Get Error Logs","description":"Get recent error logs for an API key.\n\n**Authentication:** Required (INTERNAL tier only)\n\nReturns detailed error information:\n- Endpoint and method\n- Timestamp\n- Status code\n- Response time\n- Error message","operationId":"get_error_logs_api_v1_usage_errors_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"description":"Maximum number of errors to return","default":100,"title":"Limit"},"description":"Maximum number of errors to return"},{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}},{"name":"x402","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X402"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/usage/stats":{"get":{"tags":["usage"],"summary":"Get Usage Stats","description":"Get current usage tracking statistics.\n\n**Authentication:** Required (INTERNAL tier only)\n\nReturns buffer status and tracking configuration.","operationId":"get_usage_stats_api_v1_usage_stats_get","parameters":[{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}},{"name":"x402","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X402"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"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"},"WaitlistRequest":{"properties":{"type":{"type":"string","pattern":"^(agent|human)$","title":"Type","description":"Must be 'agent' or 'human'"},"case":{"type":"string","maxLength":500,"title":"Case"},"name":{"anyOf":[{"type":"string","maxLength":50,"pattern":"^[A-Za-z0-9 _-]+$"},{"type":"null"}],"title":"Name"},"wallet":{"anyOf":[{"type":"string","maxLength":42,"pattern":"^0x[a-fA-F0-9]{40}$"},{"type":"null"}],"title":"Wallet"},"email":{"anyOf":[{"type":"string","maxLength":150,"pattern":"^[\\w\\.-]+@[\\w\\.-]+\\.\\w+$"},{"type":"null"}],"title":"Email"}},"type":"object","required":["type","case"],"title":"WaitlistRequest"}},"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key","description":"API key for authentication. Get yours at https://polystrike.xyz"},"X402Auth":{"type":"apiKey","in":"header","name":"x402","description":"Coinbase payment protocol for per-call payments"}}}}