{"openapi":"3.0.0","info":{"title":"geo_aeo Agent API","version":"1.0.0","description":"Read-only Agent API for programmatic access to project audit data."},"servers":[{"url":"/v1/agent"}],"components":{"schemas":{"AgentReportBundle":{"type":"object","description":"The run's readable report bundle (see packages/contract/src/report.ts for the full shape)."}},"parameters":{}},"paths":{"/v1/agent/projects":{"get":{"operationId":"listProjects","summary":"List projects visible to the API key","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","minimum":0,"default":0},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"Paginated project list","content":{"application/json":{"schema":{"type":"object","properties":{"projects":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"targetUrl":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","name","targetUrl","createdAt"]}},"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"}},"required":["projects","total","limit","offset"]}}}},"422":{"description":"Invalid pagination parameters","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"Too many requests from this IP (code RATE_LIMITED); see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"503":{"description":"Rate-limit store unavailable (code SERVICE_UNAVAILABLE)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}}},"/v1/agent/projects/{projectId}/runs":{"get":{"operationId":"listRuns","summary":"List runs for a project","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"projectId","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","minimum":0,"default":0},"required":false,"name":"offset","in":"query"},{"schema":{"type":"string","enum":["queued","running","done","failed","cancelled"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"since","in":"query"}],"responses":{"200":{"description":"Paginated run list","content":{"application/json":{"schema":{"type":"object","properties":{"runs":{"type":"array","items":{"type":"object","properties":{"runId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["queued","running","done","failed","cancelled"]},"createdAt":{"type":"string"},"reportReady":{"type":"boolean"},"currentStage":{"type":"string","nullable":true,"enum":["queued","crawling","preparing_prompts","sampling","analyzing","assembling_report","processing","done",null]},"failedStage":{"type":"string","nullable":true,"enum":["queued","crawling","preparing_prompts","sampling","analyzing","assembling_report","processing","done",null]},"errorClass":{"type":"string","nullable":true,"enum":["crawl_blocked","crawl_failed","sampling_unavailable","quota_exceeded","analysis_failed","report_failed","internal_error","cancelled","unknown",null]},"progress":{"type":"object","properties":{"stepsCompleted":{"type":"integer","minimum":0},"stepsTotal":{"type":"integer","minimum":1},"percent":{"type":"integer","minimum":0,"maximum":100}},"required":["stepsCompleted","stepsTotal","percent"]}},"required":["runId","status","createdAt","reportReady","currentStage","failedStage","errorClass","progress"]}},"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"}},"required":["runs","total","limit","offset"]}}}},"400":{"description":"Invalid status or since (code VALIDATION_FAILED)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Project not found or out of the key's scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"422":{"description":"Invalid pagination parameters","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"Too many requests from this IP (code RATE_LIMITED); see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"503":{"description":"Rate-limit store unavailable (code SERVICE_UNAVAILABLE)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}}},"/v1/agent/projects/{projectId}/runs/{runId}":{"get":{"operationId":"getRun","summary":"Fetch one run's status","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"projectId","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"runId","in":"path"}],"responses":{"200":{"description":"The run with its safe stage, error class and progress","content":{"application/json":{"schema":{"type":"object","properties":{"runId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["queued","running","done","failed","cancelled"]},"createdAt":{"type":"string"},"reportReady":{"type":"boolean"},"currentStage":{"type":"string","nullable":true,"enum":["queued","crawling","preparing_prompts","sampling","analyzing","assembling_report","processing","done",null]},"failedStage":{"type":"string","nullable":true,"enum":["queued","crawling","preparing_prompts","sampling","analyzing","assembling_report","processing","done",null]},"errorClass":{"type":"string","nullable":true,"enum":["crawl_blocked","crawl_failed","sampling_unavailable","quota_exceeded","analysis_failed","report_failed","internal_error","cancelled","unknown",null]},"progress":{"type":"object","properties":{"stepsCompleted":{"type":"integer","minimum":0},"stepsTotal":{"type":"integer","minimum":1},"percent":{"type":"integer","minimum":0,"maximum":100}},"required":["stepsCompleted","stepsTotal","percent"]},"updatedAt":{"type":"string"}},"required":["runId","status","createdAt","reportReady","currentStage","failedStage","errorClass","progress","updatedAt"]}}}},"400":{"description":"Invalid runId (code VALIDATION_FAILED)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Project or run not found, or out of the key's scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"Too many requests from this IP (code RATE_LIMITED); see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"503":{"description":"Rate-limit store unavailable (code SERVICE_UNAVAILABLE)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}}},"/v1/agent/projects/{projectId}/runs/{runId}/report":{"get":{"operationId":"getRunReport","summary":"Fetch a run's report bundle","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"projectId","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"runId","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":2000},"required":false,"name":"parts","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","minimum":0},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"The run's readable report bundle (or a parts/page/overview view when parts, limit or offset is given)","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"view":{"type":"string","enum":["overview"]},"schema_version":{"type":"string"},"run_id":{"type":"string","format":"uuid"},"max_result_chars":{"type":"number","enum":[40000]},"executive_summary":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"parts":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"kind":{"type":"string","enum":["section","block","sub_part"]},"parent":{"type":"string","nullable":true},"sub_parts":{"type":"array","items":{"type":"string"}},"item_count":{"type":"integer","nullable":true,"minimum":0},"serialized_chars":{"type":"integer","minimum":0},"over_budget":{"type":"boolean"},"suggested_limit":{"type":"integer","nullable":true,"minimum":1,"maximum":100}},"required":["name","kind","parent","sub_parts","item_count","serialized_chars","over_budget","suggested_limit"]}}},"required":["view","schema_version","run_id","max_result_chars","executive_summary","parts"]},{"type":"object","properties":{"view":{"type":"string","enum":["parts"]},"schema_version":{"type":"string"},"run_id":{"type":"string","format":"uuid"},"parts":{"type":"object","additionalProperties":{"nullable":true}}},"required":["view","schema_version","run_id","parts"]},{"type":"object","properties":{"view":{"type":"string","enum":["page"]},"schema_version":{"type":"string"},"run_id":{"type":"string","format":"uuid"},"part":{"type":"string"},"items":{"type":"array","items":{"nullable":true}},"total":{"type":"integer","minimum":0},"limit":{"type":"integer","minimum":1,"maximum":100},"offset":{"type":"integer","minimum":0},"next_offset":{"type":"integer","nullable":true,"minimum":0}},"required":["view","schema_version","run_id","part","items","total","limit","offset","next_offset"]},{"$ref":"#/components/schemas/AgentReportBundle"}]}}}},"400":{"description":"Invalid parts, limit or offset (code VALIDATION_FAILED)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Run does not belong to the project","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Project not found or out of the key's scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"409":{"description":"Report assembly is not done yet (code RUN_NOT_READY); carries the safe currentStage, failedStage, errorClass and progress","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["RUN_NOT_READY"]},"message":{"type":"string"}},"required":["code","message"]},"currentStage":{"type":"string","nullable":true,"enum":["queued","crawling","preparing_prompts","sampling","analyzing","assembling_report","processing","done",null]},"failedStage":{"type":"string","nullable":true,"enum":["queued","crawling","preparing_prompts","sampling","analyzing","assembling_report","processing","done",null]},"errorClass":{"type":"string","nullable":true,"enum":["crawl_blocked","crawl_failed","sampling_unavailable","quota_exceeded","analysis_failed","report_failed","internal_error","cancelled","unknown",null]},"progress":{"type":"object","properties":{"stepsCompleted":{"type":"integer","minimum":0},"stepsTotal":{"type":"integer","minimum":1},"percent":{"type":"integer","minimum":0,"maximum":100}},"required":["stepsCompleted","stepsTotal","percent"]}},"required":["error","currentStage","failedStage","errorClass","progress"]}}}},"413":{"description":"Selection exceeds the result size limit (code RESULT_TOO_LARGE); narrow_by says how to narrow","content":{"application/json":{"schema":{"type":"object","properties":{"view":{"type":"string","enum":["result_too_large"]},"error":{"type":"object","properties":{"code":{"type":"string","enum":["RESULT_TOO_LARGE"]},"message":{"type":"string"}},"required":["code","message"]},"measured_chars":{"type":"integer","minimum":0,"exclusiveMinimum":true},"max_chars":{"type":"number","enum":[40000]},"narrow_by":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["sub_parts"]},"parts":{"type":"array","items":{"type":"string"}}},"required":["kind","parts"]},{"type":"object","properties":{"kind":{"type":"string","enum":["limit"]},"suggested_limit":{"type":"integer","minimum":1}},"required":["kind","suggested_limit"]},{"type":"object","properties":{"kind":{"type":"string","enum":["fewer_parts"]},"parts":{"type":"array","items":{"type":"string"}}},"required":["kind","parts"]},{"type":"object","properties":{"kind":{"type":"string","enum":["not_narrowable"]},"reason":{"type":"string"}},"required":["kind","reason"]}]},"minItems":1}},"required":["view","error","measured_chars","max_chars","narrow_by"]}}}},"429":{"description":"Too many requests from this IP (code RATE_LIMITED); see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"503":{"description":"Rate-limit store unavailable (code SERVICE_UNAVAILABLE)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}}},"/v1/agent/projects/{projectId}/recommendations":{"get":{"operationId":"listRecommendations","summary":"List current recommendations for a project","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"projectId","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","minimum":0,"default":0},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"Paginated recommendation list","content":{"application/json":{"schema":{"type":"object","properties":{"projectId":{"type":"string","format":"uuid"},"recommendations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["open","in-progress","implemented","validated","failed"]},"title":{"type":"string"},"priority":{"type":"integer","minimum":0,"exclusiveMinimum":true},"actionOpportunityScore":{"type":"number"},"firstSeenRunId":{"type":"string","format":"uuid"},"lastSeenRunId":{"type":"string","format":"uuid"},"appearanceCount":{"type":"integer","minimum":0},"linkedClusterId":{"type":"string","nullable":true,"format":"uuid"},"category":{"type":"string","enum":["content_gap","trust_gap","schema_gap","visibility_gap","authority_gap","readiness_gap"]},"effort":{"type":"string","enum":["low","medium","high"]},"timeToImplement":{"type":"string","enum":["days","weeks","months"]},"owner":{"type":"string","nullable":true}},"required":["id","status","title","priority","actionOpportunityScore","firstSeenRunId","lastSeenRunId","appearanceCount","linkedClusterId","category","effort","timeToImplement","owner"]}},"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"}},"required":["projectId","recommendations","total","limit","offset"]}}}},"404":{"description":"Project not found or out of the key's scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"Too many requests from this IP (code RATE_LIMITED); see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"503":{"description":"Rate-limit store unavailable (code SERVICE_UNAVAILABLE)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}}},"/v1/agent/projects/{projectId}/runs/{runId}/trend":{"get":{"operationId":"getRunTrend","summary":"Fetch a run's cross-run answer-trend series","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"projectId","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"runId","in":"path"},{"schema":{"type":"string","enum":["mention_rate_by_cluster","share_of_voice","competitor_entry_exit","cited_source_delta","mention_rate_overall"]},"required":false,"name":"section","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","minimum":0},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"A compact summary of the run's trend (default), or one page of a trend section","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"view":{"type":"string","enum":["summary"]},"run_id":{"type":"string","format":"uuid"},"sections":{"type":"object","properties":{"mention_rate_by_cluster":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"description":{"type":"string"}},"required":["total","description"]},"share_of_voice":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"description":{"type":"string"}},"required":["total","description"]},"competitor_entry_exit":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"description":{"type":"string"}},"required":["total","description"]},"cited_source_delta":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"description":{"type":"string"}},"required":["total","description"]},"mention_rate_overall":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"description":{"type":"string"}},"required":["total","description"]}},"required":["mention_rate_by_cluster","share_of_voice","competitor_entry_exit","cited_source_delta","mention_rate_overall"]}},"required":["view","run_id","sections"]},{"type":"object","properties":{"view":{"type":"string","enum":["page"]},"run_id":{"type":"string","format":"uuid"},"section":{"type":"string","enum":["mention_rate_by_cluster","share_of_voice","competitor_entry_exit","cited_source_delta","mention_rate_overall"]},"items":{"type":"array","items":{"nullable":true}},"total":{"type":"integer","minimum":0},"limit":{"type":"integer","minimum":1,"maximum":100},"offset":{"type":"integer","minimum":0},"next_offset":{"type":"integer","nullable":true,"minimum":0}},"required":["view","run_id","section","items","total","limit","offset","next_offset"]}]}}}},"400":{"description":"Invalid section, limit or offset (code VALIDATION_FAILED)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"403":{"description":"Run does not belong to the project","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"Project not found or out of the key's scope","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"413":{"description":"Page over the size limit (code RESULT_TOO_LARGE); narrow_by says how to narrow","content":{"application/json":{"schema":{"type":"object","properties":{"view":{"type":"string","enum":["result_too_large"]},"error":{"type":"object","properties":{"code":{"type":"string","enum":["RESULT_TOO_LARGE"]},"message":{"type":"string"}},"required":["code","message"]},"measured_chars":{"type":"integer","minimum":0,"exclusiveMinimum":true},"max_chars":{"type":"number","enum":[40000]},"narrow_by":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["sub_parts"]},"parts":{"type":"array","items":{"type":"string"}}},"required":["kind","parts"]},{"type":"object","properties":{"kind":{"type":"string","enum":["limit"]},"suggested_limit":{"type":"integer","minimum":1}},"required":["kind","suggested_limit"]},{"type":"object","properties":{"kind":{"type":"string","enum":["fewer_parts"]},"parts":{"type":"array","items":{"type":"string"}}},"required":["kind","parts"]},{"type":"object","properties":{"kind":{"type":"string","enum":["not_narrowable"]},"reason":{"type":"string"}},"required":["kind","reason"]}]},"minItems":1}},"required":["view","error","measured_chars","max_chars","narrow_by"]}}}},"429":{"description":"Too many requests from this IP (code RATE_LIMITED); see Retry-After","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}},"503":{"description":"Rate-limit store unavailable (code SERVICE_UNAVAILABLE)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}}}}}