{"openapi":"3.1.0","info":{"title":"gotcontext.ai API","description":"Semantic compression API — cut AI token costs by up to 85%. Compress text and code while preserving meaning. Supports REST API and MCP (Model Context Protocol) via Streamable HTTP.","contact":{"name":"gotcontext.ai","url":"https://gotcontext.ai/","email":"support@gotcontext.ai"},"license":{"name":"Proprietary","url":"https://gotcontext.ai/terms"},"version":"1.71.3"},"servers":[{"url":"https://api.gotcontext.ai","description":"Production"},{"url":"http://localhost:8080","description":"Local development"}],"paths":{"/health":{"get":{"tags":["health","health"],"summary":"Health Shortcut","description":"Alias for /health/liveness — convenience for monitoring tools.","operationId":"health_shortcut_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/health/liveness":{"get":{"tags":["health"],"summary":"Liveness","description":"Simple alive check — always returns 200 if process is running.","operationId":"liveness_health_liveness_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/health/readiness":{"get":{"tags":["health"],"summary":"Readiness","description":"Readiness check — verifies core dependencies are available.","operationId":"readiness_health_readiness_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/health/diagnostics":{"get":{"tags":["health"],"summary":"Diagnostics","description":"Detailed diagnostics snapshot for ops/SRE monitoring.\n\nNot auth-gated — all fields are operational metadata, no user data.\n\nFields populated at this time:\n  - status, version, uptime_seconds, circuit_breakers: always present.\n  - latency_p50/p95/p99_ms: null — populated by latency middleware in v1.10.\n  - cache_hit_rate: sourced from token-saver HealthChecker when available.\n  - mcp_sessions_active: null — MCP session count not yet exposed via a\n    stable accessor; tracked via Prometheus gc_mcp_* counters instead.","operationId":"diagnostics_health_diagnostics_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/health/scheduler":{"get":{"tags":["health","health"],"summary":"Scheduler Health","description":"Is the SCHEDULER alive? Readable without GitHub, and without a key.\n\nWHY THIS EXISTS. On 2026-08-19 the GitHub Actions budget exhausted and every\nscheduled job stopped for 8 hours — ~360 missed firings including the\nsettlement drain and budget checks. Nothing noticed. `cron-health.yml`\ndetects a dead scheduler by querying the Actions API, so it runs on the very\nbudget whose exhaustion it exists to detect; it fired twice during the\noutage and failed both times, reporting nothing.\n\nA watchdog must not share its subject's single point of failure. This\nendpoint is served by the API — a different provider, a different budget,\na different failure domain from the thing it observes.\n\nDELIBERATELY NOT PART OF /health/readiness. Readiness gates restarts, and\nfolding downstream state into it means a late cron restart-loops the API —\nthe \"keep downstream state out of the restart-gating liveness signal\" rule\nthis repo already paid for. This is a separate, read-only signal.\n\nUNAUTHENTICATED, and the payload is shaped for that: a summary only. An\nexternal probe needs \"is it alive\", not our schedule. Endpoint names and\nper-job timings stay behind the authenticated `/v1/infra/health`.\n\n`unknown` is not `stale`. A cache flush or a cold start loses the marks, and\nreporting that as a dead scheduler would be a false alarm on every deploy —\nthe caller is told the difference so it can decide.","operationId":"scheduler_health_health_scheduler_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/infra/health":{"get":{"tags":["infra"],"summary":"Get Health","operationId":"get_health_v1_infra_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/metrics":{"get":{"tags":["monitoring"],"summary":"Prometheus Metrics","description":"Export Prometheus metrics in text format.\n\nIncludes counters and gauges from the prometheus_client registry.\nUseful for Grafana dashboards, alerting, and SLO monitoring.\n\nOpt-in scrape-token gate (codex 2026-06-29 finding #3): this endpoint is\nauth-bypassed (auth.py) + rate-limit-exempt (rate_limit.py) by design so a\nPrometheus scraper can reach it, which means it otherwise leaks operational\ntelemetry (MCP tool usage, sessions, plan/status breakdowns, active users)\nto anyone. When METRICS_SCRAPE_TOKEN is set, require a matching\n`Authorization: Bearer <token>`; when unset it stays public so no existing\nscraper breaks until an operator configures the token + the scrape job.","operationId":"prometheus_metrics_metrics_get","responses":{"200":{"description":"Successful Response","content":{"text/plain":{"schema":{"type":"string"}}}}}}},"/.well-known/oauth-protected-resource":{"get":{"tags":["oauth"],"summary":"Oauth Protected Resource","description":"Return the RFC 9728 Protected Resource Metadata document.","operationId":"oauth_protected_resource__well_known_oauth_protected_resource_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Oauth Protected Resource  Well Known Oauth Protected Resource Get"}}}}}}},"/.well-known/a2a-jwks.json":{"get":{"tags":["a2a"],"summary":"A2A Jwks","description":"Return the JWKS document for the A2A share-manifest signing key.\n\nReturns ``{\"keys\": []}`` (200, not an error) when no signing key is\nconfigured yet — an operator that has not provisioned\n``A2A_SIGNING_PRIVATE_KEY`` simply has nothing published, not a broken\nendpoint.","operationId":"a2a_jwks__well_known_a2a_jwks_json_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/.well-known/agent.json":{"get":{"tags":["a2a"],"summary":"Agent Card Legacy","description":"A2A Agent Card — legacy 0.x path used by early Vertex AI ADK + CEO spec.","operationId":"agent_card_legacy__well_known_agent_json_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/.well-known/agent-card.json":{"get":{"tags":["a2a"],"summary":"Agent Card","description":"A2A Agent Card — v1.0 canonical path per spec section 8.2.","operationId":"agent_card__well_known_agent_card_json_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/internal/benchmark-aggregate":{"get":{"tags":["internal"],"summary":"Benchmark Aggregate","description":"Return aggregated benchmark rows (v0: empty; v1: first-party MCP traffic).\n\nRequires ``X-Internal-Token`` header matching the ``INTERNAL_API_TOKEN``\nenvironment variable.  Returns 401 if the token is absent or incorrect.","operationId":"benchmark_aggregate_internal_benchmark_aggregate_get","parameters":[{"name":"x-internal-token","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Internal-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/compress":{"post":{"tags":["compression"],"summary":"Compress","description":"Compress text using semantic compression.\n\nv1.9.0: end-to-end latency is recorded as ``gc_compress_duration_seconds``\nfor the CompressP95HighLatency Prometheus alert rule.\n\nAchieves 80-95% token reduction on medium-to-large documents.\nSmall documents (<100 tokens) may see less compression.\n\nPass an optional ``query`` to enable query-guided mode — the compressor\nwill prioritise sections most relevant to your query while maintaining\nthe overall compression ratio set by ``fidelity``.\n\nv1.3 adds a plan-gated semantic dedup cache. Pro/Team/Enterprise\ncompressions go through the cache first; on hit the stored response\nis returned verbatim with ``X-Semantic-Cache: hit``. On miss the\nnormal compressor runs and the response is stored with a\nplan-sized TTL (1h/24h/7d). Free plan bypasses the cache entirely.","operationId":"compress_v1_compress_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompressRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompressResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/compress-code":{"post":{"tags":["compression"],"summary":"Compress Code Endpoint","description":"Compress source code using AST-aware semantic compression.\n\nUnlike plain text compression, this endpoint:\n- Parses the AST to respect function/class boundaries as natural chunk units\n- Extracts imports, docstrings, and dependency graphs\n- Ranks functions/classes by importance using PageRank on the dependency graph\n- Returns a skeleton with signatures, docstrings, and importance scores\n\nSupported languages: Python (AST-native), JavaScript/TypeScript (regex-based),\nJava, Go, Rust, C++ (line-based fallback).\n\nAuto-detects language from content when ``language`` is not provided.","operationId":"compress_code_endpoint_v1_compress_code_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompressCodeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompressCodeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/compress-code/structural":{"post":{"tags":["compression"],"summary":"Compress Code Structural","description":"v1.5.0 — structural-context compression via tensor-grep blast-radius\n+ BM25 + Reciprocal Rank Fusion.","operationId":"compress_code_structural_v1_compress_code_structural_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StructuralCompressRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StructuralCompressResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/batch-compress":{"post":{"tags":["compression"],"summary":"Batch Compress","description":"Compress multiple documents concurrently.\n\nAccepts up to 50 documents per call. Each document may specify its own\n``fidelity`` level and optional ``query`` for query-guided mode.\n\nDocuments are processed with bounded concurrency (max 4 simultaneous) to\navoid saturating the embedding model. Failed documents are reported in the\n``results`` list with an ``error`` field; the overall batch still returns 200.\n\nReturns per-document results plus aggregate summary statistics.","operationId":"batch_compress_v1_batch_compress_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/recommend":{"post":{"tags":["compression"],"summary":"Recommend","description":"Recommend the best compression fidelity level for a document.\n\nAnalyses document size and (optionally) the target model's context window\nto suggest a fidelity level that balances information preservation with\ntoken efficiency.\n\nRules (in priority order):\n1. Document < 500 tokens → \"detailed\" (minimal compression, preserve quality)\n2. Document 500–2,000 tokens → \"balanced\" (standard 5× compression target)\n3. Document 2,000–10,000 tokens → \"outline\" (structural skeleton)\n4. Document > 10,000 tokens → \"abstract\" (aggressive summary)\n5. If model/context_window provided and compressed output would exceed 70% of\n   the context window, step up to a more aggressive fidelity level.","operationId":"recommend_v1_recommend_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecommendRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecommendResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/keys":{"get":{"tags":["api-keys"],"summary":"List Keys","description":"List all API keys for the authenticated user.\n\nReads from Postgres (authoritative). Returns 503 when the database is\nunavailable rather than serving potentially stale partial data.","operationId":"list_keys_v1_keys_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListKeysResponse"}}}}}},"post":{"tags":["api-keys"],"summary":"Create Key","description":"Create a new API key for the authenticated user.\n\nThe full key is returned **once** in the response and cannot be retrieved\nagain. Store it in a secure location immediately.\n\nKeys are prefixed ``gc_`` and consist of 32 random hex characters.\nThey can be used with ``Authorization: Bearer gc_...`` headers as an\nalternative to Clerk JWT tokens.\n\nStorage order: Postgres first (primary), then Redis (cache).\nIf Postgres is unavailable, return 503 rather than creating a partial key.","operationId":"create_key_v1_keys_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateKeyRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateKeyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/keys/{key_id}":{"patch":{"tags":["api-keys"],"summary":"Update Key","description":"Update mutable fields on an API key.\n\nCurrently supports ``name``, ``default_model``, and ``monthly_quota``\n(v1.20.2 per-key quota). Pass ``\"monthly_quota\": null`` to clear the\nquota — the key becomes uncapped and ``quota_alert_state`` resets\nto ``'none'``. Any change to ``monthly_quota`` (set or clear) also\nresets ``quota_period_start`` to the current time so the next cron\nsweep evaluates against a clean window.","operationId":"update_key_v1_keys__key_id__patch","parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"string","title":"Key Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateKeyRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KeyListItem"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["api-keys"],"summary":"Revoke Key","description":"Revoke an API key by ID.\n\nUpdates Postgres status to 'revoked' (primary), then removes the Redis\ncache entries so the auth middleware stops accepting the key immediately.","operationId":"revoke_key_v1_keys__key_id__delete","parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"string","title":"Key Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevokeKeyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/keys/{key_id}/rotate":{"post":{"tags":["api-keys"],"summary":"Rotate Key","description":"Rotate an API key (v1.20.10).\n\nCreates a successor key in one atomic call, sets the predecessor's\n``expires_at = now + grace_period_days`` (auth-time enforcement\nvia v1.20.9 cuts the predecessor off when the deadline passes), and\nlinks the pair via ``replaces_key_id`` / ``replaced_by_key_id``.\n\nThe successor inherits the predecessor's environment, default_model,\nenforce_quota, and monthly_quota. The successor's plan is sourced\nfrom the caller's current plan (``request.state.plan``) — this\nmatches ``POST /v1/keys`` semantics so a customer who has upgraded\nsince the predecessor was minted gets a fresh-plan key.\n\nReturns the plaintext successor exactly once.\n\nSee:\n  - docs/plans/requirements-gotcontext-2026-04-26-2200.md  (§F1-F5)\n  - docs/plans/design-gotcontext-2026-04-26-2200.md         (§3.4)","operationId":"rotate_key_v1_keys__key_id__rotate_post","parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"string","title":"Key Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RotateKeyRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RotateKeyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/keys/confirm/{token_hash}":{"post":{"tags":["api-keys"],"summary":"Complete a confirm-token approval","description":"Complete a single-use confirmation-token operation.\n\nThis endpoint is callable only via a Clerk session (not a gc_ API key)\nbecause it approves destructive actions on the caller's own keys.\n\nSteps:\n  1. 404 — token not found.\n  2. 410 — token expired.\n  3. 409 — token already consumed.\n  4. 403 — token belongs to a different user.\n  5. SELECT FOR UPDATE + set consumed_at (atomic, prevents double-use).\n  6. Execute the operation (rotate | revoke | scope_grant).\n  7. Return a structured response.\n\nPart of Phase 2 (ships as v1.35.0 when all chunks land).","operationId":"confirm_token_v1_keys_confirm__token_hash__post","parameters":[{"name":"token_hash","in":"path","required":true,"schema":{"type":"string","title":"Token Hash"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmTokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/leads":{"post":{"tags":["leads"],"summary":"Create Lead","description":"Persist a sales lead and notify the gotcontext sales inbox.","operationId":"create_lead_v1_leads_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLeadRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/licenses/generate":{"post":{"tags":["licenses"],"summary":"Generate License","description":"Generate a signed self-hosted license, persist it, and email it via Resend.","operationId":"generate_license_v1_licenses_generate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateLicenseRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateLicenseResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/licenses/validate":{"post":{"tags":["licenses"],"summary":"Validate License","description":"Public endpoint that verifies a self-hosted license signature and expiry.","operationId":"validate_license_v1_licenses_validate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidateLicenseRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LicenseValidationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/metering":{"post":{"tags":["licenses"],"summary":"Ingest Metering Report","description":"Accept one self-hosted usage report authenticated by the license key.","operationId":"ingest_metering_report_v1_metering_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeteringReportRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeteringAcceptedResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/checkout":{"post":{"tags":["billing"],"summary":"Create Checkout","description":"Create a Polar checkout session for upgrading to a paid plan.\n\nRequires authentication — reads ``user_id`` from ``request.state`` (set by\nthe Clerk JWT middleware).\n\nArgs:\n    req: Body with ``plan`` field (currently only \"pro\" is valid).\n    request: FastAPI request object (provides auth state).\n\nReturns:\n    CheckoutResponse with ``checkout_url`` to redirect the client to.","operationId":"create_checkout_v1_billing_checkout_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/portal":{"post":{"tags":["billing"],"summary":"Customer Portal","description":"Return the Polar customer portal URL for the authenticated user.\n\nRequires authentication — reads ``user_id`` and ``polar_customer_id`` from\n``request.state`` (set by the Clerk JWT middleware).\n\nArgs:\n    request: FastAPI request object (provides auth state).\n\nReturns:\n    PortalResponse with ``portal_url`` to redirect the client to.","operationId":"customer_portal_v1_billing_portal_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PortalResponse"}}}}}}},"/v1/billing/orders":{"get":{"tags":["billing"],"summary":"List Billing Orders","description":"List the authenticated user's Polar order history.","operationId":"list_billing_orders_v1_billing_orders_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/OrderItem"},"type":"array","title":"Response List Billing Orders V1 Billing Orders Get"}}}}}}},"/v1/billing/subscription":{"get":{"tags":["billing"],"summary":"Get Subscription Info","description":"Return the authenticated user's current plan and subscription details.","operationId":"get_subscription_info_v1_billing_subscription_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionInfo"}}}}}}},"/v1/billing/meter-usage":{"get":{"tags":["billing"],"summary":"Get Meter Usage","description":"Return the authenticated user's metered compression count for this billing period.\n\nReads from Polar's Meters API. Falls back to a cached value when the\nPolar breaker is open so the dashboard widget never shows a stale 0\nduring a Polar outage.\n\nFree-plan users return count=0 since they never emit events.","operationId":"get_meter_usage_v1_billing_meter_usage_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeterUsageResponse"}}}}}}},"/v1/billing/overage-preview":{"get":{"tags":["billing"],"summary":"Get Overage Preview","description":"Return the authenticated user's projected overage cost for this period.\n\nFree plans return a zero overage (hard cap enforced elsewhere).\nEnterprise returns ``included_units=-1`` (unlimited) with zero cost.\nPaid tiers (pro/team) compute: ``overage = max(0, used - included)``,\ncost = ``overage * unit_amount_cents``, billed = ``min(cost, cap)``.\n\nAll math is deterministic from env knobs — CEO can tune without\nredeploy via ``flyctl secrets set``.","operationId":"get_overage_preview_v1_billing_overage_preview_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OveragePreviewResponse"}}}}}}},"/v1/capabilities":{"get":{"tags":["capabilities"],"summary":"List Capabilities","description":"List every known capability (MCP tool) with category + tier metadata.\n\nSingle source of truth: iterates ``capability_registry.get_all_capabilities()``,\nwhich wraps ``plan_gating._PRO_TOOLS`` — the same frozenset\n``test_tool_count_parity.py`` already locks against the frontend pricing\npage. No authentication is strictly required (unauthenticated callers see\nthe full catalogue with ``available`` computed against the ``free`` plan),\nmatching the posture of the sibling ``GET /v1/mcp/tools`` endpoint.","operationId":"list_capabilities_v1_capabilities_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CapabilitiesResponse"}}}}}}},"/v1/usage":{"get":{"tags":["usage"],"summary":"Get Usage","description":"Return monthly compression stats for the authenticated user.\n\nReads daily Redis counters for the current calendar month and sums them.\nKey patterns:\n    ``usage:{user_id}:{YYYY-MM-DD}``               — compression count\n    ``usage_tokens_in:{user_id}:{YYYY-MM-DD}``     — original token total\n    ``usage_tokens_saved:{user_id}:{YYYY-MM-DD}``  — tokens saved total\n\nRequires authentication — reads ``user_id`` and ``plan`` from\n``request.state`` (set by AuthMiddleware).","operationId":"get_usage_v1_usage_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageResponse"}}}}}}},"/v1/usage/activation":{"get":{"tags":["usage","admin"],"summary":"Get Usage Activation","description":"Return a time-to-first-compression histogram segmented by plan.\n\nAdmin-only. Reads ``users`` LEFT JOIN ``MIN(usage_events.created_at)``\nand buckets the delta against ``users.created_at`` into:\n``<1h | 1h-24h | 1d-7d | never``.\n\nResponse shape::\n\n    {\n        \"period\": \"all_time\",\n        \"buckets\": {\n            \"free\":       {\"<1h\": int, \"1h-24h\": int, \"1d-7d\": int, \"never\": int},\n            \"pro\":        {...},\n            \"team\":       {...},\n            \"enterprise\": {...}\n        },\n        \"generated_at\": \"2026-04-23T...\"\n    }","operationId":"get_usage_activation_v1_usage_activation_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Get Usage Activation V1 Usage Activation Get"}}}}}}},"/v1/usage/by-model":{"get":{"tags":["usage"],"summary":"Usage By Model","operationId":"usage_by_model_v1_usage_by_model_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageByModelResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/usage/by-cache":{"get":{"tags":["usage"],"summary":"Usage By Cache","operationId":"usage_by_cache_v1_usage_by_cache_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageByCacheResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/usage/by-key":{"get":{"tags":["usage"],"summary":"Usage By Key","description":"Top-N API keys by tokens saved across the window.","operationId":"usage_by_key_v1_usage_by_key_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"default":30,"title":"Days"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":5,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageByKeyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/usage/by-tool":{"get":{"tags":["usage"],"summary":"Usage By Tool","description":"Top tools called by this user over the last N days.\n\nNULL tool_name rows (REST /v1/compress hits) bucket under\n``\"rest-api\"``. Returns at most ``_TOP_N`` items ordered by call\ncount descending. Zero-tokens_saved rows (e.g. gc_blast_radius)\nstill count — the endpoint measures engagement, not savings.","operationId":"usage_by_tool_v1_usage_by_tool_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageByToolResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/usage/by-client":{"get":{"tags":["usage"],"summary":"Usage By Client","description":"Tool-call counts + compression ratios grouped by AI client over the last N days.\n\nPer-user. NULL on both signals → \"other\" bucket. Rows ordered by\ncall count descending.","operationId":"usage_by_client_v1_usage_by_client_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageByClientResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/usage/history":{"get":{"tags":["usage"],"summary":"Get Usage History","description":"Return daily compression stats for the last N days.\n\nEach element in ``data`` corresponds to one calendar day.  Days with no\nrecorded activity return zeros — the client always receives exactly ``days``\ndata points.\n\nRequires authentication — reads ``user_id`` from ``request.state``.","operationId":"get_usage_history_v1_usage_history_get","parameters":[{"name":"period","in":"query","required":false,"schema":{"type":"string","description":"Granularity — currently only 'day' is supported","default":"day","title":"Period"},"description":"Granularity — currently only 'day' is supported"},{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":90,"minimum":1,"description":"Number of days to look back","default":30,"title":"Days"},"description":"Number of days to look back"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageHistoryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/usage/events":{"get":{"tags":["analytics"],"summary":"Get Usage Events","description":"Return paginated compression history for the authenticated user.\n\nEach event represents one compression call with input/output token\ncounts, savings percentage, fidelity level, method (REST/MCP/batch),\nand latency. Users can see exactly what the engine did with their data.\n\n**Privacy:** Input text is NOT stored. Only a 100-char preview\n(first line, truncated) is kept for identification purposes.\nUsers can identify which document a compression belongs to without\nthe full content being retained.","operationId":"get_usage_events_v1_usage_events_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Page Size"}},{"name":"fidelity","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fidelity"}},{"name":"method","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Method"}},{"name":"exclude_advisory","in":"query","required":false,"schema":{"type":"boolean","description":"Exclude advisory/non-compressing MCP tool calls (method='mcp_advisory', e.g. gc_lookup, ingest_context, gc_agent_capsule). The Compression History view sets this so 0-token advisory rows don't dominate it and make it look broken.","default":false,"title":"Exclude Advisory"},"description":"Exclude advisory/non-compressing MCP tool calls (method='mcp_advisory', e.g. gc_lookup, ingest_context, gc_agent_capsule). The Compression History view sets this so 0-token advisory rows don't dominate it and make it look broken."},{"name":"model","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by call status (success, client_error, timeout, ...)","title":"Status"},"description":"Filter by call status (success, client_error, timeout, ...)"},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"ISO timestamp; only return events created after.","title":"Since"},"description":"ISO timestamp; only return events created after."},{"name":"until","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"ISO timestamp; only return events created before.","title":"Until"},"description":"ISO timestamp; only return events created before."},{"name":"key_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"description":"Filter by api_keys.key_id (v1.20.6). Cross-tenant safe.","title":"Key Id"},"description":"Filter by api_keys.key_id (v1.20.6). Cross-tenant safe."},{"name":"environment","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":16},{"type":"null"}],"description":"Filter by api_keys.environment (v1.20.8). Cross-tenant safe.","title":"Environment"},"description":"Filter by api_keys.environment (v1.20.8). Cross-tenant safe."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/usage/events/{event_id}":{"get":{"tags":["analytics"],"summary":"Get Usage Event","description":"v1.19.0 — single-event lookup for the call detail drill-down page.\n\nReturns 404 if the event isn't owned by the caller (no cross-tenant\nleak). Drill-down permalink uses the dashed UUID; a future enhancement\ncan accept the dash-stripped 8-char prefix for cleaner URLs.","operationId":"get_usage_event_v1_usage_events__event_id__get","parameters":[{"name":"event_id","in":"path","required":true,"schema":{"type":"string","title":"Event Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompressionEvent"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/usage/latency-percentiles":{"get":{"tags":["usage"],"summary":"Latency Percentiles","description":"Return p50/p95/p99 of latency_ms for the caller's events in the window.","operationId":"latency_percentiles_v1_usage_latency_percentiles_get","parameters":[{"name":"window_hours","in":"query","required":false,"schema":{"type":"integer","maximum":168,"minimum":1,"default":24,"title":"Window Hours"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LatencyPercentilesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/profiles":{"get":{"tags":["profiles"],"summary":"List Profiles","description":"List all fidelity profiles for the authenticated user, newest first.","operationId":"list_profiles_v1_profiles_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileListResponse"}}}}}},"post":{"tags":["profiles"],"summary":"Create Profile","description":"Create a new fidelity profile for the authenticated user.","operationId":"create_profile_v1_profiles_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProfileRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/profiles/{profile_id}":{"get":{"tags":["profiles"],"summary":"Get Profile","description":"Get a specific fidelity profile by ID (must belong to the caller).","operationId":"get_profile_v1_profiles__profile_id__get","parameters":[{"name":"profile_id","in":"path","required":true,"schema":{"type":"integer","title":"Profile Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["profiles"],"summary":"Update Profile","description":"Update a fidelity profile.  Only fields present in the body are changed.","operationId":"update_profile_v1_profiles__profile_id__put","parameters":[{"name":"profile_id","in":"path","required":true,"schema":{"type":"integer","title":"Profile Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateProfileRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["profiles"],"summary":"Delete Profile","description":"Delete a fidelity profile (must belong to the caller).","operationId":"delete_profile_v1_profiles__profile_id__delete","parameters":[{"name":"profile_id","in":"path","required":true,"schema":{"type":"integer","title":"Profile Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/provider-credentials":{"get":{"tags":["provider-credentials"],"summary":"List Provider Credentials","description":"This user's live credentials, plus the providers they may add.\n\n`supported_providers` ships with the list so the console never hardcodes\nthe vocabulary — one place to add a provider, and every surface follows.","operationId":"list_provider_credentials_v1_provider_credentials_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProviderCredentialListResponse"}}}}}},"post":{"tags":["provider-credentials"],"summary":"Create Provider Credential","description":"Store or rotate a provider key for the AUTHENTICATED user.\n\nThe owner comes from the session, never the body. Re-posting the same\n(provider, label) rotates the secret in place rather than 409-ing — see\n`store_credential`.","operationId":"create_provider_credential_v1_provider_credentials_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StoreCredentialRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProviderCredentialResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/provider-credentials/{credential_id}":{"delete":{"tags":["provider-credentials"],"summary":"Delete Provider Credential","description":"Soft-delete one credential.\n\n404 rather than 403 when it is not yours. The store's UPDATE is scoped by\nuser_id, so it genuinely cannot tell \"someone else's\" from \"nonexistent\" —\nand that is the desired answer anyway: a 403 would confirm the id is real.","operationId":"delete_provider_credential_v1_provider_credentials__credential_id__delete","parameters":[{"name":"credential_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Credential Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/provider-credentials/{credential_id}/models":{"get":{"tags":["provider-credentials"],"summary":"List Credential Models","description":"List models the stored key can use, via the provider's own models API.\n\nDoes NOT stamp ``last_used_at`` — that column means \"used to spend\". A 502\non key rejection (not 401) keeps OUR auth distinct from the provider's.","operationId":"list_credential_models_v1_provider_credentials__credential_id__models_get","parameters":[{"name":"credential_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Credential Id"}},{"name":"media","in":"query","required":false,"schema":{"anyOf":[{"enum":["image","video"],"type":"string"},{"type":"null"}],"title":"Media"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProviderModelsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/chat/completions":{"post":{"tags":["chat"],"summary":"Create Chat Completion","description":"Compress the context, call the user's own provider, return one answer.\n\nThe receipt reports ESTIMATED context tokens (the engine counts with\n`estimate_fast`) alongside the provider's own actual prompt total, which covers\nthe whole prompt including the instruction and wire overhead. They are different\nquantities and are reported as such rather than collapsed into one flattering\n\"measured\" number.","operationId":"create_chat_completion_v1_chat_completions_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/chat/conversations/{conversation_id}/completion-status":{"post":{"tags":["chat"],"summary":"Completion Status","description":"No acquisition, reservation or provider path: authorized cache GET only.","operationId":"completion_status_v1_chat_conversations__conversation_id__completion_status_post","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompletionStatusIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompletionStatusOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/chat/conversations":{"post":{"tags":["chat"],"summary":"Create Conversation","description":"Open a thread. Cheap and side-effect-free — no provider is contacted.","operationId":"create_conversation_v1_chat_conversations_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateConversationIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["chat"],"summary":"List Conversations","operationId":"list_conversations_v1_chat_conversations_get","parameters":[{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"description":"Search titles AND message bodies","title":"Q"},"description":"Search titles AND message bodies"},{"name":"include_archived","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Archived"}},{"name":"before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Legacy timestamp-only cursor; prefer cursor","title":"Before"},"description":"Legacy timestamp-only cursor; prefer cursor"},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":512},{"type":"null"}],"description":"Opaque full-order cursor from next_page_cursor","title":"Cursor"},"description":"Opaque full-order cursor from next_page_cursor"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":30,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationListOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/chat/conversations/{conversation_id}":{"get":{"tags":["chat"],"summary":"Get Conversation","operationId":"get_conversation_v1_chat_conversations__conversation_id__get","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationDetailOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["chat"],"summary":"Patch Conversation","operationId":"patch_conversation_v1_chat_conversations__conversation_id__patch","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatchConversationIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["chat"],"summary":"Delete Conversation","description":"Delete a conversation and, by CASCADE, its messages.\n\nReturns 200 WITH a body rather than 204, deliberately: the 404 arm already\nreturns a JSON error envelope, so a 204 success would make this the one\nroute whose two outcomes need different parsing in the client. Choosing 204\nwould also put this route in the body-less class that fails at IMPORT on\nFastAPI 0.115-0.135 under `from __future__ import annotations` unless\n`response_model=None` is set (api-changes rule 13) — that flag is set here\nanyway, but the simpler answer is to not join that class.","operationId":"delete_conversation_v1_chat_conversations__conversation_id__delete","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/chat/conversations/{conversation_id}/messages":{"post":{"tags":["chat"],"summary":"Append Message","description":"Record one turn and advance the conversation's leaf.","operationId":"append_message_v1_chat_conversations__conversation_id__messages_post","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppendMessageIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/chat/media/quotes":{"post":{"tags":["chat"],"summary":"Quote Media","operationId":"quote_media_v1_chat_media_quotes_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaQuoteRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaQuoteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/chat/media/jobs":{"post":{"tags":["chat"],"summary":"Create Media Job","operationId":"create_media_job_v1_chat_media_jobs_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaJobRequest"}}},"required":true},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaJobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/chat/media/jobs/{job_id}":{"get":{"tags":["chat"],"summary":"Get Media Job","operationId":"get_media_job_v1_chat_media_jobs__job_id__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaJobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/chat/media/jobs/{job_id}/cancel":{"post":{"tags":["chat"],"summary":"Cancel Media Job","operationId":"cancel_media_job_v1_chat_media_jobs__job_id__cancel_post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaJobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/chat/media/jobs/{job_id}/retry-delivery":{"post":{"tags":["chat"],"summary":"Retry Media Delivery","operationId":"retry_media_delivery_v1_chat_media_jobs__job_id__retry_delivery_post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaJobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/chat/media/assets/{asset_id}/content":{"get":{"tags":["chat"],"summary":"Get Media Asset","operationId":"get_media_asset_v1_chat_media_assets__asset_id__content_get","parameters":[{"name":"asset_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Asset Id"}}],"responses":{"200":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/cli-broker/anthropic/messages":{"post":{"tags":["cli-broker"],"summary":"Broker Anthropic Messages","description":"Forward one Anthropic Messages request with the owner's key injected.\n\nDeliberately NOT decorated with `requires_scope`. The caller holds a\n`cli_session_tokens` credential, not a `gc_` key, so `request.state` carries\nno `scope_model` for `enforce_scope` to read -- a scope decorator here would\nbe a check that cannot evaluate its own input. The route is registered in\n`_SCOPE_EXEMPT_ROUTES` for the coverage gate, and its authorization is the\ntoken resolution below.","operationId":"broker_anthropic_messages_v1_cli_broker_anthropic_messages_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response Broker Anthropic Messages V1 Cli Broker Anthropic Messages Post"}}}}}}},"/v1/runs":{"post":{"tags":["runs"],"summary":"Submit Run Endpoint","description":"202 with a run id. The run is durable; execution follows.","operationId":"submit_run_endpoint_v1_runs_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunSubmitRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunSubmitResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["runs"],"summary":"List Runs Endpoint","description":"The runs you submitted, newest first, with what each has cost.\n\nCouncil verdict C (2026-07-29): five slices of backend had shipped with no\nuser-visible surface, and `GET /v1/runs/{id}` could only be used by someone\nwho ALREADY had the id. Without a list, a customer charged for a run had no\nway to find it.\n\nOWNER-SCOPED IN SQL rather than filtered afterwards. There is no id in the\nrequest to leak here, so this cannot be the existence oracle the single-run\nread had to guard against -- but scoping in the query is what keeps that\ntrue when someone later adds a filter parameter.","operationId":"list_runs_endpoint_v1_runs_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":25,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RunListItem"},"title":"Response List Runs Endpoint V1 Runs Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/runs/from-workflow":{"post":{"tags":["runs"],"summary":"Run Saved Workflow Endpoint","description":"Execute a SAVED workflow at its latest version (S8, #47).\n\nThe point of the whole workflows surface: a graph someone authored, named\nand can run twice. The run records the AUTHORED `workflow_version_id`\nrather than a freshly minted throwaway, so provenance finally means what\nthe column name says.\n\nThe spec is COMPILED FROM the stored graph here rather than accepted from\nthe caller. Taking both a version id and a spec would let them disagree,\nand a run would then claim to have executed a version whose graph it never\nran.","operationId":"run_saved_workflow_endpoint_v1_runs_from_workflow_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunFromWorkflowRequest"}}},"required":true},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunSubmitResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/runs/from-assistant":{"post":{"tags":["runs"],"summary":"Run Assistant Endpoint","description":"Run an assistant the caller owns or has an accepted grant for (#59 Task 3).\n\nTHE CALLER PAYS, WITH THE CALLER'S KEY, INTO THE CALLER'S PROJECT (D4). A\ngrant conveys the right to RUN somebody's assistant, never the right to spend\ntheir provider balance -- so `owner_clerk_id` on the run is the CALLER, and\nthe author's `project_id` is not consulted. That is also why a grant crosses\nprojects harmlessly: the grantee sees the assistant and none of the author's\nproject.\n\n404 ON EVERY REFUSAL, never 403. `resolve_access` returns None for both \"no\nsuch assistant\" and \"not yours\", because a 403 confirms the id is real and\nthese are shared by link.","operationId":"run_assistant_endpoint_v1_runs_from_assistant_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunFromAssistantRequest"}}},"required":true},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunSubmitResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/runs/from-skill":{"post":{"tags":["runs"],"summary":"Run Skill Endpoint","description":"Run a community skill the caller has enabled -- the sibling of\n`/runs/from-assistant` for the marketplace-skills surface.\n\nTHE CALLER PAYS, WITH THE CALLER'S KEY, INTO THE CALLER'S PROJECT (D4),\nsame as every other route in this file. There is no author identity to\nkeep out of this run at all: unlike an assistant grant, `enabled_skills`\nis a per-principal opt-in on a MARKETPLACE row, not a grant between two\naccounts, so there is no author-side project or provider/model that could\nleak or be spent against.\n\n404 ON EVERY REFUSAL, never 403. `get_skill_markdown` collapses \"does not\nexist\", \"not enabled by you\", \"no longer accessible\" (withdrawn, or never\npublished to a non-owner) and \"the persisted `gc_skill_scan` verdict is\nnot clean\" into ONE constant not-found message -- for the identical reason\n`resolve_access` does the same for assistants: a 403 confirms the id is\nreal, and both surfaces are reachable by a shared link.\n\n`submit_run` RE-VALIDATES the skill at admission (status must be\nliterally `'published'`, `scan_safe_to_install`, and enabled for THIS\nowner) before it ever reaches a provider. That check is intentionally\nstricter than `get_skill_markdown`'s read-time gate, which also lets an\nowner preview their own draft/pending-review skill's markdown -- so an\nowner can read a draft's content here and still get a 422 (via\n`refusals_as_http`'s bare `ValueError` branch) if they try to RUN it\nbefore it is published. That is belt-and-braces, not a hole: the\nstricter check wins.","operationId":"run_skill_endpoint_v1_runs_from_skill_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunFromSkillRequest"}}},"required":true},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunSubmitResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/runs/{run_id}":{"get":{"tags":["runs"],"summary":"Get Run Endpoint","description":"Read a run you submitted. codex item-1 H5 / cursor H1.\n\nThe submit route spends the customer's provider balance; without this they\nwere charged for work they could not see. Two reviewers filed it\nindependently, which is usually the sign that a gap is real rather than\nstylistic.\n\n404 FOR SOMEONE ELSE'S RUN, never 403. A 403 confirms the id exists and\nturns the endpoint into an existence oracle; \"not yours\" and \"not here\" have\nto be the same sentence. `load_run_view` returns None for both, so this\nhandler cannot accidentally tell them apart.","operationId":"get_run_endpoint_v1_runs__run_id__get","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunReadResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/runs/{run_id}/cancel":{"post":{"tags":["runs"],"summary":"Cancel Run Endpoint","description":"Stop a run before it spends more of the caller's balance.\n\nRequires `runs:write` (the spend grant), not `runs:read`. Ownership check\nruns BEFORE the CAS and returns 404 -- never 403 -- for another tenant's\nrun, same shape as `get_run_endpoint`, so this can't be an existence\noracle. `cancelled=False` is the NORMAL outcome for an already-finished\nrun: `cancel_run`'s CAS only matches `running`/`cancel_requested` rows, so\ncancelling a settled run is a no-op, not an error.","operationId":"cancel_run_endpoint_v1_runs__run_id__cancel_post","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunCancelResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/runs/{run_id}/events":{"get":{"tags":["runs"],"summary":"Stream Run Events","description":"Server-sent events for one run, resumable by `Last-Event-ID`.\n\nBefore this, a client watching a run had to poll `GET /v1/runs/{id}` — which\nis the whole status document on every tick, for a run whose interesting\nmoments are a handful of appends.\n\nOWNERSHIP IS CHECKED BEFORE THE STREAM OPENS, and that ordering is the point.\nOnce `StreamingResponse` is returned FastAPI has already committed 200, so a\nlater refusal arrives as an error *inside* a successful stream — which a\nclient reasonably renders as \"the run failed\" rather than \"not yours\".\n\n404 FOR SOMEONE ELSE'S RUN, never 403 — same rule as `get_run_endpoint`. A\n403 confirms the id exists and turns this into an existence oracle.","operationId":"stream_run_events_v1_runs__run_id__events_get","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/runs/attachments":{"post":{"tags":["runs"],"summary":"Issue","description":"Reserve an attachment and return a signed upload URL.","operationId":"issue_v1_runs_attachments_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssueAttachmentRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssueAttachmentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/runs/attachments/{attachment_id}/complete":{"post":{"tags":["runs"],"summary":"Complete","description":"Verify the uploaded object and return a URL a provider can read.","operationId":"complete_v1_runs_attachments__attachment_id__complete_post","parameters":[{"name":"attachment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Attachment Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteAttachmentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/runs/attachments/limits":{"get":{"tags":["runs"],"summary":"Limits","description":"What a client may upload, so a UI can refuse locally instead of round-tripping.\n\nServed from the SAME constants the service enforces, so the advertised limit\ncannot drift from the enforced one -- a second hand-written copy is how those\ntwo disagree.","operationId":"limits_v1_runs_attachments_limits_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Limits V1 Runs Attachments Limits Get"}}}}}}},"/v1/settings/role-models":{"get":{"tags":["settings"],"summary":"Get Role Models","operationId":"get_role_models_v1_settings_role_models_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/RoleModelItem"},"type":"array","title":"Response Get Role Models V1 Settings Role Models Get"}}}}}}},"/v1/settings/role-models/{role}":{"put":{"tags":["settings"],"summary":"Put Role Model","description":"Set or clear one role's model, then return the full resolved set.\n\nReturning ALL five rather than the one that changed means a client never has\nto re-fetch to render the screen, and cannot show a half-updated view built\nfrom its own optimistic guess.","operationId":"put_role_model_v1_settings_role_models__role__put","parameters":[{"name":"role","in":"path","required":true,"schema":{"type":"string","title":"Role"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetRoleModelRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RoleModelItem"},"title":"Response Put Role Model V1 Settings Role Models  Role  Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/settings/role-models/roles":{"get":{"tags":["settings"],"summary":"Known Roles","description":"The closed vocabulary, served from the SAME constant the kernel validates\nagainst so an advertised role cannot drift from an accepted one.","operationId":"known_roles_v1_settings_role_models_roles_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Known Roles V1 Settings Role Models Roles Get"}}}}}}},"/v1/settings/media-model-defaults":{"get":{"tags":["settings"],"summary":"Get Media Model Preferences","operationId":"get_media_model_preferences_v1_settings_media_model_defaults_get","parameters":[{"name":"project_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaModelPreferencesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["settings"],"summary":"Patch Media Model Preferences","operationId":"patch_media_model_preferences_v1_settings_media_model_defaults_patch","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaModelPreferencesPatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaModelPreferencesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/workflows":{"get":{"tags":["workflows"],"summary":"List Endpoint","description":"Your saved workflows, most recently edited first. Graphs are omitted.","operationId":"list_endpoint_v1_workflows_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/WorkflowSummary"},"title":"Response List Endpoint V1 Workflows Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["workflows"],"summary":"Create Endpoint","operationId":"create_endpoint_v1_workflows_post","parameters":[{"name":"project_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowUpsert"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/workflows/limits":{"get":{"tags":["workflows"],"summary":"Limits","description":"What a canvas may save, served from the SAME constant the service\nenforces so the advertised limit cannot drift from the enforced one.","operationId":"limits_v1_workflows_limits_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Limits V1 Workflows Limits Get"}}}}}}},"/v1/workflows/{workflow_id}":{"get":{"tags":["workflows"],"summary":"Get Endpoint","description":"Open a workflow at its latest version — what a canvas loads.","operationId":"get_endpoint_v1_workflows__workflow_id__get","parameters":[{"name":"workflow_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Workflow Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["workflows"],"summary":"Save Endpoint","description":"Save an edit. Mints a NEW version unless the graph is unchanged.","operationId":"save_endpoint_v1_workflows__workflow_id__put","parameters":[{"name":"workflow_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Workflow Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowUpsert"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/assistants":{"get":{"tags":["assistants"],"summary":"List Assistants Endpoint","description":"Every assistant this caller authored, at head.","operationId":"list_assistants_endpoint_v1_assistants_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/AssistantListItem"},"type":"array","title":"Response List Assistants Endpoint V1 Assistants Get"}}}}}},"post":{"tags":["assistants"],"summary":"Create Assistant Endpoint","description":"Create an assistant and its version 1.","operationId":"create_assistant_endpoint_v1_assistants_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistantCreateRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistantVersionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/assistants/shared-with-me":{"get":{"tags":["assistants"],"summary":"Shared With Me Endpoint","description":"The grantee's inbox: assistants somebody has shared with this caller.\n\nIncludes grants not yet accepted -- that is what makes it an inbox. An\nunaccepted grant cannot be run until it is accepted.","operationId":"shared_with_me_endpoint_v1_assistants_shared_with_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/GrantListItem"},"type":"array","title":"Response Shared With Me Endpoint V1 Assistants Shared With Me Get"}}}}}}},"/v1/assistants/{assistant_id}/versions":{"post":{"tags":["assistants"],"summary":"Create Version Endpoint","description":"Append a version. Existing grantees keep running the version they accepted.","operationId":"create_version_endpoint_v1_assistants__assistant_id__versions_post","parameters":[{"name":"assistant_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Assistant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistantVersionRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistantVersionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/assistants/{assistant_id}/grants":{"post":{"tags":["assistants"],"summary":"Grant Endpoint","description":"Give another user the right to RUN this assistant, on their own bill.","operationId":"grant_endpoint_v1_assistants__assistant_id__grants_post","parameters":[{"name":"assistant_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Assistant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantCreateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["assistants"],"summary":"List Grants Endpoint","description":"Who can run this assistant. Owner-only.","operationId":"list_grants_endpoint_v1_assistants__assistant_id__grants_get","parameters":[{"name":"assistant_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Assistant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/GrantListItem"},"title":"Response List Grants Endpoint V1 Assistants  Assistant Id  Grants Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/assistants/{assistant_id}/accept":{"post":{"tags":["assistants"],"summary":"Accept Endpoint","description":"The GRANTEE accepts a SPECIFIC version. Required before any run resolves.\n\nThe version is in the body because consent is to a version (D3). Without it\na stale page could accept a prompt the grantee never saw -- see\n`accept_grant`, which turns that race into the 409 below.\n\nACCEPT IS ALSO THE PROMPT-SCAN BOUNDARY (S8) -- `accept_grant` scans the\nlive pinned content before recording acceptance, since this is the first\npoint at which the prompt becomes third-party content charged to THIS\ncaller's provider balance. `AssistantPromptScanBlockedError` MUST be\ncaught before it could otherwise surface as an unhandled 500 -- it is a\nplain `InvalidAssistant`/`ValueError` subclass with no handler in this\nmodule until now, unlike `create_assistant_endpoint` and\n`create_version_endpoint`, which have carried this same except clause\nsince authoring used to be where the gate lived.","operationId":"accept_endpoint_v1_assistants__assistant_id__accept_post","parameters":[{"name":"assistant_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Assistant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantAcceptRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/assistants/{assistant_id}/grants/{grantee_clerk_id}":{"delete":{"tags":["assistants"],"summary":"Revoke Endpoint","description":"Revoke a live share. The revoked row is KEPT as the audit trail.","operationId":"revoke_endpoint_v1_assistants__assistant_id__grants__grantee_clerk_id__delete","parameters":[{"name":"assistant_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Assistant Id"}},{"name":"grantee_clerk_id","in":"path","required":true,"schema":{"type":"string","title":"Grantee Clerk Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/settings/spend-ceiling":{"get":{"tags":["settings"],"summary":"Get Spend Ceiling","description":"What this customer's budget currently is.\n\nAdded while building the settings UI (#46): only PATCH existed, so a screen\ncould SET a ceiling but not SHOW one — a customer could not read their own\nbudget without changing it. Same shape of gap as the runs list.\n\nReads the stored preference and the plan maximum SEPARATELY, then reports\nboth plus what is actually enforced. A single number would hide the case\nthat matters most: a customer who chose $80 on pro and dropped to free is\nbounded by $10 today and still has $80 waiting if they upgrade back. One\nfigure cannot say that, and saying only \"$10\" reads as though their choice\nwas destroyed.","operationId":"get_spend_ceiling_v1_settings_spend_ceiling_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpendCeilingResponse"}}}}}},"patch":{"tags":["settings"],"summary":"Update Spend Ceiling","operationId":"update_spend_ceiling_v1_settings_spend_ceiling_patch","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpendCeilingUpdate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpendCeilingResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/referrals/generate":{"post":{"tags":["referrals"],"summary":"Generate Referral Code","description":"Return the caller's referral code, creating one if it doesn't exist yet.\n\nIdempotent: calling this multiple times always returns the same code.","operationId":"generate_referral_code_v1_referrals_generate_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateReferralResponse"}}}}}}},"/v1/referrals":{"get":{"tags":["referrals"],"summary":"List Referrals","description":"List all referrals created by the authenticated user.","operationId":"list_referrals_v1_referrals_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReferralListResponse"}}}}}}},"/v1/referrals/stats":{"get":{"tags":["referrals"],"summary":"Get Referral Stats","description":"Return aggregate referral stats for the authenticated user.","operationId":"get_referral_stats_v1_referrals_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReferralStatsResponse"}}}}}}},"/v1/referrals/claim":{"post":{"tags":["referrals"],"summary":"Claim Referral","description":"Manual fallback for claiming a referral code.\n\nThe primary auto-claim path runs inside the Clerk ``user.created`` webhook\n(``api/app/webhooks/clerk.py::_auto_claim_referral``), which fires whenever\nsignup metadata carries ``referral_code`` / ``ref``.  This endpoint remains\nfor admin tools and for signup flows that do not pass the code through\nClerk metadata — callers must authenticate as the *referred* user.","operationId":"claim_referral_v1_referrals_claim_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimReferralRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimReferralResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects":{"get":{"tags":["projects"],"summary":"List Projects","description":"List all projects for the authenticated user, newest first.\n\nSelf-healing get-or-create: if the authenticated user has ZERO projects\n(new signup or migration-era gap), a Default project is auto-created before\nthe list is returned.  This is idempotent and plan-agnostic — the Default\nproject is a system invariant required by the dashboard and Knowledge Hub.\n\nF22 (v1.22.2): each row includes ``current_period_compressions`` — the\ncount of usage events for the current calendar month attributed to that\nproject. Computed in ONE query (GROUP BY project_id) so we never do N+1\nlookups regardless of project count. Cap at LIMIT 100 via the existing\nordering; projects beyond 100 will not appear in the response.","operationId":"list_projects_v1_projects_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectListResponse"}}}}}},"post":{"tags":["projects"],"summary":"Create Project","description":"Create a new project for the authenticated user.\n\nRequires a plan that supports projects (team or enterprise).","operationId":"create_project_v1_projects_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProjectRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}":{"get":{"tags":["projects"],"summary":"Get Project","description":"Get a specific project with aggregated usage stats.","operationId":"get_project_v1_projects__project_id__get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectDetailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["projects"],"summary":"Update Project","description":"Update a project.  Only fields present in the body are changed.","operationId":"update_project_v1_projects__project_id__put","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateProjectRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["projects"],"summary":"Delete Project","description":"Delete a project (must belong to the caller).","operationId":"delete_project_v1_projects__project_id__delete","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Delete Project V1 Projects  Project Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/payments/reconciliation":{"get":{"tags":["payments"],"summary":"Get Reconciliation","description":"Return payment-stamped usage_events for the date window.\n\nResponse shape:\n    {\n      \"events\": [\n        {\n          \"id\": \"<uuid>\",\n          \"user_id\": \"<uuid>\",\n          \"project_id\": \"<uuid|null>\",\n          \"facilitator\": \"nevermined\",\n          \"settlement_status\": \"settled\",\n          \"payment_id\": \"<vendor-id>\",\n          \"amount_charged_micros\": 12345,\n          \"tokens_saved\": 8421,\n          \"created_at\": \"2026-05-16T12:34:56Z\"\n        },\n        ...\n      ],\n      \"count\": <int>,\n      \"window\": {\"from\": \"...\", \"to\": \"...\"}\n    }\n\nUsed by ops + finance to reconcile gotcontext-side audit rows with the\nfacilitator's own ledger. Council Rule E: gotcontext holds NO funds —\nany drift between this surface and the facilitator's ledger is reported\nto the facilitator, not to gotcontext.","operationId":"get_reconciliation_v1_payments_reconciliation_get","parameters":[{"name":"from","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO-8601 UTC start","title":"From"},"description":"ISO-8601 UTC start"},{"name":"to","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO-8601 UTC end","title":"To"},"description":"ISO-8601 UTC end"},{"name":"facilitator","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter to nevermined|skyfire|x402","title":"Facilitator"},"description":"Filter to nevermined|skyfire|x402"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":5000,"minimum":1,"default":500,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/knowledge/items":{"post":{"tags":["knowledge"],"summary":"Ingest Item","description":"Ingest text or a URL into the project's Knowledge Hub.","operationId":"ingest_item_v1_projects__project_id__knowledge_items_post","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__app__routers__v1__knowledge__IngestResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["knowledge"],"summary":"List Items","description":"List Knowledge Hub items for the project (cursor-paginated).\n\nPhase 4 audit BLOCKER-1 fix: metadata_filter is plumbed through to the\nservice layer (was silently dropped in the initial Phase 4 build).\n\nA2 (2026-06-27): plan gate skipped for reads so free-plan owners can see\ntheir own items.  Ownership check inside _resolve_project_or_404 still\nprevents cross-tenant access.  Write operations keep require_pro=True.","operationId":"list_items_v1_projects__project_id__knowledge_items_get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"name":"metadata_filter","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"JSON-encoded JSONB containment filter. URL-encode the JSON. Example: ?metadata_filter=%7B%22tag%22%3A%22alpha%22%7D for {\"tag\":\"alpha\"}.","title":"Metadata Filter"},"description":"JSON-encoded JSONB containment filter. URL-encode the JSON. Example: ?metadata_filter=%7B%22tag%22%3A%22alpha%22%7D for {\"tag\":\"alpha\"}."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListItemsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/knowledge/stats":{"get":{"tags":["knowledge"],"summary":"Get Knowledge Stats","description":"Account-wide (project-scoped) KB compression rollup -- C6 ranked slice 2.\n\nRead-only, free-plan-visible (mirrors list_items's require_pro=False so an\nowner can see their own items' rollup regardless of plan; write operations\non KB stay Pro-gated elsewhere).","operationId":"get_knowledge_stats_v1_projects__project_id__knowledge_stats_get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeStatsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/knowledge/items/{item_id}":{"get":{"tags":["knowledge"],"summary":"Get Item","description":"Fetch a single Knowledge Hub item by ID.\n\nA2: require_pro=False so free-plan owners can read their own items.\nOwnership enforced by _resolve_project_or_404 regardless.","operationId":"get_item_v1_projects__project_id__knowledge_items__item_id__get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Item Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["knowledge"],"summary":"Edit Item","description":"Replace item content with a new version, or rename/toggle without creating a new version.\n\nWhen only ``name`` is provided (no ``content``), updates the item name in-place\nwithout creating a new content version — ``current_version_id`` is unchanged.\n\nWhen ``content`` is provided, a new version is created (optimistic concurrency via\n``base_version_id``). ``name`` is also updated if provided.\n\nWhen only ``mcp_exposed`` is provided, toggles the per-source MCP-exposure flag\nwithout touching content or name.","operationId":"edit_item_v1_projects__project_id__knowledge_items__item_id__patch","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EditRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["knowledge"],"summary":"Delete Item","description":"Soft-delete a Knowledge Hub item.","operationId":"delete_item_v1_projects__project_id__knowledge_items__item_id__delete","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Item Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/knowledge/query":{"post":{"tags":["knowledge"],"summary":"Query Items","description":"Vector search the project's Knowledge Hub chunks.","operationId":"query_items_v1_projects__project_id__knowledge_query_post","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueryRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/knowledge/items/{item_id}/diff":{"get":{"tags":["knowledge"],"summary":"Diff Versions","description":"Compute a unified diff between two versions of a Knowledge Hub item.\n\nA2: require_pro=False — reading version history is allowed for free owners.","operationId":"diff_versions_v1_projects__project_id__knowledge_items__item_id__diff_get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Item Id"}},{"name":"from_version_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"From Version Id"}},{"name":"to_version_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"To Version Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DiffResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/knowledge/uploads":{"post":{"tags":["knowledge"],"summary":"Issue Upload","description":"Issue a signed URL for a file upload. Idempotent on idempotency_key.","operationId":"issue_upload_v1_projects__project_id__knowledge_uploads_post","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssueUploadRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssueUploadResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/knowledge/uploads/{upload_id}/complete":{"post":{"tags":["knowledge"],"summary":"Mark Upload Complete","description":"Notify the server that a file upload has completed.","operationId":"mark_upload_complete_v1_projects__project_id__knowledge_uploads__upload_id__complete_post","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarkUploadCompleteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadCompleteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/knowledge/items/{item_id}/reindex":{"post":{"tags":["knowledge"],"summary":"Reindex Item","description":"Re-trigger compression + embedding for an existing item's current version.\n\nUse when an item shows status='FAILED' (chunk_count == 0 despite having a\ncurrent_version_id). Returns 202 Accepted with the new version_id.\n\nThe caller must own the project (gated via _resolve_project_or_404 which\nreturns 404 for non-owner projects, same as all other KB endpoints).","operationId":"reindex_item_v1_projects__project_id__knowledge_items__item_id__reindex_post","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Item Id"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReindexResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/shares":{"get":{"tags":["shares"],"summary":"List Shares","description":"List outbound external shares for a project.\n\nOptional ``peer_id`` query param narrows to shares with one peer.","operationId":"list_shares_v1_projects__project_id__shares_get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"peer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Peer Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListSharesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["shares"],"summary":"Create Share","description":"Grant (or refresh) an external A2A peer share for a KB item.","operationId":"create_share_v1_projects__project_id__shares_post","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantShareRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/shares/{share_id}":{"delete":{"tags":["shares"],"summary":"Delete Share","description":"Revoke an outbound share grant.","operationId":"delete_share_v1_projects__project_id__shares__share_id__delete","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"share_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Share Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/share-requests":{"get":{"tags":["shares"],"summary":"List Share Requests","description":"List inbound share requests for a project.\n\nOptional ``status`` query param filters by status (e.g. ``pending``).","operationId":"list_share_requests_v1_projects__project_id__share_requests_get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListInboxResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/share-requests/{req_id}/decide":{"post":{"tags":["shares"],"summary":"Decide Share Request","description":"Approve or deny a pending inbound share request.\n\n``decision`` must be ``\"approve\"`` or ``\"deny\"``.  On approval an outbound\n``kb_share_external`` row is created automatically if ``requested_resource``\nis a valid item UUID in the project.","operationId":"decide_share_request_v1_projects__project_id__share_requests__req_id__decide_post","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"req_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Req Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__app__routers__v1__shares__DecideRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecideResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/a2a/v1/share-requests":{"post":{"tags":["shares-a2a"],"summary":"Receive Inbound Share Request","description":"Accept an inbound A2A share request from an external peer.\n\nThe ``request_jws`` is verified against the peer's registered public key,\nand its signed claims must bind the operation: ``iss`` must equal the\npresenting ``from_peer_id`` (#272 — the proof names its own issuer),\nplus ``target_project_id``, ``requested_resource``, and a ``jti`` nonce.\n``requested_at`` inside the JWS must be within ±5 minutes of server time.\n\nAll invalid / unverifiable requests return 400 ``{detail: \"invalid_request\"}``\nregardless of the failure reason (no peer-existence leakage).","operationId":"receive_inbound_share_request_a2a_v1_share_requests_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboundShareRequestPayload"}}},"required":true},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Receive Inbound Share Request A2A V1 Share Requests Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/a2a/v1/redeem":{"post":{"tags":["shares-a2a"],"summary":"Redeem Shared Item Route","description":"Redeem an approved A2A share grant and return the item's live content.\n\n``redemption_jws`` is a fresh, short-lived signed proof (Ed25519) —\nNOT the long-lived ``manifest_jws`` issued at grant time — verified\nagainst the peer's registered public key. The signed payload must bind\n``item_id`` (matching this request's ``item_id``) and ``iss`` (matching\n``from_peer_id``); ``requested_at``/``iat`` must be within ±5 minutes.\n\nAll invalid/unverifiable requests, plus a missing/expired/revoked/\nwrong-peer grant, return 400 ``{detail: \"invalid_request\"}`` — the same\ngeneric message on every rejection path (no peer/item/grant existence\nleak), matching ``POST /a2a/v1/share-requests``.","operationId":"redeem_shared_item_route_a2a_v1_redeem_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedeemRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedeemResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/a2a/v1/tasks/claim":{"post":{"tags":["a2a-tasks"],"summary":"Claim Task Route","description":"Claim a 'pending' task under a fresh Ed25519-signed proof.\n\n``proof_jws`` must be signed by ``from_peer_id``'s registered private\nkey, bound to this exact ``task_id`` and the ``claim`` action (fresh\n``iat``/``jti`` — replay-guarded). No Clerk auth, no gc_ API key.","operationId":"claim_task_route_a2a_v1_tasks_claim_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimTaskRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskContractResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/a2a/v1/tasks/complete":{"post":{"tags":["a2a-tasks"],"summary":"Complete Task Route","description":"Complete a 'claimed' task with a verifiable, assignee-signed result.\n\n``proof_jws``'s ``result_hash`` claim must equal the SHA-256 of the\ncanonical (sorted-key, no-whitespace) JSON serialization of\n``result_payload`` — a mismatch (tampered/incomplete result) rejects\ngenerically via the same ladder as an invalid signature.","operationId":"complete_task_route_a2a_v1_tasks_complete_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteTaskRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskContractResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/a2a/v1/proposals":{"post":{"tags":["a2a-proposals"],"summary":"Receive Inbound Proposal","description":"Accept an inbound A2A change proposal from an external peer.\n\n``proof_jws`` must be signed by ``from_peer_id``'s registered private\nkey, bound to this exact ``item_id`` + ``base_version_id`` +\n``diff_sha256`` and the ``propose`` action (fresh ``iat``/``jti`` —\nreplay-guarded). No Clerk auth, no gc_ API key. The verified\n``proof_jws`` itself becomes the persisted ``proposal_jws`` — the peer\nsigned its own claim here, unlike the gc-key-authenticated\n``gc_plan_propose`` MCP tool, where the server signs on the caller's\nbehalf.\n\n``user_id`` (the project owner's clerk_id, required by\n``create_proposal``) is derived from the presenting peer's OWN\n``a2a_peers.user_id`` — P1a's model is same-user delegation (mirrors\n``a2a_tasks_service.check_peer_capability``'s same-user-allow gate): if\n``item_id``'s project does not actually belong to that same user,\n``create_proposal``'s own owner check rejects generically, so trusting\nthe peer's own ``user_id`` here cannot escalate across tenants.","operationId":"receive_inbound_proposal_a2a_v1_proposals_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProposeRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProposalResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/governance/audit":{"get":{"tags":["governance"],"summary":"Get Audit Log","description":"Paginated audit log from kb_audit_events for a project you own.","operationId":"get_audit_log_v1_governance_audit_get","parameters":[{"name":"project_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","description":"Required: the project you own whose audit events to read.","title":"Project Id"},"description":"Required: the project you own whose audit events to read."},{"name":"item_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Item Id"}},{"name":"actor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor"}},{"name":"event_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Event Type"}},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Since"}},{"name":"until","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Until"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__app__routers__v1__governance__AuditLogResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/governance/audit/export":{"get":{"tags":["governance"],"summary":"Export Audit Log","description":"Stream audit events as CSV.\n\nResponse has Content-Type: text/csv and Content-Disposition:\nattachment; filename=\"audit_log.csv\".","operationId":"export_audit_log_v1_governance_audit_export_get","parameters":[{"name":"project_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","description":"Required: the project you own whose audit events to export.","title":"Project Id"},"description":"Required: the project you own whose audit events to export."},{"name":"item_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Item Id"}},{"name":"event_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Event Type"}},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Since"}},{"name":"until","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Until"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/governance/retention":{"get":{"tags":["governance"],"summary":"Get Project Retention","description":"Get the retention policy for a project.","operationId":"get_project_retention_v1_projects__project_id__governance_retention_get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetentionPolicyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["governance"],"summary":"Set Project Retention","description":"Create or replace the retention policy for a project.","operationId":"set_project_retention_v1_projects__project_id__governance_retention_put","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetentionPolicyRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetentionPolicyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["governance"],"summary":"Delete Project Retention","description":"Clear the retention policy for a project (no-limit semantics).","operationId":"delete_project_retention_v1_projects__project_id__governance_retention_delete","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/knowledge/items/{item_id}/approvals":{"post":{"tags":["governance"],"summary":"Submit Approval","description":"Record an approval decision for a KB item.\n\nkb_approvals is append-only — to change a decision, submit a new one.\nThe item's status is updated atomically: 'approved' decision sets status\nto 'approved'; 'rejected' sets it to 'rejected'.","operationId":"submit_approval_v1_projects__project_id__knowledge_items__item_id__approvals_post","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalDecisionRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["governance"],"summary":"Get Approvals","description":"List approval history for a KB item, newest first.","operationId":"get_approvals_v1_projects__project_id__knowledge_items__item_id__approvals_get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Item Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalsListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/knowledge/items/{item_id}/status":{"patch":{"tags":["governance"],"summary":"Patch Item Status","description":"Transition a KB item's approval status.\n\nValid transitions:\n  draft       → in_review\n  in_review   → approved\n  in_review   → rejected\n  rejected    → in_review (resubmission)\n\nReturns 409 for invalid transitions; 404 if item not found.","operationId":"patch_item_status_v1_projects__project_id__knowledge_items__item_id__status_patch","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusTransitionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusTransitionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/knowledge/items/{item_id}/memberships":{"get":{"tags":["knowledge-memberships"],"summary":"List projects this item is shared to","description":"Return all non-owner projects that have membership access to this item.\n\nThe ``{project_id}`` in the URL MUST be the owner project of the item.\nCallers who own only a member project receive 404 (project not found)\nbecause ``_resolve_project_or_404`` returns 404 for un-owned projects.","operationId":"list_item_memberships_v1_projects__project_id__knowledge_items__item_id__memberships_get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Item Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListMembershipsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["knowledge-memberships"],"summary":"Add member projects to this item","description":"Grant one or more projects membership access to a KB item.\n\nIdempotent: project IDs already present are returned in ``skipped`` rather\nthan raising a 409.\n\nError shapes:\n- 404 ``item_not_found`` — item doesn't exist or is soft-deleted in this project\n- 400 ``cannot_share_private`` — item is visibility='private' (creator-only; raise its visibility to share)\n- 400 ``self_membership`` — project_ids contains the owner project itself\n- 404 ``member_project_not_found`` — a target project_id doesn't exist\n- 400 ``cap_exceeded`` — item would exceed 100 member-project limit","operationId":"add_item_memberships_v1_projects__project_id__knowledge_items__item_id__memberships_post","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddMembershipsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddMembershipsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/knowledge/items/{item_id}/memberships/{member_project_id}":{"delete":{"tags":["knowledge-memberships"],"summary":"Remove a member project from this item","description":"Remove a single project's membership access from a KB item.\n\nOnly the owner project can remove memberships. A member project removing\nitself from an item it doesn't own should use the same endpoint — the\nowner-check at ``_resolve_project_or_404`` will return 404.\n\nError shapes:\n- 404 ``membership_not_found`` — the membership row does not exist","operationId":"remove_item_membership_v1_projects__project_id__knowledge_items__item_id__memberships__member_project_id__delete","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Item Id"}},{"name":"member_project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Member Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RemoveMembershipResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/knowledge/items/{item_id}/visibility":{"patch":{"tags":["knowledge"],"summary":"Update item visibility","description":"Set the visibility level for a KB item.  'org' and 'external' values return **501** until Clerk org webhook integration lands in v1.39.","operationId":"patch_item_visibility_v1_projects__project_id__knowledge_items__item_id__visibility_patch","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VisibilityRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Patch Item Visibility V1 Projects  Project Id  Knowledge Items  Item Id  Visibility Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/knowledge/items/{item_id}/classification":{"patch":{"tags":["knowledge"],"summary":"Update item classification","description":"Set the sensitivity classification level for a KB item.","operationId":"patch_item_classification_v1_projects__project_id__knowledge_items__item_id__classification_patch","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClassificationRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Patch Item Classification V1 Projects  Project Id  Knowledge Items  Item Id  Classification Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/knowledge/policy":{"get":{"tags":["knowledge"],"summary":"Get classification policy","description":"Return the project's classification policy.  If no policy has been set, returns the permissive default (all four levels allowed, default='internal', required=false).","operationId":"get_classification_policy_v1_projects__project_id__knowledge_policy_get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClassificationPolicyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["knowledge"],"summary":"Create or replace classification policy","description":"Upsert the classification policy for a project.  Only the project owner may configure this.  ``default_classification`` must be present in ``allowed_classifications``.","operationId":"put_classification_policy_v1_projects__project_id__knowledge_policy_put","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClassificationPolicyRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClassificationPolicyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/kb/items":{"post":{"tags":["knowledge-hub"],"summary":"Ingest text or URL into the Knowledge Hub","description":"Ingest text or a URL into the project's Knowledge Hub.\n\nThe project is resolved from the gc_ API key binding. Mirrors ``gc_kb_ingest``.","operationId":"kb_ingest_v1_kb_items_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbIngestRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbIngestResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["knowledge-hub"],"summary":"List Knowledge Hub items (cursor-paginated)","description":"List all non-deleted KB items for the project bound to this API key.\n\nMirrors ``gc_kb_list``.\n\nA2 (2026-06-27): plan gate skipped for reads — free-plan owners can list\ntheir own items.  The no-project-bound-key 422 still fires; only the\nplan==free 403 is lifted for this read path.","operationId":"kb_list_items_v1_kb_items_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Opaque cursor from previous response.","title":"Cursor"},"description":"Opaque cursor from previous response."},{"name":"metadata_filter","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"JSON-encoded JSONB containment filter. URL-encode the JSON. Example: ?metadata_filter=%7B%22tag%22%3A%22alpha%22%7D for {\"tag\":\"alpha\"}.","title":"Metadata Filter"},"description":"JSON-encoded JSONB containment filter. URL-encode the JSON. Example: ?metadata_filter=%7B%22tag%22%3A%22alpha%22%7D for {\"tag\":\"alpha\"}."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/kb/items/{item_id}":{"get":{"tags":["knowledge-hub"],"summary":"Fetch a single Knowledge Hub item","description":"Fetch metadata for a single KB item by its UUID.\n\nMirrors ``gc_kb_get``.\n\nA2: require_pro=False — free owners can read their own items.","operationId":"kb_get_item_v1_kb_items__item_id__get","parameters":[{"name":"item_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Item Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbItemResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["knowledge-hub"],"summary":"Edit a Knowledge Hub item (optimistic concurrency)","description":"Replace item content, creating a new version.\n\nPass ``base_version_id`` equal to the current version UUID. On stale\n``base_version_id``, returns 409 with ``current_version_id`` so the caller\ncan retry with the fresh id. Mirrors ``gc_kb_edit``.","operationId":"kb_edit_item_v1_kb_items__item_id__patch","parameters":[{"name":"item_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbEditRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbEditResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["knowledge-hub"],"summary":"Soft-delete a Knowledge Hub item","description":"Soft-delete a KB item.\n\nThe item is marked deleted and excluded from queries / listings, but data\nis retained for audit purposes. Returns 204 No Content on success.\nMirrors ``gc_kb_delete``.","operationId":"kb_delete_item_v1_kb_items__item_id__delete","parameters":[{"name":"item_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Item Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/kb/items/{item_id}/versions":{"get":{"tags":["knowledge-hub"],"summary":"List version history for a Knowledge Hub item","description":"Return the full version history for a KB item.\n\nEach entry includes the diff between consecutive versions (from_version_id,\nto_version_id, unified_diff). Mirrors ``gc_kb_diff`` iterated over all\nversion pairs.\n\nA2: require_pro=False — version history is a read operation.","operationId":"kb_list_versions_v1_kb_items__item_id__versions_get","parameters":[{"name":"item_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Item Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbVersionsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/kb/query":{"post":{"tags":["knowledge-hub"],"summary":"Semantic + BM25 hybrid search of Knowledge Hub chunks","description":"Vector-search the project's Knowledge Hub.\n\nReturns the top-k semantically similar chunks with source item IDs, scores,\nand optional raw text. Mirrors ``gc_kb_query``.","operationId":"kb_query_v1_kb_query_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbQueryRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbQueryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/plans/proposals":{"get":{"tags":["plans"],"summary":"List change proposals for a project","operationId":"list_plan_proposals_v1_plans_proposals_get","parameters":[{"name":"project_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"description":"Project to list proposals for. Falls back to the bound key's project.","title":"Project Id"},"description":"Project to list proposals for. Falls back to the bound key's project."},{"name":"item_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"description":"Filter to one plan item's proposals.","title":"Item Id"},"description":"Filter to one plan item's proposals."},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by status (open/merged/rejected/superseded/expired).","title":"Status"},"description":"Filter by status (open/merged/rejected/superseded/expired)."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProposalListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/plans/proposals/{proposal_id}":{"get":{"tags":["plans"],"summary":"Fetch a single change proposal","operationId":"get_plan_proposal_v1_plans_proposals__proposal_id__get","parameters":[{"name":"proposal_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Proposal Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProposalResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/plans/items/{item_id}/versions":{"get":{"tags":["plans"],"summary":"Version history (blame) of a plan document, with per-version attribution","description":"Owner-scoped version timeline for the dashboard blame view — the REST\nmirror of the ``gc_plan_blame`` MCP tool (MCP-only until now).","operationId":"list_plan_versions_v1_plans_items__item_id__versions_get","parameters":[{"name":"item_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Item Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanVersionsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/plans/proposals/{proposal_id}/decide":{"post":{"tags":["plans"],"summary":"Merge or reject a change proposal (owner-only)","operationId":"decide_plan_proposal_v1_plans_proposals__proposal_id__decide_post","parameters":[{"name":"proposal_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Proposal Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__app__routers__v1__plans__DecideRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProposalResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/skills":{"get":{"tags":["skills"],"summary":"Browse published skills","operationId":"list_skills_v1_skills_get","parameters":[{"name":"category","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"description":"Exact category match","title":"Category"},"description":"Exact category match"},{"name":"artifact_type","in":"query","required":false,"schema":{"anyOf":[{"enum":["skill","mcp_server","prompt","agent"],"type":"string"},{"type":"null"}],"description":"Exact artifact_type match -- skill | mcp_server | prompt | agent","title":"Artifact Type"},"description":"Exact artifact_type match -- skill | mcp_server | prompt | agent"},{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"description":"Search name + tagline","title":"Q"},"description":"Search name + tagline"},{"name":"sort","in":"query","required":false,"schema":{"enum":["new","top"],"type":"string","description":"'new' = published_at DESC. 'top' is currently an alias for 'new' -- there is no vote signal to rank by until votes/comments (target_type='skill') land in a later build step.","default":"new","title":"Sort"},"description":"'new' = published_at DESC. 'top' is currently an alias for 'new' -- there is no vote signal to rank by until votes/comments (target_type='skill') land in a later build step."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SkillListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["skills"],"summary":"Create a draft skill listing","operationId":"create_skill_v1_skills_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSkillRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunitySkillResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/skills/mine":{"get":{"tags":["skills"],"summary":"List your own skills, at any status, with their scan results","description":"The author's view of their own submissions (#483).\n\nMUST stay registered ABOVE ``GET /{slug}``: FastAPI matches in registration\norder, so below it the literal path is captured as a slug and this endpoint\nsilently 404s. That is exactly the bug this route fixes -- a dogfood of prod\n(#480) read an author's own skill by id, fell through to the slug handler,\nand got not_found. Pinned by\napi/tests/test_community_skills_author_read.py::TestMineIsRegisteredBeforeTheSlugRoute.\n\nReturns the FULL shape (``_row_to_full``), not the public list item, because\nthe scan verdict is the point: a rejected author needs scan_severity /\nscan_recommendation / scan_findings to know what to fix.\n\n``requires_scope`` is defence in depth only -- it no-ops for legacy-scope\ncallers by design (see scope_enforcer.enforce_scope). The REAL gate is\n``_require_auth`` (which rejects a missing/falsy identity) plus the bound\n``WHERE author_clerk_id = :author`` predicate in the service -- NOT the\nnon-Optional type annotation on that parameter, which enforces nothing at\nruntime (codex, 2026-07-27).","operationId":"list_my_skills_v1_skills_mine_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":25,"minimum":1,"default":20,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MySkillListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/skills/enabled":{"get":{"tags":["skills"],"summary":"List the skills YOU can actually invoke in a run","description":"Exactly the skills `submit_run` would accept from this caller.\n\nNOT the marketplace, and that distinction is the reason this route exists.\nBrowsing published skills answers \"what could I adopt\"; a workflow node needs\n\"what will run\", and those differ by the two consent/safety conditions above.\nOffering the first where the second is meant is how a picker hands someone a\n422 for a choice the UI presented as valid.\n\nDECLARED BEFORE `/{slug}`, and that order is load-bearing: FastAPI matches in\ndeclaration order, so the reverse parses \"enabled\" as a slug and 404s.","operationId":"list_invocable_skills_v1_skills_enabled_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":25,"minimum":1,"default":20,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SkillListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/skills/{slug}":{"get":{"tags":["skills"],"summary":"Get a published skill by slug","operationId":"get_skill_by_slug_v1_skills__slug__get","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunitySkillPublicResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/skills/{skill_id}":{"put":{"tags":["skills"],"summary":"Edit the caller's own draft/rejected skill","operationId":"update_skill_v1_skills__skill_id__put","parameters":[{"name":"skill_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Skill Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSkillRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunitySkillResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/skills/{skill_id}/submit":{"post":{"tags":["skills"],"summary":"Submit a draft for review (runs a live gc_skill_scan)","operationId":"submit_skill_v1_skills__skill_id__submit_post","parameters":[{"name":"skill_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Skill Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmitSkillRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunitySkillResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/skills/{skill_id}/withdraw":{"post":{"tags":["skills"],"summary":"Withdraw a published skill or retract an in-review submission","operationId":"withdraw_skill_v1_skills__skill_id__withdraw_post","parameters":[{"name":"skill_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Skill Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunitySkillResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/skills/{skill_id}/enable":{"post":{"tags":["skills"],"summary":"Enable a skill for your account so runs may invoke it","description":"Enable `skill_id` for the AUTHENTICATED caller.\n\nWHY THIS ROUTE EXISTS (#84). `enabled_skills` had exactly one writer, and it\nwas reachable only through the MCP tool `gc_skill_enable`. A person using the\ndashboard could not enable anything, so `GET /v1/skills/enabled` correctly\nreturned `[]` forever and the workflow canvas's skill picker was permanently\nempty for them — while its own empty state told them to enable one from the\nmarketplace, an action the web could not perform.\n\nIT DELEGATES. `skills_controlplane_service.enable` takes a `FOR UPDATE` lock\non the `community_skills` row and gates accessibility BEFORE the scan check,\nso a nonexistent id and a private-not-owned one are indistinguishable — an\nordering two adversarial rounds produced. Re-implementing any of that here\nwould be a second, drifting copy of a consent step whose entire value is\nbeing correct.\n\nThe principal is the resolved identity. Nothing the caller can set reaches\nit — same rule as `decide`'s moderator grant (module docstring (a)).","operationId":"enable_skill_v1_skills__skill_id__enable_post","parameters":[{"name":"skill_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Skill Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnableSkillResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["skills"],"summary":"Whether YOU have this skill enabled","description":"Read the caller's enablement state for one skill (#86).\n\nWHY THIS ROUTE EXISTS. `EnableSkillButton` took `initiallyEnabled` as a prop\nand the detail page never passed one, so it defaulted to `false` for\neverybody. Two consequences, and the second is the real one:\n\n  1. Someone who had already enabled a skill was shown \"Enable for my\n     account\". Clicking it is harmless — `enable()` is idempotent and\n     returns `already_enabled` — but the page states something untrue about\n     the reader's own account until they click.\n\n  2. THE FLAGGED-SKILL GUARD WAS DEFEATED. That component refuses to render\n     an enable control when `safeToInstall === false && !enabled`, and its\n     comment explains the case it must not create: \"a skill flagged AFTER\n     you enabled it left you with a live enablement and no way to withdraw\n     it from a browser.\" Because `enabled` was always false, that is exactly\n     what it produced. The guard was correct and its input was always wrong\n     — a check whose predicate can never be true.\n\nIT REUSES `list_enabled` RATHER THAN ASKING A TARGETED QUESTION. A one-row\n`SELECT ... WHERE principal_id AND skill_id` is the obvious implementation\nand would silently omit that reader's `_is_accessible` filter, so a skill\nits owner has since withdrawn would still report `enabled: true` here — the\nconfidentiality reversal a codex adversarial gate already forced onto\n`list_enabled` once. Reusing it means the accessibility rule has ONE\ndefinition and this route cannot drift from it.\n\nThe cost is scanning the caller's own enablements to answer one bit. That is\nthe deliberate trade; if a principal ever holds enough enabled skills for it\nto matter, add a targeted query THAT CALLS `_is_accessible`, not one that\nreimplements it.","operationId":"get_skill_enablement_v1_skills__skill_id__enable_get","parameters":[{"name":"skill_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Skill Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SkillEnablementStateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["skills"],"summary":"Disable a skill for your account","description":"Turn enablement off again.\n\nA consent step you cannot withdraw is not consent. `disable()` has existed on\nthe service since the control plane shipped; without a route, a browser user\nwho enabled a skill had no way to stop it being injected into their prompts.\n\n`response_model=None` is load-bearing on a 204 — under\n`from __future__ import annotations` a body-less route annotated `-> None`\nfails at IMPORT on FastAPI 0.115-0.135 and takes the whole app down with it\n(api-changes rule #13).","operationId":"disable_skill_v1_skills__skill_id__enable_delete","parameters":[{"name":"skill_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Skill Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/skills/{skill_id}/decide":{"post":{"tags":["skills"],"summary":"Approve or reject a pending skill submission (moderator/admin only)","description":"Moderator/admin decision. See module docstring (a) -- ``grant`` is\nconstructed SERVER-SIDE from the resolved caller identity; the request\nbody carries no field that could smuggle a different one.","operationId":"decide_skill_v1_skills__skill_id__decide_post","parameters":[{"name":"skill_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Skill Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecideSkillRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunitySkillResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/context/frameworks":{"get":{"tags":["context_hub"],"summary":"List Frameworks","description":"Return all supported frameworks in the Agent Context Hub.","operationId":"list_frameworks_api_context_frameworks_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FrameworkListResponse"}}}}}}},"/api/context/frameworks/{slug}":{"get":{"tags":["context_hub"],"summary":"Get Framework","description":"Return a single framework by slug.","operationId":"get_framework_api_context_frameworks__slug__get","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FrameworkResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/context/frameworks/{slug}/ingest":{"post":{"tags":["context_hub"],"summary":"Ingest Framework Endpoint","description":"Trigger doc ingestion for a single framework (admin only).\n\nFetches the framework's docs_url, chunks the content, embeds it, and\nstores the chunks in the system KnowledgeBase so gc_lookup can retrieve\nthem.","operationId":"ingest_framework_endpoint_api_context_frameworks__slug__ingest_post","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__app__routers__v1__context_hub__IngestResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/usage":{"get":{"tags":["projects-finops"],"summary":"Get Project Usage","description":"Return usage statistics for a project scoped to the current calendar month.\n\nOnly events with ``usage_events.project_id = project_id`` are included.\nHistorical events (pre-v1.22.0, before keys were bound) show up as\n``project_id=NULL`` in the global /v1/usage rollup but never here — the\nproject-specific view is forward-looking.\n\nF22 (v1.22.2): response now includes ``plan``, ``compressions_limit``, and\n``models`` so the per-project page can render Model Mix + plan-aware UI\nwithout an extra /v1/usage round-trip.","operationId":"get_project_usage_v1_projects__project_id__usage_get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectUsageResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/budget":{"get":{"tags":["projects-finops"],"summary":"Get Project Budget","description":"Return the current budget configuration for a project.\n\nReturns 404 when no budget has been set (use PUT to create one).","operationId":"get_project_budget_v1_projects__project_id__budget_get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BudgetResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["projects-finops"],"summary":"Upsert Project Budget","description":"Create or replace the budget configuration for a project.\n\nIdempotent — calling PUT again with different values replaces the budget.\nSetting a new budget does NOT reset ``last_alerted_threshold`` (the cron\nsweep compares against the budget in the same period; a manual update mid-\nperiod keeps the dedup state intact).","operationId":"upsert_project_budget_v1_projects__project_id__budget_put","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BudgetConfig"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BudgetResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["projects-finops"],"summary":"Delete Project Budget","description":"Remove the budget configuration for a project (alerts disabled).\n\nReturns 404 when no budget exists. Does not affect the project itself or\nits usage history.","operationId":"delete_project_budget_v1_projects__project_id__budget_delete","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Delete Project Budget V1 Projects  Project Id  Budget Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/tool-allowlist":{"get":{"tags":["projects-finops"],"summary":"Get Project Tool Allowlist","description":"Return the current tool allowlist for a project.\n\n``tool_allowlist: null`` means no filter is active — the project uses the\nplan/profile default tool surface.  A non-null list means only those tools\n(intersected with the plan/profile allowlist) are available to agents\nconnecting with this project's gc_ key.","operationId":"get_project_tool_allowlist_v1_projects__project_id__tool_allowlist_get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ToolAllowlistResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["projects-finops"],"summary":"Set Project Tool Allowlist","description":"Set the tool allowlist for a project.\n\nPro+ only — Free tier users get the 17-tool surface by plan default and\ncannot customise per-project allowlists.\n\nThe allowlist is intersected with the plan/profile allowlist at gateway\ntime — setting a tool that your plan doesn't include has no effect.","operationId":"set_project_tool_allowlist_v1_projects__project_id__tool_allowlist_put","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ToolAllowlistBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ToolAllowlistResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["projects-finops"],"summary":"Delete Project Tool Allowlist","description":"Reset the tool allowlist to NULL (plan/profile default).\n\nAfter this call, agents connecting with this project's gc_ key see the\nfull plan/profile tool surface rather than a project-scoped subset.","operationId":"delete_project_tool_allowlist_v1_projects__project_id__tool_allowlist_delete","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Delete Project Tool Allowlist V1 Projects  Project Id  Tool Allowlist Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/projects/{project_id}/tool-allowlist/apply-starter":{"post":{"tags":["projects-finops"],"summary":"Apply Starter Tool Allowlist","description":"Apply the recommended 25-tool starter set as the project's allowlist.\n\nConvenience endpoint — equivalent to PUT with the curated list. Idempotent.\nPro+ only.","operationId":"apply_starter_tool_allowlist_v1_projects__project_id__tool_allowlist_apply_starter_post","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ToolAllowlistResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/benchmarks/runs":{"post":{"tags":["benchmarks"],"summary":"Submit Benchmark Run","description":"Submit a new AI inference benchmark measurement.\n\nAuth (v1.53.0 — sign-up required):\nRequires ``Authorization: Bearer gc_<key>`` (20 runs/hour).\nThe global ``AuthMiddleware`` resolves the bearer token and sets\n``request.state.user_id``. Results remain public to VIEW — only POSTing\nrequires a free Clerk account.\n\nOld clients still sending the legacy ``cf-turnstile-response`` header are\nunaffected — unknown headers are ignored; Turnstile has not been an auth\npath since v1.53.0 (param removed in the 2026-07-17 cleanup, B3).\n\nOn missing auth: HTTP 401 with a signup CTA.","operationId":"submit_benchmark_run_v1_benchmarks_runs_post","parameters":[{"name":"x-submitted-by-agent","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Submitted-By-Agent"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BenchmarkRunCreateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BenchmarkRunResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/benchmarks/runs/{id_or_slug}":{"get":{"tags":["benchmarks"],"summary":"Get Benchmark Run","description":"Fetch a single benchmark run by UUID or public_slug.\n\nNo auth required. Cache-Control: public, max-age=300.","operationId":"get_benchmark_run_v1_benchmarks_runs__id_or_slug__get","parameters":[{"name":"id_or_slug","in":"path","required":true,"schema":{"type":"string","title":"Id Or Slug"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BenchmarkRunResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/benchmarks/leaderboard":{"get":{"tags":["benchmarks"],"summary":"Get Leaderboard","description":"Multi-axis leaderboard with cursor pagination.\n\nLenses:\n- ``tokens_per_sec``: raw output speed (default)\n- ``tokens_per_sec_per_dollar``: efficiency per $/Mtok (model price lookup)\n- ``tokens_per_sec_per_watt``: efficiency per TDP watt (from hardware metadata)\n- ``value_composite``: ``(tps * verified_boost) / sqrt(price_per_mtok)``","operationId":"get_leaderboard_v1_benchmarks_leaderboard_get","parameters":[{"name":"model_text","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by model","title":"Model Text"},"description":"Filter by model"},{"name":"hardware_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"description":"Filter by hardware SKU","title":"Hardware Id"},"description":"Filter by hardware SKU"},{"name":"hardware_class","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by hardware class — one of ['amd_rocm', 'apple_silicon', 'cpu_only', 'intel_arc', 'nvidia_cuda', 'other']","title":"Hardware Class"},"description":"Filter by hardware class — one of ['amd_rocm', 'apple_silicon', 'cpu_only', 'intel_arc', 'nvidia_cuda', 'other']"},{"name":"lens","in":"query","required":false,"schema":{"type":"string","description":"Ranking lens","default":"tokens_per_sec","title":"Lens"},"description":"Ranking lens"},{"name":"verified_only","in":"query","required":false,"schema":{"type":"boolean","description":"Only show verified runs","default":false,"title":"Verified Only"},"description":"Only show verified runs"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":25,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Pagination cursor (opaque base64)","title":"Cursor"},"description":"Pagination cursor (opaque base64)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeaderboardResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/benchmarks/runs/{run_id}/flag":{"post":{"tags":["benchmarks"],"summary":"Flag Benchmark Run","description":"Flag a benchmark run for review (requires gc_ key auth).\n\nIdempotent per (run_id, flagger_user_id).  When flag_count reaches 3\nthe run is automatically set to verified_status='flagged'.","operationId":"flag_benchmark_run_v1_benchmarks_runs__run_id__flag_post","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlagRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Flag Benchmark Run V1 Benchmarks Runs  Run Id  Flag Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/benchmarks/hardware":{"get":{"tags":["benchmarks"],"summary":"List Hardware","description":"List hardware SKUs ordered by canonical then vendor+model.","operationId":"list_hardware_v1_benchmarks_hardware_get","parameters":[{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Substring search on vendor+model","title":"Q"},"description":"Substring search on vendor+model"},{"name":"canonical_only","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Canonical Only"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":25,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/HardwareResponse"},"title":"Response List Hardware V1 Benchmarks Hardware Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["benchmarks"],"summary":"Create Hardware","description":"Submit a new hardware SKU (user-submitted, canonical=False).\n\nIdempotent on (vendor_text, model_text) — returns the existing row\nif already present.\n\nAdmin-only, mirroring the other hardware/benchmark admin routes. The\nrequires_scope(\"admin:write\") dependency is NOT a sufficient gate on its\nown (legacy / Clerk-JWT callers bypass scope enforcement via\nscope_enforcer's legacy path), so this in-handler _require_admin is the\nreal gate.","operationId":"create_hardware_v1_benchmarks_hardware_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HardwareCreateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HardwareResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/benchmarks/hardware/{hardware_id}/promote":{"post":{"tags":["benchmarks"],"summary":"Promote Hardware","description":"Mark a user-submitted hardware SKU as canonical (admin only).\n\nIdempotent: if the row is already canonical, returns 200 with a message.\nConflict (409): if another row is already canonical for the same\n(vendor_text, model_text) pair.","operationId":"promote_hardware_v1_benchmarks_hardware__hardware_id__promote_post","parameters":[{"name":"hardware_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Hardware Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PromoteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["benchmarks"],"summary":"Revoke Hardware Canonical","description":"Revoke the canonical flag from a hardware SKU (admin only).\n\nRare — used to clean up erroneous promotions.  Idempotent when already\nnon-canonical.","operationId":"revoke_hardware_canonical_v1_benchmarks_hardware__hardware_id__promote_delete","parameters":[{"name":"hardware_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Hardware Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PromoteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/benchmarks/runs/{run_id}/comments":{"post":{"tags":["benchmarks"],"summary":"Post Benchmark Comment","description":"Submit a comment on a benchmark run.\n\nRequires authentication (gc_ key or Clerk JWT).  Comment is classified\ninline by the AI moderation layer and returns its resolved status:\n  - approved   : visible to everyone immediately\n  - pending    : awaiting final classification (transient — rare)\n  - needs_review: flagged for human moderator review\n  - rejected   : content policy violation (hidden)\n\nThe caller can poll GET /comments to see the current visibility state.","operationId":"post_benchmark_comment_v1_benchmarks_runs__run_id__comments_post","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommentCreateRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["benchmarks"],"summary":"List Benchmark Comments","description":"List threaded comments for a benchmark run.\n\nPublic endpoint (no auth required for approved comments).\nAuthenticated callers also see their own pending/needs_review comments.\nRejected comments are never returned.","operationId":"list_benchmark_comments_v1_benchmarks_runs__run_id__comments_get","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommentListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/benchmarks/runs/{run_id}/percentile":{"get":{"tags":["benchmarks"],"summary":"Get Benchmark Run Percentile","description":"Return percentile context for a run's metric value.\n\nUses a fallback hierarchy per council D3:\n  1. Exact config distribution (same model × hardware × quant)\n  2. Model/hardware tier distribution\n  3. All-results distribution\n\nReturns null when insufficient data exists (<5 results at any tier).\n\nThe ``metric_value`` query parameter is optional — when omitted the\nhandler looks up the run's own stored value.","operationId":"get_benchmark_run_percentile_v1_benchmarks_runs__run_id__percentile_get","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}},{"name":"metric_name","in":"query","required":false,"schema":{"type":"string","default":"tokens_per_sec_output","title":"Metric Name"}},{"name":"metric_value","in":"query","required":false,"schema":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Metric Value"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PercentileResponse"},{"type":"null"}],"title":"Response Get Benchmark Run Percentile V1 Benchmarks Runs  Run Id  Percentile Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/benchmarks/moderation-queue":{"get":{"tags":["benchmarks"],"summary":"Get Moderation Queue","description":"Admin: list benchmark comments awaiting human review (status=needs_review).\n\nReturns comments in chronological order (oldest first — work through\nthe queue FIFO to minimise comment authors waiting).","operationId":"get_moderation_queue_v1_benchmarks_moderation_queue_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModerationQueueResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/benchmarks/comments/{comment_id}/moderate":{"post":{"tags":["benchmarks"],"summary":"Moderate Benchmark Comment","description":"Admin: approve or reject a needs_review benchmark comment.\n\naction: \"approve\" | \"reject\"\n\nSets status to \"approved\" or \"rejected\" respectively.  Only callable\nby admins (ADMIN_USER_IDS / ADMIN_EMAILS).","operationId":"moderate_benchmark_comment_v1_benchmarks_comments__comment_id__moderate_post","parameters":[{"name":"comment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Comment Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModerateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/news/items":{"post":{"tags":["news-admin"],"summary":"Ingest News Items","description":"Idempotent ingest of raw news items from n8n.\n\nAccepts either a single item or a batch (``{items: [...]}``).\n\nDedup via UNIQUE(source_slug, external_id) — same item submitted twice\nappears in ``duplicates``, not ``created``.  The caller's ``gc_`` key\nmust resolve to an admin user (ADMIN_USER_IDS / ADMIN_EMAILS).\n\nv1.34.18 — validates that source_slug exists in news_sources with active=true\nbefore accepting the ingest payload. Rejects with 422 + error:\n\"unknown_source_slug\" if not. Prevents phantom source slugs from polluting\nthe news_items table (e.g. 'smoketest' from automated testing).","operationId":"ingest_news_items_v1_news_items_post","requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/SingleItemIngestRequest"},{"$ref":"#/components/schemas/BatchItemIngestRequest"}],"title":"Body"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__app__routers__v1__news_admin__IngestResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/news/articles":{"post":{"tags":["news-admin"],"summary":"Publish News Article","description":"Publish a news article from n8n after Telegram approval.\n\nAuto-generates a slug from ``title`` if ``slug`` is not provided.\nReturns 409 on explicit slug collision so the caller can retry with a\ndifferent slug.\n\nWrites one ``news_article_revisions`` row with ``change_kind='created'``.","operationId":"publish_news_article_v1_news_articles_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishArticleRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishArticleResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/news/articles/{article_id}":{"patch":{"tags":["news-admin"],"summary":"Edit News Article","description":"Edit an existing article.\n\nAccepted fields: title, body_md, category, hero_image_url, excerpt,\nsource_url, source_attribution, status, metadata.\n\nWrites one ``news_article_revisions`` row with ``change_kind='edited'``.","operationId":"edit_news_article_v1_news_articles__article_id__patch","parameters":[{"name":"article_id","in":"path","required":true,"schema":{"type":"string","title":"Article Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EditArticleRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EditArticleResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/news/articles/{article_id}/withdraw":{"post":{"tags":["news-admin"],"summary":"Withdraw News Article","description":"Withdraw an article (DMCA or other takedown).\n\nSets ``status='withdrawn'`` on the article.\nWrites one revision with ``change_kind='dmca_withdrawn'`` (when ``dmca=True``)\nor ``change_kind='withdrawn'`` (otherwise).\n\nWithdrawn articles return 410 on the public GET /v1/news/{slug} endpoint.","operationId":"withdraw_news_article_v1_news_articles__article_id__withdraw_post","parameters":[{"name":"article_id","in":"path","required":true,"schema":{"type":"string","title":"Article Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WithdrawRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WithdrawResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/news/items/{item_id}/requeue":{"post":{"tags":["news-admin"],"summary":"Requeue News Item","description":"Manual requeue of a news_item with CAS version and audit event.","operationId":"requeue_news_item_v1_news_items__item_id__requeue_post","parameters":[{"name":"item_id","in":"path","required":true,"schema":{"type":"string","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequeueItemRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequeueItemResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/news/admin/drafts":{"get":{"tags":["news-drafts"],"summary":"List Draft Items","description":"List news_items by draft_status (admin only).\n\nDefault: status=drafted (pending approval).\nAllowed values: undrafted, drafting, drafted, rejected, needs_review,\nexpired, publishing, published. Legacy ``approved`` is invalid.\n\nEmpty list when no items match — never raises 404.","operationId":"list_draft_items_v1_news_admin_drafts_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"$ref":"#/components/schemas/DraftStatusFilter","description":"Filter by status","default":"drafted"},"description":"Filter by status"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"description":"Max results","default":50,"title":"Limit"},"description":"Max results"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DraftItemResponse"},"title":"Response List Draft Items V1 News Admin Drafts Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/news/admin/drafts/{item_id}":{"patch":{"tags":["news-drafts"],"summary":"Patch Draft Item","description":"Edit draft fields before approve.\n\nRe-runs Tier-1 kill-word and forbidden-pattern check. Returns 400 if\nany kill word or pattern is found in the patched content — surface this\nin the UI with the exact word/pattern that triggered the rejection.\n\nAccepted fields: draft_title, draft_body_md, draft_excerpt, draft_category.","operationId":"patch_draft_item_v1_news_admin_drafts__item_id__patch","parameters":[{"name":"item_id","in":"path","required":true,"schema":{"type":"string","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatchDraftRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatchDraftResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/news/admin/drafts/{item_id}/approve":{"post":{"tags":["news-drafts"],"summary":"Approve Draft Item","description":"Promote a draft to a published news_articles row.\n\nInternally calls the existing publish_article helper (DRY) and fills the\npublished_article_id FK back on the news_items row.\n\nReturns 404 if item not found.\nReturns 409 if item is not in 'drafted' status.","operationId":"approve_draft_item_v1_news_admin_drafts__item_id__approve_post","parameters":[{"name":"item_id","in":"path","required":true,"schema":{"type":"string","title":"Item Id"}}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApproveResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/news/admin/drafts/{item_id}/reject":{"post":{"tags":["news-drafts"],"summary":"Reject Draft Item","description":"Manually reject a draft with a reason.\n\nPreserves the news_items row for provenance; does not delete anything.\nReturns 404 if item not found.","operationId":"reject_draft_item_v1_news_admin_drafts__item_id__reject_post","parameters":[{"name":"item_id","in":"path","required":true,"schema":{"type":"string","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RejectRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RejectResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/news/admin/drafts/{item_id}/requeue":{"post":{"tags":["news-drafts"],"summary":"Requeue Draft Item","description":"Manual requeue with CAS version, mandatory reason, immutable audit event.","operationId":"requeue_draft_item_v1_news_admin_drafts__item_id__requeue_post","parameters":[{"name":"item_id","in":"path","required":true,"schema":{"type":"string","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequeueRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequeueResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/news/categories":{"get":{"tags":["news"],"summary":"Get News Categories","description":"Return distinct published categories with article counts.\n\nExample response::\n\n    [\n      {\"category\": \"Models\", \"count\": 14},\n      {\"category\": \"Tools\", \"count\": 9}\n    ]","operationId":"get_news_categories_v1_news_categories_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/NewsCategoryItem"},"type":"array","title":"Response Get News Categories V1 News Categories Get"}}}}}}},"/v1/news":{"get":{"tags":["news"],"summary":"List News Articles","description":"Return paginated published articles, newest-first.\n\nCursor-based pagination: the ``next_cursor`` value from one response is\npassed as ``cursor`` on the next request.  When ``next_cursor`` is null,\nthere are no more pages.\n\nOnly ``status='published'`` articles are returned.","operationId":"list_news_articles_v1_news_get","parameters":[{"name":"category","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by category","title":"Category"},"description":"Filter by category"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Page size","default":20,"title":"Limit"},"description":"Page size"},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Opaque pagination cursor","title":"Cursor"},"description":"Opaque pagination cursor"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NewsListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/news/subscribe":{"post":{"tags":["news"],"summary":"Subscribe To Newsletter","description":"Capture an email for the /news weekly digest.\n\nSingle-opt-in per council 2/3 vote. CAN-SPAM compliant via the existing\n/v1/unsubscribe one-click flow.\n\nStatus codes:\n  200 — email captured (or honeypot triggered — silent success)\n  400 — invalid source value\n  422 — invalid email (Pydantic EmailStr validation)","operationId":"subscribe_to_newsletter_v1_news_subscribe_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NewsSubscribeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NewsSubscribeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/news/{slug}":{"get":{"tags":["news"],"summary":"Get News Article","description":"Return full article by slug.\n\nStatus codes:\n  200 — article found and published\n  404 — slug not found ({detail, error: \"not_found\"})\n  410 — article withdrawn / DMCA ({detail, error: \"withdrawn\"})","operationId":"get_news_article_v1_news__slug__get","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NewsArticleDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/feed":{"get":{"tags":["feed"],"summary":"Read Feed","description":"Return a keyset-paginated page of the unified community feed.\n\n``sort`` = hot | new | top | rising (default hot); ``filter`` = all |\nnews | blog | benchmark | mine (``mine`` = your own posts, resolved from\nthe Bearer token; an anonymous ``mine`` read returns empty, never a leak).\n``q`` (#357) is an optional case-insensitive\nsubstring search over title/excerpt -- trimmed, capped at 100 chars, and\ntreated as absent when blank/whitespace-only. ``user_vote`` is attached\nper item when the request carries a valid Bearer token.","operationId":"read_feed_v1_feed_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":50,"minimum":1,"default":20,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"name":"sort","in":"query","required":false,"schema":{"type":"string","default":"hot","title":"Sort"}},{"name":"filter","in":"query","required":false,"schema":{"type":"string","default":"all","title":"Filter"}},{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Q"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/feed/vote":{"post":{"tags":["feed"],"summary":"Cast Vote","description":"Cast (+1/-1) or retract (0) a vote on a feed item. Auth required.","operationId":"cast_vote_v1_feed_vote_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoteRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoteResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/feed/bookmark":{"post":{"tags":["feed"],"summary":"Set Bookmark Endpoint","description":"Save or unsave (bookmark) a feed item for the caller. Auth required.\n\n``saved=true`` saves, ``saved=false`` unsaves; both are idempotent. Scoped to\nthe authenticated caller -- you can only bookmark on your own behalf.","operationId":"set_bookmark_endpoint_v1_feed_bookmark_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookmarkRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookmarkResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/feed/items/{item_id}/comments":{"post":{"tags":["feed"],"summary":"Post Comment","description":"Add a top-level or reply comment to a feed item. Auth required.","operationId":"post_comment_v1_feed_items__item_id__comments_post","parameters":[{"name":"item_id","in":"path","required":true,"schema":{"type":"string","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommentResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["feed"],"summary":"List Comments","description":"Return a thread-ordered comment list for a feed item.\n\n``sort`` controls ordering within each depth level:\n  - ``best``  — score DESC, recency DESC (default)\n  - ``top``   — score DESC, recency ASC\n  - ``new``   — newest first\n  - ``old``   — oldest first\n\n``user_vote`` is populated when the request carries a valid auth token.\nPublic read (legacy bypass stays in ``_AUTH_BYPASS_PATHS`` for anonymous).","operationId":"list_comments_v1_feed_items__item_id__comments_get","parameters":[{"name":"item_id","in":"path","required":true,"schema":{"type":"string","title":"Item Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"sort","in":"query","required":false,"schema":{"type":"string","pattern":"^(best|top|new|old)$","default":"best","title":"Sort"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommentsPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/feed/comments/{comment_id}/vote":{"post":{"tags":["feed"],"summary":"Cast Comment Vote","description":"Cast (+1/-1) or retract (0) a vote on a comment. Auth required.","operationId":"cast_comment_vote_v1_feed_comments__comment_id__vote_post","parameters":[{"name":"comment_id","in":"path","required":true,"schema":{"type":"string","title":"Comment Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommentVoteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommentVoteResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/feed/comments/{comment_id}":{"patch":{"tags":["feed"],"summary":"Patch Comment","description":"Edit the body of the caller's own comment (Forum slice 3). Auth required.","operationId":"patch_comment_v1_feed_comments__comment_id__patch","parameters":[{"name":"comment_id","in":"path","required":true,"schema":{"type":"string","title":"Comment Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EditCommentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommentResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["feed"],"summary":"Remove Comment","description":"Soft-delete the caller's own comment (Forum slice 4). Auth required.","operationId":"remove_comment_v1_feed_comments__comment_id__delete","parameters":[{"name":"comment_id","in":"path","required":true,"schema":{"type":"string","title":"Comment Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/feed/comments/{comment_id}/report":{"post":{"tags":["feed"],"summary":"Report Comment","description":"File a content report on a comment. Auth required. Idempotent per (reporter, comment).","operationId":"report_comment_v1_feed_comments__comment_id__report_post","parameters":[{"name":"comment_id","in":"path","required":true,"schema":{"type":"string","title":"Comment Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportCommentRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Report Comment V1 Feed Comments  Comment Id  Report Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/feed/posts":{"post":{"tags":["feed"],"summary":"Create Post","description":"Create a user-authored post (draft -> moderation). Auth required.\n\nThe core of the \"let users write their own articles/blogs\" goal: an\nauthenticated user submits a title + markdown body; the ``user_posts``\nservice (#64) validates + sanitizes, stores the row as ``status='draft'``,\nand the moderation pipeline promotes it into the feed once approved. Both\nthis endpoint and the agent-posting MCP tool call the same ``create_draft``.\n\n``request.state.user_id`` is the Clerk id (JWT ``sub`` / gc_-key owner),\nwhich is exactly what ``create_draft(author_clerk_id=...)`` wants -- no\nDB-UUID resolution needed.","operationId":"create_post_v1_feed_posts_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePostRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePostResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/users/{username}/follow":{"post":{"tags":["follows"],"summary":"Follow","description":"Follow the user identified by ``username``.\n\nIdempotent — a second call for an existing follow is a no-op.\nReturns ``{ok: true}`` on success.\nRejects self-follow with 400.\nRejects unknown username with 404.","operationId":"follow_v1_users__username__follow_post","parameters":[{"name":"username","in":"path","required":true,"schema":{"type":"string","title":"Username"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Follow V1 Users  Username  Follow Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["follows"],"summary":"Unfollow","description":"Unfollow the user identified by ``username``.\n\nNo-op if the relationship does not exist.\nReturns ``{ok: true}`` on success.\nRejects self-unfollow with 400.\nRejects unknown username with 404.","operationId":"unfollow_v1_users__username__follow_delete","parameters":[{"name":"username","in":"path","required":true,"schema":{"type":"string","title":"Username"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Unfollow V1 Users  Username  Follow Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/users/{username}/follow-status":{"get":{"tags":["follows"],"summary":"Follow Status","description":"Return follow relationship status + counts for the target user.\n\n``following`` is False when the request is unauthenticated.\nReturns 404 if ``username`` is not found.","operationId":"follow_status_v1_users__username__follow_status_get","parameters":[{"name":"username","in":"path","required":true,"schema":{"type":"string","title":"Username"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FollowStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/content/report":{"post":{"tags":["moderation"],"summary":"Report Content","description":"Flag any content for moderation review.\n\nAuth required. Idempotent per (reporter, target_type, target_id).\nSilenced users receive 403.\n\nReturns ``{id, status, created_at}`` -- matches the existing\n``POST /v1/feed/comments/{id}/report`` response shape.","operationId":"report_content_v1_content_report_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContentReportRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Report Content V1 Content Report Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/batch-queue":{"post":{"tags":["batch-queue"],"summary":"Create Batch Queue Job","description":"Create a new batch compression job.\n\nAccepts up to 200 items.\n\n**Small jobs (≤ 5 items):** processed inline and return HTTP 200 with\n``status=\"completed\"`` immediately.\n\n**Large jobs (> 5 items):** queued asynchronously and return HTTP 202\nwith ``status=\"queued\"``.  The `/v1/cron/batch-queue-sweep` endpoint\npicks up any large job that gets interrupted (e.g. Fly auto-suspend)\nand reprocesses it within the next cron cycle (≤ 5 min delay).","operationId":"create_batch_queue_job_v1_batch_queue_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchQueueRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchQueueCreatedResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["batch-queue"],"summary":"List Batch Queue Jobs","description":"List the authenticated user's batch queue jobs, newest first.","operationId":"list_batch_queue_jobs_v1_batch_queue_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Page Size"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchQueueListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/batch-queue/stream":{"get":{"tags":["batch-queue"],"summary":"Stream Batch Jobs","description":"SSE endpoint for real-time batch job status updates.\n\nEmits:\n  * ``init``        — one-shot snapshot of the user's latest 50 jobs on connect\n  * ``job.updated`` — whenever a job row's serialized form changes between polls\n  * ``job.removed`` — whenever a previously-seen job falls out of the snapshot\n  * ``heartbeat``   — approximately every 15s (keeps proxies from dropping the connection)\n\nUpstash Redis is REST-only (no pubsub), so we poll the jobs table at\n``_STREAM_POLL_SECONDS`` intervals and diff snapshots in-memory. One extra\nDB read per active connection per second is cheap on Supabase and works\nacross any number of Fly instances.\n\nRequires ``Authorization: Bearer <clerk_jwt_or_gc_key>`` (standard auth\nmiddleware populates ``request.state.user_id``).","operationId":"stream_batch_jobs_v1_batch_queue_stream_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/batch-queue/{job_id}":{"get":{"tags":["batch-queue"],"summary":"Get Batch Queue Job","description":"Get the status of a specific batch queue job.","operationId":"get_batch_queue_job_v1_batch_queue__job_id__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchQueueJobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/batch-queue/{job_id}/results":{"get":{"tags":["batch-queue"],"summary":"Get Batch Queue Results","description":"Get all items and their compressed results for a batch job.","operationId":"get_batch_queue_results_v1_batch_queue__job_id__results_get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchQueueResultsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/analytics/summary":{"get":{"tags":["analytics"],"summary":"Analytics Summary","description":"Per-project compression summary with an 'Unassigned' bucket for\nevents that have no project_id.\n\n``days`` (optional, 1–365): when provided, filters to the trailing\n``days``-day window.  When omitted, returns a lifetime aggregate so\nexisting API consumers see no breaking change.","operationId":"analytics_summary_v1_analytics_summary_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":365,"minimum":1},{"type":"null"}],"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ProjectSummary"},"title":"Response Analytics Summary V1 Analytics Summary Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/analytics/trends":{"get":{"tags":["analytics"],"summary":"Analytics Trends","description":"Aggregate compression events by date bucket.","operationId":"analytics_trends_v1_analytics_trends_get","parameters":[{"name":"period","in":"query","required":false,"schema":{"type":"string","pattern":"^(daily|weekly)$","default":"daily","title":"Period"}},{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":90,"minimum":7,"default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TrendPoint"},"title":"Response Analytics Trends V1 Analytics Trends Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/analytics/export":{"get":{"tags":["analytics"],"summary":"Analytics Export","description":"Export the last 90 days of usage events as a CSV download.","operationId":"analytics_export_v1_analytics_export_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/savings":{"get":{"tags":["analytics"],"summary":"Get Savings","description":"Cumulative all-time savings. ``?model=`` sets the rate for the\n``estimated_cost_saved_usd`` field and is echoed back in ``model``.","operationId":"get_savings_v1_savings_get","parameters":[{"name":"model","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Canonical model name for cost estimation (e.g. ``claude-sonnet-4.6``, ``claude-opus-4.6``, ``gpt-5.4``, ``gemini-3.1-pro-preview``). Unknown models fall back to a blended default. If omitted, the blended default is used.","title":"Model"},"description":"Canonical model name for cost estimation (e.g. ``claude-sonnet-4.6``, ``claude-opus-4.6``, ``gpt-5.4``, ``gemini-3.1-pro-preview``). Unknown models fall back to a blended default. If omitted, the blended default is used."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavingsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/settings/semantic-cache-threshold":{"get":{"tags":["settings"],"summary":"Get Threshold","operationId":"get_threshold_v1_settings_semantic_cache_threshold_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThresholdResponse"}}}}}},"put":{"tags":["settings"],"summary":"Put Threshold","operationId":"put_threshold_v1_settings_semantic_cache_threshold_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThresholdPutRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThresholdResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/global-savings":{"get":{"tags":["analytics"],"summary":"Global Savings","description":"Return aggregate compression savings across the whole platform.","operationId":"global_savings_v1_global_savings_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Global Savings V1 Global Savings Get"}}}}}}},"/v1/teams":{"get":{"tags":["teams"],"summary":"List Teams","description":"List teams where the caller is a member or has a pending invite.","operationId":"list_teams_v1_teams_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamListResponse"}}}}}},"post":{"tags":["teams"],"summary":"Create Team","description":"Create a team and auto-add the caller as its owner.","operationId":"create_team_v1_teams_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTeamRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamWithMembershipResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/teams/{team_id}":{"patch":{"tags":["teams"],"summary":"Update Team","description":"Rename a team. Owner/admin only.","operationId":"update_team_v1_teams__team_id__patch","parameters":[{"name":"team_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Team Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTeamRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/teams/{team_id}/invites":{"post":{"tags":["teams"],"summary":"Invite Team Member","description":"Invite a member to a team by email and send a Resend email.","operationId":"invite_team_member_v1_teams__team_id__invites_post","parameters":[{"name":"team_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Team Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteTeamMemberRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamInviteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/teams/{team_id}/members":{"get":{"tags":["teams"],"summary":"Get Team Members","description":"Return the full member roster for any active team member.","operationId":"get_team_members_v1_teams__team_id__members_get","parameters":[{"name":"team_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Team Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamMembersResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/teams/{team_id}/accept":{"post":{"tags":["teams"],"summary":"Accept Team Invite","description":"Accept the caller's pending invite for the requested team.","operationId":"accept_team_invite_v1_teams__team_id__accept_post","parameters":[{"name":"team_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Team Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptTeamInviteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/teams/{team_id}/invites/{invite_id}":{"delete":{"tags":["teams"],"summary":"Revoke Team Invite","description":"Revoke a pending team invite.","operationId":"revoke_team_invite_v1_teams__team_id__invites__invite_id__delete","parameters":[{"name":"team_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Team Id"}},{"name":"invite_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Invite Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/teams/{team_id}/members/{member_user_id}":{"delete":{"tags":["teams"],"summary":"Remove Team Member","description":"Remove a user from a team.","operationId":"remove_team_member_v1_teams__team_id__members__member_user_id__delete","parameters":[{"name":"team_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Team Id"}},{"name":"member_user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Member User Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/teams/{team_id}/transfer":{"post":{"tags":["teams"],"summary":"Transfer Team Ownership","description":"Transfer team ownership to an existing active member.","operationId":"transfer_team_ownership_v1_teams__team_id__transfer_post","parameters":[{"name":"team_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Team Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransferTeamOwnershipRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamTransferResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/teams/{team_id}/members/{member_user_id}/role":{"patch":{"tags":["teams"],"summary":"Change Member Role","description":"Change the role of an active team member.","operationId":"change_member_role_v1_teams__team_id__members__member_user_id__role_patch","parameters":[{"name":"team_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Team Id"}},{"name":"member_user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Member User Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateMemberRoleRequest"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/teams/{team_id}/invites/{invite_id}/resend":{"post":{"tags":["teams"],"summary":"Resend Team Invite","description":"Re-send the invite email for a pending team invite.","operationId":"resend_team_invite_v1_teams__team_id__invites__invite_id__resend_post","parameters":[{"name":"team_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Team Id"}},{"name":"invite_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Invite Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/teams/{team_id}/activity":{"get":{"tags":["teams"],"summary":"Get Team Activity","description":"Return the paginated audit log for a team (owners and admins only).","operationId":"get_team_activity_v1_teams__team_id__activity_get","parameters":[{"name":"team_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Team Id"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Page Size"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamActivityResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/teams/{team_id}/usage":{"get":{"tags":["teams"],"summary":"Get Team Usage","description":"Return team-wide usage aggregates for owners and admins.\n\nWhen period=current_month, only UsageEvent rows with created_at in the\ncurrent UTC calendar month are counted. Omitted period keeps the all-time\naggregate (backward compatible).","operationId":"get_team_usage_v1_teams__team_id__usage_get","parameters":[{"name":"team_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Team Id"}},{"name":"period","in":"query","required":false,"schema":{"anyOf":[{"type":"string","pattern":"^current_month$"},{"type":"null"}],"description":"Optional aggregate window. Only current_month (UTC) is supported.","title":"Period"},"description":"Optional aggregate window. Only current_month (UTC) is supported."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamUsageResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/webhooks":{"get":{"tags":["webhooks"],"summary":"List Webhooks","description":"List the caller's configured webhooks (active + inactive; excludes soft-deleted).","operationId":"list_webhooks_v1_webhooks_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookListResponse"}}}}}},"post":{"tags":["webhooks"],"summary":"Create Webhook","description":"Create a webhook owned by the authenticated user.","operationId":"create_webhook_v1_webhooks_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWebhookRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/webhooks/{webhook_id}":{"delete":{"tags":["webhooks"],"summary":"Delete Webhook","description":"Soft-delete one of the caller's webhooks.\n\nSets deleted_at to now() instead of a hard DELETE. The row is hidden\nfrom list responses and ignored by the delivery service. Recoverable\nvia POST /v1/webhooks/{id}/recover within 30 days.","operationId":"delete_webhook_v1_webhooks__webhook_id__delete","parameters":[{"name":"webhook_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Webhook Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/webhooks/{webhook_id}/toggle":{"patch":{"tags":["webhooks"],"summary":"Toggle Webhook","description":"Toggle the enabled/disabled state of one of the caller's webhooks.","operationId":"toggle_webhook_v1_webhooks__webhook_id__toggle_patch","parameters":[{"name":"webhook_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Webhook Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ToggleWebhookResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/webhooks/{webhook_id}/recover":{"post":{"tags":["webhooks"],"summary":"Recover Webhook","description":"Recover a soft-deleted webhook within 30 days of deletion.","operationId":"recover_webhook_v1_webhooks__webhook_id__recover_post","parameters":[{"name":"webhook_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Webhook Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/webhooks/{webhook_id}/test":{"post":{"tags":["webhooks"],"summary":"Test Webhook","description":"Deliver a synchronous test ping to a webhook.","operationId":"test_webhook_v1_webhooks__webhook_id__test_post","parameters":[{"name":"webhook_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Webhook Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestWebhookResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/webhooks/{webhook_id}/deliveries":{"get":{"tags":["webhooks"],"summary":"Get Webhook Deliveries","description":"Return paginated delivery history for an owned webhook.","operationId":"get_webhook_deliveries_v1_webhooks__webhook_id__deliveries_get","parameters":[{"name":"webhook_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Webhook Id"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Page Size"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDeliveriesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/filter-cli":{"post":{"tags":["compression"],"summary":"Filter Cli","description":"Filter and compress CLI output.\n\nAutomatically detects the command type (git diff, pytest, npm install, etc.)\nand applies type-specific compression. Typical savings: 80-99 % on verbose output.","operationId":"filter_cli_v1_filter_cli_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FilterCliRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FilterCliResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/compress/tool-output":{"post":{"tags":["compression"],"summary":"Compress Tool Output","description":"Compress a large tool/command/MCP output blob with identifier preservation.\n\nUses the same CLI output optimizer engine as ``filter_cli_output`` but\nadds an identifier-preservation guarantee: execution-critical tokens\n(file paths with line/col, error codes, symbols, stack frame locations,\nURLs, UUIDs, env var names) are force-kept so a downstream agent can act\non the compressed output WITHOUT re-running the original tool.\n\nTypical savings: 80–99% on verbose output, identical to filter_cli_output,\nwith near-zero amnesia risk on critical tokens.","operationId":"compress_tool_output_v1_compress_tool_output_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompressToolOutputRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompressToolOutputResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/integrations/github/webhook":{"post":{"tags":["integrations"],"summary":"Github Webhook","description":"Receive GitHub webhook events with per-tenant HMAC routing.\n\nSecurity contract\n-----------------\n1. Parse ``repository.full_name`` from the (still-unverified) payload —\n   used ONLY as a lookup key, never trusted for auth decisions.\n2. Look up ``Integration`` rows for ``service=\"github\"`` whose stored\n   ``config.repo_url`` normalises to the same ``owner/repo`` slug.\n3. **Verify HMAC** against that Integration's ``config.webhook_secret``\n   BEFORE any dispatch.  Dispatch ONLY on a verified payload.\n4. If no Integration matches → fall back to the global\n   ``GITHUB_WEBHOOK_SECRET`` env-var verify + acknowledge-only (no\n   dispatch, no regression for repos not yet integrated).\n5. If an Integration matches but signature check fails → same generic\n   response as today (no tenant/secret existence leak, no dispatch).\n\nDurability contract (row 506, 2026-08-02 — corrects the prior\n``BackgroundTasks`` design documented here)\n-----------------------------------------------------------------------\n``push``/``pull_request`` deliveries that resolve a tenant now run\n``_handle_push_event`` / ``_handle_pr_event`` INLINE (awaited before the\nresponse is returned) instead of via ``BackgroundTasks``, and the\nreplay-dedup mark is committed only AFTER the handler returns without\nraising. See the comment above the dedup block (Step 3b) for the full\nrationale and the trade-off accepted. Events with nothing to lose\n(``ping``, or a delivery that matched no Integration) keep the old\ncommit-immediately shape.","operationId":"github_webhook_v1_integrations_github_webhook_post","parameters":[{"name":"x-hub-signature-256","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Hub-Signature-256"}},{"name":"x-github-event","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Github-Event"}},{"name":"x-github-delivery","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Github-Delivery"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/integrations/github/configure":{"get":{"tags":["integrations"],"summary":"Get Github Config","description":"Get current GitHub integration settings (token redacted).","operationId":"get_github_config_v1_integrations_github_configure_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["integrations"],"summary":"Configure Github","description":"Save GitHub integration settings for the authenticated user.","operationId":"configure_github_v1_integrations_github_configure_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GithubIntegrationConfig"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["integrations"],"summary":"Delete Github Config","description":"Remove GitHub integration.","operationId":"delete_github_config_v1_integrations_github_configure_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/integrations/notion/configure":{"get":{"tags":["integrations"],"summary":"Get Notion Config","description":"Presence and workspace name. NEVER the token, not even redacted.","operationId":"get_notion_config_v1_integrations_notion_configure_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["integrations"],"summary":"Configure Notion","description":"Verify a Notion integration token, then store it encrypted.","operationId":"configure_notion_v1_integrations_notion_configure_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotionIntegrationConfig"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["integrations"],"summary":"Delete Notion Config","description":"Disconnect. IDEMPOTENT: deleting nothing is success, because a dashboard\nretrying a failed disconnect must not meet a 404 for reaching the state it\nasked for.","operationId":"delete_notion_config_v1_integrations_notion_configure_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/agents/mcp-clients":{"get":{"tags":["agents"],"summary":"Get Mcp Clients","description":"List gc_ keys owned by the caller with 30-day MCP activity stats.","operationId":"get_mcp_clients_v1_agents_mcp_clients_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListMcpClientsResponse"}}}}}}},"/v1/agents/a2a-peers":{"get":{"tags":["agents"],"summary":"List A2A Peers","description":"List registered A2A peers owned by the caller.","operationId":"list_a2a_peers_v1_agents_a2a_peers_get","parameters":[{"name":"include_revoked","in":"query","required":false,"schema":{"type":"boolean","description":"Include revoked peers (admin use)","default":false,"title":"Include Revoked"},"description":"Include revoked peers (admin use)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListA2APeersResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["agents"],"summary":"Register A2A Peer","description":"Register a new A2A peer. Returns 409 if the same base_url is already registered.","operationId":"register_a2a_peer_v1_agents_a2a_peers_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/A2APeerRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/A2APeerResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/agents/a2a-peers/{peer_id}":{"patch":{"tags":["agents"],"summary":"Patch A2A Peer","description":"Update peer name, status, or public_key_jws.","operationId":"patch_a2a_peer_v1_agents_a2a_peers__peer_id__patch","parameters":[{"name":"peer_id","in":"path","required":true,"schema":{"type":"string","title":"Peer Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/A2APeerPatchRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/A2APeerResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["agents"],"summary":"Delete A2A Peer","description":"Revoke an A2A peer (soft-delete, sets status='revoked').","operationId":"delete_a2a_peer_v1_agents_a2a_peers__peer_id__delete","parameters":[{"name":"peer_id","in":"path","required":true,"schema":{"type":"string","title":"Peer Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/agents/activity":{"get":{"tags":["agents"],"summary":"Get Activity","description":"Reverse-chronological sampled MCP call log. Supports cursor pagination.","operationId":"get_activity_v1_agents_activity_get","parameters":[{"name":"token_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by api_key_id (key_id field)","title":"Token Id"},"description":"Filter by api_key_id (key_id field)"},{"name":"tool_name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by exact tool name","title":"Tool Name"},"description":"Filter by exact tool name"},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by status","title":"Status"},"description":"Filter by status"},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO-format cursor from previous page","title":"Cursor"},"description":"ISO-format cursor from previous page"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivityResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/agents/tasks":{"get":{"tags":["agents"],"summary":"List Task Board","description":"Owner-scoped delegated-task board -- every task this user has\ndelegated to one of their own agents, most recent first.\n\nScoped by ``a2a_task_contracts.user_id`` (the validated Clerk owner),\nNOT ``get_task``'s ``(id, project_id)`` scope and NOT ``list_inbox``'s\nassignee-peer scope (which would hide the owner's own delegated tasks --\nsee ``a2a_tasks_service.list_owner_task_board``).","operationId":"list_task_board_v1_agents_tasks_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListTaskBoardResponse"}}}}}}},"/v1/agents/tasks/stream":{"get":{"tags":["agents"],"summary":"Stream Task Board","description":"Authenticated SSE stream for the live task board.\n\nEmits:\n  * ``init``         — one-shot snapshot of the owner's task board on connect\n  * ``task.updated``  — whenever a task row's serialized form changes between polls\n  * ``task.removed``  — whenever a previously-seen task falls out of the snapshot\n  * ``heartbeat``     — approximately every 15s (keeps proxies from dropping the connection)\n\nMirrors ``batch_queue.stream_batch_jobs``'s generator STRUCTURE with\nthree deliberate deviations (see ``_load_task_board_snapshots`` for #1\nand #2):\n  1. ``owner_clerk_id`` (the clerk_id) is passed straight to\n     ``_load_task_board_snapshots`` -- no ``get_or_provision_user`` ->\n     UUID resolution step (``a2a_task_contracts.user_id`` IS the\n     clerk_id; ``BatchJob.user_id`` is a UUID FK that needs one).\n  2. A fresh session is opened per poll (never one held for the whole\n     stream).\n  3. Poll interval is ``_STREAM_POLL_SECONDS`` (3-5s, not batch's 1s) --\n     this board's per-poll query (owner filter + peer JOIN + a\n     correlated MAX(event.created_at)) is heavier than 50 flat batch\n     rows.\n\nA native browser ``EventSource`` cannot attach a ``Bearer`` header, so\nthe dashboard consumes this via the existing authenticated SSE client\npattern (Task 7), not raw ``EventSource``.","operationId":"stream_task_board_v1_agents_tasks_stream_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/agents/tasks/{task_id}":{"get":{"tags":["agents"],"summary":"Get Task Board Item","description":"Owner-scoped single task plus its ordered, attributed event timeline.\n\n404s generically (no state/existence leak) when the task does not\nexist OR belongs to a different owner — both cases are indistinguishable\non the wire (see ``a2a_tasks_service.get_task_board_detail``).","operationId":"get_task_board_item_v1_agents_tasks__task_id__get","parameters":[{"name":"task_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Task Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskBoardDetailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/agents/tasks/{task_id}/reassign":{"post":{"tags":["agents"],"summary":"Reassign A2A Task","description":"Reassign a delegated A2A task to a different peer (dashboard mirror\nof the gc_a2a_task_reassign MCP tool). Owner-authority action -- no A2A\nproof required. Only 'pending'/'claimed'/'expired' tasks are reassignable.","operationId":"reassign_a2a_task_v1_agents_tasks__task_id__reassign_post","parameters":[{"name":"task_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Task Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskReassignRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskReassignResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/agents/tasks/{task_id}/cancel":{"post":{"tags":["agents"],"summary":"Cancel A2A Task Endpoint","description":"Cancel a delegated A2A task from the owner's console. Owner-authority\naction -- no A2A proof required. Only 'draft', 'pending', 'expired' tasks\ncan be cancelled.","operationId":"cancel_a2a_task_endpoint_v1_agents_tasks__task_id__cancel_post","parameters":[{"name":"task_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Task Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskCancelRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskCancelResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/audit-cache":{"post":{"tags":["optimization"],"summary":"Audit Cache","description":"Audit how cache-friendly a prompt is for a specific AI provider.","operationId":"audit_cache_v1_audit_cache_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditCacheRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditCacheResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/check-budget":{"post":{"tags":["analytics"],"summary":"Check Budget","description":"Check how much of the context budget a text would consume.","operationId":"check_budget_v1_check_budget_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BudgetCheckRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BudgetCheckResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/context/align":{"post":{"tags":["context_optimization"],"summary":"Align a static context prefix to measured token blocks","description":"Assembles static context tiers with stable separators and optionally pads cumulative prefixes. Eligible tokens describe complete measured blocks; they do not predict provider cache hits.","operationId":"align_context_v1_context_align_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContextAlignRequest"}}},"required":true},"responses":{"200":{"description":"Aligned prompt and measured token-boundary summary.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContextAlignResponse"},"example":{"full_prompt_text":"System rules\n\nKB facts\n\nCurrent question","total_tokens":80,"static_prefix_tokens":64,"eligible_boundary_tokens":64,"waste_tokens":32,"tokenizer_name":"cl100k_base","token_counts_exact":true,"tiers":[]}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/detect-issues":{"post":{"tags":["quality"],"summary":"Detect Issues","description":"Detect hallucinations and blind spots in compressed output.\n\nCompares compressed text against the original to find:\n- **Hallucinations**: claims in the compressed text not supported by the original\n- **Blind spots**: critical information in the original that was lost\n\nEnterprise feature — requires Pro or Enterprise plan.","operationId":"detect_issues_v1_detect_issues_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DetectIssuesRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DetectIssuesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/notifications":{"get":{"tags":["notifications"],"summary":"Get Notifications","description":"Return active notifications for the current user.\n\nFilters by:\n- Current time between starts_at and expires_at (if set)\n- Target matches: 'all', user's plan, or user's specific ID","operationId":"get_notifications_v1_notifications_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/UserNotification"},"type":"array","title":"Response Get Notifications V1 Notifications Get"}}}}}}},"/v1/activity":{"get":{"tags":["activity"],"summary":"Read Activity","description":"Return a merged chronological activity timeline (own comments + notifications).","operationId":"read_activity_v1_activity_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":40,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivityPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/activity/notifications":{"get":{"tags":["activity"],"summary":"Read Notifications","description":"Return in-app notifications for the current user + unread count.","operationId":"read_notifications_v1_activity_notifications_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":40,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/activity/notifications/read-all":{"post":{"tags":["activity"],"summary":"Read All Notifications","description":"Mark all unread notifications read. Returns {\"updated\": N}.","operationId":"read_all_notifications_v1_activity_notifications_read_all_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Read All Notifications V1 Activity Notifications Read All Post"}}}}}}},"/v1/activity/notifications/{notification_id}/read":{"post":{"tags":["activity"],"summary":"Read Notification","description":"Mark a single notification as read. Returns {\"ok\": true/false}.","operationId":"read_notification_v1_activity_notifications__notification_id__read_post","parameters":[{"name":"notification_id","in":"path","required":true,"schema":{"type":"string","title":"Notification Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Read Notification V1 Activity Notifications  Notification Id  Read Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/dashboard/attention":{"get":{"tags":["dashboard"],"summary":"Get Dashboard Attention","description":"Cross-project rollup of what needs the caller's attention right now.\n\nAggregates, across ALL of the caller's own projects: quota pressure,\nproject budget alerts, pending A2A share requests, expired/stale A2A\ntasks, plan-proposals awaiting review, and billing issues (past_due /\ncanceled / trial-ending). Never another tenant's signals -- every\nper-project query independently verifies project ownership (never\ntrusts a foreign table's user_id column alone) -- see\n``api/tests/test_dashboard_attention_real_pg.py`` for the tenant-\nisolation proofs against a real Postgres engine.\n\nEach signal category is additionally gated by the SAME scope its own\ndedicated REST surface requires (billing:read, projects:read, kb:read,\nagents:read, plans:read) -- a narrowly-scoped ``gc_`` key only sees the\ncategories it actually carries a scope for; a full Clerk dashboard\nsession sees everything (the existing scope_model=\"legacy\" bypass).\n\nA genuinely new caller (no active API key AND zero compressions ever\nAND zero other real signals) gets back a single first_run ghost row.\nAn established-but-currently-keyless caller with a real signal (e.g. a\npast_due subscription or a pending approval) always sees that signal --\nthe ghost row never suppresses a real one.\n\n``partial``/``degraded`` on the response distinguish \"genuinely all\ncaught up\" from \"a signal's query failed server-side\" (mirrors the\n``X-Degraded`` response header convention).","operationId":"get_dashboard_attention_v1_dashboard_attention_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttentionResponse"}}}}}}},"/v1/feedback/public":{"post":{"tags":["feedback"],"summary":"Create Public Feedback","description":"Submit a bug report or feature request without signing in.\n\nSecurity measures applied:\n- Registered in ``_AUTH_BYPASS_PATHS`` so AuthMiddleware skips it.\n- Per-IP rate-limit: 5 submissions per hour (Redis sliding window).\n- Honeypot field ``website`` — any non-empty value silently returns 200\n  without writing to DB (bots fill it; humans never see it).\n- Server-side length caps (title <=200, body <=20 000 characters).\n- Optional email validated via ``EmailStr`` but never emailed back.\n- No outbound email on submit (no spam-relay risk).\n- Stored body is plain text; admin view must escape before rendering.","operationId":"create_public_feedback_v1_feedback_public_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicFeedbackRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicFeedbackResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/feedback":{"post":{"tags":["feedback"],"summary":"Create Feedback","description":"Submit a bug report or feature request.","operationId":"create_feedback_v1_feedback_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackCreateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["feedback"],"summary":"List Feedback","description":"List the caller's own submissions (newest first).","operationId":"list_feedback_v1_feedback_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/feedback/{submission_id}":{"get":{"tags":["feedback"],"summary":"Get Feedback","description":"Get a single feedback submission (caller's own rows only).","operationId":"get_feedback_v1_feedback__submission_id__get","parameters":[{"name":"submission_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Submission Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/feedback":{"get":{"tags":["feedback"],"summary":"Admin List Feedback","description":"List all feedback submissions (admin-only).","operationId":"admin_list_feedback_v1_admin_feedback_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"kind","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kind"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":100,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/feedback/{submission_id}":{"patch":{"tags":["feedback"],"summary":"Admin Patch Feedback","description":"Update the status (and optionally admin_notes) of a submission (admin-only).\n\nMay call ``maybe_push_to_github_sink`` which no-ops unless both\n``GITHUB_FEEDBACK_REPO`` and ``GITHUB_FEEDBACK_TOKEN`` env vars are set.","operationId":"admin_patch_feedback_v1_admin_feedback__submission_id__patch","parameters":[{"name":"submission_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Submission Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackAdminPatchRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/push/subscribe":{"post":{"tags":["push"],"summary":"Subscribe Push","description":"Upsert a W3C PushSubscription for the authenticated user.\n\nIf the (user_id, endpoint) pair already exists, updates p256dh + auth\nin place (handles browser key rotation after re-subscribe).\n\nReturns {\"status\": \"subscribed\"} on success.","operationId":"subscribe_push_v1_push_subscribe_post","parameters":[{"name":"user-agent","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User-Agent"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PushSubscribeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscribeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["push"],"summary":"Unsubscribe Push","description":"Remove a push subscription for the authenticated user.\n\nIdempotent — returns {\"status\": \"unsubscribed\"} even if no row matched.","operationId":"unsubscribe_push_v1_push_subscribe_delete","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PushUnsubscribeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnsubscribeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/push/vapid-public-key":{"get":{"tags":["push"],"summary":"Get Vapid Public Key","description":"Return the VAPID public key so the client can call pushManager.subscribe().\n\nPublic endpoint — no auth required (the key is not secret).\nReturns 503 when VAPID_PUBLIC_KEY env var is not set (push not yet enabled).","operationId":"get_vapid_public_key_v1_push_vapid_public_key_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VapidPublicKeyResponse"}}}}}}},"/v1/push/test":{"post":{"tags":["push"],"summary":"Test Push Notification","description":"Send a test push notification to every registered browser for the caller.\n\nAuth required — same pattern as subscribe_push (_resolve_user_uuid).\n\nResponse:\n  sent=N, status=\"ok\"              — push attempted to N subscriptions.\n  sent=0, status=\"no_subscriptions\" — user has no registered subscriptions.\n  sent=0, status=\"push_disabled\"   — VAPID key unset; send_web_push no-ops.\n\nIdempotent and best-effort: individual delivery failures are logged at ERROR\n(Sentry-visible) by send_web_push but never surfaced as 5xx to the caller.","operationId":"test_push_notification_v1_push_test_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestPushResponse"}}}}}}},"/v1/admin/notifications":{"get":{"tags":["admin"],"summary":"List Notifications","description":"List all notifications (admin only).","operationId":"list_notifications_v1_admin_notifications_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/NotificationResponse"},"type":"array","title":"Response List Notifications V1 Admin Notifications Get"}}}}}},"post":{"tags":["admin"],"summary":"Create Notification","description":"Create a system notification (admin only).","operationId":"create_notification_v1_admin_notifications_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateNotificationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/notifications/{notification_id}":{"delete":{"tags":["admin"],"summary":"Delete Notification","description":"Delete a notification (admin only).","operationId":"delete_notification_v1_admin_notifications__notification_id__delete","parameters":[{"name":"notification_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Notification Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/opus-delta/preview":{"get":{"tags":["admin"],"summary":"Opus Delta Preview","description":"Return the list of users who would be emailed + projected savings (read-only).","operationId":"opus_delta_preview_v1_admin_opus_delta_preview_get","parameters":[{"name":"plan","in":"query","required":false,"schema":{"type":"string","pattern":"^(pro|team|enterprise)$","default":"pro","title":"Plan"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":10000,"minimum":1,"default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreviewResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/opus-delta/dispatch":{"post":{"tags":["admin"],"summary":"Opus Delta Dispatch","description":"Send the Opus 4.7 savings campaign email.\n\nSafety rails:\n- Intersects user_ids with OPUS_EMAIL_ALLOWLIST_CSV env var (first controlled send gate).\n- Skips email_opt_out users.\n- Idempotent: Redis NX key prevents double-sending within 90 days.\n- dry_run=True returns rendered bodies + recipient list without sending.","operationId":"opus_delta_dispatch_v1_admin_opus_delta_dispatch_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DispatchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DispatchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/stats/overview":{"get":{"tags":["admin"],"summary":"Admin Stats Overview","description":"Return high-level KPIs: MRR, user counts, usage totals, churn.","operationId":"admin_stats_overview_v1_admin_stats_overview_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/admin/stats/usage-chart":{"get":{"tags":["admin"],"summary":"Admin Usage Chart","description":"Return daily compression volume for the chart.","operationId":"admin_usage_chart_v1_admin_stats_usage_chart_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":90,"minimum":7,"default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/stats/signups-chart":{"get":{"tags":["admin"],"summary":"Admin Signups Chart","description":"Return daily signup counts.","operationId":"admin_signups_chart_v1_admin_stats_signups_chart_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":90,"minimum":7,"default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/stats/top-users":{"get":{"tags":["admin"],"summary":"Admin Top Users","description":"Return top users by token usage.","operationId":"admin_top_users_v1_admin_stats_top_users_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":50,"minimum":5,"default":15,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/stats/users":{"get":{"tags":["admin"],"summary":"Admin Users List","description":"Searchable, filterable user list.","operationId":"admin_users_list_v1_admin_stats_users_get","parameters":[{"name":"plan","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Plan"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":5,"default":25,"title":"Page Size"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/stats/leads":{"get":{"tags":["admin"],"summary":"Admin Leads List","description":"Return all enterprise leads.","operationId":"admin_leads_list_v1_admin_stats_leads_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/admin/stats/referrals":{"get":{"tags":["admin"],"summary":"Admin Referrals List","description":"Return referral program stats.","operationId":"admin_referrals_list_v1_admin_stats_referrals_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/admin/trials":{"get":{"tags":["admin"],"summary":"Admin Trials List","description":"#37 — trial funnel + currently-trialing roster for the admin dashboard.\n\nReads the ``subscriptions`` table populated by the Polar trial lifecycle\nwebhooks: status flips ``trialing`` on create, ``active`` on first charge, or\n``canceled`` if the user cancels in-trial (``started_as_trial`` marks the row\nas trial-originated for life). Dormant-empty until the trial product is live\n(GATE-A), so every count is 0 / list empty until then — by design.","operationId":"admin_trials_list_v1_admin_trials_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/admin/stats/infrastructure":{"get":{"tags":["admin"],"summary":"Get Infrastructure","description":"Return real-time usage vs limits for every external service.","operationId":"get_infrastructure_v1_admin_stats_infrastructure_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/admin/scaling":{"get":{"tags":["admin"],"summary":"Get Scaling","description":"Return the read-only autoscaling + rate-limit snapshot for the admin UI.","operationId":"get_scaling_v1_admin_scaling_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/admin/sandbox/sessions":{"get":{"tags":["admin"],"summary":"List Sandbox Sessions","description":"Live sandbox sessions, with the meters that actually run away.","operationId":"list_sandbox_sessions_v1_admin_sandbox_sessions_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["admin"],"summary":"Create Sandbox Session","description":"Boot one sandbox. Refuses unless armed, in-tier, and under the global cap.","operationId":"create_sandbox_session_v1_admin_sandbox_sessions_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSandboxRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/sandbox/sessions/{session_id}":{"delete":{"tags":["admin"],"summary":"Kill Sandbox Session","description":"Terminal route 1 -- admin kill. Destroys; never stops for reuse.","operationId":"kill_sandbox_session_v1_admin_sandbox_sessions__session_id__delete","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Session Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/sandbox/orphans":{"get":{"tags":["admin"],"summary":"List Sandbox Orphans","description":"WB-ORPHAN -- read-only. Classifies Fly apps against DB rows; destroys nothing.\n\nAn operator confirms a `terminal_orphan` or `unknown_origin` finding\nmanually and reaps it via the existing `DELETE /sandbox/sessions/{id}`\nroute above. This route never calls `provider.destroy()`.","operationId":"list_sandbox_orphans_v1_admin_sandbox_orphans_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/sandbox/sessions/mine":{"get":{"tags":["sandbox"],"summary":"List My Sandbox Sessions","description":"The caller's OWN sandbox sessions -- never a caller-supplied id.","operationId":"list_my_sandbox_sessions_v1_sandbox_sessions_mine_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MySandboxSessionsResponse"}}}}}}},"/v1/sandbox/sessions/{session_id}/attach-ticket":{"post":{"tags":["sandbox"],"summary":"Mint My Attach Ticket","description":"Mint the single-use upgrade ticket for a session the caller OWNS.","operationId":"mint_my_attach_ticket_v1_sandbox_sessions__session_id__attach_ticket_post","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__app__routers__v1__sandbox_sessions__AttachTicketResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/sandbox/sessions/{session_id}":{"delete":{"tags":["sandbox"],"summary":"Request destruction of an owned sandbox session","description":"Owner Stop: durable STOPPING until destruction is confirmed.\n\nOwnership is the authenticated principal only — no owner/provider/machine\nrequest fields are accepted. Missing and foreign IDs share one 404 detail.","operationId":"owner_stop_sandbox_session_v1_sandbox_sessions__session_id__delete","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}}],"responses":{"200":{"description":"Session is already terminal (STOPPED/FAILED) or destruction was confirmed in this call.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OwnerSandboxStopResponse"}}}},"202":{"description":"Durable STOPPING intent committed; provider confirmation is still pending (or cleanup was uncertain).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OwnerSandboxStopResponse"}}}},"404":{"description":"Owner-stop disabled, or session missing/foreign/malformed."},"503":{"description":"Sandbox stop unavailable (provider registry not configured)."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/workbench/capabilities":{"get":{"tags":["workbench"],"summary":"Read current Workbench capabilities","description":"Authenticated, account-wide discovery readiness, not a live health probe.\n\nProject-bound keys receive 403 on this account-wide view. No\nprovider, database, subprocess, ticket or provisioning work is performed.\nInteractive execution remains unavailable regardless of environment flags.","operationId":"get_workbench_capabilities_v1_workbench_capabilities_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkbenchCapabilities"}}}}}}},"/v1/workbench/sessions/{session_id}/conversations/{conversation_id}":{"put":{"tags":["workbench"],"summary":"Link a session to a saved conversation without starting execution","description":"Account authority is required to claim a legacy session's immutable project.\n\nRepeating a link is idempotent. A session can link many chats in one project,\nnever rebind to another. No execution, ticket or context-access grant occurs.","operationId":"link_session_conversation_v1_workbench_sessions__session_id__conversations__conversation_id__put","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Session Id"}},{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Conversation Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkbenchContextInput"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkbenchSessionLink"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["workbench"],"summary":"Remove a conversation link without stopping or unbinding the session","description":"Idempotent after owner/project/chat checks; immutable project scope stays.","operationId":"unlink_session_conversation_v1_workbench_sessions__session_id__conversations__conversation_id__delete","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Session Id"}},{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Conversation Id"}},{"name":"project_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkbenchLinkRemoval"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/workbench/sessions":{"get":{"tags":["workbench"],"summary":"List owned project sessions and optionally unbound picker candidates","description":"Validate current project and optional saved chat even when the result is empty.\n\nBound keys cannot request unbound candidates. An unbound candidate means no\nhistorical scope exists, not merely no scope in the selected project.","operationId":"list_workbench_sessions_v1_workbench_sessions_get","parameters":[{"name":"project_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"}},{"name":"conversation_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Conversation Id"}},{"name":"include_unbound","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Unbound"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkbenchSessionLinks"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/cli-terminal/sessions/{session_id}/ticket":{"post":{"tags":["cli-terminal"],"summary":"Mint Terminal Ticket","description":"Mint the single-use upgrade ticket for a session the caller OWNS.","operationId":"mint_terminal_ticket_v1_cli_terminal_sessions__session_id__ticket_post","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__app__routers__v1__cli_terminal__AttachTicketResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/activation":{"get":{"tags":["admin"],"summary":"Get Activation","description":"Return the read-only activation funnel snapshot for the admin UI.","operationId":"get_activation_v1_admin_activation_get","parameters":[{"name":"lookback_days","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"default":30,"title":"Lookback Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/price-audit":{"get":{"tags":["admin"],"summary":"Get Price Audit","description":"Return the live price-drift snapshot between our catalog and OpenRouter.","operationId":"get_price_audit_v1_admin_price_audit_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Get Price Audit V1 Admin Price Audit Get"}}}}}}},"/v1/admin/moderation/reports":{"get":{"tags":["moderation"],"summary":"Get Report Queue","description":"Return the moderation report queue. Mod/admin gated.","operationId":"get_report_queue_v1_admin_moderation_reports_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","pattern":"^(pending|resolved|ignored)$","default":"pending","title":"Status"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response Get Report Queue V1 Admin Moderation Reports Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/moderation/comments/{comment_id}/remove":{"post":{"tags":["moderation"],"summary":"Mod Remove Comment","description":"Remove a comment (soft-delete + replace body). Mod/admin gated.","operationId":"mod_remove_comment_v1_admin_moderation_comments__comment_id__remove_post","parameters":[{"name":"comment_id","in":"path","required":true,"schema":{"type":"string","title":"Comment Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModeratorReasonBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Mod Remove Comment V1 Admin Moderation Comments  Comment Id  Remove Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/moderation/comments/{comment_id}/restore":{"post":{"tags":["moderation"],"summary":"Mod Restore Comment","description":"Restore a previously removed comment. Mod/admin gated.","operationId":"mod_restore_comment_v1_admin_moderation_comments__comment_id__restore_post","parameters":[{"name":"comment_id","in":"path","required":true,"schema":{"type":"string","title":"Comment Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModeratorReasonBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Mod Restore Comment V1 Admin Moderation Comments  Comment Id  Restore Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/moderation/reports/{report_id}/resolve":{"post":{"tags":["moderation"],"summary":"Mod Resolve Report","description":"Resolve or ignore a content report. Mod/admin gated.","operationId":"mod_resolve_report_v1_admin_moderation_reports__report_id__resolve_post","parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"string","title":"Report Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResolveReportBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Mod Resolve Report V1 Admin Moderation Reports  Report Id  Resolve Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/moderation/feed-items/{item_id}/remove":{"post":{"tags":["moderation"],"summary":"Mod Remove Feed Item","description":"Remove a feed item from the feed (soft-delete via deleted_at). Mod/admin gated.\n\nCovers news, blog, and benchmark rows that live in feed_items.\nWrites a mod_actions row with target_type='feed_item'.","operationId":"mod_remove_feed_item_v1_admin_moderation_feed_items__item_id__remove_post","parameters":[{"name":"item_id","in":"path","required":true,"schema":{"type":"string","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModeratorReasonBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Mod Remove Feed Item V1 Admin Moderation Feed Items  Item Id  Remove Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/moderation/feed-items/{item_id}/restore":{"post":{"tags":["moderation"],"summary":"Mod Restore Feed Item","description":"Restore a previously removed feed item (clears deleted_at). Mod/admin gated.\n\nWrites a mod_actions row with target_type='feed_item'.","operationId":"mod_restore_feed_item_v1_admin_moderation_feed_items__item_id__restore_post","parameters":[{"name":"item_id","in":"path","required":true,"schema":{"type":"string","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModeratorReasonBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Mod Restore Feed Item V1 Admin Moderation Feed Items  Item Id  Restore Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/moderation/users/{user_id}/grant-moderator":{"post":{"tags":["moderation"],"summary":"Admin Grant Moderator","description":"Grant moderator role to a user. ADMIN-ONLY (not plain moderator).","operationId":"admin_grant_moderator_v1_admin_moderation_users__user_id__grant_moderator_post","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantModeratorBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Admin Grant Moderator V1 Admin Moderation Users  User Id  Grant Moderator Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/moderation/users/{user_id}/revoke-moderator":{"post":{"tags":["moderation"],"summary":"Admin Revoke Moderator","description":"Revoke moderator role from a user. ADMIN-ONLY (not plain moderator).","operationId":"admin_revoke_moderator_v1_admin_moderation_users__user_id__revoke_moderator_post","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantModeratorBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Admin Revoke Moderator V1 Admin Moderation Users  User Id  Revoke Moderator Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/moderation/users/{user_id}/silence":{"post":{"tags":["moderation"],"summary":"Mod Silence User","description":"Silence a user (prevent posting comments, votes, and reports). Mod/admin gated.\n\n``duration_hours`` is optional; omit for an indefinite silence.\nWrites a ``mod_actions`` row with action_type ``'silence'``.","operationId":"mod_silence_user_v1_admin_moderation_users__user_id__silence_post","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SilenceUserBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Mod Silence User V1 Admin Moderation Users  User Id  Silence Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/moderation/users/{user_id}/unsilence":{"post":{"tags":["moderation"],"summary":"Mod Unsilence User","description":"Clear a user's silence (re-enable posting). Mod/admin gated.\n\nWrites a ``mod_actions`` row with action_type ``'unsilence'``.","operationId":"mod_unsilence_user_v1_admin_moderation_users__user_id__unsilence_post","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModeratorReasonBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Mod Unsilence User V1 Admin Moderation Users  User Id  Unsilence Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/test-keys":{"get":{"tags":["admin"],"summary":"List Test Keys","operationId":"list_test_keys_v1_admin_test_keys_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListTestKeysResponse"}}}}}},"post":{"tags":["admin"],"summary":"Create Test Key","description":"Mint a plan-stamped ``gc_`` API key attributed to the synthetic user.\n\nReturns the raw key exactly once.  Store it immediately — the server\nnever exposes it again.","operationId":"create_test_key_v1_admin_test_keys_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTestKeyRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTestKeyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/test-keys/{key_id}":{"delete":{"tags":["admin"],"summary":"Delete Test Key","operationId":"delete_test_key_v1_admin_test_keys__key_id__delete","parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"string","title":"Key Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/test-keys/{key_id}/usage":{"get":{"tags":["admin"],"summary":"Get Test Key Usage","operationId":"get_test_key_usage_v1_admin_test_keys__key_id__usage_get","parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"string","title":"Key Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestKeyUsageResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/mcp/reload":{"post":{"tags":["admin"],"summary":"Hot-reload the MCP tool catalog (F1)","description":"Performs a transactional copy-on-write swap of the live MCP tool catalog without a process restart.  Requires admin privileges.  Rate-limited to ≤1 reload per hour (R7).  Disabled unless MCP_RELOAD_ENABLED=1 (R10).","operationId":"post_mcp_reload_v1_admin_mcp_reload_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/McpReloadResponse"}}}}}}},"/v1/admin/users":{"get":{"tags":["admin"],"summary":"List Users","description":"List users, optionally filtered by ``status``.\n\nSorted newest-first. Includes a 30-day compression count for each\nuser so the admin dashboard can render the abuse-signal column\nwithout an N+1 client-side fetch.","operationId":"list_users_v1_admin_users_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"enum":["active","flagged","disabled"],"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListUsersResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/users/{clerk_id}/disable":{"post":{"tags":["admin"],"summary":"Disable User","operationId":"disable_user_v1_admin_users__clerk_id__disable_post","parameters":[{"name":"clerk_id","in":"path","required":true,"schema":{"type":"string","title":"Clerk Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusChangeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/users/{clerk_id}/flag":{"post":{"tags":["admin"],"summary":"Flag User","operationId":"flag_user_v1_admin_users__clerk_id__flag_post","parameters":[{"name":"clerk_id","in":"path","required":true,"schema":{"type":"string","title":"Clerk Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusChangeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/users/{clerk_id}/reactivate":{"post":{"tags":["admin"],"summary":"Reactivate User","operationId":"reactivate_user_v1_admin_users__clerk_id__reactivate_post","parameters":[{"name":"clerk_id","in":"path","required":true,"schema":{"type":"string","title":"Clerk Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusChangeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/users/v2":{"get":{"tags":["admin"],"summary":"List Users V2","description":"Paginated, searchable, filterable user list with kind classification.","operationId":"list_users_v2_v1_admin_users_v2_get","parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ILIKE search against email and clerk_id.","title":"Search"},"description":"ILIKE search against email and clerk_id."},{"name":"plan","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by plan (free/pro/team/enterprise).","title":"Plan"},"description":"Filter by plan (free/pro/team/enterprise)."},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by status (active/flagged/disabled).","title":"Status"},"description":"Filter by status (active/flagged/disabled)."},{"name":"kind","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by kind (real/test/internal).","title":"Kind"},"description":"Filter by kind (real/test/internal)."},{"name":"stage","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by funnel stage: signup (no keys, no events), keyed (has >=1 real key), activated (has >=1 usage event).","title":"Stage"},"description":"Filter by funnel stage: signup (no keys, no events), keyed (has >=1 real key), activated (has >=1 usage event)."},{"name":"sort","in":"query","required":false,"schema":{"type":"string","description":"Sort field: created_at | email | plan.","default":"created_at","title":"Sort"},"description":"Sort field: created_at | email | plan."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":25,"title":"Page Size"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminUserListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/users/v2/{user_id}":{"get":{"tags":["admin"],"summary":"Get User Detail","description":"Return full profile + operational context for one user.\n\nIncludes key counts, last-active timestamp, key roster, subscription\nstate, and recent admin-audit rows (2026-07-08 gap-audit build).","operationId":"get_user_detail_v1_admin_users_v2__user_id__get","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminUserDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["admin"],"summary":"Patch User","description":"Change a user's plan and/or status.\n\nRefuses (HTTP 403) if the target is a protected admin account\n(ADMIN_EMAILS or ADMIN_USER_IDS).","operationId":"patch_user_v1_admin_users_v2__user_id__patch","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatchUserBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminUserDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["admin"],"summary":"Delete User","description":"Permanently delete a user and cascade their api_keys + usage_events.\n\nProtected-account guard: refuses HTTP 403 on ADMIN_EMAILS /\nADMIN_USER_IDS targets.","operationId":"delete_user_v1_admin_users_v2__user_id__delete","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Delete User V1 Admin Users V2  User Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/users/v2/bulk-delete":{"post":{"tags":["admin"],"summary":"Bulk Delete Users","description":"Bulk-delete users by kind.\n\nPhase 1 only supports kind='test', which deletes all users whose\nemail ends with '@test.invalid'.  Any other value is rejected with\nHTTP 400 to bound blast radius.\n\nReturns the count of deleted users.","operationId":"bulk_delete_users_v1_admin_users_v2_bulk_delete_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkDeleteBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkDeleteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/audit-log":{"get":{"tags":["admin"],"summary":"List Admin Audit Log","description":"Paginated, filterable read of the append-only ``admin_audit_log`` table.\n\nNewest first. Admin-only (401 unauthenticated, 403 non-admin).","operationId":"list_admin_audit_log_v1_admin_audit_log_get","parameters":[{"name":"action","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by exact action label.","title":"Action"},"description":"Filter by exact action label."},{"name":"admin_user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by the acting admin's clerk_id.","title":"Admin User Id"},"description":"Filter by the acting admin's clerk_id."},{"name":"target_user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by the affected user's clerk_id.","title":"Target User Id"},"description":"Filter by the affected user's clerk_id."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminAuditLogListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/config-flags":{"get":{"tags":["admin"],"summary":"Get Admin Config Flags","description":"Read-only snapshot of the boot-time env switches that gate product behavior.","operationId":"get_admin_config_flags_v1_admin_config_flags_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminConfigFlagsResponse"}}}}}}},"/v1/admin/crm/deals":{"get":{"tags":["admin-crm"],"summary":"List Crm Deals","description":"List deals across pipeline stages.","operationId":"list_crm_deals_v1_admin_crm_deals_get","parameters":[{"name":"stage","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stage"}},{"name":"owner","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListCrmDealsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["admin-crm"],"summary":"Create Crm Deal","description":"Create a new deal or convert from an inbound lead.","operationId":"create_crm_deal_v1_admin_crm_deals_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDealBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmDealItem"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/crm/deals/{deal_id}":{"patch":{"tags":["admin-crm"],"summary":"Patch Crm Deal","description":"Update deal stage, value, or owner. Auto-logs stage changes.","operationId":"patch_crm_deal_v1_admin_crm_deals__deal_id__patch","parameters":[{"name":"deal_id","in":"path","required":true,"schema":{"type":"string","title":"Deal Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatchDealBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmDealItem"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/crm/deals/{deal_id}/activities":{"get":{"tags":["admin-crm"],"summary":"List Deal Activities","description":"Chronological activity history for a specific deal.","operationId":"list_deal_activities_v1_admin_crm_deals__deal_id__activities_get","parameters":[{"name":"deal_id","in":"path","required":true,"schema":{"type":"string","title":"Deal Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListActivitiesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["admin-crm"],"summary":"Create Deal Activity","description":"Log an activity note, call, or interaction against a deal.","operationId":"create_deal_activity_v1_admin_crm_deals__deal_id__activities_post","parameters":[{"name":"deal_id","in":"path","required":true,"schema":{"type":"string","title":"Deal Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateActivityBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmActivityItem"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/crm/pql/scan":{"post":{"tags":["admin-crm"],"summary":"Trigger Pql Scan","description":"Trigger an automated PQL ingestion sweep across platform users.","operationId":"trigger_pql_scan_v1_admin_crm_pql_scan_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TriggerPqlScanBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TriggerPqlScanResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/crm/accounts":{"get":{"tags":["admin-crm"],"summary":"List Crm Accounts","description":"List enterprise accounts with aggregated corporate metrics and health scores.","operationId":"list_crm_accounts_v1_admin_crm_accounts_get","parameters":[{"name":"tier","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tier"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListCrmAccountsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/crm/accounts/{account_id}":{"get":{"tags":["admin-crm"],"summary":"Get Crm Account","description":"Retrieve an enterprise account by ID.","operationId":"get_crm_account_v1_admin_crm_accounts__account_id__get","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"string","title":"Account Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmAccountItem"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/finops/overview":{"get":{"tags":["admin-finops"],"summary":"Get Finops Overview","description":"Platform-wide 30d unit economics & margin health.","operationId":"get_finops_overview_v1_admin_finops_overview_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FinOpsOverviewResponse"}}}}}}},"/v1/admin/finops/margins":{"get":{"tags":["admin-finops"],"summary":"Get Finops Margins","description":"Paginated account economics and margin breakdown.","operationId":"get_finops_margins_v1_admin_finops_margins_get","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":25,"title":"Page Size"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FinOpsMarginsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin/finops/margins/export":{"get":{"tags":["admin-finops"],"summary":"Export Finops Margins Csv","description":"Export 30-day unit economics and account margins as CSV.","operationId":"export_finops_margins_csv_v1_admin_finops_margins_export_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/admin/finops/runaway":{"get":{"tags":["admin-finops"],"summary":"Get Runaway Accounts","description":"List of active runaway or negative-margin accounts.","operationId":"get_runaway_accounts_v1_admin_finops_runaway_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunawayAccountsResponse"}}}}}}},"/v1/admin/finops/users/{user_id}/brake":{"post":{"tags":["admin-finops"],"summary":"Apply Runaway Brake","description":"Emergency brake: disable runaway user, revoke active API keys, write audit row, and invalidate caches.","operationId":"apply_runaway_brake_v1_admin_finops_users__user_id__brake_post","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunawayBrakeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/account/username":{"get":{"tags":["account"],"summary":"Get Username","description":"Return the current username for the authenticated user (null if unset).","operationId":"get_username_v1_account_username_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsernameResponse"}}}}}},"patch":{"tags":["account"],"summary":"Set Username","description":"Set or update the authenticated user's display username.\n\nConstraints:\n- 3–32 chars, alphanumeric + _ and -.\n- Case-insensitive unique across all users.\n- Reserved names blocked (with basic leetspeak fold).\n- Maximum one change per 30-day window (cooldown does not apply to first-time set\n  or to re-submitting the same username).","operationId":"set_username_v1_account_username_patch","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsernameRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsernameResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/account/export":{"get":{"tags":["account"],"summary":"Export Data","description":"Export all user data in a machine-readable format (GDPR Article 20).\n\nReturns a JSON document containing all data associated with the\nauthenticated user: usage events, API keys (masked), fidelity\nprofiles, and referral codes. No team data is included (that\nbelongs to the team, not the individual).","operationId":"export_data_v1_account_export_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataExportResponse"}}}}}}},"/v1/account":{"delete":{"tags":["account"],"summary":"Delete Account","description":"Delete the user's account data (GDPR Article 17 — right to erasure).\n\nErases account content and provider credentials, anonymizes the profile, and\ndisables access. Minimal user/project identities and immutable financial/audit\nrecords survive. Legacy KB object bytes need separate storage cleanup.\n\nThis action is irreversible.","operationId":"delete_account_v1_account_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/account/email-preferences":{"get":{"tags":["account"],"summary":"Get Email Preferences","description":"Return the current email opt-out preference for the authenticated user.\n\nA value of ``true`` means all marketing, digest, and alert emails are\nsuppressed. Transactional emails (license keys, auth) are never gated.","operationId":"get_email_preferences_v1_account_email_preferences_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailPreferencesResponse"}}}}}},"patch":{"tags":["account"],"summary":"Patch Email Preferences","description":"Update the email opt-out preference for the authenticated user.\n\nPass ``{\"email_opt_out\": true}`` to suppress marketing/digest/alert emails.\nPass ``{\"email_opt_out\": false}`` to re-enable them.","operationId":"patch_email_preferences_v1_account_email_preferences_patch","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailPreferencesPatch"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailPreferencesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/account/jev-preferences":{"get":{"tags":["account"],"summary":"Get Jev Preferences","operationId":"get_jev_preferences_v1_account_jev_preferences_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JevPreferencesResponse"}}}}}},"patch":{"tags":["account"],"summary":"Patch Jev Preferences","operationId":"patch_jev_preferences_v1_account_jev_preferences_patch","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JevPreferencesPatch"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JevPreferencesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/account/alert-webhook":{"get":{"tags":["account"],"summary":"Get Alert Webhook","description":"Return the configured Discord-compatible alert webhook URL.\n\nReturns ``{\"alert_webhook_url\": null}`` when no webhook is set.","operationId":"get_alert_webhook_v1_account_alert_webhook_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertWebhookResponse"}}}}}},"patch":{"tags":["account"],"summary":"Patch Alert Webhook","description":"Set or clear the Discord-compatible alert webhook URL.\n\nValidates the URL via ``services.discord_alerts.is_valid_discord_webhook_url``\nso callers can't write an arbitrary URL that would later be POSTed\nby the cron sweep.","operationId":"patch_alert_webhook_v1_account_alert_webhook_patch","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertWebhookPatch"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertWebhookResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/account/avatar":{"get":{"tags":["account"],"summary":"Get Avatar","description":"Return the current avatar shortcode for the authenticated user (null if unset).","operationId":"get_avatar_v1_account_avatar_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AvatarResponse"}}}}}},"patch":{"tags":["account"],"summary":"Set Avatar","description":"Set or reset the authenticated user's curated avatar.\n\nPass a shortcode from the allowlist (e.g. ``\"preset:fox\"``) to set a\ncurated avatar.  Pass ``null`` / ``None`` to reset to the auto-generated\nidenticon.  The identicon is computed client-side from the username — no\nserver-side data is stored for it.","operationId":"set_avatar_v1_account_avatar_patch","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AvatarRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AvatarResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/browser/device/code":{"post":{"tags":["browser-device"],"summary":"Create Code","operationId":"create_code_v1_browser_device_code_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceCodeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Create Code V1 Browser Device Code Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/browser/device/token":{"post":{"tags":["browser-device"],"summary":"Exchange Code","operationId":"exchange_code_v1_browser_device_token_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceTokenRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Exchange Code V1 Browser Device Token Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/browser/device/refresh":{"post":{"tags":["browser-device"],"summary":"Refresh","operationId":"refresh_v1_browser_device_refresh_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Refresh V1 Browser Device Refresh Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/browser/device/revoke":{"post":{"tags":["browser-device"],"summary":"Revoke","operationId":"revoke_v1_browser_device_revoke_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevokeRequest"}}},"required":true},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/browser/device/confirm":{"post":{"tags":["browser-device"],"summary":"Approve or deny a browser device","description":"Requires a verified Clerk session. The decision defaults to approve for compatibility. Approval binds the account and optional active organization; denial is terminal.","operationId":"confirm_v1_browser_device_confirm_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmResponse"}}}},"400":{"description":"Expired or already decided device code"},"401":{"description":"Missing or invalid verified Clerk identity"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/browser/device/release/{platform}/{architecture}":{"get":{"tags":["browser-device"],"summary":"Release Manifest","operationId":"release_manifest_v1_browser_device_release__platform___architecture__get","parameters":[{"name":"platform","in":"path","required":true,"schema":{"type":"string","title":"Platform"}},{"name":"architecture","in":"path","required":true,"schema":{"type":"string","title":"Architecture"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Release Manifest V1 Browser Device Release  Platform   Architecture  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/unsubscribe":{"get":{"tags":["unsubscribe"],"summary":"Unsubscribe","description":"Verify the token, opt the user out, and return an HTML confirmation page.","operationId":"unsubscribe_v1_unsubscribe_get","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string","description":"HMAC-signed unsubscribe token","title":"Token"},"description":"HMAC-signed unsubscribe token"}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/audit-logs":{"get":{"tags":["audit"],"summary":"List Audit Logs","description":"List audit log entries for the authenticated user's organization.\n\nEnterprise plan required. Returns paginated, filterable audit entries.","operationId":"list_audit_logs_v1_audit_logs_get","parameters":[{"name":"action","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by action","title":"Action"},"description":"Filter by action"},{"name":"actor_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by actor","title":"Actor Id"},"description":"Filter by actor"},{"name":"target_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by target type","title":"Target Type"},"description":"Filter by target type"},{"name":"from","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"From"}},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Since"}},{"name":"to","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"To"}},{"name":"until","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Until"}},{"name":"project_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Id"}},{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Q"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Page Size"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__app__routers__v1__audit_logs__AuditLogResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/audit-logs/export":{"get":{"tags":["audit"],"summary":"Export Audit Logs Ndjson","description":"Stream all matching audit log entries as NDJSON (one JSON object per line).\n\nDesigned for bulk export to customer SIEMs. No pagination — the response is a\nstreaming generator that yields rows as they are read from the database.\nEnterprise plan required.","operationId":"export_audit_logs_ndjson_v1_audit_logs_export_get","parameters":[{"name":"action","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by action","title":"Action"},"description":"Filter by action"},{"name":"actor_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by actor","title":"Actor Id"},"description":"Filter by actor"},{"name":"target_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by target type","title":"Target Type"},"description":"Filter by target type"},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO 8601 lower-bound timestamp (inclusive)","title":"Since"},"description":"ISO 8601 lower-bound timestamp (inclusive)"},{"name":"until","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO 8601 upper-bound timestamp (inclusive)","title":"Until"},"description":"ISO 8601 upper-bound timestamp (inclusive)"}],"responses":{"200":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/audit-logs/export.csv":{"get":{"tags":["audit"],"summary":"Export Audit Logs Csv","description":"Stream all matching audit log entries as CSV.\n\nFirst row is a header. Designed for bulk export to customer SIEMs / spreadsheets.\nEnterprise plan required.","operationId":"export_audit_logs_csv_v1_audit_logs_export_csv_get","parameters":[{"name":"action","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by action","title":"Action"},"description":"Filter by action"},{"name":"actor_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by actor","title":"Actor Id"},"description":"Filter by actor"},{"name":"target_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by target type","title":"Target Type"},"description":"Filter by target type"},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO 8601 lower-bound timestamp (inclusive)","title":"Since"},"description":"ISO 8601 lower-bound timestamp (inclusive)"},{"name":"until","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO 8601 upper-bound timestamp (inclusive)","title":"Until"},"description":"ISO 8601 upper-bound timestamp (inclusive)"}],"responses":{"200":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/incidents":{"get":{"tags":["incidents"],"summary":"List Incidents","description":"Cluster non-success ``usage_events`` rows into hourly buckets per status.\n\nReturns clusters where ``count >= min_count`` over the trailing\n``lookback_hours`` window. Only the caller's own events are scoped\n(no cross-tenant leak).","operationId":"list_incidents_v1_incidents_get","parameters":[{"name":"lookback_hours","in":"query","required":false,"schema":{"type":"integer","maximum":168,"minimum":1,"default":24,"title":"Lookback Hours"}},{"name":"min_count","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":5,"title":"Min Count"}},{"name":"from","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"From"}},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Since"}},{"name":"to","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"To"}},{"name":"until","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Until"}},{"name":"project_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Id"}},{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Q"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IncidentsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/saved-views":{"get":{"tags":["saved-views"],"summary":"List Saved Views","description":"List every saved view for the authenticated user, newest first.","operationId":"list_saved_views_v1_saved_views_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListSavedViewsResponse"}}}}}},"post":{"tags":["saved-views"],"summary":"Create Saved View","description":"Create or overwrite (by name) a saved view.\n\nSame name → same row updated in place; this is the intended UX so\n\"Save view\" with an existing name doesn't raise 409 — it just\nre-saves the latest filters.","operationId":"create_saved_view_v1_saved_views_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSavedViewRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedView"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/saved-views/{view_id}":{"delete":{"tags":["saved-views"],"summary":"Delete Saved View","description":"Delete a saved view by id. 404 if not found OR if cross-tenant.","operationId":"delete_saved_view_v1_saved_views__view_id__delete","parameters":[{"name":"view_id","in":"path","required":true,"schema":{"type":"string","title":"View Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/prompts":{"get":{"tags":["prompts"],"summary":"List Prompts","description":"List every saved prompt for the authenticated user, newest first.","operationId":"list_prompts_v1_prompts_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListPromptsResponse"}}}}}},"post":{"tags":["prompts"],"summary":"Create Prompt","description":"Create a new saved prompt, capped at ``_MAX_PROMPTS_PER_USER`` per user.","operationId":"create_prompt_v1_prompts_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePromptRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Prompt"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/prompts/{prompt_id}":{"put":{"tags":["prompts"],"summary":"Update Prompt","description":"Update title/body of an existing prompt. 404 if not found OR cross-tenant.","operationId":"update_prompt_v1_prompts__prompt_id__put","parameters":[{"name":"prompt_id","in":"path","required":true,"schema":{"type":"string","title":"Prompt Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePromptRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Prompt"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["prompts"],"summary":"Delete Prompt","description":"Delete a saved prompt by id. 404 if not found OR if cross-tenant.","operationId":"delete_prompt_v1_prompts__prompt_id__delete","parameters":[{"name":"prompt_id","in":"path","required":true,"schema":{"type":"string","title":"Prompt Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/favorites":{"get":{"tags":["favorites"],"summary":"List Favorites","description":"List every favorite for the authenticated user, newest first.","operationId":"list_favorites_v1_favorites_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListFavoritesResponse"}}}}}},"post":{"tags":["favorites"],"summary":"Set Favorite","description":"Star (``favorited=true``) or unstar (``favorited=false``) a target.\n\nBoth directions are idempotent. Starring an existing target refreshes its\ndenormalized ``label``. Scoped to the resolved caller UUID.","operationId":"set_favorite_v1_favorites_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetFavoriteRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetFavoriteResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/mcp/tools":{"get":{"tags":["mcp"],"summary":"List Mcp Tools","description":"List all available MCP tools with categories and plan-gating info.\n\nReturns a list of every tool known to the MCP gateway, annotated with:\n- ``category``: derived from the tool name prefix\n- ``available``: whether the caller's current plan can invoke the tool\n\nNo authentication is strictly required (unauthenticated callers see the\nfull catalogue with ``available`` computed against the ``free`` plan).","operationId":"list_mcp_tools_v1_mcp_tools_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/McpToolsResponse"}}}}}}},"/v1/mcp/prime":{"get":{"tags":["mcp"],"summary":"Live plan-gated MCP tool list (Markdown) for plugin SessionStart","description":"Return a Markdown summary of every MCP tool available on the caller's plan.","operationId":"prime_session_v1_mcp_prime_get","parameters":[{"name":"plan","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Override the caller's auth plan. One of: free, pro, team, enterprise.","title":"Plan"},"description":"Override the caller's auth plan. One of: free, pro, team, enterprise."}],"responses":{"200":{"description":"Successful Response","content":{"text/plain":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/models":{"get":{"tags":["models"],"summary":"List Models","description":"Enumerate supported LLM models, their per-1k prices, and whether THIS\naccount can call them right now.\n\n`callable` exists because the pricing catalogue and the set of models we can\nreach are DIFFERENT SETS, and conflating them has already shipped a bug here.\n`list_supported_models()` enumerates everything we can attribute cost for;\n`SUPPORTED_PROVIDERS` (`provider_credentials.py`) is the platform-wide ceiling\n`normalize_provider` will accept before a wire shape is chosen. That ceiling is\nnecessary but not sufficient: a provider in `SUPPORTED_PROVIDERS` still needs a\nper-account credential (`provider_credential_store.resolve_secret` — \"NO\nHOUSE-KEY FALLBACK\"), so `callable` is now `provider in SUPPORTED_PROVIDERS AND\nprovider in {providers this caller has a live credential for}`. Piping either\nthe platform ceiling alone, or the raw pricing catalogue, into a model picker\noffers choices that fail on use — the exact failure `dashboard/chat/page.tsx`\nrecords against a previous Gemini entry: \"harmless only while the shell called\nnothing, and a user-visible failure the moment POST /v1/chat/completions\nlanded.\"\n\nThe flag is computed HERE rather than in the picker so a second client — the\nCLI, the MCP surface, a customer's own UI — does not have to re-derive it from\na constant (or a private table) it cannot see.","operationId":"list_models_v1_models_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelListResponse"}}}}}}},"/v1/demo/compress":{"post":{"tags":["demo"],"summary":"Demo Compress","description":"Compress text anonymously — for the public playground.\n\nRate-limited per IP via Redis. No auth required. Returns the compression\nresult with savings statistics.","operationId":"demo_compress_v1_demo_compress_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DemoCompressRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DemoCompressResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/demo/chat-preview":{"post":{"tags":["demo"],"summary":"Demo Chat Preview","description":"Price a chat request against a real compression, without sending it.","operationId":"demo_chat_preview_v1_demo_chat_preview_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DemoChatPreviewRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DemoChatPreviewResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/":{"get":{"summary":"Root","description":"Root endpoint — API info and discovery links.","operationId":"root__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"A2APeerPatchRequest":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"null"}],"title":"Name"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"public_key_jws":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Public Key Jws"}},"type":"object","title":"A2APeerPatchRequest"},"A2APeerRequest":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"},"base_url":{"type":"string","maxLength":1024,"minLength":8,"title":"Base Url"},"public_key_jws":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Public Key Jws"}},"type":"object","required":["name","base_url"],"title":"A2APeerRequest"},"A2APeerResponse":{"properties":{"id":{"type":"string","title":"Id"},"user_id":{"type":"string","title":"User Id"},"name":{"type":"string","title":"Name"},"base_url":{"type":"string","title":"Base Url"},"status":{"type":"string","title":"Status"},"public_key_jws":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Public Key Jws"},"last_synced_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Synced At"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","user_id","name","base_url","status","created_at","updated_at"],"title":"A2APeerResponse"},"AcceptTeamInviteResponse":{"properties":{"team":{"$ref":"#/components/schemas/TeamResponse"},"membership":{"$ref":"#/components/schemas/TeamMembershipResponse"}},"type":"object","required":["team","membership"],"title":"AcceptTeamInviteResponse","description":"Result of accepting a pending team invite."},"AccountMarginItem":{"properties":{"user_id":{"type":"string","title":"User Id"},"email":{"type":"string","title":"Email"},"plan":{"type":"string","title":"Plan"},"status":{"type":"string","title":"Status"},"estimated_revenue_30d_usd":{"type":"number","title":"Estimated Revenue 30D Usd"},"platform_cogs_30d_usd":{"type":"number","title":"Platform Cogs 30D Usd"},"customer_savings_delivered_30d_usd":{"type":"number","title":"Customer Savings Delivered 30D Usd"},"gross_margin_usd":{"type":"number","title":"Gross Margin Usd"},"gross_margin_percent":{"type":"number","title":"Gross Margin Percent"},"is_runaway":{"type":"boolean","title":"Is Runaway"}},"type":"object","required":["user_id","email","plan","status","estimated_revenue_30d_usd","platform_cogs_30d_usd","customer_savings_delivered_30d_usd","gross_margin_usd","gross_margin_percent","is_runaway"],"title":"AccountMarginItem"},"ActivityEntryOut":{"properties":{"id":{"type":"string","title":"Id"},"tool_name":{"type":"string","title":"Tool Name"},"user_id":{"type":"string","title":"User Id"},"key_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Key Id"},"item_ids":{"items":{"type":"string"},"type":"array","title":"Item Ids"},"latency_ms":{"type":"integer","title":"Latency Ms"},"status":{"type":"string","title":"Status"},"error_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Code"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","tool_name","user_id","item_ids","latency_ms","status","created_at"],"title":"ActivityEntryOut"},"ActivityItem":{"properties":{"id":{"type":"string","title":"Id"},"item_type":{"type":"string","enum":["own_comment","notification"],"title":"Item Type"},"comment_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Comment Id"},"comment_body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Comment Body"},"feed_item_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Feed Item Id"},"feed_item_title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Feed Item Title"},"feed_item_slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Feed Item Slug"},"notification_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notification Type"},"notification_body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notification Body"},"actor_username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor Username"},"target_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target Type"},"target_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target Id"},"is_read":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Read"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","item_type","created_at"],"title":"ActivityItem","description":"One row in the unified activity timeline."},"ActivityPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ActivityItem"},"type":"array","title":"Items"},"unread_count":{"type":"integer","title":"Unread Count"}},"type":"object","required":["items","unread_count"],"title":"ActivityPage"},"ActivityResponse":{"properties":{"entries":{"items":{"$ref":"#/components/schemas/ActivityEntryOut"},"type":"array","title":"Entries"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["entries"],"title":"ActivityResponse"},"AddMembershipsRequest":{"properties":{"project_ids":{"items":{"type":"string"},"type":"array","maxItems":50,"minItems":1,"title":"Project Ids","description":"Member project UUIDs to add (max 50 per call)."}},"type":"object","required":["project_ids"],"title":"AddMembershipsRequest"},"AddMembershipsResponse":{"properties":{"added":{"items":{"type":"string"},"type":"array","title":"Added"},"skipped":{"items":{"type":"string"},"type":"array","title":"Skipped"}},"type":"object","required":["added","skipped"],"title":"AddMembershipsResponse"},"AdminAuditLogListResponse":{"properties":{"rows":{"items":{"$ref":"#/components/schemas/AdminAuditLogRow"},"type":"array","title":"Rows"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["rows","total","limit","offset"],"title":"AdminAuditLogListResponse"},"AdminAuditLogRow":{"properties":{"id":{"type":"string","title":"Id"},"admin_user_id":{"type":"string","title":"Admin User Id"},"action":{"type":"string","title":"Action"},"target_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target User Id"},"detail":{"additionalProperties":true,"type":"object","title":"Detail"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","admin_user_id","action","target_user_id","detail","created_at"],"title":"AdminAuditLogRow"},"AdminConfigFlagsResponse":{"properties":{"flags":{"items":{"$ref":"#/components/schemas/ConfigFlag"},"type":"array","title":"Flags"}},"type":"object","required":["flags"],"title":"AdminConfigFlagsResponse"},"AdminUserAuditRow":{"properties":{"id":{"type":"string","title":"Id"},"action":{"type":"string","title":"Action"},"admin_user_id":{"type":"string","title":"Admin User Id"},"detail":{"additionalProperties":true,"type":"object","title":"Detail"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","action","admin_user_id","detail","created_at"],"title":"AdminUserAuditRow","description":"One admin_audit_log row where this user was the target."},"AdminUserDetail":{"properties":{"id":{"type":"string","title":"Id"},"clerk_id":{"type":"string","title":"Clerk Id"},"email":{"type":"string","title":"Email"},"plan":{"type":"string","title":"Plan"},"status":{"type":"string","title":"Status"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"kind":{"type":"string","enum":["real","test","internal"],"title":"Kind"},"real_key_count":{"type":"integer","title":"Real Key Count"},"test_key_count":{"type":"integer","title":"Test Key Count"},"usage_event_count":{"type":"integer","title":"Usage Event Count"},"email_opt_out":{"type":"boolean","title":"Email Opt Out"},"last_active":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Active"},"keys":{"items":{"$ref":"#/components/schemas/AdminUserKeySummary"},"type":"array","title":"Keys"},"subscription":{"anyOf":[{"$ref":"#/components/schemas/AdminUserSubscriptionSummary"},{"type":"null"}]},"recent_audit":{"items":{"$ref":"#/components/schemas/AdminUserAuditRow"},"type":"array","title":"Recent Audit"}},"type":"object","required":["id","clerk_id","email","plan","status","created_at","kind","real_key_count","test_key_count","usage_event_count","email_opt_out","last_active","keys","subscription","recent_audit"],"title":"AdminUserDetail"},"AdminUserItem":{"properties":{"clerk_id":{"type":"string","title":"Clerk Id"},"email":{"type":"string","title":"Email"},"plan":{"type":"string","title":"Plan"},"status":{"type":"string","title":"Status"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"compressions_30d":{"type":"integer","title":"Compressions 30D","description":"Compressions in last 30 days (anomaly signal)."},"age_hours":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Age Hours","description":"Hours since signup. <24h + over-quota = abuse signal."}},"type":"object","required":["clerk_id","email","plan","status","created_at","compressions_30d","age_hours"],"title":"AdminUserItem"},"AdminUserKeySummary":{"properties":{"key_id":{"type":"string","title":"Key Id"},"name":{"type":"string","title":"Name"},"status":{"type":"string","title":"Status"},"is_test_key":{"type":"boolean","title":"Is Test Key"},"project_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Id"},"project_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Name"},"last_used":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Used"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"}},"type":"object","required":["key_id","name","status","is_test_key","project_id","project_name","last_used","created_at"],"title":"AdminUserKeySummary","description":"Operational key context for the user-detail drawer — no secret material.\n\nOnly the key_id (16-hex identifier, not the raw ``gc_`` secret), name, and\nstatus are exposed; ``key_hash`` / ``masked_key`` are intentionally\nomitted — the drawer doesn't need to identify individual raw keys."},"AdminUserListResponse":{"properties":{"users":{"items":{"$ref":"#/components/schemas/AdminUserRow"},"type":"array","title":"Users"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"}},"type":"object","required":["users","total","page","page_size"],"title":"AdminUserListResponse"},"AdminUserRow":{"properties":{"id":{"type":"string","title":"Id"},"clerk_id":{"type":"string","title":"Clerk Id"},"email":{"type":"string","title":"Email"},"plan":{"type":"string","title":"Plan"},"status":{"type":"string","title":"Status"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"kind":{"type":"string","enum":["real","test","internal"],"title":"Kind"},"real_key_count":{"type":"integer","title":"Real Key Count"},"activated":{"type":"boolean","title":"Activated"}},"type":"object","required":["id","clerk_id","email","plan","status","created_at","kind","real_key_count","activated"],"title":"AdminUserRow","description":"Single row in the paginated user list."},"AdminUserSubscriptionSummary":{"properties":{"plan":{"type":"string","title":"Plan"},"status":{"type":"string","title":"Status"},"current_period_end":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Period End"},"trial_ends_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Trial Ends At"},"last_event_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Event At"}},"type":"object","required":["plan","status","current_period_end","trial_ends_at","last_event_at"],"title":"AdminUserSubscriptionSummary","description":"Most-recent billing subscription row for the user (Polar-synced)."},"AlertWebhookPatch":{"properties":{"alert_webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Alert Webhook Url"}},"type":"object","required":["alert_webhook_url"],"title":"AlertWebhookPatch","description":"Payload for PATCH /v1/account/alert-webhook.\n\nPass ``null`` to clear the configured URL. Validated server-side\nvia ``services.discord_alerts.is_valid_discord_webhook_url`` so a\nstolen Clerk session can't repurpose this field as a generic SSRF\nprimitive."},"AlertWebhookResponse":{"properties":{"alert_webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Alert Webhook Url"}},"type":"object","required":["alert_webhook_url"],"title":"AlertWebhookResponse","description":"Discord-compatible webhook URL for per-key quota alerts (v1.20.2)."},"AlignedTierSummary":{"properties":{"tier":{"type":"string","title":"Tier"},"raw_tokens":{"type":"integer","title":"Raw Tokens"},"padded_tokens":{"type":"integer","title":"Padded Tokens"},"padding_tokens":{"type":"integer","title":"Padding Tokens"},"is_cache_boundary":{"type":"boolean","title":"Is Cache Boundary"}},"type":"object","required":["tier","raw_tokens","padded_tokens","padding_tokens","is_cache_boundary"],"title":"AlignedTierSummary"},"AppendMessageIn":{"properties":{"role":{"type":"string","enum":["user","assistant"],"title":"Role"},"content":{"type":"string","maxLength":1000000,"title":"Content"},"parent_id":{"anyOf":[{"type":"string","maxLength":36},{"type":"null"}],"title":"Parent Id"},"root":{"type":"boolean","title":"Root","default":false},"reasoning":{"anyOf":[{"type":"string","maxLength":2097152},{"type":"null"}],"title":"Reasoning"},"provider":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Provider"},"model":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Model"},"tokens_in":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Tokens In"},"tokens_out":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Tokens Out"},"research":{"anyOf":[{"$ref":"#/components/schemas/ResearchReceipt"},{"type":"null"}]}},"additionalProperties":false,"type":"object","required":["role","content"],"title":"AppendMessageIn","description":"One turn to record.\n\nContent is the CLIENT's, and that is a deliberate scope decision rather\nthan an oversight: this route records a transcript, it does not produce\none. Public writes accept user and assistant transcript roles. Older system/tool\nrecords remain readable but are fenced as untrusted data on provider replay."},"ApprovalDecisionRequest":{"properties":{"decision":{"type":"string","enum":["approved","rejected","requested_changes"],"title":"Decision"},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Notes"}},"type":"object","required":["decision"],"title":"ApprovalDecisionRequest"},"ApprovalResponse":{"properties":{"id":{"type":"string","title":"Id"},"item_id":{"type":"string","title":"Item Id"},"project_id":{"type":"string","title":"Project Id"},"reviewer_user_id":{"type":"string","title":"Reviewer User Id"},"decision":{"type":"string","title":"Decision"},"decided_at":{"type":"string","title":"Decided At"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"}},"type":"object","required":["id","item_id","project_id","reviewer_user_id","decision","decided_at"],"title":"ApprovalResponse"},"ApprovalsListResponse":{"properties":{"approvals":{"items":{"$ref":"#/components/schemas/ApprovalResponse"},"type":"array","title":"Approvals"}},"type":"object","required":["approvals"],"title":"ApprovalsListResponse"},"ApproveResponse":{"properties":{"article_id":{"type":"string","title":"Article Id"},"slug":{"type":"string","title":"Slug"},"published_at":{"type":"string","title":"Published At"}},"type":"object","required":["article_id","slug","published_at"],"title":"ApproveResponse"},"AssistantCreateRequest":{"properties":{"name":{"type":"string","maxLength":120,"title":"Name"},"provider":{"type":"string","title":"Provider"},"model":{"type":"string","title":"Model"},"system_prompt":{"type":"string","maxLength":32000,"title":"System Prompt"},"project_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"}},"type":"object","required":["name","provider","model","system_prompt"],"title":"AssistantCreateRequest"},"AssistantListItem":{"properties":{"assistant_id":{"type":"string","format":"uuid","title":"Assistant Id"},"name":{"type":"string","title":"Name"},"project_id":{"type":"string","format":"uuid","title":"Project Id"},"provider":{"type":"string","title":"Provider"},"model":{"type":"string","title":"Model"},"version_no":{"type":"integer","title":"Version No"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["assistant_id","name","project_id","provider","model","version_no","created_at","updated_at"],"title":"AssistantListItem"},"AssistantVersionRequest":{"properties":{"provider":{"type":"string","title":"Provider"},"model":{"type":"string","title":"Model"},"system_prompt":{"type":"string","maxLength":32000,"title":"System Prompt"}},"type":"object","required":["provider","model","system_prompt"],"title":"AssistantVersionRequest"},"AssistantVersionResponse":{"properties":{"assistant_id":{"type":"string","format":"uuid","title":"Assistant Id"},"version_id":{"type":"string","format":"uuid","title":"Version Id"},"version_no":{"type":"integer","title":"Version No"},"provider":{"type":"string","title":"Provider"},"model":{"type":"string","title":"Model"}},"type":"object","required":["assistant_id","version_id","version_no","provider","model"],"title":"AssistantVersionResponse"},"AttentionItem":{"properties":{"kind":{"type":"string","title":"Kind"},"severity":{"type":"string","title":"Severity"},"title":{"type":"string","title":"Title"},"detail":{"type":"string","title":"Detail"},"action_url":{"type":"string","title":"Action Url"},"count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Count"}},"type":"object","required":["kind","severity","title","detail","action_url"],"title":"AttentionItem","description":"One \"needs your attention\" row for the dashboard Home priority queue."},"AttentionResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AttentionItem"},"type":"array","title":"Items"},"generated_at":{"type":"string","title":"Generated At"},"partial":{"type":"boolean","title":"Partial","default":false},"degraded":{"items":{"type":"string"},"type":"array","title":"Degraded"}},"type":"object","required":["items","generated_at"],"title":"AttentionResponse"},"AuditCacheRequest":{"properties":{"text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Text","description":"Prompt or document text to audit."},"sections":{"anyOf":[{"items":{"$ref":"#/components/schemas/AuditSection"},"type":"array"},{"type":"null"}],"title":"Sections","description":"Structured prompt sections (tool_definitions, system_instructions, rag_context, few_shot_examples, chat_history, metadata, user_query). If omitted, the flat ``text`` is wrapped as a single system_instructions section."},"provider":{"type":"string","title":"Provider","description":"AI provider: anthropic, openai, google","default":"anthropic"}},"type":"object","title":"AuditCacheRequest","description":"Accepts either a flat ``text`` (wrapped as ``system_instructions``) or\na structured ``sections`` list matching the tool's canonical schema."},"AuditCacheResponse":{"properties":{"provider":{"type":"string","title":"Provider"},"cache_friendly":{"type":"boolean","title":"Cache Friendly"},"score":{"type":"number","title":"Score","description":"Cacheability score 0.0-1.0"},"recommendations":{"items":{"type":"string"},"type":"array","title":"Recommendations"},"estimated_savings_pct":{"type":"number","title":"Estimated Savings Pct","description":"Estimated cache hit savings"}},"type":"object","required":["provider","cache_friendly","score","recommendations","estimated_savings_pct"],"title":"AuditCacheResponse"},"AuditEventResponse":{"properties":{"id":{"type":"string","title":"Id"},"event_type":{"type":"string","title":"Event Type"},"project_id":{"type":"string","title":"Project Id"},"item_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Item Id"},"actor":{"type":"string","title":"Actor"},"payload":{"additionalProperties":true,"type":"object","title":"Payload"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","event_type","project_id","actor","payload","created_at"],"title":"AuditEventResponse"},"AuditLogEntry":{"properties":{"id":{"type":"string","title":"Id"},"timestamp":{"type":"string","title":"Timestamp"},"actor_id":{"type":"string","title":"Actor Id"},"actor_type":{"type":"string","title":"Actor Type"},"action":{"type":"string","title":"Action"},"target_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target Type"},"target_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target Id"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"},"ip_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ip Address"}},"type":"object","required":["id","timestamp","actor_id","actor_type","action","target_type","target_id","metadata","ip_address"],"title":"AuditLogEntry","description":"Single audit log entry."},"AuditSection":{"properties":{"name":{"type":"string","title":"Name"},"content":{"type":"string","title":"Content"}},"type":"object","required":["name","content"],"title":"AuditSection"},"AvatarRequest":{"properties":{"avatar":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar"}},"type":"object","required":["avatar"],"title":"AvatarRequest","description":"Payload for PATCH /v1/account/avatar.\n\n``avatar`` must be one of the curated shortcodes in ``AVATAR_ALLOWLIST``,\nor ``None`` to reset to the auto-generated identicon."},"AvatarResponse":{"properties":{"avatar":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar"}},"type":"object","required":["avatar"],"title":"AvatarResponse","description":"Response for GET and PATCH /v1/account/avatar."},"BatchDocument":{"properties":{"text":{"type":"string","minLength":1,"title":"Text","description":"Text to compress"},"fidelity":{"type":"string","title":"Fidelity","description":"Compression level: abstract, outline, balanced, detailed, raw","default":"balanced"},"query":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Query","description":"Optional query for query-guided compression of this document"}},"type":"object","required":["text"],"title":"BatchDocument","description":"A single document in a batch compression request."},"BatchItemIngestRequest":{"properties":{"items":{"items":{"$ref":"#/components/schemas/SingleItemIngestRequest"},"type":"array","maxItems":100,"minItems":1,"title":"Items","description":"Up to 100 items per batch"}},"type":"object","required":["items"],"title":"BatchItemIngestRequest"},"BatchQueueCreatedResponse":{"properties":{"job_id":{"type":"string","format":"uuid","title":"Job Id"},"status":{"type":"string","title":"Status"},"items_total":{"type":"integer","title":"Items Total"}},"type":"object","required":["job_id","status","items_total"],"title":"BatchQueueCreatedResponse","description":"Response after a batch queue job is accepted."},"BatchQueueItemIn":{"properties":{"text":{"type":"string","minLength":1,"title":"Text","description":"Text to compress"}},"type":"object","required":["text"],"title":"BatchQueueItemIn","description":"A single document to enqueue for compression."},"BatchQueueItemResult":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"status":{"type":"string","title":"Status"},"input_text":{"type":"string","title":"Input Text"},"compressed":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Compressed"},"tokens_in":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tokens In"},"tokens_out":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tokens Out"},"tokens_saved":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tokens Saved"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["id","status","input_text"],"title":"BatchQueueItemResult","description":"Result for a single item in a batch job."},"BatchQueueJobResponse":{"properties":{"job_id":{"type":"string","format":"uuid","title":"Job Id"},"status":{"type":"string","title":"Status"},"fidelity":{"type":"string","title":"Fidelity"},"items_total":{"type":"integer","title":"Items Total"},"items_completed":{"type":"integer","title":"Items Completed"},"progress_pct":{"type":"number","title":"Progress Pct"},"project_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["job_id","status","fidelity","items_total","items_completed","progress_pct","created_at"],"title":"BatchQueueJobResponse","description":"Status snapshot of a batch queue job."},"BatchQueueListResponse":{"properties":{"jobs":{"items":{"$ref":"#/components/schemas/BatchQueueJobResponse"},"type":"array","title":"Jobs"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["jobs","page","page_size","total"],"title":"BatchQueueListResponse","description":"Paginated list of batch queue jobs."},"BatchQueueRequest":{"properties":{"items":{"items":{"$ref":"#/components/schemas/BatchQueueItemIn"},"type":"array","title":"Items","description":"List of documents to compress. Maximum 200 per job."},"fidelity":{"type":"string","title":"Fidelity","description":"Compression level: abstract, outline, balanced, detailed, raw","default":"balanced"},"project_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id","description":"Optional project ID to associate the batch with."}},"type":"object","required":["items"],"title":"BatchQueueRequest","description":"Request body for creating a batch queue job."},"BatchQueueResultsResponse":{"properties":{"job_id":{"type":"string","format":"uuid","title":"Job Id"},"status":{"type":"string","title":"Status"},"items":{"items":{"$ref":"#/components/schemas/BatchQueueItemResult"},"type":"array","title":"Items"}},"type":"object","required":["job_id","status","items"],"title":"BatchQueueResultsResponse","description":"All items and their results for a batch job."},"BatchRequest":{"properties":{"documents":{"items":{"$ref":"#/components/schemas/BatchDocument"},"type":"array","title":"Documents","description":"List of documents to compress. Maximum 50 per call."}},"type":"object","required":["documents"],"title":"BatchRequest","description":"Request body for batch compression."},"BatchResponse":{"properties":{"results":{"items":{"$ref":"#/components/schemas/BatchResultItem"},"type":"array","title":"Results"},"summary":{"$ref":"#/components/schemas/BatchSummary"}},"type":"object","required":["results","summary"],"title":"BatchResponse","description":"Response from batch compression."},"BatchResultItem":{"properties":{"compressed":{"type":"string","title":"Compressed"},"original_tokens":{"type":"integer","title":"Original Tokens"},"compressed_tokens":{"type":"integer","title":"Compressed Tokens"},"savings_pct":{"type":"number","title":"Savings Pct"},"compression_ratio":{"type":"number","title":"Compression Ratio"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["compressed","original_tokens","compressed_tokens","savings_pct","compression_ratio"],"title":"BatchResultItem","description":"Compression result for one document in the batch."},"BatchSummary":{"properties":{"total_documents":{"type":"integer","title":"Total Documents"},"successful":{"type":"integer","title":"Successful"},"failed":{"type":"integer","title":"Failed"},"total_tokens_in":{"type":"integer","title":"Total Tokens In"},"total_tokens_saved":{"type":"integer","title":"Total Tokens Saved"},"avg_savings_pct":{"type":"number","title":"Avg Savings Pct"},"avg_compression_ratio":{"type":"number","title":"Avg Compression Ratio"}},"type":"object","required":["total_documents","successful","failed","total_tokens_in","total_tokens_saved","avg_savings_pct","avg_compression_ratio"],"title":"BatchSummary","description":"Aggregate statistics across the entire batch."},"BenchmarkRunCreateRequest":{"properties":{"model_text":{"type":"string","maxLength":200,"title":"Model Text","description":"Model ID, e.g. 'meta-llama/Llama-3.3-70B-Instruct'"},"model_quant_text":{"type":"string","maxLength":80,"title":"Model Quant Text","description":"Quantization, e.g. 'Q4_K_M' or 'FP16'"},"hardware_text":{"type":"string","maxLength":200,"title":"Hardware Text","description":"Hardware description, e.g. 'RTX 5090 32GB'"},"context_length":{"type":"integer","exclusiveMinimum":0.0,"title":"Context Length","description":"Context window length in tokens"},"batch_size":{"type":"integer","exclusiveMinimum":0.0,"title":"Batch Size","description":"Batch size used during inference"},"tokens_per_sec_output":{"type":"number","exclusiveMinimum":0.0,"title":"Tokens Per Sec Output","description":"Output tokens per second"},"hardware_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Hardware Id","description":"Existing hardware SKU UUID (preferred over free-text)"},"ttft_ms":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"null"}],"title":"Ttft Ms","description":"Time to first token in milliseconds"},"tokens_per_sec_input":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"null"}],"title":"Tokens Per Sec Input"},"p50_latency_ms":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"null"}],"title":"P50 Latency Ms"},"p95_latency_ms":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"null"}],"title":"P95 Latency Ms"},"p99_latency_ms":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"null"}],"title":"P99 Latency Ms"},"vram_peak_mb":{"anyOf":[{"type":"integer","exclusiveMinimum":0.0},{"type":"null"}],"title":"Vram Peak Mb"},"perplexity":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"null"}],"title":"Perplexity"},"eval_scores":{"anyOf":[{"additionalProperties":{"type":"number"},"type":"object"},{"type":"null"}],"title":"Eval Scores","description":"e.g. {\"mmlu\": 0.62, \"humaneval\": 0.45}"},"software_stack":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Software Stack","description":"e.g. {\"framework\": \"llama.cpp\", \"version\": \"b3000\", \"cuda\": \"12.3\"}"},"settings":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Settings","description":"e.g. {\"temperature\": 0.7, \"top_p\": 0.9}"},"notes":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Notes"},"source_url":{"anyOf":[{"type":"string","maxLength":2048},{"type":"null"}],"title":"Source Url"},"source_label":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Source Label"},"itl_ms":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"null"}],"title":"Itl Ms","description":"Inter-token latency (TPOT) in milliseconds — distinct from end-to-end p50/p95/p99"},"speculative_decoding":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Speculative Decoding","description":"Speculative decoding enabled (NULL = unknown)"},"flash_attn":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Flash Attn","description":"Flash Attention enabled (NULL = unknown)"},"perplexity_dataset":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}],"title":"Perplexity Dataset","description":"Corpus used for perplexity (e.g. WikiText-2, PTB, C4, ShareGPT, Custom)"},"runtime_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Runtime Type","description":"Accelerator runtime type — one of ['cpu', 'cuda', 'metal', 'openvino', 'rocm', 'vulkan']"},"runtime_version":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}],"title":"Runtime Version","description":"Runtime version string (e.g. '12.4', '6.3.1')"},"gpu_count":{"type":"integer","exclusiveMinimum":0.0,"title":"Gpu Count","description":"Number of identical GPUs (e.g. 4× RTX 3090 = 4)","default":1},"gpu_split_mode":{"type":"string","title":"Gpu Split Mode","description":"GPU split strategy — one of ['layer', 'none', 'pipeline_parallel', 'row', 'tensor_parallel']","default":"none"},"gpu_secondary_hardware_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Gpu Secondary Hardware Id","description":"Secondary hardware UUID for HETEROGENEOUS configurations only (e.g. RTX 4070 + RTX 5070). Leave NULL for homogeneous multi-GPU."},"is_moe":{"type":"boolean","title":"Is Moe","description":"Mixture-of-Experts model flag","default":false},"total_params_b":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"null"}],"title":"Total Params B","description":"Total parameter count in billions (e.g. 35 for Qwen3.6-35B-A3B)"},"active_params_b":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"null"}],"title":"Active Params B","description":"Active parameter count in billions (e.g. 3 for A3B)"},"expert_offload_mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expert Offload Mode","description":"Expert offload strategy — one of ['cpu_moe', 'n_cpu_moe', 'none', 'ot_exps_cpu']"},"n_cpu_moe_value":{"anyOf":[{"type":"integer","exclusiveMinimum":0.0},{"type":"null"}],"title":"N Cpu Moe Value","description":"Integer value when expert_offload_mode == 'n_cpu_moe' (e.g. 32)"},"parallel_slots":{"type":"integer","exclusiveMinimum":0.0,"title":"Parallel Slots","description":"llama.cpp --parallel N value; per-slot ctx = context_length // parallel_slots","default":1},"inference_engine":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Inference Engine","description":"Inference harness/engine — one of ['aphrodite', 'cerebras', 'dynamo', 'exllamav2', 'exllamav3', 'gpt4all', 'groq', 'jan', 'koboldcpp', 'llama_cpp', 'lm_studio', 'lmdeploy', 'localai', 'mlx_lm', 'nim', 'ollama', 'other', 'sambanova', 'sglang', 'tabbyapi', 'tensorrt_llm', 'text_generation_webui', 'tgi', 'transformers', 'triton', 'vllm', 'vllm_mlx']. Use 'other' + inference_engine_other for engines not in the list."},"inference_engine_other":{"anyOf":[{"type":"string","maxLength":80},{"type":"null"}],"title":"Inference Engine Other","description":"Free-text engine name when inference_engine == 'other'."},"backend_engine":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Backend Engine","description":"Inner / backend engine for wrapper harnesses — one of ['aphrodite', 'cerebras', 'dynamo', 'exllamav2', 'exllamav3', 'gpt4all', 'groq', 'jan', 'koboldcpp', 'llama_cpp', 'lm_studio', 'lmdeploy', 'localai', 'mlx_lm', 'nim', 'ollama', 'other', 'sambanova', 'sglang', 'tabbyapi', 'tensorrt_llm', 'text_generation_webui', 'tgi', 'transformers', 'triton', 'vllm', 'vllm_mlx']."},"launch_command":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Launch Command","description":"Raw CLI invocation string for this run. Use settings jsonb for structured key-value engine parameters."},"kv_cache_dtype":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kv Cache Dtype","description":"KV-cache dtype — one of ['bf16', 'fp16', 'fp8', 'other', 'q4_0', 'q8_0']."}},"type":"object","required":["model_text","model_quant_text","hardware_text","context_length","batch_size","tokens_per_sec_output"],"title":"BenchmarkRunCreateRequest","description":"Payload for POST /v1/benchmarks/runs."},"BenchmarkRunResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"public_slug":{"type":"string","title":"Public Slug"},"model_text":{"type":"string","title":"Model Text"},"model_quant_text":{"type":"string","title":"Model Quant Text"},"hardware_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Hardware Id"},"hardware_text":{"type":"string","title":"Hardware Text"},"context_length":{"type":"integer","title":"Context Length"},"batch_size":{"type":"integer","title":"Batch Size"},"tokens_per_sec_output":{"type":"number","title":"Tokens Per Sec Output"},"ttft_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Ttft Ms"},"tokens_per_sec_input":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Tokens Per Sec Input"},"p50_latency_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"P50 Latency Ms"},"p95_latency_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"P95 Latency Ms"},"p99_latency_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"P99 Latency Ms"},"vram_peak_mb":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Vram Peak Mb"},"perplexity":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Perplexity"},"eval_scores":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Eval Scores"},"software_stack":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Software Stack"},"settings":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Settings"},"itl_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Itl Ms"},"speculative_decoding":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Speculative Decoding"},"flash_attn":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Flash Attn"},"perplexity_dataset":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Perplexity Dataset"},"runtime_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Runtime Type"},"runtime_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Runtime Version"},"gpu_count":{"type":"integer","title":"Gpu Count","default":1},"gpu_split_mode":{"type":"string","title":"Gpu Split Mode","default":"none"},"gpu_secondary_hardware_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Gpu Secondary Hardware Id"},"is_moe":{"type":"boolean","title":"Is Moe","default":false},"total_params_b":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Total Params B"},"active_params_b":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Active Params B"},"expert_offload_mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expert Offload Mode"},"n_cpu_moe_value":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"N Cpu Moe Value"},"parallel_slots":{"type":"integer","title":"Parallel Slots","default":1},"per_slot_context":{"type":"integer","title":"Per Slot Context","default":0},"warnings":{"items":{"type":"string"},"type":"array","title":"Warnings"},"inference_engine":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Inference Engine"},"inference_engine_other":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Inference Engine Other"},"backend_engine":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Backend Engine"},"launch_command":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Launch Command"},"kv_cache_dtype":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kv Cache Dtype"},"verified_status":{"type":"string","title":"Verified Status"},"outlier_score":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Outlier Score"},"flag_count":{"type":"integer","title":"Flag Count"},"submitted_by_agent":{"type":"boolean","title":"Submitted By Agent"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"source_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Url"},"source_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Label"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"feed_item_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Feed Item Id"}},"type":"object","required":["id","public_slug","model_text","model_quant_text","hardware_id","hardware_text","context_length","batch_size","tokens_per_sec_output","ttft_ms","tokens_per_sec_input","p50_latency_ms","p95_latency_ms","p99_latency_ms","vram_peak_mb","perplexity","eval_scores","software_stack","settings","verified_status","outlier_score","flag_count","submitted_by_agent","notes","created_at"],"title":"BenchmarkRunResponse","description":"Full benchmark run representation."},"BookmarkRequest":{"properties":{"item_id":{"type":"string","title":"Item Id"},"saved":{"type":"boolean","title":"Saved"}},"type":"object","required":["item_id","saved"],"title":"BookmarkRequest"},"BookmarkResult":{"properties":{"item_id":{"type":"string","title":"Item Id"},"user_bookmarked":{"type":"boolean","title":"User Bookmarked"}},"type":"object","required":["item_id","user_bookmarked"],"title":"BookmarkResult"},"BudgetCheckRequest":{"properties":{"text":{"type":"string","minLength":1,"title":"Text","description":"Text to check against budget"},"context_window":{"type":"integer","title":"Context Window","description":"Target context window size in tokens","default":200000},"model":{"type":"string","title":"Model","description":"Target model name for cost estimation","default":"claude-opus-4"}},"type":"object","required":["text"],"title":"BudgetCheckRequest"},"BudgetCheckResponse":{"properties":{"estimated_tokens":{"type":"integer","title":"Estimated Tokens"},"context_window":{"type":"integer","title":"Context Window"},"pct_used":{"type":"number","title":"Pct Used"},"status":{"type":"string","title":"Status","description":"OK, WARNING, or CRITICAL"},"recommendation":{"type":"string","title":"Recommendation"}},"type":"object","required":["estimated_tokens","context_window","pct_used","status","recommendation"],"title":"BudgetCheckResponse"},"BudgetConfig":{"properties":{"monthly_token_budget":{"type":"integer","minimum":1.0,"title":"Monthly Token Budget","description":"Monthly token ceiling (tokens-in)."},"alert_thresholds":{"items":{"type":"integer"},"type":"array","title":"Alert Thresholds","description":"Alert percentages. Each value must be 1–100.","default":[75,90,100]}},"type":"object","required":["monthly_token_budget"],"title":"BudgetConfig","description":"Budget configuration payload (PUT body and GET response body)."},"BudgetResponse":{"properties":{"project_id":{"type":"string","title":"Project Id"},"monthly_token_budget":{"type":"integer","title":"Monthly Token Budget"},"alert_thresholds":{"items":{"type":"integer"},"type":"array","title":"Alert Thresholds"},"last_alerted_threshold":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Last Alerted Threshold"},"last_alerted_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Alerted At"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["project_id","monthly_token_budget","alert_thresholds","created_at","updated_at"],"title":"BudgetResponse","description":"Budget configuration + state as returned by GET/PUT."},"BulkDeleteBody":{"properties":{"kind":{"type":"string","title":"Kind","description":"Must be 'test' in Phase 1."}},"type":"object","required":["kind"],"title":"BulkDeleteBody","description":"Payload for POST /v1/admin/users/v2/bulk-delete.\n\nPhase 1 only supports kind='test' (deletes @test.invalid accounts).\nAny other value is rejected with HTTP 400 to bound blast radius."},"BulkDeleteResponse":{"properties":{"deleted":{"type":"integer","title":"Deleted"}},"type":"object","required":["deleted"],"title":"BulkDeleteResponse"},"CacheBreakpointOut":{"properties":{"target":{"type":"string","title":"Target"},"position_tokens":{"type":"integer","title":"Position Tokens"},"ttl":{"type":"string","title":"Ttl"},"hint":{"type":"string","title":"Hint","default":""}},"type":"object","required":["target","position_tokens","ttl"],"title":"CacheBreakpointOut","description":"Provider-specific cache breakpoint hint emitted in the response."},"CachePolicyIn":{"properties":{"preserve_prefix":{"type":"boolean","title":"Preserve Prefix","default":false},"explicit_prefix_bytes":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Explicit Prefix Bytes"},"target":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target","description":"anthropic | openai | gemini"},"ttl":{"type":"string","pattern":"^(5m|1h|24h)$","title":"Ttl","default":"5m"}},"type":"object","title":"CachePolicyIn","description":"Optional prompt-cache policy (v1.1).\n\nWhen ``preserve_prefix`` is true, the compressor leaves the declared\n(or auto-detected) static prefix byte-for-byte and compresses only\nthe dynamic suffix, so downstream providers can hit their native\nprompt cache on the prefix. ``target`` selects which provider's\nbreakpoint hint to return — anthropic / openai / gemini."},"CacheRollupRow":{"properties":{"target":{"type":"string","title":"Target"},"compressions":{"type":"integer","title":"Compressions"},"preserved_prefix_tokens_total":{"type":"integer","title":"Preserved Prefix Tokens Total"},"projected_combined_savings_usd":{"type":"number","title":"Projected Combined Savings Usd"}},"type":"object","required":["target","compressions","preserved_prefix_tokens_total","projected_combined_savings_usd"],"title":"CacheRollupRow"},"CandidateRow":{"properties":{"user_id":{"type":"string","title":"User Id"},"email":{"type":"string","title":"Email"},"tokens_last_30d":{"type":"integer","title":"Tokens Last 30D"},"projected_monthly_opus47_savings_usd":{"type":"number","title":"Projected Monthly Opus47 Savings Usd"},"email_opt_out":{"type":"boolean","title":"Email Opt Out"}},"type":"object","required":["user_id","email","tokens_last_30d","projected_monthly_opus47_savings_usd","email_opt_out"],"title":"CandidateRow"},"CapabilitiesResponse":{"properties":{"capabilities":{"items":{"$ref":"#/components/schemas/CapabilityInfo"},"type":"array","title":"Capabilities"},"total":{"type":"integer","title":"Total"},"plan":{"type":"string","title":"Plan"},"categories":{"additionalProperties":{"type":"integer"},"type":"object","title":"Categories"}},"type":"object","required":["capabilities","total","plan","categories"],"title":"CapabilitiesResponse"},"CapabilityInfo":{"properties":{"name":{"type":"string","title":"Name"},"category":{"type":"string","title":"Category"},"tier":{"type":"string","title":"Tier"},"mutating":{"type":"boolean","title":"Mutating"},"read_only":{"type":"boolean","title":"Read Only"},"destructive":{"type":"boolean","title":"Destructive"},"idempotent":{"type":"boolean","title":"Idempotent"},"open_world":{"type":"boolean","title":"Open World"},"engine_profiles":{"items":{"type":"string"},"type":"array","title":"Engine Profiles"},"hosting_modes":{"items":{"type":"string"},"type":"array","title":"Hosting Modes"},"required_scopes":{"items":{"type":"string"},"type":"array","title":"Required Scopes"},"timeout_seconds":{"type":"number","title":"Timeout Seconds"},"external_dependencies":{"items":{"type":"string"},"type":"array","title":"External Dependencies"},"fixture_id":{"type":"string","title":"Fixture Id"},"confirmation_policy":{"type":"string","title":"Confirmation Policy"},"live_test_policy":{"type":"string","title":"Live Test Policy"},"available":{"type":"boolean","title":"Available"}},"type":"object","required":["name","category","tier","mutating","read_only","destructive","idempotent","open_world","engine_profiles","hosting_modes","required_scopes","timeout_seconds","external_dependencies","fixture_id","confirmation_policy","live_test_policy","available"],"title":"CapabilityInfo"},"ChatAttachment":{"properties":{"type":{"type":"string","const":"image","title":"Type","default":"image"},"url":{"anyOf":[{"type":"string","maxLength":2048},{"type":"null"}],"title":"Url"},"data":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Data"},"media_type":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}],"title":"Media Type"}},"additionalProperties":false,"type":"object","title":"ChatAttachment","description":"An image attached to the ask.\n\nTHE ACCEPTED SET IS NARROWER THAN THE KERNEL'S, ON PURPOSE. An earlier cut\nderived this vocabulary from `_NON_TEXT_BLOCK_TYPES` — all eight kinds the\nestimator can price — reasoning that matching the kernel prevented drift.\nThat was the wrong axis. What the kernel can PRICE and what this route can\ncorrectly RENDER onto a provider wire are different questions, and codex\ncaught the gap: pricing a `document` says nothing about our ability to emit\na document block Anthropic or OpenAI will accept. The binding constraint is\nthe narrower one.\n\n`text` is excluded for a second, independent reason: `instruction` and\n`context` carry the text and are separate so the compressor can tell the ask\nfrom the source material. A second path to text content would route around\nthat.\n\nWiden this only per-type, and only once that type's block has been checked\nagainst a live provider — which is blocked on #7 (no provider key is\nconfigured, so no request on this path has ever reached a provider)."},"ChatCompletionRequest":{"properties":{"provider":{"type":"string","maxLength":64,"title":"Provider"},"model":{"type":"string","maxLength":128,"title":"Model"},"instruction":{"type":"string","maxLength":8000,"minLength":1,"title":"Instruction"},"context":{"type":"string","maxLength":500000,"title":"Context","default":""},"max_output_tokens":{"anyOf":[{"type":"integer","maximum":8192.0,"minimum":1.0},{"type":"null"}],"title":"Max Output Tokens"},"conversation_id":{"anyOf":[{"type":"string","maxLength":36},{"type":"null"}],"title":"Conversation Id"},"history_leaf_id":{"anyOf":[{"type":"string","maxLength":36,"minLength":1},{"type":"null"}],"title":"History Leaf Id"},"persist_turn":{"type":"boolean","title":"Persist Turn","default":false},"reuse_user_message_id":{"anyOf":[{"type":"string","maxLength":36,"minLength":1},{"type":"null"}],"title":"Reuse User Message Id"},"reuse_input_message_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"maxLength":36,"title":"Reuse Input Message Id"},"edit_input_message_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"maxLength":36,"title":"Edit Input Message Id"},"cache_context":{"type":"boolean","title":"Cache Context","default":false},"research_mode":{"type":"string","enum":["auto","web","papers","fetch","off"],"title":"Research Mode","description":"Auto detects research intent; web searches DuckDuckGo; papers searches arXiv; fetch reads URLs; off disables retrieval.","default":"auto"},"research_timezone":{"type":"string","maxLength":64,"title":"Research Timezone","description":"IANA timezone for resolving relative dates; weather uses the resolved location timezone.","default":"UTC"},"project_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"},"credential_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Credential Id","description":"Optional specific provider credential UUID to use. Must belong to the caller and match provider."},"idempotency_key":{"anyOf":[{"type":"string","maxLength":128,"minLength":1},{"type":"null"}],"title":"Idempotency Key","description":"Optional client idempotency key to deduplicate submissions."},"attachments":{"items":{"$ref":"#/components/schemas/ChatAttachment"},"type":"array","maxItems":8,"title":"Attachments"},"stream":{"type":"boolean","title":"Stream","description":"Stream the answer as Server-Sent Events: `answer` and `reasoning` deltas, then one `final` event carrying the ChatCompletionResponse.","default":false}},"type":"object","required":["provider","model","instruction"],"title":"ChatCompletionRequest","description":"`instruction` and `context` are DISTINCT fields on purpose.\n\nA single `prompt` field would leave the compressor with no way to tell the ask\nfrom the source material, and compressing the ask is how you silently change the\nquestion. The split is the contract, not a convenience."},"ChatCompletionResponse":{"properties":{"saved_turn":{"anyOf":[{"$ref":"#/components/schemas/SavedTurnReceipt"},{"type":"null"}]},"answer":{"type":"string","title":"Answer"},"model":{"type":"string","title":"Model"},"provider":{"type":"string","title":"Provider"},"context_tokens_original_estimated":{"type":"integer","title":"Context Tokens Original Estimated"},"context_tokens_sent_estimated":{"type":"integer","title":"Context Tokens Sent Estimated"},"provider_input_tokens_actual":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Provider Input Tokens Actual"},"tokens_out":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tokens Out"},"cache_read_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Cache Read Tokens"},"cache_write_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Cache Write Tokens"},"savings_usd_micros":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Savings Usd Micros"},"pricing_catalog_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pricing Catalog Version"},"compression_applied":{"type":"boolean","title":"Compression Applied"},"quality_status":{"type":"string","title":"Quality Status"},"reasoning":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reasoning"},"stopped":{"type":"boolean","title":"Stopped","default":false},"stream_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stream Error"},"research":{"anyOf":[{"$ref":"#/components/schemas/ResearchReceipt"},{"type":"null"}]},"history_replay":{"anyOf":[{"$ref":"#/components/schemas/HistoryReplayReceipt"},{"type":"null"}]}},"additionalProperties":false,"type":"object","required":["answer","model","provider","context_tokens_original_estimated","context_tokens_sent_estimated","savings_usd_micros","pricing_catalog_version","compression_applied","quality_status"],"title":"ChatCompletionResponse","description":"Wire body for ``POST /v1/chat/completions`` — typed, not filtered.\n\nField names and types match the legacy inline dict exactly. The route keeps\n``response_model=None`` so FastAPI does not filter the return value; the\nmodel is referenced via ``responses={200: {\"model\": ...}}`` so it lands in\nOpenAPI ``components.schemas`` for the F11 wire-shape guard, and constructed\nat the return site so a field drift raises before bytes leave the process.\n\n``extra=\"forbid\"`` is load-bearing: under the default ``extra=\"ignore\"``,\n``model_dump()`` silently drops a new key — the exact silent-drop this\nmodel exists to prevent."},"CheckoutRequest":{"properties":{"plan":{"type":"string","title":"Plan","default":"pro"}},"type":"object","title":"CheckoutRequest","description":"Body for the checkout endpoint."},"CheckoutResponse":{"properties":{"checkout_url":{"type":"string","title":"Checkout Url"}},"type":"object","required":["checkout_url"],"title":"CheckoutResponse","description":"Response containing the Polar checkout URL."},"ClaimReferralRequest":{"properties":{"referral_code":{"type":"string","title":"Referral Code"},"referred_user_id":{"type":"string","title":"Referred User Id"}},"type":"object","required":["referral_code","referred_user_id"],"title":"ClaimReferralRequest","description":"Body for POST /v1/referrals/claim."},"ClaimReferralResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"referral_code":{"type":"string","title":"Referral Code"},"referrer_user_id":{"type":"string","title":"Referrer User Id"},"credit_days":{"type":"integer","title":"Credit Days"}},"type":"object","required":["success","referral_code","referrer_user_id","credit_days"],"title":"ClaimReferralResponse","description":"Confirmation of referral claim."},"ClaimTaskRequest":{"properties":{"task_id":{"type":"string","format":"uuid","title":"Task Id"},"from_peer_id":{"type":"string","format":"uuid","title":"From Peer Id"},"proof_jws":{"type":"string","title":"Proof Jws"},"claim_lease_minutes":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Claim Lease Minutes"}},"type":"object","required":["task_id","from_peer_id","proof_jws"],"title":"ClaimTaskRequest"},"ClassificationPolicyRequest":{"properties":{"allowed_classifications":{"items":{"type":"string"},"type":"array","title":"Allowed Classifications","description":"Subset of classification values allowed for items in this project."},"default_classification":{"type":"string","title":"Default Classification","description":"Classification applied when caller omits classification on ingest.","default":"internal"},"required_at_ingest":{"type":"boolean","title":"Required At Ingest","description":"When True, callers must supply classification on ingest or receive 422.","default":false}},"type":"object","title":"ClassificationPolicyRequest","description":"Body for PUT …/policy."},"ClassificationPolicyResponse":{"properties":{"project_id":{"type":"string","title":"Project Id"},"allowed_classifications":{"items":{"type":"string"},"type":"array","title":"Allowed Classifications"},"default_classification":{"type":"string","title":"Default Classification"},"required_at_ingest":{"type":"boolean","title":"Required At Ingest"}},"type":"object","required":["project_id","allowed_classifications","default_classification","required_at_ingest"],"title":"ClassificationPolicyResponse","description":"Response for GET / PUT …/policy."},"ClassificationRequest":{"properties":{"classification":{"type":"string","enum":["public","internal","confidential","restricted"],"title":"Classification","description":"Data sensitivity classification level."}},"type":"object","required":["classification"],"title":"ClassificationRequest","description":"Body for PATCH …/classification."},"ClientRollupItem":{"properties":{"client":{"type":"string","title":"Client"},"calls":{"type":"integer","title":"Calls"},"tokens_in":{"type":"integer","title":"Tokens In"},"tokens_saved":{"type":"integer","title":"Tokens Saved"},"avg_savings_pct":{"type":"number","title":"Avg Savings Pct"},"pct_of_total":{"type":"number","title":"Pct Of Total"}},"type":"object","required":["client","calls","tokens_in","tokens_saved","avg_savings_pct","pct_of_total"],"title":"ClientRollupItem"},"CodeCompressionStats":{"properties":{"original_tokens":{"type":"integer","title":"Original Tokens"},"compressed_tokens":{"type":"integer","title":"Compressed Tokens"},"savings_pct":{"type":"number","title":"Savings Pct"},"language_detected":{"type":"string","title":"Language Detected"}},"type":"object","required":["original_tokens","compressed_tokens","savings_pct","language_detected"],"title":"CodeCompressionStats","description":"Code compression statistics."},"CommentCreateRequest":{"properties":{"content":{"type":"string","maxLength":10000,"minLength":1,"title":"Content"},"parent_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Id","description":"UUID of the parent comment for replies"}},"type":"object","required":["content"],"title":"CommentCreateRequest","description":"Request body for POST /v1/benchmarks/runs/{run_id}/comments."},"CommentItem":{"properties":{"id":{"type":"string","title":"Id"},"item_id":{"type":"string","title":"Item Id"},"parent_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Id"},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"},"body":{"type":"string","title":"Body"},"depth":{"type":"integer","title":"Depth"},"score":{"type":"integer","title":"Score"},"author_username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Author Username"},"edited_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Edited At"},"author_plan":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Author Plan"},"author_avatar":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Author Avatar"},"user_vote":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"User Vote"},"is_own":{"type":"boolean","title":"Is Own","default":false}},"type":"object","required":["id","item_id","body","depth","score"],"title":"CommentItem"},"CommentListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CommentResponse"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["items","total"],"title":"CommentListResponse","description":"Response shape for GET /v1/benchmarks/runs/{run_id}/comments."},"CommentRequest":{"properties":{"body":{"type":"string","maxLength":10000,"minLength":1,"title":"Body"},"parent_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Id"}},"type":"object","required":["body"],"title":"CommentRequest"},"CommentResponse":{"properties":{"id":{"type":"string","title":"Id"},"benchmark_run_id":{"type":"string","title":"Benchmark Run Id"},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"},"parent_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Id"},"depth":{"type":"integer","title":"Depth"},"content":{"type":"string","title":"Content"},"status":{"type":"string","title":"Status"},"moderation_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Moderation Label"},"moderation_confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Moderation Confidence"},"moderation_reasoning":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Moderation Reasoning"},"created_at":{"anyOf":[{},{"type":"null"}],"title":"Created At"},"deleted_at":{"anyOf":[{},{"type":"null"}],"title":"Deleted At"}},"type":"object","required":["id","benchmark_run_id","user_id","parent_id","depth","content","status","moderation_label","moderation_confidence","moderation_reasoning","created_at"],"title":"CommentResponse","description":"Response shape for a single benchmark comment."},"CommentResult":{"properties":{"id":{"type":"string","title":"Id"},"item_id":{"type":"string","title":"Item Id"},"parent_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Id"},"depth":{"type":"integer","title":"Depth"},"body":{"type":"string","title":"Body"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"edited_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Edited At"}},"type":"object","required":["id","item_id","depth","body","created_at"],"title":"CommentResult"},"CommentVoteRequest":{"properties":{"value":{"type":"integer","maximum":1.0,"minimum":-1.0,"title":"Value"}},"type":"object","required":["value"],"title":"CommentVoteRequest"},"CommentVoteResult":{"properties":{"comment_id":{"type":"string","title":"Comment Id"},"score":{"type":"integer","title":"Score"},"user_vote":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"User Vote"}},"type":"object","required":["comment_id","score"],"title":"CommentVoteResult","description":"Result returned by ``vote_on_comment``.\n\n``score`` is the comment's current net score (sum of all +1/-1 votes,\nmaintained by the ``trg_comment_votes_apply`` trigger on Postgres; on SQLite\nthe service re-computes it from the in-process vote for test compatibility).\n``user_vote`` is the caller's current vote: 1, -1, or None (no vote / retracted)."},"CommentsPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CommentItem"},"type":"array","title":"Items"}},"type":"object","required":["items"],"title":"CommentsPage"},"CommunitySkillListItem":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"slug":{"type":"string","title":"Slug"},"tagline":{"type":"string","title":"Tagline"},"category":{"type":"string","title":"Category"},"artifact_type":{"type":"string","title":"Artifact Type"},"status":{"type":"string","title":"Status"},"scan_risk_score":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Scan Risk Score"},"scan_severity":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scan Severity"},"scan_recommendation":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scan Recommendation"},"scan_safe_to_install":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Scan Safe To Install"},"scan_findings_count":{"type":"integer","title":"Scan Findings Count"},"scanned_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scanned At"},"fetches_remote_resources":{"type":"boolean","title":"Fetches Remote Resources"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated At"},"published_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Published At"}},"type":"object","required":["id","name","slug","tagline","category","artifact_type","status","scan_risk_score","scan_severity","scan_recommendation","scan_safe_to_install","scan_findings_count","scanned_at","fetches_remote_resources","created_at","updated_at","published_at"],"title":"CommunitySkillListItem","description":"SLIM browse-grid shape. Deliberately OMITS ``skill_markdown`` and\n``install_snippet`` -- the installable payload. The list route caches\nlonger than detail (discovery TTL), so if the browse item carried the\npayload, a withdrawn/taken-down skill would stay INSTALLABLE through the\nlist cache for the list TTL even after the detail route stopped serving it\n(codex step-2 confirmation review 2026-07-21). The full payload lives only\non the 60s-bounded detail route. A card needs identity + scan verdict to\nrender, never the SKILL.md body."},"CommunitySkillPublicResponse":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"slug":{"type":"string","title":"Slug"},"tagline":{"type":"string","title":"Tagline"},"category":{"type":"string","title":"Category"},"artifact_type":{"type":"string","title":"Artifact Type"},"skill_markdown":{"type":"string","title":"Skill Markdown"},"install_snippet":{"type":"string","title":"Install Snippet"},"status":{"type":"string","title":"Status"},"scan_risk_score":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Scan Risk Score"},"scan_severity":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scan Severity"},"scan_recommendation":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scan Recommendation"},"scan_safe_to_install":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Scan Safe To Install"},"scan_findings":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Scan Findings"},"scanned_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scanned At"},"fetches_remote_resources":{"type":"boolean","title":"Fetches Remote Resources"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated At"},"published_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Published At"},"feed_item_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Feed Item Id"}},"type":"object","required":["id","name","slug","tagline","category","artifact_type","skill_markdown","install_snippet","status","scan_risk_score","scan_severity","scan_recommendation","scan_safe_to_install","scan_findings","scanned_at","fetches_remote_resources","created_at","updated_at","published_at"],"title":"CommunitySkillPublicResponse","description":"Public shape (GET list + GET detail) -- omits internal/reviewer-only\nfields (``author_clerk_id``, ``reviewed_by``, ``reviewed_at``,\n``rejection_reason``, ``authorship_asserted``, ``scan_content_sha256``,\n``scan_policy_version``). ``scan_findings`` IS included -- the whole\npoint of decision D1 (HIGH/MEDIUM = prominent badge, not a hard block)\nis that a visitor can see WHY a published listing is flagged."},"CommunitySkillResponse":{"properties":{"id":{"type":"string","title":"Id"},"author_clerk_id":{"type":"string","title":"Author Clerk Id"},"name":{"type":"string","title":"Name"},"slug":{"type":"string","title":"Slug"},"tagline":{"type":"string","title":"Tagline"},"category":{"type":"string","title":"Category"},"artifact_type":{"type":"string","title":"Artifact Type"},"skill_markdown":{"type":"string","title":"Skill Markdown"},"install_snippet":{"type":"string","title":"Install Snippet"},"status":{"type":"string","title":"Status"},"reviewed_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reviewed By"},"reviewed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reviewed At"},"rejection_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rejection Reason"},"authorship_asserted":{"type":"boolean","title":"Authorship Asserted"},"scan_risk_score":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Scan Risk Score"},"scan_severity":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scan Severity"},"scan_recommendation":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scan Recommendation"},"scan_safe_to_install":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Scan Safe To Install"},"scan_findings":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Scan Findings"},"scanned_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scanned At"},"scan_content_sha256":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scan Content Sha256"},"scan_policy_version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Scan Policy Version"},"fetches_remote_resources":{"type":"boolean","title":"Fetches Remote Resources"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated At"},"published_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Published At"}},"type":"object","required":["id","author_clerk_id","name","slug","tagline","category","artifact_type","skill_markdown","install_snippet","status","reviewed_by","reviewed_at","rejection_reason","authorship_asserted","scan_risk_score","scan_severity","scan_recommendation","scan_safe_to_install","scan_findings","scanned_at","scan_content_sha256","scan_policy_version","fetches_remote_resources","created_at","updated_at","published_at"],"title":"CommunitySkillResponse","description":"Full author/moderator-facing shape (create/update/submit/withdraw/\ndecide responses). Includes the caller's own ``author_clerk_id`` --\nharmless, since only the author (or a moderator, for decide) ever sees\nthis response, and it is their own already-known identity."},"CompleteAttachmentResponse":{"properties":{"object_path":{"type":"string","title":"Object Path"},"content_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content Type"},"bytes":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Bytes"},"url":{"type":"string","title":"Url"},"status":{"type":"string","title":"Status"}},"type":"object","required":["object_path","content_type","bytes","url","status"],"title":"CompleteAttachmentResponse"},"CompleteTaskRequest":{"properties":{"task_id":{"type":"string","format":"uuid","title":"Task Id"},"from_peer_id":{"type":"string","format":"uuid","title":"From Peer Id"},"proof_jws":{"type":"string","title":"Proof Jws"},"result_payload":{"additionalProperties":true,"type":"object","title":"Result Payload"}},"type":"object","required":["task_id","from_peer_id","proof_jws","result_payload"],"title":"CompleteTaskRequest"},"CompletionStatusIn":{"properties":{"project_id":{"type":"string","format":"uuid","title":"Project Id"},"idempotency_key":{"type":"string","maxLength":128,"minLength":1,"title":"Idempotency Key"},"history_leaf_id":{"anyOf":[{"type":"string","maxLength":36},{"type":"null"}],"title":"History Leaf Id"},"fingerprint":{"anyOf":[{"type":"string","pattern":"^[0-9a-f]{64}$"},{"type":"null"}],"title":"Fingerprint"}},"additionalProperties":false,"type":"object","required":["project_id","idempotency_key","history_leaf_id"],"title":"CompletionStatusIn"},"CompletionStatusOut":{"properties":{"status":{"type":"string","enum":["pending","complete","failed","unknown"],"title":"Status"},"fingerprint":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fingerprint"},"completion":{"anyOf":[{"$ref":"#/components/schemas/ChatCompletionResponse"},{"type":"null"}]},"failure_code":{"anyOf":[{"type":"string","enum":["generation_format_failed","generation_citation_failed"]},{"type":"null"}],"title":"Failure Code"}},"additionalProperties":false,"type":"object","required":["status"],"title":"CompletionStatusOut"},"CompressCodeRequest":{"properties":{"code":{"type":"string","minLength":1,"title":"Code","description":"Source code to compress"},"language":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Language","description":"Programming language hint (python, javascript, typescript, java, go, rust, cpp). Auto-detected from content when omitted."},"fidelity":{"type":"string","title":"Fidelity","description":"Compression level: abstract, outline, balanced, detailed, raw","default":"balanced"}},"type":"object","required":["code"],"title":"CompressCodeRequest","description":"Request body for code compression."},"CompressCodeResponse":{"properties":{"compressed":{"type":"string","title":"Compressed"},"stats":{"$ref":"#/components/schemas/CodeCompressionStats"}},"type":"object","required":["compressed","stats"],"title":"CompressCodeResponse","description":"Response from code compression."},"CompressRequest":{"properties":{"text":{"type":"string","minLength":1,"title":"Text","description":"Text to compress"},"fidelity":{"type":"string","title":"Fidelity","description":"Compression level: abstract, outline, balanced, detailed, raw","default":"balanced"},"query":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Query","description":"Optional query string for query-guided compression. When provided, nodes most relevant to the query are prioritised while still meeting the target compression ratio."},"selection_mode":{"anyOf":[{"type":"string","enum":["auto","baseline","query_guided","evidence_aware"]},{"type":"null"}],"title":"Selection Mode","description":"Optional skeleton selection mode — parity with the MCP read_skeleton path. 'evidence_aware' does a targeted, query/heading-anchored read that keeps the sections most relevant to the evidence; 'query_guided' prioritises query-relevant nodes; 'baseline' is the pure PageRank/MMR skeleton; 'auto' lets the engine pick. Defaults to query_guided when a query is supplied, else baseline."},"cost_model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cost Model","description":"Model name for cost estimation (e.g. claude-sonnet-4-6)"},"team_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Team Id","description":"Optional team workspace to attribute this compression to."},"profile_id":{"anyOf":[{"type":"integer","minimum":1.0},{"type":"null"}],"title":"Profile Id","description":"Optional saved fidelity profile to apply for this compression."},"multi_level":{"type":"boolean","title":"Multi Level","description":"When true, returns three compression levels in one call: headline (~10% kept), summary (~30% kept), and full (as per fidelity). The response includes a 'levels' object instead of a single 'compressed' string.","default":false},"cache_policy":{"anyOf":[{"$ref":"#/components/schemas/CachePolicyIn"},{"type":"null"}],"description":"Optional v1.1 prompt-cache policy. When set with ``preserve_prefix=true``, the static prefix is passed through byte-for-byte and only the dynamic suffix is compressed, so downstream providers can hit their native prompt cache."},"style":{"type":"string","pattern":"^(terse|normal|verbose)$","title":"Style","description":"v1.4.0 output-style hint. When 'terse', the response includes a short system_prompt_suffix clients should inject into the downstream LLM system prompt to cap output verbosity (~63% output-token reduction on independent 2026 benchmarks).","default":"normal"}},"type":"object","required":["text"],"title":"CompressRequest","description":"Request body for compression."},"CompressResponse":{"properties":{"compressed":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Compressed","description":"Compressed text (single-level mode)"},"levels":{"anyOf":[{"$ref":"#/components/schemas/MultiLevelOutput"},{"type":"null"}],"description":"Three tiers of compression (multi_level mode)"},"stats":{"$ref":"#/components/schemas/CompressionStats"},"original_tokens":{"type":"integer","title":"Original Tokens","description":"Token count of the original input text (cl100k_base, gpt-4 compatible).","default":0},"compressed_tokens":{"type":"integer","title":"Compressed Tokens","description":"Token count of the compressed output text.","default":0},"savings_pct":{"type":"number","title":"Savings Pct","description":"Percentage of tokens saved: (1 - compressed/original) * 100, rounded to 1 decimal place and clamped to 0 when the output is larger than the input (e.g. very short texts).","default":0.0},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note","description":"Human-readable hint, present ONLY when the input was too small to compress effectively (below ~200 tokens the semantic-skeleton's fixed overhead exceeds the savings). Guides first-time evaluators to retry with a larger document instead of concluding the product 'made it bigger'."},"cache_breakpoints":{"items":{"$ref":"#/components/schemas/CacheBreakpointOut"},"type":"array","title":"Cache Breakpoints","description":"v1.1: provider-specific cache breakpoint hints. Empty when no ``cache_policy`` was supplied on the request."},"preserved_prefix_tokens":{"type":"integer","title":"Preserved Prefix Tokens","description":"v1.1: approximate token count of the prefix preserved byte-for-byte for prompt-cache reuse. Zero when no cache policy was supplied.","default":0},"system_prompt_suffix":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"System Prompt Suffix","description":"v1.4.0: short system-prompt rule block for the downstream LLM. Non-null only when the request sets style='terse'."},"style_suffix_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Style Suffix Version","description":"v1.4.0: version tag of the returned suffix (e.g. 'v1')."}},"type":"object","required":["stats"],"title":"CompressResponse","description":"Response from compression."},"CompressToolOutputRequest":{"properties":{"output":{"type":"string","minLength":1,"title":"Output","description":"Raw tool / command / MCP output to compress. Send the full blob — the service will preserve execution-critical identifiers (file paths with line numbers, error codes, symbols, URLs, stack frames, env var names, UUIDs) even when they would normally be elided by compression."},"command_hint":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Command Hint","description":"Optional hint about the source tool type. Accepts any CLIOutputOptimizer STRATEGY_MAP key (e.g. 'git_diff', 'test_output', 'lint_output', 'json_output', 'log_output', 'install_output', 'progress_output', 'tree_output', 'docker_output', 'ansi_output') plus the friendly alias 'pytest' (mapped to 'test_output'). Auto-detected when omitted or unrecognized; unclassified verbose output still gets a conservative compression pass via the built-in generic fallback strategy rather than a silent no-op."},"preserve_identifiers":{"type":"boolean","title":"Preserve Identifiers","description":"When true (default), execution-critical identifiers are guaranteed to survive compression via a force-keep pass after the main compression engine runs.  Set false to get standard filter_cli_output behavior.","default":true}},"type":"object","required":["output"],"title":"CompressToolOutputRequest","description":"Request body for tool output compression with identifier preservation."},"CompressToolOutputResponse":{"properties":{"compressed":{"type":"string","title":"Compressed"},"original_chars":{"type":"integer","title":"Original Chars"},"filtered_chars":{"type":"integer","title":"Filtered Chars"},"savings_pct":{"type":"number","title":"Savings Pct"},"detected_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detected Type"},"strategy_applied":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Strategy Applied"},"preserved_identifier_count":{"type":"integer","title":"Preserved Identifier Count","default":0},"reinjected_count":{"type":"integer","title":"Reinjected Count","default":0},"reinjected_tokens":{"items":{"type":"string"},"type":"array","title":"Reinjected Tokens"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"}},"type":"object","required":["compressed","original_chars","filtered_chars","savings_pct"],"title":"CompressToolOutputResponse","description":"Response from POST /v1/compress/tool-output."},"CompressionEvent":{"properties":{"id":{"type":"string","title":"Id"},"tokens_in":{"type":"integer","title":"Tokens In"},"tokens_out":{"type":"integer","title":"Tokens Out"},"tokens_saved":{"type":"integer","title":"Tokens Saved"},"savings_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Savings Pct"},"fidelity":{"type":"string","title":"Fidelity"},"method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Method"},"latency_ms":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Latency Ms"},"input_preview":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Input Preview"},"tool_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tool Name"},"profile_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Profile Name"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"},"model_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Source"},"status":{"type":"string","title":"Status","default":"success"},"api_key_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Api Key Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","tokens_in","tokens_out","tokens_saved","savings_pct","fidelity","created_at"],"title":"CompressionEvent","description":"A single compression event in the history."},"CompressionStats":{"properties":{"original_tokens":{"type":"integer","title":"Original Tokens"},"compressed_tokens":{"type":"integer","title":"Compressed Tokens"},"savings_pct":{"type":"number","title":"Savings Pct"},"compression_ratio":{"type":"number","title":"Compression Ratio"},"estimated_cost_saved":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Estimated Cost Saved"}},"type":"object","required":["original_tokens","compressed_tokens","savings_pct","compression_ratio"],"title":"CompressionStats","description":"Compression statistics."},"ConfigFlag":{"properties":{"key":{"type":"string","title":"Key"},"label":{"type":"string","title":"Label"},"value":{"type":"boolean","title":"Value"},"source_env":{"type":"string","title":"Source Env"}},"type":"object","required":["key","label","value","source_env"],"title":"ConfigFlag"},"ConfirmRequest":{"properties":{"user_code":{"type":"string","maxLength":64,"minLength":8,"title":"User Code"},"decision":{"type":"string","enum":["approve","deny"],"title":"Decision","default":"approve"}},"type":"object","required":["user_code"],"title":"ConfirmRequest"},"ConfirmResponse":{"properties":{"status":{"type":"string","enum":["confirmed","denied"],"title":"Status"}},"type":"object","required":["status"],"title":"ConfirmResponse"},"ConfirmTokenResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"operation":{"type":"string","title":"Operation"},"api_key_id":{"type":"string","title":"Api Key Id"},"payload_processed":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Payload Processed"},"new_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"New Key"},"new_key_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"New Key Id"}},"type":"object","required":["success","operation","api_key_id"],"title":"ConfirmTokenResponse"},"ContentReportRequest":{"properties":{"target_type":{"type":"string","title":"Target Type","description":"Type of content being reported. One of: benchmark, comment, feed_item, news, user_post"},"target_id":{"type":"string","title":"Target Id","description":"UUID of the content being reported."},"reason":{"type":"string","pattern":"^(spam|inappropriate|illegal|other)$","title":"Reason","description":"Reason for the report."},"detail":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Detail"}},"type":"object","required":["target_type","target_id","reason"],"title":"ContentReportRequest"},"ContextAlignRequest":{"properties":{"tier1_system":{"type":"string","maxLength":32000,"title":"Tier1 System"},"tier2_kb":{"type":"string","maxLength":32000,"title":"Tier2 Kb","default":""},"tier3_ast":{"type":"string","maxLength":32000,"title":"Tier3 Ast","default":""},"tier4_dynamic":{"type":"string","maxLength":32000,"title":"Tier4 Dynamic","default":""},"block_size":{"type":"integer","maximum":4096.0,"minimum":16.0,"title":"Block Size","default":1024},"padding_style":{"type":"string","enum":["comment","newline","virtual"],"title":"Padding Style","default":"comment"}},"type":"object","required":["tier1_system"],"title":"ContextAlignRequest"},"ContextAlignResponse":{"properties":{"full_prompt_text":{"type":"string","title":"Full Prompt Text"},"total_tokens":{"type":"integer","title":"Total Tokens"},"static_prefix_tokens":{"type":"integer","title":"Static Prefix Tokens"},"eligible_boundary_tokens":{"type":"integer","title":"Eligible Boundary Tokens"},"waste_tokens":{"type":"integer","title":"Waste Tokens"},"tokenizer_name":{"type":"string","title":"Tokenizer Name"},"token_counts_exact":{"type":"boolean","title":"Token Counts Exact"},"tiers":{"items":{"$ref":"#/components/schemas/AlignedTierSummary"},"type":"array","title":"Tiers"}},"type":"object","required":["full_prompt_text","total_tokens","static_prefix_tokens","eligible_boundary_tokens","waste_tokens","tokenizer_name","token_counts_exact","tiers"],"title":"ContextAlignResponse"},"ConversationDetailOut":{"properties":{"conversation":{"$ref":"#/components/schemas/ConversationOut"},"messages":{"items":{"$ref":"#/components/schemas/MessageOut"},"type":"array","title":"Messages"}},"additionalProperties":false,"type":"object","required":["conversation","messages"],"title":"ConversationDetailOut"},"ConversationListOut":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ConversationOut"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Next Cursor"},"next_page_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Page Cursor"}},"additionalProperties":false,"type":"object","required":["items","next_cursor"],"title":"ConversationListOut"},"ConversationOut":{"properties":{"id":{"type":"string","title":"Id"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"draft_text":{"type":"string","title":"Draft Text"},"project_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Id"},"pinned":{"type":"boolean","title":"Pinned"},"archived":{"type":"boolean","title":"Archived"},"current_message_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Message Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"additionalProperties":false,"type":"object","required":["id","title","draft_text","project_id","pinned","archived","current_message_id","created_at","updated_at"],"title":"ConversationOut"},"CreateActivityBody":{"properties":{"activity_type":{"type":"string","maxLength":32,"title":"Activity Type"},"body":{"type":"string","minLength":1,"title":"Body"}},"type":"object","required":["activity_type","body"],"title":"CreateActivityBody"},"CreateConversationIn":{"properties":{"title":{"anyOf":[{"type":"string","maxLength":400},{"type":"null"}],"title":"Title"},"draft_text":{"type":"string","maxLength":100000,"title":"Draft Text","default":""},"project_id":{"anyOf":[{"type":"string","maxLength":36},{"type":"null"}],"title":"Project Id"}},"additionalProperties":false,"type":"object","title":"CreateConversationIn"},"CreateDealBody":{"properties":{"title":{"type":"string","maxLength":255,"title":"Title"},"company":{"type":"string","maxLength":255,"title":"Company"},"account_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Id"},"stage":{"type":"string","maxLength":32,"title":"Stage","default":"lead"},"deal_value_usd":{"type":"number","minimum":0.0,"title":"Deal Value Usd","default":0.0},"lead_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lead Id"},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},"type":"object","required":["title","company"],"title":"CreateDealBody"},"CreateKeyRequest":{"properties":{"name":{"type":"string","maxLength":100,"minLength":1,"title":"Name","description":"Human-readable key name"},"default_model":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Default Model","description":"Optional LLM model this key is typically used with. Used to price MCP compression savings when the tool call doesn't pass an explicit ``_meta.model``. Must be one of the models returned by ``/v1/models`` (or a recognised alias)."},"environment":{"anyOf":[{"type":"string","maxLength":16},{"type":"null"}],"title":"Environment","description":"Environment label: dev | staging | prod | other.","default":"prod"},"project_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Id","description":"UUID of the project to bind this key to (optional)."},"scope_model":{"type":"string","title":"Scope Model","description":"Scope enforcement model: 'scoped' = enforce scopes / denied_scopes allow/deny list (default); 'legacy' = god-mode (backward compat).","default":"scoped"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes","description":"List of granted scope strings (e.g. ['compress:read', 'keys:read'])."},"denied_scopes":{"items":{"type":"string"},"type":"array","title":"Denied Scopes","description":"List of explicitly denied scopes (trumps grants)."}},"type":"object","required":["name"],"title":"CreateKeyRequest","description":"Request body for API key creation."},"CreateKeyResponse":{"properties":{"key":{"type":"string","title":"Key"},"key_id":{"type":"string","title":"Key Id"},"name":{"type":"string","title":"Name"},"created_at":{"type":"string","title":"Created At"},"default_model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Default Model"},"environment":{"type":"string","title":"Environment","default":"prod"},"project_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Id"},"scope_model":{"type":"string","title":"Scope Model","default":"legacy"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes","default":[]},"denied_scopes":{"items":{"type":"string"},"type":"array","title":"Denied Scopes","default":[]}},"type":"object","required":["key","key_id","name","created_at"],"title":"CreateKeyResponse","description":"Response after creating an API key.\n\nThe ``key`` field contains the full raw key — this is shown ONCE and\ncannot be retrieved again. Store it securely immediately."},"CreateLeadRequest":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"},"email":{"type":"string","maxLength":255,"minLength":3,"title":"Email"},"company":{"type":"string","maxLength":255,"minLength":1,"title":"Company"},"message":{"type":"string","maxLength":5000,"title":"Message","default":""}},"type":"object","required":["name","email","company"],"title":"CreateLeadRequest","description":"Body for POST /v1/leads."},"CreateNotificationRequest":{"properties":{"title":{"type":"string","maxLength":200,"minLength":1,"title":"Title"},"message":{"type":"string","minLength":1,"title":"Message"},"severity":{"type":"string","pattern":"^(info|warning|error|success)$","title":"Severity","default":"info"},"category":{"type":"string","pattern":"^(system|billing|usage|feature|maintenance)$","title":"Category","default":"system"},"target":{"type":"string","title":"Target","description":"Target: 'all', 'free', 'pro', 'enterprise', or a specific user_id","default":"all"},"dismissible":{"type":"boolean","title":"Dismissible","default":true},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"}},"type":"object","required":["title","message"],"title":"CreateNotificationRequest"},"CreatePostRequest":{"properties":{"title":{"type":"string","maxLength":200,"minLength":1,"title":"Title"},"body_markdown":{"type":"string","maxLength":50000,"minLength":1,"title":"Body Markdown"}},"type":"object","required":["title","body_markdown"],"title":"CreatePostRequest"},"CreatePostResult":{"properties":{"id":{"type":"string","title":"Id"},"slug":{"type":"string","title":"Slug"},"status":{"type":"string","title":"Status"}},"type":"object","required":["id","slug","status"],"title":"CreatePostResult"},"CreateProfileRequest":{"properties":{"name":{"type":"string","maxLength":100,"minLength":1,"title":"Name","description":"Human-readable profile name"},"fidelity":{"type":"string","title":"Fidelity","description":"Compression fidelity level"},"chunk_size":{"type":"integer","maximum":1000.0,"minimum":50.0,"title":"Chunk Size","description":"Token chunk size for segmentation","default":150},"skeleton_ratio":{"type":"number","maximum":1.0,"minimum":0.05,"title":"Skeleton Ratio","description":"Fraction of nodes kept in skeleton","default":0.2},"description":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Description","description":"Optional description"}},"type":"object","required":["name","fidelity"],"title":"CreateProfileRequest","description":"Body for POST /v1/profiles."},"CreateProjectRequest":{"properties":{"name":{"type":"string","maxLength":100,"minLength":1,"title":"Name","description":"Human-readable project name"},"description":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Description","description":"Optional project description"}},"type":"object","required":["name"],"title":"CreateProjectRequest","description":"Body for POST /v1/projects."},"CreatePromptRequest":{"properties":{"title":{"type":"string","maxLength":200,"minLength":1,"title":"Title"},"body":{"type":"string","maxLength":20000,"minLength":1,"title":"Body"}},"type":"object","required":["title","body"],"title":"CreatePromptRequest"},"CreateSandboxRequest":{"properties":{"tool":{"type":"string","pattern":"^(claude|gemini|codex)$","title":"Tool"},"owner_clerk_id":{"type":"string","maxLength":255,"minLength":1,"title":"Owner Clerk Id"},"label":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Label"},"max_lifetime_seconds":{"anyOf":[{"type":"integer","maximum":1800.0,"minimum":1.0},{"type":"null"}],"title":"Max Lifetime Seconds"}},"type":"object","required":["tool","owner_clerk_id"],"title":"CreateSandboxRequest"},"CreateSavedViewRequest":{"properties":{"name":{"type":"string","maxLength":80,"minLength":1,"title":"Name"},"filters":{"additionalProperties":true,"type":"object","title":"Filters"}},"type":"object","required":["name"],"title":"CreateSavedViewRequest"},"CreateSkillRequest":{"properties":{"name":{"type":"string","maxLength":200,"minLength":1,"title":"Name"},"tagline":{"type":"string","maxLength":300,"minLength":1,"title":"Tagline"},"category":{"type":"string","maxLength":64,"minLength":1,"title":"Category"},"artifact_type":{"type":"string","enum":["skill","mcp_server","prompt","agent"],"title":"Artifact Type","default":"skill"},"skill_markdown":{"type":"string","maxLength":524288,"minLength":1,"title":"Skill Markdown"},"install_snippet":{"type":"string","maxLength":2000,"minLength":1,"title":"Install Snippet"}},"type":"object","required":["name","tagline","category","skill_markdown","install_snippet"],"title":"CreateSkillRequest","description":"Body for ``POST /v1/skills``. No ``author_clerk_id`` field exists --\nsee module docstring (b)."},"CreateTeamRequest":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"}},"type":"object","required":["name"],"title":"CreateTeamRequest","description":"Body for POST /v1/teams."},"CreateTestKeyRequest":{"properties":{"plan":{"type":"string","enum":["free","pro","team","enterprise"],"title":"Plan","description":"Plan tier to stamp on the key."},"name":{"type":"string","maxLength":100,"minLength":1,"title":"Name"},"expires_days":{"anyOf":[{"type":"integer","maximum":365.0,"minimum":0.0},{"type":"null"}],"title":"Expires Days","description":"Optional auto-expiry in days.  0 or null means no expiry.  Helps prevent forgotten long-lived admin keys."}},"type":"object","required":["plan","name"],"title":"CreateTestKeyRequest"},"CreateTestKeyResponse":{"properties":{"key":{"type":"string","title":"Key"},"key_id":{"type":"string","title":"Key Id"},"plan":{"type":"string","title":"Plan"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"}},"type":"object","required":["key","key_id","plan","expires_at"],"title":"CreateTestKeyResponse"},"CreateWebhookRequest":{"properties":{"url":{"type":"string","maxLength":2083,"minLength":1,"format":"uri","title":"Url"},"events":{"items":{"type":"string"},"type":"array","minItems":1,"title":"Events"},"team_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Team Id"}},"type":"object","required":["url","events"],"title":"CreateWebhookRequest","description":"Body for POST /v1/webhooks."},"CrmAccountItem":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"domain":{"type":"string","title":"Domain"},"tier":{"type":"string","title":"Tier"},"seats_count":{"type":"integer","title":"Seats Count"},"mrr_usd":{"type":"number","title":"Mrr Usd"},"savings_usd":{"type":"number","title":"Savings Usd"},"health_score":{"type":"integer","title":"Health Score"},"sales_rep_id":{"type":"string","title":"Sales Rep Id"},"routing_reason":{"type":"string","title":"Routing Reason"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","name","domain","tier","seats_count","mrr_usd","savings_usd","health_score","sales_rep_id","routing_reason","created_at","updated_at"],"title":"CrmAccountItem"},"CrmActivityItem":{"properties":{"id":{"type":"string","title":"Id"},"deal_id":{"type":"string","title":"Deal Id"},"activity_type":{"type":"string","title":"Activity Type"},"body":{"type":"string","title":"Body"},"created_by_admin":{"type":"string","title":"Created By Admin"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","deal_id","activity_type","body","created_by_admin","created_at"],"title":"CrmActivityItem"},"CrmDealItem":{"properties":{"id":{"type":"string","title":"Id"},"account_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Id"},"title":{"type":"string","title":"Title"},"company":{"type":"string","title":"Company"},"lead_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lead Id"},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"},"stage":{"type":"string","title":"Stage"},"deal_value_usd":{"type":"number","title":"Deal Value Usd"},"owner_admin_id":{"type":"string","title":"Owner Admin Id"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","title","company","stage","deal_value_usd","owner_admin_id","created_at","updated_at"],"title":"CrmDealItem"},"DataExportResponse":{"properties":{"exported_at":{"type":"string","title":"Exported At"},"user_id":{"type":"string","title":"User Id"},"usage_events_count":{"type":"integer","title":"Usage Events Count"},"api_keys_count":{"type":"integer","title":"Api Keys Count"},"profiles_count":{"type":"integer","title":"Profiles Count"},"referrals_count":{"type":"integer","title":"Referrals Count"},"data":{"additionalProperties":true,"type":"object","title":"Data"}},"type":"object","required":["exported_at","user_id","usage_events_count","api_keys_count","profiles_count","referrals_count","data"],"title":"DataExportResponse","description":"GDPR Article 20 — data portability response."},"DecideResponse":{"properties":{"request_id":{"type":"string","title":"Request Id"},"status":{"type":"string","title":"Status"}},"type":"object","required":["request_id","status"],"title":"DecideResponse"},"DecideSkillRequest":{"properties":{"decision":{"type":"string","enum":["approve","reject"],"title":"Decision"},"rejection_reason":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Rejection Reason"}},"type":"object","required":["decision"],"title":"DecideSkillRequest","description":"Body for ``POST /v1/skills/{skill_id}/decide``. Deliberately carries\nONLY ``decision`` + ``rejection_reason`` -- see module docstring (a).\nAny extra field (a moderator id, a ``grant``, ``granted_via``) in the\nraw request JSON is silently dropped by Pydantic's default\n``extra=\"ignore\"`` behavior; it can never reach ``ModeratorGrant``\nconstruction below, which is built exclusively from the resolved\ncaller identity."},"DeleteResponse":{"properties":{"deleted":{"type":"boolean","title":"Deleted"},"item_id":{"type":"string","title":"Item Id"}},"type":"object","required":["deleted","item_id"],"title":"DeleteResponse"},"DemoChatPreviewRequest":{"properties":{"context":{"type":"string","maxLength":12000,"minLength":10,"title":"Context"},"instruction":{"type":"string","maxLength":2000,"minLength":1,"title":"Instruction"},"model":{"type":"string","maxLength":100,"title":"Model","default":"claude-sonnet-5"}},"type":"object","required":["context","instruction"],"title":"DemoChatPreviewRequest","description":"A chat request, priced but never sent.\n\nTWO FIELDS, NOT ONE — the same split `/v1/chat/completions` enforces. A single\n`prompt` leaves the compressor unable to tell the source material from the ask,\nand compressing the ask silently changes the question."},"DemoChatPreviewResponse":{"properties":{"demo":{"type":"boolean","title":"Demo"},"provider_called":{"type":"boolean","title":"Provider Called"},"notice":{"type":"string","title":"Notice"},"cost_basis":{"type":"string","title":"Cost Basis"},"compressed_context":{"type":"string","title":"Compressed Context"},"context_tokens_before":{"type":"integer","title":"Context Tokens Before"},"context_tokens_after":{"type":"integer","title":"Context Tokens After"},"instruction_tokens":{"type":"integer","title":"Instruction Tokens"},"request_tokens_before":{"type":"integer","title":"Request Tokens Before"},"request_tokens_after":{"type":"integer","title":"Request Tokens After"},"tokens_saved":{"type":"integer","title":"Tokens Saved"},"savings_pct":{"type":"number","title":"Savings Pct"},"compression_applied":{"type":"boolean","title":"Compression Applied"},"token_count_method":{"type":"string","title":"Token Count Method"},"model":{"type":"string","title":"Model"},"pricing_source":{"type":"string","title":"Pricing Source"},"input_cost_before_usd":{"type":"number","title":"Input Cost Before Usd"},"input_cost_after_usd":{"type":"number","title":"Input Cost After Usd"},"input_cost_saved_usd":{"type":"number","title":"Input Cost Saved Usd"}},"type":"object","required":["demo","provider_called","notice","cost_basis","compressed_context","context_tokens_before","context_tokens_after","instruction_tokens","request_tokens_before","request_tokens_after","tokens_saved","savings_pct","compression_applied","token_count_method","model","pricing_source","input_cost_before_usd","input_cost_after_usd","input_cost_saved_usd"],"title":"DemoChatPreviewResponse","description":"What the request would cost, and an explicit statement of what it is not."},"DemoCompressRequest":{"properties":{"text":{"type":"string","maxLength":12000,"minLength":10,"title":"Text"},"fidelity":{"type":"string","title":"Fidelity","default":"balanced"}},"type":"object","required":["text"],"title":"DemoCompressRequest","description":"Minimal request body for the anonymous playground."},"DemoCompressResponse":{"properties":{"compressed":{"type":"string","title":"Compressed"},"original_tokens":{"type":"integer","title":"Original Tokens"},"compressed_tokens":{"type":"integer","title":"Compressed Tokens"},"tokens_saved":{"type":"integer","title":"Tokens Saved"},"savings_pct":{"type":"number","title":"Savings Pct"}},"type":"object","required":["compressed","original_tokens","compressed_tokens","tokens_saved","savings_pct"],"title":"DemoCompressResponse","description":"Playground response with savings stats."},"DetectIssuesRequest":{"properties":{"original_text":{"type":"string","minLength":1,"title":"Original Text","description":"Original uncompressed text"},"compressed_text":{"type":"string","minLength":1,"title":"Compressed Text","description":"Compressed/generated text to check"},"check_hallucination":{"type":"boolean","title":"Check Hallucination","description":"Check for hallucinated content not in the original","default":true},"check_blind_spots":{"type":"boolean","title":"Check Blind Spots","description":"Check for critical info lost during compression","default":true}},"type":"object","required":["original_text","compressed_text"],"title":"DetectIssuesRequest","description":"Request body for issue detection."},"DetectIssuesResponse":{"properties":{"issues_found":{"type":"integer","title":"Issues Found"},"issues":{"items":{"$ref":"#/components/schemas/IssueItem"},"type":"array","title":"Issues"},"quality_score":{"type":"number","title":"Quality Score","description":"Overall quality 0.0-1.0 (1.0 = no issues)"}},"type":"object","required":["issues_found","issues","quality_score"],"title":"DetectIssuesResponse","description":"Response from issue detection."},"DeviceCodeRequest":{"properties":{"device_id":{"type":"string","maxLength":255,"minLength":1,"title":"Device Id"},"channel":{"type":"string","title":"Channel"}},"type":"object","required":["device_id","channel"],"title":"DeviceCodeRequest"},"DeviceTokenRequest":{"properties":{"device_code":{"type":"string","maxLength":256,"minLength":32,"title":"Device Code"},"device_id":{"type":"string","maxLength":255,"minLength":1,"title":"Device Id"}},"type":"object","required":["device_code","device_id"],"title":"DeviceTokenRequest"},"DiffResponse":{"properties":{"from_version_id":{"type":"string","title":"From Version Id"},"to_version_id":{"type":"string","title":"To Version Id"},"from_content":{"type":"string","title":"From Content"},"to_content":{"type":"string","title":"To Content"},"unified_diff":{"type":"string","title":"Unified Diff"}},"type":"object","required":["from_version_id","to_version_id","from_content","to_content","unified_diff"],"title":"DiffResponse"},"DispatchRequest":{"properties":{"user_ids":{"items":{"type":"string"},"type":"array","title":"User Ids"},"dry_run":{"type":"boolean","title":"Dry Run","default":false}},"type":"object","required":["user_ids"],"title":"DispatchRequest"},"DispatchResponse":{"properties":{"sent":{"type":"integer","title":"Sent"},"skipped_opt_out":{"type":"integer","title":"Skipped Opt Out"},"skipped_duplicate":{"type":"integer","title":"Skipped Duplicate"},"skipped_not_in_allowlist":{"type":"integer","title":"Skipped Not In Allowlist"},"errors":{"items":{"type":"string"},"type":"array","title":"Errors"}},"type":"object","required":["sent","skipped_opt_out","skipped_duplicate","skipped_not_in_allowlist","errors"],"title":"DispatchResponse"},"DraftItemResponse":{"properties":{"id":{"type":"string","title":"Id"},"source_slug":{"type":"string","title":"Source Slug"},"url":{"type":"string","title":"Url"},"original_title":{"type":"string","title":"Original Title"},"ingested_at":{"type":"string","title":"Ingested At"},"draft_status":{"type":"string","title":"Draft Status"},"draft_title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Draft Title"},"draft_excerpt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Draft Excerpt"},"draft_body_md":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Draft Body Md"},"draft_category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Draft Category"},"draft_model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Draft Model"},"draft_tokens_in":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Draft Tokens In"},"draft_tokens_out":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Draft Tokens Out"},"draft_cost_micros":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Draft Cost Micros"},"drafted_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Drafted At"},"reviewed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reviewed At"},"reviewed_by_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reviewed By User Id"},"rejection_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rejection Reason"},"published_article_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Published Article Id"},"draft_thumbnail_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Draft Thumbnail Url"},"attempt_generation":{"type":"integer","title":"Attempt Generation","default":0}},"type":"object","required":["id","source_slug","url","original_title","ingested_at","draft_status","draft_title","draft_excerpt","draft_body_md","draft_category","draft_model","draft_tokens_in","draft_tokens_out","draft_cost_micros","drafted_at","reviewed_at","reviewed_by_user_id","rejection_reason","published_article_id"],"title":"DraftItemResponse","description":"Single draft item shape (news_items row with draft columns)."},"DraftStatusFilter":{"type":"string","enum":["undrafted","drafting","drafted","rejected","needs_review","expired","publishing","published"],"title":"DraftStatusFilter","description":"Queue statuses accepted by the admin draft-list endpoint."},"EditArticleRequest":{"properties":{"title":{"anyOf":[{"type":"string","maxLength":512,"minLength":1},{"type":"null"}],"title":"Title"},"body_md":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"title":"Body Md"},"category":{"anyOf":[{"type":"string","maxLength":64,"minLength":1},{"type":"null"}],"title":"Category"},"hero_image_url":{"anyOf":[{"type":"string","maxLength":2048},{"type":"null"}],"title":"Hero Image Url"},"excerpt":{"anyOf":[{"type":"string","maxLength":512},{"type":"null"}],"title":"Excerpt"},"source_url":{"anyOf":[{"type":"string","maxLength":2048},{"type":"null"}],"title":"Source Url"},"source_attribution":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Attribution"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"}},"type":"object","title":"EditArticleRequest"},"EditArticleResponse":{"properties":{"id":{"type":"string","title":"Id"},"slug":{"type":"string","title":"Slug"},"title":{"type":"string","title":"Title"},"status":{"type":"string","title":"Status"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","slug","title","status","updated_at"],"title":"EditArticleResponse"},"EditCommentRequest":{"properties":{"body":{"type":"string","maxLength":10000,"minLength":1,"title":"Body"}},"type":"object","required":["body"],"title":"EditCommentRequest"},"EditRequest":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"null"}],"title":"Name"},"content":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"title":"Content"},"base_version_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Base Version Id"},"force_overwrite":{"type":"boolean","title":"Force Overwrite","default":false},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"},"fidelity":{"type":"string","enum":["abstract","outline","balanced","detailed","raw"],"title":"Fidelity","default":"balanced"},"mcp_exposed":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Mcp Exposed"}},"type":"object","title":"EditRequest","description":"PATCH /v1/projects/{project_id}/knowledge/items/{id}.\n\nAt least one of ``name``, ``content``, or ``mcp_exposed`` must be present.\n``base_version_id`` is required when ``content`` is provided."},"EmailPreferencesPatch":{"properties":{"email_opt_out":{"type":"boolean","title":"Email Opt Out"}},"type":"object","required":["email_opt_out"],"title":"EmailPreferencesPatch","description":"Payload for PATCH /v1/account/email-preferences.\n\nUses ``StrictBool`` so Pydantic's lax coercion (where ``\"yes\"`` would\nsilently become ``True``) is rejected with 422 — matching the intent\nof the ``test_patch_email_preferences_rejects_string`` regression."},"EmailPreferencesResponse":{"properties":{"email_opt_out":{"type":"boolean","title":"Email Opt Out"}},"type":"object","required":["email_opt_out"],"title":"EmailPreferencesResponse","description":"Email preference state for the authenticated user."},"EnableSkillResponse":{"properties":{"skill_id":{"type":"string","title":"Skill Id"},"enabled_at":{"type":"string","format":"date-time","title":"Enabled At"},"already_enabled":{"type":"boolean","title":"Already Enabled"}},"type":"object","required":["skill_id","enabled_at","already_enabled"],"title":"EnableSkillResponse","description":"The CURRENT state of the `(principal, skill)` enablement after the call.\n\n`already_enabled` is carried through rather than collapsed: the service went\nto real trouble to distinguish \"I just turned this on\" from \"it was already\non\", and a UI that cannot tell them apart makes a double-click look like a\nfirst enable."},"EventsResponse":{"properties":{"events":{"items":{"$ref":"#/components/schemas/CompressionEvent"},"type":"array","title":"Events"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"},"has_more":{"type":"boolean","title":"Has More"}},"type":"object","required":["events","total","page","page_size","has_more"],"title":"EventsResponse","description":"Paginated compression history."},"Favorite":{"properties":{"id":{"type":"string","title":"Id"},"kind":{"type":"string","title":"Kind"},"ref":{"type":"string","title":"Ref"},"label":{"type":"string","title":"Label"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","kind","ref","label","created_at"],"title":"Favorite"},"FeedItem":{"properties":{"id":{"type":"string","title":"Id"},"content_type":{"type":"string","enum":["news","blog","benchmark"],"title":"Content Type"},"type":{"type":"string","enum":["news","blog","benchmark"],"title":"Type"},"title":{"type":"string","title":"Title"},"sort_time":{"type":"string","format":"date-time","title":"Sort Time"},"content_slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content Slug"},"excerpt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Excerpt"},"thumbnail_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thumbnail Url"},"source_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Url"},"slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Slug"},"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"},"author_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Author Label"},"compression_ratio":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Compression Ratio"},"hardware_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hardware Text"},"model_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Text"},"tokens_per_sec":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Tokens Per Sec"},"net_score":{"type":"integer","title":"Net Score","default":0},"upvote_count":{"type":"integer","title":"Upvote Count","default":0},"downvote_count":{"type":"integer","title":"Downvote Count","default":0},"comment_count":{"type":"integer","title":"Comment Count","default":0},"hot_score":{"type":"number","title":"Hot Score","default":0.0},"user_vote":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"User Vote"},"user_bookmarked":{"type":"boolean","title":"User Bookmarked","default":false}},"type":"object","required":["id","content_type","type","title","sort_time"],"title":"FeedItem","description":"Unified feed card wire shape (mirrors the TS ``FeedItem`` in\napps/web/src/libs/gotcontext-api.ts — keep them in lockstep, F11)."},"FeedPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/FeedItem"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"FeedPage"},"FeedbackAdminPatchRequest":{"properties":{"status":{"type":"string","pattern":"^(new|triaged|planned|in_progress|shipped|declined)$","title":"Status"},"admin_notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Admin Notes"}},"type":"object","required":["status"],"title":"FeedbackAdminPatchRequest"},"FeedbackCreateRequest":{"properties":{"kind":{"type":"string","pattern":"^(bug|feature)$","title":"Kind","description":"'bug' or 'feature'"},"title":{"type":"string","maxLength":200,"minLength":1,"title":"Title"},"body":{"type":"string","maxLength":20000,"minLength":1,"title":"Body"}},"type":"object","required":["kind","title","body"],"title":"FeedbackCreateRequest"},"FeedbackListResponse":{"properties":{"submissions":{"items":{"$ref":"#/components/schemas/FeedbackResponse"},"type":"array","title":"Submissions"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["submissions","total"],"title":"FeedbackListResponse"},"FeedbackResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"kind":{"type":"string","title":"Kind"},"title":{"type":"string","title":"Title"},"body":{"type":"string","title":"Body"},"status":{"type":"string","title":"Status"},"ai_triage":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Ai Triage"},"github_issue_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Github Issue Url"},"admin_notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Admin Notes"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"triaged_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Triaged At"}},"type":"object","required":["id","kind","title","body","status","created_at","updated_at"],"title":"FeedbackResponse"},"FilterCliRequest":{"properties":{"output":{"type":"string","minLength":1,"title":"Output","description":"Raw CLI output to filter/compress"},"command_hint":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Command Hint","description":"Optional hint about the command type (e.g., 'git_diff', 'test_output'). Auto-detected if omitted."}},"type":"object","required":["output"],"title":"FilterCliRequest","description":"Request body for CLI output filtering."},"FilterCliResponse":{"properties":{"filtered":{"type":"string","title":"Filtered"},"original_chars":{"type":"integer","title":"Original Chars"},"filtered_chars":{"type":"integer","title":"Filtered Chars"},"savings_pct":{"type":"number","title":"Savings Pct"},"detected_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detected Type"}},"type":"object","required":["filtered","original_chars","filtered_chars","savings_pct"],"title":"FilterCliResponse","description":"Response from CLI output filtering."},"FinOpsMarginsResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AccountMarginItem"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"}},"type":"object","required":["items","total","page","page_size"],"title":"FinOpsMarginsResponse"},"FinOpsOverviewResponse":{"properties":{"estimated_revenue_30d_usd":{"type":"number","title":"Estimated Revenue 30D Usd","description":"Estimated 30d revenue from active subscriptions"},"platform_cogs_30d_usd":{"type":"number","title":"Platform Cogs 30D Usd","description":"Estimated platform COGS over past 30 days"},"gross_profit_30d_usd":{"type":"number","title":"Gross Profit 30D Usd","description":"Estimated gross profit (Revenue - COGS)"},"gross_margin_percent":{"type":"number","title":"Gross Margin Percent","description":"Estimated gross margin percentage"},"customer_savings_delivered_30d_usd":{"type":"number","title":"Customer Savings Delivered 30D Usd","description":"Total LLM savings delivered to customers"},"runaway_accounts_count":{"type":"integer","title":"Runaway Accounts Count","description":"Number of active accounts flagged as runaway/negative-margin"}},"type":"object","required":["estimated_revenue_30d_usd","platform_cogs_30d_usd","gross_profit_30d_usd","gross_margin_percent","customer_savings_delivered_30d_usd","runaway_accounts_count"],"title":"FinOpsOverviewResponse"},"FlagRequest":{"properties":{"reason":{"type":"string","maxLength":200,"title":"Reason"},"details":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Details"}},"type":"object","required":["reason"],"title":"FlagRequest"},"FollowStatusResponse":{"properties":{"following":{"type":"boolean","title":"Following"},"follower_count":{"type":"integer","title":"Follower Count"},"following_count":{"type":"integer","title":"Following Count"}},"type":"object","required":["following","follower_count","following_count"],"title":"FollowStatusResponse"},"FrameworkListResponse":{"properties":{"frameworks":{"items":{"$ref":"#/components/schemas/FrameworkResponse"},"type":"array","title":"Frameworks"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["frameworks","total"],"title":"FrameworkListResponse"},"FrameworkResponse":{"properties":{"slug":{"type":"string","title":"Slug"},"display_name":{"type":"string","title":"Display Name"},"version_tag":{"type":"string","title":"Version Tag"},"docs_url":{"type":"string","title":"Docs Url"},"description":{"type":"string","title":"Description"},"source_hint":{"type":"string","title":"Source Hint"},"last_ingested_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Ingested At"}},"type":"object","required":["slug","display_name","version_tag","docs_url","description","source_hint"],"title":"FrameworkResponse"},"GenerateLicenseRequest":{"properties":{"org_id":{"type":"string","maxLength":255,"minLength":1,"title":"Org Id"},"tier":{"type":"string","maxLength":50,"minLength":1,"title":"Tier"},"seats":{"type":"integer","maximum":100000.0,"minimum":1.0,"title":"Seats"},"expires_at":{"type":"string","format":"date-time","title":"Expires At"},"email":{"type":"string","maxLength":255,"minLength":3,"title":"Email"}},"type":"object","required":["org_id","tier","seats","expires_at","email"],"title":"GenerateLicenseRequest","description":"Body for POST /v1/licenses/generate."},"GenerateLicenseResponse":{"properties":{"license_id":{"type":"string","title":"License Id"},"org_id":{"type":"string","title":"Org Id"},"tier":{"type":"string","title":"Tier"},"seats":{"type":"integer","title":"Seats"},"expires_at":{"type":"string","title":"Expires At"},"license_key":{"type":"string","title":"License Key"},"email_delivery_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email Delivery Id"}},"type":"object","required":["license_id","org_id","tier","seats","expires_at","license_key","email_delivery_id"],"title":"GenerateLicenseResponse","description":"Serialized result of a generated self-hosted license."},"GenerateReferralResponse":{"properties":{"referral_code":{"type":"string","title":"Referral Code"},"referral_url":{"type":"string","title":"Referral Url"},"is_new":{"type":"boolean","title":"Is New"}},"type":"object","required":["referral_code","referral_url","is_new"],"title":"GenerateReferralResponse","description":"Response from POST /v1/referrals/generate."},"GithubIntegrationConfig":{"properties":{"token":{"type":"string","title":"Token"},"webhook_secret":{"type":"string","title":"Webhook Secret"},"repo_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Repo Url"}},"type":"object","required":["token","webhook_secret"],"title":"GithubIntegrationConfig"},"GrantAcceptRequest":{"properties":{"assistant_version_id":{"type":"string","format":"uuid","title":"Assistant Version Id"}},"type":"object","required":["assistant_version_id"],"title":"GrantAcceptRequest"},"GrantCreateRequest":{"properties":{"grantee_clerk_id":{"type":"string","title":"Grantee Clerk Id"},"version_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Version Id"}},"type":"object","required":["grantee_clerk_id"],"title":"GrantCreateRequest"},"GrantListItem":{"properties":{"grant_id":{"type":"string","format":"uuid","title":"Grant Id"},"assistant_id":{"type":"string","format":"uuid","title":"Assistant Id"},"assistant_name":{"type":"string","title":"Assistant Name"},"grantee_clerk_id":{"type":"string","title":"Grantee Clerk Id"},"granted_by_clerk_id":{"type":"string","title":"Granted By Clerk Id"},"assistant_version_id":{"type":"string","format":"uuid","title":"Assistant Version Id"},"version_no":{"type":"integer","title":"Version No"},"granted_at":{"type":"string","format":"date-time","title":"Granted At"},"accepted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Accepted At"}},"type":"object","required":["grant_id","assistant_id","assistant_name","grantee_clerk_id","granted_by_clerk_id","assistant_version_id","version_no","granted_at","accepted_at"],"title":"GrantListItem"},"GrantModeratorBody":{"properties":{"reason":{"type":"string","maxLength":1000,"minLength":1,"title":"Reason"}},"type":"object","required":["reason"],"title":"GrantModeratorBody"},"GrantResponse":{"properties":{"grant_id":{"type":"string","format":"uuid","title":"Grant Id"}},"type":"object","required":["grant_id"],"title":"GrantResponse"},"GrantShareRequest":{"properties":{"item_id":{"type":"string","format":"uuid","title":"Item Id"},"peer_id":{"type":"string","format":"uuid","title":"Peer Id"},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"}},"type":"object","required":["item_id","peer_id"],"title":"GrantShareRequest"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HardwareCreateRequest":{"properties":{"vendor_text":{"type":"string","maxLength":100,"title":"Vendor Text"},"model_text":{"type":"string","maxLength":200,"title":"Model Text"},"vram_gb":{"anyOf":[{"type":"integer","exclusiveMinimum":0.0},{"type":"null"}],"title":"Vram Gb"},"hw_metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Hw Metadata"},"gpu_count":{"type":"integer","exclusiveMinimum":0.0,"title":"Gpu Count","description":"Number of physical GPU cards (default 1)","default":1},"memory_type":{"type":"string","title":"Memory Type","description":"Memory architecture — one of ['discrete_vram', 'system_ram', 'unified_memory']","default":"discrete_vram"},"hardware_class":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hardware Class","description":"Hardware ecosystem class — one of ['amd_rocm', 'apple_silicon', 'cpu_only', 'intel_arc', 'nvidia_cuda', 'other']"}},"type":"object","required":["vendor_text","model_text"],"title":"HardwareCreateRequest"},"HardwareResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"vendor_text":{"type":"string","title":"Vendor Text"},"model_text":{"type":"string","title":"Model Text"},"vram_gb":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Vram Gb"},"canonical":{"type":"boolean","title":"Canonical"},"hw_metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Hw Metadata"},"gpu_count":{"type":"integer","title":"Gpu Count","default":1},"memory_type":{"type":"string","title":"Memory Type","default":"discrete_vram"},"hardware_class":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hardware Class"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","vendor_text","model_text","vram_gb","canonical","hw_metadata","created_at"],"title":"HardwareResponse"},"HistoryReplayReceipt":{"properties":{"reference_count":{"type":"integer","minimum":0.0,"title":"Reference Count","default":0},"replayed_reference_count":{"type":"integer","minimum":0.0,"title":"Replayed Reference Count","default":0},"omitted_reference_count":{"type":"integer","minimum":0.0,"title":"Omitted Reference Count","default":0},"deduplicated_reference_count":{"type":"integer","minimum":0.0,"title":"Deduplicated Reference Count","default":0},"dropped_message_count":{"type":"integer","minimum":0.0,"title":"Dropped Message Count","default":0},"omitted_source_count":{"type":"integer","minimum":0.0,"title":"Omitted Source Count","default":0},"limited":{"type":"boolean","title":"Limited","default":false}},"type":"object","title":"HistoryReplayReceipt"},"HitSourceBreakdown":{"properties":{"exact_hits":{"type":"integer","title":"Exact Hits"},"semantic_hits":{"type":"integer","title":"Semantic Hits"},"misses":{"type":"integer","title":"Misses"}},"type":"object","required":["exact_hits","semantic_hits","misses"],"title":"HitSourceBreakdown","description":"v1.4.0 F5 — exact vs semantic hit breakdown.\n\nThe existing ``semantic_cache`` block collapses both hit types into\none ``hits`` counter. Dashboards that want to distinguish\nbyte-identical hash hits from embedding-distance hits read from\n``by_source``. ``exact_hits`` are cache rows where\n``semantic_cache_distance = 0.0`` (the request-hash fastpath);\n``semantic_hits`` are rows where the embedding-distance fallback\nmatched; ``misses`` is the existing miss counter."},"InboundShareRequestPayload":{"properties":{"from_peer_id":{"type":"string","format":"uuid","title":"From Peer Id"},"target_project_id":{"type":"string","format":"uuid","title":"Target Project Id"},"requested_resource":{"type":"string","title":"Requested Resource"},"request_jws":{"type":"string","title":"Request Jws"}},"type":"object","required":["from_peer_id","target_project_id","requested_resource","request_jws"],"title":"InboundShareRequestPayload","description":"Public POST body for external A2A peers submitting a share request."},"InboxItemResponse":{"properties":{"id":{"type":"string","title":"Id"},"from_peer_id":{"type":"string","title":"From Peer Id"},"target_project_id":{"type":"string","title":"Target Project Id"},"requested_resource":{"type":"string","title":"Requested Resource"},"status":{"type":"string","title":"Status"},"created_at":{"type":"string","title":"Created At"},"decided_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Decided At"},"decided_by_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Decided By User Id"}},"type":"object","required":["id","from_peer_id","target_project_id","requested_resource","status","created_at","decided_at","decided_by_user_id"],"title":"InboxItemResponse"},"IncidentCluster":{"properties":{"bucket_start":{"type":"string","title":"Bucket Start"},"status":{"type":"string","title":"Status"},"count":{"type":"integer","title":"Count"},"sample_event_ids":{"items":{"type":"string"},"type":"array","title":"Sample Event Ids"}},"type":"object","required":["bucket_start","status","count","sample_event_ids"],"title":"IncidentCluster","description":"One time-bucketed status cluster."},"IncidentsResponse":{"properties":{"clusters":{"items":{"$ref":"#/components/schemas/IncidentCluster"},"type":"array","title":"Clusters"},"lookback_hours":{"type":"integer","title":"Lookback Hours"},"min_count":{"type":"integer","title":"Min Count"},"total_failures":{"type":"integer","title":"Total Failures"},"total_calls":{"type":"integer","title":"Total Calls","default":0}},"type":"object","required":["clusters","lookback_hours","min_count","total_failures"],"title":"IncidentsResponse"},"IngestErrorResult":{"properties":{"external_id":{"type":"string","title":"External Id"},"reason":{"type":"string","title":"Reason"}},"type":"object","required":["external_id","reason"],"title":"IngestErrorResult"},"IngestItemResult":{"properties":{"id":{"type":"string","title":"Id"},"external_id":{"type":"string","title":"External Id"}},"type":"object","required":["id","external_id"],"title":"IngestItemResult"},"IngestRequest":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"},"content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content","description":"Raw text content. Mutually exclusive with url."},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url","description":"URL to fetch. Mutually exclusive with content."},"type":{"type":"string","enum":["note","document","url","file","plan"],"title":"Type","default":"note"},"metadata":{"additionalProperties":true,"type":"object","title":"Metadata"},"is_ephemeral":{"type":"boolean","title":"Is Ephemeral","default":false},"fidelity":{"type":"string","enum":["abstract","outline","balanced","detailed","raw"],"title":"Fidelity","default":"balanced"}},"type":"object","required":["name"],"title":"IngestRequest","description":"POST /v1/projects/{project_id}/knowledge/items body."},"InviteTeamMemberRequest":{"properties":{"email":{"type":"string","maxLength":255,"minLength":3,"title":"Email"},"role":{"type":"string","title":"Role","default":"member"}},"type":"object","required":["email"],"title":"InviteTeamMemberRequest","description":"Body for POST /v1/teams/{id}/invites."},"IssueAttachmentRequest":{"properties":{"content_type":{"type":"string","maxLength":255,"title":"Content Type"},"idempotency_key":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Idempotency Key"}},"type":"object","required":["content_type"],"title":"IssueAttachmentRequest"},"IssueAttachmentResponse":{"properties":{"attachment_id":{"type":"string","title":"Attachment Id"},"upload_url":{"type":"string","title":"Upload Url"},"object_path":{"type":"string","title":"Object Path"},"expires_in_seconds":{"type":"integer","title":"Expires In Seconds"}},"type":"object","required":["attachment_id","upload_url","object_path","expires_in_seconds"],"title":"IssueAttachmentResponse"},"IssueItem":{"properties":{"type":{"type":"string","title":"Type","description":"hallucination or blind_spot"},"severity":{"type":"string","title":"Severity","description":"low, medium, or high"},"description":{"type":"string","title":"Description"},"location":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location"}},"type":"object","required":["type","severity","description"],"title":"IssueItem","description":"A single detected issue."},"IssueUploadRequest":{"properties":{"filename":{"type":"string","maxLength":512,"minLength":1,"title":"Filename"},"mime_type":{"type":"string","maxLength":128,"minLength":1,"title":"Mime Type"},"expected_bytes":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Expected Bytes"},"idempotency_key":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Idempotency Key"}},"type":"object","required":["filename","mime_type"],"title":"IssueUploadRequest","description":"POST /v1/projects/{project_id}/knowledge/uploads body."},"IssueUploadResponse":{"properties":{"upload_id":{"type":"string","title":"Upload Id"},"signed_url":{"type":"string","title":"Signed Url"},"expires_at":{"type":"string","title":"Expires At"},"status":{"type":"string","title":"Status"}},"type":"object","required":["upload_id","signed_url","expires_at","status"],"title":"IssueUploadResponse","description":"201 response for POST /uploads."},"ItemResponse":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"type":{"type":"string","title":"Type"},"current_version_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Version Id"},"metadata":{"additionalProperties":true,"type":"object","title":"Metadata"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"owner":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner"},"chunk_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Chunk Count"},"owner_display":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner Display"},"owner_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner Type"},"mcp_exposed":{"type":"boolean","title":"Mcp Exposed","default":true},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"item_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Item Status"}},"type":"object","required":["id","name","type","current_version_id","metadata","created_at","updated_at"],"title":"ItemResponse"},"JevPreferencesPatch":{"properties":{"jev_enabled":{"type":"boolean","title":"Jev Enabled"}},"type":"object","required":["jev_enabled"],"title":"JevPreferencesPatch"},"JevPreferencesResponse":{"properties":{"jev_enabled":{"type":"boolean","title":"Jev Enabled"}},"type":"object","required":["jev_enabled"],"title":"JevPreferencesResponse"},"KbEditRequest":{"properties":{"content":{"type":"string","minLength":1,"title":"Content","description":"New text content for the item."},"base_version_id":{"type":"string","title":"Base Version Id","description":"UUID of the current version. Used for optimistic concurrency — if stale, returns 409 with current_version_id."},"force_overwrite":{"type":"boolean","title":"Force Overwrite","description":"When True, bypass the optimistic-concurrency guard.","default":false},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata","description":"Metadata to merge into the item (top-level keys overwrite)."},"fidelity":{"type":"string","enum":["abstract","outline","balanced","detailed","raw"],"title":"Fidelity","default":"balanced"}},"type":"object","required":["content","base_version_id"],"title":"KbEditRequest","description":"PATCH /v1/kb/items/{item_id} body."},"KbEditResponse":{"properties":{"item_id":{"type":"string","title":"Item Id"},"version_id":{"type":"string","title":"Version Id"}},"type":"object","required":["item_id","version_id"],"title":"KbEditResponse"},"KbIngestRequest":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name","description":"Human-readable item name."},"content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content","description":"Raw text content. Mutually exclusive with url."},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url","description":"URL to fetch and ingest. Mutually exclusive with content."},"type":{"type":"string","enum":["note","document","url","file","plan"],"title":"Type","description":"KB item type. 'plan' = a versioned planning doc for gc_plan_* proposals.","default":"note"},"metadata":{"additionalProperties":true,"type":"object","title":"Metadata","description":"Arbitrary JSONB metadata."},"is_ephemeral":{"type":"boolean","title":"Is Ephemeral","description":"When True, mark for sweeping.","default":false},"fidelity":{"type":"string","enum":["abstract","outline","balanced","detailed","raw"],"title":"Fidelity","description":"Compression fidelity preset.","default":"balanced"}},"type":"object","required":["name"],"title":"KbIngestRequest","description":"POST /v1/kb/items body."},"KbIngestResponse":{"properties":{"item_id":{"type":"string","title":"Item Id"},"version_id":{"type":"string","title":"Version Id"}},"type":"object","required":["item_id","version_id"],"title":"KbIngestResponse"},"KbItemResponse":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"type":{"type":"string","title":"Type"},"current_version_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Version Id"},"metadata":{"additionalProperties":true,"type":"object","title":"Metadata"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","name","type","current_version_id","metadata","created_at","updated_at"],"title":"KbItemResponse"},"KbListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/KbItemResponse"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items","next_cursor"],"title":"KbListResponse"},"KbQueryChunk":{"properties":{"chunk_id":{"type":"string","title":"Chunk Id"},"item_id":{"type":"string","title":"Item Id"},"version_id":{"type":"string","title":"Version Id"},"text":{"type":"string","title":"Text"},"raw_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Raw Text"},"byte_range":{"items":{"type":"integer"},"type":"array","title":"Byte Range"},"score":{"type":"number","title":"Score"},"score_type":{"type":"string","title":"Score Type","default":"cosine"}},"type":"object","required":["chunk_id","item_id","version_id","text","byte_range","score"],"title":"KbQueryChunk"},"KbQueryRequest":{"properties":{"query_text":{"type":"string","maxLength":8000,"minLength":1,"title":"Query Text"},"k":{"type":"integer","maximum":100.0,"minimum":1.0,"title":"K","description":"Number of results (1-100).","default":10},"metadata_filter":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata Filter","description":"Optional JSONB containment filter on item metadata."},"token_budget":{"anyOf":[{"type":"integer","minimum":1.0},{"type":"null"}],"title":"Token Budget","description":"Optional cap on total tokens of content (raw_text) returned across all results; trimmed to highest-relevance chunks that fit. Always returns at least one result. Omit to return all k results."},"as_of":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"As Of","description":"Return chunks valid at this timezone-aware timestamp."},"focus_symbols":{"anyOf":[{"items":{"type":"string","maxLength":128,"minLength":1},"type":"array","maxItems":50},{"type":"null"}],"title":"Focus Symbols","description":"Up to 50 symbols used to calibrate evidence."},"root_code":{"anyOf":[{"type":"string","maxLength":40000},{"type":"null"}],"title":"Root Code","description":"Root source code for evidence calibration."},"calibrate_evidence":{"type":"boolean","title":"Calibrate Evidence","description":"Apply symbol-aware evidence calibration when context is supplied.","default":true}},"type":"object","required":["query_text"],"title":"KbQueryRequest","description":"POST /v1/kb/query body."},"KbQueryResponse":{"properties":{"results":{"items":{"$ref":"#/components/schemas/KbQueryChunk"},"type":"array","title":"Results"},"total_content_tokens":{"type":"integer","title":"Total Content Tokens","description":"Sum of raw_text token counts across returned chunks.","default":0},"token_budget_applied":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Token Budget Applied","description":"Echoes token_budget from the request; null when unset."}},"type":"object","required":["results"],"title":"KbQueryResponse"},"KbVersionResponse":{"properties":{"version_id":{"type":"string","title":"Version Id"},"version_n":{"type":"integer","title":"Version N"},"created_at":{"type":"string","title":"Created At"},"from_version_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"From Version Id"},"to_version_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"To Version Id"},"unified_diff":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unified Diff"}},"type":"object","required":["version_id","version_n","created_at"],"title":"KbVersionResponse"},"KbVersionsResponse":{"properties":{"versions":{"items":{"$ref":"#/components/schemas/KbVersionResponse"},"type":"array","title":"Versions"}},"type":"object","required":["versions"],"title":"KbVersionsResponse"},"KeyListItem":{"properties":{"key_id":{"type":"string","title":"Key Id"},"name":{"type":"string","title":"Name"},"masked_key":{"type":"string","title":"Masked Key"},"created_at":{"type":"string","title":"Created At"},"last_used":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Used"},"status":{"type":"string","title":"Status"},"default_model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Default Model"},"monthly_quota":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Monthly Quota"},"quota_alert_state":{"type":"string","title":"Quota Alert State","default":"none"},"enforce_quota":{"type":"boolean","title":"Enforce Quota","default":false},"current_period_count":{"type":"integer","title":"Current Period Count","default":0},"environment":{"type":"string","title":"Environment","default":"prod"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"},"replaces_key_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Replaces Key Id"},"replaced_by_key_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Replaced By Key Id"},"project_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Id"},"project_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Name"},"cache_invalidated":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Cache Invalidated"},"scope_model":{"type":"string","title":"Scope Model","default":"legacy"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes","default":[]},"denied_scopes":{"items":{"type":"string"},"type":"array","title":"Denied Scopes","default":[]}},"type":"object","required":["key_id","name","masked_key","created_at","last_used","status"],"title":"KeyListItem","description":"A single API key entry in the list response."},"KeyRollupRow":{"properties":{"key_id":{"type":"string","title":"Key Id"},"name":{"type":"string","title":"Name"},"compressions":{"type":"integer","title":"Compressions"},"tokens_saved":{"type":"integer","title":"Tokens Saved"},"estimated_savings_usd":{"type":"number","title":"Estimated Savings Usd"},"estimated_portion_usd":{"type":"number","title":"Estimated Portion Usd","default":0.0}},"type":"object","required":["key_id","name","compressions","tokens_saved","estimated_savings_usd"],"title":"KeyRollupRow","description":"Per-key rollup row.\n\n``estimated_savings_usd`` is computed against the user's most-\ncommon model's input price across the same period. Falls back to\nSonnet 4.6 when the user has no attributed model yet."},"KnowledgeStatsResponse":{"properties":{"items_total":{"type":"integer","title":"Items Total","description":"Total non-deleted items visible to this caller."},"items_with_stats":{"type":"integer","title":"Items With Stats","description":"Of items_total, how many carry positive original_tokens telemetry."},"original_tokens":{"type":"integer","title":"Original Tokens","description":"Sum of original_tokens across items_with_stats.","default":0},"compressed_tokens":{"type":"integer","title":"Compressed Tokens","description":"Sum of compressed_tokens across items_with_stats.","default":0}},"type":"object","required":["items_total","items_with_stats"],"title":"KnowledgeStatsResponse","description":"GET /v1/projects/{project_id}/knowledge/stats — account-wide (project-scoped)\nKB compression rollup. C6 backlog ranked slice 2 (docs/PROJECT_BACKLOG.md):\nthe KB-item analogue of the account-level chat/session savings_pct rollup\n(TokenSaverStatusPill) -- a distinct figure, never merged with that one."},"LatencyPercentilesResponse":{"properties":{"window_hours":{"type":"integer","title":"Window Hours"},"count":{"type":"integer","title":"Count"},"p50_ms":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"P50 Ms"},"p95_ms":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"P95 Ms"},"p99_ms":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"P99 Ms"}},"type":"object","required":["window_hours","count","p50_ms","p95_ms","p99_ms"],"title":"LatencyPercentilesResponse","description":"p50/p95/p99 of ``usage_events.latency_ms`` over the requested window."},"LeadResponse":{"properties":{"id":{"type":"string","title":"Id"},"source":{"type":"string","title":"Source"},"status":{"type":"string","title":"Status"}},"type":"object","required":["id","source","status"],"title":"LeadResponse","description":"Serialized result for a created lead."},"LeaderboardEntry":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"public_slug":{"type":"string","title":"Public Slug"},"model_text":{"type":"string","title":"Model Text"},"model_quant_text":{"type":"string","title":"Model Quant Text"},"hardware_text":{"type":"string","title":"Hardware Text"},"hardware_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Hardware Id"},"tokens_per_sec_output":{"type":"number","title":"Tokens Per Sec Output"},"context_length":{"type":"integer","title":"Context Length"},"batch_size":{"type":"integer","title":"Batch Size"},"ttft_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Ttft Ms"},"runtime_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Runtime Type"},"verified_status":{"type":"string","title":"Verified Status"},"submitted_by_agent":{"type":"boolean","title":"Submitted By Agent"},"lens_value":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Lens Value","description":"Value for the selected lens"},"lens_eligible":{"type":"boolean","title":"Lens Eligible","description":"False when required data for lens is missing","default":true},"created_at":{"type":"string","format":"date-time","title":"Created At"},"source_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Url"},"source_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Label"},"feed_item_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Feed Item Id"}},"type":"object","required":["id","public_slug","model_text","model_quant_text","hardware_text","hardware_id","tokens_per_sec_output","context_length","batch_size","verified_status","submitted_by_agent","created_at"],"title":"LeaderboardEntry","description":"A single leaderboard row."},"LeaderboardResponse":{"properties":{"entries":{"items":{"$ref":"#/components/schemas/LeaderboardEntry"},"type":"array","title":"Entries"},"total":{"type":"integer","title":"Total"},"lens":{"type":"string","title":"Lens"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["entries","total","lens"],"title":"LeaderboardResponse"},"LicenseValidationResponse":{"properties":{"license_id":{"type":"string","title":"License Id"},"org_id":{"type":"string","title":"Org Id"},"tier":{"type":"string","title":"Tier"},"seats":{"type":"integer","title":"Seats"},"expires_at":{"type":"string","title":"Expires At"},"grace_expires_at":{"type":"string","title":"Grace Expires At"},"status":{"type":"string","title":"Status"}},"type":"object","required":["license_id","org_id","tier","seats","expires_at","grace_expires_at","status"],"title":"LicenseValidationResponse","description":"Decoded license claims plus the evaluated lifecycle status."},"ListA2APeersResponse":{"properties":{"peers":{"items":{"$ref":"#/components/schemas/A2APeerResponse"},"type":"array","title":"Peers"}},"type":"object","required":["peers"],"title":"ListA2APeersResponse"},"ListActivitiesResponse":{"properties":{"activities":{"items":{"$ref":"#/components/schemas/CrmActivityItem"},"type":"array","title":"Activities"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["activities","total"],"title":"ListActivitiesResponse"},"ListCrmAccountsResponse":{"properties":{"accounts":{"items":{"$ref":"#/components/schemas/CrmAccountItem"},"type":"array","title":"Accounts"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["accounts","total"],"title":"ListCrmAccountsResponse"},"ListCrmDealsResponse":{"properties":{"deals":{"items":{"$ref":"#/components/schemas/CrmDealItem"},"type":"array","title":"Deals"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["deals","total"],"title":"ListCrmDealsResponse"},"ListFavoritesResponse":{"properties":{"favorites":{"items":{"$ref":"#/components/schemas/Favorite"},"type":"array","title":"Favorites"}},"type":"object","required":["favorites"],"title":"ListFavoritesResponse"},"ListInboxResponse":{"properties":{"requests":{"items":{"$ref":"#/components/schemas/InboxItemResponse"},"type":"array","title":"Requests"},"pending_count":{"type":"integer","title":"Pending Count"}},"type":"object","required":["requests","pending_count"],"title":"ListInboxResponse"},"ListItemsResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ItemResponse"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items","next_cursor"],"title":"ListItemsResponse"},"ListKeysResponse":{"properties":{"keys":{"items":{"$ref":"#/components/schemas/KeyListItem"},"type":"array","title":"Keys"}},"type":"object","required":["keys"],"title":"ListKeysResponse","description":"List of API keys for the authenticated user."},"ListMcpClientsResponse":{"properties":{"clients":{"items":{"$ref":"#/components/schemas/McpClientSummaryOut"},"type":"array","title":"Clients"}},"type":"object","required":["clients"],"title":"ListMcpClientsResponse"},"ListMembershipsResponse":{"properties":{"memberships":{"items":{"$ref":"#/components/schemas/MembershipResponse"},"type":"array","title":"Memberships"}},"type":"object","required":["memberships"],"title":"ListMembershipsResponse"},"ListPromptsResponse":{"properties":{"prompts":{"items":{"$ref":"#/components/schemas/Prompt"},"type":"array","title":"Prompts"}},"type":"object","required":["prompts"],"title":"ListPromptsResponse"},"ListSavedViewsResponse":{"properties":{"views":{"items":{"$ref":"#/components/schemas/SavedView"},"type":"array","title":"Views"}},"type":"object","required":["views"],"title":"ListSavedViewsResponse"},"ListSharesResponse":{"properties":{"shares":{"items":{"$ref":"#/components/schemas/ShareResponse"},"type":"array","title":"Shares"}},"type":"object","required":["shares"],"title":"ListSharesResponse"},"ListTaskBoardResponse":{"properties":{"tasks":{"items":{"$ref":"#/components/schemas/TaskBoardRow"},"type":"array","title":"Tasks"}},"type":"object","required":["tasks"],"title":"ListTaskBoardResponse"},"ListTestKeysResponse":{"properties":{"keys":{"items":{"$ref":"#/components/schemas/TestKeyListItem"},"type":"array","title":"Keys"}},"type":"object","required":["keys"],"title":"ListTestKeysResponse"},"ListUsersResponse":{"properties":{"users":{"items":{"$ref":"#/components/schemas/AdminUserItem"},"type":"array","title":"Users"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["users","total"],"title":"ListUsersResponse"},"MarkUploadCompleteRequest":{"properties":{"actual_mime":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}],"title":"Actual Mime"},"actual_bytes":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Actual Bytes"},"content_hash":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}],"title":"Content Hash"}},"type":"object","title":"MarkUploadCompleteRequest","description":"POST /v1/projects/{project_id}/knowledge/uploads/{upload_id}/complete body."},"McpClientSummaryOut":{"properties":{"key_id":{"type":"string","title":"Key Id"},"name":{"type":"string","title":"Name"},"last_active_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Active At"},"call_count_30d":{"type":"integer","title":"Call Count 30D"},"kb_item_allowlist":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Kb Item Allowlist"},"tool_allowlist":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tool Allowlist"}},"type":"object","required":["key_id","name","call_count_30d"],"title":"McpClientSummaryOut"},"McpReloadResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"previous_count":{"type":"integer","title":"Previous Count"},"current_count":{"type":"integer","title":"Current Count"},"added":{"items":{"type":"string"},"type":"array","title":"Added"},"removed":{"items":{"type":"string"},"type":"array","title":"Removed"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["success","previous_count","current_count","added","removed"],"title":"McpReloadResponse"},"McpToolsResponse":{"properties":{"tools":{"items":{"$ref":"#/components/schemas/ToolInfo"},"type":"array","title":"Tools"},"total":{"type":"integer","title":"Total"},"plan":{"type":"string","title":"Plan"},"available_count":{"type":"integer","title":"Available Count"}},"type":"object","required":["tools","total","plan","available_count"],"title":"McpToolsResponse"},"MediaAssetResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"kind":{"type":"string","enum":["image","video"],"title":"Kind"},"media_type":{"type":"string","title":"Media Type"},"size_bytes":{"type":"integer","title":"Size Bytes"},"width":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Width"},"height":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Height"}},"type":"object","required":["id","kind","media_type","size_bytes"],"title":"MediaAssetResponse"},"MediaDefaultSources":{"properties":{"video":{"anyOf":[{"type":"string","enum":["user","workspace"]},{"type":"null"}],"title":"Video"},"image":{"anyOf":[{"type":"string","enum":["user","workspace"]},{"type":"null"}],"title":"Image"}},"type":"object","title":"MediaDefaultSources"},"MediaJobPart":{"properties":{"type":{"type":"string","const":"media_job","title":"Type"},"job_id":{"type":"string","format":"uuid","title":"Job Id"},"kind":{"type":"string","enum":["image","video"],"title":"Kind"}},"type":"object","required":["type","job_id","kind"],"title":"MediaJobPart"},"MediaJobRequest":{"properties":{"quote_id":{"type":"string","format":"uuid","title":"Quote Id"},"idempotency_key":{"type":"string","maxLength":200,"minLength":1,"title":"Idempotency Key"}},"additionalProperties":false,"type":"object","required":["quote_id","idempotency_key"],"title":"MediaJobRequest"},"MediaJobResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"conversation_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Conversation Id"},"assistant_message_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Assistant Message Id"},"kind":{"type":"string","enum":["image","video"],"title":"Kind"},"model":{"type":"string","title":"Model"},"status":{"type":"string","enum":["queued","generating","saving","ready","failed","unknown","cancelled","deleted"],"title":"Status"},"diagnostic_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Diagnostic Code"},"max_cost_micros":{"type":"integer","title":"Max Cost Micros"},"provider_cost_micros":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Provider Cost Micros"},"assets":{"items":{"$ref":"#/components/schemas/MediaAssetResponse"},"type":"array","title":"Assets"},"can_cancel":{"type":"boolean","title":"Can Cancel"},"can_retry_delivery":{"type":"boolean","title":"Can Retry Delivery"}},"type":"object","required":["id","conversation_id","assistant_message_id","kind","model","status","diagnostic_code","max_cost_micros","provider_cost_micros","assets","can_cancel","can_retry_delivery"],"title":"MediaJobResponse"},"MediaModelDefault":{"properties":{"provider":{"type":"string","enum":["openrouter","openai"],"title":"Provider"},"model":{"type":"string","maxLength":200,"minLength":1,"title":"Model"}},"additionalProperties":false,"type":"object","required":["provider","model"],"title":"MediaModelDefault"},"MediaModelDefaults":{"properties":{"video":{"anyOf":[{"$ref":"#/components/schemas/MediaModelDefault"},{"type":"null"}]},"image":{"anyOf":[{"$ref":"#/components/schemas/MediaModelDefault"},{"type":"null"}]}},"additionalProperties":false,"type":"object","title":"MediaModelDefaults"},"MediaModelPreferencesPatch":{"properties":{"video":{"anyOf":[{"$ref":"#/components/schemas/MediaModelDefault"},{"type":"null"}]},"image":{"anyOf":[{"$ref":"#/components/schemas/MediaModelDefault"},{"type":"null"}]},"scope":{"type":"string","enum":["user","workspace"],"title":"Scope"},"project_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"}},"additionalProperties":false,"type":"object","required":["scope"],"title":"MediaModelPreferencesPatch"},"MediaModelPreferencesResponse":{"properties":{"user_defaults":{"$ref":"#/components/schemas/MediaModelDefaults"},"workspace_defaults":{"$ref":"#/components/schemas/MediaModelDefaults"},"effective_defaults":{"$ref":"#/components/schemas/MediaModelDefaults"},"effective_sources":{"$ref":"#/components/schemas/MediaDefaultSources"},"workspace_can_edit":{"type":"boolean","title":"Workspace Can Edit"}},"type":"object","required":["user_defaults","workspace_defaults","effective_defaults","effective_sources","workspace_can_edit"],"title":"MediaModelPreferencesResponse"},"MediaQuoteRequest":{"properties":{"credential_id":{"type":"string","format":"uuid","title":"Credential Id"},"project_id":{"type":"string","format":"uuid","title":"Project Id"},"conversation_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Conversation Id"},"model":{"type":"string","maxLength":200,"minLength":1,"title":"Model"},"kind":{"type":"string","enum":["image","video"],"title":"Kind"},"prompt":{"type":"string","maxLength":4096,"minLength":1,"title":"Prompt"},"duration":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Duration"},"aspect_ratio":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Aspect Ratio"},"resolution":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Resolution"},"size":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Size"},"generate_audio":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Generate Audio"}},"additionalProperties":false,"type":"object","required":["credential_id","project_id","model","kind","prompt"],"title":"MediaQuoteRequest"},"MediaQuoteResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"provider":{"type":"string","title":"Provider"},"model":{"type":"string","title":"Model"},"kind":{"type":"string","enum":["image","video"],"title":"Kind"},"max_cost_micros":{"type":"integer","title":"Max Cost Micros"},"expires_at":{"type":"string","format":"date-time","title":"Expires At"},"parameters":{"additionalProperties":true,"type":"object","title":"Parameters"}},"type":"object","required":["id","provider","model","kind","max_cost_micros","expires_at","parameters"],"title":"MediaQuoteResponse"},"MembershipResponse":{"properties":{"item_id":{"type":"string","title":"Item Id"},"owner_project_id":{"type":"string","title":"Owner Project Id"},"member_project_id":{"type":"string","title":"Member Project Id"},"added_at":{"type":"string","title":"Added At"},"added_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Added By"}},"type":"object","required":["item_id","owner_project_id","member_project_id","added_at","added_by"],"title":"MembershipResponse","description":"A single membership row serialised for the API response."},"MessageOut":{"properties":{"id":{"type":"string","title":"Id"},"parent_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Id"},"role":{"type":"string","title":"Role"},"content":{"type":"string","title":"Content"},"parts":{"anyOf":[{"items":{"$ref":"#/components/schemas/MediaJobPart"},"type":"array"},{"type":"null"}],"title":"Parts"},"research":{"anyOf":[{"$ref":"#/components/schemas/ResearchReceipt"},{"type":"null"}]},"history_replay":{"anyOf":[{"$ref":"#/components/schemas/HistoryReplayReceipt"},{"type":"null"}]},"stopped":{"type":"boolean","title":"Stopped","default":false},"stream_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stream Error"},"reasoning":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reasoning"},"provider":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"},"tokens_in":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tokens In"},"tokens_out":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tokens Out"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"additionalProperties":false,"type":"object","required":["id","parent_id","role","content","reasoning","provider","model","tokens_in","tokens_out","created_at"],"title":"MessageOut"},"MeterUsageResponse":{"properties":{"count":{"type":"integer","title":"Count"},"event_name":{"type":"string","title":"Event Name"},"period":{"type":"string","title":"Period"},"degraded":{"type":"boolean","title":"Degraded","default":false}},"type":"object","required":["count","event_name","period"],"title":"MeterUsageResponse","description":"Current-period metered-usage count for the authenticated user."},"MeteringAcceptedResponse":{"properties":{"status":{"type":"string","title":"Status"},"org_id":{"type":"string","title":"Org Id"},"license_status":{"type":"string","title":"License Status"}},"type":"object","required":["status","org_id","license_status"],"title":"MeteringAcceptedResponse","description":"Acknowledgement of a persisted metering report."},"MeteringReportRequest":{"properties":{"org_id":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Org Id"},"compressions":{"type":"integer","minimum":0.0,"title":"Compressions"},"tokens":{"type":"integer","minimum":0.0,"title":"Tokens"},"active_users":{"type":"integer","minimum":0.0,"title":"Active Users"},"period_start":{"type":"string","format":"date-time","title":"Period Start"},"period_end":{"type":"string","format":"date-time","title":"Period End"},"collection_error":{"type":"boolean","title":"Collection Error","default":false}},"type":"object","required":["compressions","tokens","active_users","period_start","period_end"],"title":"MeteringReportRequest","description":"Body for POST /v1/metering."},"ModelListItem":{"properties":{"model":{"type":"string","title":"Model"},"provider":{"type":"string","title":"Provider"},"input_per_1k":{"type":"number","title":"Input Per 1K","description":"USD per 1k input tokens."},"output_per_1k":{"type":"number","title":"Output Per 1K","description":"USD per 1k output tokens."},"callable":{"type":"boolean","title":"Callable","description":"True when this API can actually SEND a request to this model. The catalogue is a PRICING list and is strictly wider — a model can be priceable for cost attribution while no provider adapter exists for it. Model pickers must filter on this."}},"type":"object","required":["model","provider","input_per_1k","output_per_1k","callable"],"title":"ModelListItem"},"ModelListResponse":{"properties":{"models":{"items":{"$ref":"#/components/schemas/ModelListItem"},"type":"array","title":"Models"}},"type":"object","required":["models"],"title":"ModelListResponse"},"ModelRollupItem":{"properties":{"model":{"type":"string","title":"Model"},"model_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Source"},"compressions":{"type":"integer","title":"Compressions"},"tokens_in":{"type":"integer","title":"Tokens In"},"tokens_saved":{"type":"integer","title":"Tokens Saved"},"estimated_cost_saved_usd":{"type":"number","title":"Estimated Cost Saved Usd"},"estimated_portion_usd":{"type":"number","title":"Estimated Portion Usd"}},"type":"object","required":["model","model_source","compressions","tokens_in","tokens_saved","estimated_cost_saved_usd","estimated_portion_usd"],"title":"ModelRollupItem"},"ModerateRequest":{"properties":{"action":{"type":"string","pattern":"^(approve|reject)$","title":"Action"}},"type":"object","required":["action"],"title":"ModerateRequest","description":"Request body for POST /v1/benchmarks/comments/{comment_id}/moderate."},"ModerationQueueResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CommentResponse"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["items","total"],"title":"ModerationQueueResponse","description":"Response shape for GET /v1/benchmarks/moderation-queue."},"ModeratorReasonBody":{"properties":{"reason":{"type":"string","maxLength":1000,"minLength":1,"title":"Reason"}},"type":"object","required":["reason"],"title":"ModeratorReasonBody"},"MultiLevelOutput":{"properties":{"headline":{"type":"string","title":"Headline","description":"~10% kept — navigation-level summary"},"summary":{"type":"string","title":"Summary","description":"~30% kept — key points preserved"},"full":{"type":"string","title":"Full","description":"Compressed at the requested fidelity level"}},"type":"object","required":["headline","summary","full"],"title":"MultiLevelOutput","description":"Three compression tiers returned by multi_level mode."},"MySandboxSession":{"properties":{"id":{"type":"string","title":"Id"},"tool":{"type":"string","title":"Tool"},"status":{"type":"string","title":"Status"},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"last_seen_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Seen At"}},"type":"object","required":["id","tool","status","label","created_at","last_seen_at"],"title":"MySandboxSession"},"MySandboxSessionsResponse":{"properties":{"sessions":{"items":{"$ref":"#/components/schemas/MySandboxSession"},"type":"array","title":"Sessions"}},"type":"object","required":["sessions"],"title":"MySandboxSessionsResponse"},"MySkillListResponse":{"properties":{"skills":{"items":{"$ref":"#/components/schemas/CommunitySkillResponse"},"type":"array","title":"Skills"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"},"has_more":{"type":"boolean","title":"Has More"}},"type":"object","required":["skills","limit","offset","has_more"],"title":"MySkillListResponse","description":"The author's own listing (#483).\n\nSame envelope as ``SkillListResponse`` but the items are the FULL\n``CommunitySkillResponse`` rather than the trimmed public list item,\nbecause this endpoint exists to surface the scan verdict to its author."},"NewsArticleDetail":{"properties":{"id":{"type":"string","title":"Id"},"slug":{"type":"string","title":"Slug"},"title":{"type":"string","title":"Title"},"body_md":{"type":"string","title":"Body Md"},"excerpt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Excerpt"},"category":{"type":"string","title":"Category"},"status":{"type":"string","title":"Status"},"published_at":{"type":"string","title":"Published At"},"hero_image_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hero Image Url"},"source_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Url"},"source_attribution":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Attribution"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","slug","title","body_md","excerpt","category","status","published_at","hero_image_url","source_url","source_attribution","created_at","updated_at"],"title":"NewsArticleDetail","description":"Full article shape for the detail endpoint."},"NewsArticleListItem":{"properties":{"id":{"type":"string","title":"Id"},"slug":{"type":"string","title":"Slug"},"title":{"type":"string","title":"Title"},"excerpt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Excerpt"},"category":{"type":"string","title":"Category"},"status":{"type":"string","title":"Status"},"published_at":{"type":"string","title":"Published At"},"hero_image_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hero Image Url"},"source_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Url"},"source_attribution":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Attribution"}},"type":"object","required":["id","slug","title","excerpt","category","status","published_at","hero_image_url","source_url","source_attribution"],"title":"NewsArticleListItem","description":"Compact article shape for the listing endpoint."},"NewsCategoryItem":{"properties":{"category":{"type":"string","title":"Category"},"count":{"type":"integer","title":"Count"}},"type":"object","required":["category","count"],"title":"NewsCategoryItem"},"NewsListResponse":{"properties":{"articles":{"items":{"$ref":"#/components/schemas/NewsArticleListItem"},"type":"array","title":"Articles"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["articles","next_cursor"],"title":"NewsListResponse"},"NewsSubscribeRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"},"source":{"type":"string","maxLength":64,"title":"Source","description":"Capture surface — 'inline-form', 'subscribe-page', 'rss-fallback'","default":"inline-form"},"website":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Website","description":"Honeypot — humans leave this blank; bots fill it"}},"type":"object","required":["email"],"title":"NewsSubscribeRequest"},"NewsSubscribeResponse":{"properties":{"ok":{"type":"boolean","title":"Ok"},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["ok","detail"],"title":"NewsSubscribeResponse"},"NotificationItem":{"properties":{"id":{"type":"string","title":"Id"},"type":{"type":"string","title":"Type"},"actor_username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor Username"},"target_type":{"type":"string","title":"Target Type"},"target_id":{"type":"string","title":"Target Id"},"body":{"type":"string","title":"Body"},"is_read":{"type":"boolean","title":"Is Read"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","type","target_type","target_id","body","is_read","created_at"],"title":"NotificationItem","description":"A single user_activity_notification row (for the notifications-only list)."},"NotificationResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"severity":{"type":"string","title":"Severity"},"category":{"type":"string","title":"Category"},"title":{"type":"string","title":"Title"},"message":{"type":"string","title":"Message"},"target":{"type":"string","title":"Target"},"dismissible":{"type":"boolean","title":"Dismissible"},"starts_at":{"type":"string","format":"date-time","title":"Starts At"},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"},"created_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","severity","category","title","message","target","dismissible","starts_at","expires_at","created_by","created_at"],"title":"NotificationResponse"},"NotificationsResponse":{"properties":{"notifications":{"items":{"$ref":"#/components/schemas/NotificationItem"},"type":"array","title":"Notifications"},"unread_count":{"type":"integer","title":"Unread Count"}},"type":"object","required":["notifications","unread_count"],"title":"NotificationsResponse"},"NotionIntegrationConfig":{"properties":{"token":{"type":"string","title":"Token"}},"type":"object","required":["token"],"title":"NotionIntegrationConfig"},"OrderItem":{"properties":{"id":{"type":"string","title":"Id"},"amount_cents":{"type":"integer","title":"Amount Cents"},"currency":{"type":"string","title":"Currency"},"status":{"type":"string","title":"Status"},"invoice_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Number"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","amount_cents","currency","status","created_at"],"title":"OrderItem","description":"A single Polar order record."},"OveragePreviewResponse":{"properties":{"plan":{"type":"string","title":"Plan"},"included_units":{"type":"integer","title":"Included Units"},"used_units":{"type":"integer","title":"Used Units"},"overage_units":{"type":"integer","title":"Overage Units"},"unit_amount_cents":{"type":"integer","title":"Unit Amount Cents"},"overage_cost_cents":{"type":"integer","title":"Overage Cost Cents"},"cap_amount_cents":{"type":"integer","title":"Cap Amount Cents"},"billed_cost_cents":{"type":"integer","title":"Billed Cost Cents"},"currency":{"type":"string","title":"Currency","default":"usd"},"period":{"type":"string","title":"Period"},"degraded":{"type":"boolean","title":"Degraded","default":false}},"type":"object","required":["plan","included_units","used_units","overage_units","unit_amount_cents","overage_cost_cents","cap_amount_cents","billed_cost_cents","period"],"title":"OveragePreviewResponse","description":"Projected overage cost for the current billing period."},"OwnerSandboxStopResponse":{"properties":{"session_id":{"type":"string","title":"Session Id"},"status":{"type":"string","enum":["STOPPING","STOPPED","FAILED"],"title":"Status"},"already_terminal":{"type":"boolean","title":"Already Terminal"},"cleanup_error":{"type":"boolean","title":"Cleanup Error"}},"type":"object","required":["session_id","status","already_terminal","cleanup_error"],"title":"OwnerSandboxStopResponse"},"PatchConversationIn":{"properties":{"title":{"anyOf":[{"type":"string","maxLength":400},{"type":"null"}],"title":"Title"},"draft_text":{"anyOf":[{"type":"string","maxLength":100000},{"type":"null"}],"title":"Draft Text"},"pinned":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Pinned"},"archived":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Archived"},"current_message_id":{"anyOf":[{"type":"string","maxLength":36},{"type":"null"}],"title":"Current Message Id"}},"additionalProperties":false,"type":"object","title":"PatchConversationIn","description":"Every field optional, and None means UNCHANGED, not \"clear\".\n\nA client sending only `pinned` must not blank the title it never mentioned.\nClearing a title is expressed by sending a new one, not by omission."},"PatchDealBody":{"properties":{"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"company":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company"},"stage":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stage"},"deal_value_usd":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Deal Value Usd"},"owner_admin_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner Admin Id"}},"type":"object","title":"PatchDealBody"},"PatchDraftRequest":{"properties":{"draft_title":{"anyOf":[{"type":"string","maxLength":80},{"type":"null"}],"title":"Draft Title"},"draft_body_md":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"title":"Draft Body Md"},"draft_excerpt":{"anyOf":[{"type":"string","maxLength":220},{"type":"null"}],"title":"Draft Excerpt"},"draft_category":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Draft Category"}},"type":"object","title":"PatchDraftRequest","description":"Partial update for a draft item."},"PatchDraftResponse":{"properties":{"id":{"type":"string","title":"Id"},"draft_status":{"type":"string","title":"Draft Status"},"draft_title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Draft Title"},"draft_excerpt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Draft Excerpt"},"draft_category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Draft Category"}},"type":"object","required":["id","draft_status","draft_title","draft_excerpt","draft_category"],"title":"PatchDraftResponse"},"PatchUserBody":{"properties":{"plan":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Plan","description":"New billing plan for the user."},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status","description":"New account status: active | flagged | disabled."}},"type":"object","title":"PatchUserBody","description":"Payload for PATCH /v1/admin/users/v2/{id}.\n\nAt least one of plan / status must be provided. The endpoint rejects\na body with neither field set (HTTP 422)."},"PercentileResponse":{"properties":{"percentile":{"type":"number","title":"Percentile"},"tier":{"type":"string","title":"Tier"},"count":{"type":"integer","title":"Count"},"metric_name":{"type":"string","title":"Metric Name"}},"type":"object","required":["percentile","tier","count","metric_name"],"title":"PercentileResponse","description":"Response shape for GET /v1/benchmarks/runs/{run_id}/percentile."},"PlanVersionResponse":{"properties":{"version_id":{"type":"string","title":"Version Id"},"version_n":{"type":"integer","title":"Version N"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"merged_from_proposal_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Merged From Proposal Id"},"authored_by_peer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authored By Peer Id"},"authored_by_peer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authored By Peer Name"},"proposal_title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Proposal Title"}},"type":"object","required":["version_id","version_n","created_at","merged_from_proposal_id","authored_by_peer_id","authored_by_peer_name","proposal_title"],"title":"PlanVersionResponse"},"PlanVersionsResponse":{"properties":{"versions":{"items":{"$ref":"#/components/schemas/PlanVersionResponse"},"type":"array","title":"Versions"}},"type":"object","required":["versions"],"title":"PlanVersionsResponse"},"PortalResponse":{"properties":{"portal_url":{"type":"string","title":"Portal Url"}},"type":"object","required":["portal_url"],"title":"PortalResponse","description":"Response containing the Polar customer portal URL."},"PqlScanDetailItem":{"properties":{"user_id":{"type":"string","title":"User Id"},"email":{"type":"string","title":"Email"},"plan":{"type":"string","title":"Plan"},"trigger_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Trigger Type"},"suggested_deal_value":{"type":"number","title":"Suggested Deal Value","default":0.0},"reason":{"type":"string","title":"Reason","default":""}},"type":"object","required":["user_id","email","plan"],"title":"PqlScanDetailItem"},"PreviewResponse":{"properties":{"period_days":{"type":"integer","title":"Period Days"},"candidates":{"items":{"$ref":"#/components/schemas/CandidateRow"},"type":"array","title":"Candidates"},"skipped_opt_out":{"type":"integer","title":"Skipped Opt Out"},"total_projected_savings_usd":{"type":"number","title":"Total Projected Savings Usd"}},"type":"object","required":["period_days","candidates","skipped_opt_out","total_projected_savings_usd"],"title":"PreviewResponse"},"ProfileListResponse":{"properties":{"profiles":{"items":{"$ref":"#/components/schemas/ProfileResponse"},"type":"array","title":"Profiles"}},"type":"object","required":["profiles"],"title":"ProfileListResponse","description":"List of fidelity profiles."},"ProfileResponse":{"properties":{"id":{"type":"integer","title":"Id"},"user_id":{"type":"string","title":"User Id"},"name":{"type":"string","title":"Name"},"fidelity":{"type":"string","title":"Fidelity"},"chunk_size":{"type":"integer","title":"Chunk Size"},"skeleton_ratio":{"type":"number","title":"Skeleton Ratio"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","user_id","name","fidelity","chunk_size","skeleton_ratio","description","created_at"],"title":"ProfileResponse","description":"A single fidelity profile."},"ProjectDetailResponse":{"properties":{"id":{"type":"string","title":"Id"},"user_id":{"type":"string","title":"User Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated At"},"current_period_compressions":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Current Period Compressions"},"is_default":{"type":"boolean","title":"Is Default","default":false},"jev_enabled":{"type":"boolean","title":"Jev Enabled","default":true},"total_compressions":{"type":"integer","title":"Total Compressions"},"total_tokens_in":{"type":"integer","title":"Total Tokens In"},"total_tokens_saved":{"type":"integer","title":"Total Tokens Saved"},"batch_job_count":{"type":"integer","title":"Batch Job Count"}},"type":"object","required":["id","user_id","name","description","created_at","updated_at","total_compressions","total_tokens_in","total_tokens_saved","batch_job_count"],"title":"ProjectDetailResponse","description":"Project with aggregated usage stats."},"ProjectListResponse":{"properties":{"projects":{"items":{"$ref":"#/components/schemas/ProjectResponse"},"type":"array","title":"Projects"}},"type":"object","required":["projects"],"title":"ProjectListResponse","description":"List of projects."},"ProjectModelBreakdown":{"properties":{"model":{"type":"string","title":"Model"},"count":{"type":"integer","title":"Count"},"savings_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Savings Pct"}},"type":"object","required":["model","count","savings_pct"],"title":"ProjectModelBreakdown","description":"Per-model usage breakdown for the current period."},"ProjectResponse":{"properties":{"id":{"type":"string","title":"Id"},"user_id":{"type":"string","title":"User Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated At"},"current_period_compressions":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Current Period Compressions"},"is_default":{"type":"boolean","title":"Is Default","default":false},"jev_enabled":{"type":"boolean","title":"Jev Enabled","default":true}},"type":"object","required":["id","user_id","name","description","created_at","updated_at"],"title":"ProjectResponse","description":"A single project."},"ProjectSummary":{"properties":{"project_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Id"},"project_name":{"type":"string","title":"Project Name"},"compressions":{"type":"integer","title":"Compressions"},"tokens_in":{"type":"integer","title":"Tokens In"},"tokens_saved":{"type":"integer","title":"Tokens Saved"},"savings_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Savings Pct"},"estimated_cost_saved_usd":{"type":"number","title":"Estimated Cost Saved Usd"},"estimated_portion_usd":{"type":"number","title":"Estimated Portion Usd","default":0.0}},"type":"object","required":["project_id","project_name","compressions","tokens_in","tokens_saved","savings_pct","estimated_cost_saved_usd"],"title":"ProjectSummary"},"ProjectUsageResponse":{"properties":{"project_id":{"type":"string","title":"Project Id"},"project_name":{"type":"string","title":"Project Name"},"period":{"type":"string","title":"Period"},"period_start":{"type":"string","title":"Period Start"},"period_end":{"type":"string","title":"Period End"},"compressions_used":{"type":"integer","title":"Compressions Used"},"tokens_in":{"type":"integer","title":"Tokens In"},"tokens_saved":{"type":"integer","title":"Tokens Saved"},"plan":{"type":"string","title":"Plan","default":"free"},"compressions_limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Compressions Limit"},"models":{"items":{"$ref":"#/components/schemas/ProjectModelBreakdown"},"type":"array","title":"Models"},"savings_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Savings Pct"},"savings_rows":{"type":"integer","title":"Savings Rows","default":0}},"type":"object","required":["project_id","project_name","period","period_start","period_end","compressions_used","tokens_in","tokens_saved"],"title":"ProjectUsageResponse","description":"Project-scoped usage for the current calendar month."},"PromoteResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"canonical":{"type":"boolean","title":"Canonical"},"approved_by_admin":{"type":"boolean","title":"Approved By Admin"},"message":{"type":"string","title":"Message"}},"type":"object","required":["id","canonical","approved_by_admin","message"],"title":"PromoteResponse"},"Prompt":{"properties":{"id":{"type":"string","title":"Id"},"title":{"type":"string","title":"Title"},"body":{"type":"string","title":"Body"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","title","body","created_at","updated_at"],"title":"Prompt"},"ProposalListResponse":{"properties":{"proposals":{"items":{"$ref":"#/components/schemas/ProposalResponse"},"type":"array","title":"Proposals"}},"type":"object","required":["proposals"],"title":"ProposalListResponse"},"ProposalResponse":{"properties":{"id":{"type":"string","title":"Id"},"item_id":{"type":"string","title":"Item Id"},"project_id":{"type":"string","title":"Project Id"},"base_version_id":{"type":"string","title":"Base Version Id"},"proposer_peer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Proposer Peer Id"},"proposal_jws":{"type":"string","title":"Proposal Jws"},"diff":{"type":"string","title":"Diff"},"diff_sha256":{"type":"string","title":"Diff Sha256"},"title":{"type":"string","title":"Title"},"rationale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rationale"},"status":{"type":"string","title":"Status"},"stale_base":{"type":"boolean","title":"Stale Base"},"result_version_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Result Version Id"},"decided_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Decided By"},"decided_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Decided At"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"}},"type":"object","required":["id","item_id","project_id","base_version_id","proposer_peer_id","proposal_jws","diff","diff_sha256","title","rationale","status","stale_base","result_version_id","decided_by","decided_at","created_at","expires_at"],"title":"ProposalResponse"},"ProposeRequest":{"properties":{"from_peer_id":{"type":"string","format":"uuid","title":"From Peer Id"},"proof_jws":{"type":"string","title":"Proof Jws"},"item_id":{"type":"string","format":"uuid","title":"Item Id"},"base_version_id":{"type":"string","format":"uuid","title":"Base Version Id"},"diff":{"type":"string","title":"Diff"},"title":{"type":"string","title":"Title"},"rationale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rationale"}},"type":"object","required":["from_peer_id","proof_jws","item_id","base_version_id","diff","title"],"title":"ProposeRequest"},"ProviderCredentialListResponse":{"properties":{"credentials":{"items":{"$ref":"#/components/schemas/ProviderCredentialResponse"},"type":"array","title":"Credentials"},"supported_providers":{"items":{"type":"string"},"type":"array","title":"Supported Providers"}},"type":"object","required":["credentials"],"title":"ProviderCredentialListResponse"},"ProviderCredentialResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"provider":{"type":"string","title":"Provider"},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"},"masked_tail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Masked Tail"},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At"},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated At"},"last_used_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Used At"},"base_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Base Url"}},"type":"object","required":["id","provider"],"title":"ProviderCredentialResponse","description":"The wire allowlist. Every field here is safe to show; nothing else ships.\n\nMirrors `provider_credentials._PUBLIC_FIELDS`. If that tuple grows, this\nmust be updated deliberately — that friction is the feature."},"ProviderModelEntry":{"properties":{"id":{"type":"string","title":"Id"},"display_name":{"type":"string","title":"Display Name"},"kind":{"anyOf":[{"type":"string","enum":["image","video"]},{"type":"null"}],"title":"Kind"},"aspect_ratios":{"items":{"type":"string"},"type":"array","title":"Aspect Ratios"},"sizes":{"items":{"type":"string"},"type":"array","title":"Sizes"},"resolutions":{"items":{"type":"string"},"type":"array","title":"Resolutions"},"durations":{"items":{"type":"integer"},"type":"array","title":"Durations"},"max_outputs":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Outputs"},"provider":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider"},"selectable":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Selectable"},"default_parameters":{"additionalProperties":true,"type":"object","title":"Default Parameters"},"unavailable_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unavailable Reason"},"estimated_max_cost_micros":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Estimated Max Cost Micros"}},"type":"object","required":["id","display_name"],"title":"ProviderModelEntry"},"ProviderModelsResponse":{"properties":{"provider":{"type":"string","title":"Provider"},"models":{"items":{"$ref":"#/components/schemas/ProviderModelEntry"},"type":"array","title":"Models"},"fetched_live":{"type":"boolean","title":"Fetched Live"}},"type":"object","required":["provider","models","fetched_live"],"title":"ProviderModelsResponse"},"PublicFeedbackRequest":{"properties":{"kind":{"type":"string","pattern":"^(bug|feature)$","title":"Kind","description":"'bug' or 'feature'"},"title":{"type":"string","maxLength":200,"minLength":1,"title":"Title"},"body":{"type":"string","maxLength":20000,"minLength":1,"title":"Body"},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}],"title":"Email","description":"Optional contact email."},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website","description":"Leave empty."}},"type":"object","required":["kind","title","body"],"title":"PublicFeedbackRequest","description":"Request body for the public (unauthenticated) feedback endpoint.\n\n``website`` is a honeypot field — any non-empty value triggers a silent\ndrop (bots fill it; humans never see it because CSS hides it).\n``email`` is optional and stored only; it is never used to send mail."},"PublicFeedbackResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"kind":{"type":"string","title":"Kind"},"status":{"type":"string","title":"Status"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","kind","status","created_at"],"title":"PublicFeedbackResponse","description":"Minimal response for the public endpoint — no internal fields exposed."},"PublishArticleRequest":{"properties":{"title":{"type":"string","maxLength":512,"minLength":1,"title":"Title"},"body_md":{"type":"string","minLength":1,"title":"Body Md"},"category":{"type":"string","maxLength":64,"minLength":1,"title":"Category"},"news_item_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"News Item Id"},"slug":{"anyOf":[{"type":"string","maxLength":256,"minLength":1},{"type":"null"}],"title":"Slug"},"excerpt":{"anyOf":[{"type":"string","maxLength":512},{"type":"null"}],"title":"Excerpt"},"hero_image_url":{"anyOf":[{"type":"string","maxLength":2048},{"type":"null"}],"title":"Hero Image Url"},"source_url":{"anyOf":[{"type":"string","maxLength":2048},{"type":"null"}],"title":"Source Url"},"source_attribution":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Attribution"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"}},"type":"object","required":["title","body_md","category"],"title":"PublishArticleRequest"},"PublishArticleResponse":{"properties":{"id":{"type":"string","title":"Id"},"slug":{"type":"string","title":"Slug"},"published_at":{"type":"string","title":"Published At"},"url":{"type":"string","title":"Url"}},"type":"object","required":["id","slug","published_at","url"],"title":"PublishArticleResponse"},"PushSubscribeRequest":{"properties":{"endpoint":{"type":"string","title":"Endpoint"},"expirationTime":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expirationtime"},"keys":{"$ref":"#/components/schemas/PushSubscriptionKeys"}},"type":"object","required":["endpoint","keys"],"title":"PushSubscribeRequest","description":"Body of POST /v1/push/subscribe.\n\nMirrors PushSubscription.toJSON() exactly so the browser can call:\n  fetch('/v1/push/subscribe', {method:'POST', body: JSON.stringify(subscription.toJSON())})"},"PushSubscriptionKeys":{"properties":{"p256dh":{"type":"string","title":"P256Dh"},"auth":{"type":"string","title":"Auth"}},"type":"object","required":["p256dh","auth"],"title":"PushSubscriptionKeys","description":"Nested keys block from W3C PushSubscription.toJSON()."},"PushUnsubscribeRequest":{"properties":{"endpoint":{"type":"string","title":"Endpoint"}},"type":"object","required":["endpoint"],"title":"PushUnsubscribeRequest","description":"Body of DELETE /v1/push/subscribe."},"QueryRequest":{"properties":{"query_text":{"type":"string","maxLength":8000,"minLength":1,"title":"Query Text"},"k":{"type":"integer","maximum":100.0,"minimum":1.0,"title":"K","default":10},"metadata_filter":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata Filter"},"token_budget":{"anyOf":[{"type":"integer","minimum":1.0},{"type":"null"}],"title":"Token Budget","description":"Optional cap on total tokens of content (raw_text) returned across all results; trimmed to highest-relevance chunks that fit. Always returns at least one result. Omit to return all k results."},"as_of":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"As Of","description":"Return chunks valid at this timezone-aware timestamp."},"focus_symbols":{"anyOf":[{"items":{"type":"string","maxLength":128,"minLength":1},"type":"array","maxItems":50},{"type":"null"}],"title":"Focus Symbols","description":"Up to 50 symbols used to calibrate evidence."},"root_code":{"anyOf":[{"type":"string","maxLength":40000},{"type":"null"}],"title":"Root Code","description":"Root source code for evidence calibration."},"calibrate_evidence":{"type":"boolean","title":"Calibrate Evidence","description":"Apply symbol-aware evidence calibration when context is supplied.","default":true}},"type":"object","required":["query_text"],"title":"QueryRequest"},"QueryResponse":{"properties":{"results":{"items":{"$ref":"#/components/schemas/QueryResultChunk"},"type":"array","title":"Results"},"total_content_tokens":{"type":"integer","title":"Total Content Tokens","description":"Sum of raw_text token counts across returned chunks.","default":0},"token_budget_applied":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Token Budget Applied","description":"Echoes token_budget from the request; null when unset."}},"type":"object","required":["results"],"title":"QueryResponse"},"QueryResultChunk":{"properties":{"chunk_id":{"type":"string","title":"Chunk Id"},"item_id":{"type":"string","title":"Item Id"},"version_id":{"type":"string","title":"Version Id"},"text":{"type":"string","title":"Text"},"byte_range":{"items":{"type":"integer"},"type":"array","title":"Byte Range"},"score":{"type":"number","title":"Score"},"raw_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Raw Text"}},"type":"object","required":["chunk_id","item_id","version_id","text","byte_range","score"],"title":"QueryResultChunk"},"RankedContextItem":{"properties":{"path":{"type":"string","title":"Path"},"score":{"type":"number","title":"Score"},"rank":{"type":"integer","title":"Rank"},"contributing_signals":{"items":{"type":"string"},"type":"array","title":"Contributing Signals"}},"type":"object","required":["path","score","rank","contributing_signals"],"title":"RankedContextItem"},"RecommendRequest":{"properties":{"text":{"type":"string","minLength":1,"title":"Text","description":"Text to analyse for recommendation"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model","description":"Target model name (e.g. claude-sonnet-4-6). Used to check context fit."},"context_window":{"anyOf":[{"type":"integer","minimum":1.0},{"type":"null"}],"title":"Context Window","description":"Override context window size in tokens. Takes precedence over the model-derived value."}},"type":"object","required":["text"],"title":"RecommendRequest","description":"Request body for fidelity recommendation."},"RecommendResponse":{"properties":{"recommended_fidelity":{"type":"string","title":"Recommended Fidelity"},"estimated_ratio":{"type":"number","title":"Estimated Ratio"},"estimated_output_tokens":{"type":"integer","title":"Estimated Output Tokens"},"original_tokens":{"type":"integer","title":"Original Tokens"},"reasoning":{"type":"string","title":"Reasoning"}},"type":"object","required":["recommended_fidelity","estimated_ratio","estimated_output_tokens","original_tokens","reasoning"],"title":"RecommendResponse","description":"Fidelity recommendation result."},"RedeemRequest":{"properties":{"from_peer_id":{"type":"string","format":"uuid","title":"From Peer Id"},"item_id":{"type":"string","format":"uuid","title":"Item Id"},"redemption_jws":{"type":"string","title":"Redemption Jws"}},"type":"object","required":["from_peer_id","item_id","redemption_jws"],"title":"RedeemRequest","description":"Public POST body for an external A2A peer redeeming an approved grant.\n\n``item_id`` comes from the request body (not the signed JWS alone) so the\nhandler has an independent value to bind the signed ``item_id`` claim\nagainst — the signed proof must claim the SAME item_id, closing the class\nof bug where a peer signs a minimal proof once and replays it against an\narbitrary item."},"RedeemResponse":{"properties":{"item_id":{"type":"string","title":"Item Id"},"version_id":{"type":"string","title":"Version Id"},"name":{"type":"string","title":"Name"},"compressed_content":{"type":"string","title":"Compressed Content"},"granted_at":{"type":"string","title":"Granted At"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"}},"type":"object","required":["item_id","version_id","name","compressed_content","granted_at","expires_at"],"title":"RedeemResponse"},"ReferralItem":{"properties":{"id":{"type":"integer","title":"Id"},"referral_code":{"type":"string","title":"Referral Code"},"referred_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Referred User Id"},"status":{"type":"string","title":"Status"},"credit_days":{"type":"integer","title":"Credit Days"},"created_at":{"type":"string","title":"Created At"},"completed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Completed At"}},"type":"object","required":["id","referral_code","referred_user_id","status","credit_days","created_at","completed_at"],"title":"ReferralItem","description":"A single referral entry."},"ReferralListResponse":{"properties":{"referrals":{"items":{"$ref":"#/components/schemas/ReferralItem"},"type":"array","title":"Referrals"}},"type":"object","required":["referrals"],"title":"ReferralListResponse","description":"List of referrals created by the caller."},"ReferralMilestone":{"properties":{"referrals_needed":{"type":"integer","title":"Referrals Needed"},"reward":{"type":"string","title":"Reward"},"reached":{"type":"boolean","title":"Reached"}},"type":"object","required":["referrals_needed","reward","reached"],"title":"ReferralMilestone","description":"A referral milestone tier."},"ReferralStatsResponse":{"properties":{"total_referred":{"type":"integer","title":"Total Referred"},"credits_earned_days":{"type":"integer","title":"Credits Earned Days"},"pending":{"type":"integer","title":"Pending"},"milestones":{"items":{"$ref":"#/components/schemas/ReferralMilestone"},"type":"array","title":"Milestones","default":[]}},"type":"object","required":["total_referred","credits_earned_days","pending"],"title":"ReferralStatsResponse","description":"Aggregate stats for the caller's referral program."},"RefreshRequest":{"properties":{"refresh_credential":{"type":"string","maxLength":256,"minLength":32,"title":"Refresh Credential"}},"type":"object","required":["refresh_credential"],"title":"RefreshRequest"},"ReindexResponse":{"properties":{"item_id":{"type":"string","title":"Item Id"},"version_id":{"type":"string","title":"Version Id"},"status":{"type":"string","title":"Status","default":"COMPLETE"}},"type":"object","required":["item_id","version_id"],"title":"ReindexResponse"},"RejectRequest":{"properties":{"reason":{"type":"string","minLength":1,"title":"Reason"}},"type":"object","required":["reason"],"title":"RejectRequest"},"RejectResponse":{"properties":{"id":{"type":"string","title":"Id"},"draft_status":{"type":"string","title":"Draft Status"},"reviewed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reviewed At"}},"type":"object","required":["id","draft_status","reviewed_at"],"title":"RejectResponse"},"RemoveMembershipResponse":{"properties":{"removed":{"type":"boolean","title":"Removed"},"item_id":{"type":"string","title":"Item Id"},"member_project_id":{"type":"string","title":"Member Project Id"}},"type":"object","required":["removed","item_id","member_project_id"],"title":"RemoveMembershipResponse"},"ReportCommentRequest":{"properties":{"reason":{"type":"string","pattern":"^(spam|inappropriate|illegal|other)$","title":"Reason"},"detail":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Detail"}},"type":"object","required":["reason"],"title":"ReportCommentRequest"},"RequeueItemRequest":{"properties":{"reason":{"type":"string","minLength":1,"title":"Reason"},"expected_version":{"type":"integer","minimum":0.0,"title":"Expected Version","description":"CAS on attempt_generation"}},"type":"object","required":["reason","expected_version"],"title":"RequeueItemRequest"},"RequeueItemResponse":{"properties":{"id":{"type":"string","title":"Id"},"draft_status":{"type":"string","title":"Draft Status"},"attempt_generation":{"type":"integer","title":"Attempt Generation"},"replayed":{"type":"boolean","title":"Replayed"}},"type":"object","required":["id","draft_status","attempt_generation","replayed"],"title":"RequeueItemResponse"},"RequeueRequest":{"properties":{"reason":{"type":"string","minLength":1,"title":"Reason"},"expected_version":{"type":"integer","minimum":0.0,"title":"Expected Version","description":"CAS on attempt_generation"}},"type":"object","required":["reason","expected_version"],"title":"RequeueRequest"},"RequeueResponse":{"properties":{"id":{"type":"string","title":"Id"},"draft_status":{"type":"string","title":"Draft Status"},"attempt_generation":{"type":"integer","title":"Attempt Generation"},"replayed":{"type":"boolean","title":"Replayed"}},"type":"object","required":["id","draft_status","attempt_generation","replayed"],"title":"RequeueResponse"},"ResearchReceipt":{"properties":{"mode":{"type":"string","enum":["auto","web","papers","fetch","off"],"title":"Mode"},"tools":{"items":{"$ref":"#/components/schemas/ResearchToolResult"},"type":"array","maxItems":3,"title":"Tools"},"sources":{"items":{"$ref":"#/components/schemas/ResearchSource"},"type":"array","maxItems":6,"title":"Sources"},"retained_source_ids":{"items":{"type":"string"},"type":"array","maxItems":6,"title":"Retained Source Ids"},"original_tokens_estimated":{"type":"integer","maximum":1000000.0,"minimum":0.0,"title":"Original Tokens Estimated","default":0},"sent_tokens_estimated":{"type":"integer","maximum":1000000.0,"minimum":0.0,"title":"Sent Tokens Estimated","default":0},"compression_applied":{"type":"boolean","title":"Compression Applied","default":false},"truncated":{"type":"boolean","title":"Truncated","default":false},"compression_status":{"type":"string","enum":["not_needed","compressed","kept_original","failed"],"title":"Compression Status","default":"not_needed"}},"type":"object","required":["mode"],"title":"ResearchReceipt"},"ResearchSource":{"properties":{"id":{"type":"string","maxLength":16,"title":"Id"},"title":{"type":"string","maxLength":300,"title":"Title"},"url":{"type":"string","maxLength":2048,"title":"Url"},"kind":{"type":"string","enum":["page","snippet","abstract"],"title":"Kind"},"provider":{"anyOf":[{"type":"string","maxLength":80},{"type":"null"}],"title":"Provider"},"retrieved_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Retrieved At"},"published_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Published At"},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated At"},"data_as_of":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Data As Of"},"timezone":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Timezone"},"coverage_limitations":{"items":{"type":"string"},"type":"array","maxItems":8,"title":"Coverage Limitations"}},"type":"object","required":["id","title","url","kind"],"title":"ResearchSource"},"ResearchToolResult":{"properties":{"name":{"type":"string","enum":["web_search","arxiv_search","web_fetch","weather_lookup","finance_lookup","weather_window"],"title":"Name"},"status":{"type":"string","enum":["success","empty","partial","unavailable","timeout","blocked"],"title":"Status"}},"type":"object","required":["name","status"],"title":"ResearchToolResult"},"ResolveReportBody":{"properties":{"action":{"type":"string","pattern":"^(resolved|ignored)$","title":"Action"},"reason":{"type":"string","maxLength":1000,"minLength":1,"title":"Reason"}},"type":"object","required":["action","reason"],"title":"ResolveReportBody"},"RetentionPolicyRequest":{"properties":{"retention_days":{"anyOf":[{"type":"integer","maximum":3650.0,"minimum":1.0},{"type":"null"}],"title":"Retention Days"},"legal_hold_until":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Legal Hold Until","description":"ISO-8601 timestamp"}},"type":"object","title":"RetentionPolicyRequest"},"RetentionPolicyResponse":{"properties":{"project_id":{"type":"string","title":"Project Id"},"retention_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Retention Days"},"legal_hold_until":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Legal Hold Until"}},"type":"object","required":["project_id"],"title":"RetentionPolicyResponse"},"RevokeKeyResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"key_id":{"type":"string","title":"Key Id"}},"type":"object","required":["success","key_id"],"title":"RevokeKeyResponse","description":"Confirmation of key revocation."},"RevokeRequest":{"properties":{"refresh_credential":{"type":"string","maxLength":256,"minLength":32,"title":"Refresh Credential"}},"type":"object","required":["refresh_credential"],"title":"RevokeRequest"},"RoleModelItem":{"properties":{"role":{"type":"string","title":"Role"},"provider":{"type":"string","title":"Provider"},"model":{"type":"string","title":"Model"},"is_default":{"type":"boolean","title":"Is Default"}},"type":"object","required":["role","provider","model","is_default"],"title":"RoleModelItem"},"RotateKeyRequest":{"properties":{"grace_period_days":{"type":"integer","maximum":30.0,"minimum":0.0,"title":"Grace Period Days","description":"Days the predecessor key remains valid after rotation (0-30). Default 7. ``0`` immediately expires the predecessor (panic rotate).","default":7},"name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Name"}},"type":"object","title":"RotateKeyRequest","description":"Request body for ``POST /v1/keys/{key_id}/rotate`` (v1.20.10).\n\nBoth fields are optional. ``grace_period_days`` defaults to 7 (Stripe-\nstyle SaaS norm). ``name`` defaults to ``\"<predecessor.name> (rotated\nYYYY-MM-DD)\"`` when omitted."},"RotateKeyResponse":{"properties":{"key":{"type":"string","title":"Key"},"key_id":{"type":"string","title":"Key Id"},"name":{"type":"string","title":"Name"},"created_at":{"type":"string","title":"Created At"},"environment":{"type":"string","title":"Environment"},"default_model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Default Model"},"predecessor_key_id":{"type":"string","title":"Predecessor Key Id"},"predecessor_expires_at":{"type":"string","title":"Predecessor Expires At"},"grace_period_days":{"type":"integer","title":"Grace Period Days"}},"type":"object","required":["key","key_id","name","created_at","environment","predecessor_key_id","predecessor_expires_at","grace_period_days"],"title":"RotateKeyResponse","description":"Response after rotating an API key (v1.20.10).\n\nThe ``key`` field contains the full plaintext successor — shown ONCE\nand cannot be retrieved again. The predecessor continues to\nauthenticate until ``predecessor_expires_at``."},"RunCancelResponse":{"properties":{"run_id":{"type":"string","format":"uuid","title":"Run Id"},"cancelled":{"type":"boolean","title":"Cancelled"}},"type":"object","required":["run_id","cancelled"],"title":"RunCancelResponse"},"RunFromAssistantRequest":{"properties":{"assistant_id":{"type":"string","format":"uuid","title":"Assistant Id"},"instruction":{"type":"string","maxLength":8000,"minLength":1,"title":"Instruction"},"project_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"}},"type":"object","required":["assistant_id","instruction"],"title":"RunFromAssistantRequest"},"RunFromSkillRequest":{"properties":{"skill_id":{"type":"string","format":"uuid","title":"Skill Id"},"instruction":{"type":"string","maxLength":8000,"minLength":1,"title":"Instruction"},"provider":{"type":"string","maxLength":64,"minLength":1,"title":"Provider"},"model":{"type":"string","maxLength":128,"minLength":1,"title":"Model"},"project_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"}},"type":"object","required":["skill_id","instruction","provider","model"],"title":"RunFromSkillRequest"},"RunFromWorkflowRequest":{"properties":{"workflow_id":{"type":"string","format":"uuid","title":"Workflow Id"},"surface":{"type":"string","title":"Surface","default":"canvas"},"project_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"},"version_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Version Id"}},"type":"object","required":["workflow_id"],"title":"RunFromWorkflowRequest"},"RunListItem":{"properties":{"run_id":{"type":"string","format":"uuid","title":"Run Id"},"status":{"type":"string","title":"Status"},"surface":{"type":"string","title":"Surface"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"plan":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Plan"},"step_count":{"type":"integer","title":"Step Count"},"cost_micros":{"type":"integer","title":"Cost Micros"},"cost_is_partial":{"type":"boolean","title":"Cost Is Partial"}},"type":"object","required":["run_id","status","surface","created_at","plan","step_count","cost_micros","cost_is_partial"],"title":"RunListItem"},"RunReadResponse":{"properties":{"run_id":{"type":"string","format":"uuid","title":"Run Id"},"status":{"type":"string","title":"Status"},"surface":{"type":"string","title":"Surface"},"steps":{"items":{"$ref":"#/components/schemas/RunStepOut"},"type":"array","title":"Steps"}},"type":"object","required":["run_id","status","surface","steps"],"title":"RunReadResponse"},"RunStepIn":{"properties":{"provider":{"type":"string","maxLength":64,"minLength":1,"title":"Provider"},"model":{"type":"string","maxLength":128,"minLength":1,"title":"Model"},"messages":{"items":{"additionalProperties":true,"type":"object"},"type":"array","minItems":1,"title":"Messages"},"node_id":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}],"title":"Node Id"},"role":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Role"},"skill_id":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}],"title":"Skill Id"}},"type":"object","required":["provider","model","messages"],"title":"RunStepIn"},"RunStepOut":{"properties":{"step_index":{"type":"integer","title":"Step Index"},"status":{"type":"string","title":"Status"},"attempt_no":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Attempt No"},"fault_domain":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fault Domain"},"output":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Output"}},"type":"object","required":["step_index","status"],"title":"RunStepOut"},"RunSubmitRequest":{"properties":{"surface":{"type":"string","title":"Surface","description":"chat | canvas | cli | mcp"},"steps":{"items":{"$ref":"#/components/schemas/RunStepIn"},"type":"array","maxItems":10,"minItems":1,"title":"Steps"},"project_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"}},"type":"object","required":["surface","steps"],"title":"RunSubmitRequest"},"RunSubmitResponse":{"properties":{"run_id":{"type":"string","format":"uuid","title":"Run Id"},"status":{"type":"string","title":"Status"}},"type":"object","required":["run_id","status"],"title":"RunSubmitResponse"},"RunawayAccountItem":{"properties":{"user_id":{"type":"string","title":"User Id"},"email":{"type":"string","title":"Email"},"plan":{"type":"string","title":"Plan"},"status":{"type":"string","title":"Status"},"estimated_revenue_30d_usd":{"type":"number","title":"Estimated Revenue 30D Usd"},"platform_cogs_30d_usd":{"type":"number","title":"Platform Cogs 30D Usd"},"tokens_in_30d":{"type":"integer","title":"Tokens In 30D"},"flag_reason":{"type":"string","title":"Flag Reason"}},"type":"object","required":["user_id","email","plan","status","estimated_revenue_30d_usd","platform_cogs_30d_usd","tokens_in_30d","flag_reason"],"title":"RunawayAccountItem"},"RunawayAccountsResponse":{"properties":{"runaway_accounts":{"items":{"$ref":"#/components/schemas/RunawayAccountItem"},"type":"array","title":"Runaway Accounts"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["runaway_accounts","total"],"title":"RunawayAccountsResponse"},"RunawayBrakeResponse":{"properties":{"user_id":{"type":"string","title":"User Id"},"status":{"type":"string","title":"Status"},"revoked_keys_count":{"type":"integer","title":"Revoked Keys Count"},"message":{"type":"string","title":"Message"}},"type":"object","required":["user_id","status","revoked_keys_count","message"],"title":"RunawayBrakeResponse"},"SavedTurnReceipt":{"properties":{"status":{"type":"string","enum":["saved","unsaved","unknown"],"title":"Status"},"conversation_id":{"anyOf":[{"type":"string","maxLength":36},{"type":"null"}],"title":"Conversation Id"},"user_message_id":{"anyOf":[{"type":"string","maxLength":36},{"type":"null"}],"title":"User Message Id"},"assistant_message_id":{"anyOf":[{"type":"string","maxLength":36},{"type":"null"}],"title":"Assistant Message Id"}},"additionalProperties":false,"type":"object","required":["status"],"title":"SavedTurnReceipt"},"SavedView":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"filters":{"additionalProperties":true,"type":"object","title":"Filters"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","name","filters","created_at"],"title":"SavedView"},"SavingsResponse":{"properties":{"total_compressions":{"type":"integer","title":"Total Compressions"},"total_tokens_in":{"type":"integer","title":"Total Tokens In"},"total_tokens_saved":{"type":"integer","title":"Total Tokens Saved"},"savings_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Savings Pct"},"estimated_cost_saved_usd":{"type":"number","title":"Estimated Cost Saved Usd"},"model":{"type":"string","title":"Model","description":"Canonical model name used for cost math."},"price_per_1k_in":{"type":"number","title":"Price Per 1K In","description":"USD per 1k input tokens."},"price_per_1k_out":{"type":"number","title":"Price Per 1K Out","description":"USD per 1k output tokens."}},"type":"object","required":["total_compressions","total_tokens_in","total_tokens_saved","savings_pct","estimated_cost_saved_usd","model","price_per_1k_in","price_per_1k_out"],"title":"SavingsResponse","description":"Cumulative compression savings for the authenticated user."},"SemanticCacheRollup":{"properties":{"hits":{"type":"integer","title":"Hits"},"misses":{"type":"integer","title":"Misses"},"hit_rate":{"type":"number","title":"Hit Rate"},"tokens_saved_via_hits":{"type":"integer","title":"Tokens Saved Via Hits"},"usd_saved_via_hits":{"type":"number","title":"Usd Saved Via Hits"},"estimated_portion_usd":{"type":"number","title":"Estimated Portion Usd","default":0.0}},"type":"object","required":["hits","misses","hit_rate","tokens_saved_via_hits","usd_saved_via_hits"],"title":"SemanticCacheRollup","description":"v1.3 — rollup of the semantic dedup cache hit rate + savings.\n\n``hits``/``misses`` sum over the window's ``UsageEvent`` rows; free\ntier and pre-v1.3 rows are ``NULL`` in ``semantic_cache_status``\nand excluded from both counts. ``hit_rate`` is a fraction in\n``[0, 1]``. ``tokens_saved_via_hits`` is the ``tokens_saved`` sum\non hit rows; ``usd_saved_via_hits`` multiplies that by the user's\nmost-common-model input price (same basis as ``compression_only``)."},"SetFavoriteRequest":{"properties":{"kind":{"type":"string","enum":["kb_plan","project"],"title":"Kind"},"ref":{"type":"string","maxLength":255,"minLength":1,"title":"Ref"},"label":{"type":"string","maxLength":200,"minLength":1,"title":"Label"},"favorited":{"type":"boolean","title":"Favorited"}},"type":"object","required":["kind","ref","label","favorited"],"title":"SetFavoriteRequest"},"SetFavoriteResult":{"properties":{"kind":{"type":"string","title":"Kind"},"ref":{"type":"string","title":"Ref"},"favorited":{"type":"boolean","title":"Favorited"}},"type":"object","required":["kind","ref","favorited"],"title":"SetFavoriteResult"},"SetRoleModelRequest":{"properties":{"provider":{"type":"string","maxLength":64,"title":"Provider"},"model":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}],"title":"Model"}},"type":"object","required":["provider"],"title":"SetRoleModelRequest"},"ShareResponse":{"properties":{"id":{"type":"string","title":"Id"},"item_id":{"type":"string","title":"Item Id"},"owner_project_id":{"type":"string","title":"Owner Project Id"},"peer_id":{"type":"string","title":"Peer Id"},"manifest_jws":{"type":"string","title":"Manifest Jws"},"status":{"type":"string","title":"Status"},"granted_at":{"type":"string","title":"Granted At"},"granted_by_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Granted By User Id"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"},"revoked_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Revoked At"}},"type":"object","required":["id","item_id","owner_project_id","peer_id","manifest_jws","status","granted_at","granted_by_user_id","expires_at","revoked_at"],"title":"ShareResponse"},"SilenceUserBody":{"properties":{"reason":{"type":"string","maxLength":1000,"minLength":1,"title":"Reason"},"duration_hours":{"anyOf":[{"type":"integer","maximum":720.0,"minimum":1.0},{"type":"null"}],"title":"Duration Hours"}},"type":"object","required":["reason"],"title":"SilenceUserBody"},"SingleItemIngestRequest":{"properties":{"source_slug":{"type":"string","maxLength":64,"minLength":1,"title":"Source Slug"},"external_id":{"type":"string","maxLength":256,"minLength":1,"title":"External Id"},"url":{"type":"string","maxLength":2048,"minLength":1,"title":"Url"},"title":{"type":"string","maxLength":512,"minLength":1,"title":"Title"},"raw_summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Raw Summary"},"published_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Published At"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"}},"type":"object","required":["source_slug","external_id","url","title"],"title":"SingleItemIngestRequest"},"SkillEnablementStateResponse":{"properties":{"skill_id":{"type":"string","title":"Skill Id"},"enabled":{"type":"boolean","title":"Enabled"},"enabled_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Enabled At"}},"type":"object","required":["skill_id","enabled"],"title":"SkillEnablementStateResponse","description":"Whether the CALLER has this skill enabled. The MANAGEMENT question.\n\nDeliberately NOT answerable from `GET /v1/skills/enabled`, which is the\nINVOCATION list — published AND scanner-clean AND enabled. A skill you\nenabled and that was flagged afterwards is absent from that list while\nremaining very much enabled on your account, so using it here would report\n`enabled: false` for the one case where the answer matters most: the UI\nwould then offer no way to withdraw consent for a skill whose markdown is\nstill attached to your account. `skills_controlplane_service.list_enabled`\nis the reader with the right semantics and says so at length.\n\n`enabled_at` is None when not enabled rather than the field being absent, so\na client cannot mistake a missing key for a missing answer."},"SkillListResponse":{"properties":{"skills":{"items":{"$ref":"#/components/schemas/CommunitySkillListItem"},"type":"array","title":"Skills"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"},"has_more":{"type":"boolean","title":"Has More"}},"type":"object","required":["skills","limit","offset","has_more"],"title":"SkillListResponse"},"SpendCeilingResponse":{"properties":{"spend_ceiling_usd":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Spend Ceiling Usd"},"plan":{"type":"string","title":"Plan"},"tier_max_usd":{"type":"integer","title":"Tier Max Usd"},"effective_usd":{"type":"integer","title":"Effective Usd"}},"type":"object","required":["spend_ceiling_usd","plan","tier_max_usd","effective_usd"],"title":"SpendCeilingResponse"},"SpendCeilingUpdate":{"properties":{"spend_ceiling_usd":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Spend Ceiling Usd","description":"Whole US dollars, from 1 up to your plan's maximum. null clears your preference and restores the plan maximum."}},"type":"object","title":"SpendCeilingUpdate"},"StatusChangeResponse":{"properties":{"clerk_id":{"type":"string","title":"Clerk Id"},"previous_status":{"type":"string","title":"Previous Status"},"new_status":{"type":"string","title":"New Status"},"changed_at":{"type":"string","title":"Changed At"}},"type":"object","required":["clerk_id","previous_status","new_status","changed_at"],"title":"StatusChangeResponse"},"StatusTransitionRequest":{"properties":{"status":{"type":"string","enum":["draft","in_review","approved"],"title":"Status"}},"type":"object","required":["status"],"title":"StatusTransitionRequest"},"StatusTransitionResponse":{"properties":{"item_id":{"type":"string","title":"Item Id"},"status":{"type":"string","title":"Status"}},"type":"object","required":["item_id","status"],"title":"StatusTransitionResponse"},"StoreCredentialRequest":{"properties":{"provider":{"type":"string","maxLength":64,"title":"Provider"},"api_key":{"type":"string","format":"password","title":"Api Key","writeOnly":true},"label":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}],"title":"Label"},"base_url":{"anyOf":[{"type":"string","maxLength":2048},{"type":"null"}],"title":"Base Url"}},"type":"object","required":["provider","api_key"],"title":"StoreCredentialRequest","description":"`provider` is NOT validated here on purpose.\n\n`normalize_provider` in the service is the single closed vocabulary, shared\nwith `provider_runtime` so that what you can STORE a key for and what you\ncan CALL are the same set. Re-declaring the enum here would be a second\nsource of truth that drifts the day a provider is added."},"StructuralCompressRequest":{"properties":{"files":{"items":{"$ref":"#/components/schemas/StructuralFile"},"type":"array","title":"Files","description":"The code bundle to analyse. 1–1000 files, ≤512 KB each, ≤5 MB total."},"focus_symbol":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Focus Symbol","description":"Symbol name to focus the blast-radius on. When omitted, tg returns the global map — still useful for BM25-only ranking."},"query":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Query","description":"Free-form query used as the BM25 input. Defaults to focus_symbol."},"top_k":{"type":"integer","maximum":500.0,"minimum":1.0,"title":"Top K","description":"Cap on the size of the returned ranked_context list.","default":50}},"type":"object","title":"StructuralCompressRequest"},"StructuralCompressResponse":{"properties":{"ranked_context":{"items":{"$ref":"#/components/schemas/RankedContextItem"},"type":"array","title":"Ranked Context"},"stats":{"$ref":"#/components/schemas/StructuralCompressStats"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message","description":"Populated only on degraded paths (missing tg, timeout, non-zero exit)."}},"type":"object","required":["ranked_context","stats"],"title":"StructuralCompressResponse"},"StructuralCompressStats":{"properties":{"files_in":{"type":"integer","title":"Files In"},"files_ranked":{"type":"integer","title":"Files Ranked"},"symbols_in":{"type":"integer","title":"Symbols In"},"degraded":{"type":"boolean","title":"Degraded"}},"type":"object","required":["files_in","files_ranked","symbols_in","degraded"],"title":"StructuralCompressStats"},"StructuralFile":{"properties":{"path":{"type":"string","minLength":1,"title":"Path","description":"POSIX-style relative path within the submitted tree."},"content":{"type":"string","title":"Content","description":"File content as UTF-8 text."}},"type":"object","required":["path","content"],"title":"StructuralFile"},"SubmitSkillRequest":{"properties":{"authorship_asserted":{"type":"boolean","title":"Authorship Asserted"}},"type":"object","required":["authorship_asserted"],"title":"SubmitSkillRequest","description":"Body for ``POST /v1/skills/{skill_id}/submit``. D6 authorship\ncheckbox -- the service refuses (with a clean domain error) when this is\nFalse; the Pydantic layer only enforces that the field is present."},"SubscribeResponse":{"properties":{"status":{"type":"string","title":"Status"}},"type":"object","required":["status"],"title":"SubscribeResponse"},"SubscriptionInfo":{"properties":{"plan":{"type":"string","title":"Plan"},"renewal_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Renewal At"},"amount_cents":{"type":"integer","title":"Amount Cents"},"currency":{"type":"string","title":"Currency"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"trial_ends_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Trial Ends At"}},"type":"object","required":["plan","amount_cents","currency"],"title":"SubscriptionInfo","description":"Current plan and subscription billing details."},"TaskBoardActor":{"properties":{"kind":{"type":"string","title":"Kind"},"id":{"type":"string","title":"Id"},"display":{"type":"string","title":"Display"}},"type":"object","required":["kind","id","display"],"title":"TaskBoardActor","description":"Who performed one task-board event.\n\n``kind`` is ``\"human\"`` (a write over the Clerk-session dashboard REST\npath -- Slice 1's only human action is Reassign) or ``\"agent\"`` (a write\nover MCP / a peer-signed route; ``display`` is the peer's CURRENT\n``a2a_peers.name``, resolved at read time -- never a stored string, so\na later peer rename is reflected and a deleted peer can't leave a stale\nspoofable label behind). There is no ``\"system\"`` literal on the wire --\na system-authored event (cron sweep, no actor) carries ``actor: null``\non ``TaskBoardEvent`` instead of a third kind value."},"TaskBoardDetailResponse":{"properties":{"id":{"type":"string","title":"Id"},"task_type":{"type":"string","title":"Task Type"},"title":{"type":"string","title":"Title"},"status":{"type":"string","title":"Status"},"assignee_display":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Assignee Display"},"created_at":{"type":"string","title":"Created At"},"last_event_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Event At"},"events":{"items":{"$ref":"#/components/schemas/TaskBoardEvent"},"type":"array","title":"Events"}},"type":"object","required":["id","task_type","title","status","created_at","events"],"title":"TaskBoardDetailResponse","description":"A single task board row plus its ordered, attributed event timeline."},"TaskBoardEvent":{"properties":{"event":{"type":"string","title":"Event"},"actor":{"anyOf":[{"$ref":"#/components/schemas/TaskBoardActor"},{"type":"null"}]},"created_at":{"type":"string","title":"Created At"},"detail":{"additionalProperties":true,"type":"object","title":"Detail"}},"type":"object","required":["event","created_at"],"title":"TaskBoardEvent"},"TaskBoardRow":{"properties":{"id":{"type":"string","title":"Id"},"task_type":{"type":"string","title":"Task Type"},"title":{"type":"string","title":"Title"},"status":{"type":"string","title":"Status"},"assignee_display":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Assignee Display"},"created_at":{"type":"string","title":"Created At"},"last_event_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Event At"}},"type":"object","required":["id","task_type","title","status","created_at"],"title":"TaskBoardRow"},"TaskCancelRequest":{"properties":{"project_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"}},"type":"object","title":"TaskCancelRequest"},"TaskCancelResponse":{"properties":{"task_id":{"type":"string","title":"Task Id"},"status":{"type":"string","title":"Status"}},"type":"object","required":["task_id","status"],"title":"TaskCancelResponse"},"TaskContractResponse":{"properties":{"id":{"type":"string","title":"Id"},"project_id":{"type":"string","title":"Project Id"},"requester_peer_id":{"type":"string","title":"Requester Peer Id"},"assignee_peer_id":{"type":"string","title":"Assignee Peer Id"},"task_type":{"type":"string","title":"Task Type"},"title":{"type":"string","title":"Title"},"payload":{"additionalProperties":true,"type":"object","title":"Payload"},"status":{"type":"string","title":"Status"},"claimant_peer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Claimant Peer Id"},"deadline_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Deadline At"},"claim_deadline_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Claim Deadline At"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"claimed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Claimed At"},"completed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Completed At"},"result_payload":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Result Payload"},"result_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Result Hash"}},"type":"object","required":["id","project_id","requester_peer_id","assignee_peer_id","task_type","title","payload","status","claimant_peer_id","deadline_at","claim_deadline_at","created_at","claimed_at","completed_at","result_payload","result_hash"],"title":"TaskContractResponse"},"TaskReassignRequest":{"properties":{"new_assignee_peer_id":{"type":"string","format":"uuid","title":"New Assignee Peer Id"},"deadline_minutes":{"anyOf":[{"type":"integer","maximum":10080.0,"minimum":5.0},{"type":"null"}],"title":"Deadline Minutes"},"project_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"}},"type":"object","required":["new_assignee_peer_id"],"title":"TaskReassignRequest"},"TaskReassignResponse":{"properties":{"old_task_id":{"type":"string","title":"Old Task Id"},"new_task_id":{"type":"string","title":"New Task Id"},"new_status":{"type":"string","title":"New Status"},"deadline_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Deadline At"}},"type":"object","required":["old_task_id","new_task_id","new_status"],"title":"TaskReassignResponse"},"TeamActivityEntry":{"properties":{"id":{"type":"string","title":"Id"},"action":{"type":"string","title":"Action"},"actor_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor Id"},"actor_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor Email"},"target_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target Id"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","action","actor_id","actor_email","target_id","metadata","created_at"],"title":"TeamActivityEntry","description":"Single audit log entry for a team."},"TeamActivityResponse":{"properties":{"entries":{"items":{"$ref":"#/components/schemas/TeamActivityEntry"},"type":"array","title":"Entries"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["entries","total"],"title":"TeamActivityResponse","description":"Paginated team activity log."},"TeamInviteResponse":{"properties":{"invite":{"$ref":"#/components/schemas/TeamMembershipResponse"},"email_delivery_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email Delivery Id"},"email_delivery_status":{"type":"string","title":"Email Delivery Status","default":"sent"}},"type":"object","required":["invite","email_delivery_id"],"title":"TeamInviteResponse","description":"Created invite row plus email delivery metadata."},"TeamListResponse":{"properties":{"teams":{"items":{"$ref":"#/components/schemas/TeamWithMembershipResponse"},"type":"array","title":"Teams"}},"type":"object","required":["teams"],"title":"TeamListResponse","description":"List of teams available to the caller."},"TeamMembersResponse":{"properties":{"members":{"items":{"$ref":"#/components/schemas/TeamMembershipResponse"},"type":"array","title":"Members"}},"type":"object","required":["members"],"title":"TeamMembersResponse","description":"Full member roster for a team, including pending invites."},"TeamMembershipResponse":{"properties":{"id":{"type":"string","title":"Id"},"team_id":{"type":"string","title":"Team Id"},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"role":{"type":"string","title":"Role"},"status":{"type":"string","title":"Status"},"invited_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invited Email"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","team_id","user_id","role","status","invited_email","expires_at","created_at"],"title":"TeamMembershipResponse","description":"Serialized team membership or invite."},"TeamResponse":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"owner_id":{"type":"string","title":"Owner Id"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","name","owner_id","created_at"],"title":"TeamResponse","description":"Serialized team details."},"TeamTransferResponse":{"properties":{"team":{"$ref":"#/components/schemas/TeamResponse"},"previous_owner_membership":{"$ref":"#/components/schemas/TeamMembershipResponse"},"new_owner_membership":{"$ref":"#/components/schemas/TeamMembershipResponse"}},"type":"object","required":["team","previous_owner_membership","new_owner_membership"],"title":"TeamTransferResponse","description":"Ownership transfer result."},"TeamUsageMemberResponse":{"properties":{"user_id":{"type":"string","title":"User Id"},"email":{"type":"string","title":"Email"},"role":{"type":"string","title":"Role"},"total_compressions":{"type":"integer","title":"Total Compressions"},"total_tokens_in":{"type":"integer","title":"Total Tokens In"},"total_tokens_saved":{"type":"integer","title":"Total Tokens Saved"}},"type":"object","required":["user_id","email","role","total_compressions","total_tokens_in","total_tokens_saved"],"title":"TeamUsageMemberResponse","description":"Usage aggregation for one active member."},"TeamUsageResponse":{"properties":{"team_id":{"type":"string","title":"Team Id"},"total_tokens_in":{"type":"integer","title":"Total Tokens In"},"total_tokens_saved":{"type":"integer","title":"Total Tokens Saved"},"total_compressions":{"type":"integer","title":"Total Compressions"},"by_member":{"items":{"$ref":"#/components/schemas/TeamUsageMemberResponse"},"type":"array","title":"By Member"}},"type":"object","required":["team_id","total_tokens_in","total_tokens_saved","total_compressions","by_member"],"title":"TeamUsageResponse","description":"Team-wide aggregated usage plus per-member breakdown."},"TeamWithMembershipResponse":{"properties":{"team":{"$ref":"#/components/schemas/TeamResponse"},"membership":{"$ref":"#/components/schemas/TeamMembershipResponse"}},"type":"object","required":["team","membership"],"title":"TeamWithMembershipResponse","description":"Team plus the caller-specific membership context."},"TestKeyListItem":{"properties":{"key_id":{"type":"string","title":"Key Id"},"name":{"type":"string","title":"Name"},"plan":{"type":"string","title":"Plan"},"created_by_admin_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By Admin Id"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"},"last_used":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Used"},"status":{"type":"string","title":"Status"}},"type":"object","required":["key_id","name","plan","created_by_admin_id","created_at","expires_at","last_used","status"],"title":"TestKeyListItem"},"TestKeyUsageResponse":{"properties":{"compressions":{"type":"integer","title":"Compressions"},"tokens_in":{"type":"integer","title":"Tokens In"},"tokens_saved":{"type":"integer","title":"Tokens Saved"},"last_7_days_events":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Last 7 Days Events"}},"type":"object","required":["compressions","tokens_in","tokens_saved","last_7_days_events"],"title":"TestKeyUsageResponse"},"TestPushResponse":{"properties":{"sent":{"type":"integer","title":"Sent"},"status":{"type":"string","title":"Status"}},"type":"object","required":["sent","status"],"title":"TestPushResponse"},"TestWebhookResponse":{"properties":{"delivery":{"$ref":"#/components/schemas/WebhookDeliveryResponse"}},"type":"object","required":["delivery"],"title":"TestWebhookResponse","description":"Immediate result from a manual test ping."},"ThresholdPutRequest":{"properties":{"threshold":{"anyOf":[{"type":"number","maximum":0.99,"minimum":0.8},{"type":"null"}],"title":"Threshold","description":"Cosine similarity cutoff in [0.80, 0.99]; null resets to the server-wide default (currently ~0.95)."}},"type":"object","title":"ThresholdPutRequest"},"ThresholdResponse":{"properties":{"threshold":{"type":"number","maximum":0.99,"minimum":0.8,"title":"Threshold"},"source":{"type":"string","enum":["user","global"],"title":"Source"}},"type":"object","required":["threshold","source"],"title":"ThresholdResponse"},"ToggleWebhookResponse":{"properties":{"id":{"type":"string","title":"Id"},"is_active":{"type":"boolean","title":"Is Active"}},"type":"object","required":["id","is_active"],"title":"ToggleWebhookResponse","description":"Result of enable/disable toggle."},"ToolAllowlistBody":{"properties":{"tool_allowlist":{"items":{"type":"string"},"type":"array","minItems":1,"title":"Tool Allowlist","description":"List of MCP tool names to allow for this project. The gateway intersects this with the plan/profile allowlist — you cannot grant tools beyond your plan tier."}},"type":"object","required":["tool_allowlist"],"title":"ToolAllowlistBody","description":"Request body for PUT /v1/projects/{id}/tool-allowlist."},"ToolAllowlistResponse":{"properties":{"project_id":{"type":"string","title":"Project Id"},"tool_allowlist":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tool Allowlist"},"recommended_starter":{"items":{"type":"string"},"type":"array","title":"Recommended Starter"},"recommended_starter_size":{"type":"integer","title":"Recommended Starter Size"}},"type":"object","required":["project_id","tool_allowlist","recommended_starter","recommended_starter_size"],"title":"ToolAllowlistResponse","description":"Response for GET /v1/projects/{id}/tool-allowlist."},"ToolInfo":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"category":{"type":"string","title":"Category"},"available":{"type":"boolean","title":"Available"},"tier":{"type":"string","title":"Tier"}},"type":"object","required":["name","description","category","available","tier"],"title":"ToolInfo"},"ToolRollupItem":{"properties":{"tool":{"type":"string","title":"Tool"},"calls":{"type":"integer","title":"Calls"},"tokens_in":{"type":"integer","title":"Tokens In"},"tokens_saved":{"type":"integer","title":"Tokens Saved"},"pct_of_total":{"type":"number","title":"Pct Of Total"}},"type":"object","required":["tool","calls","tokens_in","tokens_saved","pct_of_total"],"title":"ToolRollupItem"},"TransferTeamOwnershipRequest":{"properties":{"new_owner_id":{"type":"string","format":"uuid","title":"New Owner Id"}},"type":"object","required":["new_owner_id"],"title":"TransferTeamOwnershipRequest","description":"Body for POST /v1/teams/{id}/transfer."},"TrendPoint":{"properties":{"date":{"type":"string","title":"Date"},"compressions":{"type":"integer","title":"Compressions"},"tokens_in":{"type":"integer","title":"Tokens In"},"tokens_saved":{"type":"integer","title":"Tokens Saved"}},"type":"object","required":["date","compressions","tokens_in","tokens_saved"],"title":"TrendPoint"},"TriggerPqlScanBody":{"properties":{"dry_run":{"type":"boolean","title":"Dry Run","default":false},"alert_webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Alert Webhook Url"}},"type":"object","title":"TriggerPqlScanBody"},"TriggerPqlScanResponse":{"properties":{"users_evaluated":{"type":"integer","title":"Users Evaluated"},"pql_triggers_found":{"type":"integer","title":"Pql Triggers Found"},"deals_created_or_updated":{"type":"integer","title":"Deals Created Or Updated"},"dry_run":{"type":"boolean","title":"Dry Run"},"details":{"items":{"$ref":"#/components/schemas/PqlScanDetailItem"},"type":"array","title":"Details"}},"type":"object","required":["users_evaluated","pql_triggers_found","deals_created_or_updated","dry_run","details"],"title":"TriggerPqlScanResponse"},"UnsubscribeResponse":{"properties":{"status":{"type":"string","title":"Status"}},"type":"object","required":["status"],"title":"UnsubscribeResponse"},"UpdateKeyRequest":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":100,"minLength":1},{"type":"null"}],"title":"Name"},"default_model":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Default Model"},"monthly_quota":{"anyOf":[{"type":"integer","maximum":100000000.0,"minimum":1.0},{"type":"null"}],"title":"Monthly Quota"},"enforce_quota":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enforce Quota"},"environment":{"anyOf":[{"type":"string","maxLength":16},{"type":"null"}],"title":"Environment"},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"},"project_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Id"}},"type":"object","title":"UpdateKeyRequest","description":"Request body for ``PATCH /v1/keys/{key_id}``.\n\nAll fields are optional — supply only what you want to change.\nPass ``monthly_quota: null`` to clear the quota (key becomes\nuncapped again)."},"UpdateMemberRoleRequest":{"properties":{"role":{"type":"string","title":"Role"}},"type":"object","required":["role"],"title":"UpdateMemberRoleRequest","description":"Body for PATCH /v1/teams/{id}/members/{user_id}/role."},"UpdateProfileRequest":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":100,"minLength":1},{"type":"null"}],"title":"Name"},"fidelity":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fidelity"},"chunk_size":{"anyOf":[{"type":"integer","maximum":1000.0,"minimum":50.0},{"type":"null"}],"title":"Chunk Size"},"skeleton_ratio":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.05},{"type":"null"}],"title":"Skeleton Ratio"},"description":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Description"}},"type":"object","title":"UpdateProfileRequest","description":"Body for PUT /v1/profiles/{id} — all fields optional."},"UpdateProjectRequest":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":100,"minLength":1},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Description"},"jev_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Jev Enabled"}},"type":"object","title":"UpdateProjectRequest","description":"Body for PUT /v1/projects/{project_id} — all fields optional."},"UpdatePromptRequest":{"properties":{"title":{"type":"string","maxLength":200,"minLength":1,"title":"Title"},"body":{"type":"string","maxLength":20000,"minLength":1,"title":"Body"}},"type":"object","required":["title","body"],"title":"UpdatePromptRequest"},"UpdateSkillRequest":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":200,"minLength":1},{"type":"null"}],"title":"Name"},"tagline":{"anyOf":[{"type":"string","maxLength":300,"minLength":1},{"type":"null"}],"title":"Tagline"},"category":{"anyOf":[{"type":"string","maxLength":64,"minLength":1},{"type":"null"}],"title":"Category"},"artifact_type":{"anyOf":[{"type":"string","enum":["skill","mcp_server","prompt","agent"]},{"type":"null"}],"title":"Artifact Type"},"skill_markdown":{"anyOf":[{"type":"string","maxLength":524288,"minLength":1},{"type":"null"}],"title":"Skill Markdown"},"install_snippet":{"anyOf":[{"type":"string","maxLength":2000,"minLength":1},{"type":"null"}],"title":"Install Snippet"}},"type":"object","title":"UpdateSkillRequest","description":"Body for ``PUT /v1/skills/{skill_id}``. All fields optional (partial\nupdate, mirrors ``update_draft``'s own keyword-optional signature)."},"UpdateTeamRequest":{"properties":{"name":{"type":"string","maxLength":64,"minLength":1,"title":"Name"}},"type":"object","required":["name"],"title":"UpdateTeamRequest","description":"Body for PATCH /v1/teams/{id}."},"UploadCompleteResponse":{"properties":{"upload_id":{"type":"string","title":"Upload Id"},"status":{"type":"string","title":"Status"}},"type":"object","required":["upload_id","status"],"title":"UploadCompleteResponse","description":"200 response for POST /uploads/{upload_id}/complete."},"UsageAlert":{"properties":{"severity":{"type":"string","title":"Severity"},"message":{"type":"string","title":"Message"}},"type":"object","required":["severity","message"],"title":"UsageAlert","description":"Usage milestone alert — returned when pct_used crosses a threshold."},"UsageByCacheResponse":{"properties":{"period_days":{"type":"integer","title":"Period Days"},"compression_only_savings_usd":{"type":"number","title":"Compression Only Savings Usd"},"compression_only_estimated_portion_usd":{"type":"number","title":"Compression Only Estimated Portion Usd","default":0.0},"combined_savings_usd":{"type":"number","title":"Combined Savings Usd"},"combined_estimated_portion_usd":{"type":"number","title":"Combined Estimated Portion Usd","default":0.0},"savings_basis":{"type":"string","title":"Savings Basis"},"by_target":{"items":{"$ref":"#/components/schemas/CacheRollupRow"},"type":"array","title":"By Target"},"semantic_cache":{"$ref":"#/components/schemas/SemanticCacheRollup"},"by_source":{"$ref":"#/components/schemas/HitSourceBreakdown"}},"type":"object","required":["period_days","compression_only_savings_usd","combined_savings_usd","savings_basis","by_target","semantic_cache","by_source"],"title":"UsageByCacheResponse"},"UsageByClientResponse":{"properties":{"period_days":{"type":"integer","title":"Period Days"},"total_calls":{"type":"integer","title":"Total Calls"},"items":{"items":{"$ref":"#/components/schemas/ClientRollupItem"},"type":"array","title":"Items"}},"type":"object","required":["period_days","total_calls","items"],"title":"UsageByClientResponse"},"UsageByKeyResponse":{"properties":{"period_days":{"type":"integer","title":"Period Days"},"by_key":{"items":{"$ref":"#/components/schemas/KeyRollupRow"},"type":"array","title":"By Key"},"total_compressions":{"type":"integer","title":"Total Compressions"},"total_savings_usd":{"type":"number","title":"Total Savings Usd"},"total_estimated_portion_usd":{"type":"number","title":"Total Estimated Portion Usd","default":0.0}},"type":"object","required":["period_days","by_key","total_compressions","total_savings_usd"],"title":"UsageByKeyResponse"},"UsageByModelResponse":{"properties":{"period_days":{"type":"integer","title":"Period Days"},"items":{"items":{"$ref":"#/components/schemas/ModelRollupItem"},"type":"array","title":"Items"}},"type":"object","required":["period_days","items"],"title":"UsageByModelResponse"},"UsageByToolResponse":{"properties":{"period_days":{"type":"integer","title":"Period Days"},"total_calls":{"type":"integer","title":"Total Calls"},"items":{"items":{"$ref":"#/components/schemas/ToolRollupItem"},"type":"array","title":"Items"}},"type":"object","required":["period_days","total_calls","items"],"title":"UsageByToolResponse"},"UsageHistoryPoint":{"properties":{"date":{"type":"string","title":"Date"},"compressions":{"type":"integer","title":"Compressions"},"tokens_in":{"type":"integer","title":"Tokens In"},"tokens_saved":{"type":"integer","title":"Tokens Saved"}},"type":"object","required":["date","compressions","tokens_in","tokens_saved"],"title":"UsageHistoryPoint","description":"Usage data for a single day."},"UsageHistoryResponse":{"properties":{"period":{"type":"string","title":"Period"},"days":{"type":"integer","title":"Days"},"data":{"items":{"$ref":"#/components/schemas/UsageHistoryPoint"},"type":"array","title":"Data"}},"type":"object","required":["period","days","data"],"title":"UsageHistoryResponse","description":"Time-series usage history."},"UsageResponse":{"properties":{"period":{"type":"string","title":"Period"},"compressions_used":{"type":"integer","title":"Compressions Used"},"compressions_limit":{"type":"integer","title":"Compressions Limit"},"pct_used":{"type":"number","title":"Pct Used"},"tokens_in":{"type":"integer","title":"Tokens In"},"tokens_saved":{"type":"integer","title":"Tokens Saved"},"resets_at":{"type":"string","title":"Resets At"},"alert":{"anyOf":[{"$ref":"#/components/schemas/UsageAlert"},{"type":"null"}]},"savings_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Savings Pct"},"savings_rows":{"type":"integer","title":"Savings Rows","default":0},"plan":{"type":"string","title":"Plan","default":"free"},"rate_limit_per_minute":{"type":"integer","title":"Rate Limit Per Minute","default":30},"path_rate_limits_per_minute":{"additionalProperties":{"type":"integer"},"type":"object","title":"Path Rate Limits Per Minute","default":{}}},"type":"object","required":["period","compressions_used","compressions_limit","pct_used","tokens_in","tokens_saved","resets_at"],"title":"UsageResponse","description":"Monthly usage statistics for the authenticated user."},"UserNotification":{"properties":{"id":{"type":"string","title":"Id"},"severity":{"type":"string","title":"Severity"},"category":{"type":"string","title":"Category"},"title":{"type":"string","title":"Title"},"message":{"type":"string","title":"Message"},"dismissible":{"type":"boolean","title":"Dismissible"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","severity","category","title","message","dismissible","created_at"],"title":"UserNotification","description":"A notification visible to the user."},"UsernameRequest":{"properties":{"username":{"type":"string","title":"Username"}},"type":"object","required":["username"],"title":"UsernameRequest","description":"Payload for PATCH /v1/account/username."},"UsernameResponse":{"properties":{"username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Username"}},"type":"object","required":["username"],"title":"UsernameResponse","description":"Response for GET and PATCH /v1/account/username."},"ValidateLicenseRequest":{"properties":{"license_key":{"type":"string","minLength":20,"title":"License Key"}},"type":"object","required":["license_key"],"title":"ValidateLicenseRequest","description":"Body for POST /v1/licenses/validate."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"VapidPublicKeyResponse":{"properties":{"public_key":{"type":"string","title":"Public Key"}},"type":"object","required":["public_key"],"title":"VapidPublicKeyResponse"},"VisibilityRequest":{"properties":{"visibility":{"type":"string","enum":["private","project","org","external"],"title":"Visibility","description":"Visibility level. 'org' and 'external' return 501 until v1.39 (requires Clerk org webhook integration)."}},"type":"object","required":["visibility"],"title":"VisibilityRequest","description":"Body for PATCH …/visibility."},"VoteRequest":{"properties":{"item_id":{"type":"string","title":"Item Id"},"value":{"type":"integer","maximum":1.0,"minimum":-1.0,"title":"Value"}},"type":"object","required":["item_id","value"],"title":"VoteRequest"},"VoteResult":{"properties":{"item_id":{"type":"string","title":"Item Id"},"net_score":{"type":"integer","title":"Net Score"},"upvote_count":{"type":"integer","title":"Upvote Count"},"downvote_count":{"type":"integer","title":"Downvote Count"},"user_vote":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"User Vote"}},"type":"object","required":["item_id","net_score","upvote_count","downvote_count"],"title":"VoteResult"},"WebhookDeliveriesResponse":{"properties":{"deliveries":{"items":{"$ref":"#/components/schemas/WebhookDeliveryResponse"},"type":"array","title":"Deliveries"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["deliveries","page","page_size","total"],"title":"WebhookDeliveriesResponse","description":"Paginated delivery history."},"WebhookDeliveryResponse":{"properties":{"id":{"type":"string","title":"Id"},"webhook_id":{"type":"string","title":"Webhook Id"},"event":{"type":"string","title":"Event"},"status":{"type":"string","title":"Status"},"attempts":{"type":"integer","title":"Attempts"},"response_code":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Response Code"},"latency_ms":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Latency Ms"},"last_attempt_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Attempt At"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","webhook_id","event","status","attempts","response_code","latency_ms","last_attempt_at","created_at"],"title":"WebhookDeliveryResponse","description":"Serialized delivery attempt sequence."},"WebhookListResponse":{"properties":{"webhooks":{"items":{"$ref":"#/components/schemas/WebhookResponse"},"type":"array","title":"Webhooks"}},"type":"object","required":["webhooks"],"title":"WebhookListResponse","description":"List of configured webhooks."},"WebhookResponse":{"properties":{"id":{"type":"string","title":"Id"},"url":{"type":"string","title":"Url"},"events":{"items":{"type":"string"},"type":"array","title":"Events"},"secret":{"type":"string","title":"Secret"},"is_active":{"type":"boolean","title":"Is Active"},"deleted_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Deleted At"},"created_at":{"type":"string","title":"Created At"},"team_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Team Id"},"project_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Id"}},"type":"object","required":["id","url","events","secret","is_active","deleted_at","created_at"],"title":"WebhookResponse","description":"Serialized webhook configuration."},"WithdrawRequest":{"properties":{"reason":{"type":"string","minLength":1,"title":"Reason"},"dmca":{"type":"boolean","title":"Dmca","default":false}},"type":"object","required":["reason"],"title":"WithdrawRequest"},"WithdrawResponse":{"properties":{"id":{"type":"string","title":"Id"},"status":{"type":"string","title":"Status"}},"type":"object","required":["id","status"],"title":"WithdrawResponse"},"WorkbenchCapabilities":{"properties":{"version":{"type":"integer","const":1,"title":"Version","default":1},"discovery_scope":{"type":"string","const":"account","title":"Discovery Scope","default":"account"},"session_discovery_enabled":{"type":"boolean","title":"Session Discovery Enabled"},"project_binding":{"type":"boolean","const":true,"title":"Project Binding","default":true},"self_service_launch":{"type":"boolean","const":false,"title":"Self Service Launch","default":false},"stop":{"type":"boolean","title":"Stop","default":false},"resume":{"type":"boolean","const":false,"title":"Resume","default":false},"owned_session_attach_enabled":{"type":"boolean","const":false,"title":"Owned Session Attach Enabled","description":"Unavailable until the isolated interactive runtime is verified; not resume.","default":false},"interactive_cli_supported":{"type":"boolean","const":false,"title":"Interactive Cli Supported","default":false}},"type":"object","required":["session_discovery_enabled"],"title":"WorkbenchCapabilities"},"WorkbenchContextInput":{"properties":{"project_id":{"type":"string","format":"uuid","title":"Project Id"}},"additionalProperties":false,"type":"object","required":["project_id"],"title":"WorkbenchContextInput"},"WorkbenchLinkRemoval":{"properties":{"removed":{"type":"boolean","title":"Removed"}},"type":"object","required":["removed"],"title":"WorkbenchLinkRemoval"},"WorkbenchSessionLink":{"properties":{"session_id":{"type":"string","title":"Session Id"},"conversation_id":{"type":"string","title":"Conversation Id"},"project_id":{"type":"string","title":"Project Id"},"linked_at":{"type":"string","format":"date-time","title":"Linked At"}},"type":"object","required":["session_id","conversation_id","project_id","linked_at"],"title":"WorkbenchSessionLink"},"WorkbenchSessionLinks":{"properties":{"sessions":{"items":{"$ref":"#/components/schemas/WorkbenchSessionSummary"},"type":"array","title":"Sessions"}},"type":"object","required":["sessions"],"title":"WorkbenchSessionLinks"},"WorkbenchSessionSummary":{"properties":{"id":{"type":"string","title":"Id"},"tool":{"type":"string","title":"Tool"},"status":{"type":"string","title":"Status"},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"last_seen_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Seen At"},"project_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Id"},"conversation_ids":{"items":{"type":"string"},"type":"array","title":"Conversation Ids"}},"type":"object","required":["id","tool","status","label","created_at","last_seen_at","project_id","conversation_ids"],"title":"WorkbenchSessionSummary"},"WorkflowDetail":{"properties":{"workflow_id":{"type":"string","title":"Workflow Id"},"name":{"type":"string","title":"Name"},"version_id":{"type":"string","title":"Version Id"},"version_no":{"type":"integer","title":"Version No"},"graph":{"additionalProperties":true,"type":"object","title":"Graph"},"created_version":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Created Version"},"renamed":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Renamed"}},"type":"object","required":["workflow_id","name","version_id","version_no","graph"],"title":"WorkflowDetail"},"WorkflowSummary":{"properties":{"workflow_id":{"type":"string","title":"Workflow Id"},"name":{"type":"string","title":"Name"},"updated_at":{"title":"Updated At"},"latest_version":{"type":"integer","title":"Latest Version"}},"type":"object","required":["workflow_id","name","updated_at","latest_version"],"title":"WorkflowSummary"},"WorkflowUpsert":{"properties":{"name":{"type":"string","maxLength":200,"title":"Name"},"graph":{"additionalProperties":true,"type":"object","title":"Graph"}},"type":"object","required":["name","graph"],"title":"WorkflowUpsert"},"api__app__routers__v1__audit_logs__AuditLogResponse":{"properties":{"entries":{"items":{"$ref":"#/components/schemas/AuditLogEntry"},"type":"array","title":"Entries"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"}},"type":"object","required":["entries","total","page","page_size"],"title":"AuditLogResponse","description":"Paginated audit log response."},"api__app__routers__v1__cli_terminal__AttachTicketResponse":{"properties":{"ticket":{"type":"string","title":"Ticket"},"expires_in_seconds":{"type":"integer","title":"Expires In Seconds"},"websocket_path":{"type":"string","title":"Websocket Path"}},"type":"object","required":["ticket","expires_in_seconds","websocket_path"],"title":"AttachTicketResponse"},"api__app__routers__v1__context_hub__IngestResponse":{"properties":{"slug":{"type":"string","title":"Slug"},"item_id":{"type":"string","title":"Item Id"},"version_id":{"type":"string","title":"Version Id"}},"type":"object","required":["slug","item_id","version_id"],"title":"IngestResponse"},"api__app__routers__v1__governance__AuditLogResponse":{"properties":{"events":{"items":{"$ref":"#/components/schemas/AuditEventResponse"},"type":"array","title":"Events"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"},"total_matching":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total Matching"}},"type":"object","required":["events"],"title":"AuditLogResponse"},"api__app__routers__v1__knowledge__IngestResponse":{"properties":{"item_id":{"type":"string","title":"Item Id"},"version_id":{"type":"string","title":"Version Id"}},"type":"object","required":["item_id","version_id"],"title":"IngestResponse"},"api__app__routers__v1__news_admin__IngestResponse":{"properties":{"created":{"items":{"$ref":"#/components/schemas/IngestItemResult"},"type":"array","title":"Created"},"duplicates":{"items":{"$ref":"#/components/schemas/IngestItemResult"},"type":"array","title":"Duplicates"},"errors":{"items":{"$ref":"#/components/schemas/IngestErrorResult"},"type":"array","title":"Errors"}},"type":"object","required":["created","duplicates","errors"],"title":"IngestResponse"},"api__app__routers__v1__plans__DecideRequest":{"properties":{"decision":{"type":"string","enum":["merge","reject"],"title":"Decision"}},"type":"object","required":["decision"],"title":"DecideRequest"},"api__app__routers__v1__sandbox_sessions__AttachTicketResponse":{"properties":{"ticket":{"type":"string","title":"Ticket"},"expires_at":{"type":"string","format":"date-time","title":"Expires At"}},"type":"object","required":["ticket","expires_at"],"title":"AttachTicketResponse"},"api__app__routers__v1__shares__DecideRequest":{"properties":{"decision":{"type":"string","title":"Decision"}},"type":"object","required":["decision"],"title":"DecideRequest"}}}}