{"openapi":"3.1.0","info":{"title":"Clarity API","description":"Company intelligence API for AI sales agents. One API call returns structured intelligence that agents can consume and act on programmatically.","version":"0.1.0"},"paths":{"/":{"get":{"summary":"Serve Frontend","description":"Serve the demo frontend.","operationId":"serve_frontend__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/speedrun":{"get":{"summary":"Serve Speedrun","description":"Candidate mode page.","operationId":"serve_speedrun_speedrun_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/health":{"get":{"summary":"Health Check","description":"Basic health check endpoint.","operationId":"health_check_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/admin/clear-cache":{"post":{"summary":"Admin Clear Cache","description":"Clear the response cache. Requires API key.","operationId":"admin_clear_cache_admin_clear_cache_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/costs":{"get":{"summary":"Get Costs","description":"Get cumulative OpenAI spend stats. Requires API key.","operationId":"get_costs_costs_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/stats":{"get":{"summary":"Get Stats","description":"Get public usage and feedback stats.","operationId":"get_stats_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/feedback":{"post":{"summary":"Submit Feedback","description":"Record thumbs up/down feedback on analysis quality.","operationId":"submit_feedback_api_feedback_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/company":{"post":{"summary":"Analyze Company","description":"Analyze a company and return structured intelligence.\n\nFetches data from website, news, GitHub, jobs, and community in parallel,\nthen synthesizes everything through OpenAI with contradiction detection.","operationId":"analyze_company_api_company_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClarityRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClarityResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/candidate":{"post":{"summary":"Analyze For Candidate","description":"Research a company for a job seeker.\n\nSame parallel sources as /api/company. Returns what the company does,\nsignals that matter to a candidate, contradictions as questions to ask,\nexplicit evidence gaps, and a short intro note to the founder.","operationId":"analyze_for_candidate_api_candidate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CandidateRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CandidateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/compare":{"post":{"summary":"Compare Emails","description":"Run the full pipeline: analyze a company, then generate two emails.\n\nReturns a generic cold email (no intelligence) side-by-side with\na Clarity-powered personalized email. This is the core demo endpoint.","operationId":"compare_emails_api_compare_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompareRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompareResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}}},"components":{"schemas":{"CandidateContradiction":{"properties":{"claim_a":{"type":"string","title":"Claim A","description":"What one source says"},"source_a":{"type":"string","title":"Source A","description":"URL of first source"},"claim_b":{"type":"string","title":"Claim B","description":"What another source says that conflicts"},"source_b":{"type":"string","title":"Source B","description":"URL of second source"},"resolution":{"type":"string","title":"Resolution","description":"Most likely innocent explanation"},"question_to_ask":{"type":"string","title":"Question To Ask","description":"A neutral question a candidate could ask the founder about it"}},"type":"object","required":["claim_a","source_a","claim_b","source_b","resolution","question_to_ask"],"title":"CandidateContradiction","description":"A tension between sources, turned into a question worth asking the founder."},"CandidateIntelligence":{"properties":{"company_name":{"type":"string","title":"Company Name"},"domain":{"type":"string","title":"Domain"},"what_they_do":{"type":"string","title":"What They Do","description":"One-sentence description of the company"},"who_they_sell_to":{"type":"string","title":"Who They Sell To","description":"Their customers, as stated in the sources"},"industry":{"type":"string","title":"Industry"},"stage":{"type":"string","title":"Stage","description":"Stage if the sources state it, otherwise says it was not found"},"bottom_line":{"type":"string","title":"Bottom Line","description":"Two sentences: what's solid, what's unknown","default":""},"claims_checked":{"items":{"$ref":"#/components/schemas/ClaimCheck"},"type":"array","title":"Claims Checked"},"signals":{"items":{"$ref":"#/components/schemas/CandidateSignal"},"type":"array","title":"Signals"},"contradictions":{"items":{"$ref":"#/components/schemas/CandidateContradiction"},"type":"array","title":"Contradictions"},"questions_for_founder":{"items":{"$ref":"#/components/schemas/FounderQuestion"},"type":"array","title":"Questions For Founder"},"evidence_gaps":{"items":{"type":"string"},"type":"array","title":"Evidence Gaps","description":"Things a candidate would want to know that the sources did not answer"},"unrelated_sources":{"items":{"type":"string"},"type":"array","title":"Unrelated Sources","description":"Sources whose results were about something else with the same name"},"tech_stack":{"items":{"type":"string"},"type":"array","title":"Tech Stack"},"hiring_signals":{"items":{"type":"string"},"type":"array","title":"Hiring Signals"},"sources_used":{"items":{"type":"string"},"type":"array","title":"Sources Used"},"overall_confidence":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Overall Confidence"},"data_freshness":{"type":"string","title":"Data Freshness"}},"type":"object","required":["company_name","domain","what_they_do","who_they_sell_to","industry","stage","overall_confidence","data_freshness"],"title":"CandidateIntelligence","description":"Company research shaped for a job seeker."},"CandidateRequest":{"properties":{"domain":{"type":"string","title":"Domain","description":"Company domain to research, e.g. 'linear.app'"},"candidate_profile":{"anyOf":[{"type":"string","maxLength":1500},{"type":"null"}],"title":"Candidate Profile","description":"Optional: a short bio, and/or a GitHub profile URL. Used only to tailor the intro note. Public GitHub repos are read if a URL is given."}},"type":"object","required":["domain"],"title":"CandidateRequest","description":"Candidate mode request body."},"CandidateResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"intelligence":{"anyOf":[{"$ref":"#/components/schemas/CandidateIntelligence"},{"type":"null"}]},"intro_note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Intro Note"},"sources_checked":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Sources Checked","description":"Which sources returned data, so gaps are visible"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"processing_time_ms":{"type":"integer","title":"Processing Time Ms","description":"Total processing time in milliseconds"}},"type":"object","required":["success","processing_time_ms"],"title":"CandidateResponse","description":"Candidate mode response wrapper."},"CandidateSignal":{"properties":{"signal":{"type":"string","title":"Signal","description":"What was observed"},"why_it_matters":{"type":"string","title":"Why It Matters","description":"What this means for a candidate"},"source_url":{"type":"string","title":"Source Url","description":"URL where this was found"},"confidence":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Confidence","description":"Confidence score 0-1"}},"type":"object","required":["signal","why_it_matters","source_url","confidence"],"title":"CandidateSignal","description":"An evidence-backed observation that matters to someone considering a job there."},"ClaimCheck":{"properties":{"claim":{"type":"string","title":"Claim","description":"What the company says about itself"},"claim_url":{"type":"string","title":"Claim Url","description":"Where the company says it"},"verdict":{"type":"string","title":"Verdict","description":"verified, partly, contradicted or unverified"},"evidence":{"type":"string","title":"Evidence","description":"The detail that decided the verdict"},"evidence_url":{"type":"string","title":"Evidence Url","description":"Where that evidence came from","default":""}},"type":"object","required":["claim","claim_url","verdict","evidence"],"title":"ClaimCheck","description":"One of the company's own claims, checked against independent sources."},"ClarityRequest":{"properties":{"domain":{"type":"string","title":"Domain","description":"Target company domain to analyze, e.g., 'stripe.com'"},"seller_domain":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Seller Domain","description":"Your company's domain. Clarity will fetch your website to understand what you sell."},"context":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Context","description":"Optional extra context (e.g., 'focus on their enterprise tier', 'we just launched a new feature')"}},"type":"object","required":["domain"],"title":"ClarityRequest","description":"API request body."},"ClarityResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"intelligence":{"anyOf":[{"$ref":"#/components/schemas/CompanyIntelligence"},{"type":"null"}]},"suggested_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Suggested Email"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"processing_time_ms":{"type":"integer","title":"Processing Time Ms","description":"Total processing time in milliseconds"}},"type":"object","required":["success","processing_time_ms"],"title":"ClarityResponse","description":"API response wrapper."},"CompanyIntelligence":{"properties":{"company_name":{"type":"string","title":"Company Name"},"domain":{"type":"string","title":"Domain"},"what_they_do":{"type":"string","title":"What They Do","description":"One-sentence description of the company"},"industry":{"type":"string","title":"Industry"},"stage":{"type":"string","title":"Stage","description":"e.g., 'Seed-stage startup', 'Series B', 'Public company'"},"signals":{"items":{"$ref":"#/components/schemas/Signal"},"type":"array","title":"Signals","description":"Evidence-backed observations"},"contradictions":{"items":{"$ref":"#/components/schemas/Contradiction"},"type":"array","title":"Contradictions","description":"Detected contradictions between sources"},"sales_strategy":{"$ref":"#/components/schemas/SalesStrategy"},"tech_stack":{"items":{"type":"string"},"type":"array","title":"Tech Stack"},"hiring_signals":{"items":{"type":"string"},"type":"array","title":"Hiring Signals"},"sources_used":{"items":{"type":"string"},"type":"array","title":"Sources Used","description":"URLs of all sources consulted"},"overall_confidence":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Overall Confidence"},"data_freshness":{"type":"string","title":"Data Freshness","description":"How recent the underlying data is"}},"type":"object","required":["company_name","domain","what_they_do","industry","stage","signals","sales_strategy","sources_used","overall_confidence","data_freshness"],"title":"CompanyIntelligence","description":"Full structured intelligence response.\nDesigned for programmatic consumption by AI agents, not for human dashboards."},"CompareRequest":{"properties":{"domain":{"type":"string","title":"Domain","description":"Target company domain"},"seller_domain":{"type":"string","title":"Seller Domain","description":"Your company's domain"},"context":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Context","description":"Optional extra context"}},"type":"object","required":["domain","seller_domain"],"title":"CompareRequest","description":"Request for side-by-side email comparison."},"CompareResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"company_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company Name"},"generic_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Generic Email"},"clarity_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Clarity Email"},"intelligence":{"anyOf":[{"$ref":"#/components/schemas/CompanyIntelligence"},{"type":"null"}]},"processing_time_ms":{"type":"integer","title":"Processing Time Ms","default":0},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["success"],"title":"CompareResponse","description":"Side-by-side email comparison response."},"Contradiction":{"properties":{"claim_a":{"type":"string","title":"Claim A","description":"What one source says"},"source_a":{"type":"string","title":"Source A","description":"URL of first source"},"claim_b":{"type":"string","title":"Claim B","description":"What another source says that conflicts"},"source_b":{"type":"string","title":"Source B","description":"URL of second source"},"resolution":{"type":"string","title":"Resolution","description":"Most likely explanation for the contradiction"},"sales_implication":{"type":"string","title":"Sales Implication","description":"How this affects the sales approach"}},"type":"object","required":["claim_a","source_a","claim_b","source_b","resolution","sales_implication"],"title":"Contradiction","description":"A detected contradiction between sources.\n\nThis is the main differentiator for Clarity. Parallel enrichment tools\nprocess each source independently and can't cross-reference claims.\nClarity runs a single reasoning pass across all sources to catch conflicts."},"FeedbackRequest":{"properties":{"domain":{"type":"string","title":"Domain","description":"Domain that was analyzed"},"rating":{"type":"string","title":"Rating","description":"'up' or 'down'"}},"type":"object","required":["domain","rating"],"title":"FeedbackRequest","description":"User feedback on analysis quality."},"FounderQuestion":{"properties":{"question":{"type":"string","title":"Question"},"based_on":{"type":"string","title":"Based On","description":"The specific finding that prompts this question"},"source_url":{"type":"string","title":"Source Url","description":"Where that finding came from","default":""}},"type":"object","required":["question","based_on"],"title":"FounderQuestion","description":"A question for the founder call, tied to a specific finding."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"SalesStrategy":{"properties":{"relevance_score":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Relevance Score","description":"How relevant is what we're selling to this company? 0 = completely irrelevant, 1 = perfect fit"},"relevance_reasoning":{"type":"string","title":"Relevance Reasoning","description":"Why this product is or isn't a good fit for this company. Be honest when it's a bad match."},"recommended_angle":{"type":"string","title":"Recommended Angle","description":"The best approach to pitch this company"},"conversation_starter":{"type":"string","title":"Conversation Starter","description":"A specific, relevant opening line"},"avoid_topics":{"items":{"type":"string"},"type":"array","title":"Avoid Topics","description":"Topics or approaches that would backfire"},"timing_assessment":{"type":"string","title":"Timing Assessment","description":"Is now a good time to reach out? Why?"},"decision_maker_profile":{"type":"string","title":"Decision Maker Profile","description":"Who likely makes buying decisions and their likely priorities"}},"type":"object","required":["relevance_score","relevance_reasoning","recommended_angle","conversation_starter","avoid_topics","timing_assessment","decision_maker_profile"],"title":"SalesStrategy","description":"Typed decision object an AI agent can branch on programmatically."},"Signal":{"properties":{"signal":{"type":"string","title":"Signal","description":"What was observed"},"implication":{"type":"string","title":"Implication","description":"What this means for a sales approach"},"source_url":{"type":"string","title":"Source Url","description":"URL where this was found"},"confidence":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Confidence","description":"Confidence score 0-1"}},"type":"object","required":["signal","implication","source_url","confidence"],"title":"Signal","description":"A specific, evidence-backed signal about the company."},"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"}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}}}}