{"openapi":"3.1.0","info":{"title":"Agentry API","version":"2026-05-20","description":"Canonical agent-readable schema for Agentry endpoints. Use this for request and response shapes; use /install.md and /v1/install/contract for onboarding workflow. API-key-authenticated JSON responses may include a billing_notice field when the account is near or over quota."},"servers":[{"url":"https://api.agentry.sh"}],"x-agentry-flows":{"install":{"purpose":"Take a repo from unknown state to verified Agentry instrumentation.","operations":[{"method":"get","path":"/v1/install/sdk/{language}"}],"states":["unknown","contract_loaded","authenticated","project_selected","project_setup_loaded","plan_drafted","plan_approved","implemented","verified","proof_loaded","feedback_checked","blocked"],"transitions":[{"from":"unknown","to":"contract_loaded","operation":"GET /install.md -> GET /v1/setup/manifest -> GET /v1/install/contract"},{"from":"contract_loaded","to":"authenticated","operation":"POST /v1/auth/device -> POST /v1/auth/device/poll","when":"no local AGENTRY_API_KEY is available"},{"from":"authenticated","to":"project_selected","operation":"GET /v1/projects or POST /v1/projects"},{"from":"project_selected","to":"project_setup_loaded","operation":"GET /v1/projects/{project_id}/setup"},{"from":"project_setup_loaded","to":"plan_drafted","operation":"POST /v1/install/plan"},{"from":"plan_drafted","to":"plan_approved","operation":"PUT /v1/projects/{project_id}/signal-map"},{"from":"plan_approved","to":"implemented","operation":"PUT /v1/projects/{project_id}/implementation-report"},{"from":"implemented","to":"verified","operation":"POST /v1/projects/{project_id}/install/verify","when":"ok=true; readiness_gaps may still require follow-up telemetry before specific dashboards/questions are claimed answerable"},{"from":"verified","to":"proof_loaded","operation":"GET /v1/projects/{project_id}/verify-report"},{"from":"verified","to":"feedback_checked","operation":"POST /v1/feedback","when":"agent discovered an Agentry API/docs/schema/install/verify defect during the run"},{"from":"implemented","to":"blocked","operation":"POST /v1/projects/{project_id}/install/verify","when":"ok=false or gate_failures non-empty"}],"invariants":["Do not implement before the user has reviewed the plan.","Do not call the install complete until verify returns ok=true. If readiness_gaps is non-empty, report the install as working but do not claim complete product-question coverage.","Before the final response, file kind=agent_discovered_bug feedback with a stable fingerprint for each Agentry API/docs/schema/install/verify defect discovered during the run.","When exact payload shape is unclear, use a filtered schema lookup: /v1/openapi.json?flow=install, /v1/openapi.json?tag=Install&include_components=false, or /v1/openapi.json?path=...&method=...."]},"daily_use":{"purpose":"Answer day-to-day product, reliability, and deploy questions by proving readiness first, then querying.","operations":[{"method":"get","path":"/v1/projects/{project_id}/signal-map"},{"method":"get","path":"/v1/projects/{project_id}/verify-report"},{"method":"get","path":"/v1/projects/{project_id}/answer-contracts"},{"method":"get","path":"/v1/projects/{project_id}/event-names"},{"method":"get","path":"/v1/projects/{project_id}/event-property-keys"},{"method":"get","path":"/v1/query-blueprints"},{"method":"get","path":"/v1/query-blueprints/{blueprint_id}"},{"method":"post","path":"/v1/projects/{project_id}/query-blueprints/{blueprint_id}/run"},{"method":"post","path":"/v1/projects/{project_id}/analytics/query"},{"method":"get","path":"/v1/projects/{project_id}/cases"},{"method":"get","path":"/v1/cases/{case_id}"},{"method":"get","path":"/v1/projects/{project_id}/deploys"},{"method":"get","path":"/v1/projects/{project_id}/next-steps"}],"states":["question","contract_loaded","readiness_classified","queried","answered","needs_data_or_instrumentation"],"transitions":[{"from":"question","to":"contract_loaded","operation":"GET /v1/projects/{project_id}/signal-map"},{"from":"contract_loaded","to":"readiness_classified","operation":"GET /v1/projects/{project_id}/verify-report -> GET /v1/projects/{project_id}/answer-contracts"},{"from":"readiness_classified","to":"queried","operation":"GET /v1/projects/{project_id}/event-names -> GET /v1/projects/{project_id}/event-property-keys -> POST /v1/projects/{project_id}/query-blueprints/{blueprint_id}/run or POST /v1/projects/{project_id}/analytics/query","when":"answer_ready=true, readiness_gaps is empty for the question, and the needed events/properties are observed"},{"from":"readiness_classified","to":"needs_data_or_instrumentation","operation":"GET /v1/projects/{project_id}/verify-report","when":"answer_ready=false, readiness_gaps non-empty, or required event/property is absent"},{"from":"queried","to":"answered","operation":"Return rows plus evidence and freshness; build a report/dashboard only when the user asked for one"}],"invariants":["Read signal-map, verify-report, and answer-contracts before choosing a blueprint or writing HogQL.","For event-property-keys, pass ?events=a,b,c from the saved funnel. Do not rely on the no-events form for segmentation proof.","If answer_ready=false or readiness_gaps is non-empty, classify the question as Ready/Needs more data/Needs instrumentation before querying. Observed rows alone are not proof that the product question is answer-ready.","Public-query publications are optional browser/shareable output, not proof that the metric is valid."]},"webhooks":{"purpose":"Register signed outbound deliveries for case/deploy lifecycle events.","states":["none","registered","tested","delivering","unhealthy","deleted"],"transitions":[{"from":"none","to":"registered","operation":"POST /v1/projects/{project_id}/webhooks"},{"from":"registered","to":"tested","operation":"POST /v1/projects/{project_id}/webhooks/{id}/test"},{"from":"registered","to":"delivering","operation":"POST /v1/logs/ or POST /v1/deploys/"},{"from":"delivering","to":"unhealthy","operation":"GET /v1/projects/{project_id}/webhooks","when":"last_status is non-2xx or last_error is present"},{"from":"registered","to":"deleted","operation":"DELETE /v1/projects/{project_id}/webhooks/{id}"}],"invariants":["Deliveries include x-agentry-event and x-agentry-signature.","Subscribers only receive events listed in their events array."]},"alerts":{"purpose":"Create query-blueprint-backed alert definitions and evaluate them on a customer-owned schedule.","states":["none","created","evaluated_clear","triggered","deleted"],"transitions":[{"from":"none","to":"created","operation":"POST /v1/projects/{project_id}/alerts"},{"from":"created","to":"evaluated_clear","operation":"POST /v1/projects/{project_id}/alerts/{id}/evaluate","when":"threshold not crossed"},{"from":"created","to":"triggered","operation":"POST /v1/projects/{project_id}/alerts/{id}/evaluate","when":"threshold crossed"},{"from":"created","to":"deleted","operation":"DELETE /v1/projects/{project_id}/alerts/{id}"}],"invariants":["blueprint_id must exist in the query blueprint catalog.","threshold_column, threshold_op, and threshold_value define the trigger condition."]},"public_queries":{"purpose":"Publish a bounded query-blueprint result URL without exposing arbitrary HogQL.","states":["private","published","served","revoked"],"transitions":[{"from":"private","to":"published","operation":"POST /v1/projects/{project_id}/public-queries"},{"from":"published","to":"served","operation":"GET /v1/public/q/{publication_id}"},{"from":"published","to":"revoked","operation":"DELETE /v1/projects/{project_id}/public-queries/{publication_id}"}],"invariants":["Only blueprint_id plus params are public, never arbitrary HogQL.","The returned publication URL can only execute its explicitly published query-blueprint query; optional agp_ keys are validated when supplied."]},"posthog_setup":{"purpose":"Repair or configure the per-project analytics backing.","states":["unknown","provisioned","replay_configured","ready","upstream_blocked"],"transitions":[{"from":"unknown","to":"provisioned","operation":"POST /v1/projects/{project_id}/posthog/provision"},{"from":"provisioned","to":"replay_configured","operation":"POST /v1/projects/{project_id}/posthog/session-replay/configure"},{"from":"replay_configured","to":"ready","operation":"GET /v1/projects/{project_id}/posthog/session-replay/status"},{"from":"unknown","to":"upstream_blocked","operation":"POST /v1/projects/{project_id}/posthog/provision","when":"503 or missing operator credentials"}],"invariants":["Feature, cohort, survey, and replay routes scope through the user's PostHog team binding.","If provisioning fails, errors and deploys can still work while analytics waits on PostHog."]}},"x-agentry-agent-contract":{"request_id_header":"x-agentry-request-id","response_request_id_header":"x-agentry-request-id","idempotency_key_header":"idempotency-key","error_retryability_field":"error.retryable","error_request_id_field":"error.request_id","optional_quota_notice_field":"billing_notice","quota_lock_status":402,"quota_lock_code":"quota_exceeded","quota_notice_guidance":"If billing_notice.should_notify_human is true, show billing_notice.message_for_human to the human operator and pass billing_notice.client_payload unchanged to any client UI you control. Core row-query reads remain available with billing_notice so beta agents can keep working while surfacing the operator issue; advanced raw data reads such as sourcemap blobs can still lock with 402 quota_exceeded. Project health, event schema metadata, audit history, sourcemap metadata listing, bounded case recovery operations including affected-user and distinct-id summary reads, deploy recovery reads, and DSN-authenticated event ingest remain open so events are not lost before upgrade. Create an account-specific Stripe Checkout link only by calling POST /v1/billing/checkout.","retryable_statuses":[429,500,502,503,504],"retry_guidance":"Agents should retry retryable=true failures with exponential backoff and preserve the original idempotency-key when replaying the same mutation. invalid_payload is not retryable; fetch the filtered schema and fix the body."},"paths":{"/":{"get":{"summary":"Get service metadata","tags":["Discovery"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"docs":{"type":"string"},"install_docs":{"type":"string"},"reference_docs":{"type":"string"},"api_schema":{"type":"string"},"capabilities":{"type":"string"},"setup_manifest":{"type":"string"},"install_contract":{"type":"string"},"install_plan":{"type":"string"},"quick_start":{"type":"array","items":{"type":"object","properties":{"when":{"type":"string"},"action":{"type":"string"},"urls":{"type":"array","items":{"type":"string"}}},"required":["when","action","urls"],"additionalProperties":false}},"mental_model":{"type":"object","additionalProperties":true},"proof_contract":{"type":"object","properties":{"install":{"type":"string"},"answering":{"type":"string"}},"required":["install","answering"],"additionalProperties":false},"signal_map":{"type":"string"},"implementation_report":{"type":"string"},"verify_install":{"type":"string"},"verify_report":{"type":"string"},"skill":{"type":"string"},"response_shapes":{"type":"object","additionalProperties":true},"next_action":{"type":"string"}},"required":["name","docs","api_schema"],"additionalProperties":false},"examples":{"default":{"value":{"name":"string","docs":"string","install_docs":"string","reference_docs":"string","api_schema":"string","capabilities":"string","setup_manifest":"string","install_contract":"string","install_plan":"string","quick_start":[{"when":"string","action":"string","urls":[{}]}],"mental_model":{},"proof_contract":{"install":"string","answering":"string"},"signal_map":"string","implementation_report":"string","verify_install":"string","verify_report":"string","skill":"string","response_shapes":{},"next_action":"string"}}}}}}}}},"/v1/capabilities":{"get":{"summary":"Get agent capability manifest","description":"Agent-readable manifest of Agentry's composable product features: endpoint groups, HTTP-backed skill adapters, answer contracts, query blueprints, auth types, and what to call next.","tags":["Discovery"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"schema_version":{"type":"integer"},"generated_at":{"type":"string"},"principle":{"type":"string"},"discovery":{"type":"object","additionalProperties":true},"auth_types":{"type":"object","additionalProperties":true},"surfaces":{"type":"object","additionalProperties":true},"capabilities":{"type":"array","items":{"type":"object","additionalProperties":true}},"next_action":{"type":"string"}},"required":["schema_version","surfaces","capabilities"],"additionalProperties":false},"examples":{"default":{"value":{"schema_version":1,"generated_at":"string","principle":"string","discovery":{},"auth_types":{},"surfaces":{},"capabilities":[{}],"next_action":"string"}}}}}}}}},"/v1/setup/manifest":{"get":{"summary":"Get env and setup manifest","description":"Machine-readable setup guidance for agents: default runtime env, owner-only env, public-query handling, and canonical local/server state.","tags":["Install"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"schema_version":{"type":"integer"},"principle":{"type":"string"},"project_setup_endpoint":{"type":"string"},"runtime_env":{"type":"array","items":{"type":"object","additionalProperties":true}},"owner_env":{"type":"array","items":{"type":"object","additionalProperties":true}},"framework_env_matrix":{"type":"array","items":{"type":"object","additionalProperties":true}},"host_env_matrix":{"type":"array","items":{"type":"object","additionalProperties":true}},"env_preflight_checks":{"type":"object","additionalProperties":true},"public_queries":{"type":"object","additionalProperties":true},"local_state":{"type":"object","additionalProperties":true},"next_action":{"type":"string"}},"required":["schema_version","principle","project_setup_endpoint","runtime_env","owner_env","framework_env_matrix","host_env_matrix","env_preflight_checks","local_state","next_action"],"additionalProperties":false},"examples":{"default":{"value":{"schema_version":1,"principle":"string","project_setup_endpoint":"string","runtime_env":[{}],"owner_env":[{}],"framework_env_matrix":[{}],"host_env_matrix":[{}],"env_preflight_checks":{},"public_queries":{},"local_state":{},"next_action":"string"}}}}}}}}},"/agentry.md":{"get":{"summary":"Get lean agent reference","tags":["Discovery"],"responses":{"200":{"description":"Markdown response","content":{"text/markdown":{"schema":{"type":"string"}}}}}}},"/install.md":{"get":{"summary":"Get install bootstrap","tags":["Discovery"],"responses":{"200":{"description":"Markdown response","content":{"text/markdown":{"schema":{"type":"string"}}}}}}},"/skill/agentry/SKILL.md":{"get":{"summary":"Get agent discovery skill","tags":["Discovery"],"responses":{"200":{"description":"Markdown response","content":{"text/markdown":{"schema":{"type":"string"}}}}}}},"/adapters":{"get":{"summary":"List cross-platform install adapters","tags":["Discovery"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":true},"examples":{"default":{"value":{}}}}}}}}},"/adapters/AGENTS.md":{"get":{"summary":"AGENTS.md install adapter","tags":["Discovery"],"responses":{"200":{"description":"Markdown response","content":{"text/markdown":{"schema":{"type":"string"}}}}}}},"/adapters/cursor.mdc":{"get":{"summary":"Cursor rule install adapter","tags":["Discovery"],"responses":{"200":{"description":"Markdown response","content":{"text/markdown":{"schema":{"type":"string"}}}}}}},"/adapters/copilot-instructions.md":{"get":{"summary":"GitHub Copilot repository instructions adapter","tags":["Discovery"],"responses":{"200":{"description":"Markdown response","content":{"text/markdown":{"schema":{"type":"string"}}}}}}},"/adapters/agentry.instructions.md":{"get":{"summary":"VS Code and Visual Studio targeted instructions adapter","tags":["Discovery"],"responses":{"200":{"description":"Markdown response","content":{"text/markdown":{"schema":{"type":"string"}}}}}}},"/adapters/windsurf.md":{"get":{"summary":"Windsurf or Devin Desktop workspace rule adapter","tags":["Discovery"],"responses":{"200":{"description":"Markdown response","content":{"text/markdown":{"schema":{"type":"string"}}}}}}},"/adapters/windsurfrules":{"get":{"summary":"Windsurf rules install adapter","tags":["Discovery"],"responses":{"200":{"description":"Markdown response","content":{"text/markdown":{"schema":{"type":"string"}}}}}}},"/adapters/cline.md":{"get":{"summary":"Cline workspace rule adapter","tags":["Discovery"],"responses":{"200":{"description":"Markdown response","content":{"text/markdown":{"schema":{"type":"string"}}}}}}},"/adapters/roo.md":{"get":{"summary":"Roo Code workspace rule adapter","tags":["Discovery"],"responses":{"200":{"description":"Markdown response","content":{"text/markdown":{"schema":{"type":"string"}}}}}}},"/adapters/continue.md":{"get":{"summary":"Continue rule adapter","tags":["Discovery"],"responses":{"200":{"description":"Markdown response","content":{"text/markdown":{"schema":{"type":"string"}}}}}}},"/adapters/zed.rules":{"get":{"summary":"Zed project rule adapter","tags":["Discovery"],"responses":{"200":{"description":"Markdown response","content":{"text/markdown":{"schema":{"type":"string"}}}}}}},"/adapters/GEMINI.md":{"get":{"summary":"Gemini CLI context adapter","tags":["Discovery"],"responses":{"200":{"description":"Markdown response","content":{"text/markdown":{"schema":{"type":"string"}}}}}}},"/adapters/aider-conventions.md":{"get":{"summary":"Aider conventions adapter","tags":["Discovery"],"responses":{"200":{"description":"Markdown response","content":{"text/markdown":{"schema":{"type":"string"}}}}}}},"/adapters/claude-plugin.json":{"get":{"summary":"Claude Code plugin manifest","tags":["Discovery"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":true},"examples":{"default":{"value":{}}}}}}}}},"/v1/install/sdk/node":{"get":{"summary":"Get Node fetch helper snippet","tags":["Install"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstallSnippet"},"examples":{"default":{"value":{}}}}}}}}},"/v1/install/sdk/browser":{"get":{"summary":"Get browser fetch helper snippet","tags":["Install"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstallSnippet"},"examples":{"default":{"value":{}}}}}}}}},"/v1/install/sdk/{language}":{"get":{"summary":"Get install helper snippet","tags":["Install"],"parameters":[{"name":"language","in":"path","required":true,"schema":{"type":"string","enum":["node","browser","python","ruby","go","php","java","dotnet","rust","elixir","curl"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstallSnippet"},"examples":{"default":{"value":{}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/docs/query":{"get":{"summary":"Get HogQL/query docs","tags":["Discovery"],"responses":{"200":{"description":"Markdown response","content":{"text/markdown":{"schema":{"type":"string"}}}}}}},"/v1/docs/automation":{"get":{"summary":"Get webhook/automation docs","tags":["Discovery"],"responses":{"200":{"description":"Markdown response","content":{"text/markdown":{"schema":{"type":"string"}}}}}}},"/v1/privacy/disclosure":{"get":{"summary":"Get privacy disclosure clause","tags":["Discovery"],"parameters":[{"name":"variant","in":"query","required":false,"schema":{"type":"string"}},{"name":"errors","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"analytics","in":"query","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"canonical_url":{"type":"string"},"variant":{"type":"string","enum":["client","server"]},"last_updated":{"type":"string"},"data_residency":{"type":"object","additionalProperties":true},"includes":{"type":"object","additionalProperties":true},"paste_ready_markdown":{"type":"string"},"learn_more":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"canonical_url":"string","variant":"client","last_updated":"string","data_residency":{},"includes":{},"paste_ready_markdown":"string","learn_more":"string"}}}}}}}}},"/v1/auth/device/authorize":{"post":{"summary":"Authorize device flow from hosted web app","tags":["Auth"],"security":[{"InternalTokenAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"user_code":{"type":"string"},"identity":{"type":"object","additionalProperties":true}},"required":["user_code","identity"],"additionalProperties":false},"examples":{"default":{"value":{"user_code":"string","identity":{}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"user_id":{"type":"string"}},"required":["status","user_id"],"additionalProperties":false},"examples":{"default":{"value":{"status":"ok","user_id":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/auth/device/test-authorize":{"post":{"summary":"Authorize device flow for hosted beta lifecycle tests","description":"Operator-only hosted test hook. Disabled unless AGENTRY_TEST_AUTH_TOKEN is configured. Creates only synthetic email-provider identities with provider_user_id agentry-test:<test_run_id>, then the normal device poll path mints keys.","tags":["Auth"],"security":[{"TestAuthTokenAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"user_code":{"type":"string"},"test_run_id":{"type":"string"}},"required":["user_code","test_run_id"],"additionalProperties":false},"examples":{"default":{"value":{"user_code":"string","test_run_id":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"user_id":{"type":"string"},"is_new":{"type":"boolean"},"test_run_id":{"type":"string"},"email":{"type":"string"},"next_action":{"type":"string"}},"required":["status","user_id","is_new","test_run_id","email"],"additionalProperties":false},"examples":{"default":{"value":{"status":"ok","user_id":"string","is_new":true,"test_run_id":"string","email":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/auth/identity/resolve":{"post":{"summary":"Resolve hosted auth identity","tags":["Auth"],"security":[{"InternalTokenAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"identity":{"type":"object","additionalProperties":true}},"required":["identity"],"additionalProperties":false},"examples":{"default":{"value":{"identity":{}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"user_id":{"type":"string"},"is_new":{"type":"boolean"}},"required":["user_id","is_new"],"additionalProperties":false},"examples":{"default":{"value":{"user_id":"string","is_new":true}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/auth/self_delete":{"post":{"summary":"Delete authenticated user account","tags":["Auth"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"confirm":{"type":"string"}},"required":["confirm"],"additionalProperties":false},"examples":{"default":{"value":{"confirm":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["deleted"]},"user_id":{"type":"string"},"cascaded":{"type":"object","additionalProperties":true},"note":{"type":"string"},"next_action":{"type":"string"}},"required":["status","user_id","cascaded"],"additionalProperties":false},"examples":{"default":{"value":{"status":"deleted","user_id":"string","cascaded":{},"note":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/dsn":{"get":{"summary":"Get current project DSN status","description":"Owner-only. Returns the recoverable current raw DSN when Agentry has an encrypted copy. Does not rotate credentials.","tags":["Projects"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"project_id":{"type":"string"},"dsn_prefix":{"type":"string"},"raw_available":{"type":"boolean"},"dsn":{"oneOf":[{"type":"string"},{"type":"null"}]},"verify_endpoint":{"type":"string"},"rotate_endpoint":{"type":"string"},"next_action":{"type":"string"}},"required":["project_id","dsn_prefix","raw_available","dsn","verify_endpoint","rotate_endpoint"],"additionalProperties":false},"examples":{"default":{"value":{"project_id":"string","dsn_prefix":"string","raw_available":true,"dsn":"string","verify_endpoint":"string","rotate_endpoint":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/dsn/verify":{"post":{"summary":"Verify project DSN without rotating","tags":["Projects"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"dsn":{"type":"string"}},"required":["dsn"],"additionalProperties":false},"examples":{"default":{"value":{"dsn":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"project_id":{"type":"string"},"dsn_prefix":{"type":"string"},"parsed_project_id":{"oneOf":[{"type":"string"},{"type":"null"}]},"stored_for_recovery":{"type":"boolean"},"next_action":{"type":"string"}},"required":["ok","project_id","dsn_prefix","parsed_project_id","stored_for_recovery"],"additionalProperties":false},"examples":{"default":{"value":{"ok":true,"project_id":"string","dsn_prefix":"string","parsed_project_id":"string","stored_for_recovery":true,"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/dsn/rotate":{"post":{"summary":"Rotate project DSN","description":"Owner-only. Explicitly invalidates the old project DSN and returns a new AGENTRY_DSN for future ingest. Inviting members or owners never calls this.","tags":["Projects"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false},"examples":{"default":{"value":{}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"dsn":{"type":"string"},"dsn_recoverable":{"type":"boolean"},"logs_url":{"type":"string"},"analytics_url":{"type":"string"},"deploys_url":{"type":"string"},"deploys_note":{"type":"string"},"next_action":{"type":"string"}},"required":["id","name","dsn","dsn_recoverable"],"additionalProperties":false},"examples":{"default":{"value":{"id":"string","name":"string","dsn":"string","dsn_recoverable":true,"logs_url":"string","analytics_url":"string","deploys_url":"string","deploys_note":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/posthog/provision":{"post":{"summary":"Provision or repair PostHog analytics backing","tags":["Projects"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false},"examples":{"default":{"value":{}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"team_id":{"type":"integer"},"web_ui_url":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"team_id":1,"web_ui_url":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/logs/":{"post":{"summary":"Ingest log or error with project resolved from DSN","tags":["Ingest"],"security":[{"DsnAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LogIngestRequest"},"examples":{"default":{"value":{"level":"error","message":"Checkout failed","environment":"production","release":"web@1.2.3","user":{"id":"user_123"},"tags":{"surface":"checkout"},"extra":{"order_id":"ord_123"}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestAcceptedResponse"},"examples":{"default":{"value":{}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/analytics/":{"post":{"summary":"Ingest analytics event with project resolved from DSN","tags":["Ingest"],"security":[{"DsnAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsIngestRequest"},"examples":{"default":{"value":{"event":"signup_completed","distinct_id":"user_123","properties":{"plan":"pro","source":"docs"}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsAcceptedResponse"},"examples":{"default":{"value":{}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/analytics/browser-config":{"get":{"summary":"Fetch browser analytics/replay config with project resolved from DSN","description":"Browser helper bootstrap endpoint. Client apps pass the same AGENTRY_DSN used for /v1/logs/ and /v1/analytics/; Agentry resolves project-scoped recorder config server-side. Do not ask users to configure a separate PostHog browser token.","tags":["Ingest"],"security":[{"DsnAuth":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"replay":{"type":"object","properties":{"enabled":{"type":"boolean"},"provider":{"type":"string"},"token":{"type":"string"},"api_host":{"type":"string"},"reason":{"type":"string"}},"required":["enabled","provider"],"additionalProperties":true},"next_action":{"type":"string"}},"required":["ok","replay","next_action"],"additionalProperties":true},"examples":{"default":{"value":{"ok":true,"replay":{"enabled":true,"provider":"string","token":"string","api_host":"string","reason":"string"},"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/deploys/":{"post":{"summary":"Record deploy with project resolved from DSN","description":"Record one deploy after a real successful deploy from CI, a provider deploy hook, or a release script. Do not call this from app startup, instrumentation/register/bootstrap hooks, cron routes, workers, request handlers, browser/client code, or product flows.","tags":["Ingest"],"security":[{"DsnAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeployIngestRequest"},"examples":{"default":{"value":{"version":"web@1.2.3","environment":"production","sha":"abc123def456","branch":"main","message":"Deploy web@1.2.3"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeployAcceptedResponse"},"examples":{"default":{"value":{}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/cases/{case_id}/runs":{"post":{"summary":"Record agent investigation run","tags":["Cases"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/caseId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["pr_opened","escalated","marked_spurious","failed"]},"summary_md":{"type":"string"},"pr_url":{"type":"string"}},"required":["status"],"additionalProperties":false},"examples":{"default":{"value":{"status":"pr_opened","summary_md":"string","pr_url":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"case_id":{"type":"string"},"status":{"type":"string","enum":["pr_opened","escalated","marked_spurious","failed"]},"next_action":{"type":"string"}},"required":["id","case_id","status"],"additionalProperties":false},"examples":{"default":{"value":{"id":"string","case_id":"string","status":"pr_opened","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/cases/{case_id}/unmangle":{"post":{"summary":"Unmangle a case's stack trace using stored sourcemaps","tags":["Cases"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/caseId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false},"examples":{"default":{"value":{}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"case_id":{"type":"string"},"release_id":{"type":"string"},"total_frames":{"type":"number"},"resolved_count":{"type":"number"},"unmapped_source_urls":{"type":"array","items":{"type":"string"}},"frames":{"type":"array","items":{"type":"object","additionalProperties":true}},"next_action":{"type":"string"}},"required":["case_id","release_id","frames"],"additionalProperties":false},"examples":{"default":{"value":{"case_id":"string","release_id":"string","total_frames":1,"resolved_count":1,"unmapped_source_urls":["string"],"frames":[{}],"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/cases/{case_id}/users":{"get":{"summary":"List users affected by a case","tags":["Users"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/caseId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"case_id":{"type":"string"},"users":{"type":"array","items":{"type":"object","properties":{"user_id":{"type":"string"},"user_email":{"oneOf":[{"type":"string"},{"type":"null"}]},"error_count":{"type":"integer"},"distinct_fingerprints":{"type":"integer"},"last_seen_at":{"type":"integer"}},"additionalProperties":false}},"next_action":{"type":"string"}},"required":["case_id","users"],"additionalProperties":false},"examples":{"default":{"value":{"case_id":"string","users":[{"user_id":"string","user_email":{},"error_count":1,"distinct_fingerprints":1,"last_seen_at":1}],"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/users":{"get":{"summary":"List top users by error count","tags":["Users"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"days","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"project_id":{"type":"string"},"window_days":{"type":"integer"},"unique_users":{"type":"integer"},"total_events":{"type":"integer"},"users":{"type":"array","items":{"type":"object","properties":{"user_id":{"type":"string"},"user_email":{"oneOf":[{"type":"string"},{"type":"null"}]},"error_count":{"type":"integer"},"distinct_fingerprints":{"type":"integer"},"last_seen_at":{"type":"integer"}},"additionalProperties":false}},"next_action":{"type":"string"}},"required":["project_id","users"],"additionalProperties":false},"examples":{"default":{"value":{"project_id":"string","window_days":1,"unique_users":1,"total_events":1,"users":[{"user_id":"string","user_email":{},"error_count":1,"distinct_fingerprints":1,"last_seen_at":1}],"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/users/{distinct_id}/summary":{"get":{"summary":"Get distinct_id dossier","tags":["Users"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"distinct_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"project_id":{"type":"string"},"distinct_id":{"type":"string"},"person":{"type":"object","additionalProperties":true},"event_stats":{"type":"object","additionalProperties":true},"recent_events":{"type":"array","items":{"type":"object","additionalProperties":true}},"recent_recordings":{"type":"array","items":{"type":"object","additionalProperties":true}},"web_ui_url":{"type":"string"},"next_action":{"type":"string"}},"required":["project_id","distinct_id"],"additionalProperties":false},"examples":{"default":{"value":{"project_id":"string","distinct_id":"string","person":{},"event_stats":{},"recent_events":[{}],"recent_recordings":[{}],"web_ui_url":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/suppressions":{"get":{"summary":"List suppressions","tags":["Suppressions"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"suppressions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"fingerprint_pattern":{"type":"string"},"action":{"type":"string","enum":["auto_ignore","auto_resolve","prompt_hint"]},"reason":{"oneOf":[{"type":"string"},{"type":"null"}]},"hint_text":{"oneOf":[{"type":"string"},{"type":"null"}]},"created_at":{"type":"integer"}},"required":["id","fingerprint_pattern","action"],"additionalProperties":false}},"next_action":{"type":"string"}},"required":["suppressions"],"additionalProperties":false},"examples":{"default":{"value":{"suppressions":[{"id":"string","fingerprint_pattern":"string","action":"auto_ignore","reason":{},"hint_text":{},"created_at":1}],"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}},"post":{"summary":"Create suppression","tags":["Suppressions"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"fingerprint_pattern":{"type":"string"},"action":{"type":"string","enum":["auto_ignore","auto_resolve","prompt_hint"]},"reason":{"type":"string"},"hint_text":{"type":"string"}},"required":["fingerprint_pattern","action"],"additionalProperties":false},"examples":{"default":{"value":{"fingerprint_pattern":"string","action":"auto_ignore","reason":"string","hint_text":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"project_id":{"type":"string"},"fingerprint_pattern":{"type":"string"},"action":{"type":"string","enum":["auto_ignore","auto_resolve","prompt_hint"]},"next_action":{"type":"string"}},"required":["id","project_id","fingerprint_pattern","action"],"additionalProperties":false},"examples":{"default":{"value":{"id":"string","project_id":"string","fingerprint_pattern":"string","action":"auto_ignore","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/next-steps":{"get":{"summary":"Get suggested next steps","tags":["Projects"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"project_state":{"type":"object","properties":{"signal_types":{"type":"array","items":{"type":"string"}},"analytics_scope":{"type":"boolean"},"errors_scope":{"type":"boolean"},"deploys_scope":{"type":"boolean"},"analytics_configured":{"type":"boolean"},"has_events":{"type":"boolean"},"has_cases":{"type":"boolean"},"has_deploys":{"type":"boolean"},"install_verified":{"type":"boolean"},"minimum_install_complete":{"type":"boolean"},"readiness_complete":{"type":"boolean"},"answer_ready":{"type":"boolean"},"readiness_gaps_count":{"type":"integer"},"blocked_answer_contract_count":{"type":"integer"},"pending_real_data_count":{"type":"integer"}},"additionalProperties":true},"count":{"type":"integer"},"suggestions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"prompt_template":{"type":"string"},"uses":{"type":"array","items":{"type":"string"}},"estimated_seconds":{"type":"integer"},"requires":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["available","preview","coming_soon"]}},"required":["id","title","description","prompt_template","uses","estimated_seconds","requires"],"additionalProperties":true}},"next_action":{"type":"string"}},"required":["project_state","count","suggestions"],"additionalProperties":false},"examples":{"default":{"value":{"project_state":{"signal_types":["string"],"analytics_scope":true,"errors_scope":true,"deploys_scope":true,"analytics_configured":true,"has_events":true,"has_cases":true,"has_deploys":true,"install_verified":true,"minimum_install_complete":true,"readiness_complete":true,"answer_ready":true,"readiness_gaps_count":1,"blocked_answer_contract_count":1,"pending_real_data_count":1},"count":1,"suggestions":[{"id":"string","title":"string","description":"string","prompt_template":"string","uses":[{}],"estimated_seconds":1,"requires":[{}],"status":"available"}],"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/health":{"get":{"summary":"Get project health","tags":["Projects"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"project_id":{"type":"string"},"last_event_received_at":{"oneOf":[{"type":"integer"},{"type":"null"}]},"last_deploy_at":{"oneOf":[{"type":"integer"},{"type":"null"}]},"seconds_since_last_event":{"oneOf":[{"type":"integer"},{"type":"null"}]},"open_cases":{"type":"integer"},"events_last_hour":{"type":"integer"},"usage_this_month":{"type":"object","additionalProperties":true},"webhooks":{"type":"array","items":{"type":"object","additionalProperties":true}},"billing_notice":{"type":"object","additionalProperties":true},"next_action":{"type":"string"}},"required":["project_id"],"additionalProperties":true},"examples":{"default":{"value":{"project_id":"string","last_event_received_at":1,"last_deploy_at":1,"seconds_since_last_event":1,"open_cases":1,"events_last_hour":1,"usage_this_month":{},"webhooks":[{}],"billing_notice":{},"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/usage":{"get":{"summary":"Get current account usage","tags":["Usage"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"name":"period","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"period":{"type":"string"},"plan":{"type":"string"},"plan_name":{"type":"string"},"monthly_event_cap":{"type":"integer"},"retention_days":{"type":"integer"},"total_events":{"type":"integer"},"pct_of_plan":{"type":"integer"},"breakdown":{"type":"object","properties":{"errors":{"type":"integer"},"analytics":{"type":"integer"},"deploys":{"type":"integer"}},"additionalProperties":false},"quota":{"type":"object","additionalProperties":true},"upgrade":{"type":"object","additionalProperties":true},"billing_notice":{"type":"object","additionalProperties":true},"next_action":{"type":"string"}},"required":["period","plan","total_events","breakdown"],"additionalProperties":false},"examples":{"default":{"value":{"period":"string","plan":"string","plan_name":"string","monthly_event_cap":1,"retention_days":1,"total_events":1,"pct_of_plan":1,"breakdown":{"errors":1,"analytics":1,"deploys":1},"quota":{},"upgrade":{},"billing_notice":{},"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/usage/history":{"get":{"summary":"Get account usage history","tags":["Usage"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"days":{"type":"integer"},"snapshots":{"type":"array","items":{"type":"object","additionalProperties":true}}},"required":["days","snapshots"],"additionalProperties":false},"examples":{"default":{"value":{"days":1,"snapshots":[{}]}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/billing/status":{"get":{"summary":"Get billing and quota status","tags":["Billing"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"name":"period","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"user_id":{"type":"string"},"period":{"type":"string"},"plan":{"type":"string"},"plan_name":{"type":"string"},"price_cents":{"type":"integer"},"monthly_event_cap":{"type":"integer"},"retention_days":{"type":"integer"},"billing":{"type":"object","additionalProperties":true},"usage":{"type":"object","additionalProperties":true},"quota":{"type":"object","additionalProperties":true},"upgrade":{"type":"object","additionalProperties":true},"billing_notice":{"type":"object","additionalProperties":true},"next_action":{"type":"string"}},"required":["user_id","period","plan","billing","usage","quota","upgrade"],"additionalProperties":false},"examples":{"default":{"value":{"user_id":"string","period":"string","plan":"string","plan_name":"string","price_cents":1,"monthly_event_cap":1,"retention_days":1,"billing":{},"usage":{},"quota":{},"upgrade":{},"billing_notice":{},"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/billing/checkout":{"post":{"summary":"Create Stripe Checkout session","tags":["Billing"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"plan":{"type":"string","enum":["pro","scale"]},"success_url":{"type":"string"},"cancel_url":{"type":"string"}},"required":["plan"],"additionalProperties":false},"examples":{"default":{"value":{"plan":"pro","success_url":"string","cancel_url":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"checkout_url":{"type":"string"},"session_id":{"type":"string"},"plan":{"type":"string","enum":["pro","scale"]},"price_id":{"type":"string"},"next_action":{"type":"string"}},"required":["checkout_url","session_id","plan"],"additionalProperties":false},"examples":{"default":{"value":{"checkout_url":"string","session_id":"string","plan":"pro","price_id":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/billing/portal":{"post":{"summary":"Create Stripe customer portal session","tags":["Billing"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"return_url":{"type":"string"}},"additionalProperties":false},"examples":{"default":{"value":{"return_url":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"session_id":{"type":"string"},"next_action":{"type":"string"}},"required":["url","session_id"],"additionalProperties":false},"examples":{"default":{"value":{"url":"string","session_id":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/billing/webhook":{"post":{"summary":"Receive Stripe billing webhook","description":"Stripe-signed webhook for checkout.session.completed and customer.subscription.* events. This endpoint uses the Stripe-Signature header, not API-key auth.","tags":["Billing"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true},"examples":{"default":{"value":{}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"received":{"type":"boolean"},"event_id":{"oneOf":[{"type":"string"},{"type":"null"}]},"event_type":{"oneOf":[{"type":"string"},{"type":"null"}]},"handled":{"type":"boolean"},"user_id":{"oneOf":[{"type":"string"},{"type":"null"}]},"plan":{"oneOf":[{"type":"string"},{"type":"null"}]},"billing_status":{"oneOf":[{"type":"string"},{"type":"null"}]},"next_action":{"type":"string"}},"required":["received","handled"],"additionalProperties":false},"examples":{"default":{"value":{"received":true,"event_id":"string","event_type":"string","handled":true,"user_id":"string","plan":"string","billing_status":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/audit/recent":{"get":{"summary":"Get recent audit log entries","tags":["Audit"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"name":"hours","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"hours":{"type":"number"},"since":{"type":"integer"},"count":{"type":"integer"},"actions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"at":{"type":"integer"},"action":{"type":"string"},"resource_type":{"type":"string"},"resource_id":{"oneOf":[{"type":"string"},{"type":"null"}]},"project_id":{"oneOf":[{"type":"string"},{"type":"null"}]},"summary":{"oneOf":[{"type":"string"},{"type":"null"}]},"ip":{"oneOf":[{"type":"string"},{"type":"null"}]},"ua":{"oneOf":[{"type":"string"},{"type":"null"}]},"metadata":{"type":"object","additionalProperties":true}},"additionalProperties":true}},"next_action":{"type":"string"}},"required":["hours","since","count","actions"],"additionalProperties":false},"examples":{"default":{"value":{"hours":1,"since":1,"count":1,"actions":[{"id":"string","at":1,"action":"string","resource_type":"string","resource_id":{},"project_id":{},"summary":{},"ip":{},"ua":{},"metadata":{}}],"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/feedback":{"get":{"summary":"List feedback","tags":["Feedback"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"resolved","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"kind","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"},"feedback":{"type":"array","items":{"type":"object","additionalProperties":true}},"next_action":{"type":"string"}},"required":["count","feedback"],"additionalProperties":false},"examples":{"default":{"value":{"count":1,"feedback":[{}],"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}},"post":{"summary":"Send feedback","tags":["Feedback"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"kind":{"type":"string","enum":["missing_feature","bug","agent_discovered_bug","ux_friction","answer_contract_proposal","other"]},"project_id":{"type":"string"},"agent_note":{"type":"string"},"tool_name":{"type":"string"},"attempt_count":{"type":"number"},"fingerprint":{"type":"string"},"claude_session_id":{"type":"string"}},"required":["message"],"additionalProperties":false},"examples":{"default":{"value":{"message":"string","kind":"missing_feature","project_id":"string","agent_note":"string","tool_name":"string","attempt_count":1,"fingerprint":"string","claude_session_id":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"received_at":{"type":"integer"},"fingerprint":{"oneOf":[{"type":"string"},{"type":"null"}]},"deduped":{"type":"boolean"},"next_action":{"type":"string"}},"required":["id","received_at"],"additionalProperties":false},"examples":{"default":{"value":{"id":"string","received_at":1,"fingerprint":"string","deduped":true,"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/webhooks":{"get":{"summary":"List webhooks","tags":["Webhooks"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"webhooks":{"type":"array","items":{"type":"object","additionalProperties":true}},"next_action":{"type":"string"}},"required":["webhooks"],"additionalProperties":false},"examples":{"default":{"value":{"webhooks":[{}],"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}},"post":{"summary":"Register webhook","tags":["Webhooks"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"description":{"type":"string"}},"required":["url","events"],"additionalProperties":false},"examples":{"default":{"value":{"url":"string","events":["string"],"description":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"signing_secret":{"type":"string"},"signing_secret_prefix":{"type":"string"},"next_action":{"type":"string"}},"required":["id","url","events"],"additionalProperties":false},"examples":{"default":{"value":{"id":"string","url":"string","events":["string"],"signing_secret":"string","signing_secret_prefix":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/webhooks/{id}":{"delete":{"summary":"Delete webhook","tags":["Webhooks"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"id":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"ok":true,"id":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/webhooks/{id}/test":{"post":{"summary":"Send test webhook delivery","tags":["Webhooks"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false},"examples":{"default":{"value":{}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"id":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"ok":true,"id":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/alerts":{"get":{"summary":"List alerts","tags":["Alerts"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"alerts":{"type":"array","items":{"type":"object","additionalProperties":true}},"next_action":{"type":"string"}},"required":["alerts"],"additionalProperties":false},"examples":{"default":{"value":{"alerts":[{}],"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}},"post":{"summary":"Create alert","tags":["Alerts"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"blueprint_id":{"type":"string"},"threshold_column":{"type":"string"},"threshold_op":{"type":"string","enum":["gt","gte","lt","lte","eq"]},"threshold_value":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]},"params":{"type":"object","additionalProperties":true},"description":{"type":"string"},"webhook_id":{"type":"string"}},"required":["name","blueprint_id","threshold_column","threshold_op","threshold_value"],"additionalProperties":false},"examples":{"default":{"value":{"name":"string","blueprint_id":"string","threshold_column":"string","threshold_op":"gt","threshold_value":"string","params":{},"description":"string","webhook_id":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"blueprint_id":{"type":"string"},"next_action":{"type":"string"}},"required":["id","name","blueprint_id"],"additionalProperties":true},"examples":{"default":{"value":{"id":"string","name":"string","blueprint_id":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/alerts/{id}":{"delete":{"summary":"Delete alert","tags":["Alerts"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"id":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"ok":true,"id":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/alerts/{id}/evaluate":{"post":{"summary":"Evaluate alert","tags":["Alerts"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false},"examples":{"default":{"value":{}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"alert_id":{"type":"string"},"blueprint_id":{"type":"string"},"evaluated_at":{"type":"integer"},"triggered":{"type":"boolean"},"current_value":{"oneOf":[{"type":"number"},{"type":"string"},{"type":"null"}]},"threshold":{"type":"object","additionalProperties":true},"transition_event":{"oneOf":[{"type":"string"},{"type":"null"}]},"rows_count":{"type":"integer"},"next_action":{"type":"string"}},"required":["alert_id","blueprint_id","triggered","current_value","rows_count"],"additionalProperties":true},"examples":{"default":{"value":{"alert_id":"string","blueprint_id":"string","evaluated_at":1,"triggered":true,"current_value":1,"threshold":{},"transition_event":"string","rows_count":1,"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/sourcemaps/{project_id}/":{"get":{"summary":"List sourcemaps","tags":["Sourcemaps"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"release_id","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"project_id":{"type":"string"},"count":{"type":"integer"},"sourcemaps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"project_id":{"type":"string"},"release_id":{"type":"string"},"source_url":{"type":"string"},"size_bytes":{"type":"integer"},"uploaded_at":{"type":"integer"}},"additionalProperties":true}},"next_action":{"type":"string"}},"required":["project_id","sourcemaps"],"additionalProperties":false},"examples":{"default":{"value":{"project_id":"string","count":1,"sourcemaps":[{"id":"string","project_id":"string","release_id":"string","source_url":"string","size_bytes":1,"uploaded_at":1}],"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}},"post":{"summary":"Upload sourcemap JSON","tags":["Sourcemaps"],"security":[{"DsnAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"release_id","in":"query","required":false,"schema":{"type":"string"}},{"name":"source_url","in":"query","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true},"examples":{"default":{"value":{}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"project_id":{"type":"string"},"release_id":{"type":"string"},"source_url":{"type":"string"},"size_bytes":{"type":"integer"},"uploaded_at":{"type":"integer"}},"additionalProperties":true},"examples":{"default":{"value":{"id":"string","project_id":"string","release_id":"string","source_url":"string","size_bytes":1,"uploaded_at":1}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}},"delete":{"summary":"Delete sourcemaps for a release","tags":["Sourcemaps"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"release_id","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"project_id":{"type":"string"},"release_id":{"type":"string"},"deleted":{"type":"integer"},"next_action":{"type":"string"}},"required":["project_id","deleted"],"additionalProperties":false},"examples":{"default":{"value":{"project_id":"string","release_id":"string","deleted":1,"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/sourcemaps/{project_id}/blob/":{"get":{"summary":"Fetch raw sourcemap blob","tags":["Sourcemaps"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"release_id","in":"query","required":false,"schema":{"type":"string"}},{"name":"source_url","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Raw sourcemap JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":true},"examples":{"default":{"value":{"version":3,"sources":["src/app.ts"],"mappings":""}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/public-queries":{"get":{"summary":"List public query publications","tags":["Public Queries"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"project_id":{"type":"string"},"count":{"type":"integer"},"publications":{"type":"array","items":{"type":"object","additionalProperties":true}},"next_action":{"type":"string"}},"required":["project_id","publications"],"additionalProperties":false},"examples":{"default":{"value":{"project_id":"string","count":1,"publications":[{}],"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}},"post":{"summary":"Publish a query blueprint","tags":["Public Queries"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"blueprint_id":{"type":"string"},"params":{"type":"object","additionalProperties":true},"description":{"type":"string"}},"required":["blueprint_id"],"additionalProperties":false},"examples":{"default":{"value":{"blueprint_id":"string","params":{},"description":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"project_id":{"type":"string"},"blueprint_id":{"type":"string"},"params":{"type":"object","additionalProperties":true},"description":{"oneOf":[{"type":"string"},{"type":"null"}]},"public_url":{"type":"string"},"next_action":{"type":"string"}},"required":["id","project_id","blueprint_id","public_url"],"additionalProperties":false},"examples":{"default":{"value":{"id":"string","project_id":"string","blueprint_id":"string","params":{},"description":"string","public_url":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/public-queries/{publication_id}":{"delete":{"summary":"Revoke public query publication","tags":["Public Queries"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"publication_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"revoked":{"type":"boolean"},"next_action":{"type":"string"}},"required":["id","revoked"],"additionalProperties":false},"examples":{"default":{"value":{"id":"string","revoked":true,"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/public/q/{publication_id}":{"get":{"summary":"Execute public query publication","tags":["Public Queries"],"parameters":[{"name":"publication_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"key","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"publication_id":{"type":"string"},"blueprint_id":{"type":"string"},"title":{"type":"string"},"description":{"oneOf":[{"type":"string"},{"type":"null"}]},"rows":{"type":"array","items":{"type":"object","additionalProperties":true}},"columns":{"type":"array","items":{"type":"string"}},"types":{"oneOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"row_count":{"type":"integer"},"freshness":{"type":"object","properties":{"source":{"type":"string"},"consistency":{"type":"string"},"cache_bust":{"type":"boolean"},"queried_at":{"type":"string"},"query_duration_ms":{"type":"integer"},"retry_after_ms":{"type":"integer"},"status":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":false},"render_hint":{"type":"object","additionalProperties":true},"next_action":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"publication_id":"pub_example","blueprint_id":"active_users_daily","title":"Active users by day","description":"Browser-safe daily active users","rows":[{"day":"2026-06-14","dau":42}],"columns":["day","dau"],"types":["Date","UInt64"],"row_count":1,"freshness":{"source":"posthog_hogql","consistency":"eventual","cache_bust":true,"queried_at":"2026-06-16T10:00:00.000Z","query_duration_ms":832,"retry_after_ms":30000,"status":"complete_for_query_time","next_action":"Freshly ingested analytics can take a short time to appear; re-fetch recent public-query reads before making customer-facing claims."},"render_hint":{"type":"line","x":"day","y":"dau"},"next_action":"Consume rows as the canonical object-shaped result set. Columns is metadata for display order. Check freshness before treating recent empty or partial rows as final."}}}}}},"410":{"description":"Publication revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/posthog/session-replay/configure":{"post":{"summary":"Configure session replay","tags":["PostHog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"strategy":{"type":"string","enum":["off","all","sampled","url_scoped","errors_only"]},"sample_rate":{"type":"number"},"retention_days":{"type":"number"},"url_triggers":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"matching":{"type":"string","enum":["exact","regex"]}},"required":["url"],"additionalProperties":false}},"min_duration_ms":{"type":"number"}},"required":["strategy"],"additionalProperties":false},"examples":{"default":{"value":{"strategy":"off","sample_rate":1,"retention_days":1,"url_triggers":[{"url":"string","matching":"exact"}],"min_duration_ms":1}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"team_id":{"type":"integer"},"strategy":{"type":"string","enum":["off","all","sampled","url_scoped","errors_only"]},"settings":{"type":"object","properties":{"session_recording_opt_in":{"type":"boolean"},"session_recording_sample_rate":{"type":"string"},"session_recording_retention_period":{"type":"string"},"session_recording_minimum_duration_milliseconds":{"type":"integer"},"session_recording_url_trigger_config":{"type":"array","items":{"type":"object","additionalProperties":true}}},"additionalProperties":true},"next_action":{"type":"string"}},"required":["team_id","strategy","settings","next_action"],"additionalProperties":false},"examples":{"default":{"value":{"team_id":1,"strategy":"off","settings":{"session_recording_opt_in":true,"session_recording_sample_rate":"string","session_recording_retention_period":"string","session_recording_minimum_duration_milliseconds":1,"session_recording_url_trigger_config":[{}]},"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/posthog/session-replay/status":{"get":{"summary":"Get session replay status","tags":["PostHog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"team_id":{"type":"integer"},"session_recording_opt_in":{"type":"boolean"},"session_recording_sample_rate":{"type":"string"},"session_recording_retention_period":{"type":"string"},"session_recording_minimum_duration_milliseconds":{"type":"integer"},"session_recording_url_trigger_config":{"type":"array","items":{"type":"object","additionalProperties":true}},"web_ui_url":{"type":"string"},"next_action":{"type":"string"}},"required":["team_id","session_recording_opt_in","web_ui_url","next_action"],"additionalProperties":true},"examples":{"default":{"value":{"team_id":1,"session_recording_opt_in":true,"session_recording_sample_rate":"string","session_recording_retention_period":"string","session_recording_minimum_duration_milliseconds":1,"session_recording_url_trigger_config":[{}],"web_ui_url":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/feature-flags":{"get":{"summary":"List feature flags","tags":["PostHog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"team_id":{"type":"integer"},"web_ui_url":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"team_id":1,"web_ui_url":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}},"post":{"summary":"Create feature flag","tags":["PostHog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"active":{"type":"boolean"},"rollout_percentage":{"type":"number"},"filters":{"type":"object","additionalProperties":true}},"required":["key"],"additionalProperties":false},"examples":{"default":{"value":{"key":"string","name":"string","active":true,"rollout_percentage":1,"filters":{}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"team_id":{"type":"integer"},"web_ui_url":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"team_id":1,"web_ui_url":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/feature-flags/{flag_id}":{"get":{"summary":"Get feature flag","tags":["PostHog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"flag_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"team_id":{"type":"integer"},"web_ui_url":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"team_id":1,"web_ui_url":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}},"patch":{"summary":"Update feature flag","tags":["PostHog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"flag_id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"active":{"type":"boolean"},"name":{"type":"string"},"filters":{"type":"object","additionalProperties":true},"rollout_percentage":{"type":"number"}},"additionalProperties":false},"examples":{"default":{"value":{"active":true,"name":"string","filters":{},"rollout_percentage":1}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"team_id":{"type":"integer"},"web_ui_url":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"team_id":1,"web_ui_url":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}},"delete":{"summary":"Soft-delete feature flag","tags":["PostHog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"flag_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"team_id":{"type":"integer"},"web_ui_url":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"team_id":1,"web_ui_url":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/feature-flags/evaluate":{"post":{"summary":"Evaluate feature flag(s) for a user","tags":["PostHog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"distinct_id":{"type":"string"},"key":{"type":"string"},"person_properties":{"type":"object","additionalProperties":true},"groups":{"type":"object","additionalProperties":true}},"required":["distinct_id"],"additionalProperties":false},"examples":{"default":{"value":{"distinct_id":"string","key":"string","person_properties":{},"groups":{}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"team_id":{"type":"integer"},"web_ui_url":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"team_id":1,"web_ui_url":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/cohorts":{"get":{"summary":"List cohorts","tags":["PostHog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"team_id":{"type":"integer"},"web_ui_url":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"team_id":1,"web_ui_url":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}},"post":{"summary":"Create cohort","tags":["PostHog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"event":{"type":"string"},"days":{"type":"number"},"groups":{"type":"array","items":{"type":"object","additionalProperties":true}}},"required":["name"],"additionalProperties":false},"examples":{"default":{"value":{"name":"string","event":"string","days":1,"groups":[{}]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"team_id":{"type":"integer"},"web_ui_url":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"team_id":1,"web_ui_url":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/cohorts/{cohort_id}":{"get":{"summary":"Get cohort","tags":["PostHog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"cohort_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"team_id":{"type":"integer"},"web_ui_url":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"team_id":1,"web_ui_url":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}},"delete":{"summary":"Soft-delete cohort","tags":["PostHog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"cohort_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"team_id":{"type":"integer"},"web_ui_url":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"team_id":1,"web_ui_url":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/surveys":{"get":{"summary":"List surveys","tags":["PostHog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"team_id":{"type":"integer"},"web_ui_url":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"team_id":1,"web_ui_url":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}},"post":{"summary":"Create survey","tags":["PostHog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"questions":{"type":"array","items":{"type":"object","additionalProperties":true}},"question":{"type":"string"},"question_type":{"type":"string"},"description":{"type":"string"},"linked_flag_id":{"type":"string"},"targeting_flag_id":{"type":"string"},"conditions":{"type":"object","additionalProperties":true},"appearance":{"type":"object","additionalProperties":true},"start_date":{"type":"string"}},"required":["name"],"additionalProperties":false},"examples":{"default":{"value":{"name":"string","type":"string","questions":[{}],"question":"string","question_type":"string","description":"string","linked_flag_id":"string","targeting_flag_id":"string","conditions":{},"appearance":{},"start_date":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"team_id":{"type":"integer"},"web_ui_url":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"team_id":1,"web_ui_url":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/surveys/{survey_id}":{"get":{"summary":"Get survey","tags":["PostHog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"survey_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"team_id":{"type":"integer"},"web_ui_url":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"team_id":1,"web_ui_url":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}},"delete":{"summary":"Delete survey","tags":["PostHog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"survey_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"team_id":{"type":"integer"},"web_ui_url":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"team_id":1,"web_ui_url":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/surveys/{survey_id}/responses":{"get":{"summary":"Get survey response rollup","tags":["PostHog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"survey_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"team_id":{"type":"integer"},"web_ui_url":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"team_id":1,"web_ui_url":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/session-replays":{"get":{"summary":"List session replays","tags":["PostHog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"distinct_id","in":"query","required":false,"schema":{"type":"string"}},{"name":"date_from","in":"query","required":false,"schema":{"type":"string"}},{"name":"date_to","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"team_id":{"type":"integer"},"recordings":{"type":"array","items":{"type":"object","additionalProperties":true}},"has_next":{"type":"boolean"},"web_ui_url":{"type":"string"},"next_action":{"type":"string"}},"required":["team_id","recordings","has_next","web_ui_url","next_action"],"additionalProperties":false},"examples":{"default":{"value":{"team_id":1,"recordings":[{}],"has_next":true,"web_ui_url":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/session-replays/{replay_id}":{"get":{"summary":"Get session replay","tags":["PostHog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"replay_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"team_id":{"type":"integer"},"recording":{"type":"object","additionalProperties":true},"player_url":{"type":"string"},"next_action":{"type":"string"}},"required":["team_id","recording","player_url","next_action"],"additionalProperties":false},"examples":{"default":{"value":{"team_id":1,"recording":{},"player_url":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/session-replays/{replay_id}/snapshots":{"get":{"summary":"Get replay snapshots","tags":["PostHog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"replay_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"source","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"team_id":{"type":"integer"},"replay_id":{"type":"string"},"snapshots":{"oneOf":[{"type":"object","additionalProperties":true},{"type":"array","items":{"type":"object","additionalProperties":true}}]},"next_action":{"type":"string"}},"required":["team_id","replay_id","snapshots","next_action"],"additionalProperties":false},"examples":{"default":{"value":{"team_id":1,"replay_id":"string","snapshots":{},"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/ab-tests":{"post":{"summary":"Create A/B test","tags":["PostHog"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"flag_key":{"type":"string"},"success_event":{"type":"string"},"variants":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"rollout_percentage":{"type":"number"}},"required":["key"],"additionalProperties":false}}},"required":["name","success_event","variants"],"additionalProperties":false},"examples":{"default":{"value":{"name":"string","flag_key":"string","success_event":"string","variants":[{"key":"string","name":"string","rollout_percentage":1}]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"team_id":{"type":"integer"},"web_ui_url":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"team_id":1,"web_ui_url":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/invites":{"post":{"summary":"Create project invite","tags":["Invites"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"role":{"type":"string","enum":["owner","member"]}},"additionalProperties":false},"examples":{"default":{"value":{"email":"string","role":"owner"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"invite_id":{"type":"string"},"invite_url":{"type":"string"},"role":{"type":"string","enum":["owner","member"]},"expires_at":{"type":"integer"},"email":{"oneOf":[{"type":"string"},{"type":"null"}]},"next_action":{"type":"string"}},"required":["invite_id","invite_url","role","expires_at"],"additionalProperties":false},"examples":{"default":{"value":{"invite_id":"string","invite_url":"string","role":"owner","expires_at":1,"email":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/members":{"get":{"summary":"List project members","tags":["Invites"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"members":{"type":"array","items":{"type":"object","additionalProperties":true}},"pending_invites":{"type":"array","items":{"type":"object","additionalProperties":true}},"next_action":{"type":"string"}},"required":["members","pending_invites"],"additionalProperties":false},"examples":{"default":{"value":{"members":[{}],"pending_invites":[{}],"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/members/{userId}":{"delete":{"summary":"Remove project member","tags":["Invites"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"userId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"removed_user_id":{"type":"string"},"next_action":{"type":"string"}},"required":["status","removed_user_id"],"additionalProperties":false},"examples":{"default":{"value":{"status":"ok","removed_user_id":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/invites/{token}/preview":{"get":{"summary":"Preview invite","tags":["Invites"],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"project":{"type":"object","additionalProperties":true},"inviter":{"type":"object","additionalProperties":true},"role":{"type":"string","enum":["owner","member"]},"email":{"oneOf":[{"type":"string"},{"type":"null"}]},"expires_at":{"type":"integer"},"next_action":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"project":{},"inviter":{},"role":"owner","email":"string","expires_at":1,"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/invites/{token}/accept":{"post":{"summary":"Accept invite from hosted web app","tags":["Invites"],"security":[{"InternalTokenAuth":[]}],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"user_id":{"type":"string"}},"required":["user_id"],"additionalProperties":false},"examples":{"default":{"value":{"user_id":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"project_id":{"type":"string"},"role":{"type":"string","enum":["owner","member"]},"next_action":{"type":"string"}},"required":["status","project_id","role"],"additionalProperties":false},"examples":{"default":{"value":{"status":"ok","project_id":"string","role":"owner","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/admin/usage":{"get":{"summary":"Admin usage overview","tags":["Admin"],"security":[{"AdminTokenAuth":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":true},"examples":{"default":{"value":{}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/admin/usage/snapshots":{"get":{"summary":"Admin usage snapshots","tags":["Admin"],"security":[{"AdminTokenAuth":[]}],"parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":true},"examples":{"default":{"value":{}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/admin/usage/snapshot":{"post":{"summary":"Admin force usage snapshot","tags":["Admin"],"security":[{"AdminTokenAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false},"examples":{"default":{"value":{}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":true},"examples":{"default":{"value":{}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/admin/retention/sweep":{"post":{"summary":"Admin force retention sweep","tags":["Admin"],"security":[{"AdminTokenAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false},"examples":{"default":{"value":{}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":true},"examples":{"default":{"value":{}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/admin/usage/{user_id}":{"get":{"summary":"Admin usage by user","tags":["Admin"],"security":[{"AdminTokenAuth":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":true},"examples":{"default":{"value":{}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/admin/plans":{"get":{"summary":"Admin list plans","tags":["Admin"],"security":[{"AdminTokenAuth":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":true},"examples":{"default":{"value":{}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/admin/feedback":{"get":{"summary":"Admin agent feedback queue","tags":["Admin"],"security":[{"AdminTokenAuth":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"resolved","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"kind","in":"query","required":false,"schema":{"type":"string"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string"}},{"name":"project_id","in":"query","required":false,"schema":{"type":"string"}},{"name":"q","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":true},"examples":{"default":{"value":{}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/admin/users/{user_id}/plan":{"patch":{"summary":"Admin change user plan","tags":["Admin"],"security":[{"AdminTokenAuth":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"plan":{"type":"string","enum":["free","pro","scale"]}},"required":["plan"],"additionalProperties":false},"examples":{"default":{"value":{"plan":"free"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":true},"examples":{"default":{"value":{}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/auth/device":{"post":{"summary":"Start device authorization","tags":["Auth"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false},"examples":{"default":{"value":{}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceStartResponse"},"examples":{"default":{"value":{}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/auth/device/poll":{"post":{"summary":"Poll device authorization","tags":["Auth"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"device_code":{"type":"string"}},"required":["device_code"],"additionalProperties":false},"examples":{"default":{"value":{"device_code":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DevicePollResponse"},"examples":{"default":{"value":{}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/auth/keys/rotate":{"post":{"summary":"Rotate private API key","tags":["Auth"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false},"examples":{"default":{"value":{}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponse"},"examples":{"default":{"value":{}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/me":{"get":{"summary":"Get current authenticated user","tags":["Auth"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"}},"required":["id"],"additionalProperties":false},"api_key":{"type":"object","properties":{"id":{"type":"string"},"prefix":{"type":"string"},"kind":{"type":"string"}},"required":["id","prefix","kind"],"additionalProperties":false},"projects_url":{"type":"string"},"schema_url":{"type":"string"},"next_action":{"type":"string"}},"required":["user","api_key","projects_url","schema_url","next_action"],"additionalProperties":false},"examples":{"default":{"value":{"user":{"id":"string","email":"string"},"api_key":{"id":"string","prefix":"string","kind":"string"},"projects_url":"string","schema_url":"string","next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects":{"get":{"summary":"List projects","tags":["Projects"],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"projects":{"type":"array","items":{"$ref":"#/components/schemas/ProjectSummary"}}},"additionalProperties":false},"examples":{"default":{"value":{"projects":[{}]}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}},"post":{"summary":"Create project","tags":["Projects"],"security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProjectRequest"},"examples":{"default":{"value":{"name":"acme-web","repo_url":"https://github.com/acme/acme-web","default_branch":"main"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProjectResponse"},"examples":{"default":{"value":{"id":"018f0000-0000-7000-8000-000000000001","name":"acme-web","role":"owner","dsn":"agnt_018f0000-0000-7000-8000-000000000001.example","logs_url":"https://api.agentry.sh/v1/logs/","analytics_url":"https://api.agentry.sh/v1/analytics/","deploys_url":"https://api.agentry.sh/v1/deploys/","deploys_note":"Use deploys_url only from CI/provider post-deploy hooks after a successful deploy; never from app runtime.","dsn_recoverable":false,"dsn_recovery_state":"saving"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}":{"get":{"summary":"Get project","tags":["Projects"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectDetail"},"examples":{"default":{"value":{}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}},"delete":{"summary":"Delete project","description":"Deletes a project owned by the authenticated user. This revokes the project's DSN by removing the project row, cascades project-scoped Agentry metadata, and best-effort deletes sourcemap blobs before removing their index rows. Use this for disposable test/stress projects and explicit user cleanup.","tags":["Projects"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteProjectResponse"},"examples":{"default":{"value":{"id":"018f0000-0000-7000-8000-000000000001","deleted":true,"cleanup":{"sourcemaps":0,"sourcemap_blobs_deleted":0,"sourcemap_blob_warnings":0},"next_action":"Project deleted. Remove any repo-local .agentry/config.json binding that pointed here."}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/cases":{"get":{"summary":"List project cases","tags":["Cases"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"status","in":"query","required":false,"schema":{"$ref":"#/components/schemas/CaseStatus"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"cases":{"type":"array","items":{"$ref":"#/components/schemas/CaseSummary"}},"next_action":{"type":"string"}},"additionalProperties":false},"examples":{"default":{"value":{"cases":[{}],"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/cases/{case_id}":{"get":{"summary":"Get case detail","tags":["Cases"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/caseId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseDetail"},"examples":{"default":{"value":{}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}},"patch":{"summary":"Update case","tags":["Cases"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/caseId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCaseRequest"},"examples":{"default":{"value":{}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseDetail"},"examples":{"default":{"value":{}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/deploys":{"get":{"summary":"List deploys","tags":["Deploys"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200}},{"name":"since","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deploys":{"type":"array","items":{"$ref":"#/components/schemas/Deploy"}},"next_action":{"type":"string"}},"additionalProperties":false},"examples":{"default":{"value":{"deploys":[{}],"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/analytics/query":{"post":{"summary":"Run HogQL query","description":"Runs a PostHog/HogQL query through Agentry. This endpoint is for agents, CI, and server-only admin code. Client code that calls it must use a request timeout of at least 45 seconds; real HogQL queries commonly take 10-30 seconds. For dashboard code, run a small fixed set of visible-view queries in a bounded parallel batch and flatten related metrics into grouped queries. Avoid unbounded fan-out over dynamic users, rows, segments, or filter values. The response always includes canonical object-shaped rows; columns is metadata for display order. Do not read response.results; Agentry does not expose PostHog's internal results array on this agent-facing endpoint. Check freshness before treating recent empty or partial reads as final; PostHog-backed analytics is eventually consistent after ingest.","tags":["Analytics"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"query":{"type":"string"}},"required":["query"],"additionalProperties":false},"examples":{"default":{"value":{"query":"SELECT event, count() AS users FROM events WHERE (event NOT IN ('install.verify.synthetic', 'install.verify.http.synthetic') AND lower(ifNull(toString(properties['synthetic']), '')) NOT IN ('true', '1') AND lower(ifNull(toString(properties['agentry_rehearsal_event']), '')) NOT IN ('true', '1') AND lower(ifNull(toString(properties['agentry_test_event']), '')) NOT IN ('true', '1') AND lower(ifNull(toString(properties['test_event']), '')) NOT IN ('true', '1') AND lower(ifNull(toString(properties['source']), '')) NOT IN ('install_verify_http', 'direct_rehearsal_ingest', 'agentry_rehearsal', 'install_rehearsal', 'codex_rehearsal', 'test_ingest') AND lower(ifNull(toString(properties['event_source']), '')) NOT IN ('install_verify_http', 'direct_rehearsal_ingest', 'agentry_rehearsal', 'install_rehearsal', 'codex_rehearsal', 'test_ingest')) AND event IN ('signup_completed', 'subscription_started') AND timestamp >= now() - INTERVAL 30 DAY GROUP BY event ORDER BY users DESC"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"rows":{"type":"array","items":{"type":"object","additionalProperties":true},"description":"Canonical object-shaped result rows. Read response.rows; response.results is intentionally absent."},"columns":{"type":"array","items":{"type":"string"},"description":"Display-order metadata only. Do not zip this with a PostHog results array."},"types":{"oneOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"row_count":{"type":"integer"},"freshness":{"type":"object","properties":{"source":{"type":"string"},"consistency":{"type":"string"},"cache_bust":{"type":"boolean"},"queried_at":{"type":"string"},"query_duration_ms":{"type":"integer"},"retry_after_ms":{"type":"integer"},"status":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":false},"billing_notice":{"type":"object","additionalProperties":true},"next_action":{"type":"string"}},"additionalProperties":true},"examples":{"default":{"value":{"rows":[{"event":"signup_completed","users":42}],"columns":["event","users"],"types":["String","UInt64"],"row_count":1,"freshness":{"source":"posthog_hogql","consistency":"eventual","cache_bust":true,"queried_at":"2026-06-16T10:00:00.000Z","query_duration_ms":832,"retry_after_ms":30000,"status":"complete_for_query_time","next_action":"Freshly ingested analytics can take a short time to appear; re-query recent verification reads before making customer-facing claims."},"billing_notice":{"should_notify_human":false},"next_action":"Interpret response.rows as the canonical object-shaped result set. response.results is intentionally absent; fix clients that read results. Columns is metadata for ordering/display only. Check freshness before treating a recent empty or partial result as final."}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/install/contract":{"get":{"summary":"Get structured install contract","tags":["Install"],"parameters":[{"name":"surface","in":"query","required":false,"schema":{"type":"string","enum":["client","server","direct-http"]}},{"name":"framework","in":"query","required":false,"schema":{"type":"string"}},{"name":"signal_types","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstallContract"},"examples":{"default":{"value":{}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/install/plan":{"post":{"summary":"Plan install","tags":["Install"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstallPlanRequest"},"examples":{"default":{"value":{"framework":"next","surface":"server","shapes":["b2b-saas"],"has_revenue":true,"is_b2b":true,"is_two_sided":false,"discovery_map":{"product_summary":"Team workspace app with Stripe billing.","product_category":"B2B SaaS","metric_lens":"Activation, checkout conversion, paid subscription health, reliability, and deploy regressions.","primary_outcome":"Teams create workspaces, upgrade to paid plans, and keep using the product.","existing_live_events":[],"key_entities":["user","workspace","subscription"],"key_user_journeys":["visitor signs up","user creates workspace","workspace upgrades"],"ui_surfaces":["app/(marketing)/page.tsx signup CTA"],"api_surfaces":["app/api/billing/route.ts creates Stripe checkout sessions"],"async_surfaces":["app/api/stripe/webhook/route.ts receives Stripe events"],"admin_surfaces":[],"external_dependencies":["Stripe"],"monetization_surfaces":["app/api/billing/route.ts","app/api/stripe/webhook/route.ts"],"deploy_surfaces":["GitHub Actions workflow .github/workflows/deploy.yml"],"risky_failure_paths":["Stripe webhook failures can leave subscriptions stale"],"notes":["Cron jobs and app API routes are not deploy hooks."]}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstallPlanResponse"},"examples":{"default":{"value":{}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/signal-map":{"get":{"summary":"Get approved signal map","description":"Canonical project memory for day-to-day questions: approved business question, funnel/business flow, required events/properties, provider-satisfied events, answer contracts, post-setup handoff, and verify templates. Read this before picking query blueprints or writing HogQL.","tags":["Install"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignalMap"},"examples":{"default":{"value":{"project_id":"019exampleproject","artifact":"signal_map","contract_version":"2026-05-20","framework":"next","surface":"server","signal_types":["errors","analytics","deploys"],"shapes":["b2b-saas"],"approved_plan_hash":"plan_hash_123","approval_status":"approved","approved_events":["page_view","signup_completed","subscription_started"],"approved_event_properties":{"signup_completed":["source"],"subscription_started":["plan"]},"happy_path_funnel":[{"id":"entry","title":"Entry","goal":"Visitor starts signup","related_events":["page_view"]},{"id":"activation","title":"Activation","goal":"User creates a workspace","related_events":["signup_completed"]},{"id":"outcome","title":"Paid outcome","goal":"Workspace starts subscription","related_events":["subscription_started"]}],"questions_to_answer":[{"id":"trial_to_paid_by_source","question":"Which signup source produces paid workspaces?","why":"Guides acquisition spend.","covered_by_events":["signup_completed","subscription_started"]}],"post_setup_blueprint":{"target_route":"/agentry","question_readiness_plan":{"canonical_reads":["GET /v1/projects/:project_id/signal-map","GET /v1/projects/:project_id/verify-report","GET /v1/projects/:project_id/answer-contracts"],"classification":["Ready","Needs data","Needs instrumentation"]},"optional_ui_plan":{"default":"do_not_build","route_first":false}},"question_handoff":{"first_artifacts":["signal-map","verify-report","answer-contracts"],"suggested_sections":["Business question","Primary funnel","Readiness gaps"],"build_order":["prove readiness","query rows","optional report"]},"next_action":"Use this as the canonical business question, funnel, approved events/properties, and optional report handoff. Do not use query blueprint default events unless they match this signal map."}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}},"put":{"summary":"Save approved signal map","tags":["Install"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveSignalMapRequest"},"examples":{"default":{"value":{"contract_version":"2026-05-20","framework":"next","surface":"server","signal_types":["errors","analytics","deploys"],"shapes":["b2b-saas"],"approved_plan_hash":"plan_hash_123","approved_events":["page_view","signup_completed","subscription_started"],"approved_event_properties":{"signup_completed":["source"],"subscription_started":["plan"]},"discovery_map":{"product_summary":"Team workspace app with Stripe billing.","product_category":"B2B SaaS","metric_lens":"Activation, checkout conversion, paid subscription health, reliability, and deploy regressions.","primary_outcome":"Teams create workspaces, upgrade to paid plans, and keep using the product.","existing_live_events":[],"key_entities":["user","workspace","subscription"],"key_user_journeys":["visitor signs up","user creates workspace","workspace upgrades"],"ui_surfaces":["app/(marketing)/page.tsx signup CTA"],"api_surfaces":["app/api/billing/route.ts creates Stripe checkout sessions"],"async_surfaces":["app/api/stripe/webhook/route.ts receives Stripe events"],"admin_surfaces":[],"external_dependencies":["Stripe"],"monetization_surfaces":["app/api/billing/route.ts","app/api/stripe/webhook/route.ts"],"deploy_surfaces":["GitHub Actions workflow .github/workflows/deploy.yml"],"risky_failure_paths":["Stripe webhook failures can leave subscriptions stale"],"notes":["Cron jobs and app API routes are not deploy hooks."]},"event_buckets":[{"bucket":"activation","required_events":["signup_completed"],"missing_events":[]}],"happy_path_funnel":[{"id":"entry","title":"Entry","goal":"User starts","related_events":["page_view"]},{"id":"activation","title":"Activation","goal":"User signs up","related_events":["signup_completed"]},{"id":"outcome","title":"Outcome","goal":"User upgrades","related_events":["subscription_started"]}],"failure_surface_map":[{"id":"server_global_errors","title":"Global server errors","related_stage_ids":["activation"]}],"planned_wiring_map":[{"signal":"signup_completed","kind":"event","target_files":["app/(marketing)/page.tsx","app/api/signup/route.ts"],"target_surface":"signup flow","trigger":"When a visitor completes signup and creates a workspace.","key_properties":["source"],"notes":["Approved from POST /v1/install/plan."]},{"signal":"subscription_started","kind":"event","target_files":["app/api/stripe/webhook/route.ts"],"target_surface":"Stripe subscription webhook","trigger":"When the billing provider confirms an active subscription.","key_properties":["plan"],"notes":["Do not emit from checkout-session creation alone."]}],"answer_contracts":[{"id":"signup-funnel","state":"applicable","reason":"Matches the approved signup flow."}],"post_setup_blueprint":{"artifact":"post_setup_blueprint","target_route":"/agentry","question_readiness_plan":{"default_strategy":"Classify questions as Ready, Needs data, or Needs instrumentation from the saved signal map, verify report, answer contracts, event names, and event-property keys.","canonical_reads":["GET /v1/projects/:project_id/signal-map","GET /v1/projects/:project_id/verify-report","GET /v1/projects/:project_id/answer-contracts"],"classification":["Ready","Needs data","Needs instrumentation"]},"optional_ui_plan":{"suggested_route":"/agentry","default":"do_not_build","route_first":false,"guidance":"Build only when the user asks for a persistent view or the app already has an internal admin surface."}}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignalMap"},"examples":{"default":{"value":{"project_id":"019exampleproject","artifact":"signal_map","contract_version":"2026-05-20","framework":"next","surface":"server","signal_types":["errors","analytics","deploys"],"shapes":["b2b-saas"],"approved_plan_hash":"plan_hash_123","approval_status":"approved","approved_events":["page_view","signup_completed","subscription_started"],"approved_event_properties":{"signup_completed":["source"],"subscription_started":["plan"]},"happy_path_funnel":[{"id":"entry","title":"Entry","goal":"Visitor starts signup","related_events":["page_view"]},{"id":"activation","title":"Activation","goal":"User creates a workspace","related_events":["signup_completed"]},{"id":"outcome","title":"Paid outcome","goal":"Workspace starts subscription","related_events":["subscription_started"]}],"questions_to_answer":[{"id":"trial_to_paid_by_source","question":"Which signup source produces paid workspaces?","why":"Guides acquisition spend.","covered_by_events":["signup_completed","subscription_started"]}],"post_setup_blueprint":{"target_route":"/agentry","question_readiness_plan":{"canonical_reads":["GET /v1/projects/:project_id/signal-map","GET /v1/projects/:project_id/verify-report","GET /v1/projects/:project_id/answer-contracts"],"classification":["Ready","Needs data","Needs instrumentation"]},"optional_ui_plan":{"default":"do_not_build","route_first":false}},"question_handoff":{"first_artifacts":["signal-map","verify-report","answer-contracts"],"suggested_sections":["Business question","Primary funnel","Readiness gaps"],"build_order":["prove readiness","query rows","optional report"]},"next_action":"Use this as the canonical business question, funnel, approved events/properties, and optional report handoff. Do not use query blueprint default events unless they match this signal map."}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/setup":{"get":{"summary":"Get project setup matrix","description":"Project-specific, machine-readable env/token placement matrix. Use this to decide which Agentry keys belong in app runtime, agent/server tooling, CI, repo config, and public-query URLs.","tags":["Install"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"schema_version":{"type":"integer"},"project_id":{"type":"string"},"principle":{"type":"string"},"project_binding":{"type":"object","properties":{"file":{"type":"string"},"commit_to_git":{"type":"boolean"},"content":{"type":"object","properties":{"project_id":{"type":"string"}},"required":["project_id"],"additionalProperties":true},"notes":{"type":"string"}},"required":["file","commit_to_git","content","notes"],"additionalProperties":true},"env_matrix":{"type":"array","items":{"type":"object","properties":{"token_kind":{"type":"string"},"env_var":{"type":"string"},"required":{"type":"boolean"},"default":{"type":"string"},"secret_level":{"type":"string"},"token_prefix":{"type":"string"},"allowed_contexts":{"type":"array","items":{"type":"string"}},"commit_to_git":{"type":"boolean"},"browser_safe":{"type":"boolean"},"host_or_ci_placement":{"type":"string"},"verify_endpoint":{"type":"string"},"rotate_endpoint":{"oneOf":[{"type":"string"},{"type":"null"}]},"notes":{"type":"string"}},"required":["token_kind","env_var","required","secret_level","commit_to_git","browser_safe"],"additionalProperties":true}},"framework_env_matrix":{"type":"array","items":{"type":"object","additionalProperties":true}},"host_env_matrix":{"type":"array","items":{"type":"object","additionalProperties":true}},"env_preflight_checks":{"type":"object","additionalProperties":true},"public_queries":{"type":"object","additionalProperties":true},"next_action":{"type":"string"}},"required":["schema_version","project_id","principle","project_binding","env_matrix","framework_env_matrix","host_env_matrix","env_preflight_checks","public_queries","next_action"],"additionalProperties":false},"examples":{"default":{"value":{"schema_version":1,"project_id":"string","principle":"string","project_binding":{"file":"string","commit_to_git":true,"content":{"project_id":"string"},"notes":"string"},"env_matrix":[{"token_kind":"string","env_var":"string","required":true,"default":"string","secret_level":"string","token_prefix":"string","allowed_contexts":[{}],"commit_to_git":true,"browser_safe":true,"host_or_ci_placement":"string","verify_endpoint":"string","rotate_endpoint":{},"notes":"string"}],"framework_env_matrix":[{}],"host_env_matrix":[{}],"env_preflight_checks":{},"public_queries":{},"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/implementation-report":{"put":{"summary":"Save implementation report","tags":["Install"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImplementationReportRequest"},"examples":{"default":{"value":{"approved_plan_hash":"plan_hash_123","summary":"Wired errors, analytics, and deploy attribution.","files_touched":["src/agentry.ts","src/app.ts"],"coverage":{"events":["signup_completed","subscription_started"],"event_properties":["signup_completed.plan"],"error_surface_ids":["server_global_errors"],"deploy_surfaces":["ci"],"wired_events":[{"event":"signup_completed","source":"src/app.ts:signupCompleted"}]},"unresolved_gaps":[],"follow_up_checks":["exercise checkout in production"]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImplementationReport"},"examples":{"default":{"value":{}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}},"get":{"summary":"Get implementation report","tags":["Install"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImplementationReport"},"examples":{"default":{"value":{}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/install/verify":{"post":{"summary":"Verify install","description":"Hard gate for write/read primitives plus readiness report for product questions. ok=true means the minimum install works; answer_ready/readiness_complete=false and non-empty readiness_gaps mean product reports or dashboards still need real data or instrumentation.","tags":["Install"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyInstallRequest"},"examples":{"default":{"value":{"dsn":"agnt_018f0000-0000-7000-8000-000000000001.example","shapes":["b2b-saas"],"has_revenue":true,"is_b2b":true,"is_two_sided":false,"repo_audit":{"approved_plan_hash":"plan_hash_123","planned_events":["signup_completed","subscription_started"],"planned_event_properties":{"signup_completed":["plan"]},"error_surfaces":[{"id":"server_global_errors","title":"Global server errors","surface":"server","required_when":"always","verify_strategy":"literal_presence","step_ids":["wire_errors"],"applicable":true,"wired":true,"detect_file_count":0,"covered_file_count":1,"detect_matches":[],"wire_matches":[{"file":"src/server.ts","line":1,"preview":"unhandledRejection"}]}]}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyInstallResponse"},"examples":{"default":{"value":{"artifact":"verify_report","ok":true,"minimum_install_complete":true,"readiness_complete":false,"answer_ready":false,"summary":"3/3 synthetic signals verified; 2/3 planned events observed; 1 source-wired pending real data; 1/2 answer contracts covered; 1 pending real data; 2 real events / 5 total seen","passed":["errors","analytics","deploys"],"failed":[],"checks":{"errors":{"ok":true,"detail":"synthetic error recorded and read back"},"analytics":{"ok":true,"detail":"synthetic analytics event recorded and queried"},"deploys":{"ok":true,"detail":"synthetic deploy recorded"}},"approved_plan":{"source":"server","approval_status":"approved","approved_at":1716400000,"approved_plan_hash":"plan_hash_123","funnel_stage_count":3,"event_bucket_count":2,"approved_event_count":3,"failure_surface_count":2},"repo_audit":{"status":"fresh","reason":"repo audit matched the approved signal map","repo_root":"/repo"},"planned_event_check":{"requested":true,"required_event_count":3,"seen_required_event_count":3,"observed_required_event_count":2,"source_wired_required_event_count":1,"pending_real_data_events":["subscription_started"],"pending_real_data_event_properties":["subscription_started.plan"],"missing_events":[],"missing_event_properties":[],"wiring_hints":{"searched":true,"repo_root":"/repo","events":[{"target":"subscription_started","kind":"event","wired":true,"matches":[{"file":"src/billing.ts","line":42,"preview":"track('subscription_started', { plan })"}]}],"event_properties":[]}},"answer_contract_check":{"requested":true,"applicable_count":2,"answerable_count":1,"pending_real_data_count":1,"blocked_count":0,"answerable_contract_ids":["signup-funnel"],"blocked_contract_ids":[],"pending_real_data_contract_ids":["trial-to-paid-conversion"],"missing_events":[],"missing_event_properties":[],"blocked_event_properties":[],"pending_real_data_events":["subscription_started"],"pending_real_data_event_properties":[]},"error_surface_check":{"requested":true,"applicable_count":2,"wired_count":2,"missing_ids":[]},"real_events":{"total":5,"real":2,"samples":["page_view","signup_completed"]},"gate_failures":[],"readiness_gaps":[{"code":"planned_events_pending_real_data","message":"subscription_started looks source-wired but has not landed as a real analytics row yet.","fix":"Trigger the paid subscription flow or wait for real traffic before claiming trial-to-paid questions are answer-ready."}],"required_handoff_items":["Minimum install is complete: the requested write/read primitives passed verify.","Do not claim all product questions are answerable yet."],"final_handoff_markdown":"Basic events are set up. Ask me questions about your product, growth, revenue, reliability, or usage and I will verify whether the needed events exist, answer with evidence when they do, or wire missing telemetry when they do not.","suggested_next_step_titles":["Review the primary funnel and readiness gaps"],"suggested_next_steps":[{"id":"review_primary_funnel_readiness","title":"Review the primary funnel and readiness gaps","description":"Name missing events/properties before building product output.","prompt_template":"Review the approved funnel and readiness gaps from Agentry.","uses":["GET /v1/projects/:project_id/signal-map","GET /v1/projects/:project_id/verify-report"],"estimated_seconds":120,"requires":["analytics_scope","analytics_configured","install_verified"]}],"wiring_hints":{"searched":true,"repo_root":"/repo","events":[],"event_properties":[]},"next_action":"Minimum install is complete, but answer_ready=false. Report readiness_gaps before building reports or dashboards."}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/verify-report":{"get":{"summary":"Get latest verify report","description":"Latest persisted install proof. Use minimum_install_complete for setup status, and answer_ready/readiness_gaps/planned_event_check/answer_contract_check before answering product questions or building reports.","tags":["Install"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyInstallResponse"},"examples":{"default":{"value":{"artifact":"verify_report","ok":true,"minimum_install_complete":true,"readiness_complete":false,"answer_ready":false,"summary":"3/3 synthetic signals verified; 2/3 planned events observed; 1 source-wired pending real data; 1/2 answer contracts covered; 1 pending real data; 2 real events / 5 total seen","passed":["errors","analytics","deploys"],"failed":[],"checks":{"errors":{"ok":true,"detail":"synthetic error recorded and read back"},"analytics":{"ok":true,"detail":"synthetic analytics event recorded and queried"},"deploys":{"ok":true,"detail":"synthetic deploy recorded"}},"approved_plan":{"source":"server","approval_status":"approved","approved_at":1716400000,"approved_plan_hash":"plan_hash_123","funnel_stage_count":3,"event_bucket_count":2,"approved_event_count":3,"failure_surface_count":2},"repo_audit":{"status":"fresh","reason":"repo audit matched the approved signal map","repo_root":"/repo"},"planned_event_check":{"requested":true,"required_event_count":3,"seen_required_event_count":3,"observed_required_event_count":2,"source_wired_required_event_count":1,"pending_real_data_events":["subscription_started"],"pending_real_data_event_properties":["subscription_started.plan"],"missing_events":[],"missing_event_properties":[],"wiring_hints":{"searched":true,"repo_root":"/repo","events":[{"target":"subscription_started","kind":"event","wired":true,"matches":[{"file":"src/billing.ts","line":42,"preview":"track('subscription_started', { plan })"}]}],"event_properties":[]}},"answer_contract_check":{"requested":true,"applicable_count":2,"answerable_count":1,"pending_real_data_count":1,"blocked_count":0,"answerable_contract_ids":["signup-funnel"],"blocked_contract_ids":[],"pending_real_data_contract_ids":["trial-to-paid-conversion"],"missing_events":[],"missing_event_properties":[],"blocked_event_properties":[],"pending_real_data_events":["subscription_started"],"pending_real_data_event_properties":[]},"error_surface_check":{"requested":true,"applicable_count":2,"wired_count":2,"missing_ids":[]},"real_events":{"total":5,"real":2,"samples":["page_view","signup_completed"]},"gate_failures":[],"readiness_gaps":[{"code":"planned_events_pending_real_data","message":"subscription_started looks source-wired but has not landed as a real analytics row yet.","fix":"Trigger the paid subscription flow or wait for real traffic before claiming trial-to-paid questions are answer-ready."}],"required_handoff_items":["Minimum install is complete: the requested write/read primitives passed verify.","Do not claim all product questions are answerable yet."],"final_handoff_markdown":"Basic events are set up. Ask me questions about your product, growth, revenue, reliability, or usage and I will verify whether the needed events exist, answer with evidence when they do, or wire missing telemetry when they do not.","suggested_next_step_titles":["Review the primary funnel and readiness gaps"],"suggested_next_steps":[{"id":"review_primary_funnel_readiness","title":"Review the primary funnel and readiness gaps","description":"Name missing events/properties before building product output.","prompt_template":"Review the approved funnel and readiness gaps from Agentry.","uses":["GET /v1/projects/:project_id/signal-map","GET /v1/projects/:project_id/verify-report"],"estimated_seconds":120,"requires":["analytics_scope","analytics_configured","install_verified"]}],"wiring_hints":{"searched":true,"repo_root":"/repo","events":[],"event_properties":[]},"next_action":"Minimum install is complete, but answer_ready=false. Report readiness_gaps before building reports or dashboards."}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/event-names":{"get":{"summary":"List observed analytics and server-emitted event names","description":"Discovery helper for real telemetry. Compare these event names with the saved signal map and verify report before running a funnel; do not use blueprint default events unless they appear here or are provider-satisfied in the signal map.","tags":["Analytics"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"server_emitted":{"type":"array","items":{"type":"string"}},"analytics_events":{"type":"array","items":{"type":"object","properties":{"event":{"type":"string"},"count":{"type":"integer"},"last_seen":{"type":"integer"}},"required":["event","count","last_seen"],"additionalProperties":true}},"analytics_read":{"type":"object","properties":{"ok":{"type":"boolean"},"status":{"type":"string"},"source":{"type":"string"},"row_count":{"type":"integer"},"queried_at":{"type":"string"},"next_action":{"type":"string"}},"required":["ok","status","source","row_count"],"additionalProperties":true},"customer_data_filter":{"type":"object","properties":{"hogql_where":{"type":"string"},"next_action":{"type":"string"}},"required":["hogql_where"],"additionalProperties":true},"wildcards":{"type":"array","items":{"type":"string"}},"next_action":{"type":"string"}},"required":["server_emitted","analytics_events","analytics_read","wildcards","next_action"],"additionalProperties":true},"examples":{"default":{"value":{"server_emitted":["string"],"analytics_events":[{"event":"string","count":1,"last_seen":1}],"analytics_read":{"ok":true,"status":"string","source":"string","row_count":1,"queried_at":"string","next_action":"string"},"customer_data_filter":{"hogql_where":"string","next_action":"string"},"wildcards":["string"],"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/event-property-keys":{"get":{"summary":"List observed analytics property keys","description":"Discovery helper for segmentation and drop-off analysis. Pass ?events=event_a,event_b,event_c from the saved funnel; the no-events form is intentionally only broad guidance and should not be used to prove a segment property exists.","tags":["Analytics"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"events","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"analytics_read":{"type":"object","properties":{"ok":{"type":"boolean"},"status":{"type":"string"},"source":{"type":"string"},"row_count":{"type":"integer"},"requested_event_count":{"type":"integer"},"observed_event_count":{"type":"integer"},"missing_events":{"type":"array","items":{"type":"string"}},"queried_at":{"type":"string"},"next_action":{"type":"string"}},"required":["ok","status","source","row_count"],"additionalProperties":true},"customer_data_filter":{"type":"object","properties":{"hogql_where":{"type":"string"},"next_action":{"type":"string"}},"required":["hogql_where"],"additionalProperties":true},"next_action":{"type":"string"}},"required":["keys","analytics_read"],"additionalProperties":true},"examples":{"default":{"value":{"keys":{},"analytics_read":{"ok":true,"status":"string","source":"string","row_count":1,"requested_event_count":1,"observed_event_count":1,"missing_events":["string"],"queried_at":"string","next_action":"string"},"customer_data_filter":{"hogql_where":"string","next_action":"string"},"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/query-blueprints":{"get":{"summary":"List query blueprints","tags":["Query Blueprints"],"parameters":[{"name":"category","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"},"categories":{"type":"array","items":{"type":"string"}},"kind":{"type":"string","enum":["query_blueprints"]},"blueprints":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["query_blueprint"]},"title":{"type":"string"},"description":{"type":"string"},"category":{"type":"string"},"backend":{"type":"string","enum":["analytics","operational"]},"params":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string","enum":["string","number"]},"description":{"type":"string"},"default":{"oneOf":[{"type":"string"},{"type":"number"}]},"required":{"type":"boolean"}},"required":["name","type","description"],"additionalProperties":true}},"query":{"type":"string"},"expected_columns":{"type":"array","items":{"type":"string"}},"render_hint":{"type":"object","properties":{"type":{"type":"string","enum":["table","line","bar","funnel","scalar","stacked_bar"]},"x":{"type":"string"},"y":{"type":"string"},"stages":{"type":"array","items":{"type":"string"}},"title":{"type":"string"},"notes":{"type":"array","items":{"type":"string"}}},"required":["type","title"],"additionalProperties":true},"example_user_question":{"type":"string"},"example_params":{"type":"object","additionalProperties":true},"recommended_segment_properties":{"type":"array","items":{"type":"string"}},"required_event_properties":{"type":"object","additionalProperties":true},"parameterized_required_event_properties":{"type":"array","items":{"type":"object","properties":{"event_param":{"type":"string"},"property_param":{"type":"string"},"check_endpoint":{"type":"string"},"description":{"type":"string"}},"required":["event_param","property_param","check_endpoint","description"],"additionalProperties":true}},"endpoints":{"type":"object","additionalProperties":true},"publishable":{"type":"boolean"},"next_action":{"type":"string"}},"required":["id","kind","title","description","category","publishable"],"additionalProperties":true}},"next_action":{"type":"string"}},"required":["count","categories","blueprints"],"additionalProperties":false},"examples":{"default":{"value":{"count":1,"categories":["string"],"kind":"query_blueprints","blueprints":[{"id":"string","kind":"query_blueprint","title":"string","description":"string","category":"string","backend":"analytics","params":[{}],"query":"string","expected_columns":[{}],"render_hint":{"type":{},"x":{},"y":{},"stages":{},"title":{},"notes":{}},"example_user_question":"string","example_params":{},"recommended_segment_properties":[{}],"required_event_properties":{},"parameterized_required_event_properties":[{}],"endpoints":{},"publishable":true,"next_action":"string"}],"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/query-blueprints/{blueprint_id}":{"get":{"summary":"Get query blueprint details","tags":["Query Blueprints"],"parameters":[{"name":"blueprint_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["query_blueprint"]},"title":{"type":"string"},"description":{"type":"string"},"category":{"type":"string"},"backend":{"type":"string","enum":["analytics","operational"]},"params":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string","enum":["string","number"]},"description":{"type":"string"},"default":{"oneOf":[{"type":"string"},{"type":"number"}]},"required":{"type":"boolean"}},"required":["name","type","description"],"additionalProperties":true}},"query":{"type":"string"},"expected_columns":{"type":"array","items":{"type":"string"}},"render_hint":{"type":"object","properties":{"type":{"type":"string","enum":["table","line","bar","funnel","scalar","stacked_bar"]},"x":{"type":"string"},"y":{"type":"string"},"stages":{"type":"array","items":{"type":"string"}},"title":{"type":"string"},"notes":{"type":"array","items":{"type":"string"}}},"required":["type","title"],"additionalProperties":true},"example_user_question":{"type":"string"},"example_params":{"type":"object","additionalProperties":true},"recommended_segment_properties":{"type":"array","items":{"type":"string"}},"required_event_properties":{"type":"object","additionalProperties":true},"parameterized_required_event_properties":{"type":"array","items":{"type":"object","properties":{"event_param":{"type":"string"},"property_param":{"type":"string"},"check_endpoint":{"type":"string"},"description":{"type":"string"}},"required":["event_param","property_param","check_endpoint","description"],"additionalProperties":true}},"endpoints":{"type":"object","additionalProperties":true},"publishable":{"type":"boolean"},"next_action":{"type":"string"}},"required":["id","kind","title","description","category","publishable"],"additionalProperties":true},"examples":{"default":{"value":{"id":"string","kind":"query_blueprint","title":"string","description":"string","category":"string","backend":"analytics","params":[{"name":"string","type":"string","description":"string","default":{},"required":true}],"query":"string","expected_columns":["string"],"render_hint":{"type":"table","x":"string","y":"string","stages":["string"],"title":"string","notes":["string"]},"example_user_question":"string","example_params":{},"recommended_segment_properties":["string"],"required_event_properties":{},"parameterized_required_event_properties":[{"event_param":"string","property_param":"string","check_endpoint":"string","description":"string"}],"endpoints":{},"publishable":true,"next_action":"string"}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/answer-contracts":{"get":{"summary":"Get project answer-contract event coverage","description":"Project-specific question coverage derived from the approved signal map. Use this to decide which business/product questions are Ready, Need more data, or Need instrumentation before building an answer or dashboard.","tags":["Install"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnswerContractsResponse"},"examples":{"default":{"value":{"project_id":"019exampleproject","inputs":{"shapes":["b2b-saas"],"has_revenue":true,"is_b2b":true,"is_two_sided":false},"source":"signal_map","approved_plan_hash":"plan_hash_123","questions_to_answer":[{"id":"trial_to_paid_by_source","question":"Which signup source produces paid workspaces?","required_events":["signup_completed","subscription_started"]}],"answerability_contract_source":"answer_contracts","fallback_question_contract":null,"answer_contract_library_count":4,"unsaved_contract_ids":["account-health-score"],"drift":{"answer_contract_library_larger_than_saved_state":true,"answer_contract_library_count":4,"saved_applicable_count":2,"unsaved_contract_count":1},"applicable_count":2,"total_count":92,"answer_contracts":[{"id":"trial-to-paid-conversion","title":"Track trial-to-paid conversion by acquisition source","state":"pending_real_data","required_events":["signup_completed","trial_started","subscription_started"],"required_event_properties":{"signup_completed":["utm_source"],"subscription_started":["plan"]}}],"required_events":["signup_completed","trial_started","subscription_started"],"readiness_events":["signup_completed","subscription_started"],"required_event_properties":{"signup_completed":["utm_source"],"subscription_started":["plan"]},"answer_contract_decisions":[{"id":"trial-to-paid-conversion","state":"applicable","user_confirmed":true}],"skipped_count":1,"skipped":[{"id":"public-stats-page","title":"Build a public live-stats widget for your marketing site","reason":"not approved in saved signal map","negative_fit":["Only publish browser-safe metrics after readiness is proven."]}],"next_action":"Compare these required events/properties with verify-report, event-names, and event-property-keys before answering or building a report."}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/projects/{project_id}/query-blueprints/{blueprint_id}/run":{"post":{"summary":"Run query blueprint","description":"Run a deterministic query template. For funnels, set params from the saved signal map/post_setup_blueprint/activation definition; never rely on default signup steps unless those events are approved and observed for this project.","tags":["Query Blueprints"],"security":[{"ApiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/projectId"},{"name":"blueprint_id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"params":{"type":"object","additionalProperties":true}},"additionalProperties":false},"examples":{"default":{"value":{"params":{"step1":"page_view","step2":"signup_completed","step3":"subscription_started","days":30,"segment_property":"utm_source"}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"blueprint_id":{"type":"string"},"title":{"type":"string"},"backend":{"type":"string","enum":["analytics","operational"]},"rows":{"type":"array","items":{"type":"object","additionalProperties":true}},"columns":{"type":"array","items":{"type":"string"}},"row_count":{"type":"integer"},"freshness":{"type":"object","properties":{"source":{"type":"string"},"consistency":{"type":"string"},"cache_bust":{"type":"boolean"},"queried_at":{"type":"string"},"query_duration_ms":{"type":"integer"},"retry_after_ms":{"type":"integer"},"status":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":false},"render_hint":{"type":"object","additionalProperties":true},"billing_notice":{"type":"object","additionalProperties":true},"next_action":{"type":"string"}},"additionalProperties":false},"examples":{"default":{"value":{"blueprint_id":"active_users_daily","title":"Active users by day","backend":"analytics","rows":[{"day":"2026-06-14","dau":42}],"columns":["day","dau"],"row_count":1,"freshness":{"source":"posthog_hogql","consistency":"eventual","cache_bust":true,"queried_at":"2026-06-16T10:00:00.000Z","query_duration_ms":832,"retry_after_ms":30000,"status":"complete_for_query_time","next_action":"Freshly ingested analytics can take a short time to appear; re-run recent blueprint reads before making customer-facing claims."},"render_hint":{"type":"line","x":"day","y":"dau"},"billing_notice":{"should_notify_human":false},"next_action":"Render rows according to render_hint. Columns is metadata for display order."}}}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"examples":{"default":{"value":{"error":{"code":"invalid_payload","message":"Request body or parameters are invalid.","next_action":"Read error.details.request_body_schema, fix the request body, then retry once.","request_id":"req_example","retryable":false,"details":{"missing_fields":["required_field"]}}}}}}}}}}},"/v1/openapi.json":{"get":{"summary":"Get this OpenAPI schema","description":"Canonical full HTTP schema by default. Agents should prefer filtered lookups such as ?flow=install, ?tag=Install&include_components=false, or ?path=%2Fv1%2Fprojects%2F%7Bproject_id%7D%2Finstall%2Fverify&method=post.","tags":["Discovery"],"parameters":[{"name":"flow","in":"query","required":false,"schema":{"type":"string"}},{"name":"tag","in":"query","required":false,"schema":{"type":"string"}},{"name":"path","in":"query","required":false,"schema":{"type":"string"}},{"name":"method","in":"query","required":false,"schema":{"type":"string","enum":["get","post","put","patch","delete"]}},{"name":"include_components","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"index","in":"query","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":true},"examples":{"default":{"value":{}}}}}}}}}},"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","description":"Private agk_ API key."},"AdminTokenAuth":{"type":"http","scheme":"bearer","description":"Admin bearer token: Authorization: Bearer <ADMIN_TOKEN>."},"InternalTokenAuth":{"type":"http","scheme":"bearer","description":"Internal bearer token used by first-party web/auth functions."},"TestAuthTokenAuth":{"type":"http","scheme":"bearer","description":"Hosted beta/load-test bearer token: Authorization: Bearer <AGENTRY_TEST_AUTH_TOKEN>. Disabled unless configured."},"DsnAuth":{"type":"http","scheme":"bearer","description":"Project DSN, agnt_<projectId>.<token>. Send as Authorization: Bearer <DSN>."}},"parameters":{"projectId":{"name":"project_id","in":"path","required":true,"schema":{"type":"string"}},"caseId":{"name":"case_id","in":"path","required":true,"schema":{"type":"string"}}},"schemas":{"ErrorEnvelope":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"next_action":{"type":"string"},"details":{"type":"object","additionalProperties":true},"request_id":{"type":"string"},"retryable":{"type":"boolean"}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false},"DeviceStartResponse":{"type":"object","properties":{"device_code":{"type":"string"},"user_code":{"type":"string"},"verification_uri":{"type":"string"},"verification_uri_complete":{"type":"string"},"expires_in":{"type":"integer"},"interval":{"type":"integer"},"next_action":{"type":"string"}},"required":["device_code","user_code","verification_uri","expires_in","interval"],"additionalProperties":false},"LoginResponse":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"api_key":{"type":"string"},"user_id":{"type":"string"},"prefix":{"type":"string"},"user":{"type":"object","additionalProperties":true},"posthog":{"type":"object","additionalProperties":true},"next_action":{"type":"string"}},"required":["status","api_key","user_id","prefix"],"additionalProperties":false},"DevicePollResponse":{"oneOf":[{"$ref":"#/components/schemas/LoginResponse"},{"type":"object","properties":{"status":{"type":"string","enum":["pending","slow_down","expired","denied"]},"next_action":{"type":"string"}},"required":["status"],"additionalProperties":false}]},"InstallSnippet":{"type":"object","properties":{"language":{"type":"string"},"code":{"type":"string"},"required_env":{"type":"array","items":{"type":"string"}},"optional_env":{"type":"array","items":{"type":"string"}},"env_vars":{"type":"object","additionalProperties":{"type":"string"}},"next_action":{"type":"string"}},"required":["language","code"],"additionalProperties":false},"CreateProjectRequest":{"type":"object","properties":{"name":{"type":"string"},"repo_url":{"type":"string"},"default_branch":{"type":"string"},"local_path":{"type":"string"}},"required":["name"],"additionalProperties":false},"ProjectSummary":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"repo_url":{"type":"string"},"default_branch":{"type":"string"},"local_path":{"type":"string"},"created_at":{"type":"integer"},"role":{"type":"string","enum":["owner","member"]}},"required":["id","name","created_at"],"additionalProperties":false},"ProjectDetail":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"repo_url":{"type":"string"},"default_branch":{"type":"string"},"local_path":{"type":"string"},"created_at":{"type":"integer"},"role":{"type":"string","enum":["owner","member"]},"dsn":{"type":"object","properties":{"prefix":{"type":"string"},"raw_available":{"type":"boolean"},"verify_endpoint":{"type":"string"},"rotate_endpoint":{"type":"string"}},"required":["prefix","raw_available","verify_endpoint","rotate_endpoint"],"additionalProperties":false},"analytics":{"type":"object","additionalProperties":true},"next_action":{"type":"string"}},"required":["id","name","created_at","dsn","next_action"],"additionalProperties":false},"CreateProjectResponse":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"role":{"type":"string","enum":["owner","member"]},"dsn":{"type":"string"},"logs_url":{"type":"string"},"analytics_url":{"type":"string"},"deploys_url":{"type":"string"},"deploys_note":{"type":"string"},"dsn_recoverable":{"type":"boolean"},"dsn_recovery_state":{"type":"string","enum":["saving","unavailable"]},"default_branch":{"type":"string"},"analytics":{"type":"object","additionalProperties":true},"install_snippet":{"type":"string"},"next_action":{"type":"string"}},"required":["id","name","dsn"],"additionalProperties":false},"DeleteProjectResponse":{"type":"object","properties":{"id":{"type":"string"},"deleted":{"type":"boolean"},"cleanup":{"type":"object","properties":{"sourcemaps":{"type":"integer"},"sourcemap_blobs_deleted":{"type":"integer"},"sourcemap_blob_warnings":{"type":"integer"}},"required":["sourcemaps","sourcemap_blobs_deleted","sourcemap_blob_warnings"],"additionalProperties":false},"next_action":{"type":"string"}},"required":["id","deleted","cleanup","next_action"],"additionalProperties":false},"LogIngestRequest":{"type":"object","properties":{"event_id":{"type":"string"},"timestamp":{"type":"number"},"platform":{"type":"string"},"environment":{"type":"string"},"release":{"type":"string"},"deploy_sha":{"type":"string"},"server_name":{"type":"string"},"level":{"type":"string","enum":["fatal","error","warning","info","debug"]},"message":{"oneOf":[{"type":"string"},{"type":"object","properties":{"formatted":{"type":"string"},"message":{"type":"string"}},"additionalProperties":true}]},"exception":{"type":"object","properties":{"values":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"value":{"type":"string"},"stacktrace":{"type":"object","properties":{"frames":{"type":"array","items":{"type":"object","properties":{"filename":{"type":"string"},"function":{"type":"string"},"lineno":{"type":"integer"},"colno":{"type":"integer"},"in_app":{"type":"boolean"},"context_line":{"type":"string"}},"additionalProperties":true}}},"additionalProperties":false}},"additionalProperties":true}}},"additionalProperties":false},"breadcrumbs":{"type":"object","properties":{"values":{"type":"array","items":{"type":"object","additionalProperties":true}}},"additionalProperties":false},"request":{"type":"object","additionalProperties":true},"user":{"type":"object","additionalProperties":true},"tags":{"type":"object","additionalProperties":{"type":"string"}},"extra":{"type":"object","additionalProperties":true}},"additionalProperties":true},"AnalyticsIngestRequest":{"type":"object","properties":{"event":{"type":"string"},"distinct_id":{"type":"string"},"properties":{"type":"object","additionalProperties":true},"timestamp":{"type":"number"}},"required":["event"],"additionalProperties":false},"DeployIngestRequest":{"type":"object","properties":{"sha":{"type":"string"},"branch":{"type":"string"},"environment":{"type":"string"},"message":{"type":"string"},"url":{"type":"string"},"actor":{"type":"string"}},"required":["sha"],"additionalProperties":true},"IngestAcceptedResponse":{"type":"object","properties":{"event_id":{"type":"string"},"case_id":{"type":"string"},"suppressed":{"type":"boolean"},"next_action":{"type":"string"}},"additionalProperties":true},"AnalyticsAcceptedResponse":{"type":"object","properties":{"ok":{"type":"boolean"},"event":{"type":"string"},"next_action":{"type":"string"}},"additionalProperties":true},"DeployAcceptedResponse":{"type":"object","properties":{"id":{"type":"string"},"project_id":{"type":"string"},"sha":{"type":"string"},"received_at":{"type":"integer"},"next_action":{"type":"string"}},"additionalProperties":true},"CaseStatus":{"type":"string","enum":["open","investigating","resolved","spurious","ignored"]},"CaseSummary":{"type":"object","properties":{"id":{"type":"string"},"fingerprint":{"type":"string"},"error_type":{"type":"string"},"message":{"type":"string"},"status":{"$ref":"#/components/schemas/CaseStatus"},"event_count":{"type":"integer"},"first_seen_at":{"type":"integer"},"last_seen_at":{"type":"integer"},"last_deploy_sha":{"type":"string"}},"additionalProperties":true},"CaseDetail":{"type":"object","properties":{"id":{"type":"string"},"fingerprint":{"type":"string"},"error_type":{"type":"string"},"message":{"type":"string"},"status":{"$ref":"#/components/schemas/CaseStatus"},"events":{"type":"array","items":{"type":"object","additionalProperties":true}},"recent_deploys":{"type":"array","items":{"$ref":"#/components/schemas/Deploy"}},"affected_users":{"type":"array","items":{"type":"object","additionalProperties":true}},"next_action":{"type":"string"}},"additionalProperties":true},"UpdateCaseRequest":{"type":"object","properties":{"status":{"$ref":"#/components/schemas/CaseStatus"},"agent_summary":{"type":"string"},"pr_url":{"type":"string"}},"additionalProperties":false},"Deploy":{"type":"object","properties":{"id":{"type":"string"},"sha":{"type":"string"},"branch":{"type":"string"},"environment":{"type":"string"},"message":{"type":"string"},"url":{"type":"string"},"actor":{"type":"string"},"extra":{"type":"object","additionalProperties":true},"received_at":{"type":"integer"}},"required":["id","sha","received_at"],"additionalProperties":false},"InstallContract":{"type":"object","properties":{"contract_version":{"type":"string"},"framework":{"type":"string"},"surface":{"type":"string","enum":["client","server","direct-http"]},"signal_types":{"type":"array","items":{"type":"string"}},"authority":{"type":"object","properties":{"bootstrap_markdown":{"type":"string"},"structured_contract":{"type":"string"},"api_schema":{"type":"string"},"planner_endpoint":{"type":"string"},"reference_markdown":{"type":"string"}},"required":["bootstrap_markdown","structured_contract","api_schema","planner_endpoint","reference_markdown"],"additionalProperties":false},"http_routes":{"type":"object","additionalProperties":{"type":"object","properties":{"method":{"type":"string","enum":["GET","POST","PUT"]},"path":{"type":"string"},"auth":{"type":"string","enum":["none","api_key"]},"purpose":{"type":"string"},"filtered_examples":{"type":"array","items":{"type":"string"}}},"required":["method","path","auth","purpose"],"additionalProperties":true}},"phases":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","enum":["detect","inventory","plan","instrument","verify","follow_up"]},"title":{"type":"string"},"goal":{"type":"string"}},"required":["id","title","goal"],"additionalProperties":false}},"minimum_verified_install":{"type":"object","properties":{"id":{"type":"string"},"purpose":{"type":"string"},"first_pass_rule":{"type":"string"},"required_before_planning":{"type":"array","items":{"type":"string"}},"minimum_discovery_map_fields":{"type":"array","items":{"type":"string"}},"required_endpoint_sequence":{"type":"array","items":{"type":"string"}},"runtime_write_endpoints":{"type":"array","items":{"type":"string"}},"hard_success_requires":{"type":"array","items":{"type":"string"}},"readiness_follow_up_not_blocking_first_success":{"type":"array","items":{"type":"string"}},"forbidden_shortcuts":{"type":"array","items":{"type":"string"}},"minimum_plan_request":{"type":"object","additionalProperties":true}},"required":["id","purpose","first_pass_rule","required_endpoint_sequence","hard_success_requires"],"additionalProperties":true},"planner":{"type":"object","properties":{"operation":{"type":"string"},"confirmation_operation":{"type":"string"},"planner_output_required":{"type":"boolean"},"manual_plan_substitute_forbidden":{"type":"boolean"},"force_operation_when_supported":{"type":"boolean"},"orchestrator_guidance":{"type":"string"},"approval_delivery":{"type":"object","properties":{"required_channel":{"type":"string","enum":["assistant_response"]},"pause_token":{"type":"string"},"shell_output_is_not_approval":{"type":"boolean"},"instruction":{"type":"string"}},"required":["required_channel","pause_token","shell_output_is_not_approval","instruction"],"additionalProperties":false},"required_inputs":{"type":"array","items":{"type":"string"}},"requires_full_repo_discovery":{"type":"boolean"},"discovery_step_id":{"type":"string"},"discovery_scope":{"type":"array","items":{"type":"string"}},"approval_artifacts":{"type":"array","items":{"type":"string"}},"approval_required":{"type":"boolean"},"approval_step_id":{"type":"string"},"plan_review_pause_token":{"type":"string"},"plan_review_required_sections":{"type":"array","items":{"type":"string"}},"implementation_starts_after":{"type":"string"}},"required":["operation","confirmation_operation","planner_output_required","manual_plan_substitute_forbidden","approval_delivery","approval_required","approval_step_id"],"additionalProperties":true},"execution":{"type":"object","properties":{"surface":{"type":"string","enum":["client","server","direct-http"]},"framework":{"type":"string"},"snippet_refs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"purpose":{"type":"string"},"surface":{"type":"string","enum":["client","server","direct-http"]},"frameworks":{"type":"array","items":{"type":"string"}},"path":{"type":"string"},"step_id":{"type":"string"}},"required":["id","purpose","surface","frameworks"],"additionalProperties":true}},"error_surfaces":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"why":{"type":"string"},"surface":{"type":"string","enum":["client","server","direct-http"]},"frameworks":{"type":"array","items":{"type":"string"}},"required_when":{"type":"string","enum":["always","when_repo_patterns_match"]},"step_ids":{"type":"array","items":{"type":"string"}},"detect_literals":{"type":"array","items":{"type":"string"}},"wire_literals":{"type":"array","items":{"type":"string"}},"verify_strategy":{"type":"string","enum":["literal_presence","detect_file_has_wire"]}},"required":["id","title","why","surface","frameworks","required_when","step_ids","detect_literals","wire_literals","verify_strategy"],"additionalProperties":true}}},"required":["surface","framework","snippet_refs","error_surfaces"],"additionalProperties":false},"verification":{"type":"object","properties":{"operation":{"type":"string"},"http_route":{"type":"object","properties":{"method":{"type":"string","enum":["GET","POST","PUT"]},"path":{"type":"string"},"auth":{"type":"string","enum":["none","api_key"]},"purpose":{"type":"string"},"filtered_examples":{"type":"array","items":{"type":"string"}}},"required":["method","path","auth","purpose"],"additionalProperties":true},"verify_step_id":{"type":"string"},"auth_header":{"type":"string"},"dsn_usage":{"type":"string"},"readiness_handoff_required":{"type":"boolean"},"requires_approved_plan":{"type":"boolean"},"requires_planned_event_coverage":{"type":"boolean"},"requires_shapes":{"type":"boolean"},"requires_real_events":{"type":"boolean"},"requires_answer_contract_coverage":{"type":"boolean"},"requires_error_surface_coverage":{"type":"boolean"},"requires_repo_audit":{"type":"boolean"},"hard_gate_checks":{"type":"array","items":{"type":"string"}},"readiness_checks":{"type":"array","items":{"type":"string"}},"repo_audit_fields":{"type":"array","items":{"type":"string"}},"blocking_failure_codes":{"type":"array","items":{"type":"string"}},"readiness_gap_codes":{"type":"array","items":{"type":"string"}}},"required":["operation","http_route","verify_step_id","auth_header","dsn_usage","readiness_handoff_required"],"additionalProperties":true},"steps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"why":{"type":"string"},"action":{"type":"string","enum":["run","edit","verify","manual"]},"file_hint":{"type":"string"},"command":{"type":"string"},"code":{"type":"string"},"validate":{"type":"string"},"phase":{"type":"string","enum":["detect","inventory","plan","instrument","verify","follow_up"]},"blocking":{"type":"boolean"},"applies_when":{"type":"array","items":{"type":"string"}},"requires_user_reply":{"type":"boolean"},"success_checks":{"type":"array","items":{"type":"string"}},"failure_codes":{"type":"array","items":{"type":"string"}},"artifacts":{"type":"array","items":{"type":"string"}},"progress_key":{"type":"string"}},"required":["id","title","why","action","validate","phase","blocking","applies_when","requires_user_reply","success_checks","failure_codes","artifacts","progress_key"],"additionalProperties":true}},"pitfalls":{"type":"array","items":{"type":"string"}},"signal_health_principles":{"type":"array","items":{"type":"string"}},"next_action":{"type":"string"}},"required":["contract_version","framework","surface","signal_types","authority","http_routes","phases","planner","execution","verification","steps","next_action"],"additionalProperties":true},"InstallPlanRequest":{"type":"object","properties":{"framework":{"type":"string"},"surface":{"type":"string","enum":["client","server","direct-http"]},"shapes":{"type":"array","items":{"type":"string"}},"has_revenue":{"type":"boolean"},"is_b2b":{"type":"boolean"},"is_two_sided":{"type":"boolean"},"current_project_id":{"type":"string"},"existing_events":{"type":"array","items":{"type":"string"}},"existing_event_properties":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"signal_types":{"type":"array","items":{"type":"string"}},"infer_boolean_flags":{"type":"object","properties":{"has_revenue":{"type":"boolean"},"is_b2b":{"type":"boolean"},"is_two_sided":{"type":"boolean"}},"additionalProperties":true},"discovery_map":{"type":"object","properties":{"product_summary":{"type":"string"},"product_category":{"type":"string"},"metric_lens":{"type":"string"},"primary_outcome":{"type":"string"},"existing_live_events":{"type":"array","items":{"type":"string"}},"source_files":{"type":"array","items":{"type":"string"}},"failure_surfaces":{"type":"array","items":{"type":"string"}},"planned_wiring_candidates":{"type":"array","items":{"type":"string"}},"wiring_candidates":{"type":"array","items":{"type":"string"}},"key_entities":{"type":"array","items":{"type":"string"}},"key_user_journeys":{"type":"array","items":{"type":"string"}},"ui_surfaces":{"type":"array","items":{"type":"string"}},"api_surfaces":{"type":"array","items":{"type":"string"}},"async_surfaces":{"type":"array","items":{"type":"string"}},"admin_surfaces":{"type":"array","items":{"type":"string"}},"external_dependencies":{"type":"array","items":{"type":"string"}},"monetization_surfaces":{"type":"array","items":{"type":"string"}},"deploy_surfaces":{"type":"array","items":{"type":"string"}},"risky_failure_paths":{"type":"array","items":{"type":"string"}},"notes":{"type":"array","items":{"type":"string"}}},"required":["product_summary","product_category","metric_lens","primary_outcome","key_entities","key_user_journeys","ui_surfaces","api_surfaces","async_surfaces","admin_surfaces","external_dependencies","monetization_surfaces","deploy_surfaces","risky_failure_paths"],"additionalProperties":true}},"required":["framework","shapes","discovery_map"],"additionalProperties":false},"InstallPlanResponse":{"type":"object","properties":{"contract_version":{"type":"string"},"approved_plan_hash":{"type":"string"},"framework":{"type":"string"},"surface":{"type":"string","enum":["client","server","direct-http"]},"signal_types":{"type":"array","items":{"type":"string"}},"planner_output_required":{"type":"boolean"},"planner_invocation":{"type":"object","properties":{"operation":{"type":"string"},"http_route":{"type":"string"},"manual_substitute_forbidden":{"type":"boolean"},"force_operation_when_supported":{"type":"boolean"},"orchestrator_note":{"type":"string"},"approval_delivery":{"type":"object","properties":{"required_channel":{"type":"string","enum":["assistant_response"]},"pause_token":{"type":"string"},"shell_output_is_not_approval":{"type":"boolean"},"instruction":{"type":"string"}},"required":["required_channel","pause_token","shell_output_is_not_approval","instruction"],"additionalProperties":false}},"required":["operation","http_route","manual_substitute_forbidden","force_operation_when_supported","orchestrator_note","approval_delivery"],"additionalProperties":false},"current_project_id":{"oneOf":[{"type":"string"},{"type":"null"}]},"authority":{"type":"object","properties":{"bootstrap_markdown":{"type":"string"},"structured_contract":{"type":"string"},"planner_endpoint":{"type":"string"},"reference_markdown":{"type":"string"}},"required":["bootstrap_markdown","structured_contract","planner_endpoint","reference_markdown"],"additionalProperties":false},"approval_required":{"type":"boolean"},"approval_step_id":{"type":"string"},"verify_endpoint":{"type":"string"},"verify_step_id":{"type":"string"},"snippet_refs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"purpose":{"type":"string"},"surface":{"type":"string","enum":["client","server","direct-http"]},"frameworks":{"type":"array","items":{"type":"string"}},"path":{"type":"string"},"step_id":{"type":"string"}},"required":["id","purpose","surface","frameworks"],"additionalProperties":true}},"required_error_surfaces":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"why":{"type":"string"},"surface":{"type":"string","enum":["client","server","direct-http"]},"frameworks":{"type":"array","items":{"type":"string"}},"required_when":{"type":"string","enum":["always","when_repo_patterns_match"]},"step_ids":{"type":"array","items":{"type":"string"}},"detect_literals":{"type":"array","items":{"type":"string"}},"wire_literals":{"type":"array","items":{"type":"string"}},"verify_strategy":{"type":"string","enum":["literal_presence","detect_file_has_wire"]}},"required":["id","title","why","surface","frameworks","required_when","step_ids","detect_literals","wire_literals","verify_strategy"],"additionalProperties":true}},"shapes":{"type":"array","items":{"type":"string"}},"has_revenue":{"type":"boolean"},"is_b2b":{"type":"boolean"},"is_two_sided":{"type":"boolean"},"discovery_map":{"oneOf":[{"type":"object","properties":{"product_summary":{"type":"string"},"product_category":{"type":"string"},"metric_lens":{"type":"string"},"primary_outcome":{"type":"string"},"existing_live_events":{"type":"array","items":{"type":"string"}},"source_files":{"type":"array","items":{"type":"string"}},"failure_surfaces":{"type":"array","items":{"type":"string"}},"planned_wiring_candidates":{"type":"array","items":{"type":"string"}},"wiring_candidates":{"type":"array","items":{"type":"string"}},"key_entities":{"type":"array","items":{"type":"string"}},"key_user_journeys":{"type":"array","items":{"type":"string"}},"ui_surfaces":{"type":"array","items":{"type":"string"}},"api_surfaces":{"type":"array","items":{"type":"string"}},"async_surfaces":{"type":"array","items":{"type":"string"}},"admin_surfaces":{"type":"array","items":{"type":"string"}},"external_dependencies":{"type":"array","items":{"type":"string"}},"monetization_surfaces":{"type":"array","items":{"type":"string"}},"deploy_surfaces":{"type":"array","items":{"type":"string"}},"risky_failure_paths":{"type":"array","items":{"type":"string"}},"notes":{"type":"array","items":{"type":"string"}}},"required":["product_summary","product_category","metric_lens","primary_outcome","key_entities","key_user_journeys","ui_surfaces","api_surfaces","async_surfaces","admin_surfaces","external_dependencies","monetization_surfaces","deploy_surfaces","risky_failure_paths"],"additionalProperties":true},{"type":"null"}]},"mode":{"type":"string","enum":["fresh_install","extend_existing","repair_existing","verify_only"]},"existing_events":{"type":"array","items":{"type":"string"}},"required_events":{"type":"array","items":{"type":"string"}},"readiness_events":{"type":"array","items":{"type":"string"}},"required_event_properties":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"provider_satisfied_events":{"type":"array","items":{"type":"object","properties":{"event":{"type":"string"},"source_event":{"type":"string"},"provider":{"type":"string"},"status":{"type":"string","enum":["provider_stream_preserved"]},"guidance":{"type":"string"}},"required":["event","source_event","provider","status","guidance"],"additionalProperties":true}},"missing_events":{"type":"array","items":{"type":"string"}},"missing_event_properties":{"type":"array","items":{"type":"string"}},"answer_contracts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"state":{"type":"string","enum":["applicable","skipped","not_applicable","needs_mapping","deferred"]},"reason":{"type":"string"},"substituted_events":{"type":"object","additionalProperties":{"type":"string"}},"user_confirmed":{"type":"boolean"}},"required":["id","state"],"additionalProperties":true}},"event_buckets":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string"},"purpose":{"type":"string"},"required_events":{"type":"array","items":{"type":"string"}},"missing_events":{"type":"array","items":{"type":"string"}}},"required":["bucket","required_events","missing_events"],"additionalProperties":true}},"happy_path_funnel":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"goal":{"type":"string"},"related_events":{"type":"array","items":{"type":"string"}}},"required":["id","title","goal","related_events"],"additionalProperties":true}},"failure_surface_map":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"why":{"type":"string"},"related_stage_ids":{"type":"array","items":{"type":"string"}},"related_events":{"type":"array","items":{"type":"string"}},"source_error_surface_ids":{"type":"array","items":{"type":"string"}}},"required":["id","title","why"],"additionalProperties":true}},"coverage_checklist":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"why":{"type":"string"},"guidance":{"type":"string"},"example_events":{"type":"array","items":{"type":"string"}}},"required":["id","title","why","guidance","example_events"],"additionalProperties":true}},"planned_wiring_map":{"type":"array","items":{"type":"object","properties":{"signal":{"type":"string"},"kind":{"type":"string","enum":["event","error","deploy"]},"target_files":{"type":"array","items":{"type":"string"}},"target_surface":{"type":"string"},"trigger":{"type":"string"},"key_properties":{"type":"array","items":{"type":"string"}},"notes":{"type":"array","items":{"type":"string"}}},"required":["signal","kind","target_files","target_surface","trigger","key_properties","notes"],"additionalProperties":true}},"signal_map_template":{"$ref":"#/components/schemas/SaveSignalMapRequest"},"plan_review":{"type":"object","properties":{"pause_token":{"type":"string"},"must_pause_for_user_reply":{"type":"boolean"},"required_section_ids":{"type":"array","items":{"type":"string"}},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"body":{"type":"string"}},"required":["id","title","body"],"additionalProperties":false}},"rendering_guidance":{"type":"string"},"message_markdown":{"type":"string"}},"required":["pause_token","must_pause_for_user_reply","required_section_ids","sections","rendering_guidance","message_markdown"],"additionalProperties":false},"post_setup_blueprint":{"type":"object","properties":{"artifact":{"type":"string","enum":["post_setup_blueprint"]},"target_route":{"type":"string"},"target_name":{"type":"string"},"route_guidance":{"type":"string"},"source_context":{"type":"array","items":{"type":"string"}},"customization_rules":{"type":"array","items":{"type":"string"}},"activation_definition":{"type":"object","properties":{"metric":{"type":"string","enum":["activation"]},"event":{"oneOf":[{"type":"string"},{"type":"null"}]},"label":{"type":"string"},"source":{"type":"string"},"reason":{"type":"string"},"supporting_events":{"type":"array","items":{"type":"string"}},"required_properties":{"type":"array","items":{"type":"string"}},"dashboard_guidance":{"type":"string"}},"required":["metric","event","label","source","reason"],"additionalProperties":true},"deployment_env_plan":{"type":"object","additionalProperties":true},"automations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"trigger":{"type":"string"},"purpose":{"type":"string"},"uses":{"type":"array","items":{"type":"string"}},"prompt_seed":{"type":"string"}},"required":["id","title","trigger","purpose"],"additionalProperties":true}},"question_readiness_plan":{"type":"object","properties":{"default_strategy":{"type":"string"},"canonical_reads":{"type":"array","items":{"type":"string"}},"classification":{"type":"array","items":{"type":"string"}},"publish_or_build_ui_only_when":{"type":"string"}},"additionalProperties":true},"optional_ui_plan":{"type":"object","properties":{"suggested_route":{"type":"string"},"default":{"type":"string"},"route_first":{"type":"boolean"},"panels":{"type":"array","items":{"type":"string"}},"guidance":{"type":"string"}},"additionalProperties":true},"completion_gate":{"type":"object","additionalProperties":true},"next_action":{"type":"string"}},"required":["target_route"],"additionalProperties":true},"suggested_questions_to_answer":{"type":"array","items":{"type":"object","properties":{"question":{"type":"string"},"why":{"type":"string"},"category":{"type":"string"},"source_contract_id":{"type":"string"},"source_contract_title":{"type":"string"},"covered_by_events":{"type":"array","items":{"type":"string"}}},"required":["question"],"additionalProperties":true}},"future_question_prompt":{"type":"string"},"questions_for_user":{"type":"array","items":{"type":"string"}},"assumption_warnings":{"type":"array","items":{"type":"string"}},"next_action":{"type":"string"}},"required":["contract_version","approved_plan_hash","framework","surface","signal_types","required_events","required_event_properties","provider_satisfied_events","event_buckets","happy_path_funnel","failure_surface_map","signal_map_template","plan_review","post_setup_blueprint","next_action"],"additionalProperties":true},"SaveSignalMapRequest":{"type":"object","properties":{"contract_version":{"type":"string"},"framework":{"type":"string"},"surface":{"type":"string","enum":["client","server","direct-http"]},"signal_types":{"type":"array","items":{"type":"string"}},"shapes":{"type":"array","items":{"type":"string"}},"has_revenue":{"type":"boolean"},"is_b2b":{"type":"boolean"},"is_two_sided":{"type":"boolean"},"approved_plan_hash":{"type":"string"},"approved_at":{"type":"integer"},"approval_notes":{"type":"array","items":{"type":"string"}},"approved_events":{"type":"array","items":{"type":"string"}},"approved_event_properties":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"provider_satisfied_events":{"type":"array","items":{"type":"object","properties":{"event":{"type":"string"},"source_event":{"type":"string"},"provider":{"type":"string"},"status":{"type":"string","enum":["provider_stream_preserved"]},"guidance":{"type":"string"}},"required":["event","source_event","provider","status","guidance"],"additionalProperties":true}},"happy_path_funnel":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"goal":{"type":"string"},"related_events":{"type":"array","items":{"type":"string"}}},"required":["id","title","goal","related_events"],"additionalProperties":true}},"event_buckets":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string"},"purpose":{"type":"string"},"required_events":{"type":"array","items":{"type":"string"}},"missing_events":{"type":"array","items":{"type":"string"}}},"required":["bucket","required_events","missing_events"],"additionalProperties":true}},"failure_surface_map":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"why":{"type":"string"},"related_stage_ids":{"type":"array","items":{"type":"string"}},"related_events":{"type":"array","items":{"type":"string"}},"source_error_surface_ids":{"type":"array","items":{"type":"string"}}},"required":["id","title","why"],"additionalProperties":true}},"planned_wiring_map":{"type":"array","items":{"type":"object","properties":{"signal":{"type":"string"},"kind":{"type":"string","enum":["event","error","deploy"]},"target_files":{"type":"array","items":{"type":"string"}},"target_surface":{"type":"string"},"trigger":{"type":"string"},"key_properties":{"type":"array","items":{"type":"string"}},"notes":{"type":"array","items":{"type":"string"}}},"required":["signal","kind","target_files","target_surface","trigger","key_properties","notes"],"additionalProperties":true}},"questions_to_answer":{"type":"array","items":{"type":"object","properties":{"question":{"type":"string"},"why":{"type":"string"},"category":{"type":"string"},"source_contract_id":{"type":"string"},"source_contract_title":{"type":"string"},"covered_by_events":{"type":"array","items":{"type":"string"}}},"required":["question"],"additionalProperties":true}},"answer_contracts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"state":{"type":"string","enum":["applicable","skipped","not_applicable","needs_mapping","deferred"]},"reason":{"type":"string"},"substituted_events":{"type":"object","additionalProperties":{"type":"string"}},"user_confirmed":{"type":"boolean"}},"required":["id","state"],"additionalProperties":true}},"post_setup_blueprint":{"type":"object","properties":{"artifact":{"type":"string","enum":["post_setup_blueprint"]},"target_route":{"type":"string"},"target_name":{"type":"string"},"route_guidance":{"type":"string"},"source_context":{"type":"array","items":{"type":"string"}},"customization_rules":{"type":"array","items":{"type":"string"}},"activation_definition":{"type":"object","properties":{"metric":{"type":"string","enum":["activation"]},"event":{"oneOf":[{"type":"string"},{"type":"null"}]},"label":{"type":"string"},"source":{"type":"string"},"reason":{"type":"string"},"supporting_events":{"type":"array","items":{"type":"string"}},"required_properties":{"type":"array","items":{"type":"string"}},"dashboard_guidance":{"type":"string"}},"required":["metric","event","label","source","reason"],"additionalProperties":true},"deployment_env_plan":{"type":"object","additionalProperties":true},"automations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"trigger":{"type":"string"},"purpose":{"type":"string"},"uses":{"type":"array","items":{"type":"string"}},"prompt_seed":{"type":"string"}},"required":["id","title","trigger","purpose"],"additionalProperties":true}},"question_readiness_plan":{"type":"object","properties":{"default_strategy":{"type":"string"},"canonical_reads":{"type":"array","items":{"type":"string"}},"classification":{"type":"array","items":{"type":"string"}},"publish_or_build_ui_only_when":{"type":"string"}},"additionalProperties":true},"optional_ui_plan":{"type":"object","properties":{"suggested_route":{"type":"string"},"default":{"type":"string"},"route_first":{"type":"boolean"},"panels":{"type":"array","items":{"type":"string"}},"guidance":{"type":"string"}},"additionalProperties":true},"completion_gate":{"type":"object","additionalProperties":true},"next_action":{"type":"string"}},"required":["target_route"],"additionalProperties":true},"discovery_map":{"type":"object","properties":{"product_summary":{"type":"string"},"product_category":{"type":"string"},"metric_lens":{"type":"string"},"primary_outcome":{"type":"string"},"existing_live_events":{"type":"array","items":{"type":"string"}},"source_files":{"type":"array","items":{"type":"string"}},"failure_surfaces":{"type":"array","items":{"type":"string"}},"planned_wiring_candidates":{"type":"array","items":{"type":"string"}},"wiring_candidates":{"type":"array","items":{"type":"string"}},"key_entities":{"type":"array","items":{"type":"string"}},"key_user_journeys":{"type":"array","items":{"type":"string"}},"ui_surfaces":{"type":"array","items":{"type":"string"}},"api_surfaces":{"type":"array","items":{"type":"string"}},"async_surfaces":{"type":"array","items":{"type":"string"}},"admin_surfaces":{"type":"array","items":{"type":"string"}},"external_dependencies":{"type":"array","items":{"type":"string"}},"monetization_surfaces":{"type":"array","items":{"type":"string"}},"deploy_surfaces":{"type":"array","items":{"type":"string"}},"risky_failure_paths":{"type":"array","items":{"type":"string"}},"notes":{"type":"array","items":{"type":"string"}}},"required":["product_summary","product_category","metric_lens","primary_outcome","key_entities","key_user_journeys","ui_surfaces","api_surfaces","async_surfaces","admin_surfaces","external_dependencies","monetization_surfaces","deploy_surfaces","risky_failure_paths"],"additionalProperties":true}},"required":["contract_version","framework","surface","approved_plan_hash","discovery_map","happy_path_funnel","event_buckets","failure_surface_map","planned_wiring_map"],"additionalProperties":true,"not":{"anyOf":[{"required":["required_events"]},{"required":["required_event_properties"]}]},"x-agentry-field-mapping":{"required_events":"approved_events","required_event_properties":"approved_event_properties"},"x-agentry-save-from-planner":"Use InstallPlanResponse.signal_map_template as the PUT body after user approval."},"SignalMap":{"type":"object","properties":{"project_id":{"type":"string"},"artifact":{"type":"string","enum":["signal_map"]},"version":{"type":"string"},"contract_version":{"type":"string"},"framework":{"type":"string"},"surface":{"type":"string","enum":["client","server","direct-http"]},"signal_types":{"type":"array","items":{"type":"string"}},"shapes":{"type":"array","items":{"type":"string"}},"has_revenue":{"type":"boolean"},"is_b2b":{"type":"boolean"},"is_two_sided":{"type":"boolean"},"mode":{"type":"string"},"approval_status":{"type":"string"},"approved_plan_hash":{"type":"string"},"approved_at":{"type":"integer"},"approved_events":{"type":"array","items":{"type":"string"}},"approved_event_properties":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"provider_satisfied_events":{"type":"array","items":{"type":"object","properties":{"event":{"type":"string"},"source_event":{"type":"string"},"provider":{"type":"string"},"status":{"type":"string","enum":["provider_stream_preserved"]},"guidance":{"type":"string"}},"required":["event","source_event","provider","status","guidance"],"additionalProperties":true}},"discovery_map":{"oneOf":[{"type":"object","properties":{"product_summary":{"type":"string"},"product_category":{"type":"string"},"metric_lens":{"type":"string"},"primary_outcome":{"type":"string"},"existing_live_events":{"type":"array","items":{"type":"string"}},"source_files":{"type":"array","items":{"type":"string"}},"failure_surfaces":{"type":"array","items":{"type":"string"}},"planned_wiring_candidates":{"type":"array","items":{"type":"string"}},"wiring_candidates":{"type":"array","items":{"type":"string"}},"key_entities":{"type":"array","items":{"type":"string"}},"key_user_journeys":{"type":"array","items":{"type":"string"}},"ui_surfaces":{"type":"array","items":{"type":"string"}},"api_surfaces":{"type":"array","items":{"type":"string"}},"async_surfaces":{"type":"array","items":{"type":"string"}},"admin_surfaces":{"type":"array","items":{"type":"string"}},"external_dependencies":{"type":"array","items":{"type":"string"}},"monetization_surfaces":{"type":"array","items":{"type":"string"}},"deploy_surfaces":{"type":"array","items":{"type":"string"}},"risky_failure_paths":{"type":"array","items":{"type":"string"}},"notes":{"type":"array","items":{"type":"string"}}},"required":["product_summary","product_category","metric_lens","primary_outcome","key_entities","key_user_journeys","ui_surfaces","api_surfaces","async_surfaces","admin_surfaces","external_dependencies","monetization_surfaces","deploy_surfaces","risky_failure_paths"],"additionalProperties":true},{"type":"null"}]},"happy_path_funnel":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"goal":{"type":"string"},"related_events":{"type":"array","items":{"type":"string"}}},"required":["id","title","goal","related_events"],"additionalProperties":true}},"event_buckets":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string"},"purpose":{"type":"string"},"required_events":{"type":"array","items":{"type":"string"}},"missing_events":{"type":"array","items":{"type":"string"}}},"required":["bucket","required_events","missing_events"],"additionalProperties":true}},"answer_contracts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"state":{"type":"string","enum":["applicable","skipped","not_applicable","needs_mapping","deferred"]},"reason":{"type":"string"},"substituted_events":{"type":"object","additionalProperties":{"type":"string"}},"user_confirmed":{"type":"boolean"}},"required":["id","state"],"additionalProperties":true}},"failure_surface_map":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"why":{"type":"string"},"related_stage_ids":{"type":"array","items":{"type":"string"}},"related_events":{"type":"array","items":{"type":"string"}},"source_error_surface_ids":{"type":"array","items":{"type":"string"}}},"required":["id","title","why"],"additionalProperties":true}},"planned_wiring_map":{"type":"array","items":{"type":"object","properties":{"signal":{"type":"string"},"kind":{"type":"string","enum":["event","error","deploy"]},"target_files":{"type":"array","items":{"type":"string"}},"target_surface":{"type":"string"},"trigger":{"type":"string"},"key_properties":{"type":"array","items":{"type":"string"}},"notes":{"type":"array","items":{"type":"string"}}},"required":["signal","kind","target_files","target_surface","trigger","key_properties","notes"],"additionalProperties":true}},"questions_to_answer":{"type":"array","items":{"type":"object","properties":{"question":{"type":"string"},"why":{"type":"string"},"category":{"type":"string"},"source_contract_id":{"type":"string"},"source_contract_title":{"type":"string"},"covered_by_events":{"type":"array","items":{"type":"string"}}},"required":["question"],"additionalProperties":true}},"post_setup_blueprint":{"oneOf":[{"type":"object","properties":{"artifact":{"type":"string","enum":["post_setup_blueprint"]},"target_route":{"type":"string"},"target_name":{"type":"string"},"route_guidance":{"type":"string"},"source_context":{"type":"array","items":{"type":"string"}},"customization_rules":{"type":"array","items":{"type":"string"}},"activation_definition":{"type":"object","properties":{"metric":{"type":"string","enum":["activation"]},"event":{"oneOf":[{"type":"string"},{"type":"null"}]},"label":{"type":"string"},"source":{"type":"string"},"reason":{"type":"string"},"supporting_events":{"type":"array","items":{"type":"string"}},"required_properties":{"type":"array","items":{"type":"string"}},"dashboard_guidance":{"type":"string"}},"required":["metric","event","label","source","reason"],"additionalProperties":true},"deployment_env_plan":{"type":"object","additionalProperties":true},"automations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"trigger":{"type":"string"},"purpose":{"type":"string"},"uses":{"type":"array","items":{"type":"string"}},"prompt_seed":{"type":"string"}},"required":["id","title","trigger","purpose"],"additionalProperties":true}},"question_readiness_plan":{"type":"object","properties":{"default_strategy":{"type":"string"},"canonical_reads":{"type":"array","items":{"type":"string"}},"classification":{"type":"array","items":{"type":"string"}},"publish_or_build_ui_only_when":{"type":"string"}},"additionalProperties":true},"optional_ui_plan":{"type":"object","properties":{"suggested_route":{"type":"string"},"default":{"type":"string"},"route_first":{"type":"boolean"},"panels":{"type":"array","items":{"type":"string"}},"guidance":{"type":"string"}},"additionalProperties":true},"completion_gate":{"type":"object","additionalProperties":true},"next_action":{"type":"string"}},"required":["target_route"],"additionalProperties":true},{"type":"null"}]},"implementation_report_template":{"type":"object","properties":{"method":{"type":"string"},"endpoint":{"type":"string"},"management_auth_header":{"type":"string"},"note":{"type":"string"},"body":{"type":"object","additionalProperties":true}},"required":["method","endpoint","body"],"additionalProperties":true},"verify_request_template":{"type":"object","properties":{"method":{"type":"string"},"endpoint":{"type":"string"},"note":{"type":"string"},"body":{"type":"object","additionalProperties":true}},"required":["method","endpoint","body"],"additionalProperties":true},"question_handoff":{"type":"object","properties":{"first_artifacts":{"type":"array","items":{"type":"string"}},"suggested_sections":{"type":"array","items":{"type":"string"}},"build_order":{"type":"array","items":{"type":"string"}}},"required":["first_artifacts","suggested_sections","build_order"],"additionalProperties":true},"approval_notes":{"type":"array","items":{"type":"string"}},"next_action":{"type":"string"},"created_at":{"type":"integer"},"updated_at":{"type":"integer"}},"required":["project_id","contract_version","framework","surface","approved_plan_hash","happy_path_funnel","event_buckets","failure_surface_map"],"additionalProperties":true},"ImplementationCoverage":{"type":"object","properties":{"events":{"type":"array","items":{"type":"string"}},"event_properties":{"type":"array","items":{"type":"string"}},"error_surface_ids":{"type":"array","items":{"type":"string"}},"deploy_surfaces":{"type":"array","items":{"type":"string"}}},"required":["events","event_properties","error_surface_ids","deploy_surfaces"],"additionalProperties":true},"ImplementationReportRequest":{"type":"object","properties":{"approved_plan_hash":{"oneOf":[{"type":"string"},{"type":"null"}]},"repo_root":{"oneOf":[{"type":"string"},{"type":"null"}]},"summary":{"type":"string"},"files_touched":{"type":"array","items":{"type":"string"}},"coverage":{"type":"object","properties":{"events":{"type":"array","items":{"type":"string"}},"event_properties":{"type":"array","items":{"type":"string"}},"error_surface_ids":{"type":"array","items":{"type":"string"}},"deploy_surfaces":{"type":"array","items":{"type":"string"}}},"required":["events","event_properties","error_surface_ids","deploy_surfaces"],"additionalProperties":true},"unresolved_gaps":{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"object","additionalProperties":true}]}},"follow_up_checks":{"type":"array","items":{"type":"string"}},"notes":{"type":"array","items":{"type":"string"}}},"required":["summary","files_touched","coverage","unresolved_gaps","follow_up_checks"],"additionalProperties":false},"ImplementationReport":{"type":"object","properties":{"artifact":{"type":"string","enum":["implementation_report"]},"project_id":{"type":"string"},"approved_plan_hash":{"oneOf":[{"type":"string"},{"type":"null"}]},"repo_root":{"oneOf":[{"type":"string"},{"type":"null"}]},"summary":{"type":"string"},"files_touched":{"type":"array","items":{"type":"string"}},"coverage":{"type":"object","properties":{"events":{"type":"array","items":{"type":"string"}},"event_properties":{"type":"array","items":{"type":"string"}},"error_surface_ids":{"type":"array","items":{"type":"string"}},"deploy_surfaces":{"type":"array","items":{"type":"string"}}},"required":["events","event_properties","error_surface_ids","deploy_surfaces"],"additionalProperties":true},"unresolved_gaps":{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"object","additionalProperties":true}]}},"follow_up_checks":{"type":"array","items":{"type":"string"}},"notes":{"type":"array","items":{"type":"string"}},"created_at":{"oneOf":[{"type":"integer"},{"type":"null"}]},"updated_at":{"oneOf":[{"type":"integer"},{"type":"null"}]},"input_approved_plan_hash":{"oneOf":[{"type":"string"},{"type":"null"}]},"hash_canonicalized":{"type":"boolean"},"verify_request_template":{"oneOf":[{"type":"object","properties":{"method":{"type":"string"},"endpoint":{"type":"string"},"note":{"type":"string"},"body":{"type":"object","additionalProperties":true}},"required":["method","endpoint","body"],"additionalProperties":true},{"type":"null"}]}},"required":["summary","files_touched","coverage","unresolved_gaps","follow_up_checks"],"additionalProperties":true},"VerifyInstallRequest":{"type":"object","properties":{"dsn":{"type":"string"},"skip":{"type":"array","items":{"type":"string","enum":["errors","analytics","deploys"]}},"shapes":{"type":"array","items":{"type":"string"}},"has_revenue":{"type":"boolean"},"is_b2b":{"type":"boolean"},"is_two_sided":{"type":"boolean"},"repo_audit":{"type":"object","properties":{"repo_root":{"oneOf":[{"type":"string"},{"type":"null"}]},"approved_plan_hash":{"oneOf":[{"type":"string"},{"type":"null"}]},"planned_events":{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"object","properties":{"target":{"type":"string"},"kind":{"type":"string"},"event":{"type":"string"},"property":{"type":"string"},"wired":{"type":"boolean"},"matches":{"type":"array","items":{"type":"object","properties":{"file":{"type":"string"},"line":{"type":"integer"},"preview":{"type":"string"}},"required":["file","line","preview"],"additionalProperties":false}},"files":{"type":"array","items":{"type":"string"}},"evidence":{"type":"array","items":{"type":"string"}}},"additionalProperties":true}]}},"planned_event_properties":{"oneOf":[{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},{"type":"array","items":{"type":"object","properties":{"target":{"type":"string"},"kind":{"type":"string"},"event":{"type":"string"},"property":{"type":"string"},"wired":{"type":"boolean"},"matches":{"type":"array","items":{"type":"object","properties":{"file":{"type":"string"},"line":{"type":"integer"},"preview":{"type":"string"}},"required":["file","line","preview"],"additionalProperties":false}},"files":{"type":"array","items":{"type":"string"}},"evidence":{"type":"array","items":{"type":"string"}}},"additionalProperties":true}}]},"event_coverage":{"type":"object","additionalProperties":{"oneOf":[{"type":"boolean"},{"type":"array","items":{"type":"string"}},{"type":"object","additionalProperties":true}]}},"error_surfaces":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"surface":{"type":"string"},"required_when":{"type":"string","enum":["always","when_repo_patterns_match"]},"verify_strategy":{"type":"string","enum":["literal_presence","detect_file_has_wire"]},"step_ids":{"type":"array","items":{"type":"string"}},"applicable":{"type":"boolean"},"wired":{"type":"boolean"},"detect_file_count":{"type":"integer"},"covered_file_count":{"type":"integer"},"detect_matches":{"type":"array","items":{"type":"object","properties":{"file":{"type":"string"},"line":{"type":"integer"},"preview":{"type":"string"}},"required":["file","line","preview"],"additionalProperties":false}},"wire_matches":{"type":"array","items":{"type":"object","properties":{"file":{"type":"string"},"line":{"type":"integer"},"preview":{"type":"string"}},"required":["file","line","preview"],"additionalProperties":false}},"uncovered_matches":{"type":"array","items":{"type":"object","properties":{"file":{"type":"string"},"line":{"type":"integer"},"preview":{"type":"string"}},"required":["file","line","preview"],"additionalProperties":false}}},"required":["id","title","surface","required_when","verify_strategy","step_ids","applicable","wired","detect_file_count","covered_file_count","detect_matches","wire_matches"],"additionalProperties":true}},"generated_at":{"oneOf":[{"type":"integer"},{"type":"null"}]}},"additionalProperties":true}},"required":["dsn","repo_audit"],"additionalProperties":false},"VerifyInstallResponse":{"type":"object","properties":{"artifact":{"type":"string","enum":["verify_report"]},"project_id":{"type":"string"},"approved_plan_hash":{"oneOf":[{"type":"string"},{"type":"null"}]},"ok":{"type":"boolean"},"minimum_install_complete":{"type":"boolean"},"readiness_complete":{"type":"boolean"},"answer_ready":{"type":"boolean"},"summary":{"type":"string"},"passed":{"type":"array","items":{"type":"string"}},"failed":{"type":"array","items":{"type":"string"}},"checks":{"type":"object","properties":{},"additionalProperties":{"type":"object","properties":{"ok":{"type":"boolean"},"detail":{"type":"string"}},"required":["ok","detail"],"additionalProperties":true}},"approved_plan":{"oneOf":[{"type":"object","properties":{"source":{"type":"string"},"approval_status":{"type":"string"},"approved_at":{"oneOf":[{"type":"integer"},{"type":"null"}]},"approved_plan_hash":{"oneOf":[{"type":"string"},{"type":"null"}]},"funnel_stage_count":{"type":"integer"},"event_bucket_count":{"type":"integer"},"approved_event_count":{"type":"integer"},"failure_surface_count":{"type":"integer"}},"required":["source","approval_status"],"additionalProperties":true},{"type":"null"}]},"repo_audit":{"type":"object","properties":{"status":{"type":"string","enum":["missing","stale","fresh"]},"reason":{"type":"string"},"repo_root":{"oneOf":[{"type":"string"},{"type":"null"}]},"approved_plan_hash":{"oneOf":[{"type":"string"},{"type":"null"}]}},"required":["status","reason"],"additionalProperties":true},"planned_event_check":{"type":"object","properties":{"requested":{"type":"boolean"},"required_event_count":{"type":"integer"},"seen_required_event_count":{"type":"integer"},"observed_required_event_count":{"type":"integer"},"source_wired_required_event_count":{"type":"integer"},"pending_real_data_events":{"type":"array","items":{"type":"string"}},"pending_real_data_event_properties":{"type":"array","items":{"type":"string"}},"missing_events":{"type":"array","items":{"type":"string"}},"missing_event_properties":{"type":"array","items":{"type":"string"}},"wiring_hints":{"type":"object","properties":{"searched":{"type":"boolean"},"repo_root":{"type":"string"},"events":{"type":"array","items":{"type":"object","properties":{"target":{"type":"string"},"kind":{"type":"string"},"event":{"type":"string"},"property":{"type":"string"},"wired":{"type":"boolean"},"matches":{"type":"array","items":{"type":"object","properties":{"file":{"type":"string"},"line":{"type":"integer"},"preview":{"type":"string"}},"required":["file","line","preview"],"additionalProperties":false}},"files":{"type":"array","items":{"type":"string"}},"evidence":{"type":"array","items":{"type":"string"}}},"additionalProperties":true}},"event_properties":{"type":"array","items":{"type":"object","properties":{"target":{"type":"string"},"kind":{"type":"string"},"event":{"type":"string"},"property":{"type":"string"},"wired":{"type":"boolean"},"matches":{"type":"array","items":{"type":"object","properties":{"file":{"type":"string"},"line":{"type":"integer"},"preview":{"type":"string"}},"required":["file","line","preview"],"additionalProperties":false}},"files":{"type":"array","items":{"type":"string"}},"evidence":{"type":"array","items":{"type":"string"}}},"additionalProperties":true}}},"required":["searched","events","event_properties"],"additionalProperties":true},"skipped_reason":{"type":"string"}},"required":["requested","required_event_count","seen_required_event_count","missing_events","missing_event_properties"],"additionalProperties":true},"state_transition_check":{"type":"object","properties":{"requested":{"type":"boolean"},"checked_events":{"type":"array","items":{"type":"string"}},"weak_events":{"type":"array","items":{"type":"string"}},"issues":{"type":"array","items":{"type":"object","properties":{"event":{"type":"string"},"reason":{"type":"string"},"matches":{"type":"array","items":{"type":"object","properties":{"file":{"type":"string"},"line":{"type":"integer"},"preview":{"type":"string"}},"required":["file","line","preview"],"additionalProperties":false}}},"required":["event","reason","matches"],"additionalProperties":true}},"skipped_reason":{"type":"string"}},"required":["requested","checked_events","weak_events","issues"],"additionalProperties":true},"answer_contract_check":{"type":"object","properties":{"requested":{"type":"boolean"},"answerability_contract_source":{"type":"string"},"fallback_question_contract":{"oneOf":[{"type":"object","additionalProperties":true},{"type":"null"}]},"applicable_count":{"type":"integer"},"answerable_count":{"type":"integer"},"pending_real_data_count":{"type":"integer"},"blocked_count":{"type":"integer"},"answerable_contract_ids":{"type":"array","items":{"type":"string"}},"blocked_contract_ids":{"type":"array","items":{"type":"string"}},"pending_real_data_contract_ids":{"type":"array","items":{"type":"string"}},"missing_events":{"type":"array","items":{"type":"string"}},"missing_event_properties":{"type":"array","items":{"type":"string"}},"blocked_event_properties":{"type":"array","items":{"type":"string"}},"pending_real_data_events":{"type":"array","items":{"type":"string"}},"pending_real_data_event_properties":{"type":"array","items":{"type":"string"}},"skipped_reason":{"type":"string"}},"required":["requested","applicable_count","answerable_count","pending_real_data_count","blocked_count","answerable_contract_ids","blocked_contract_ids","pending_real_data_contract_ids","missing_events","missing_event_properties"],"additionalProperties":true},"error_surface_check":{"type":"object","properties":{"requested":{"type":"boolean"},"applicable_count":{"type":"integer"},"wired_count":{"type":"integer"},"missing_ids":{"type":"array","items":{"type":"string"}},"skipped_reason":{"type":"string"}},"required":["requested","applicable_count","wired_count","missing_ids"],"additionalProperties":true},"real_events":{"type":"object","properties":{"total":{"type":"integer"},"real":{"type":"integer"},"samples":{"type":"array","items":{"type":"string"}},"error":{"type":"string"}},"required":["total","real","samples"],"additionalProperties":true},"gate_failures":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fix":{"type":"string"}},"required":["code","message"],"additionalProperties":true}},"readiness_gaps":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"fix":{"type":"string"}},"required":["code","message"],"additionalProperties":true}},"required_handoff_items":{"type":"array","items":{"type":"string"}},"final_handoff_markdown":{"oneOf":[{"type":"string"},{"type":"null"}]},"post_setup_blueprint":{"oneOf":[{"type":"object","properties":{"artifact":{"type":"string","enum":["post_setup_blueprint"]},"target_route":{"type":"string"},"target_name":{"type":"string"},"route_guidance":{"type":"string"},"source_context":{"type":"array","items":{"type":"string"}},"customization_rules":{"type":"array","items":{"type":"string"}},"activation_definition":{"type":"object","properties":{"metric":{"type":"string","enum":["activation"]},"event":{"oneOf":[{"type":"string"},{"type":"null"}]},"label":{"type":"string"},"source":{"type":"string"},"reason":{"type":"string"},"supporting_events":{"type":"array","items":{"type":"string"}},"required_properties":{"type":"array","items":{"type":"string"}},"dashboard_guidance":{"type":"string"}},"required":["metric","event","label","source","reason"],"additionalProperties":true},"deployment_env_plan":{"type":"object","additionalProperties":true},"automations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"trigger":{"type":"string"},"purpose":{"type":"string"},"uses":{"type":"array","items":{"type":"string"}},"prompt_seed":{"type":"string"}},"required":["id","title","trigger","purpose"],"additionalProperties":true}},"question_readiness_plan":{"type":"object","properties":{"default_strategy":{"type":"string"},"canonical_reads":{"type":"array","items":{"type":"string"}},"classification":{"type":"array","items":{"type":"string"}},"publish_or_build_ui_only_when":{"type":"string"}},"additionalProperties":true},"optional_ui_plan":{"type":"object","properties":{"suggested_route":{"type":"string"},"default":{"type":"string"},"route_first":{"type":"boolean"},"panels":{"type":"array","items":{"type":"string"}},"guidance":{"type":"string"}},"additionalProperties":true},"completion_gate":{"type":"object","additionalProperties":true},"next_action":{"type":"string"}},"required":["target_route"],"additionalProperties":true},{"type":"null"}]},"suggested_next_step_titles":{"type":"array","items":{"type":"string"}},"suggested_next_steps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"prompt_template":{"type":"string"},"uses":{"type":"array","items":{"type":"string"}},"estimated_seconds":{"type":"integer"},"requires":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["available","preview","coming_soon"]}},"required":["id","title","description","prompt_template","uses","estimated_seconds","requires"],"additionalProperties":true}},"wiring_hints":{"type":"object","properties":{"searched":{"type":"boolean"},"repo_root":{"type":"string"},"events":{"type":"array","items":{"type":"object","properties":{"target":{"type":"string"},"kind":{"type":"string"},"event":{"type":"string"},"property":{"type":"string"},"wired":{"type":"boolean"},"matches":{"type":"array","items":{"type":"object","properties":{"file":{"type":"string"},"line":{"type":"integer"},"preview":{"type":"string"}},"required":["file","line","preview"],"additionalProperties":false}},"files":{"type":"array","items":{"type":"string"}},"evidence":{"type":"array","items":{"type":"string"}}},"additionalProperties":true}},"event_properties":{"type":"array","items":{"type":"object","properties":{"target":{"type":"string"},"kind":{"type":"string"},"event":{"type":"string"},"property":{"type":"string"},"wired":{"type":"boolean"},"matches":{"type":"array","items":{"type":"object","properties":{"file":{"type":"string"},"line":{"type":"integer"},"preview":{"type":"string"}},"required":["file","line","preview"],"additionalProperties":false}},"files":{"type":"array","items":{"type":"string"}},"evidence":{"type":"array","items":{"type":"string"}}},"additionalProperties":true}}},"required":["searched","events","event_properties"],"additionalProperties":true},"next_action":{"type":"string"},"generated_at":{"oneOf":[{"type":"integer"},{"type":"null"}]}},"required":["ok","minimum_install_complete","readiness_complete","answer_ready","summary","passed","failed","checks","repo_audit","planned_event_check","answer_contract_check","error_surface_check","real_events","gate_failures","readiness_gaps","required_handoff_items","final_handoff_markdown"],"additionalProperties":true},"AnswerContractsResponse":{"type":"object","properties":{"inputs":{"type":"object","properties":{"shapes":{"type":"array","items":{"type":"string"}},"has_revenue":{"type":"boolean"},"is_b2b":{"type":"boolean"},"is_two_sided":{"type":"boolean"}},"additionalProperties":true},"source":{"type":"string"},"project_id":{"type":"string"},"approved_plan_hash":{"type":"string"},"questions_to_answer":{"type":"array","items":{"type":"object","properties":{"question":{"type":"string"},"why":{"type":"string"},"category":{"type":"string"},"source_contract_id":{"type":"string"},"source_contract_title":{"type":"string"},"covered_by_events":{"type":"array","items":{"type":"string"}}},"required":["question"],"additionalProperties":true}},"answerability_contract_source":{"type":"string"},"fallback_question_contract":{"oneOf":[{"type":"object","properties":{"state":{"type":"string","enum":["questions_without_materialized_answer_contracts"]},"source":{"type":"string"},"question_count":{"type":"integer"},"required_events":{"type":"array","items":{"type":"string"}},"required_event_properties":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"guidance":{"type":"string"}},"required":["state","source","question_count","required_events","required_event_properties"],"additionalProperties":true},{"type":"null"}]},"answer_contract_library_count":{"type":"integer"},"unsaved_contract_ids":{"type":"array","items":{"type":"string"}},"drift":{"type":"object","properties":{"answer_contract_library_larger_than_saved_state":{"type":"boolean"},"answer_contract_library_count":{"type":"integer"},"saved_applicable_count":{"type":"integer"},"unsaved_contract_count":{"type":"integer"}},"additionalProperties":true},"applicable_count":{"type":"integer"},"total_count":{"type":"integer"},"answer_contracts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"starter_prompt":{"type":"string"},"category":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"applies_to":{"type":"array","items":{"type":"string"}},"example_only":{"type":"boolean"},"adaptation_required":{"type":"boolean"},"requirement_level":{"type":"string","enum":["planning_preview","approved_signal_map"]},"fit_confidence":{"type":"string"},"why_included":{"type":"string"},"acceptable_substitutions":{"type":"string"},"negative_fit":{"type":"array","items":{"type":"string"}},"ask_if_missing":{"type":"array","items":{"type":"string"}},"required_events":{"type":"array","items":{"type":"string"}},"readiness_events":{"type":"array","items":{"type":"string"}},"required_event_properties":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["id","title","required_events","readiness_events","required_event_properties"],"additionalProperties":true}},"answer_contract_decisions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"state":{"type":"string","enum":["applicable","skipped","not_applicable","needs_mapping","deferred"]},"reason":{"type":"string"},"substituted_events":{"type":"object","additionalProperties":{"type":"string"}},"user_confirmed":{"type":"boolean"}},"required":["id","state"],"additionalProperties":true}},"required_events":{"type":"array","items":{"type":"string"}},"readiness_events":{"type":"array","items":{"type":"string"}},"required_event_properties":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"skipped_count":{"type":"integer"},"skipped":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"reason":{"type":"string"},"negative_fit":{"type":"array","items":{"type":"string"}}},"required":["id","title","reason"],"additionalProperties":true}},"next_action":{"type":"string"}},"required":["required_events","required_event_properties","questions_to_answer","answerability_contract_source","fallback_question_contract"],"additionalProperties":false}}}}