{"openapi": "3.1.0", "info": {"title": "AutonoMath", "description": "AutonoMath is a Japanese public-program intelligence API + MCP server. It exposes a single retrieval surface over **10,790 補助金 / 融資 / 税制 / 認定** programs (tier S/A/B/C searchable; 1,923 tier-X rows are quarantined and not returned), **2,286 採択事例 (case studies)**, **108 融資 (loan products)** decomposed across the three risk axes (担保 / 個人保証人 / 第三者保証人), **1,185 行政処分 (enforcement cases)**, **9,484 laws** (e-Gov, CC-BY 4.0), **35 税務判定ルールセット (tax rulesets)**, **2,065 court decisions (判例)**, **362 bids (入札)**, and **13,801 適格請求書発行事業者 (NTA invoice registrants, PDL v1.0)**. Every row carries a primary-source URL + fetched_at timestamp.\n\n## Who this is for\n\nBuilt for LLM agents (Claude / ChatGPT / Perplexity / Cursor) and developers building Japanese-business automation. Use cases:\n- discover candidate 補助金 / 助成金 by region + industry + amount\n- check whether a 法人番号 is a registered 適格請求書発行事業者\n- look up the current 税務判定ルールセット (e.g. 2割特例, 電子帳簿保存法) and evaluate caller-supplied 事業者プロファイル against it\n- pull 採択事例 (real awarded grants) for prior-art research\n- check 行政処分 history before extending credit / awarding subsidy\n- read e-Gov 法令 articles and trace which programs cite them\n\n## Information lookup, not professional advice (税理士法 §52)\n\n**This API returns information retrieved from public Japanese government sources. It is NOT 税務助言 (tax advice), NOT 法律相談 (legal advice), and NOT a substitute for 士業 (税理士 / 弁護士 / 社労士 / 行政書士) consultation.** Every `/v1/am/*` and `/v1/tax_*` response carries an explicit `_disclaimer` envelope key making this fence machine-readable. LLM agents relaying this data to end users MUST surface the disclaimer.\n\n## Quickstart\n\nAnonymous (no auth, **50 req/月 per IP**, JST 月初 00:00 リセット):\n```bash\ncurl 'https://api.jpcite.com/v1/programs/search?q=IT導入&limit=5'\n```\n\nAuthenticated (¥3/req metered, 税込 ¥3.30, no tier SKUs, no minimums) — pass `X-API-Key: sk_...` issued via Stripe Checkout:\n```bash\ncurl -H 'X-API-Key: sk_live_...' 'https://api.jpcite.com/v1/programs/search?q=DX&prefecture=東京都&tier=S'\n```\n\n## Pagination + envelopes\n\n- All search endpoints share `{total, limit, offset, results[]}` shape with `limit<=100` (default 20).\n- Search responses returning data sourced from PDL v1.0 (NTA invoice registrants) carry an `attribution` block — required by the license. Do not strip it.\n- `/v1/am/*` and `/v1/tax_rulesets/*` carry `_disclaimer` (税理士法 §52 fence) — relay verbatim.\n\n## Operator\n\nBookyou株式会社 (適格請求書発行事業者番号 T8010001213708), 代表 梅田茂利, <email-redacted>. Canonical site: https://jpcite.com. MCP package: `pip install autonomath-mcp` (PyPI). MCP exposes 69 tools at default gates (39 jpintel + 30 autonomath; protocol 2025-06-18).\n\n---\n\n## 日本語要約 (JP summary)\n\nAutonoMath (税務会計AI) は **10,790 件の補助金 / 融資 / 税制 / 認定** (tier S/A/B/C のみ検索対象、tier X 1,923 件は品質保留)、**2,286 件の採択事例**、**108 件の融資商品** (担保 / 個人保証人 / 第三者保証人 三軸分解)、**1,185 件の行政処分**、**9,484 件の法令** (e-Gov / CC-BY 4.0)、**35 件の税務判定ルールセット**、**2,065 件の判例**、**362 件の入札案件**、**13,801 件の適格請求書発行事業者 (国税庁 / PDL v1.0)** を、REST + MCP の単一検索面で公開する API です。各レコードは 一次情報源 URL と取得時刻 (`source_url` / `fetched_at`) を保持しています。\n\n**用途:** LLM エージェント (Claude / ChatGPT / Perplexity / Cursor) と日本企業向け業務自動化開発者向け。地域 × 業種 × 金額の補助金候補抽出、13 桁 法人番号 → 適格請求書発行事業者 登録確認、税務判定ルール適用判断、採択事例の事前研究、行政処分歴の与信前 DD、e-Gov 法令の条文参照、等。\n\n**税理士法 §52 fence:** 本 API は公的情報の検索結果を返すサービスで、**税務助言・法律相談・士業 (税理士 / 弁護士 / 社労士 / 行政書士) 業務の代替ではありません**。`/v1/am/*` および `/v1/tax_*` の各レスポンスは `_disclaimer` キーをもち、機械可読な形でこの境界を表明しています。LLM エージェントは end user に情報を中継する際、`_disclaimer` を必ず併示してください。\n\n**料金体系:** 認証なし (匿名) は IP あたり 50 リクエスト / 月 (JST 月初 00:00 リセット)、有料は ¥3 / リクエスト 完全従量 (税込 ¥3.30)。tier 課金・座席課金・年契約最低料金はありません。Stripe Checkout で 発行した `X-API-Key: sk_...` を Authorization header に設定してください。\n\n**運営者:** Bookyou株式会社 (適格請求書発行事業者番号 T8010001213708 / 代表 梅田茂利 / <email-redacted> / 東京都文京区小日向2-22-1)。商号: 税務会計AI。公式サイト: https://jpcite.com/.", "version": "0.3.1", "contact": {"name": "AutonoMath Support", "email": "<email-redacted>"}, "termsOfService": "https://jpcite.com/terms.html", "license": {"name": "Proprietary - see termsOfService"}}, "paths": {"/v1/meta": {"get": {"tags": ["meta"], "summary": "Get Meta", "operationId": "get_meta_v1_meta_get", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Meta"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/healthz": {"get": {"tags": ["meta"], "summary": "Healthz", "operationId": "healthz_healthz_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"additionalProperties": {"type": "string"}, "type": "object", "title": "Response Healthz Healthz Get"}}}}}}}, "/v1/ping": {"get": {"tags": ["meta"], "summary": "Ping", "operationId": "ping_v1_ping_get", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/PingResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/health/data": {"get": {"tags": ["meta"], "summary": "Data Health", "description": "Row-count probe for the 5 canonical tables.\n\nReturns one entry per (table, db) pair. status:\n- \"ok\" — row count meets `expected_min_rows`\n- \"below_threshold\" — rows present but under the floor\n- \"empty\" — table reachable, 0 rows\n- \"missing\" — table or DB file unreachable\n\nAggregate `status` rolls up:\n- \"unhealthy\" if any check is \"missing\" OR \"empty\" with floor > 0\n- \"degraded\" if any check is \"below_threshold\"\n- \"ok\" otherwise\n\nUnbilled / unlogged / no anonymous quota — heartbeat surface for uptime\nmonitors. 30-second response cache.", "operationId": "data_health_v1_health_data_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/DataHealthResponse"}}}}}}}, "/v1/meta/freshness": {"get": {"tags": ["meta", "transparency"], "summary": "Meta Freshness", "operationId": "meta_freshness_v1_meta_freshness_get", "parameters": [{"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 500, "minimum": 1, "default": 50, "title": "Limit"}}, {"name": "sort_by", "in": "query", "required": false, "schema": {"type": "string", "pattern": "^(fetched_at_desc|fetched_at_asc|tier)$", "default": "fetched_at_desc", "title": "Sort By"}}, {"name": "tier", "in": "query", "required": false, "schema": {"type": "string", "pattern": "^(all|S|A|B|C)$", "default": "all", "title": "Tier"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MetaFreshnessResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/data-freshness": {"get": {"tags": ["transparency", "trust"], "summary": "Data Freshness", "description": "Public per-dataset freshness snapshot (no auth).\n\nCached 30 s in-process; the page polls every 5 minutes by default. The\nresponse shape is intentionally simple so the static page can render it\nwith a few lines of vanilla JS without a parser:\n\n    {\n      \"datasets\": [\n        {\"name\": \"programs\", \"row_count\": 13578,\n         \"last_fetched_at\": \"2026-04-25\", \"days_ago\": 4,\n         \"staleness\": \"fresh\",\n         \"license\": \"gov_standard_v2.0\",\n         \"source\": \"経済産業省 / 中小企業庁 / 各都道府県\"},\n        ...\n      ],\n      \"generated_at\": \"2026-04-29T01:23:45Z\"\n    }", "operationId": "data_freshness_v1_am_data_freshness_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"additionalProperties": true, "type": "object", "title": "Response Data Freshness V1 Am Data Freshness Get"}}}}}}}, "/v1/am/programs/{program_id}/sources": {"get": {"tags": ["transparency", "trust"], "summary": "Program Sources", "description": "Per-program cite chain — every primary URL used to compose the row.\n\nJoins am_entity_source × am_source for the entity matching this\nprogram's unified_id (looked up via entity_id_map). Returns:\n\n    {\n      \"program_id\": \"UNI-...\",\n      \"entity_id\": \"AM-...\",\n      \"name\": \"...\",\n      \"sources\": [\n        {\"source_url\": \"https://...\", \"source_type\": \"primary\",\n         \"domain\": \"meti.go.jp\", \"license\": \"gov_standard_v2.0\",\n         \"is_pdf\": false, \"first_seen\": \"2026-03-12\",\n         \"last_verified\": \"2026-04-25\",\n         \"role\": \"primary_source\", \"source_field\": \"official_url\"},\n        ...\n      ],\n      \"generated_at\": \"2026-04-29T01:23:45Z\"\n    }\n\nReturns 404 if the program is unknown to either jpi_programs or\nentity_id_map. Cite-chain transparency is the differentiator vs\naggregator sites — we publish every URL, no opaque \"scraped from\nmultiple sources\" claims.", "operationId": "program_sources_v1_am_programs__program_id__sources_get", "parameters": [{"name": "program_id", "in": "path", "required": true, "schema": {"type": "string", "minLength": 1, "maxLength": 120, "title": "Program Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "object", "additionalProperties": true, "title": "Response Program Sources V1 Am Programs  Program Id  Sources Get"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/health/sla": {"get": {"tags": ["trust", "trust", "sla"], "summary": "Sla Metrics", "description": "Public SLA metrics — uptime + p95 latency.\n\nReads from jpintel.db `usage_events` (every API call lands a row).\nUptime = (status < 500) / total. p95 across non-error events.", "operationId": "sla_metrics_v1_health_sla_get", "parameters": [{"name": "window", "in": "query", "required": false, "schema": {"type": "string", "pattern": "^(24h|7d)$", "default": "7d", "title": "Window"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SlaResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/corrections": {"get": {"tags": ["trust", "trust", "corrections"], "summary": "List Corrections", "description": "Most-recent corrections (correction_log table, mig 101).\n\nReverse-chrono. Cite-only — every row carries source_url + reproducer_sql\nso an auditor can verify the correction byte-for-byte.", "operationId": "list_corrections_v1_corrections_get", "parameters": [{"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 100, "minimum": 1, "default": 50, "title": "Limit"}}, {"name": "dataset", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "minLength": 1, "maxLength": 64}, {"type": "null"}], "title": "Dataset"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "post": {"tags": ["trust", "trust", "corrections"], "summary": "Submit Correction", "description": "Customer-submitted data correction. Idempotent on (entity_id, field, IP-hash, day).", "operationId": "submit_correction_v1_corrections_post", "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/CorrectionSubmit"}}}}, "responses": {"201": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/corrections/feed": {"get": {"tags": ["trust", "trust", "corrections"], "summary": "Corrections Rss Feed", "description": "RSS 2.0 of the latest 50 corrections.", "operationId": "corrections_rss_feed_v1_corrections_feed_get", "responses": {"200": {"description": "Successful Response"}}}}, "/v1/trust/section52": {"get": {"tags": ["trust", "trust", "audit"], "summary": "Audit Section52", "description": "Per-day §52 violation count rollup.\n\nReads `audit_log_section52` (mig 101). The cron sampler populates this\ntable; here we return the aggregate so the public /compliance page can\nrender trend-line + verdict.", "operationId": "audit_section52_v1_trust_section52_get", "parameters": [{"name": "days", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 90, "minimum": 1, "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/cross_source/{entity_id}": {"get": {"tags": ["trust", "trust", "cross_source"], "summary": "Cross Source Check", "description": "Verify how many distinct sources confirm an entity (or one field).\n\nWraps services.cross_source.compute_cross_source_agreement so callers\nget a single endpoint while the math lives in a unit-testable module.", "operationId": "cross_source_check_v1_cross_source__entity_id__get", "parameters": [{"name": "entity_id", "in": "path", "required": true, "schema": {"type": "string", "minLength": 1, "maxLength": 200, "title": "Entity Id"}}, {"name": "field", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "minLength": 1, "maxLength": 120}, {"type": "null"}], "title": "Field"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/staleness": {"get": {"tags": ["trust", "trust", "staleness"], "summary": "Staleness Summary", "description": "Per-dataset count of rows fresher / staler than threshold_days.", "operationId": "staleness_summary_v1_staleness_get", "parameters": [{"name": "threshold_days", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 365, "minimum": 1, "default": 90, "title": "Threshold Days"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/stats/coverage": {"get": {"tags": ["stats", "transparency"], "summary": "Stats Coverage", "operationId": "stats_coverage_v1_stats_coverage_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/CoverageResponse"}}}}}}}, "/v1/stats/freshness": {"get": {"tags": ["stats", "transparency"], "summary": "Stats Freshness", "operationId": "stats_freshness_v1_stats_freshness_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/FreshnessResponse"}}}}}}}, "/v1/stats/usage": {"get": {"tags": ["stats", "transparency"], "summary": "Stats Usage", "operationId": "stats_usage_v1_stats_usage_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UsageResponse"}}}}}}}, "/v1/stats/data_quality": {"get": {"tags": ["stats", "transparency"], "summary": "Stats Data Quality", "operationId": "stats_data_quality_v1_stats_data_quality_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/DataQualityResponse"}}}}}}}, "/v1/stats/confidence": {"get": {"tags": ["stats", "transparency"], "summary": "Stats Confidence", "description": "Live Bayesian Discovery + Use posteriors per tool, last 30 days.", "operationId": "stats_confidence_v1_stats_confidence_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ConfidenceResponse"}}}}}}}, "/v1/testimonials": {"get": {"tags": ["testimonials"], "summary": "List Testimonials", "operationId": "list_testimonials_v1_testimonials_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/TestimonialListResponse"}}}}}}}, "/v1/usage": {"get": {"tags": ["usage"], "summary": "Get Usage", "description": "Probe the caller's current quota state without consuming a slot.\n\nThe handler is *not* attached to ``AnonIpLimitDep`` so anonymous\ncallers can call it freely — the whole point of the tool is to\navoid burning the bucket while checking it.", "operationId": "get_usage_v1_usage_get", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/UsageStatus"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/programs/search": {"get": {"tags": ["programs"], "summary": "Search 補助金 / 助成金 / 融資 / 税制 / 認定 programs", "description": "Discover candidate Japanese public-funding programs by free-text + structured filters across **10,790 active rows** (tier S/A/B/C — tier X is a quality-gate quarantine, not returned). Backed by FTS5 trigram on name/aliases/enriched_json plus exact filters on prefecture, authority_level, target_types, funding_purpose, and amount band.\n\n**When to use this endpoint:** the caller has a topic / region / kind in mind ('IT導入', '東京都', '補助金') and wants candidates. For *judgment* (does this profile fit?), prefer `POST /v1/programs/prescreen`. For exact-id lookup use `GET /v1/programs/{unified_id}`. For up-to-50 ids in one call use `POST /v1/programs/batch`.\n\n**FTS5 query rewriting (automatic — no operator tweaks needed):** the handler treats `q` as free text and rewrites it into a safe FTS5 MATCH expression before execution.\n - 2+ char kanji compounds are auto phrase-quoted (`q=税額控除` → `\"税額控除\"`) so the trigram tokens must appear contiguously. This defeats the single-kanji overlap false-positive (`税額控除` no longer co-ranks `ふるさと納税`-only rows).\n - User-quoted phrases are preserved verbatim. `q='\"中小企業 デジタル化\"'` searches the whole phrase as one term; `q='\"DX\" 製造業'` ANDs DX (phrase) with 製造業 (auto-quoted).\n - Whitespace + Japanese/ASCII punctuation (`,` `、` `。` `;` `!` etc.) are token separators. FTS5-special chars (`*` `:` `(` `)` `^` `+`) are stripped to keep the parser predictable.\n - Full-width ASCII / 全角 space NFKC-normalized to half-width (`ＩＴ補助金` matches `IT補助金`).\n - Hiragana/katakana readings auto-OR'd with their kanji canonical form when in the KANA_EXPANSIONS map (`q=のうぎょう` matches 農業-only docs). Wrap in quotes (`q='\"のうぎょう\"'`) to disable expansion.\n - Empty / whitespace / punctuation-only `q` (no other filter) returns 0 rows — this is a safety guard against accidental corpus dumps. Combine `q=` with `tier=S` etc. to browse by structural filter without a free-text term.\n\nUse `as_of_date=YYYY-MM-DD` to pin the result set to a historical dataset state (R8 dataset versioning) — useful for 申告時点の 制度状態 audit. Rows are honestly tiered (S/A/B/C); `confidence` and `source_fetched_at` are exposed per-row.", "operationId": "search_programs_v1_programs_search_get", "parameters": [{"name": "q", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}], "description": "Free-text search across primary_name / aliases / enriched. The handler auto phrase-quotes 2+ char kanji compounds to defeat trigram single-kanji false matches; user `\"...\"` phrases are preserved verbatim; punctuation acts as token separator. Empty `q` with no other filter returns 0 (corpus dump guard). See endpoint description for full rules.", "title": "Q"}, "description": "Free-text search across primary_name / aliases / enriched. The handler auto phrase-quotes 2+ char kanji compounds to defeat trigram single-kanji false matches; user `\"...\"` phrases are preserved verbatim; punctuation acts as token separator. Empty `q` with no other filter returns 0 (corpus dump guard). See endpoint description for full rules."}, {"name": "tier", "in": "query", "required": false, "schema": {"anyOf": [{"type": "array", "items": {"enum": ["S", "A", "B", "C", "X"], "type": "string"}}, {"type": "null"}], "description": "filter tier, repeat for OR", "title": "Tier"}, "description": "filter tier, repeat for OR"}, {"name": "prefecture", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 20}, {"type": "null"}], "description": "Prefecture name. Canonical = full-suffix kanji ('東京都'). Also accepts short ('東京') and romaji ('Tokyo'/'tokyo'); normalized server-side. Use '全国' (or 'national'/'all') for nationwide programs.", "title": "Prefecture"}, "description": "Prefecture name. Canonical = full-suffix kanji ('東京都'). Also accepts short ('東京') and romaji ('Tokyo'/'tokyo'); normalized server-side. Use '全国' (or 'national'/'all') for nationwide programs."}, {"name": "authority_level", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 20}, {"type": "null"}], "description": "Authority level. Canonical (English): `national` / `prefecture` / `municipality` / `financial`. Also accepts Japanese: `国` / `都道府県` / `市区町村` (normalized server-side).", "title": "Authority Level"}, "description": "Authority level. Canonical (English): `national` / `prefecture` / `municipality` / `financial`. Also accepts Japanese: `国` / `都道府県` / `市区町村` (normalized server-side)."}, {"name": "funding_purpose", "in": "query", "required": false, "schema": {"anyOf": [{"type": "array", "items": {"type": "string"}, "maxItems": 64}, {"type": "null"}], "title": "Funding Purpose"}}, {"name": "target_type", "in": "query", "required": false, "schema": {"anyOf": [{"type": "array", "items": {"type": "string"}, "maxItems": 64}, {"type": "null"}], "title": "Target Type"}}, {"name": "amount_min", "in": "query", "required": false, "schema": {"anyOf": [{"type": "number", "minimum": 0}, {"type": "null"}], "title": "Amount Min"}}, {"name": "amount_max", "in": "query", "required": false, "schema": {"anyOf": [{"type": "number", "minimum": 0}, {"type": "null"}], "title": "Amount Max"}}, {"name": "include_excluded", "in": "query", "required": false, "schema": {"type": "boolean", "default": false, "title": "Include Excluded"}}, {"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"}}, {"name": "fields", "in": "query", "required": false, "schema": {"enum": ["minimal", "default", "full"], "type": "string", "description": "Payload size knob. minimal = 7-key whitelist (~300 B/row). default = full Program shape (current behavior). full = Program + enriched + source_mentions + lineage.", "default": "default", "title": "Fields"}, "description": "Payload size knob. minimal = 7-key whitelist (~300 B/row). default = full Program shape (current behavior). full = Program + enriched + source_mentions + lineage."}, {"name": "include_advisors", "in": "query", "required": false, "schema": {"type": "boolean", "description": "When true, attach up to 3 matching 士業/認定支援機関 advisors under `matched_advisors` on the response envelope. Additive — the `results[]` shape is unchanged for callers that leave this false (default). Match ranks on prefecture + target_type.", "default": false, "title": "Include Advisors"}, "description": "When true, attach up to 3 matching 士業/認定支援機関 advisors under `matched_advisors` on the response envelope. Additive — the `results[]` shape is unchanged for callers that leave this false (default). Match ranks on prefecture + target_type."}, {"name": "as_of_date", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 10}, {"type": "null"}], "description": "R8 dataset versioning — pin the result set to the dataset state at YYYY-MM-DD (ISO-8601 date). Predicate: `valid_from <= as_of_date AND (valid_until IS NULL OR valid_until > as_of_date)`. Omit / null = live (today). Used by tax accountants / 行政書士 to fix 申告時点の制度状態 for audit. Returns 422 on malformed date.", "title": "As Of Date"}, "description": "R8 dataset versioning — pin the result set to the dataset state at YYYY-MM-DD (ISO-8601 date). Predicate: `valid_from <= as_of_date AND (valid_until IS NULL OR valid_until > as_of_date)`. Omit / null = live (today). Used by tax accountants / 行政書士 to fix 申告時点の制度状態 for audit. Returns 422 on malformed date."}, {"name": "format", "in": "query", "required": false, "schema": {"type": "string", "pattern": "^(json|csv|xlsx|md|csv-freee|csv-mf|csv-yayoi)$", "description": "Output format. Default `json` returns the SearchResponse envelope unchanged. Other values dispatch to the 6-pack renderer surface (csv / xlsx / md / csv-freee / csv-mf / csv-yayoi). `ics` and `docx-application` are intentionally rejected here — ICS belongs to deadline-bearing endpoints (saved_searches) and DOCX is per-program (get-by-id). One ¥3 charge per request regardless of format.", "default": "json", "title": "Format"}, "description": "Output format. Default `json` returns the SearchResponse envelope unchanged. Other values dispatch to the 6-pack renderer surface (csv / xlsx / md / csv-freee / csv-mf / csv-yayoi). `ics` and `docx-application` are intentionally rejected here — ICS belongs to deadline-bearing endpoints (saved_searches) and DOCX is per-program (get-by-id). One ¥3 charge per request regardless of format."}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "SearchResponse. `results[]` shape depends on `fields`: minimal = 7-key whitelist, default = Program, full = ProgramDetail.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/jpintel_mcp__models__SearchResponse"}, "example": {"total": 3, "limit": 20, "offset": 0, "results": [{"unified_id": "UNI-185c08e0c1", "primary_name": "デジタル化・AI導入補助金（旧IT導入補助金）", "tier": "B", "authority_level": "national", "authority_name": "国（農水省等）", "program_kind": "subsidy", "amount_max_man_yen": 450.0, "subsidy_rate": 0.5, "funding_purpose": ["DX", "デジタル化"], "target_types": ["sme", "sole_proprietor"], "official_url": "https://it-shien.smrj.go.jp/", "source_url": "https://it-shien.smrj.go.jp/", "source_fetched_at": "2026-04-22T13:20:57Z"}, {"unified_id": "UNI-2611050f9a", "primary_name": "小規模事業者持続化補助金", "tier": "B", "authority_level": "national", "authority_name": "日本商工会議所/全国商工会連合会", "program_kind": "subsidy", "amount_max_man_yen": 200.0, "funding_purpose": ["販路開拓", "業務効率化"], "target_types": ["sole_proprietor", "sme"], "source_fetched_at": "2026-04-22T13:20:57Z"}]}}}}, "400": {"description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "401": {"description": "Authentication required — `code='auth_required'`. Send `X-API-Key`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "404": {"description": "Not found — `code` ∈ {no_matching_records, seed_not_found, route_not_found}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "422": {"description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`).", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "429": {"description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "500": {"description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "503": {"description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}}}}, "/v1/programs/batch": {"post": {"tags": ["programs"], "summary": "Batch fetch up to 50 programs by unified_id", "description": "Resolve up to 50 `unified_id` values in a single round-trip. Output shape matches `GET /v1/programs/{unified_id}` per row, so SDK callers can `chunk(ids, 50)` and stitch locally without per-id round trips. The 50-cap *is* the pagination — there is no page envelope.\n\n**Order contract:** `results[i]` corresponds to the i-th deduped input id (first occurrence wins). Missing ids go to `not_found[]` — this is NOT a 404, partial success is the point. Batch hard-codes `fields=full` so anonymous tier callers must upgrade (sequential GETs with `fields=default` remain anonymous-OK).", "operationId": "batch_get_programs_v1_programs_batch_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/BatchGetProgramsRequest"}}}}, "responses": {"200": {"description": "Batch ProgramDetail lookup. `results[]` is ordered by the deduped input `unified_ids`. Ids not found in the DB go to `not_found` — this is NOT a 404, because partial success is the point of batch.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/BatchGetProgramsResponse"}, "example": {"results": [{"unified_id": "UNI-2611050f9a", "primary_name": "小規模事業者持続化補助金", "tier": "B", "authority_level": "national", "authority_name": "日本商工会議所/全国商工会連合会", "program_kind": "subsidy", "amount_max_man_yen": 200.0, "official_url": "https://r3.jizokukahojokin.info/", "source_fetched_at": "2026-04-22T13:20:57Z"}, {"unified_id": "UNI-185c08e0c1", "primary_name": "デジタル化・AI導入補助金（旧IT導入補助金）", "tier": "B", "authority_level": "national", "authority_name": "国（農水省等）", "program_kind": "subsidy", "amount_max_man_yen": 450.0, "official_url": "https://it-shien.smrj.go.jp/", "source_fetched_at": "2026-04-22T13:20:57Z"}], "not_found": ["UNI-deadbeef00"]}}}}, "400": {"description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "401": {"description": "Authentication required — `code='auth_required'`. Send `X-API-Key`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "404": {"description": "Not found — `code` ∈ {no_matching_records, seed_not_found, route_not_found}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "422": {"description": "input validation failed (empty list, >50 ids, bad shape). `error.code='invalid_enum'`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "429": {"description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "500": {"description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "503": {"description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}}}}, "/v1/programs/{unified_id}": {"get": {"tags": ["programs"], "summary": "Get a single program by unified_id (UNI-*)", "description": "Look up one program (補助金 / 融資 / 税制 / 認定) by stable `unified_id` (`UNI-<10 hex>`). Returns the full program detail including `enriched_json` (eligibility narrative, application window, required documents) and lineage (`source_url`, `source_fetched_at`, `source_checksum`).\n\n**404 semantics:** tier-X (quarantined) rows return 404 — the stable slug must never serve a quality-gated row. To pin the lookup to a historical dataset state, supply `as_of_date=YYYY-MM-DD` (R8 dataset versioning).\n\n**Discovery flow:** call `GET /v1/programs/search` first, then follow up on each `unified_id` with this endpoint to get the narrative + required-documents detail.", "operationId": "get_program_v1_programs__unified_id__get", "parameters": [{"name": "unified_id", "in": "path", "required": true, "schema": {"type": "string", "title": "Unified Id"}}, {"name": "fields", "in": "query", "required": false, "schema": {"enum": ["minimal", "default", "full"], "type": "string", "description": "Payload size knob. minimal = 7-key whitelist. default = Program + enriched + source_mentions + lineage (current behavior — this endpoint has always returned ProgramDetail, so default == full in shape; the two values differ only in the guarantee that full's enriched/source_mentions keys are present even when null).", "default": "default", "title": "Fields"}, "description": "Payload size knob. minimal = 7-key whitelist. default = Program + enriched + source_mentions + lineage (current behavior — this endpoint has always returned ProgramDetail, so default == full in shape; the two values differ only in the guarantee that full's enriched/source_mentions keys are present even when null)."}, {"name": "as_of_date", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 10}, {"type": "null"}], "description": "R8 dataset versioning — pin lookup to dataset state at YYYY-MM-DD (ISO-8601). When set, the row is filtered with `valid_from <= as_of_date AND (valid_until IS NULL OR valid_until > as_of_date)`. Omit / null = live (today).", "title": "As Of Date"}, "description": "R8 dataset versioning — pin lookup to dataset state at YYYY-MM-DD (ISO-8601). When set, the row is filtered with `valid_from <= as_of_date AND (valid_until IS NULL OR valid_until > as_of_date)`. Omit / null = live (today)."}, {"name": "format", "in": "query", "required": false, "schema": {"type": "string", "pattern": "^(json|csv|xlsx|md|docx-application)$", "description": "Output format. Default `json` returns the ProgramDetail envelope unchanged. Other values dispatch to: csv / xlsx / md / docx-application. ICS and accounting CSVs (freee / mf / yayoi) are rejected here — ICS belongs to deadline-bearing list endpoints, and accounting CSVs are list-shaped. One ¥3 charge per request regardless of format.", "default": "json", "title": "Format"}, "description": "Output format. Default `json` returns the ProgramDetail envelope unchanged. Other values dispatch to: csv / xlsx / md / docx-application. ICS and accounting CSVs (freee / mf / yayoi) are rejected here — ICS belongs to deadline-bearing list endpoints, and accounting CSVs are list-shaped. One ¥3 charge per request regardless of format."}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "ProgramDetail. Shape depends on `fields`: minimal = 7-key whitelist, default = Program shape, full = Program + enriched + source_mentions + lineage (keys always present, may be null).", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProgramDetail"}, "example": {"unified_id": "UNI-2611050f9a", "primary_name": "小規模事業者持続化補助金", "tier": "B", "authority_level": "national", "authority_name": "日本商工会議所/全国商工会連合会", "program_kind": "subsidy", "amount_max_man_yen": 200.0, "funding_purpose": ["販路開拓", "業務効率化"], "target_types": ["sole_proprietor", "sme"], "official_url": "https://r3.jizokukahojokin.info/", "source_url": "https://r3.jizokukahojokin.info/", "source_fetched_at": "2026-04-22T13:20:57Z", "source_mentions": {}, "required_documents": ["事業計画書", "経費明細書"]}}}}, "400": {"description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "401": {"description": "Authentication required — `code='auth_required'`. Send `X-API-Key`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "404": {"description": "program not found — `error.code='no_matching_records'`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "422": {"description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`).", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "429": {"description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "500": {"description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "503": {"description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}}}}, "/v1/programs/prescreen": {"post": {"tags": ["programs"], "summary": "Prescreen — rank programs by fit to a business profile", "description": "Profile-oriented match: given a caller's `prefecture` / `industry_jsic` / `is_sole_proprietor` / `employee_count` / `planned_investment_man_yen` / declared `held_certifications`, return ranked candidate programs with per-row `reasons[]` and `caveats[]`.\n\n**When to use prescreen vs search:** `/v1/programs/search` answers 'which programs mention X?' (keyword discovery). Prescreen answers 'which programs could *I* plausibly apply to, and why?' (fit judgment). LLM agents building 'help this SMB find support' flows should prefer prescreen — it cuts the keyword-guessing round-trips.\n\n**Scope (v1):** prefecture (direct + 全国 fallback), target_types (sole_proprietor / corporation, EN+JP aliases), amount sufficiency vs `planned_investment_man_yen`, and exclusion-rule prerequisite flagging (e.g. 認定新規就農者 required but not declared). Ranking: tier (S>A>B>C) → match count → amount_max_man_yen desc.", "operationId": "prescreen_programs_v1_programs_prescreen_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/PrescreenRequest"}}}}, "responses": {"200": {"description": "Ranked prescreen matches with reasons + caveats.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/PrescreenResponse"}, "example": {"total_considered": 312, "limit": 20, "results": [{"unified_id": "UNI-2611050f9a", "primary_name": "小規模事業者持続化補助金", "tier": "B", "authority_level": "national", "prefecture": "全国", "amount_max_man_yen": 200.0, "official_url": "https://r3.jizokukahojokin.info/", "static_url": "/programs/shoukibo-jigyousha-jizokuka-hojokin-2611050f9a.html", "fit_score": 3, "match_reasons": ["prefecture match: 全国 program covers 東京都", "target_types に 個人事業主 相当 (sole_proprietor) を含む", "amount_max 200万円 ≥ 予定投資 80万円"], "caveats": []}], "profile_echo": {"prefecture": "東京都", "industry_jsic": "G", "is_sole_proprietor": true, "planned_investment_man_yen": 80, "declared_certifications": []}}}}}, "400": {"description": "Malformed profile."}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/exclusions/rules": {"get": {"tags": ["exclusions"], "summary": "List Rules", "operationId": "list_rules_v1_exclusions_rules_get", "parameters": [{"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 500, "minimum": 1, "description": "Maximum number of rules to return. Defaults to 200 (currently returns the full ruleset of 181). Cap is 500 to bound response size for AI-agent callers paying ¥3/req.", "default": 200, "title": "Limit"}, "description": "Maximum number of rules to return. Defaults to 200 (currently returns the full ruleset of 181). Cap is 500 to bound response size for AI-agent callers paying ¥3/req."}, {"name": "offset", "in": "query", "required": false, "schema": {"type": "integer", "minimum": 0, "description": "Number of rules to skip for pagination (0 = first page).", "default": 0, "title": "Offset"}, "description": "Number of rules to skip for pagination (0 = first page)."}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/ExclusionRule"}, "title": "Response List Rules V1 Exclusions Rules Get"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/exclusions/check": {"post": {"tags": ["exclusions"], "summary": "Check Exclusions", "operationId": "check_exclusions_v1_exclusions_check_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ExclusionCheckRequest"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ExclusionCheckResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/enforcement-cases/search": {"get": {"tags": ["enforcement-cases"], "summary": "Search Enforcement Cases", "description": "Search enforcement cases for compliance / DD lookup.", "operationId": "search_enforcement_cases_v1_enforcement_cases_search_get", "parameters": [{"name": "q", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}], "description": "Free-text search over program_name_hint + reason_excerpt + source_title (LIKE, case-insensitive).", "title": "Q"}, "description": "Free-text search over program_name_hint + reason_excerpt + source_title (LIKE, case-insensitive)."}, {"name": "event_type", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 80}, {"type": "null"}], "title": "Event Type"}}, {"name": "ministry", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 120}, {"type": "null"}], "title": "Ministry"}}, {"name": "prefecture", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 80}, {"type": "null"}], "title": "Prefecture"}}, {"name": "legal_basis", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}], "title": "Legal Basis"}}, {"name": "program_name_hint", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}], "title": "Program Name Hint"}}, {"name": "recipient_houjin_bangou", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 13}, {"type": "null"}], "description": "13-digit 法人番号 filter. NOTE: this column is 100% NULL across all 1,185 enforcement cases because 会計検査院 does not publish 法人番号. Filtering by this parameter will always return 0 rows. Use `q=<company_name>` or `q=<houjin_bangou_digits>` for substring search over source_title / reason_excerpt / program_name_hint instead.", "title": "Recipient Houjin Bangou"}, "description": "13-digit 法人番号 filter. NOTE: this column is 100% NULL across all 1,185 enforcement cases because 会計検査院 does not publish 法人番号. Filtering by this parameter will always return 0 rows. Use `q=<company_name>` or `q=<houjin_bangou_digits>` for substring search over source_title / reason_excerpt / program_name_hint instead."}, {"name": "min_improper_grant_yen", "in": "query", "required": false, "schema": {"anyOf": [{"type": "integer", "minimum": 0}, {"type": "null"}], "title": "Min Improper Grant Yen"}}, {"name": "max_improper_grant_yen", "in": "query", "required": false, "schema": {"anyOf": [{"type": "integer", "minimum": 0}, {"type": "null"}], "title": "Max Improper Grant Yen"}}, {"name": "disclosed_from", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$"}, {"type": "null"}], "description": "ISO date (YYYY-MM-DD) — inclusive lower bound on disclosed_date.", "title": "Disclosed From"}, "description": "ISO date (YYYY-MM-DD) — inclusive lower bound on disclosed_date."}, {"name": "disclosed_until", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$"}, {"type": "null"}], "description": "ISO date (YYYY-MM-DD) — inclusive upper bound on disclosed_date.", "title": "Disclosed Until"}, "description": "ISO date (YYYY-MM-DD) — inclusive upper bound on disclosed_date."}, {"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"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Paginated 行政処分 / 会計検査院 indications. Use this for compliance / due-diligence on a recipient or program.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/EnforcementCaseSearchResponse"}, "example": {"total": 1, "limit": 20, "offset": 0, "results": [{"case_id": "ENF-jftc-2024-00045", "event_type": "排除措置命令", "recipient_name": "株式会社サンプル建設", "recipient_kind": "houjin", "recipient_houjin_bangou": "9876543210987", "ministry": "公正取引委員会", "prefecture": "大阪府", "amount_yen": 12500000, "reason_excerpt": "公共工事入札談合の事実を認定。", "source_url": "https://www.jftc.go.jp/houdou/pressrelease/2024/feb/...", "source_title": "排除措置命令及び課徴金納付命令について", "disclosed_date": "2024-02-15", "fetched_at": "2026-04-22T08:11:00Z", "confidence": 0.98}]}}}}, "400": {"description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "401": {"description": "Authentication required — `code='auth_required'`. Send `X-API-Key`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "404": {"description": "Not found — `code` ∈ {no_matching_records, seed_not_found, route_not_found}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "422": {"description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`).", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "429": {"description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "500": {"description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "503": {"description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}}}}, "/v1/enforcement-cases/{case_id}": {"get": {"tags": ["enforcement-cases"], "summary": "Get Enforcement Case", "description": "Return one enforcement case with audit-trail snapshot fields.\n\nAudit trail (会計士 work-paper, added 2026-04-29): the response includes\n`corpus_snapshot_id` + `corpus_checksum` so an auditor citing this\n行政処分 case in a work-paper can reproduce the lookup later and detect\nwhether the corpus mutated. See docs/audit_trail.md.", "operationId": "get_enforcement_case_v1_enforcement_cases__case_id__get", "parameters": [{"name": "case_id", "in": "path", "required": true, "schema": {"type": "string", "title": "Case Id"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/EnforcementCase"}}}}, "400": {"description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "401": {"description": "Authentication required — `code='auth_required'`. Send `X-API-Key`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "404": {"description": "case not found — `error.code='no_matching_records'`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "422": {"description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`).", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "429": {"description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "500": {"description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "503": {"description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}}}}, "/v1/case-studies/search": {"get": {"tags": ["case-studies"], "summary": "Search 採択事例 (awarded grant case studies)", "description": "Browse 2,286 採択事例 (real awarded grants) — searchable across `company_name + case_title + case_summary + source_excerpt` via FTS5 trigram + filterable by 都道府県 / industry_jsic / 法人番号 / `program_used` / 補助金額 band / 従業員数 band.\n\n**Use cases:** prior-art research ('which companies received ものづくり補助金 in 群馬?'), benchmark sizing ('what's the typical amount for 製造業 + 100 employees?'), or co-applicant discovery.\n\n**Sparsity caveats:**\n- only ~19% of rows carry 法人番号 (427 / 2,286) — most 採択 announcements publish 社名 only. Prefer `q=<company_name>` for substring search when 法人番号 is unknown.\n- only <1% (4 / 2,286) carry an `amount_received_man_yen` value — ministries publish 採択 without 交付額. Filtering on `min_subsidy_yen` / `max_subsidy_yen` silently drops ~99% of matches; avoid unless the user explicitly asked for an amount band.", "operationId": "search_case_studies_v1_case_studies_search_get", "parameters": [{"name": "q", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}], "description": "Free-text search over company_name + case_title + case_summary + source_excerpt. Backed by FTS5 trigram (case_studies_fts) for queries of length >= 2; falls back to LIKE for single-char or 0-result short-ASCII queries.", "title": "Q"}, "description": "Free-text search over company_name + case_title + case_summary + source_excerpt. Backed by FTS5 trigram (case_studies_fts) for queries of length >= 2; falls back to LIKE for single-char or 0-result short-ASCII queries."}, {"name": "prefecture", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 80}, {"type": "null"}], "title": "Prefecture"}}, {"name": "industry_jsic", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 10}, {"type": "null"}], "description": "JSIC industry code prefix (e.g. 'A' for 農林水産業, '05' for 食料品製造業).", "title": "Industry Jsic"}, "description": "JSIC industry code prefix (e.g. 'A' for 農林水産業, '05' for 食料品製造業)."}, {"name": "houjin_bangou", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 13}, {"type": "null"}], "description": "13-digit 法人番号 exact match. NOTE: only ~19% of case studies carry 法人番号 (427 / 2,286 rows) — most 採択 announcements publish 社名 only. Prefer `q=<company_name>` for substring search when the 法人番号 is unknown.", "title": "Houjin Bangou"}, "description": "13-digit 法人番号 exact match. NOTE: only ~19% of case studies carry 法人番号 (427 / 2,286 rows) — most 採択 announcements publish 社名 only. Prefer `q=<company_name>` for substring search when the 法人番号 is unknown."}, {"name": "program_used", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}], "description": "Match rows whose programs_used_json list contains this program name or unified_id substring.", "title": "Program Used"}, "description": "Match rows whose programs_used_json list contains this program name or unified_id substring."}, {"name": "min_subsidy_yen", "in": "query", "required": false, "schema": {"anyOf": [{"type": "integer", "minimum": 0}, {"type": "null"}], "description": "Lower bound on total_subsidy_received_yen (JPY). WARNING: only 4 / 2,286 rows (<1%) carry an amount — ministries publish 採択 without 交付額. Filtering here silently drops ~99% of matches.", "title": "Min Subsidy Yen"}, "description": "Lower bound on total_subsidy_received_yen (JPY). WARNING: only 4 / 2,286 rows (<1%) carry an amount — ministries publish 採択 without 交付額. Filtering here silently drops ~99% of matches."}, {"name": "max_subsidy_yen", "in": "query", "required": false, "schema": {"anyOf": [{"type": "integer", "minimum": 0}, {"type": "null"}], "description": "Upper bound on total_subsidy_received_yen (JPY). Same <1% sparsity as min_subsidy_yen — avoid unless the user explicitly asked for a ceiling.", "title": "Max Subsidy Yen"}, "description": "Upper bound on total_subsidy_received_yen (JPY). Same <1% sparsity as min_subsidy_yen — avoid unless the user explicitly asked for a ceiling."}, {"name": "min_employees", "in": "query", "required": false, "schema": {"anyOf": [{"type": "integer", "minimum": 0}, {"type": "null"}], "title": "Min Employees"}}, {"name": "max_employees", "in": "query", "required": false, "schema": {"anyOf": [{"type": "integer", "minimum": 0}, {"type": "null"}], "title": "Max Employees"}}, {"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"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Paginated case_studies. Search via FTS5 trigram on company_name + case_title + summary.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/CaseStudySearchResponse"}, "example": {"total": 1, "limit": 20, "offset": 0, "results": [{"case_id": "CS-meti-jizokuka-2024-00123", "company_name": "株式会社ヤマダ製作所", "case_title": "持続化補助金で新規販路開拓に成功", "case_summary": "EC サイト構築費 200 万円補助で売上 1.4 倍。", "prefecture": "群馬県", "industry_jsic": "29", "houjin_bangou": "1234567890123", "program_used": "小規模事業者持続化補助金", "amount_received_man_yen": 150, "fiscal_year": 2024, "source_url": "https://www.jizokukahojokin.info/case/123", "fetched_at": "2026-04-20T05:14:33Z", "confidence": 0.92}]}}}}, "400": {"description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "401": {"description": "Authentication required — `code='auth_required'`. Send `X-API-Key`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "404": {"description": "Not found — `code` ∈ {no_matching_records, seed_not_found, route_not_found}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "422": {"description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`).", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "429": {"description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "500": {"description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "503": {"description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}}}}, "/v1/case-studies/{case_id}": {"get": {"tags": ["case-studies"], "summary": "Get a single 採択事例 case study by case_id", "description": "Look up one 採択事例 by stable `case_id` (e.g. `CS-meti-jizokuka-2024-00123`). Returns full case_title, case_summary, programs_used, amount_received (when published), outcomes (KPI lift, headcount change), patterns (intervention category), and source lineage.\n\nDiscovery flow: call `GET /v1/case-studies/search` first, then follow up on each `case_id` here for the long-form outcome narrative.", "operationId": "get_case_study_v1_case_studies__case_id__get", "parameters": [{"name": "case_id", "in": "path", "required": true, "schema": {"type": "string", "title": "Case Id"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Single case study row.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/CaseStudy"}, "example": {"case_id": "CS-meti-jizokuka-2024-00123", "company_name": "株式会社ヤマダ製作所", "case_title": "持続化補助金で新規販路開拓に成功", "case_summary": "EC サイト構築費 200 万円補助で売上 1.4 倍。", "prefecture": "群馬県", "industry_jsic": "29", "houjin_bangou": "1234567890123", "employee_count": 8, "programs_used": ["小規模事業者持続化補助金"], "amount_received_man_yen": 150, "fiscal_year": 2024, "outcomes": {"sales_yoy_pct": 40, "new_channels": 2}, "patterns": ["EC構築", "販路開拓"], "publication_date": "2024-12-15", "source_url": "https://www.jizokukahojokin.info/case/123", "source_excerpt": "EC化により…", "fetched_at": "2026-04-20T05:14:33Z", "confidence": 0.92}}}}, "400": {"description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "401": {"description": "Authentication required — `code='auth_required'`. Send `X-API-Key`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "404": {"description": "case study not found — `error.code='no_matching_records'`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "422": {"description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`).", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "429": {"description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "500": {"description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "503": {"description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}}}}, "/v1/loan-programs/search": {"get": {"tags": ["loan-programs"], "summary": "Search loan programs (公庫 / 商工中金 / 自治体) — 3-axis risk filter", "description": "Search the 108-row `loan_programs` table by free-text + lender + interest-rate + amount + 3-axis risk independently. The three guarantor axes were split in migration 013 because '要相談' free-text muddles the question 'is 経営者保証 actually waivable?' — each axis is now a discrete enum (`required` / `not_required` / `negotiable` / `unknown`).\n\n**Risk axes:**\n- `collateral_required` — 物的担保 (real-estate / inventory)\n- `personal_guarantor_required` — 代表者保証 / 役員保証 / 家族保証\n- `third_party_guarantor_required` — 第三者保証\n\n**When to use this vs `/v1/am/loans`:** this endpoint is the legacy public REST surface (jpintel.db). For richer entity provenance + cross-domain joins, prefer `/v1/am/loans` (autonomath.db, unified).", "operationId": "search_loan_programs_v1_loan_programs_search_get", "parameters": [{"name": "q", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}], "description": "Free-text search over program_name + provider + target_conditions.", "title": "Q"}, "description": "Free-text search over program_name + provider + target_conditions."}, {"name": "provider", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}], "title": "Provider"}}, {"name": "loan_type", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 80}, {"type": "null"}], "title": "Loan Type"}}, {"name": "collateral_required", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 20}, {"type": "null"}], "description": "Risk axis 1 (物的担保). One of: required | not_required | negotiable | unknown.", "title": "Collateral Required"}, "description": "Risk axis 1 (物的担保). One of: required | not_required | negotiable | unknown."}, {"name": "personal_guarantor_required", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 20}, {"type": "null"}], "description": "Risk axis 2 (代表者/役員/家族保証). One of: required | not_required | negotiable | unknown.", "title": "Personal Guarantor Required"}, "description": "Risk axis 2 (代表者/役員/家族保証). One of: required | not_required | negotiable | unknown."}, {"name": "third_party_guarantor_required", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 20}, {"type": "null"}], "description": "Risk axis 3 (第三者保証). One of: required | not_required | negotiable | unknown.", "title": "Third Party Guarantor Required"}, "description": "Risk axis 3 (第三者保証). One of: required | not_required | negotiable | unknown."}, {"name": "min_amount_yen", "in": "query", "required": false, "schema": {"anyOf": [{"type": "integer", "minimum": 0}, {"type": "null"}], "title": "Min Amount Yen"}}, {"name": "max_amount_yen", "in": "query", "required": false, "schema": {"anyOf": [{"type": "integer", "minimum": 0}, {"type": "null"}], "title": "Max Amount Yen"}}, {"name": "max_interest_rate", "in": "query", "required": false, "schema": {"anyOf": [{"type": "number", "minimum": 0.0}, {"type": "null"}], "description": "Upper bound on interest_rate_base_annual (e.g. 0.015 for 1.5%).", "title": "Max Interest Rate"}, "description": "Upper bound on interest_rate_base_annual (e.g. 0.015 for 1.5%)."}, {"name": "min_loan_period_years", "in": "query", "required": false, "schema": {"anyOf": [{"type": "integer", "minimum": 0}, {"type": "null"}], "title": "Min Loan Period Years"}}, {"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"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Three-axis loan search. Filter on collateral / personal_guarantor / third_party_guarantor independently — see migration 013 for the axis split.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/LoanProgramSearchResponse"}, "example": {"total": 1, "limit": 20, "offset": 0, "results": [{"id": 12, "program_name": "新規開業資金（女性、若者/シニア起業家支援関連）", "provider": "日本政策金融公庫", "loan_type": "国民生活事業", "amount_max_yen": 72000000, "loan_period_years_max": 20, "grace_period_years_max": 2, "interest_rate_base_annual": 1.5, "interest_rate_special_annual": 0.95, "rate_names": "基準利率/特別利率A", "collateral_required": "negotiable", "personal_guarantor_required": "negotiable", "third_party_guarantor_required": "not_required", "security_notes": "代表者保証は希望に応じて. 第三者保証人は原則不要.", "official_url": "https://www.jfc.go.jp/n/finance/search/02_kaigyou_m.html", "fetched_at": "2026-04-22T08:11:00Z", "confidence": 0.95}]}}}}, "400": {"description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "401": {"description": "Authentication required — `code='auth_required'`. Send `X-API-Key`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "404": {"description": "Not found — `code` ∈ {no_matching_records, seed_not_found, route_not_found}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "422": {"description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`).", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "429": {"description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "500": {"description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "503": {"description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}}}}, "/v1/loan-programs/{loan_id}": {"get": {"tags": ["loan-programs"], "summary": "Get a single loan program by integer id", "description": "Look up one loan product by its integer `id` (the autoincrement PK on `loan_programs`). Returns full lender / amount band / interest rate / 3-axis risk / target conditions / source lineage (`official_url`, `fetched_at`, `confidence`).\n\nDiscovery flow: call `GET /v1/loan-programs/search` first, then follow up on each `id` with this endpoint. For unified entity-id-based lookups (cross-program), use `/v1/am/loans`.", "operationId": "get_loan_program_v1_loan_programs__loan_id__get", "parameters": [{"name": "loan_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Loan Id"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Single LoanProgram row.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/LoanProgram"}, "example": {"id": 1, "program_name": "新規開業・スタートアップ支援資金", "provider": "日本政策金融公庫 国民生活事業", "loan_type": "special_rate", "amount_max_yen": 72000000, "loan_period_years_max": 20, "grace_period_years_max": 5, "interest_rate_base_annual": 0.041, "rate_names": "基準利率,特別利率", "collateral_required": "negotiable", "personal_guarantor_required": "negotiable", "third_party_guarantor_required": "negotiable", "security_notes": "要相談（担保・保証）", "official_url": "https://www.jfc.go.jp/n/finance/search/01_sinkikaigyou_m.html", "fetched_at": "2026-04-23T04:32:55Z", "confidence": 0.9}}}}, "400": {"description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "401": {"description": "Authentication required — `code='auth_required'`. Send `X-API-Key`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "404": {"description": "loan program not found — `error.code='no_matching_records'`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "422": {"description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`).", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "429": {"description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "500": {"description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "503": {"description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}}}}, "/v1/laws/search": {"get": {"tags": ["laws"], "summary": "Search Japanese laws (法令): 憲法 / 法律 / 政令 / 省令 / 告示", "description": "Search the e-Gov 法令 catalog (9,484 rows + still loading) across `law_title + law_short_title + law_number + summary`. Filter by `law_type` (constitution / act / cabinet_order / imperial_order / ministerial_ordinance / rule / notice / guideline), 所管府省 (`ministry`), revision_status, and promulgated / enforced date windows.\n\n**License:** e-Gov 法令データ is **CC-BY 4.0** (attribution required, redistribution permitted with attribution). The `source_url` on each row points to the canonical e-Gov 法令検索 permalink — relay it.\n\n**FTS quirk:** trigram tokenizer matches single kanji; for 2+ char kanji compounds quote the phrase (`q=\"所得税法\"`). Terms < 3 chars fall through to LIKE.\n\nPair with `GET /v1/laws/{unified_id}/related-programs` to trace which 補助金 cite a given statute as authority / eligibility / exclusion / penalty.", "operationId": "search_laws_v1_laws_search_get", "parameters": [{"name": "q", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}], "description": "Free-text search across law_title + law_short_title + law_number + summary (FTS5 with quoted-phrase workaround for 2+ character kanji compounds). Terms shorter than 3 characters fall through to LIKE to dodge trigram zero-match.", "title": "Q"}, "description": "Free-text search across law_title + law_short_title + law_number + summary (FTS5 with quoted-phrase workaround for 2+ character kanji compounds). Terms shorter than 3 characters fall through to LIKE to dodge trigram zero-match."}, {"name": "law_type", "in": "query", "required": false, "schema": {"anyOf": [{"enum": ["constitution", "act", "cabinet_order", "imperial_order", "ministerial_ordinance", "rule", "notice", "guideline"], "type": "string"}, {"type": "null"}], "description": "Filter by law_type. One of: constitution | act | cabinet_order | imperial_order | ministerial_ordinance | rule | notice | guideline.", "title": "Law Type"}, "description": "Filter by law_type. One of: constitution | act | cabinet_order | imperial_order | ministerial_ordinance | rule | notice | guideline."}, {"name": "ministry", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 120}, {"type": "null"}], "description": "Filter by 所管府省 (exact match).", "title": "Ministry"}, "description": "Filter by 所管府省 (exact match)."}, {"name": "currently_effective_only", "in": "query", "required": false, "schema": {"type": "boolean", "description": "When true (default), only `revision_status='current'` rows are returned. Flip to false to include 'superseded' rows.", "default": true, "title": "Currently Effective Only"}, "description": "When true (default), only `revision_status='current'` rows are returned. Flip to false to include 'superseded' rows."}, {"name": "include_repealed", "in": "query", "required": false, "schema": {"type": "boolean", "description": "When false (default), `revision_status='repealed'` rows are excluded. Flip to true for historical research.", "default": false, "title": "Include Repealed"}, "description": "When false (default), `revision_status='repealed'` rows are excluded. Flip to true for historical research."}, {"name": "promulgated_from", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$"}, {"type": "null"}], "description": "ISO date (YYYY-MM-DD) — inclusive lower bound on promulgated_date.", "title": "Promulgated From"}, "description": "ISO date (YYYY-MM-DD) — inclusive lower bound on promulgated_date."}, {"name": "promulgated_to", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$"}, {"type": "null"}], "description": "ISO date (YYYY-MM-DD) — inclusive upper bound on promulgated_date.", "title": "Promulgated To"}, "description": "ISO date (YYYY-MM-DD) — inclusive upper bound on promulgated_date."}, {"name": "enforced_from", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$"}, {"type": "null"}], "description": "ISO date (YYYY-MM-DD) — inclusive lower bound on enforced_date.", "title": "Enforced From"}, "description": "ISO date (YYYY-MM-DD) — inclusive lower bound on enforced_date."}, {"name": "enforced_to", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$"}, {"type": "null"}], "description": "ISO date (YYYY-MM-DD) — inclusive upper bound on enforced_date.", "title": "Enforced To"}, "description": "ISO date (YYYY-MM-DD) — inclusive upper bound on enforced_date."}, {"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"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Paginated laws (e-Gov 法令 catalog, CC-BY 4.0).", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/LawSearchResponse"}, "example": {"total": 1, "limit": 20, "offset": 0, "results": [{"unified_id": "LAW-jp-shotokuzeiho", "law_number": "昭和四十年法律第三十三号", "law_title": "所得税法", "law_short_title": "所得税法", "law_type": "act", "ministry": "財務省", "promulgated_date": "1965-03-31", "enforced_date": "1965-04-01", "last_amended_date": "2025-03-31", "revision_status": "current", "article_count": 245, "full_text_url": "https://laws.e-gov.go.jp/law/340AC0000000033", "subject_areas": ["税法", "所得税"], "source_url": "https://laws.e-gov.go.jp/law/340AC0000000033", "fetched_at": "2026-04-20T05:14:33Z", "confidence": 1.0}]}}}}, "400": {"description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "401": {"description": "Authentication required — `code='auth_required'`. Send `X-API-Key`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "404": {"description": "Not found — `code` ∈ {no_matching_records, seed_not_found, route_not_found}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "422": {"description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`).", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "429": {"description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "500": {"description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "503": {"description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}}}}, "/v1/laws/{unified_id}": {"get": {"tags": ["laws"], "summary": "Get a single law (法令) by unified_id (LAW-*)", "description": "Look up one 法令 by stable `unified_id` (`LAW-<10 hex>`). Returns 法令番号 (e.g. 昭和四十年法律第三十三号), 正式名称, 略称, 所管府省, 公布日 / 施行日 / 改正日, 条文数, 2-3 line abstract (`summary`), `subject_areas` tags (subsidy_clawback / tax_credit / etc.), and `full_text_url` (e-Gov 法令検索 permalink for humans).\n\n**License:** e-Gov 法令データ is CC-BY 4.0 (cc_by_4.0). Relay `source_url` + attribution.\n\nPair with `GET /v1/laws/{unified_id}/related-programs` to trace which programs cite this law.", "operationId": "get_law_v1_laws__unified_id__get", "parameters": [{"name": "unified_id", "in": "path", "required": true, "schema": {"type": "string", "title": "Unified Id"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Single law row.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Law"}, "example": {"unified_id": "LAW-64c08d2649", "law_number": "昭和四十年法律第三十三号", "law_title": "所得税法", "law_short_title": "所得税法", "law_type": "act", "ministry": "財務省", "promulgated_date": "1965-03-31", "enforced_date": "2026-04-01", "last_amended_date": "2026-03-31", "revision_status": "current", "article_count": 245, "full_text_url": "https://laws.e-gov.go.jp/law/340AC0000000033", "summary": "所得に対する税の課税標準・税額等を定める。", "subject_areas": ["税法", "所得税"], "source_url": "https://laws.e-gov.go.jp/law/340AC0000000033", "fetched_at": "2026-04-20T05:14:33Z", "confidence": 1.0}}}}, "400": {"description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "401": {"description": "Authentication required — `code='auth_required'`. Send `X-API-Key`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "404": {"description": "law not found — `error.code='no_matching_records'`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "422": {"description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`).", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "429": {"description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "500": {"description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "503": {"description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}}}}, "/v1/laws/{unified_id}/related-programs": {"get": {"tags": ["laws"], "summary": "Get Related Programs", "description": "Reverse lookup: which programs cite this law via program_law_refs.", "operationId": "get_related_programs_v1_laws__unified_id__related_programs_get", "parameters": [{"name": "unified_id", "in": "path", "required": true, "schema": {"type": "string", "title": "Unified Id"}}, {"name": "ref_kind", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 20}, {"type": "null"}], "description": "Filter by citation kind. One of: authority | eligibility | exclusion | reference | penalty. Omit to return all kinds.", "title": "Ref Kind"}, "description": "Filter by citation kind. One of: authority | eligibility | exclusion | reference | penalty. Omit to return all kinds."}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 100, "minimum": 1, "default": 50, "title": "Limit"}}, {"name": "offset", "in": "query", "required": false, "schema": {"type": "integer", "minimum": 0, "default": 0, "title": "Offset"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/RelatedProgramsResponse"}}}}, "400": {"description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "401": {"description": "Authentication required — `code='auth_required'`. Send `X-API-Key`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "404": {"description": "law not found — `error.code='no_matching_records'`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "422": {"description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`).", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "429": {"description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "500": {"description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "503": {"description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}}}}, "/v1/court-decisions/search": {"get": {"tags": ["court-decisions"], "summary": "Search Japanese court decisions (判決 / 決定 / 命令)", "description": "Search 2,065 court decisions (判例) sourced from courts.go.jp 判例検索 across `case_name + subject_area + key_ruling + impact_on_business`. Filter by 裁判所名 / `court_level` (supreme / high / district / summary / family) / `decision_type` (判決 / 決定 / 命令) / `subject_area` (租税 / 行政 / 補助金適正化法 / etc.) / decided_from/to date window / `references_law_id` (cites this LAW-* unified_id).\n\n**Precedent weight:** each row carries `precedent_weight` in `{binding, persuasive, informational}`. binding = 最高裁 or 大法廷; persuasive = 高裁 / 地裁 leading case; informational = case reference. LLM agents should surface `precedent_weight` when relaying — a 地裁 ruling is not the same as 最高裁 binding precedent.\n\nFor statute-citation crawls (which decisions cite this law?), prefer `POST /v1/court-decisions/by-statute`.", "operationId": "search_court_decisions_v1_court_decisions_search_get", "parameters": [{"name": "q", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}], "description": "Free-text search across case_name + subject_area + key_ruling + impact_on_business (FTS5 with quoted-phrase workaround for 2+ character kanji compounds).", "title": "Q"}, "description": "Free-text search across case_name + subject_area + key_ruling + impact_on_business (FTS5 with quoted-phrase workaround for 2+ character kanji compounds)."}, {"name": "court", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 160}, {"type": "null"}], "description": "Filter by 裁判所名 (exact match, e.g. '最高裁判所第三小法廷').", "title": "Court"}, "description": "Filter by 裁判所名 (exact match, e.g. '最高裁判所第三小法廷')."}, {"name": "court_level", "in": "query", "required": false, "schema": {"anyOf": [{"enum": ["supreme", "high", "district", "summary", "family"], "type": "string"}, {"type": "null"}], "description": "Filter by court tier. One of: supreme | high | district | summary | family.", "title": "Court Level"}, "description": "Filter by court tier. One of: supreme | high | district | summary | family."}, {"name": "decision_type", "in": "query", "required": false, "schema": {"anyOf": [{"enum": ["判決", "決定", "命令"], "type": "string"}, {"type": "null"}], "description": "Filter by decision shape. One of: 判決 | 決定 | 命令.", "title": "Decision Type"}, "description": "Filter by decision shape. One of: 判決 | 決定 | 命令."}, {"name": "subject_area", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 120}, {"type": "null"}], "description": "Filter by 分野 (substring LIKE — the column is free-text and varies by 判例集, so exact-match is too brittle).", "title": "Subject Area"}, "description": "Filter by 分野 (substring LIKE — the column is free-text and varies by 判例集, so exact-match is too brittle)."}, {"name": "references_law_id", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "pattern": "^LAW-[0-9a-f]{10}$"}, {"type": "null"}], "description": "Filter rows whose `related_law_ids_json` contains this LAW-<10 hex> unified_id. JSON-array substring LIKE — accurate because unified_ids are fixed-width and have a distinctive `LAW-` prefix.", "title": "References Law Id"}, "description": "Filter rows whose `related_law_ids_json` contains this LAW-<10 hex> unified_id. JSON-array substring LIKE — accurate because unified_ids are fixed-width and have a distinctive `LAW-` prefix."}, {"name": "decided_from", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$"}, {"type": "null"}], "description": "ISO date (YYYY-MM-DD) — inclusive lower bound on decision_date.", "title": "Decided From"}, "description": "ISO date (YYYY-MM-DD) — inclusive lower bound on decision_date."}, {"name": "decided_to", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$"}, {"type": "null"}], "description": "ISO date (YYYY-MM-DD) — inclusive upper bound on decision_date.", "title": "Decided To"}, "description": "ISO date (YYYY-MM-DD) — inclusive upper bound on decision_date."}, {"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"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Paginated court decisions.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/CourtDecisionSearchResponse"}, "example": {"total": 1, "limit": 20, "offset": 0, "results": [{"unified_id": "HAN-5954003266", "case_name": "所得税更正処分取消等請求事件", "case_number": "平成30(行ヒ)422", "court": "最高裁判所第三小法廷", "court_level": "supreme", "decision_date": "2020-03-24", "decision_type": "判決", "subject_area": "租税", "precedent_weight": "binding", "key_ruling": "国税通則法24条所定の更正処分の取消…", "full_text_url": "https://www.courts.go.jp/app/hanrei_jp/detail2?id=89311", "source_url": "https://www.courts.go.jp/...", "fetched_at": "2026-04-20T05:14:33Z"}]}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/court-decisions/{unified_id}": {"get": {"tags": ["court-decisions"], "summary": "Get a single court decision by unified_id (HAN-*)", "description": "Look up one 判例 by stable `unified_id` (`HAN-<10 hex>`). Returns 事件名, 事件番号, 裁判所, 言渡日, 判決種別, 分野, 主要判示事項 (`key_ruling`), 実務影響 (`impact_on_business`), `precedent_weight`, courts.go.jp permalink, and `pdf_url` (全文 PDF mirror).\n\nDiscovery flow: call `GET /v1/court-decisions/search` first, then follow up on each `unified_id` here for the full key ruling text + practical impact summary.", "operationId": "get_court_decision_v1_court_decisions__unified_id__get", "parameters": [{"name": "unified_id", "in": "path", "required": true, "schema": {"type": "string", "title": "Unified Id"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Single court decision row.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/CourtDecision"}, "example": {"unified_id": "HAN-5954003266", "case_name": "所得税更正処分取消等請求事件", "case_number": "平成30(行ヒ)422", "court": "最高裁判所第三小法廷", "court_level": "supreme", "decision_date": "2020-03-24", "decision_type": "判決", "subject_area": "租税", "precedent_weight": "binding", "key_ruling": "更正処分の理由付記の…", "impact_on_business": "国税不服審判の段階で…", "full_text_url": "https://www.courts.go.jp/app/hanrei_jp/detail2?id=89311", "pdf_url": "https://www.courts.go.jp/app/files/hanrei_jp/311/089311_hanrei.pdf", "source_url": "https://www.courts.go.jp/app/hanrei_jp/detail2?id=89311", "source_excerpt": "…(裁判所サイトより抜粋)", "confidence": 0.9, "fetched_at": "2026-04-20T05:14:33Z"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/court-decisions/by-statute": {"post": {"tags": ["court-decisions"], "summary": "Decisions By Statute", "description": "Return court decisions citing a given LAW-<10 hex> statute.\n\nTRACE endpoint: resolves the statute→ruling edge via\n`related_law_ids_json`. When `article_citation` is supplied, we\nadditionally require the article string to appear in `key_ruling` or\n`source_excerpt` — the ingest does not yet write a structured\n(law_id, article) map, so this is a honest contains-check, not a\nfalse-precision exact join. Callers should treat `article_citation`\nnarrowing as best-effort.", "operationId": "decisions_by_statute_v1_court_decisions_by_statute_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/CourtDecisionByStatuteRequest"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/CourtDecisionSearchResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/bids/search": {"get": {"tags": ["bids"], "summary": "Search Japanese government bids (入札案件)", "description": "Search 362 入札案件 (government procurement bids) sourced from GEPS (政府電子調達) + ministry / 自治体 procurement portals. Filter by `bid_kind` (open / selective / negotiated / kobo_subsidy), 発注機関 法人番号, 落札者 法人番号, programs.unified_id hint, awarded_amount band, deadline window.\n\n**When to use:** caller asks 'who won the 国土交通省 2025 IT procurement?' or 'are there still-open 物品調達 in 関東 with award ceiling > 1億?'. Pair with `/v1/am/enforcement` to screen winners for 入札参加資格停止.\n\n**FTS quirk:** terms < 3 chars will not match (trigram tokenizer limitation); use the structured filters instead or longer phrases. When `q` is omitted, results sort by most recently published first.", "operationId": "search_bids_v1_bids_search_get", "parameters": [{"name": "q", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}], "description": "Free-text search across bid_title + bid_description + procuring_entity + winner_name (FTS5 with quoted-phrase workaround for 2+ character kanji compounds). Terms shorter than 3 characters will not match — trigram tokenizer limitation; use a longer phrase or the structured filters instead.", "title": "Q"}, "description": "Free-text search across bid_title + bid_description + procuring_entity + winner_name (FTS5 with quoted-phrase workaround for 2+ character kanji compounds). Terms shorter than 3 characters will not match — trigram tokenizer limitation; use a longer phrase or the structured filters instead."}, {"name": "bid_kind", "in": "query", "required": false, "schema": {"anyOf": [{"enum": ["open", "selective", "negotiated", "kobo_subsidy"], "type": "string"}, {"type": "null"}], "description": "Filter by bid_kind. One of: open | selective | negotiated | kobo_subsidy.", "title": "Bid Kind"}, "description": "Filter by bid_kind. One of: open | selective | negotiated | kobo_subsidy."}, {"name": "procuring_houjin_bangou", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "pattern": "^\\d{13}$"}, {"type": "null"}], "description": "Exact 13-digit 法人番号 of the procuring entity.", "title": "Procuring Houjin Bangou"}, "description": "Exact 13-digit 法人番号 of the procuring entity."}, {"name": "winner_houjin_bangou", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "pattern": "^\\d{13}$"}, {"type": "null"}], "description": "Exact 13-digit 法人番号 of the落札者.", "title": "Winner Houjin Bangou"}, "description": "Exact 13-digit 法人番号 of the落札者."}, {"name": "program_id_hint", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 64}, {"type": "null"}], "description": "Exact programs.unified_id (UNI-* / TAX-* / LAW-* etc.) — returns bids linked to that program via ingest matchers.", "title": "Program Id Hint"}, "description": "Exact programs.unified_id (UNI-* / TAX-* / LAW-* etc.) — returns bids linked to that program via ingest matchers."}, {"name": "min_amount", "in": "query", "required": false, "schema": {"anyOf": [{"type": "integer", "minimum": 0}, {"type": "null"}], "description": "Inclusive lower bound on awarded_amount_yen (JPY). Rows with NULL awarded_amount_yen are excluded from the filtered set when this is set.", "title": "Min Amount"}, "description": "Inclusive lower bound on awarded_amount_yen (JPY). Rows with NULL awarded_amount_yen are excluded from the filtered set when this is set."}, {"name": "max_amount", "in": "query", "required": false, "schema": {"anyOf": [{"type": "integer", "minimum": 0}, {"type": "null"}], "description": "Inclusive upper bound on awarded_amount_yen (JPY). Rows with NULL awarded_amount_yen are excluded from the filtered set when this is set.", "title": "Max Amount"}, "description": "Inclusive upper bound on awarded_amount_yen (JPY). Rows with NULL awarded_amount_yen are excluded from the filtered set when this is set."}, {"name": "deadline_after", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$"}, {"type": "null"}], "description": "ISO date (YYYY-MM-DD) — inclusive lower bound on bid_deadline. Useful for 'still-open' queries.", "title": "Deadline After"}, "description": "ISO date (YYYY-MM-DD) — inclusive lower bound on bid_deadline. Useful for 'still-open' queries."}, {"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"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Paginated bids.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/BidsSearchResponse"}, "example": {"total": 1, "limit": 20, "offset": 0, "results": [{"unified_id": "BID-cf1aff5eb7", "bid_title": "農林水産省永年勤続者表彰用銀杯等の製造（単価契約）", "bid_kind": "open", "procuring_entity": "農林水産省", "ministry": "農林水産省", "announcement_date": "2026-04-14", "bid_deadline": "2026-04-27", "classification_code": "物品の製造", "source_url": "https://www.maff.go.jp/j/supply/nyusatu/buppin_ekimu/sonota1/index.html", "confidence": 0.92, "fetched_at": "2026-04-25T04:06:20Z", "updated_at": "2026-04-25T04:06:20Z"}]}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/bids/{unified_id}": {"get": {"tags": ["bids"], "summary": "Get Bid", "description": "Return a single 入札案件 by BID-<10 hex> unified_id.\n\nAudit trail (会計士 work-paper, added 2026-04-29): the response includes\n`corpus_snapshot_id` + `corpus_checksum` so an auditor citing this 入札\nin a work-paper can reproduce the lookup later and detect whether the\ncorpus mutated. See docs/audit_trail.md.", "operationId": "get_bid_v1_bids__unified_id__get", "parameters": [{"name": "unified_id", "in": "path", "required": true, "schema": {"type": "string", "title": "Unified Id"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/BidOut"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/tax_rulesets/search": {"get": {"tags": ["tax_rulesets"], "summary": "Search 税務判定ルールセット (e.g. 2割特例, 適格請求書発行事業者登録, 経過措置)", "description": "Search 50 税務判定ルールセット — structured, machine-evaluable tax rules covering インボイス制度 (2割特例, 80%/50% 経過措置, 少額特例), 適格請求書発行事業者登録, 住宅ローン控除, 中小企業 投資促進税制, etc. Each row has `eligibility_conditions_json` (predicate tree), `rate_or_amount`, `calculation_formula`, `filing_requirements`, and `effective_from` / `effective_until`.\n\n**Cliff dates to flag:**\n- 2026-09-30: 2割特例 / 80%経過措置 終了\n- 2027-09-30: 80% 経過措置 終了 (50% 経過措置 開始)\n- 2029-09-30: 50% 経過措置 / 少額特例 終了\n\nUse `effective_on=YYYY-MM-DD` to filter to rules that applied on a specific date — critical around cliff dates. To *evaluate* rules against a caller business profile, use `POST /v1/tax_rulesets/evaluate` (mechanical predicate matching, NOT 税務助言).\n\n**税理士法 §52 fence:** every response carries a `_disclaimer` envelope key. LLM agents MUST relay verbatim to end users.", "operationId": "search_tax_rulesets_v1_tax_rulesets_search_get", "parameters": [{"name": "q", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}], "description": "Free-text search across ruleset_name + eligibility_conditions + calculation_formula (FTS5 with quoted-phrase workaround for 2+ character kanji compounds). Terms shorter than 3 characters fall through to LIKE to dodge trigram zero-match.", "title": "Q"}, "description": "Free-text search across ruleset_name + eligibility_conditions + calculation_formula (FTS5 with quoted-phrase workaround for 2+ character kanji compounds). Terms shorter than 3 characters fall through to LIKE to dodge trigram zero-match."}, {"name": "tax_category", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 20}, {"type": "null"}], "description": "Filter by tax_category. One of: consumption | corporate | income | property | local | inheritance.", "title": "Tax Category"}, "description": "Filter by tax_category. One of: consumption | corporate | income | property | local | inheritance."}, {"name": "ruleset_kind", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 30}, {"type": "null"}], "description": "Filter by ruleset_kind. One of: registration | credit | deduction | special_depreciation | exemption | preservation | other.", "title": "Ruleset Kind"}, "description": "Filter by ruleset_kind. One of: registration | credit | deduction | special_depreciation | exemption | preservation | other."}, {"name": "effective_on", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 10}, {"type": "null"}], "description": "ISO 8601 date (YYYY-MM-DD). Returns only rulesets whose effective_from <= date AND (effective_until IS NULL OR effective_until >= date). Use this to ask 'which rules applied on date X?' — critical around cliff dates (2026-09-30 / 2027-09-30 / 2029-09-30).", "title": "Effective On"}, "description": "ISO 8601 date (YYYY-MM-DD). Returns only rulesets whose effective_from <= date AND (effective_until IS NULL OR effective_until >= date). Use this to ask 'which rules applied on date X?' — critical around cliff dates (2026-09-30 / 2027-09-30 / 2029-09-30)."}, {"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"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Paginated tax rulesets + `_disclaimer` (税理士法 §52 fence).", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/TaxRulesetSearchResponse"}, "example": {"total": 1, "limit": 20, "offset": 0, "results": [{"unified_id": "TAX-b886afca81", "ruleset_name": "2割特例 (小規模事業者の消費税納税額軽減)", "tax_category": "consumption", "ruleset_kind": "exemption", "effective_from": "2023-10-01", "effective_until": "2026-09-30", "related_law_ids": ["PENDING:所得税法等の一部を改正する法律(令和五年法律第三号)附則第51条の2", "PENDING:消費税法第37条"], "eligibility_conditions": "インボイス制度を機に免税事業者から課税事業者となった小規模事業者は、2023-10-01 から 2026-09-30 までの属する課税期間について、売上税額の 2 割を納税額とできる。基準期間の課税売上高が1,000 万円以下であることが前提。", "eligibility_conditions_json": {"op": "all", "of": [{"op": "eq", "field": "newly_registered_invoice_issuer", "value": true}, {"op": "eq", "field": "was_exempt_business_before_registration", "value": true}, {"op": "lte", "field": "taxable_sales_jpy_base_period", "value": 10000000}]}, "rate_or_amount": "納税額 = 売上税額 × 20%", "calculation_formula": "納付消費税額 = 課税売上に係る消費税額 × 0.2", "filing_requirements": "事前届出不要。消費税確定申告書に2割特例適用の旨を記載。", "authority": "国税庁", "authority_url": "https://www.nta.go.jp/", "source_url": "https://www.nta.go.jp/taxes/shiraberu/zeimokubetsu/shohi/keigenzeiritsu/invoice_tokurei.htm", "source_excerpt": "適格請求書発行事業者となる小規模事業者の負担軽減措置 (2割特例)", "source_checksum": "9a1c4f0d6e3b2a7c8d5f1e4b9a2c7d6e", "confidence": 0.95, "fetched_at": "2026-04-24T06:08:43Z", "updated_at": "2026-04-24T06:08:43Z"}], "_disclaimer": "本情報は税務助言ではありません。AutonoMath は公的機関が公表する税制・補助金・法令情報を検索・整理して提供するサービスで、税理士法 §52 に基づき個別具体的な税務判断・申告書作成代行は行いません。"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/tax_rulesets/{unified_id}": {"get": {"tags": ["tax_rulesets"], "summary": "Get a single 税務判定ルールセット by TAX-* id", "description": "Look up one 税務判定ルールセット by stable `unified_id` (`TAX-<10 hex>`). Returns full eligibility conditions (narrative + structured JSON predicates), rate/amount cap, calculation formula, filing requirements, effective window, related law ids, and source lineage.\n\n**税理士法 §52 fence:** response carries `_disclaimer`. Eligibility predicates are derived from public 国税庁 / 財務省 sources and require qualified 税理士 confirmation before any filing decision.", "operationId": "get_tax_ruleset_v1_tax_rulesets__unified_id__get", "parameters": [{"name": "unified_id", "in": "path", "required": true, "schema": {"type": "string", "title": "Unified Id"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Single ruleset row + `_disclaimer`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/TaxRulesetOut"}, "example": {"unified_id": "TAX-b886afca81", "ruleset_name": "2割特例 (小規模事業者の消費税納税額軽減)", "tax_category": "consumption", "ruleset_kind": "exemption", "effective_from": "2023-10-01", "effective_until": "2026-09-30", "related_law_ids": ["LAW-4e95177b82"], "eligibility_conditions": "免税事業者から登録した小規模事業者…", "rate_or_amount": "課税売上にかかる消費税額の20%", "calculation_formula": "納付税額 = 課税売上消費税 × 20%", "filing_requirements": "確定申告書「2割特例適用」欄に記入。届出書 不要。", "authority": "国税庁", "source_url": "https://www.nta.go.jp/...", "_disclaimer": "本情報は公開情報の検索結果であり、税務助言ではありません。申告・適用判断は税理士にご確認ください。"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/tax_rulesets/evaluate": {"post": {"tags": ["tax_rulesets"], "summary": "Evaluate Tax Rulesets", "description": "Evaluate one or more rulesets against a caller business_profile.\n\nWalks `eligibility_conditions_json` for each selected row and returns\nper-ruleset `applicable` + matched / unmatched predicate lists. Never\ninterprets tax law — pure JSON predicate matching.\n\ntarget_ruleset_ids omitted -> evaluates all CURRENT rulesets\n(effective_until IS NULL OR effective_until >= today). Use /search with\neffective_on + explicit ids list to evaluate historical snapshots.\n\nEvery response carries a ``_disclaimer`` envelope key (税理士法 §52 fence).\nEven when ``applicable=True``, the verdict is mechanical predicate\nmatching against publicly disclosed eligibility conditions, NOT 税務助言.\nFiling decisions require qualified 税理士 confirmation.\n\nAudit-trail fields (会計士 work-paper requirement, added 2026-04-29):\n    corpus_snapshot_id  ISO-8601 of latest am_amendment_diff detection\n                        (or MAX(fetched_at) fallback). The whole-corpus\n                        identity at the moment of evaluation.\n    corpus_checksum     sha256:<16hex> deterministic over\n                        (snapshot_id || api_version || row_counts).\n                        Auditors quote both fields verbatim in their\n                        work-paper; a year later the same call with the\n                        same business_profile must yield byte-identical\n                        results, OR a different checksum proving the\n                        corpus mutated. Per-row `fetched_at` is too\n                        granular for this purpose. See docs/audit_trail.md.", "operationId": "evaluate_tax_rulesets_v1_tax_rulesets_evaluate_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/EvaluateRequest"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/EvaluateResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/invoice_registrants/search": {"get": {"tags": ["invoice_registrants"], "summary": "Search 適格請求書発行事業者 (NTA invoice registrants)", "description": "Look up registered Japanese 適格請求書発行事業者 (qualified invoice issuers under the インボイス制度 / 消費税仕入税額控除 regime) by name prefix, 法人番号, prefecture, or registration date window. Mirror of NTA's official 適格請求書発行事業者公表サイト bulk (13,801 delta rows live; full 4M-row monthly bulk lands post-launch).\n\n**When to use:** verify whether a counterparty has issued a valid T-prefixed invoice number before claiming 仕入税額控除. For exact T-number lookup (T + 13 digits), prefer `GET /v1/invoice_registrants/{invoice_registration_number}`.\n\n**Limits:** `q` requires 2+ chars and is index-eligible LIKE (prefix only — not FTS). Bulk dump is intentionally not supported; for full snapshots use NTA's official download URL in the `attribution.source_url`.\n\n**License:** every 2xx body carries a PDL v1.0 `attribution` block — 公共データ利用規約 第1.0版 (出典明記 + 編集・加工注記). Do NOT strip on relay.", "operationId": "search_invoice_registrants_v1_invoice_registrants_search_get", "parameters": [{"name": "q", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}], "description": "Prefix match on 事業者名 (normalized_name). Index-eligible LIKE — not FTS. Short queries (< 2 chars) are rejected to keep the match selective.", "title": "Q"}, "description": "Prefix match on 事業者名 (normalized_name). Index-eligible LIKE — not FTS. Short queries (< 2 chars) are rejected to keep the match selective."}, {"name": "houjin_bangou", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "pattern": "^\\d{13}$"}, {"type": "null"}], "description": "Exact 13-digit 法人番号 filter. Returns only rows where houjin_bangou matches (sole-proprietor rows excluded).", "title": "Houjin Bangou"}, "description": "Exact 13-digit 法人番号 filter. Returns only rows where houjin_bangou matches (sole-proprietor rows excluded)."}, {"name": "kind", "in": "query", "required": false, "schema": {"anyOf": [{"enum": ["corporate", "individual"], "type": "string"}, {"type": "null"}], "description": "corporate = 法人 (registrant_kind='corporation'); individual = 個人事業主 (registrant_kind='sole_proprietor'). Omit to include both plus 'other'.", "title": "Kind"}, "description": "corporate = 法人 (registrant_kind='corporation'); individual = 個人事業主 (registrant_kind='sole_proprietor'). Omit to include both plus 'other'."}, {"name": "prefecture", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 20}, {"type": "null"}], "description": "Prefecture name. Canonical = full-suffix kanji ('東京都'); short form ('東京') and romaji also accepted.", "title": "Prefecture"}, "description": "Prefecture name. Canonical = full-suffix kanji ('東京都'); short form ('東京') and romaji also accepted."}, {"name": "registered_after", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$"}, {"type": "null"}], "description": "ISO date (YYYY-MM-DD) — inclusive lower bound on registered_date.", "title": "Registered After"}, "description": "ISO date (YYYY-MM-DD) — inclusive lower bound on registered_date."}, {"name": "registered_before", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$"}, {"type": "null"}], "description": "ISO date (YYYY-MM-DD) — inclusive upper bound on registered_date.", "title": "Registered Before"}, "description": "ISO date (YYYY-MM-DD) — inclusive upper bound on registered_date."}, {"name": "active_only", "in": "query", "required": false, "schema": {"type": "boolean", "description": "When true (default), excludes revoked (revoked_date IS NOT NULL) and expired (expired_date IS NOT NULL) rows. Flip to false for historical/audit research.", "default": true, "title": "Active Only"}, "description": "When true (default), excludes revoked (revoked_date IS NOT NULL) and expired (expired_date IS NOT NULL) rows. Flip to false for historical/audit research."}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 100, "minimum": 1, "description": "Page size. Default 50, hard cap 100. No wildcard bulk export — point consumers at NTA's own download URL for full snapshots.", "default": 50, "title": "Limit"}, "description": "Page size. Default 50, hard cap 100. No wildcard bulk export — point consumers at NTA's own download URL for full snapshots."}, {"name": "offset", "in": "query", "required": false, "schema": {"type": "integer", "minimum": 0, "default": 0, "title": "Offset"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "SearchResponse. Every 2xx body carries a PDL v1.0 `attribution` block — required by 公共データ利用規約 第1.0版.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/jpintel_mcp__api__invoice_registrants__SearchResponse"}, "example": {"total": 1, "limit": 50, "offset": 0, "results": [{"invoice_registration_number": "T8010001213708", "houjin_bangou": "8010001213708", "normalized_name": "Bookyou株式会社", "address_normalized": "東京都文京区小日向2-22-1", "prefecture": "東京都", "registered_date": "2025-05-12", "registrant_kind": "corporation", "trade_name": "税務会計AI", "last_updated_nta": "2025-05-13", "source_url": "https://www.invoice-kohyo.nta.go.jp/regno-search/download", "source_checksum": "0e5e54184ed778eb2fd797dc7f100b80cb7e892b15134de629d860ae76546398", "confidence": 0.98, "fetched_at": "2026-04-25T03:30:00Z", "updated_at": "2026-04-25T03:30:00Z"}], "attribution": {"source": "国税庁適格請求書発行事業者公表サイト（国税庁）", "source_url": "https://www.invoice-kohyo.nta.go.jp/", "license": "公共データ利用規約 第1.0版 (PDL v1.0)", "edited": true, "notice": "本データは国税庁公表データを編集加工したものであり、原データと完全には一致しません。公表データは本API経由ではなく、発行元サイトで最新のものを確認してください。"}}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/invoice_registrants/{invoice_registration_number}": {"get": {"tags": ["invoice_registrants"], "summary": "Lookup adequate-invoice (適格請求書) registrant by T-number", "description": "Exact lookup by 適格請求書発行事業者登録番号 (`^T\\d{13}$`). Returns the registrant's name, address, prefecture, registered_date, and revocation/expiry status (NULL = active).\n\n**404 semantics:** the 4M-row 適格事業者 population only lands in the mirror at the post-launch monthly bulk refresh. A launch-week miss frequently means 'your T-number is real, we just haven't ingested it yet' — NOT 'this T-number is invalid'. The 404 body therefore carries `snapshot_size`, `full_population_estimate`, `next_bulk_refresh`, and an `alternative` URL pointing at NTA's authoritative lookup so the caller can distinguish the two cases.\n\n**License:** PDL v1.0 attribution block on every 2xx + 404 response (公共データ利用規約 第1.0版 / 出典明記 + 編集・加工注記).", "operationId": "get_invoice_registrant_v1_invoice_registrants__invoice_registration_number__get", "parameters": [{"name": "invoice_registration_number", "in": "path", "required": true, "schema": {"type": "string", "title": "Invoice Registration Number"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "GetResponse. Every 2xx body carries a PDL v1.0 `attribution` block — required by 公共データ利用規約 第1.0版.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/GetResponse"}, "example": {"result": {"invoice_registration_number": "T8010001213708", "houjin_bangou": "8010001213708", "normalized_name": "Bookyou株式会社", "address_normalized": "東京都文京区小日向2-22-1", "prefecture": "東京都", "registered_date": "2025-05-12", "registrant_kind": "corporation", "last_updated_nta": "2025-05-13", "source_url": "https://www.invoice-kohyo.nta.go.jp/regno-search/download", "confidence": 0.98, "fetched_at": "2026-04-25T03:30:00Z", "updated_at": "2026-04-25T03:30:00Z"}, "attribution": {"source": "国税庁適格請求書発行事業者公表サイト（国税庁）", "source_url": "https://www.invoice-kohyo.nta.go.jp/", "license": "公共データ利用規約 第1.0版 (PDL v1.0)", "edited": true, "notice": "本データは国税庁公表データを編集加工したものであり、原データと完全には一致しません。公表データは本API経由ではなく、発行元サイトで最新のものを確認してください。"}}}}}, "404": {"description": "registrant not found in the current snapshot. The 404 body is structured (not a bare `detail` string): it reports `snapshot_size` of the partial mirror we currently serve, the `full_population_estimate` for context, an `alternative` URL pointing at NTA's official lookup, plus the same PDL v1.0 `attribution` block carried by 2xx responses so 出典明記 + 編集・加工注記 stay attached even on miss. This shape is contractual — see tests/test_invoice_registrants_404.py."}, "422": {"description": "invoice_registration_number malformed (must match '^T\\d{13}$')"}}}}, "/v1/calendar/deadlines": {"get": {"tags": ["calendar"], "summary": "Get Deadlines", "description": "List upcoming submission deadlines.\n\nAnswers \"what's due in the next 30 days for 東京 SMBs?\" in one call so\ncallers don't stitch together N search_programs requests. Programs\nwithout a structured end_date are silently excluded — they are not\n\"no deadline\", they are \"we couldn't extract one\" and need case-by-case\nlookup via get_program.", "operationId": "get_deadlines_v1_calendar_deadlines_get", "parameters": [{"name": "within_days", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 180, "minimum": 1, "description": "Only return programs whose end_date falls between today and today + within_days (inclusive). Default 30.", "default": 30, "title": "Within Days"}, "description": "Only return programs whose end_date falls between today and today + within_days (inclusive). Default 30."}, {"name": "prefecture", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 40}, {"type": "null"}], "description": "Prefecture filter. Canonical kanji ('東京都'), short ('東京'), romaji ('Tokyo'), or '全国' / 'national'. Nationwide programs and prefecture-unassigned rows are always included.", "title": "Prefecture"}, "description": "Prefecture filter. Canonical kanji ('東京都'), short ('東京'), romaji ('Tokyo'), or '全国' / 'national'. Nationwide programs and prefecture-unassigned rows are always included."}, {"name": "authority_level", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 20}, {"type": "null"}], "description": "Authority level filter. Canonical EN: national / prefecture / municipality / financial. Also accepts JP (国 / 都道府県 / 市区町村).", "title": "Authority Level"}, "description": "Authority level filter. Canonical EN: national / prefecture / municipality / financial. Also accepts JP (国 / 都道府県 / 市区町村)."}, {"name": "tier", "in": "query", "required": false, "schema": {"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}], "description": "Repeat to OR across tiers (e.g. tier=S&tier=A).", "title": "Tier"}, "description": "Repeat to OR across tiers (e.g. tier=S&tier=A)."}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 100, "minimum": 1, "default": 50, "title": "Limit"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/DeadlinesResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/billing/checkout": {"post": {"tags": ["billing"], "summary": "Create Checkout", "operationId": "create_checkout_v1_billing_checkout_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/jpintel_mcp__api__billing__CheckoutRequest"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/jpintel_mcp__api__compliance__CheckoutResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/billing/portal": {"post": {"tags": ["billing"], "summary": "Create Portal", "description": "Stripe Customer Portal URL for the *authenticated* API key's customer.\n\nAuth: X-API-Key (or `Authorization: Bearer ...`) MUST be supplied.\nAnonymous callers get 401 here — there is no Stripe customer to open\na portal session for. The body-supplied `customer_id` is ignored\n(kept on the schema for backwards-compat decoding only); the customer\nis resolved from `api_keys.customer_id` keyed off the auth'd key\nhash. This closes a P0 enumeration hole where any caller could pass\na guessed `cus_*` id and obtain a portal URL for that customer.", "operationId": "create_portal_v1_billing_portal_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/PortalRequest"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "object", "additionalProperties": {"type": "string"}, "title": "Response Create Portal V1 Billing Portal Post"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/billing/keys/from-checkout": {"post": {"tags": ["billing"], "summary": "Issue From Checkout", "description": "Issue an API key after checkout completion.\n\nThe client holds a session_id from Stripe Checkout. Metered subscriptions\nreturn `payment_status=\"no_payment_required\"` at session completion (no\nupfront charge — Stripe bills the first invoice at the first cycle).\nNon-paid statuses (e.g. \"unpaid\") are rejected.", "operationId": "issue_from_checkout_v1_billing_keys_from_checkout_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/KeyIssueRequest"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/KeyIssueResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/billing/webhook": {"post": {"tags": ["billing"], "summary": "Webhook", "description": "Stripe webhook endpoint.\n\nP1 perf fix (audit a9fd80e134b538a32, 2026-04-25): outbound HTTP\n(Stripe.modify, Stripe.retrieve, Postmark sends) is scheduled via\n`BackgroundTasks` so it fires AFTER the 200 has been sent. Stripe\nexpects 200 within 5s; the previous inline path could exceed that\non Stripe API or Postmark slow-paths and trigger redelivery.\n\nOrder on the request path (all fast, all in-process / SQLite):\n  1. Content-Length guard\n  2. Read body + signature verify\n  3. Livemode guard\n  4. Dedup INSERT into `stripe_webhook_events` (BEGIN IMMEDIATE)\n  5. Synchronous DB writes (issue_key, update_tier, revoke_subscription,\n     update_subscription_status_*) — all SQLite, sub-millisecond\n  6. COMMIT\n  7. Schedule slow ops via background_tasks (Stripe API + Postmark)\n  8. Return 200\n\nBackground tasks open their OWN DB connection where needed — the\nrequest-scoped `conn` is closed by FastAPI before BackgroundTasks\nfire.", "operationId": "webhook_v1_billing_webhook_post", "parameters": [{"name": "stripe-signature", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Stripe-Signature"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "object", "additionalProperties": {"type": "string"}, "title": "Response Webhook V1 Billing Webhook Post"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/billing/refund_request": {"post": {"tags": ["billing"], "summary": "Submit a refund request for ¥3/req metered Stripe charges (manual review)", "description": "Customer-initiated intake for refunds against ¥3/req metered Stripe charges. The operator (Bookyou株式会社) reviews each request manually within 14 days; this endpoint only records the request and fires an operator notification — it does NOT auto-issue the refund or revoke the caller's API key. Existing metered charges remain on the customer's invoice until the review concludes.\n\n**Use this when** a caller disputes a specific billing month or a tranche of usage they consider erroneous. For chargeback-style disputes, prefer Stripe's issuer-side flow (we mirror those events into the audit log automatically).\n\n(顧客発の返金請求受付。Stripe で課金された ¥3/req メータリング分の返金を顧客が請求するためのエンドポイント。運営側で 14 日以内に手動審査を行います。受付番号の発行と通知のみで、自動的な返金や API キー失効は行いません。既に課金済みの分も審査完了までそのまま残ります。)", "operationId": "submit_refund_request_v1_billing_refund_request_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/RefundRequest"}}}, "required": true}, "responses": {"201": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/RefundResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/device/authorize": {"post": {"tags": ["device"], "summary": "Authorize", "description": "Mint a fresh (device_code, user_code) pair (RFC 8628 §3.1).", "operationId": "authorize_v1_device_authorize_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/AuthorizeRequest"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AuthorizeResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/device/token": {"post": {"tags": ["device"], "summary": "Token", "description": "Device-flow poll endpoint (RFC 8628 §3.4).\n\nSuccess → {access_token, token_type, scope} + 200.\nPending → authorization_pending (400).\nPolling too fast → slow_down (400).\nExpired → expired_token (400).\nDenied → access_denied (400).\nInvalid grant_type / device_code → invalid_grant (400).", "operationId": "token_v1_device_token_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/TokenRequest"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/TokenSuccess"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/device/complete": {"post": {"tags": ["device"], "summary": "Complete", "description": "Called by /go after Stripe Checkout succeeds.\n\n1. Verifies the Stripe session is paid (or metered — no_payment_required).\n2. Marks device_code activated.\n3. Issues an api_keys row prefixed 'am_device_' and links it.\n4. Stashes the raw key in the in-process pickup map so the MCP's\n   next /token poll picks it up.", "operationId": "complete_v1_device_complete_post", "parameters": [{"name": "origin", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Origin"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/CompleteRequest"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/CompleteResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/email/webhook": {"post": {"tags": ["email"], "summary": "Postmark Webhook", "operationId": "postmark_webhook_v1_email_webhook_post", "parameters": [{"name": "X-Postmark-Signature", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Postmark-Signature"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "object", "additionalProperties": {"type": "string"}, "title": "Response Postmark Webhook V1 Email Webhook Post"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/email/unsubscribe": {"post": {"tags": ["email"], "summary": "Unsubscribe Post", "description": "Idempotent self-serve master-list opt-out.\n\nOn invalid token we DO NOT raise 401 — that would let an attacker\nenumerate which addresses are valid. We return the success shape\nwith a fixed timestamp instead. The internal write is silently\nskipped.", "operationId": "unsubscribe_post_v1_email_unsubscribe_post", "parameters": [{"name": "email", "in": "query", "required": true, "schema": {"type": "string", "minLength": 3, "maxLength": 320, "title": "Email"}}, {"name": "token", "in": "query", "required": true, "schema": {"type": "string", "minLength": 16, "maxLength": 128, "title": "Token"}}, {"name": "reason", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 64}, {"type": "null"}], "title": "Reason"}}], "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"}}}}}}, "get": {"tags": ["email"], "summary": "Unsubscribe Get", "description": "HTML variant — clicked from a footer link.\n\nMail clients and corporate scanners pre-fetch GET links to scan for\nmalware. To keep that from auto-unsubscribing, we ONLY honour the\nGET when the token verifies AND the user explicitly hits the page.\nToken verification is the same HMAC check as POST so a bot-fetch with\na stolen-but-real token would still unsubscribe — that's by design;\na real token implies real user intent.", "operationId": "unsubscribe_get_v1_email_unsubscribe_get", "parameters": [{"name": "email", "in": "query", "required": true, "schema": {"type": "string", "minLength": 3, "maxLength": 320, "title": "Email"}}, {"name": "token", "in": "query", "required": true, "schema": {"type": "string", "minLength": 16, "maxLength": 128, "title": "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/subscribers": {"post": {"tags": ["subscribers"], "summary": "Subscribe", "operationId": "subscribe_v1_subscribers_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/jpintel_mcp__api__subscribers__SubscribeRequest"}}}, "required": true}, "responses": {"201": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/jpintel_mcp__api__subscribers__SubscribeResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/subscribers/unsubscribe": {"get": {"tags": ["subscribers"], "summary": "Unsubscribe", "operationId": "unsubscribe_v1_subscribers_unsubscribe_get", "parameters": [{"name": "token", "in": "query", "required": true, "schema": {"type": "string", "minLength": 16, "maxLength": 128, "title": "Token"}}, {"name": "email", "in": "query", "required": true, "schema": {"type": "string", "minLength": 3, "maxLength": 320, "title": "Email"}}], "responses": {"200": {"description": "Successful Response", "content": {"text/html": {"schema": {"type": "string"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/compliance/subscribe": {"post": {"tags": ["compliance"], "summary": "Subscribe", "description": "Create a new pending subscription + send verification email.\n\nFlow:\n    1. Insert row with `verification_token` set, `verified_at=NULL`.\n    2. Send verification email (async best-effort via Postmark).\n    3. If plan='paid', return `next_step='checkout'` + a placeholder\n       response — the caller should then POST /stripe-checkout.\n       (The caller must verify FIRST; the verify GET redirects to\n       the checkout for paid plans — see below.)\n    4. If plan='free', return `next_step='verify'`.\n\nDuplicate email behaviour: we return the SAME response shape whether\nthis is a fresh signup or an already-existing email — no enumeration\nleak. A second subscribe with the same email re-sends the verification\nmail (an attacker cannot see `verified_at` from the endpoint; worst\ncase they can DoS our Postmark budget, which the anon rate limit\ncovers).", "operationId": "subscribe_v1_compliance_subscribe_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/jpintel_mcp__api__compliance__SubscribeRequest"}}}, "required": true}, "responses": {"201": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/jpintel_mcp__api__compliance__SubscribeResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/compliance/verify/{verification_token}": {"get": {"tags": ["compliance"], "summary": "Verify", "description": "Mark a subscriber as verified. Renders a minimal HTML page.\n\nA valid token flips `verified_at = now()` and clears\n`verification_token`. Idempotent — a second click shows the same\nsuccess page (we look up by email after the clear, so the row is\nstill findable by unsubscribe_token but not by verification_token).\n\nFor paid subscribers, the page nudges the user to the Stripe checkout\npage (link to `/alerts.html#checkout`).", "operationId": "verify_v1_compliance_verify__verification_token__get", "parameters": [{"name": "verification_token", "in": "path", "required": true, "schema": {"type": "string", "title": "Verification 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/compliance/unsubscribe/{unsubscribe_token}": {"post": {"tags": ["compliance"], "summary": "Unsubscribe", "description": "Cancel the subscription.\n\n- For `plan='paid'`: also cancels the Stripe subscription (best-effort;\n  if Stripe is down we still mark canceled_at locally so no more\n  emails go out).\n- For `plan='free'`: just marks `canceled_at`.\nReturns HTML so the static unsubscribe landing page can call this\nvia fetch + show the body.", "operationId": "unsubscribe_v1_compliance_unsubscribe__unsubscribe_token__post", "parameters": [{"name": "unsubscribe_token", "in": "path", "required": true, "schema": {"type": "string", "title": "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/compliance/stripe-checkout": {"post": {"tags": ["compliance"], "summary": "Stripe Checkout", "description": "Create a Stripe Checkout Session for a verified paid subscriber.\n\nRequires the subscriber row to already exist and be verified. The\nsession's `client_reference_id` is the subscriber_id so the webhook\ncan tie the Stripe subscription back to our row.", "operationId": "stripe_checkout_v1_compliance_stripe_checkout_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/jpintel_mcp__api__compliance__CheckoutRequest"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/jpintel_mcp__api__compliance__CheckoutResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/compliance/stripe-webhook": {"post": {"tags": ["compliance"], "summary": "Stripe Webhook", "description": "Handle customer.subscription.created/.deleted for the alert product.\n\nOn `created` we persist stripe_customer_id / stripe_subscription_id +\nflip plan to 'paid' if it wasn't already.\nOn `deleted` we mark canceled_at (same effect as a customer clicking\nthe unsubscribe link — Stripe Customer Portal cancel path).", "operationId": "stripe_webhook_v1_compliance_stripe_webhook_post", "parameters": [{"name": "stripe-signature", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Stripe-Signature"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "object", "additionalProperties": {"type": "string"}, "title": "Response Stripe Webhook V1 Compliance Stripe Webhook Post"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/signup": {"post": {"tags": ["signup"], "summary": "メール認証だけで 14 日 / 200 req のトライアル鍵を発行", "description": "Persist a trial_signups row + mail a magic link. Always 202 Accepted.\n\nPosture: we always return 202 even when:\n    * the email already used its lifetime trial (409 in body would\n      leak account-existence; a uniform 202 with the magic link only\n      mailed when the row insert succeeds keeps the response shape\n      opaque). Re-signup attempts hit the UNIQUE on email_normalized\n      which we swallow as IntegrityError — no email is sent.\n    * the IP has exceeded its 24h gate. We DO surface this as 429\n      because an evaluator typing their email twice should see WHY\n      their second click bounced.\n\nStripe is NEVER involved. tier='trial' rows have no customer_id, no\nsubscription, and the metered branch in deps._enforce_quota /\nApiContext.metered checks `tier == 'paid'`.", "operationId": "submit_signup_v1_signup_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/jpintel_mcp__api__signup__SignupRequest"}}}, "required": true}, "responses": {"202": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/jpintel_mcp__api__signup__SignupResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/signup/verify": {"get": {"tags": ["signup"], "summary": "マジックリンクを検証してトライアル API 鍵を発行 (1 回限りの reveal)", "description": "Verify the magic-link token, issue a trial key, redirect to /trial.html.\n\nBehaviour:\n    * Invalid / unknown email → redirect to /trial.html?status=invalid\n    * Expired (>24h since signup) → redirect with ?status=expired\n    * Already verified (key already issued) → redirect with ?status=already\n    * OK → issue tier='trial' key, mark verified_at, link\n      issued_api_key_hash, redirect to /trial.html with the raw key\n      in the URL fragment.\n\nWe deliberately use a 302 redirect rather than rendering JSON here\nso a click from the email client lands on the static page and the\nraw-key reveal flow matches the success.html paid-tier UX pattern.\nThe fragment-only key is invisible to our access logs (browsers\nstrip fragment before sending the request).", "operationId": "verify_signup_v1_signup_verify_get", "parameters": [{"name": "email", "in": "query", "required": true, "schema": {"type": "string", "minLength": 3, "maxLength": 320, "title": "Email"}}, {"name": "token", "in": "query", "required": true, "schema": {"type": "string", "minLength": 32, "maxLength": 128, "title": "Token"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/session": {"post": {"tags": ["me"], "summary": "Create Session", "operationId": "create_session_v1_session_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/SessionRequest"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SessionResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me": {"get": {"tags": ["me"], "summary": "Get Me", "operationId": "get_me_v1_me_get", "parameters": [{"name": "am_session", "in": "cookie", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Am Session"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MeResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/usage": {"get": {"tags": ["me"], "summary": "Get Me Usage", "description": "Per-day OR per-client_tag usage aggregate.\n\nDefault (``group_by`` absent) returns the legacy daily series — one\nrow per UTC date with the call count, contiguous (gaps filled with\nzeros) so dashboards can plot directly. ``days`` clamped 1..90.\n\n``group_by=client_tag`` (migration 085) returns one row per distinct\n``X-Client-Tag`` value within the same window, sorted by descending\ncall count. ``client_tag=None`` is the catch-all bucket for requests\nthat did not pass the header. Aggregation runs across the full\nparent/child tree (migration 086) so a parent caller sees totals for\nall children.", "operationId": "get_me_usage_v1_me_usage_get", "parameters": [{"name": "days", "in": "query", "required": false, "schema": {"type": "integer", "default": 30, "title": "Days"}}, {"name": "group_by", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Group By"}}, {"name": "am_session", "in": "cookie", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Am Session"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"anyOf": [{"type": "array", "items": {"$ref": "#/components/schemas/jpintel_mcp__api__me__UsageDay"}}, {"type": "array", "items": {"$ref": "#/components/schemas/UsageByClientTag"}}], "title": "Response Get Me Usage V1 Me Usage Get"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/usage.csv": {"get": {"tags": ["me"], "summary": "Get Me Usage Csv", "description": "CSV export of per-tag aggregate (migration 085).\n\nCurrently only ``group_by=client_tag`` is supported. The format is\na stable header + one row per tag, NULL tags rendered as empty.\nDesigned for Excel / Google Sheets ingestion by 税理士 offices that\nneed to forward per-顧問先 line items into their internal billing.", "operationId": "get_me_usage_csv_v1_me_usage_csv_get", "parameters": [{"name": "days", "in": "query", "required": false, "schema": {"type": "integer", "default": 30, "title": "Days"}}, {"name": "group_by", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Group By"}}, {"name": "am_session", "in": "cookie", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Am Session"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/rotate-key": {"post": {"tags": ["me"], "summary": "Rotate Key", "description": "Revoke the current key and issue a new one in a single atomic txn.\n\nP0 fixes from audit a4298e454aab2aa43:\n  - P0-1: BEGIN IMMEDIATE / COMMIT around the revoke + insert. Without\n    this the connection runs in autocommit (db.session.connect uses\n    isolation_level=None), so a crash between the UPDATE and the INSERT\n    leaves the customer with neither a working old key nor a new key.\n    BEGIN IMMEDIATE acquires the writer lock up-front, which also serves\n    as the lock for the concurrent-rotation race (only one writer at\n    a time; the loser gets SQLITE_BUSY and bubbles up as 5xx).\n  - P0-3: carry forward `monthly_cap_yen` so the customer's spend cap\n    is not silently reset to NULL (unlimited) on rotation. Also migrate\n    any `alert_subscriptions` rows from old key_hash to new — otherwise\n    the customer's amendment alerts go silent on rotation.\n  - Bonus: re-issue the session cookie bound to the NEW key_hash so the\n    dashboard stays logged in. With P0-2 in place, the OLD cookie now\n    401s on next /v1/me, so without this the user gets bounced to\n    /login the moment they rotate.", "operationId": "rotate_key_v1_me_rotate_key_post", "parameters": [{"name": "am_session", "in": "cookie", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Am Session"}}, {"name": "am_csrf", "in": "cookie", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Am Csrf"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/RotateKeyResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/cap": {"post": {"tags": ["me"], "summary": "Set Monthly Cap", "description": "Set the customer's self-serve monthly spend cap (P3-W).\n\nAuthenticated via require_key (X-API-Key header or Authorization: Bearer).\nAnonymous callers (no key) cannot set a cap because the anonymous tier is\nalready gated by the 50 req/月 free quota — there is nothing to cap.\n\nThe unit price stays ¥3/req (immutable per\nproject_autonomath_business_model). `monthly_cap_yen` is purely a client\nbudget control: at cap-reached the middleware returns 503 with\n`cap_reached: true` and Stripe usage is NOT recorded for the rejected\nrequest, so the cap is hard.", "operationId": "set_monthly_cap_v1_me_cap_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/CapRequest"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/CapResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/billing-portal": {"post": {"tags": ["me"], "summary": "Billing Portal", "operationId": "billing_portal_v1_me_billing_portal_post", "parameters": [{"name": "am_session", "in": "cookie", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Am Session"}}, {"name": "am_csrf", "in": "cookie", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Am Csrf"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/BillingPortalResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/session/logout": {"post": {"tags": ["me"], "summary": "Logout", "operationId": "logout_v1_session_logout_post", "parameters": [{"name": "am_csrf", "in": "cookie", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Am Csrf"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/dashboard": {"get": {"tags": ["dashboard"], "summary": "Get Dashboard", "description": "30-day usage summary for the calling key.\n\nBearer-authenticated. The series is filled with zeros for days with no\nusage so the UI can render a contiguous bar chart without client-side\ngap-filling.", "operationId": "get_dashboard_v1_me_dashboard_get", "parameters": [{"name": "days", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 90, "minimum": 1, "default": 30, "title": "Days"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/DashboardSummary"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/usage_by_tool": {"get": {"tags": ["dashboard"], "summary": "Get Usage By Tool", "description": "Top N endpoints by call count over the requested window.", "operationId": "get_usage_by_tool_v1_me_usage_by_tool_get", "parameters": [{"name": "days", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 90, "minimum": 1, "default": 30, "title": "Days"}}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 50, "minimum": 1, "default": 10, "title": "Limit"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ToolUsageResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/billing_history": {"get": {"tags": ["dashboard"], "summary": "Get Billing History", "description": "Most-recent Stripe invoices for the calling key's customer.\n\nUses a 5-minute in-process cache keyed by `customer_id`. Empty list when\nStripe is unconfigured or the customer has no invoices yet — this is not\nan error, just a cold-start state.", "operationId": "get_billing_history_v1_me_billing_history_get", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/BillingHistoryResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/tool_recommendation": {"get": {"tags": ["dashboard"], "summary": "Get Tool Recommendation", "description": "Map a free-text intent to ranked tool candidates.\n\nPure keyword scoring — no LLM call (memory: feedback_autonomath_no_api_use).\nThe caller is expected to be an LLM agent; we return signal, the caller\ncomposes the next request.", "operationId": "get_tool_recommendation_v1_me_tool_recommendation_get", "parameters": [{"name": "intent", "in": "query", "required": true, "schema": {"type": "string", "minLength": 1, "maxLength": 500, "title": "Intent"}}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 10, "minimum": 1, "default": 5, "title": "Limit"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ToolRecommendationResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/feedback": {"post": {"tags": ["feedback"], "summary": "Submit Feedback", "operationId": "submit_feedback_v1_feedback_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/FeedbackRequest"}}}}, "responses": {"201": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/FeedbackResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/privacy/disclosure_request": {"post": {"tags": ["privacy"], "summary": "Submit an APPI Article 31 personal-data disclosure request", "description": "Intake for disclosure requests under the Act on the Protection of Personal Information (個人情報の保護に関する法律 / APPI), Article 31. This endpoint only records the request and notifies the operator (Bookyou株式会社) — the actual disclosure is performed within 14 days after operator-side identity verification, out-of-band. Personal data itself is **never** returned in this response; the body carries only the receipt number, expected response window, and the operator contact (<email-redacted>).\n\n**Use this when** a data subject (typically a 13-digit 法人番号 holder whose record we mirror) wants to know which of their fields are stored. Identity verification methods accepted: personal-seal certificate (印鑑証明), driver's licence, individual number card (マイナンバーカード). The operator may refuse with a reason code under §31-2 (e.g. would jeopardise a third party).\n\n(個人情報の保護に関する法律 第31条 に基づく開示請求を受付けます。受付番号の発行と運営宛通知のみを行い、実際の開示は 14 日以内に運営側で本人確認の上で別途対応します。個人情報そのものはこのレスポンスでは返却しません。)", "operationId": "submit_disclosure_request_v1_privacy_disclosure_request_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/DisclosureRequest"}}}, "required": true}, "responses": {"201": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/DisclosureResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/privacy/deletion_request": {"post": {"tags": ["privacy"], "summary": "Submit an APPI Article 33 personal-data deletion request", "description": "Intake for deletion requests under the Act on the Protection of Personal Information (個人情報の保護に関する法律 / APPI), Article 33. This endpoint only records the request and notifies the operator (Bookyou株式会社) — the actual deletion is performed within 30 days after operator-side identity verification (§33-3 statutory ceiling). Personal data itself is **never** returned or mutated in this response; the body carries only the receipt number, expected response window, and the operator contact (<email-redacted>).\n\n**Use this when** a data subject wants their record removed from our mirror of NTA invoice-registrant data, gbiz corporate facts, or audit-log artefacts that contain their identifiers. Pass `target_data_categories[]` to scope the request (a closed enum covers the categories we hold). The operator may decline with a reason code under §33-1 (e.g. statutory retention obligation).\n\n(個人情報の保護に関する法律 第33条 に基づく削除請求を受付けます。受付番号の発行と運営宛通知のみを行い、実際の削除は 30 日以内に運営側で本人確認の上で別途対応します (§33-3 法定上限)。個人情報そのものはこのレスポンスでは返却・操作しません。)", "operationId": "submit_deletion_request_v1_privacy_deletion_request_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/DeletionRequest"}}}, "required": true}, "responses": {"201": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/DeletionResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/testimonials": {"post": {"tags": ["testimonials", "me"], "summary": "Submit Testimonial", "operationId": "submit_testimonial_v1_me_testimonials_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/TestimonialSubmit"}}}}, "responses": {"201": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/TestimonialSubmitResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/testimonials/{testimonial_id}": {"delete": {"tags": ["testimonials", "me"], "summary": "Delete My Testimonial", "operationId": "delete_my_testimonial_v1_me_testimonials__testimonial_id__delete", "parameters": [{"name": "testimonial_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Testimonial Id"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"204": {"description": "Successful Response"}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/advisors/match": {"get": {"tags": ["advisors"], "summary": "Match Advisors", "description": "Top ``limit`` advisors matching the supplied filters.\n\nIntentionally doesn't go through the digest whitelist (ctx.log_usage\nis called with no params): advisor match responses are not a retention\nsignal, and the params (esp. prefecture) carry enough geographic info\nthat hashing them into a digest starts to smell PII-adjacent.", "operationId": "match_advisors_v1_advisors_match_get", "parameters": [{"name": "prefecture", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "都道府県. Accepts canonical, short, or romaji.", "title": "Prefecture"}, "description": "都道府県. Accepts canonical, short, or romaji."}, {"name": "specialty", "in": "query", "required": false, "schema": {"anyOf": [{"enum": ["subsidy", "loan", "tax", "enforcement_defense", "invoice", "ebook"], "type": "string"}, {"type": "null"}], "title": "Specialty"}}, {"name": "industry", "in": "query", "required": false, "schema": {"anyOf": [{"enum": ["agri", "manufacture", "it", "service", "construction", "retail"], "type": "string"}, {"type": "null"}], "title": "Industry"}}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 10, "minimum": 1, "default": 3, "title": "Limit"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/MatchResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/advisors/track": {"post": {"tags": ["advisors"], "summary": "Track Click", "description": "Record a referral click and mint a single-use redirect token.\n\nThe returned ``redirect_url`` is ``advisor.contact_url`` with\n``?ref=<token>`` appended, or a fallback to an in-domain contact page\nwhen the advisor didn't supply one. 5% or ¥3,000 commission (model\ndependent) is resolved at conversion time, not click time.", "operationId": "track_click_v1_advisors_track_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/TrackRequest"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/TrackResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/advisors/signup": {"post": {"tags": ["advisors"], "summary": "Signup Advisor", "description": "Create an unverified advisor profile + return Stripe Connect onboarding URL.\n\nSelf-serve, no API key required (prospective advisors don't have one\nyet). verified_at stays NULL until both:\n  (a) /verify-houjin/{id} succeeds against invoice_registrants, AND\n  (b) Stripe Connect account.updated webhook reports capabilities.transfers=active.\n\nFor advisors seeded from the 中小企業庁 認定支援機関 public list,\nscripts/seed_advisors.py sets verified_at directly at seed time — this\nhandler path is for self-serve signups only.", "operationId": "signup_advisor_v1_advisors_signup_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/jpintel_mcp__api__advisors__SignupRequest"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/jpintel_mcp__api__advisors__SignupResponse"}}}}, "409": {"description": "houjin_bangou already registered"}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/advisors/verify-houjin/{advisor_id}": {"post": {"tags": ["advisors"], "summary": "Verify Houjin", "description": "Confirm the advisor's 法人番号 exists in invoice_registrants (migration 019).\n\nProvisional verification: sets advisors.verified_at to the current\ntimestamp when the 法人番号 is found. Full verification still waits\non Stripe Connect webhook reporting capabilities.transfers=active —\nquery_matching_advisors() filters on verified_at alone today, so this\nprovisional gate is the public-visibility switch.\n\nFor 認定支援機関 rows seeded from the 中小企業庁 public list,\nseed_advisors.py sets verified_at directly and this endpoint is a\nno-op idempotent success.", "operationId": "verify_houjin_v1_advisors_verify_houjin__advisor_id__post", "parameters": [{"name": "advisor_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Advisor Id"}}], "responses": {"200": {"description": "verified", "content": {"application/json": {"schema": {}}}}, "404": {"description": "advisor not found"}, "422": {"description": "houjin_bangou not found in NTA registry"}}}}, "/v1/advisors/report-conversion": {"post": {"tags": ["advisors"], "summary": "Report Conversion", "description": "Advisor marks a referral as converted. Commission computed + queued.\n\nAuthentication model: authentication is provided by possession of the\n``referral_token`` (treat as a bearer secret for that single referral)\ncombined with the advisor later being able to verify via Stripe Connect.\nA stronger model would require the advisor's API key — deferred to the\ndashboard login flow.", "operationId": "report_conversion_v1_advisors_report_conversion_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ReportConversionRequest"}}}, "required": true}, "responses": {"200": {"description": "conversion recorded", "content": {"application/json": {"schema": {}}}}, "404": {"description": "token unknown"}, "409": {"description": "already converted"}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/advisors/{advisor_id}/dashboard-data": {"get": {"tags": ["advisors"], "summary": "Dashboard Data", "description": "Self-serve dashboard backing data: referrals + earnings summary.\n\nAuthentication: intentionally light today — the dashboard HTML is\nexpected to be reached via the Stripe Connect Express portal return\nURL (or via magic-link email). Adding API-key auth here would block\nthe simplest flow where the advisor arrives from Stripe's own\ndashboard. If this becomes abused, add a signed HMAC\n``?token=...`` in the URL and verify here.", "operationId": "dashboard_data_v1_advisors__advisor_id__dashboard_data_get", "parameters": [{"name": "advisor_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Advisor Id"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AdvisorDashboardResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/alerts/subscribe": {"post": {"tags": ["alerts"], "summary": "Create Subscription", "description": "Create a new alert subscription on the calling key.\n\nAt least one delivery channel is required: webhook_url OR email. A\nsubscription with neither is meaningless (the cron has nowhere to send).\n\n`filter_value` is required for every filter_type EXCEPT 'all'. For 'all'\nit is silently ignored (we set NULL on disk for clarity).", "operationId": "create_subscription_v1_me_alerts_subscribe_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/jpintel_mcp__api__alerts__SubscribeRequest"}}}}, "responses": {"201": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SubscriptionResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/alerts/subscriptions": {"get": {"tags": ["alerts"], "summary": "List Subscriptions", "description": "List the calling key's active subscriptions.\n\nInactive (deactivated) rows are NOT returned by default — they are kept\non disk for audit but are noise on the read path. There is no\n`?include_inactive=true` flag in MVP; the customer who wants to inspect\nhistory can hit the DB directly via support.", "operationId": "list_subscriptions_v1_me_alerts_subscriptions_get", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/SubscriptionResponse"}, "title": "Response List Subscriptions V1 Me Alerts Subscriptions Get"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/alerts/subscriptions/{sub_id}": {"delete": {"tags": ["alerts"], "summary": "Deactivate Subscription", "description": "Deactivate (soft-delete) the subscription.\n\nThe row stays on disk with active=0 so audit trails remain intact. A\nre-subscribe creates a fresh row rather than reviving the old one — this\nkeeps `created_at` semantically honest.\n\n404 when the id does not belong to this key OR when it is already\ninactive (so callers cannot probe the id-space of other keys).", "operationId": "deactivate_subscription_v1_me_alerts_subscriptions__sub_id__delete", "parameters": [{"name": "sub_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Sub Id"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/DeactivateResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/webhooks": {"post": {"tags": ["customer_webhooks"], "summary": "Register Webhook", "description": "Register a new outbound webhook.\n\nThe response carries the full ``secret_hmac`` exactly once. Subsequent\nGET / list calls return only ``secret_last4``. The customer MUST persist\nthe secret on their side at this moment — we cannot retrieve it later\n(parity with raw API key issuance via /signup).", "operationId": "register_webhook_v1_me_webhooks_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/RegisterRequest"}}}}, "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"}}}}}}, "get": {"tags": ["customer_webhooks"], "summary": "List Webhooks", "description": "List the calling key's webhooks (active + disabled, newest first).\n\nDisabled rows are intentionally surfaced (unlike alerts.py which hides\ninactive subs). For webhooks the operator must see WHY auto-disable\nfired and decide whether to re-register.\n\n``secret_hmac`` is NEVER returned here — only ``secret_last4`` is.", "operationId": "list_webhooks_v1_me_webhooks_get", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/WebhookResponse"}, "title": "Response List Webhooks V1 Me Webhooks Get"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/webhooks/{webhook_id}": {"delete": {"tags": ["customer_webhooks"], "summary": "Delete Webhook", "description": "Soft-delete (status='disabled'). Row stays for audit; deliveries stop.\n\n404 when the id is not owned by this key — same posture as alerts.py\n(callers cannot probe other keys' id-space).", "operationId": "delete_webhook_v1_me_webhooks__webhook_id__delete", "parameters": [{"name": "webhook_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Webhook Id"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/jpintel_mcp__api__customer_webhooks__DeleteResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/webhooks/{webhook_id}/test": {"post": {"tags": ["customer_webhooks"], "summary": "Test Delivery", "description": "Synthesise a test POST against the registered URL.\n\nCost: FREE. Does not increment ``failure_count`` (the customer is\nactively testing; a 500 here is informative, not a runaway-billing\nsignal). Does not appear in ``webhook_deliveries`` (test traffic must\nnot pollute the customer's audit trail).\n\nRate-limited to 5 / minute / webhook_id. The cap is generous enough\nfor normal \"save → test → tweak → test\" iteration but stops a\ncustomer from accidentally hammering their downstream during config.", "operationId": "test_delivery_v1_me_webhooks__webhook_id__test_post", "parameters": [{"name": "webhook_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Webhook Id"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/TestDeliveryResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/webhooks/{webhook_id}/deliveries": {"get": {"tags": ["customer_webhooks"], "summary": "List Deliveries", "description": "Return the most recent webhook_deliveries rows for the dashboard.\n\nDefault 10 (max 100). Owner-scoped: the join on customer_webhooks\nensures a caller cannot read another key's delivery log by passing a\nforeign id.", "operationId": "list_deliveries_v1_me_webhooks__webhook_id__deliveries_get", "parameters": [{"name": "webhook_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Webhook Id"}}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "default": 10, "title": "Limit"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/DeliveryRow"}, "title": "Response List Deliveries V1 Me Webhooks  Webhook Id  Deliveries Get"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/saved_searches": {"post": {"tags": ["saved-searches"], "summary": "Create Saved Search", "description": "Create a new saved search on the calling key.\n\nReturns 401 for anonymous callers — there is no key_hash to attach the\nrow to. Returns 400 when the query has no filters (empty-corpus guard).\nReturns 409 when the per-key cap (MAX_SAVED_SEARCHES_PER_KEY) is\nreached.", "operationId": "create_saved_search_v1_me_saved_searches_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/CreateSavedSearchRequest"}}}}, "responses": {"201": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SavedSearchResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "get": {"tags": ["saved-searches"], "summary": "List Saved Searches", "description": "Return all saved searches owned by the calling key.\n\nOrdered by id ascending so the dashboard's render order stays stable\nacross calls (no UI flicker on poll).", "operationId": "list_saved_searches_v1_me_saved_searches_get", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/SavedSearchResponse"}, "title": "Response List Saved Searches V1 Me Saved Searches Get"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/saved_searches/{saved_id}": {"patch": {"tags": ["saved-searches"], "summary": "Update Saved Search", "description": "Update channel routing on an existing saved search.\n\nOnly `channel_format` + `channel_url` are mutable post-create. Either\nboth must be provided (full channel re-bind) or neither (no-op 200).\nAnything else is rejected with 422 to prevent half-bound rows.", "operationId": "update_saved_search_v1_me_saved_searches__saved_id__patch", "parameters": [{"name": "saved_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Saved Id"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/PatchSavedSearchRequest"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SavedSearchResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "delete": {"tags": ["saved-searches"], "summary": "Delete Saved Search", "description": "Hard-delete a saved search. 404 when the id is not the caller's.\n\nWe hard-delete (not soft) because the saved-search row is a bookmark,\nnot a transactional record — the audit trail for delivered digests\nlives in ``usage_events`` and is unaffected by deletion here.", "operationId": "delete_saved_search_v1_me_saved_searches__saved_id__delete", "parameters": [{"name": "saved_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Saved Id"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/jpintel_mcp__api__saved_searches__DeleteResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/saved_searches/{saved_id}/sheet": {"post": {"tags": ["saved-searches"], "summary": "Bind Sheet To Saved Search", "description": "Bind a Google Sheets spreadsheet ID to this saved search.\n\nPre-condition: the calling key has already completed the OAuth\nhandshake at ``/v1/integrations/google/start`` → callback. We do NOT\nre-verify here (that would require a 4th hop to Google for a single\nbind). The cron job will surface \"credential missing\" on the next\ndelivery if the customer revoked the OAuth grant on Google's side.", "operationId": "bind_sheet_to_saved_search_v1_me_saved_searches__saved_id__sheet_post", "parameters": [{"name": "saved_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Saved Id"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/BindSheetRequest"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/BindSheetResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/saved_searches/{saved_id}/results": {"get": {"tags": ["saved-searches"], "summary": "Run today's saved-search and return results in chosen format", "description": "Re-run the saved search query against the current corpus and return the matching rows in the requested format. Allowed formats: `json` (default), `csv`, `xlsx`, `ics` (one VEVENT per row that carries `next_deadline`). One ¥3 charge per call regardless of row count or format. The same §52 / 税理士法 disclaimer is embedded in every non-JSON body, plus the `corpus_snapshot_id` is mirrored as `X-Corpus-Snapshot-Id` and into the format body (CSV comment row, ICS X-WR-CALDESC, etc.).", "operationId": "saved_search_results_v1_me_saved_searches__saved_id__results_get", "parameters": [{"name": "saved_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Saved Id"}}, {"name": "format", "in": "query", "required": false, "schema": {"type": "string", "pattern": "^(json|csv|xlsx|ics)$", "description": "Output format. `json` returns the raw envelope; `csv`/`xlsx` produce a downloadable workbook/sheet; `ics` produces an iCalendar file with one VEVENT per deadline-bearing row. Other formats (md / docx-application / accounting CSVs) are rejected — they are wired on the /v1/programs surface, not on saved_searches.", "default": "json", "title": "Format"}, "description": "Output format. `json` returns the raw envelope; `csv`/`xlsx` produce a downloadable workbook/sheet; `ics` produces an iCalendar file with one VEVENT per deadline-bearing row. Other formats (md / docx-application / accounting CSVs) are rejected — they are wired on the /v1/programs surface, not on saved_searches."}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/saved_searches/{saved_id}/results.xlsx": {"get": {"tags": ["saved-searches"], "summary": "Download today's saved-search results as XLSX", "description": "Re-runs the saved search and returns the result rows as an openpyxl-streamed XLSX workbook. ¥3 per call regardless of row count. The workbook carries the §52 disclaimer in row 1 of the data sheet plus a ``_meta`` sheet with license + brand.", "operationId": "saved_search_results_xlsx_v1_me_saved_searches__saved_id__results_xlsx_get", "parameters": [{"name": "saved_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Saved Id"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/client_profiles/bulk_import": {"post": {"tags": ["client-profiles"], "summary": "Bulk Import Client Profiles", "description": "Upload a CSV of 顧問先 metadata. Up to 200 rows per call.\n\nRequired column: `name_label`.\nOptional columns: `jsic_major`, `prefecture`, `employee_count`,\n`capital_yen`, `target_types`, `last_active_program_ids`.\nMulti-value columns (`target_types`, `last_active_program_ids`)\naccept JSON arrays, pipe-separated, or semicolon-separated values.\n\nReturns 401 for anonymous callers — this is a per-key surface.\nReturns 400 on missing required column / unparseable CSV / >200 rows.\nReturns 409 when the per-key cap (MAX_CLIENT_PROFILES_PER_KEY) would\nbe exceeded by the import.", "operationId": "bulk_import_client_profiles_v1_me_client_profiles_bulk_import_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"multipart/form-data": {"schema": {"$ref": "#/components/schemas/Body_bulk_import_client_profiles_v1_me_client_profiles_bulk_import_post"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/BulkImportResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/client_profiles": {"get": {"tags": ["client-profiles"], "summary": "List Client Profiles", "description": "Return all client_profiles owned by the calling key.\n\nOrdered by profile_id ascending so the dashboard renders stably.", "operationId": "list_client_profiles_v1_me_client_profiles_get", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/ClientProfileResponse"}, "title": "Response List Client Profiles V1 Me Client Profiles Get"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/client_profiles/{profile_id}": {"delete": {"tags": ["client-profiles"], "summary": "Delete Client Profile", "description": "Hard-delete a client_profile. 404 when the id is not the caller's.", "operationId": "delete_client_profile_v1_me_client_profiles__profile_id__delete", "parameters": [{"name": "profile_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Profile Id"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/jpintel_mcp__api__client_profiles__DeleteResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/clients/bulk_evaluate": {"post": {"tags": ["bulk-evaluate"], "summary": "Bulk Evaluate Clients", "description": "Pre-evaluate program eligibility for ALL clients in a CSV batch.\n\nWhen `commit=false` (default): returns JSON cost preview only. NO billing.\nWhen `commit=true`: bills ¥3 × N rows, returns a ZIP archive (one CSV\n    per client + manifest.json). `idempotency_key` REQUIRED on commit\n    so accidental retries don't double-bill.\n\nReturns:\n    - JSON {\"row_count\": N, \"estimated_yen\": 3*N, \"preview\": true}\n      when commit=false.\n    - application/zip stream when commit=true.\n\nErrors:\n    - 401 if anon (no key to bill).\n    - 400 on missing required columns / bad encoding / row cap.\n    - 409 if commit=true but idempotency_key already used with a\n          different payload signature.", "operationId": "bulk_evaluate_clients_v1_me_clients_bulk_evaluate_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"multipart/form-data": {"schema": {"$ref": "#/components/schemas/Body_bulk_evaluate_clients_v1_me_clients_bulk_evaluate_post"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"title": "Response Bulk Evaluate Clients V1 Me Clients Bulk Evaluate Post"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/courses": {"post": {"tags": ["courses"], "summary": "Subscribe Course", "description": "Subscribe the calling key to a pre-recorded course.\n\nSide effect: fires D+1 email synchronously (immediate first lesson,\nmetered ¥3 on success). The cron picks up D+2..D+N from the next\nsweep. We treat D+1 as \"day 1 of the course\" (current_day=1 after\ninsert), not D+0, to keep the customer-facing language clean.", "operationId": "subscribe_course_v1_me_courses_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SubscribeCourseRequest"}}}}, "responses": {"201": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/CourseSubscriptionResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "get": {"tags": ["courses"], "summary": "List Courses", "operationId": "list_courses_v1_me_courses_get", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/CourseSubscriptionResponse"}, "title": "Response List Courses V1 Me Courses Get"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/courses/{course_slug}": {"delete": {"tags": ["courses"], "summary": "Cancel Course", "description": "Cancel an active course. Soft-cancel (status='cancelled') so the\nhistory row stays for audit and the cron stops picking it up.", "operationId": "cancel_course_v1_me_courses__course_slug__delete", "parameters": [{"name": "course_slug", "in": "path", "required": true, "schema": {"type": "string", "title": "Course Slug"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/DeleteCourseResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/recurring/quarterly/{year}/{quarter}": {"get": {"tags": ["recurring"], "summary": "Get Quarterly Pdf", "description": "Generate (or serve cached) quarterly PDF for the calling key.\n\nCached to data/quarterly_pdfs/<api_key_id>_<year>_q<n>.pdf — repeat\ndownloads are read-from-disk, not re-rendered (and not metered).", "operationId": "get_quarterly_pdf_v1_me_recurring_quarterly__year___quarter__get", "parameters": [{"name": "year", "in": "path", "required": true, "schema": {"type": "integer", "title": "Year"}}, {"name": "quarter", "in": "path", "required": true, "schema": {"type": "integer", "title": "Quarter"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/recurring/slack": {"post": {"tags": ["recurring"], "summary": "Set Slack Webhook", "description": "Bind a Slack incoming-webhook URL to a saved search.\n\nServer-side validation:\n    * URL must start with `https://hooks.slack.com/services/` (SSRF\n      defense — Slack-only domain)\n    * A test message is POSTed; we commit the binding ONLY if Slack\n      returns 2xx.", "operationId": "set_slack_webhook_v1_me_recurring_slack_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SetSlackRequest"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SetSlackResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/recurring/email_course/start": {"post": {"tags": ["recurring"], "summary": "Start Email Course", "description": "Spec-named alias for the canonical `/v1/me/courses` create.\n\nForwards verbatim to courses.subscribe_course so the existing endpoint\nstays canonical (single billing path, single CRUD surface). The spec\ndocument calls this endpoint `email_course/start`, so we expose it\nunder that name AND keep the engineering-canonical `/v1/me/courses`\npath live.", "operationId": "start_email_course_v1_me_recurring_email_course_start_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/StartEmailCourseRequest"}}}}, "responses": {"201": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "object", "additionalProperties": true, "title": "Response Start Email Course V1 Me Recurring Email Course Start Post"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/integrations/slack": {"post": {"tags": ["integrations"], "summary": "Slack slash command", "description": "Slack POSTs ``application/x-www-form-urlencoded`` from a workspace slash command (e.g. ``/zeimukaikei DX 製造業``). The request carries `text=` (the user's query) and integration auth via ``?key=am_...`` (since Slack cannot inject custom headers per call). Response shape is Slack's standard `{response_type, text, blocks}` with §52 footer in the last block.", "operationId": "slack_slash_command_v1_integrations_slack_post", "parameters": [{"name": "key", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Key"}}], "requestBody": {"content": {"application/x-www-form-urlencoded": {"schema": {"$ref": "#/components/schemas/Body_slack_slash_command_v1_integrations_slack_post"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/integrations/slack/webhook": {"post": {"tags": ["integrations"], "summary": "Slack incoming webhook drop-in", "description": "Drop-in shape for Slack-compatible relays (Discord/Teams in their Slack-compat mode, Mattermost). Accepts JSON ``{text}`` or ``{query}`` and returns Slack's `{response_type, text, blocks}` envelope — same body as ``/slack`` above.", "operationId": "slack_incoming_webhook_v1_integrations_slack_webhook_post", "parameters": [{"name": "key", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Key"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "additionalProperties": true, "title": "Payload"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/integrations/sheets": {"post": {"tags": ["integrations"], "summary": "Google Sheets Apps Script callback", "description": "Apps Script template (`sdk/integrations/google-sheets/template.gs`) POSTs JSON `{query, field}`. Returns `{value, footer, source_url}` as a tight scalar so a single sheet cell can render. The Apps Script wrapper caches 6h via `CacheService` to bound spend on Sheet-open recalc.", "operationId": "sheets_callback_v1_integrations_sheets_post", "parameters": [{"name": "key", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Key"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/SheetsRequest"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/integrations/email/inbound": {"post": {"tags": ["integrations"], "summary": "Postmark inbound email webhook", "description": "Customers email `query+<email-redacted>`. Postmark POSTs the parsed email JSON to this endpoint. The plus-address tail carries the API key (`am_xxx`); the subject carries the query string. We reply via Postmark's outbound API with HTML + plain body and §52 footer. The `From:` address must be on the API key's whitelist (set once via `/v1/me/connectors/email`).", "operationId": "email_inbound_v1_integrations_email_inbound_post", "parameters": [{"name": "X-Postmark-Webhook-Token", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Postmark-Webhook-Token"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "additionalProperties": true, "title": "Payload"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/integrations/excel": {"get": {"tags": ["integrations"], "summary": "Excel WEBSERVICE template endpoint", "description": "Excel's `WEBSERVICE` formula cannot send headers, so auth is via `?key=` query param. Response is `text/plain` so the cell renders a single-line answer. `?field=` selects which scalar to return (title|url|prefecture|authority|amount|footer|count). §52 footer is also surfaced in the named cell `A1` of the downloadable template (`sdk/integrations/excel/zeimu-kaikei-template.xlsx`).", "operationId": "excel_webservice_v1_integrations_excel_get", "parameters": [{"name": "q", "in": "query", "required": true, "schema": {"type": "string", "minLength": 1, "maxLength": 200, "title": "Q"}}, {"name": "key", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Key"}}, {"name": "field", "in": "query", "required": false, "schema": {"type": "string", "default": "title", "title": "Field"}}], "responses": {"200": {"description": "Successful Response", "content": {"text/plain": {"schema": {"type": "string"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/integrations/kintone": {"post": {"tags": ["integrations"], "summary": "kintone plugin button callback", "description": "Pure client-side kintone plugin (`sdk/integrations/kintone/plugin.zip`) fetches this endpoint when the user clicks the in-record button \"AutonoMath で関連補助金検索\". Returns a JSON envelope the plugin renders into a modal + writes top result into configured fields. Origins `*.cybozu.com` / `*.kintone.com` are CORS-allowlisted in `config.py::cors_origins`.", "operationId": "kintone_callback_v1_integrations_kintone_post", "parameters": [{"name": "key", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Key"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/KintoneRequest"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/integrations/google/start": {"post": {"tags": ["integrations"], "summary": "Begin Google Sheets OAuth flow", "description": "Returns a one-time ``authorize_url`` that the customer must open in a browser to grant Google Sheets write access. The state token is opaque and embeds the calling api_key_hash + a 16-byte nonce; the callback validates both. ``GOOGLE_OAUTH_CLIENT_ID`` env var must be set on the operator side before this works (503 otherwise).", "operationId": "google_oauth_start_v1_integrations_google_start_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/integrations/google/callback": {"get": {"tags": ["integrations"], "summary": "Google OAuth callback", "description": "Google redirects here after user consent. Exchanges the code for a refresh+access token pair and stores it Fernet-encrypted under ``integration_accounts``. Redirects to the dashboard on success or returns a JSON error envelope on failure.", "operationId": "google_oauth_callback_v1_integrations_google_callback_get", "parameters": [{"name": "code", "in": "query", "required": true, "schema": {"type": "string", "title": "Code"}}, {"name": "state", "in": "query", "required": true, "schema": {"type": "string", "title": "State"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/integrations/google/status": {"get": {"tags": ["integrations"], "summary": "Google Sheets connection status for the calling key", "operationId": "google_status_v1_integrations_google_status_get", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/integrations/google": {"delete": {"tags": ["integrations"], "summary": "Revoke the Google Sheets credential", "operationId": "google_revoke_v1_integrations_google_delete", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"204": {"description": "Successful Response"}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/integrations/kintone/connect": {"post": {"tags": ["integrations"], "summary": "Register a kintone API token + app for the calling key", "operationId": "kintone_connect_v1_integrations_kintone_connect_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/KintoneConnectRequest"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/integrations/kintone/sync": {"post": {"tags": ["integrations"], "summary": "Sync saved-search results into the customer's kintone app", "description": "Pulls the calling key's saved search, runs the canonical search, and POSTs the result rows into the customer's kintone app via ``/k/v1/records.json``. One ¥3 charge per sync call regardless of row count (NOT 100×¥3 for 100 rows). Idempotency on ``(provider='kintone', idempotency_key)``: a repeat call with the same key returns the cached row count and does NOT bill again.", "operationId": "kintone_sync_v1_integrations_kintone_sync_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/KintoneSyncRequest"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/integrations/email/connect": {"post": {"tags": ["integrations"], "summary": "Mark email-inbound integration as enabled for this key", "description": "Records the calling key's preference for which inbound parse address to publish. The Postmark side (mapping the parse domain to the webhook URL) is a manual operator action — see ``docs/_internal/integrations_setup.md``. This endpoint just flags that the customer wants the route enabled.", "operationId": "email_connect_v1_integrations_email_connect_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/EmailConnectRequest"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/integrations/line/webhook": {"post": {"tags": ["integrations"], "summary": "LINE Messaging API webhook receiver", "description": "LINE delivers a JSON envelope `{destination, events: [...]}`. We verify `X-Line-Signature` HMAC-SHA256 against the raw body, then dispatch each event into the deterministic state machine (NO LLM call). Replies are sent via LINE Reply API; each round-trip bills ¥3 against the user's parent API key OR is counted against the LINE user's 50-event/month free allowance.", "operationId": "line_webhook_v1_integrations_line_webhook_post", "parameters": [{"name": "X-Line-Signature", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Line-Signature"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "object", "additionalProperties": {"type": "string"}, "title": "Response Line Webhook V1 Integrations Line Webhook Post"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/audit-log": {"get": {"tags": ["audit-log"], "summary": "Public audit log of am_amendment_diff (reverse-chrono, cursor-paginated)", "description": "**Public read** of the append-only `am_amendment_diff` table — the real per-field change log populated daily by `scripts/cron/refresh_amendment_diff.py` (migration 075). Anyone can verify what changed on which entity at which `detected_at`, against which `source_url`, byte-for-byte.\n\n**Pagination:** cursor-based. The first page request omits `cursor`; the response carries `next_cursor` (or null when exhausted). Pass `next_cursor` verbatim as `?cursor=...` for the next page. Cursor is opaque base64 — do not parse.\n\n**Filters:**\n- `since=YYYY-MM-DD` — UTC date floor on `detected_at`.\n- `entity_id` — exact match on `am_entities.canonical_id`.\n\n**Billing:** anonymous callers hit the 50/月 per-IP quota (JST 月初 リセット). Paid keys are metered ¥3/req 税別 (税込 ¥3.30) and bypass the anonymous ceiling.\n\n**Honesty:** AutonoMath detects field-level diffs from public government sources via daily cron. **検出のみで個別判断は行いません。** Subscribe to `https://jpcite.com/audit-log.rss` for an RSS feed of the same data.", "operationId": "rest_audit_log_v1_am_audit_log_get", "parameters": [{"name": "since", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "minLength": 10, "maxLength": 10, "pattern": "^\\d{4}-\\d{2}-\\d{2}$"}, {"type": "null"}], "description": "ISO YYYY-MM-DD UTC floor on detected_at.", "title": "Since"}, "description": "ISO YYYY-MM-DD UTC floor on detected_at."}, {"name": "entity_id", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "minLength": 1, "maxLength": 200}, {"type": "null"}], "description": "Exact match on am_entities.canonical_id.", "title": "Entity Id"}, "description": "Exact match on am_entities.canonical_id."}, {"name": "cursor", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "minLength": 1, "maxLength": 200}, {"type": "null"}], "description": "Opaque pagination cursor from a previous response. Omit for the first page.", "title": "Cursor"}, "description": "Opaque pagination cursor from a previous response. Omit for the first page."}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 100, "minimum": 1, "description": "Max rows per page (default 50).", "default": 50, "title": "Limit"}, "description": "Max rows per page (default 50)."}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Reverse-chrono diff rows + next_cursor.", "content": {"application/json": {"schema": {}, "example": {"results": [{"diff_id": 12345, "entity_id": "program_jigyou_saikouchiku_2026", "field_name": "amount_max_yen", "field_name_ja": "補助上限額", "prev_value": "150000000", "new_value": "200000000", "prev_hash": "9c3f8e...", "new_hash": "7a1b2d...", "detected_at": "2026-04-28T03:14:22+00:00", "source_url": "https://jigyou-saikouchiku.go.jp/..."}], "next_cursor": "MjAyNi0wNC0yOFQwMzoxNDoyMnwxMjM0NQ", "limit": 100, "filter": {"since": "2026-04-01"}}}}}, "400": {"description": "Invalid cursor / since format."}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/tax_incentives": {"get": {"tags": ["autonomath"], "summary": "Search 税制特例 (special depreciation, tax credits, NOL carryforward, exemptions)", "description": "FTS + structured filter across **285 税制特例** rows: 特別償却 (special depreciation), 税額控除 (tax credit), 繰越欠損金 (NOL carryforward), 非課税措置 (tax exemption). Backed by autonomath.db `am_entities` (record_kind='tax_measure') with provenance + amount conditions joined.\n\n**When to use:** caller asks 'what tax incentives apply to manufacturing CapEx in 2026?' — pass `target_year=2026` + `industry='製造業'` + `target_entity='sme'`. For broader consumption-tax / 適格請求書 ruleset queries (2割特例, 経過措置 80%) use `GET /v1/tax_rulesets/search` instead.\n\n**税理士法 §52 fence:** every response carries a `_disclaimer` envelope key declaring the output information retrieval, NOT 税務助言. LLM agents MUST relay the disclaimer.", "operationId": "rest_search_tax_incentives_v1_am_tax_incentives_get", "parameters": [{"name": "query", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}], "title": "Query"}}, {"name": "authority", "in": "query", "required": false, "schema": {"anyOf": [{"enum": ["国税庁", "財務省", "経済産業省", "中小企業庁", "農林水産省", "総務省", "国土交通省", "厚生労働省", "自治体"], "type": "string"}, {"type": "null"}], "title": "Authority"}}, {"name": "industry", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 100}, {"type": "null"}], "title": "Industry"}}, {"name": "target_year", "in": "query", "required": false, "schema": {"anyOf": [{"type": "integer", "maximum": 2099, "minimum": 1988}, {"type": "null"}], "title": "Target Year"}}, {"name": "target_entity", "in": "query", "required": false, "schema": {"anyOf": [{"enum": ["中小企業", "小規模事業者", "個人事業主", "大企業", "認定事業者", "青色申告者", "農業法人", "特定事業者等"], "type": "string"}, {"type": "null"}], "title": "Target Entity"}}, {"name": "natural_query", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 500}, {"type": "null"}], "title": "Natural Query"}}, {"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"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "AMSearchResponse + `_disclaimer` (税理士法 §52 fence).", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AMSearchResponse"}, "example": {"total": 1, "limit": 20, "offset": 0, "results": [{"entity_id": "tax_measure_chusho_kvestigation_credit_2026", "name": "中小企業投資促進税制 (税額控除7%)", "authority": "国税庁", "tax_kind": "corporate", "incentive_type": "credit", "rate": "7%", "amount_cap_yen": 30000000, "effective_from": "2025-04-01", "effective_until": "2027-03-31", "source_url": "https://www.nta.go.jp/..."}], "_disclaimer": "本情報は公開情報の検索結果であり、税務助言ではありません。申告・適用判断は税理士にご確認ください。"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/certifications": {"get": {"tags": ["autonomath"], "summary": "Search 認定・認証制度 (健康経営, えるぼし, くるみん, 経営革新等支援機関 etc.)", "description": "Look up Japanese business certification programs across 66 認定・認証 schemes spanning labor (くるみん, えるぼし, ユースエール), management innovation (経営革新, 認定経営革新等支援機関), health (健康経営優良法人, 健康経営銘柄), sustainability (SDGs 認証, ゼブラ企業), and information security (Pマーク, ISMS).\n\n**When to use:** caller asks 'which certifications can a 50-person manufacturing 株式会社 in 大阪 apply for?' — pass `size='medium'` + `industry='製造業'`. Many 補助金 cite these 認定 as eligibility prerequisites — pair with `POST /v1/programs/prescreen` (`held_certifications=[...]`) to see which programs the certifications unlock.\n\n**Authority enum (`authority`):** 厚生労働省 / 経済産業省 / 内閣府 / 中小企業庁 / 自治体 / その他.", "operationId": "rest_search_certifications_v1_am_certifications_get", "parameters": [{"name": "query", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}], "title": "Query"}}, {"name": "authority", "in": "query", "required": false, "schema": {"anyOf": [{"enum": ["経済産業省", "日本健康会議", "厚生労働省", "内閣府", "都道府県", "市町村", "農林水産省", "国土交通省", "その他"], "type": "string"}, {"type": "null"}], "title": "Authority"}}, {"name": "size", "in": "query", "required": false, "schema": {"anyOf": [{"enum": ["sole", "small", "sme", "mid", "large"], "type": "string"}, {"type": "null"}], "title": "Size"}}, {"name": "industry", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 100}, {"type": "null"}], "title": "Industry"}}, {"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"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "AMSearchResponse — paginated certification entities.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AMSearchResponse"}, "example": {"total": 1, "limit": 20, "offset": 0, "results": [{"entity_id": "cert_kurumin_2026", "name": "くるみん認定 (子育てサポート企業)", "authority": "厚生労働省", "size_target": ["sme", "large"], "industry_target": ["all"], "issuance_basis": "次世代育成支援対策推進法", "validity_years": 2, "source_url": "https://www.mhlw.go.jp/general/seido/koyou/kurumin/"}]}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/open_programs": {"get": {"tags": ["autonomath"], "summary": "Rest List Open Programs", "description": "Currently-open (公募中) program rounds on a target date.", "operationId": "rest_list_open_programs_v1_am_open_programs_get", "parameters": [{"name": "on_date", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 10}, {"type": "null"}], "description": "ISO YYYY-MM-DD. Default = today.", "title": "On Date"}, "description": "ISO YYYY-MM-DD. Default = today."}, {"name": "region", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 100}, {"type": "null"}], "title": "Region"}}, {"name": "industry", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 100}, {"type": "null"}], "title": "Industry"}}, {"name": "size", "in": "query", "required": false, "schema": {"anyOf": [{"enum": ["sole", "small", "sme", "mid", "large"], "type": "string"}, {"type": "null"}], "title": "Size"}}, {"name": "natural_query", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 500}, {"type": "null"}], "title": "Natural Query"}}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 100, "minimum": 1, "default": 20, "title": "Limit"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AMOpenProgramsResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/enums/{enum_name}": {"get": {"tags": ["autonomath"], "summary": "Rest Enum Values", "description": "List canonical enum values + frequency for a given enum_name.", "operationId": "rest_enum_values_v1_am_enums__enum_name__get", "parameters": [{"name": "enum_name", "in": "path", "required": true, "schema": {"enum": ["authority", "tier", "industry", "funding_purpose", "target_type", "region", "tax_category", "program_kind", "loan_type", "event_type", "ministry", "certification_authority"], "type": "string", "title": "Enum Name"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AMEnumValuesResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/by_law": {"get": {"tags": ["autonomath"], "summary": "Rest Search By Law", "description": "Programs / tax rules / certifications linked to a specific law (fuzzy name match).", "operationId": "rest_search_by_law_v1_am_by_law_get", "parameters": [{"name": "law_name", "in": "query", "required": true, "schema": {"type": "string", "minLength": 1, "maxLength": 200, "title": "Law Name"}}, {"name": "article", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 40}, {"type": "null"}], "title": "Article"}}, {"name": "amendment_date", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 10}, {"type": "null"}], "title": "Amendment Date"}}, {"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"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AMByLawResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/active_at": {"get": {"tags": ["autonomath"], "summary": "Rest Active Programs At", "description": "Point-in-time snapshot: programs whose effective window covered a given date.", "operationId": "rest_active_programs_at_v1_am_active_at_get", "parameters": [{"name": "date", "in": "query", "required": true, "schema": {"type": "string", "minLength": 10, "maxLength": 10, "description": "ISO YYYY-MM-DD", "title": "Date"}, "description": "ISO YYYY-MM-DD"}, {"name": "region", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 100}, {"type": "null"}], "title": "Region"}}, {"name": "industry", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 100}, {"type": "null"}], "title": "Industry"}}, {"name": "size", "in": "query", "required": false, "schema": {"anyOf": [{"enum": ["sole", "small", "sme", "mid", "large"], "type": "string"}, {"type": "null"}], "title": "Size"}}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 100, "minimum": 1, "default": 20, "title": "Limit"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AMActiveAtResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/programs/active_v2": {"get": {"tags": ["autonomath"], "summary": "Rest Programs Active At V2", "description": "Three-axis active-at: effective window + application_open + application_close in one query.\n\nBacked by view `programs_active_at_v2`. Returns programs that:\n  - are effective on `as_of` (effective_from <= as_of < effective_until,\n    with `effective_from_source` provenance hint), AND\n  - have an application round whose open_date <= `application_open_by`\n    (when provided), AND\n  - have an application round whose close_date >= `application_close_by`\n    (when provided), AND\n  - match `prefecture` (when provided).\n\nCaveat: `am_amendment_snapshot` carries a uniform `eligibility_hash`\nacross all (v1, v2) pairs — the table is a point-in-time snapshot,\nnot a real time-series. The response carries `_lifecycle_caveat` (a\nstructured dict with `data_quality` / `rows_with_complete_temporal_data`\n/ `total_rows` / `note`) so callers do not infer per-version eligibility\ndrift. The same caveat is also emitted on `/v1/am/by_law` and\n`/v1/am/law_article` responses that surface amendment history.", "operationId": "rest_programs_active_at_v2_v1_am_programs_active_v2_get", "parameters": [{"name": "as_of", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "minLength": 10, "maxLength": 10}, {"type": "null"}], "description": "ISO YYYY-MM-DD. effective window pivot. Defaults to today (JST date as ISO).", "title": "As Of"}, "description": "ISO YYYY-MM-DD. effective window pivot. Defaults to today (JST date as ISO)."}, {"name": "application_open_by", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "minLength": 10, "maxLength": 10}, {"type": "null"}], "description": "Filter to rounds whose application_open_date <= this date.", "title": "Application Open By"}, "description": "Filter to rounds whose application_open_date <= this date."}, {"name": "application_close_by", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "minLength": 10, "maxLength": 10}, {"type": "null"}], "description": "Filter to rounds whose application_close_date >= this date (締切がこの日以降).", "title": "Application Close By"}, "description": "Filter to rounds whose application_close_date >= this date (締切がこの日以降)."}, {"name": "prefecture", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 20}, {"type": "null"}], "description": "Optional prefecture filter (e.g. '東京都').", "title": "Prefecture"}, "description": "Optional prefecture filter (e.g. '東京都')."}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 200, "minimum": 1, "default": 50, "title": "Limit"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/related/{program_id}": {"get": {"tags": ["autonomath"], "summary": "Rest Related Programs", "description": "Graph walk over am_relation (prerequisite / compatible / incompatible / replaces / amends / related / references_law etc.).", "operationId": "rest_related_programs_v1_am_related__program_id__get", "parameters": [{"name": "program_id", "in": "path", "required": true, "schema": {"type": "string", "title": "Program Id"}}, {"name": "relation_types", "in": "query", "required": false, "schema": {"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}], "description": "Filter edge types (prerequisite / compatible / incompatible / replaces / …).", "title": "Relation Types"}, "description": "Filter edge types (prerequisite / compatible / incompatible / replaces / …)."}, {"name": "depth", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 3, "minimum": 1, "default": 1, "title": "Depth"}}, {"name": "max_edges", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 500, "minimum": 1, "default": 100, "title": "Max Edges"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AMRelatedResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/acceptance_stats": {"get": {"tags": ["autonomath"], "summary": "Rest Search Acceptance Stats", "description": "採択率 / 採択事例 statistics from am_entities (supersedes cross-DB acceptance_stats_tool).", "operationId": "rest_search_acceptance_stats_v1_am_acceptance_stats_get", "parameters": [{"name": "program_name", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}], "title": "Program Name"}}, {"name": "year", "in": "query", "required": false, "schema": {"anyOf": [{"type": "integer", "maximum": 2099, "minimum": 1988}, {"type": "null"}], "title": "Year"}}, {"name": "region", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 100}, {"type": "null"}], "title": "Region"}}, {"name": "industry", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 100}, {"type": "null"}], "title": "Industry"}}, {"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"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AMSearchResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/intent": {"get": {"tags": ["autonomath"], "summary": "Rest Intent Of", "description": "Route a natural-language query to the best-fit tool + extracted slots (query_rewrite layer).", "operationId": "rest_intent_of_v1_am_intent_get", "parameters": [{"name": "query", "in": "query", "required": true, "schema": {"type": "string", "minLength": 1, "maxLength": 500, "title": "Query"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AMIntentResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/reason": {"get": {"tags": ["autonomath"], "summary": "Rest Reason Answer", "description": "Return a citation-backed narrative answer (source_url + snippet per claim).", "operationId": "rest_reason_answer_v1_am_reason_get", "parameters": [{"name": "query", "in": "query", "required": true, "schema": {"type": "string", "minLength": 1, "maxLength": 500, "title": "Query"}}, {"name": "persona", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 100}, {"type": "null"}], "title": "Persona"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AMReasonResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/tax_rule": {"get": {"tags": ["autonomath"], "summary": "Rest Get Tax Rule", "description": "Single tax measure lookup against am_tax_rule with root_law + rate + applicability window.\n\nEvery response carries a ``_disclaimer`` envelope key (税理士法 §52 fence).\nEven when a single measure matches, the row payload is information\nretrieval — root_law / rate / applicability window all derive from\npublic 国税庁・財務省 sources and require qualified 税理士 confirmation\nbefore any filing decision.", "operationId": "rest_get_tax_rule_v1_am_tax_rule_get", "parameters": [{"name": "measure_name_or_id", "in": "query", "required": true, "schema": {"type": "string", "minLength": 1, "maxLength": 200, "title": "Measure Name Or Id"}}, {"name": "rule_type", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 60}, {"type": "null"}], "title": "Rule Type"}}, {"name": "as_of", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 10}, {"type": "null"}], "description": "ISO YYYY-MM-DD (default today)", "title": "As Of"}, "description": "ISO YYYY-MM-DD (default today)"}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AMTaxRuleResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/gx_programs": {"get": {"tags": ["autonomath"], "summary": "Rest Search Gx Programs", "description": "GX / 脱炭素 / 再エネ / EV / ZEB-ZEH curated 補助金 programs.", "operationId": "rest_search_gx_programs_v1_am_gx_programs_get", "parameters": [{"name": "theme", "in": "query", "required": false, "schema": {"enum": ["ghg_reduction", "ev", "renewable", "zeb_zeh", "carbon_credit"], "type": "string", "default": "ghg_reduction", "title": "Theme"}}, {"name": "company_size", "in": "query", "required": false, "schema": {"anyOf": [{"enum": ["sme", "midsize", "large", "individual", "municipality", "farmer"], "type": "string"}, {"type": "null"}], "title": "Company Size"}}, {"name": "region", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 100}, {"type": "null"}], "title": "Region"}}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 100, "minimum": 1, "default": 20, "title": "Limit"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AMSimpleSearchResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/loans": {"get": {"tags": ["autonomath"], "summary": "Search loan products (公庫 / 商工中金 / 自治体制度融資) with 3-axis risk filter", "description": "Loan-product search backed by `am_loan_product` (autonomath.db) covering 日本政策金融公庫 (JFC), 商工組合中央金庫, and 自治体制度融資 (prefecture / municipal credit guarantee programs). Filter independently along three risk axes:\n\n- `no_collateral=true` → 物的担保 not required\n- `no_personal_guarantor=true` → 代表者保証 / 経営者保証 not required\n- `no_third_party_guarantor=true` → 第三者保証 not required\n\nFree-text search via `name_query` (3+ char minimum). Lender narrowing via `lender_entity_id`. Amount band via `min_amount_yen` / `max_amount_yen` (in YEN, not 万円).\n\n**Note:** there is also `GET /v1/loan-programs/search` against the legacy `loan_programs` table (108 rows, jpintel.db). The `/v1/am/loans` route returns the unified autonomath view with richer entity provenance. Prefer this for new integrations.", "operationId": "rest_search_loans_v1_am_loans_get", "parameters": [{"name": "loan_kind", "in": "query", "required": false, "schema": {"anyOf": [{"enum": ["ippan", "trou", "seirei", "sanko", "sogyo", "rinsei", "saigai", "shingiseikyu", "kiki", "other"], "type": "string"}, {"type": "null"}], "title": "Loan Kind"}}, {"name": "no_collateral", "in": "query", "required": false, "schema": {"type": "boolean", "default": false, "title": "No Collateral"}}, {"name": "no_personal_guarantor", "in": "query", "required": false, "schema": {"type": "boolean", "default": false, "title": "No Personal Guarantor"}}, {"name": "no_third_party_guarantor", "in": "query", "required": false, "schema": {"type": "boolean", "default": false, "title": "No Third Party Guarantor"}}, {"name": "max_amount_yen", "in": "query", "required": false, "schema": {"anyOf": [{"type": "integer", "minimum": 0}, {"type": "null"}], "title": "Max Amount Yen"}}, {"name": "min_amount_yen", "in": "query", "required": false, "schema": {"anyOf": [{"type": "integer", "minimum": 0}, {"type": "null"}], "title": "Min Amount Yen"}}, {"name": "lender_entity_id", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 100}, {"type": "null"}], "title": "Lender Entity Id"}}, {"name": "name_query", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}], "title": "Name Query"}}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 100, "minimum": 1, "default": 10, "title": "Limit"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "AMLoanSearchResponse — ranked loan products.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AMLoanSearchResponse"}, "example": {"total": 1, "limit": 10, "results": [{"entity_id": "loan_jfc_kokumin_shinki_kaigyou", "name": "新規開業・スタートアップ支援資金", "lender": "日本政策金融公庫 国民生活事業", "loan_kind": "special_rate", "amount_max_yen": 72000000, "loan_period_years_max": 20, "interest_rate_annual": 0.041, "collateral_required": "negotiable", "personal_guarantor_required": "negotiable", "third_party_guarantor_required": "negotiable", "source_url": "https://www.jfc.go.jp/n/finance/search/01_sinkikaigyou_m.html"}]}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/enforcement": {"get": {"tags": ["autonomath"], "summary": "Check 行政処分 / 排除期間 status for a 法人番号 or 事業者名", "description": "Compliance / DD lookup: is this entity currently barred from 補助金 / 助成金 receipt under 補助金等適正化法 §17 / 入札参加資格 停止 / その他 行政処分? Query by 13-digit `houjin_bangou` (preferred — exact match) or `target_name` (LIKE match against the published 対象事業者名). Pass `as_of_date='YYYY-MM-DD'` to check status as of a historical date — 排除期間 windows are time-bounded so 'today' vs '2024-06-01' can give different verdicts.\n\n**Backed by:** 1,185 行政処分 cases (会計検査院 + ministry 公表) + `am_enforcement_detail` (22,258 rows; grant_refund / subsidy_exclude / fine breakdown).\n\n**Use this BEFORE awarding subsidies, before extending credit, before contracting with a vendor.** A clear-status response (`is_currently_barred=false`) lists past closed cases for reference; an active match returns the disclosed_until (排除期間 終了日) so the caller can plan timing.", "operationId": "rest_check_enforcement_v1_am_enforcement_get", "parameters": [{"name": "houjin_bangou", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 20}, {"type": "null"}], "title": "Houjin Bangou"}}, {"name": "target_name", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}], "title": "Target Name"}}, {"name": "as_of_date", "in": "query", "required": false, "schema": {"type": "string", "maxLength": 10, "default": "today", "title": "As Of Date"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Enforcement status snapshot at `as_of_date`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AMEnforcementCheckResponse"}, "example": {"houjin_bangou": "1234567890123", "as_of_date": "2026-04-29", "is_currently_barred": false, "active_cases": [], "past_cases": [{"case_id": "jbaudit_r03_2021-r03-0046-0_1", "event_type": "clawback", "ministry": "内閣府", "disclosed_date": "2022-11-07", "disclosed_until": "2027-11-06", "amount_improper_grant_yen": 89073000, "legal_basis": "補助金等に係る予算の執行の適正化に関する法律 第17条", "source_url": "https://report.jbaudit.go.jp/org/r03/2021-r03-0046-0.htm"}]}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/mutual_plans": {"get": {"tags": ["autonomath"], "summary": "Search mutual-aid / pension / workers' comp plans (共済 / 年金 / 労災)", "description": "Cross-search across Japanese mutual-aid (共済), corporate / personal pension (年金), and workers' compensation special-membership (労災特別加入) plans. Covers 小規模企業共済 (small-enterprise mutual aid), iDeCo+ (iDeCo with employer contributions), DB / DC corporate pensions, industry-specific pensions, and 労災特別加入 schemes for 代表者 / 一人親方.\n\nFilter by `plan_kind` (retirement_mutual / bankruptcy_mutual / dc_pension / db_pension / industry_pension / welfare_insurance / health_insurance / other), `premium_monthly_yen` ceiling, `tax_deduction_type` (small_enterprise_deduction / idekodc / group_retirement / corp_expense / none), or `provider_entity_id`.\n\n(共済 / 年金 / 労災 cross-search: 小規模企業共済 / iDeCo+ / DB / DC / 労災特別加入 等を横断検索.)", "operationId": "rest_search_mutual_plans_v1_am_mutual_plans_get", "parameters": [{"name": "plan_kind", "in": "query", "required": false, "schema": {"anyOf": [{"enum": ["retirement_mutual", "bankruptcy_mutual", "dc_pension", "db_pension", "industry_pension", "welfare_insurance", "health_insurance", "other"], "type": "string"}, {"type": "null"}], "title": "Plan Kind"}}, {"name": "premium_monthly_yen", "in": "query", "required": false, "schema": {"anyOf": [{"type": "integer", "minimum": 0}, {"type": "null"}], "title": "Premium Monthly Yen"}}, {"name": "tax_deduction_type", "in": "query", "required": false, "schema": {"anyOf": [{"enum": ["small_enterprise_deduction", "idekodc", "group_retirement", "corp_expense", "none"], "type": "string"}, {"type": "null"}], "title": "Tax Deduction Type"}}, {"name": "provider_entity_id", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 100}, {"type": "null"}], "title": "Provider Entity Id"}}, {"name": "name_query", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}], "title": "Name Query"}}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 100, "minimum": 1, "default": 10, "title": "Limit"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AMLoanSearchResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/law_article": {"get": {"tags": ["autonomath"], "summary": "Rest Get Law Article", "description": "Exact 条文 lookup: '租税特別措置法' + '41の19' → full article text + amendment history.", "operationId": "rest_get_law_article_v1_am_law_article_get", "parameters": [{"name": "law_name_or_canonical_id", "in": "query", "required": true, "schema": {"type": "string", "minLength": 1, "maxLength": 200, "title": "Law Name Or Canonical Id"}}, {"name": "article_number", "in": "query", "required": true, "schema": {"type": "string", "minLength": 1, "maxLength": 40, "title": "Article Number"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AMLawArticleResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/annotations/{entity_id}": {"get": {"tags": ["autonomath"], "summary": "Rest Get Annotations", "description": "am_entity_annotation 逆引き — examiner feedback / quality score / ML 推論 等を 1 コール (16,474 行).", "operationId": "rest_get_annotations_v1_am_annotations__entity_id__get", "parameters": [{"name": "entity_id", "in": "path", "required": true, "schema": {"type": "string", "minLength": 1, "maxLength": 200, "description": "am_entities.canonical_id (TEXT)", "title": "Entity Id"}, "description": "am_entities.canonical_id (TEXT)"}, {"name": "kinds", "in": "query", "required": false, "schema": {"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}], "description": "Filter on annotation kind (examiner_warning / examiner_correction / quality_score / validation_failure / ml_inference / manual_note). Repeat the param to OR-combine.", "title": "Kinds"}, "description": "Filter on annotation kind (examiner_warning / examiner_correction / quality_score / validation_failure / ml_inference / manual_note). Repeat the param to OR-combine."}, {"name": "include_internal", "in": "query", "required": false, "schema": {"type": "boolean", "description": "Include visibility='internal' rows (default False = public only). 'private' is never returned.", "default": false, "title": "Include Internal"}, "description": "Include visibility='internal' rows (default False = public only). 'private' is never returned."}, {"name": "include_superseded", "in": "query", "required": false, "schema": {"type": "boolean", "description": "Include superseded / expired annotations (default False = currently-live only).", "default": false, "title": "Include Superseded"}, "description": "Include superseded / expired annotations (default False = currently-live only)."}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 500, "minimum": 1, "default": 50, "title": "Limit"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AMAnnotationsResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/validate": {"post": {"tags": ["autonomath"], "summary": "Rest Validate", "description": "汎用 intake 検証 — am_validation_rule の active 述語を applicant_data に対して評価し\nrule 単位の passed/failed/deferred を返す (deferred = jpintel 内で評価できない外部依存述語).", "operationId": "rest_validate_v1_am_validate_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Body_rest_validate_v1_am_validate_post"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AMValidateResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/provenance/{entity_id}": {"get": {"tags": ["autonomath"], "summary": "Rest Get Provenance", "description": "am_entity_source × am_source 一括返却 — 出典 URL / license / role / fetched_at + license_summary を 1 コール (migration 049, 99.17% license filled).", "operationId": "rest_get_provenance_v1_am_provenance__entity_id__get", "parameters": [{"name": "entity_id", "in": "path", "required": true, "schema": {"type": "string", "minLength": 1, "maxLength": 200, "description": "am_entities.canonical_id (TEXT)", "title": "Entity Id"}, "description": "am_entities.canonical_id (TEXT)"}, {"name": "include_facts", "in": "query", "required": false, "schema": {"type": "boolean", "description": "If True, also return per-fact provenance via am_entity_facts.source_id (NULL on legacy rows pre-2026-04-25 — those facts are skipped). Default False = entity-level sources only.", "default": false, "title": "Include Facts"}, "description": "If True, also return per-fact provenance via am_entity_facts.source_id (NULL on legacy rows pre-2026-04-25 — those facts are skipped). Default False = entity-level sources only."}, {"name": "fact_limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 1000, "minimum": 1, "description": "Max facts when include_facts=True (default 200).", "default": 200, "title": "Fact Limit"}, "description": "Max facts when include_facts=True (default 200)."}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AMProvenanceResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/provenance/fact/{fact_id}": {"get": {"tags": ["autonomath"], "summary": "Rest Get Provenance For Fact", "description": "am_entity_facts.source_id → am_source 1 件 (NULL なら entity-level am_entity_source の候補 list に fallback).", "operationId": "rest_get_provenance_for_fact_v1_am_provenance_fact__fact_id__get", "parameters": [{"name": "fact_id", "in": "path", "required": true, "schema": {"type": "integer", "minimum": 1, "description": "am_entity_facts.id (INTEGER PK)", "title": "Fact Id"}, "description": "am_entity_facts.id (INTEGER PK)"}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/AMProvenanceResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/static": {"get": {"tags": ["autonomath"], "summary": "Rest List Static Resources", "description": "List 8 curated AutonoMath taxonomies (seido / glossary / money_types / obligations / dealbreakers / sector_combos / crop_library / exclusion_rules).", "operationId": "rest_list_static_resources_v1_am_static_get", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/StaticResourceList"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/static/{resource_id}": {"get": {"tags": ["autonomath"], "summary": "Rest Get Static Resource", "description": "Load one taxonomy/lookup file. Returns full JSON content + license.", "operationId": "rest_get_static_resource_v1_am_static__resource_id__get", "parameters": [{"name": "resource_id", "in": "path", "required": true, "schema": {"type": "string", "minLength": 1, "maxLength": 64, "description": "Resource id; see /v1/am/static for the catalog.", "title": "Resource Id"}, "description": "Resource id; see /v1/am/static for the catalog."}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/StaticResourceDetail"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/example_profiles": {"get": {"tags": ["autonomath"], "summary": "Rest List Example Profiles", "description": "List 5 canonical client-intake example payloads (PII-clean).", "operationId": "rest_list_example_profiles_v1_am_example_profiles_get", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ExampleProfileList"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/example_profiles/{profile_id}": {"get": {"tags": ["autonomath"], "summary": "Rest Get Example Profile", "description": "Return one canonical client profile JSON as a complete-payload example.", "operationId": "rest_get_example_profile_v1_am_example_profiles__profile_id__get", "parameters": [{"name": "profile_id", "in": "path", "required": true, "schema": {"type": "string", "minLength": 1, "maxLength": 64, "description": "Profile id; see /v1/am/example_profiles.", "title": "Profile Id"}, "description": "Profile id; see /v1/am/example_profiles."}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ExampleProfileDetail"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/pack_construction": {"get": {"tags": ["autonomath"], "summary": "Rest Pack Construction", "description": "[INDUSTRY-PACK] 建設業 (JSIC D) cohort: top 10 programs + 5 saiketsu + 3 通達.", "operationId": "rest_pack_construction_v1_am_pack_construction_get", "parameters": [{"name": "prefecture", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 20}, {"type": "null"}], "title": "Prefecture"}}, {"name": "employee_count", "in": "query", "required": false, "schema": {"anyOf": [{"type": "integer", "minimum": 0}, {"type": "null"}], "title": "Employee Count"}}, {"name": "revenue_yen", "in": "query", "required": false, "schema": {"anyOf": [{"type": "integer", "minimum": 0}, {"type": "null"}], "title": "Revenue Yen"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/pack_manufacturing": {"get": {"tags": ["autonomath"], "summary": "Rest Pack Manufacturing", "description": "[INDUSTRY-PACK] 製造業 (JSIC E) cohort: top 10 programs + 5 saiketsu + 3 通達.", "operationId": "rest_pack_manufacturing_v1_am_pack_manufacturing_get", "parameters": [{"name": "prefecture", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 20}, {"type": "null"}], "title": "Prefecture"}}, {"name": "employee_count", "in": "query", "required": false, "schema": {"anyOf": [{"type": "integer", "minimum": 0}, {"type": "null"}], "title": "Employee Count"}}, {"name": "revenue_yen", "in": "query", "required": false, "schema": {"anyOf": [{"type": "integer", "minimum": 0}, {"type": "null"}], "title": "Revenue Yen"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/pack_real_estate": {"get": {"tags": ["autonomath"], "summary": "Rest Pack Real Estate", "description": "[INDUSTRY-PACK] 不動産業 (JSIC K) cohort: top 10 programs + 5 saiketsu + 3 通達.", "operationId": "rest_pack_real_estate_v1_am_pack_real_estate_get", "parameters": [{"name": "prefecture", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 20}, {"type": "null"}], "title": "Prefecture"}}, {"name": "employee_count", "in": "query", "required": false, "schema": {"anyOf": [{"type": "integer", "minimum": 0}, {"type": "null"}], "title": "Employee Count"}}, {"name": "revenue_yen", "in": "query", "required": false, "schema": {"anyOf": [{"type": "integer", "minimum": 0}, {"type": "null"}], "title": "Revenue Yen"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/dd_batch": {"post": {"tags": ["ma_dd"], "summary": "Batch DD over up to 200 法人 (¥3 per id, NDJSON when N>50)", "description": "Composes the existing dd_profile_am chain (corporate_entity + adoptions + enforcement + invoice + bids + amendment_recent) over a batch of 1..200 法人番号 in a single call.\n\n**Pricing**: ¥3 per houjin_bangou (per-id, NOT 1 ¥3/call). Cap enforced via `X-Cost-Cap-JPY` header AND/OR `max_cost_jpy` body field — the lower binds.\n\n**Response shape**:\n  - len ≤ 50 → application/json `{batch_size, profiles: [...], metered_yen, corpus_snapshot_id, _disclaimer, coverage_scope}`\n  - len > 50 → application/x-ndjson stream, one profile per line, terminated by a `{ \"_meta\": {...}, \"_disclaimer\": ..., \"coverage_scope\": ... }` envelope line.\n\n**§52 fence**: every response carries the 税理士法 §52 disclaimer and an explicit coverage_scope excluding 役員一覧 / 株主構成 / 経歴 / 反社 / 信用情報 (商業登記法 gray-zone; TDB primary). LLM agents MUST relay both verbatim.\n\n**Operator**: Bookyou株式会社 (適格請求書発行事業者番号 T8010001213708). Brand: 税務会計AI.", "operationId": "post_dd_batch_v1_am_dd_batch_post", "parameters": [{"name": "X-Cost-Cap-JPY", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Cost-Cap-Jpy"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/DdBatchRequest"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/group_graph": {"get": {"tags": ["ma_dd"], "summary": "2-hop 法人↔法人 part_of traversal (no shareholder data)", "description": "Walks `am_relation.part_of` edges where BOTH endpoints are `am_entities.record_kind='corporate_entity'` (filter applied in-query). Returns nodes + edges up to depth=2.\n\n**Excluded by design** (商業登記法 gray-zone, TDB primary):\n  - 役員一覧 / 株主構成 / 経歴 / 持株比率\n  - 反社チェック / 信用情報 / 帝国データバンク data\n\n**Pricing**: ¥3 per call (single houjin seed).", "operationId": "get_group_graph_v1_am_group_graph_get", "parameters": [{"name": "houjin_bangou", "in": "query", "required": true, "schema": {"type": "string", "minLength": 1, "maxLength": 64, "title": "Houjin Bangou"}}, {"name": "depth", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 2, "minimum": 1, "default": 2, "title": "Depth"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/am/dd_export": {"post": {"tags": ["ma_dd"], "summary": "Audit-bundle ZIP via signed R2 URL (¥3×N + ¥30 fixed fee)", "description": "Builds a ZIP containing one JSONL per houjin + cite_chain.json + sha256.manifest + manifest.json, uploads to R2, returns a signed URL with 24h TTL.\n\n**Pricing**: ¥3 per houjin_bangou + ¥30 fixed bundle fee. THIS IS THE ONLY NON-¥3 SKU IN THE ENTIRE SYSTEM — the ¥30 covers R2 storage + sha256 manifest compute + signed URL lifecycle. Documented explicitly in docs/pricing.md.\n\n**§52 fence**: response carries the 税理士法 §52 disclaimer + coverage_scope. The bundle README + manifest.json mirror the fence inside the ZIP.", "operationId": "post_dd_export_v1_am_dd_export_post", "parameters": [{"name": "X-Cost-Cap-JPY", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Cost-Cap-Jpy"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/DdExportRequest"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/watches": {"post": {"tags": ["customer_watches"], "summary": "Register a real-time watch (houjin / program / law)", "description": "Creates a customer_watches row. Watch *registration* is FREE; delivery is ¥3 per HTTP 2xx via the existing customer_webhooks infrastructure (dispatcher cron: dispatch_watch_events.py).\n\nPer-key watch cap: 5,000. Re-registering an existing target is a no-op (returns the existing row).\n\nCustomer must ALSO register a webhook via /v1/me/webhooks before deliveries can fire. Watches without a matching webhook fan-out are silently dropped at dispatch time.", "operationId": "register_watch_v1_me_watches_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/WatchRegisterRequest"}}}}, "responses": {"201": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/WatchResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}, "get": {"tags": ["customer_watches"], "summary": "List the calling key's watches (active + disabled)", "operationId": "list_watches_v1_me_watches_get", "parameters": [{"name": "watch_kind", "in": "query", "required": false, "schema": {"anyOf": [{"enum": ["houjin", "program", "law"], "type": "string"}, {"type": "null"}], "title": "Watch Kind"}}, {"name": "status", "in": "query", "required": false, "schema": {"anyOf": [{"enum": ["active", "disabled"], "type": "string"}, {"type": "null"}], "title": "Status"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "array", "items": {"$ref": "#/components/schemas/WatchResponse"}, "title": "Response List Watches V1 Me Watches Get"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/me/watches/{watch_id}": {"delete": {"tags": ["customer_watches"], "summary": "Cancel a watch (soft delete; row stays for audit)", "operationId": "cancel_watch_v1_me_watches__watch_id__delete", "parameters": [{"name": "watch_id", "in": "path", "required": true, "schema": {"type": "integer", "title": "Watch Id"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "object", "additionalProperties": true, "title": "Response Cancel Watch V1 Me Watches  Watch Id  Delete"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/audit/workpaper": {"post": {"tags": ["audit (会計士・監査法人)"], "summary": "Render a per-client audit work-paper (PDF/CSV/MD/DOCX).", "description": "Generate a single-client audit work-paper for the audit cycle.\n\n**Bills**: ``len(target_ruleset_ids) × ¥3 + ¥30 export fee``.\n\n**§52 + 公認会計士法 §47条の2** — the artefact is **input material**, NOT a substitute for the auditor's opinion or working papers. The disclaimer is rendered on the cover page, every page footer, every CSV header line, and every JSON response.", "operationId": "render_workpaper_v1_audit_workpaper_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/WorkpaperRequest"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "400": {"description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "401": {"description": "Authentication required — `code='auth_required'`. Send `X-API-Key`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "404": {"description": "Not found — `code` ∈ {no_matching_records, seed_not_found, route_not_found}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "422": {"description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`).", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "429": {"description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "500": {"description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "503": {"description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}}}}, "/v1/audit/batch_evaluate": {"post": {"tags": ["audit (会計士・監査法人)"], "summary": "Evaluate ≤5,000 client profiles × ≤100 rulesets in one call.", "description": "Batch evaluation across an audit firm's client population. Bills ``len(profiles) × len(target_ruleset_ids) ÷ 10`` units (K=10 fan-out factor — see ``docs/compliance/audit_firm_economics.md``).\n\nReturns per-profile evaluation rows + ``anomalies[]`` highlighting rulesets where this profile's outcome deviates from the population mode (e.g. only this client is non-applicable for the 2割特例 across an otherwise homogeneous SMB book).\n\n**§52 + 公認会計士法 §47条の2** envelope on every row.", "operationId": "batch_evaluate_v1_audit_batch_evaluate_post", "parameters": [{"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/BatchEvaluateRequest"}}}}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "400": {"description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "401": {"description": "Authentication required — `code='auth_required'`. Send `X-API-Key`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "404": {"description": "Not found — `code` ∈ {no_matching_records, seed_not_found, route_not_found}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "422": {"description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`).", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "429": {"description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "500": {"description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "503": {"description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}}}}, "/v1/audit/cite_chain/{ruleset_id}": {"get": {"tags": ["audit (会計士・監査法人)"], "summary": "Auto-resolve the full citation chain for one tax_ruleset.", "description": "Returns a structured provenance graph: ruleset → 法令 article → 通達 → 質疑応答 → 文書回答. The auditor pastes the tree verbatim into the audit trail / 監査調書 索引.\n\n**Bills**: 1 unit (¥3) per call.\n\n**§52 + 公認会計士法 §47条の2** envelope on every response. Citations are pulled from public NTA / e-Gov / 裁判所 sources; Bookyou Inc. provides retrieval only — citing tax authorities is sensitive territory and the auditor remains responsible for verifying every cited document on the primary URL.", "operationId": "cite_chain_resolve_v1_audit_cite_chain__ruleset_id__get", "parameters": [{"name": "ruleset_id", "in": "path", "required": true, "schema": {"type": "string", "minLength": 14, "maxLength": 14, "description": "TAX-<10 lowercase hex> id. The chain is rooted at this ruleset and walks every reachable citation.", "title": "Ruleset Id"}}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "400": {"description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "401": {"description": "Authentication required — `code='auth_required'`. Send `X-API-Key`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "404": {"description": "Not found — `code` ∈ {no_matching_records, seed_not_found, route_not_found}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "422": {"description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`).", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "429": {"description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "500": {"description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "503": {"description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}}}}, "/v1/audit/snapshot_attestation": {"get": {"tags": ["audit (会計士・監査法人)"], "summary": "Year-end PDF: 印 + 法人番号 + 日次 corpus_snapshot_id ログ.", "description": "Year-end attestation PDF for the audit firm's working-paper retention obligation (公認会計士法 §47条の2). Covers every daily corpus_snapshot_id observed during the calendar year, plus the matching checksum. Fixed price ¥30,000 (NOT a metered tier; billed as 10,000 × ¥3 units).", "operationId": "snapshot_attestation_v1_audit_snapshot_attestation_get", "parameters": [{"name": "year", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 2099, "minimum": 2024, "description": "Calendar year (UTC). Defaults to current UTC year.", "default": 2026, "title": "Year"}, "description": "Calendar year (UTC). Defaults to current UTC year."}, {"name": "X-API-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Api-Key"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "400": {"description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "401": {"description": "Authentication required — `code='auth_required'`. Send `X-API-Key`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "404": {"description": "Not found — `code` ∈ {no_matching_records, seed_not_found, route_not_found}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "422": {"description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`).", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "429": {"description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "500": {"description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}, "503": {"description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}.", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ErrorEnvelope"}}}}}}}, "/v1/am/health/deep": {"get": {"tags": ["autonomath-health"], "summary": "Rest Deep Health", "description": "10-check aggregate health (db + freshness + license + provenance + bundle + WAL).\n\nUnbilled, unlogged, no anonymous-IP rate limit — heartbeat surface for\nuptime monitors. Returns ``status`` ∈ {ok, degraded, unhealthy}.\n\nResponses are cached for 30 seconds; pass ``?force=true`` to bypass for\ndebugging or post-deploy verification.", "operationId": "rest_deep_health_v1_am_health_deep_get", "parameters": [{"name": "force", "in": "query", "required": false, "schema": {"type": "boolean", "default": false, "title": "Force"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/DeepHealthResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/widget/search": {"get": {"tags": ["widget"], "summary": "Widget Search", "description": "Search programs restricted to the widget surface.\n\nProxies to the existing `/v1/programs/search` logic via direct function\nimport — there is no internal HTTP hop so the widget path stays under\nthe tight latency budget (TTFB matters on a 3rd-party's site).", "operationId": "widget_search_v1_widget_search_get", "parameters": [{"name": "key", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 64}, {"type": "null"}], "description": "widget key; wgt_live_...", "title": "Key"}, "description": "widget key; wgt_live_..."}, {"name": "q", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}], "title": "Q"}}, {"name": "prefecture", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 20}, {"type": "null"}], "title": "Prefecture"}}, {"name": "authority_level", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 20}, {"type": "null"}], "title": "Authority Level"}}, {"name": "industry", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 20}, {"type": "null"}], "title": "Industry"}}, {"name": "target", "in": "query", "required": false, "schema": {"anyOf": [{"type": "array", "items": {"type": "string"}, "maxItems": 64}, {"type": "null"}], "title": "Target"}}, {"name": "funding_purpose", "in": "query", "required": false, "schema": {"anyOf": [{"type": "array", "items": {"type": "string"}, "maxItems": 64}, {"type": "null"}], "title": "Funding Purpose"}}, {"name": "limit", "in": "query", "required": false, "schema": {"type": "integer", "maximum": 20, "minimum": 1, "default": 5, "title": "Limit"}}, {"name": "X-Widget-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Widget-Key"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/widget/enum_values": {"get": {"tags": ["widget"], "summary": "Widget Enum Values", "description": "Return filter enum vocab for widget dropdowns — prefectures, industries,\nauthority_levels, and a short target_types list drawn from programs.", "operationId": "widget_enum_values_v1_widget_enum_values_get", "parameters": [{"name": "key", "in": "query", "required": false, "schema": {"anyOf": [{"type": "string", "maxLength": 64}, {"type": "null"}], "title": "Key"}}, {"name": "X-Widget-Key", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "X-Widget-Key"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/widget/signup": {"post": {"tags": ["widget"], "summary": "Widget Signup", "description": "Create a Stripe Checkout session for the widget plan.\n\nThe actual `widget_keys` row is provisioned later, in the\n`checkout.session.completed` webhook handler. The Checkout session\ncarries `metadata.autonomath_product = 'widget'` so our webhook\nknows to look up widget-specific price ids and persist to widget_keys\n(not api_keys).", "operationId": "widget_signup_v1_widget_signup_post", "requestBody": {"content": {"application/json": {"schema": {"$ref": "#/components/schemas/WidgetSignupRequest"}}}, "required": true}, "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/WidgetSignupResponse"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/widget/stripe-webhook": {"post": {"tags": ["widget"], "summary": "Widget Stripe Webhook", "description": "Handle widget-product Stripe events.\n\nKey lifecycle events:\n  checkout.session.completed        -> provision widget_keys row\n  customer.subscription.deleted     -> disabled_at = now()\n  invoice.payment_failed            -> disabled_at = now() (widget is\n    not dunning-tolerant like the main API — a widget on a public\n    site stays disabled through dunning rather than billing overage\n    nobody will ever pay for).", "operationId": "widget_stripe_webhook_v1_widget_stripe_webhook_post", "parameters": [{"name": "stripe-signature", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Stripe-Signature"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {"type": "object", "additionalProperties": {"type": "string"}, "title": "Response Widget Stripe Webhook V1 Widget Stripe Webhook Post"}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/v1/widget/{key_id}/usage": {"get": {"tags": ["widget"], "summary": "Widget Usage", "description": "Owner-visible usage for their widget key. Bearer admin required.\n\nSparse on purpose: the dashboard consumes this via a scheduled fetch\nso we return stable, JSON-first fields. A full dashboard UI is a\nlater ticket — this stub is enough for \"how many reqs this month?\".", "operationId": "widget_usage_v1_widget__key_id__usage_get", "parameters": [{"name": "key_id", "in": "path", "required": true, "schema": {"type": "string", "title": "Key Id"}}, {"name": "authorization", "in": "header", "required": false, "schema": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authorization"}}], "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}, "422": {"description": "Validation Error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/HTTPValidationError"}}}}}}}, "/readyz": {"get": {"summary": "Readyz", "operationId": "readyz_readyz_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}}}}, "components": {"schemas": {"AMActiveAtResponse": {"properties": {"total": {"type": "integer", "title": "Total", "description": "Total candidate rows before paging."}, "limit": {"type": "integer", "title": "Limit", "description": "Page size echoed from the request."}, "offset": {"type": "integer", "title": "Offset", "description": "Page offset echoed from the request."}, "results": {"items": {"additionalProperties": true, "type": "object"}, "type": "array", "title": "Results"}, "meta": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Meta", "description": "Optional envelope: alternative_intents, retrieval_note, next_cursor, advisory hints. Wired by L5."}, "retrieval_note": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Retrieval Note", "description": "One-line provenance hint, e.g. 'fts5_trigram + LIKE fallback (3 rows from 285)'."}, "error": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Error", "description": "Set when the tool failed (DB unavailable / invalid input). When present, ``results`` is empty and the caller should surface the error message rather than render an empty list."}, "pivot_date": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Pivot Date"}}, "additionalProperties": true, "type": "object", "required": ["total", "limit", "offset"], "title": "AMActiveAtResponse", "description": "``GET /v1/am/active_at`` — paginated list with the snapshot date."}, "AMAnnotationsResponse": {"properties": {"total": {"type": "integer", "title": "Total", "description": "Total candidate rows before paging."}, "limit": {"type": "integer", "title": "Limit", "description": "Page size echoed from the request."}, "offset": {"type": "integer", "title": "Offset", "description": "Page offset echoed from the request."}, "results": {"items": {"additionalProperties": true, "type": "object"}, "type": "array", "title": "Results"}, "meta": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Meta", "description": "Optional envelope: alternative_intents, retrieval_note, next_cursor, advisory hints. Wired by L5."}, "retrieval_note": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Retrieval Note", "description": "One-line provenance hint, e.g. 'fts5_trigram + LIKE fallback (3 rows from 285)'."}, "error": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Error", "description": "Set when the tool failed (DB unavailable / invalid input). When present, ``results`` is empty and the caller should surface the error message rather than render an empty list."}, "entity_id": {"type": "string", "title": "Entity Id"}, "filters": {"additionalProperties": true, "type": "object", "title": "Filters"}}, "additionalProperties": true, "type": "object", "required": ["total", "limit", "offset", "entity_id"], "title": "AMAnnotationsResponse", "description": "``GET /v1/am/annotations/{entity_id}`` — examiner / quality / ML notes."}, "AMByLawResponse": {"properties": {"total": {"type": "integer", "title": "Total", "description": "Total candidate rows before paging."}, "limit": {"type": "integer", "title": "Limit", "description": "Page size echoed from the request."}, "offset": {"type": "integer", "title": "Offset", "description": "Page offset echoed from the request."}, "results": {"items": {"additionalProperties": true, "type": "object"}, "type": "array", "title": "Results"}, "meta": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Meta", "description": "Optional envelope: alternative_intents, retrieval_note, next_cursor, advisory hints. Wired by L5."}, "retrieval_note": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Retrieval Note", "description": "One-line provenance hint, e.g. 'fts5_trigram + LIKE fallback (3 rows from 285)'."}, "error": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Error", "description": "Set when the tool failed (DB unavailable / invalid input). When present, ``results`` is empty and the caller should surface the error message rather than render an empty list."}, "law_aliases_tried": {"items": {"type": "string"}, "type": "array", "title": "Law Aliases Tried", "description": "Fuzzy-match alias attempts tried before settling on a hit."}}, "additionalProperties": true, "type": "object", "required": ["total", "limit", "offset"], "title": "AMByLawResponse", "description": "``GET /v1/am/by_law`` — adds the alias-resolution debug field."}, "AMEnforcementCheckResponse": {"properties": {"queried": {"additionalProperties": true, "type": "object", "title": "Queried"}, "found": {"type": "boolean", "title": "Found", "default": false}, "currently_excluded": {"type": "boolean", "title": "Currently Excluded", "default": false}, "active_exclusions": {"items": {"additionalProperties": true, "type": "object"}, "type": "array", "title": "Active Exclusions"}, "recent_history": {"items": {"additionalProperties": true, "type": "object"}, "type": "array", "title": "Recent History"}, "all_count": {"type": "integer", "title": "All Count", "default": 0}, "error": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Error"}}, "additionalProperties": true, "type": "object", "title": "AMEnforcementCheckResponse", "description": "``GET /v1/am/enforcement`` — 排除期間チェック result."}, "AMEnumValuesResponse": {"properties": {"enum_name": {"type": "string", "title": "Enum Name"}, "values": {"items": {"type": "string"}, "type": "array", "title": "Values"}, "frequency_map": {"additionalProperties": {"type": "integer"}, "type": "object", "title": "Frequency Map"}, "last_updated": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Last Updated"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "error": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Error"}}, "additionalProperties": true, "type": "object", "required": ["enum_name"], "title": "AMEnumValuesResponse", "description": "``GET /v1/am/enums/{enum_name}`` — distinct values + counts for an enum."}, "AMIntentResponse": {"properties": {"intent_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Intent Id"}, "intent_name_ja": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Intent Name Ja"}, "confidence": {"anyOf": [{"type": "number"}, {"type": "null"}], "title": "Confidence"}, "all_scores": {"items": {"additionalProperties": true, "type": "object"}, "type": "array", "title": "All Scores"}, "sample_queries": {"items": {"type": "string"}, "type": "array", "title": "Sample Queries"}, "error": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Error"}}, "additionalProperties": true, "type": "object", "title": "AMIntentResponse", "description": "``GET /v1/am/intent`` — natural-language → tool routing."}, "AMLawArticleResponse": {"properties": {"found": {"type": "boolean", "title": "Found", "default": false}, "law": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Law"}, "article_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Article Id"}, "article_number": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Article Number"}, "article_number_sort": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Article Number Sort"}, "title": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Title"}, "text_summary": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Text Summary"}, "text_full": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Text Full"}, "effective_from": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Effective From"}, "effective_until": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Effective Until"}, "last_amended": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Last Amended"}, "source_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Url"}, "source_fetched_at": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Fetched At"}, "error": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Error"}}, "additionalProperties": true, "type": "object", "title": "AMLawArticleResponse", "description": "``GET /v1/am/law_article`` — 条文 lookup."}, "AMLoanSearchResponse": {"properties": {"total": {"type": "integer", "title": "Total", "default": 0}, "limit": {"type": "integer", "title": "Limit", "default": 10}, "offset": {"type": "integer", "title": "Offset", "default": 0}, "result_count": {"type": "integer", "title": "Result Count", "default": 0}, "results": {"items": {"additionalProperties": true, "type": "object"}, "type": "array", "title": "Results"}, "error": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Error"}}, "additionalProperties": true, "type": "object", "title": "AMLoanSearchResponse", "description": "``GET /v1/am/loans`` / ``mutual_plans`` — three-axis loan/共済 search."}, "AMOpenProgramsResponse": {"properties": {"total": {"type": "integer", "title": "Total", "description": "Total candidate rows before paging."}, "limit": {"type": "integer", "title": "Limit", "description": "Page size echoed from the request."}, "offset": {"type": "integer", "title": "Offset", "description": "Page offset echoed from the request."}, "results": {"items": {"additionalProperties": true, "type": "object"}, "type": "array", "title": "Results"}, "meta": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Meta", "description": "Optional envelope: alternative_intents, retrieval_note, next_cursor, advisory hints. Wired by L5."}, "retrieval_note": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Retrieval Note", "description": "One-line provenance hint, e.g. 'fts5_trigram + LIKE fallback (3 rows from 285)'."}, "error": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Error", "description": "Set when the tool failed (DB unavailable / invalid input). When present, ``results`` is empty and the caller should surface the error message rather than render an empty list."}, "pivot_date": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Pivot Date", "description": "ISO YYYY-MM-DD of the snapshot date."}}, "additionalProperties": true, "type": "object", "required": ["total", "limit", "offset"], "title": "AMOpenProgramsResponse", "description": "``GET /v1/am/open_programs`` — adds ``pivot_date`` (the date the snapshot\nwas taken on, defaulting to today)."}, "AMProvenanceResponse": {"properties": {"total": {"type": "integer", "title": "Total", "description": "Total candidate rows before paging."}, "limit": {"type": "integer", "title": "Limit", "description": "Page size echoed from the request."}, "offset": {"type": "integer", "title": "Offset", "description": "Page offset echoed from the request."}, "results": {"items": {"additionalProperties": true, "type": "object"}, "type": "array", "title": "Results"}, "meta": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Meta", "description": "Optional envelope: alternative_intents, retrieval_note, next_cursor, advisory hints. Wired by L5."}, "retrieval_note": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Retrieval Note", "description": "One-line provenance hint, e.g. 'fts5_trigram + LIKE fallback (3 rows from 285)'."}, "error": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Error", "description": "Set when the tool failed (DB unavailable / invalid input). When present, ``results`` is empty and the caller should surface the error message rather than render an empty list."}}, "additionalProperties": true, "type": "object", "required": ["total", "limit", "offset"], "title": "AMProvenanceResponse", "description": "``GET /v1/am/provenance/{entity_id}`` and the per-fact variant."}, "AMReasonResponse": {"properties": {"intent": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Intent"}, "intent_name_ja": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Intent Name Ja"}, "filters_extracted": {"additionalProperties": true, "type": "object", "title": "Filters Extracted"}, "answer_skeleton": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Answer Skeleton"}, "confidence": {"anyOf": [{"type": "number"}, {"type": "null"}], "title": "Confidence"}, "missing_data": {"items": {"type": "string"}, "type": "array", "title": "Missing Data"}, "precompute_gaps": {"items": {"type": "string"}, "type": "array", "title": "Precompute Gaps"}, "source_urls": {"items": {"type": "string"}, "type": "array", "title": "Source Urls"}, "db_bind_ok": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Db Bind Ok"}, "db_bind_notes": {"anyOf": [{"items": {"type": "string"}, "type": "array"}, {"type": "string"}, {"type": "null"}], "title": "Db Bind Notes"}, "persona_hint": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Persona Hint"}, "retry_with": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Retry With"}, "error": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Error"}}, "additionalProperties": true, "type": "object", "title": "AMReasonResponse", "description": "``GET /v1/am/reason`` — citation-backed narrative answer."}, "AMRelatedResponse": {"properties": {"seed_id": {"type": "string", "title": "Seed Id"}, "seed_kind": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Seed Kind"}, "relations": {"items": {"additionalProperties": true, "type": "object"}, "type": "array", "title": "Relations"}, "nodes": {"items": {"additionalProperties": true, "type": "object"}, "type": "array", "title": "Nodes"}, "total_edges": {"type": "integer", "title": "Total Edges", "default": 0}, "depth": {"type": "integer", "title": "Depth", "default": 1}, "hint": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Hint"}, "retry_with": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Retry With"}, "error": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Error"}}, "additionalProperties": true, "type": "object", "required": ["seed_id"], "title": "AMRelatedResponse", "description": "``GET /v1/am/related/{program_id}`` — graph walk over am_relation."}, "AMSearchResponse": {"properties": {"total": {"type": "integer", "title": "Total", "description": "Total candidate rows before paging."}, "limit": {"type": "integer", "title": "Limit", "description": "Page size echoed from the request."}, "offset": {"type": "integer", "title": "Offset", "description": "Page offset echoed from the request."}, "results": {"items": {"additionalProperties": true, "type": "object"}, "type": "array", "title": "Results"}, "meta": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Meta", "description": "Optional envelope: alternative_intents, retrieval_note, next_cursor, advisory hints. Wired by L5."}, "retrieval_note": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Retrieval Note", "description": "One-line provenance hint, e.g. 'fts5_trigram + LIKE fallback (3 rows from 285)'."}, "error": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Error", "description": "Set when the tool failed (DB unavailable / invalid input). When present, ``results`` is empty and the caller should surface the error message rather than render an empty list."}}, "additionalProperties": true, "type": "object", "required": ["total", "limit", "offset"], "title": "AMSearchResponse", "description": "Concrete `SearchResponse[Any]` used by ``/v1/am/*`` paginated tools.\n\nThe underlying ``am_entities`` table is heterogeneous (12 record_kinds:\nprogram / tax_measure / certification / loan / adoption / …), so the\nrow contract is left at ``dict`` rather than enumerated. The pagination\n+ meta + error contract — which is what an agent needs to drive a loop\n— is fully typed."}, "AMSimpleSearchResponse": {"properties": {"total": {"type": "integer", "title": "Total", "default": 0}, "results": {"items": {"additionalProperties": true, "type": "object"}, "type": "array", "title": "Results"}, "error": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Error"}}, "additionalProperties": true, "type": "object", "title": "AMSimpleSearchResponse", "description": "Lighter SearchResponse variant for tools that omit ``offset``.\n\nUsed by ``search_gx_programs_am`` and the like that return ``{total,\nresults}`` only. Listed separately so the OpenAPI schema is honest —\nwe don't claim ``offset`` when the underlying tool doesn't ship it."}, "AMTaxRuleResponse": {"properties": {"total": {"type": "integer", "title": "Total", "default": 0}, "results": {"items": {"additionalProperties": true, "type": "object"}, "type": "array", "title": "Results"}, "error": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Error"}}, "additionalProperties": true, "type": "object", "title": "AMTaxRuleResponse", "description": "``GET /v1/am/tax_rule`` — single-measure tax rule lookup."}, "AMValidateResponse": {"properties": {"total": {"type": "integer", "title": "Total", "default": 0}, "applicant_hash": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Applicant Hash"}, "scope": {"type": "string", "title": "Scope", "default": "intake"}, "entity_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Entity Id"}, "summary": {"additionalProperties": true, "type": "object", "title": "Summary"}, "results": {"items": {"additionalProperties": true, "type": "object"}, "type": "array", "title": "Results"}, "error": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Error"}}, "additionalProperties": true, "type": "object", "title": "AMValidateResponse", "description": "``POST /v1/am/validate`` — generic intake validator output."}, "AdvisorDashboardReferral": {"properties": {"id": {"type": "integer", "title": "Id"}, "token_prefix": {"type": "string", "title": "Token Prefix"}, "source_program_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Program Id"}, "clicked_at": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Clicked At"}, "converted_at": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Converted At"}, "conversion_value_yen": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Conversion Value Yen"}, "commission_yen": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Commission Yen"}, "commission_paid_at": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Commission Paid At"}}, "additionalProperties": true, "type": "object", "required": ["id", "token_prefix"], "title": "AdvisorDashboardReferral"}, "AdvisorDashboardResponse": {"properties": {"advisor": {"additionalProperties": true, "type": "object", "title": "Advisor"}, "summary": {"$ref": "#/components/schemas/AdvisorDashboardSummary"}, "referrals": {"items": {"$ref": "#/components/schemas/AdvisorDashboardReferral"}, "type": "array", "title": "Referrals"}}, "additionalProperties": true, "type": "object", "required": ["advisor", "summary"], "title": "AdvisorDashboardResponse"}, "AdvisorDashboardSummary": {"properties": {"clicks": {"type": "integer", "title": "Clicks", "default": 0}, "conversions": {"type": "integer", "title": "Conversions", "default": 0}, "unpaid_yen": {"type": "integer", "title": "Unpaid Yen", "default": 0}, "paid_yen": {"type": "integer", "title": "Paid Yen", "default": 0}}, "additionalProperties": true, "type": "object", "title": "AdvisorDashboardSummary"}, "AdvisorOut": {"properties": {"id": {"type": "integer", "title": "Id"}, "firm_name": {"type": "string", "title": "Firm Name"}, "firm_name_kana": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Firm Name Kana"}, "firm_type": {"type": "string", "enum": ["税理士法人", "認定支援機関", "社会保険労務士", "中小企業診断士", "行政書士", "弁護士", "銀行", "商工会議所", "その他"], "title": "Firm Type"}, "specialties": {"items": {"type": "string"}, "type": "array", "title": "Specialties"}, "industries": {"anyOf": [{"items": {"type": "string"}, "type": "array"}, {"type": "null"}], "title": "Industries"}, "prefecture": {"type": "string", "title": "Prefecture"}, "city": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "City"}, "address": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Address"}, "contact_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Contact Url"}, "contact_email": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Contact Email"}, "contact_phone": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Contact Phone"}, "intro_blurb": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Intro Blurb"}, "success_count": {"type": "integer", "title": "Success Count", "default": 0}, "commission_model": {"type": "string", "enum": ["flat", "percent"], "title": "Commission Model", "default": "flat"}, "commission_yen_per_intro": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Commission Yen Per Intro", "default": 3000}, "commission_rate_pct": {"type": "integer", "title": "Commission Rate Pct", "default": 5}, "verified_at": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Verified At"}}, "additionalProperties": false, "type": "object", "required": ["id", "firm_name", "firm_type", "specialties", "prefecture"], "title": "AdvisorOut", "description": "Public-facing advisor row. Excludes internal-only columns\n(stripe_connect_account_id, disabled_reason, raw success_count math)."}, "AttributionBlock": {"properties": {"source": {"type": "string", "title": "Source"}, "source_url": {"type": "string", "title": "Source Url"}, "license": {"type": "string", "title": "License"}, "edited": {"type": "boolean", "title": "Edited"}, "notice": {"type": "string", "title": "Notice"}}, "additionalProperties": false, "type": "object", "required": ["source", "source_url", "license", "edited", "notice"], "title": "AttributionBlock", "description": "PDL v1.0 attribution (出典明記 + 編集・加工注記)."}, "AuthorizeRequest": {"properties": {"client_id": {"type": "string", "title": "Client Id", "default": "autonomath-mcp"}, "scope": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Scope", "description": "Space-delimited scopes. Defaults to 'api:read api:metered'.", "default": "api:read api:metered"}}, "type": "object", "title": "AuthorizeRequest"}, "AuthorizeResponse": {"properties": {"device_code": {"type": "string", "title": "Device Code"}, "user_code": {"type": "string", "title": "User Code"}, "verification_uri": {"type": "string", "title": "Verification Uri"}, "verification_uri_complete": {"type": "string", "title": "Verification Uri Complete"}, "expires_in": {"type": "integer", "title": "Expires In"}, "interval": {"type": "integer", "title": "Interval"}}, "type": "object", "required": ["device_code", "user_code", "verification_uri", "verification_uri_complete", "expires_in", "interval"], "title": "AuthorizeResponse"}, "BatchEvaluateRequest": {"properties": {"audit_firm_id": {"type": "string", "maxLength": 128, "minLength": 1, "title": "Audit Firm Id", "description": "Audit firm's own identifier (echoed back; reporting convenience). ASCII ≤128 chars. NOT used for auth — auth is the X-API-Key on the request."}, "profiles": {"items": {"$ref": "#/components/schemas/BatchProfileItem"}, "type": "array", "maxItems": 5000, "minItems": 1, "title": "Profiles", "description": "Per-client business profiles. Cap: 5,000. Order preserved in results."}, "target_ruleset_ids": {"items": {"type": "string"}, "type": "array", "maxItems": 100, "minItems": 1, "title": "Target Ruleset Ids", "description": "TAX-<10hex> ids to evaluate against EVERY profile. Cap: 100."}}, "additionalProperties": false, "type": "object", "required": ["audit_firm_id", "profiles", "target_ruleset_ids"], "title": "BatchEvaluateRequest", "description": "POST /v1/audit/batch_evaluate input."}, "BatchGetProgramsRequest": {"properties": {"unified_ids": {"items": {"type": "string"}, "type": "array", "maxItems": 50, "minItems": 1, "title": "Unified Ids"}}, "type": "object", "required": ["unified_ids"], "title": "BatchGetProgramsRequest", "description": "Body for POST /v1/programs/batch.\n\n`unified_ids` is capped at 50 — the 50-cap IS the pagination. Callers\nwith more ids page the request themselves (request.py: chunk(ids, 50)).\nThe cap lives here (pydantic) AND is also enforced inside the handler;\nexceeding it surfaces as HTTP 422 per the usual FastAPI validation path."}, "BatchGetProgramsResponse": {"properties": {"results": {"items": {"$ref": "#/components/schemas/ProgramDetail"}, "type": "array", "title": "Results"}, "not_found": {"items": {"type": "string"}, "type": "array", "title": "Not Found"}}, "type": "object", "required": ["results", "not_found"], "title": "BatchGetProgramsResponse", "description": "Response for POST /v1/programs/batch.\n\n`results[]` is in the same order as the deduped input `unified_ids`.\nMissing ids go to `not_found` (NOT a 404 — partial success is the point\nof batch-fetch). Use `not_found` length == 0 as the \"everything resolved\"\nsignal."}, "BatchProfileItem": {"properties": {"client_id": {"type": "string", "maxLength": 128, "minLength": 1, "title": "Client Id"}, "profile": {"additionalProperties": true, "type": "object", "title": "Profile"}}, "additionalProperties": false, "type": "object", "required": ["client_id", "profile"], "title": "BatchProfileItem"}, "BidOut": {"properties": {"unified_id": {"type": "string", "title": "Unified Id", "description": "BID-<10 lowercase hex>"}, "bid_title": {"type": "string", "title": "Bid Title", "description": "Bid title (案件名) — short headline as published by the procuring entity."}, "bid_kind": {"type": "string", "enum": ["open", "selective", "negotiated", "kobo_subsidy"], "title": "Bid Kind", "description": "Bid procedure kind. open = 一般競争 (open competitive); selective = 指名競争 (selective tender); negotiated = 随意契約 (negotiated contract); kobo_subsidy = 公募型補助 (subsidy-style open call)."}, "procuring_entity": {"type": "string", "title": "Procuring Entity", "description": "Procuring entity name (発注機関名) — ministry / agency / 自治体 issuing the tender."}, "procuring_houjin_bangou": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Procuring Houjin Bangou", "description": "13-digit 法人番号 of the procuring entity (soft ref to houjin_master)."}, "ministry": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Ministry", "description": "Ministry / agency in charge (所管府省) — e.g. 農林水産省, 経済産業省."}, "prefecture": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Prefecture", "description": "Prefecture (都道府県) — full-suffix kanji form, e.g. 東京都. NULL for nationwide bids."}, "program_id_hint": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Program Id Hint", "description": "Soft reference to programs.unified_id when this bid is the procurement arm of a funded 補助事業."}, "announcement_date": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Announcement Date", "description": "Announcement date / 公告日 (ISO 8601 YYYY-MM-DD)."}, "question_deadline": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Question Deadline", "description": "Question-submission deadline / 質問受付期限 (ISO 8601 YYYY-MM-DD)."}, "bid_deadline": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Bid Deadline", "description": "Bid-submission deadline / 入札書提出期限 (ISO 8601 YYYY-MM-DD)."}, "decision_date": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Decision Date", "description": "Award-decision date / 落札決定日 (ISO 8601 YYYY-MM-DD)."}, "budget_ceiling_yen": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Budget Ceiling Yen", "description": "Budget ceiling / contract cap (予定価格 / 契約限度額) in JPY, tax-inclusive when disclosed by the procuring entity."}, "awarded_amount_yen": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Awarded Amount Yen", "description": "Awarded amount (落札金額) in JPY, tax-inclusive when disclosed."}, "winner_name": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Winner Name", "description": "Winning bidder name (落札者名) — as published by the procuring entity."}, "winner_houjin_bangou": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Winner Houjin Bangou", "description": "13-digit 法人番号 of the winning bidder (soft ref to houjin_master)."}, "participant_count": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Participant Count", "description": "Number of participating bidders (入札参加者数)."}, "bid_description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Bid Description", "description": "Procurement scope / specification summary (調達概要 / 仕様要旨)."}, "eligibility_conditions": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Eligibility Conditions", "description": "Participation eligibility conditions (参加資格要件) — grade rating / location / past-performance requirements."}, "classification_code": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Classification Code", "description": "'役務' | '物品' | '工事' (or finer JGS code)"}, "source_url": {"type": "string", "title": "Source Url", "description": "primary source (GEPS / ministry / *.lg.jp)"}, "source_excerpt": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Excerpt", "description": "relevant passage for audit"}, "source_checksum": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Checksum", "description": "optional SHA-256 of raw fetch body"}, "confidence": {"type": "number", "title": "Confidence", "description": "0..1 lineage confidence"}, "fetched_at": {"type": "string", "title": "Fetched At", "description": "ISO 8601 UTC of last successful fetch"}, "updated_at": {"type": "string", "title": "Updated At", "description": "ISO 8601 UTC of last row write"}}, "additionalProperties": false, "type": "object", "required": ["unified_id", "bid_title", "bid_kind", "procuring_entity", "source_url", "confidence", "fetched_at", "updated_at"], "title": "BidOut", "description": "Single 入札 row. Columns map 1:1 onto 017_bids.sql's `bids` table."}, "BidsSearchResponse": {"properties": {"total": {"type": "integer", "title": "Total"}, "limit": {"type": "integer", "title": "Limit"}, "offset": {"type": "integer", "title": "Offset"}, "results": {"items": {"$ref": "#/components/schemas/BidOut"}, "type": "array", "title": "Results"}}, "additionalProperties": false, "type": "object", "required": ["total", "limit", "offset", "results"], "title": "BidsSearchResponse"}, "BillingHistoryResponse": {"properties": {"invoices": {"items": {"$ref": "#/components/schemas/BillingInvoice"}, "type": "array", "title": "Invoices"}, "cached_at": {"type": "string", "title": "Cached At"}, "customer_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Customer Id"}}, "type": "object", "required": ["invoices", "cached_at", "customer_id"], "title": "BillingHistoryResponse"}, "BillingInvoice": {"properties": {"id": {"type": "string", "title": "Id"}, "number": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Number"}, "period_start": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Period Start"}, "period_end": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Period End"}, "amount_due_yen": {"type": "integer", "title": "Amount Due Yen"}, "amount_paid_yen": {"type": "integer", "title": "Amount Paid Yen"}, "currency": {"type": "string", "title": "Currency"}, "status": {"type": "string", "title": "Status"}, "hosted_invoice_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Hosted Invoice Url"}, "invoice_pdf": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Invoice Pdf"}, "created": {"type": "string", "title": "Created"}}, "type": "object", "required": ["id", "number", "period_start", "period_end", "amount_due_yen", "amount_paid_yen", "currency", "status", "hosted_invoice_url", "invoice_pdf", "created"], "title": "BillingInvoice"}, "BillingPortalResponse": {"properties": {"url": {"type": "string", "title": "Url"}}, "type": "object", "required": ["url"], "title": "BillingPortalResponse"}, "BindSheetRequest": {"properties": {"sheet_id": {"type": "string", "maxLength": 120, "minLength": 20, "title": "Sheet Id"}, "sheet_tab_name": {"anyOf": [{"type": "string", "maxLength": 64}, {"type": "null"}], "title": "Sheet Tab Name", "default": "AutonoMath"}}, "type": "object", "required": ["sheet_id"], "title": "BindSheetRequest"}, "BindSheetResponse": {"properties": {"ok": {"type": "boolean", "title": "Ok"}, "saved_search_id": {"type": "integer", "title": "Saved Search Id"}, "sheet_id": {"type": "string", "title": "Sheet Id"}, "sheet_tab_name": {"type": "string", "title": "Sheet Tab Name"}}, "type": "object", "required": ["ok", "saved_search_id", "sheet_id", "sheet_tab_name"], "title": "BindSheetResponse"}, "Body_bulk_evaluate_clients_v1_me_clients_bulk_evaluate_post": {"properties": {"file": {"type": "string", "format": "binary", "title": "File", "description": "CSV with name_label header"}, "commit": {"type": "boolean", "title": "Commit", "default": false}, "program_filter": {"type": "string", "title": "Program Filter", "default": "all"}, "idempotency_key": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Idempotency Key"}}, "type": "object", "required": ["file"], "title": "Body_bulk_evaluate_clients_v1_me_clients_bulk_evaluate_post"}, "Body_bulk_import_client_profiles_v1_me_client_profiles_bulk_import_post": {"properties": {"file": {"type": "string", "format": "binary", "title": "File", "description": "CSV with name_label header"}, "upsert": {"type": "boolean", "title": "Upsert", "default": true}}, "type": "object", "required": ["file"], "title": "Body_bulk_import_client_profiles_v1_me_client_profiles_bulk_import_post"}, "Body_rest_validate_v1_am_validate_post": {"properties": {"applicant_data": {"additionalProperties": true, "type": "object", "title": "Applicant Data", "description": "Applicant intake dict, e.g. {'plan': {'start_year': 2026, 'desired_amount_man_yen': 1500}, 'identity': {'age': 42, 'birth_date': '1983-08-12'}, 'behavioral': {'training_hours_per_year': 9000}}. Hashed via canonical JSON (sha256) for the result cache key."}, "entity_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Entity Id", "description": "Optional am_entities.canonical_id. Filters rules pinned via scope_entity_id and is part of the cache key."}, "scope": {"type": "string", "title": "Scope", "description": "applies_to scope. Default 'intake' selects the 6 generic predicates ported from autonomath.intake_consistency_rules.", "default": "intake"}}, "type": "object", "required": ["applicant_data"], "title": "Body_rest_validate_v1_am_validate_post"}, "Body_slack_slash_command_v1_integrations_slack_post": {"properties": {"text": {"type": "string", "title": "Text", "default": ""}, "team_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Team Id"}, "user_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "User Id"}, "command": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Command"}}, "type": "object", "title": "Body_slack_slash_command_v1_integrations_slack_post"}, "BulkImportResponse": {"properties": {"imported": {"type": "integer", "title": "Imported"}, "updated": {"type": "integer", "title": "Updated"}, "skipped": {"type": "integer", "title": "Skipped"}, "errors": {"items": {"additionalProperties": true, "type": "object"}, "type": "array", "title": "Errors"}, "total_after_import": {"type": "integer", "title": "Total After Import"}}, "type": "object", "required": ["imported", "updated", "skipped", "total_after_import"], "title": "BulkImportResponse"}, "CapRequest": {"properties": {"monthly_cap_yen": {"anyOf": [{"type": "integer", "minimum": 0.0}, {"type": "null"}], "title": "Monthly Cap Yen", "description": "JPY hard cap for the calendar month. NULL = unlimited. Once reached, requests return 503 with cap_reached=true until JST 月初."}}, "type": "object", "title": "CapRequest", "description": "Body for POST /v1/me/cap.\n\n`monthly_cap_yen=None` -> remove the cap (uncapped, default).\n`monthly_cap_yen=N>0`  -> hard cap at ¥N billable spend per JST calendar\n                          month. ¥3/req unit price unchanged; the cap is\n                          client-side budget control, not a discount."}, "CapResponse": {"properties": {"ok": {"type": "boolean", "title": "Ok"}, "monthly_cap_yen": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Monthly Cap Yen"}}, "type": "object", "required": ["ok", "monthly_cap_yen"], "title": "CapResponse"}, "CaseStudy": {"properties": {"case_id": {"type": "string", "title": "Case Id"}, "company_name": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Company Name"}, "houjin_bangou": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Houjin Bangou"}, "is_sole_proprietor": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Sole Proprietor"}, "prefecture": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Prefecture"}, "municipality": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Municipality"}, "industry_jsic": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Industry Jsic"}, "industry_name": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Industry Name"}, "employees": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Employees"}, "founded_year": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Founded Year"}, "capital_yen": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Capital Yen"}, "case_title": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Case Title"}, "case_summary": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Case Summary"}, "programs_used": {"items": {"type": "string"}, "type": "array", "title": "Programs Used", "default": []}, "total_subsidy_received_yen": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Total Subsidy Received Yen"}, "outcomes": {"anyOf": [{"items": {}, "type": "array"}, {"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Outcomes"}, "patterns": {"anyOf": [{"items": {}, "type": "array"}, {"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Patterns"}, "publication_date": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Publication Date"}, "source_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Url"}, "source_excerpt": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Excerpt"}, "fetched_at": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Fetched At"}, "confidence": {"anyOf": [{"type": "number"}, {"type": "null"}], "title": "Confidence"}}, "type": "object", "required": ["case_id"], "title": "CaseStudy", "description": "A 採択事例 / success-story record.\n\nBacks /v1/case-studies/*. Collected from Jグランツ 採択結果 pages,\nmirasapo 事業事例, local prefectural 事例集, etc. Used as evidence\n(\"program X has actually paid out to a similar business\") and as a\nlookup for due-diligence on named recipients."}, "CaseStudySearchResponse": {"properties": {"total": {"type": "integer", "title": "Total"}, "limit": {"type": "integer", "title": "Limit"}, "offset": {"type": "integer", "title": "Offset"}, "results": {"items": {"$ref": "#/components/schemas/CaseStudy"}, "type": "array", "title": "Results"}}, "type": "object", "required": ["total", "limit", "offset", "results"], "title": "CaseStudySearchResponse"}, "ClientProfileResponse": {"properties": {"profile_id": {"type": "integer", "title": "Profile Id"}, "name_label": {"type": "string", "title": "Name Label"}, "jsic_major": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Jsic Major"}, "prefecture": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Prefecture"}, "employee_count": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Employee Count"}, "capital_yen": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Capital Yen"}, "target_types": {"items": {"type": "string"}, "type": "array", "title": "Target Types"}, "last_active_program_ids": {"items": {"type": "string"}, "type": "array", "title": "Last Active Program Ids"}, "created_at": {"type": "string", "title": "Created At"}, "updated_at": {"type": "string", "title": "Updated At"}}, "type": "object", "required": ["profile_id", "name_label", "jsic_major", "prefecture", "employee_count", "capital_yen", "target_types", "last_active_program_ids", "created_at", "updated_at"], "title": "ClientProfileResponse"}, "CompleteRequest": {"properties": {"user_code": {"type": "string", "title": "User Code"}, "stripe_checkout_session_id": {"type": "string", "title": "Stripe Checkout Session Id"}}, "type": "object", "required": ["user_code", "stripe_checkout_session_id"], "title": "CompleteRequest"}, "CompleteResponse": {"properties": {"ok": {"type": "boolean", "title": "Ok"}}, "type": "object", "required": ["ok"], "title": "CompleteResponse"}, "ConfidencePerToolRow": {"properties": {"tool": {"type": "string", "title": "Tool"}, "discovery": {"anyOf": [{"type": "number"}, {"type": "null"}], "title": "Discovery"}, "discovery_ci95": {"anyOf": [{"items": {"type": "number"}, "type": "array"}, {"type": "null"}], "title": "Discovery Ci95"}, "discovery_hits": {"type": "integer", "title": "Discovery Hits", "default": 0}, "discovery_trials": {"type": "integer", "title": "Discovery Trials", "default": 0}, "use": {"anyOf": [{"type": "number"}, {"type": "null"}], "title": "Use"}, "use_ci95": {"anyOf": [{"items": {"type": "number"}, "type": "array"}, {"type": "null"}], "title": "Use Ci95"}, "use_hits": {"type": "integer", "title": "Use Hits", "default": 0}, "use_trials": {"type": "integer", "title": "Use Trials", "default": 0}, "by_cohort": {"additionalProperties": {"additionalProperties": true, "type": "object"}, "type": "object", "title": "By Cohort"}}, "additionalProperties": true, "type": "object", "required": ["tool"], "title": "ConfidencePerToolRow"}, "ConfidenceResponse": {"properties": {"window_days": {"type": "integer", "title": "Window Days"}, "since": {"type": "string", "title": "Since"}, "until": {"type": "string", "title": "Until"}, "overall": {"additionalProperties": true, "type": "object", "title": "Overall"}, "per_tool": {"items": {"$ref": "#/components/schemas/ConfidencePerToolRow"}, "type": "array", "title": "Per Tool"}, "generated_at": {"type": "string", "title": "Generated At"}}, "additionalProperties": true, "type": "object", "required": ["window_days", "since", "until", "generated_at"], "title": "ConfidenceResponse", "description": "``GET /v1/stats/confidence`` — Bayesian Discovery+Use posteriors."}, "CorrectionSubmit": {"properties": {"entity_id": {"type": "string", "maxLength": 200, "minLength": 1, "title": "Entity Id"}, "field": {"type": "string", "maxLength": 120, "minLength": 1, "title": "Field"}, "claimed_correct_value": {"type": "string", "maxLength": 4000, "minLength": 1, "title": "Claimed Correct Value"}, "evidence_url": {"type": "string", "maxLength": 2000, "pattern": "^https?://", "title": "Evidence Url"}, "reporter_email": {"anyOf": [{"type": "string", "maxLength": 320}, {"type": "null"}], "title": "Reporter Email"}}, "type": "object", "required": ["entity_id", "field", "claimed_correct_value", "evidence_url"], "title": "CorrectionSubmit"}, "CourseSubscriptionResponse": {"properties": {"id": {"type": "integer", "title": "Id"}, "course_slug": {"type": "string", "title": "Course Slug"}, "title": {"type": "string", "title": "Title"}, "length_days": {"type": "integer", "title": "Length Days"}, "started_at": {"type": "string", "title": "Started At"}, "current_day": {"type": "integer", "title": "Current Day"}, "status": {"type": "string", "title": "Status"}, "notify_email": {"type": "string", "title": "Notify Email"}}, "type": "object", "required": ["id", "course_slug", "title", "length_days", "started_at", "current_day", "status", "notify_email"], "title": "CourseSubscriptionResponse"}, "CourtDecision": {"properties": {"unified_id": {"type": "string", "title": "Unified Id", "description": "HAN-<10 lowercase hex>"}, "case_name": {"type": "string", "title": "Case Name"}, "case_number": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Case Number"}, "court": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Court"}, "court_level": {"type": "string", "enum": ["supreme", "high", "district", "summary", "family"], "title": "Court Level"}, "decision_date": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Decision Date"}, "decision_type": {"type": "string", "enum": ["判決", "決定", "命令"], "title": "Decision Type"}, "subject_area": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Subject Area"}, "related_law_ids": {"items": {"type": "string"}, "type": "array", "title": "Related Law Ids", "default": []}, "key_ruling": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Key Ruling"}, "parties_involved": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Parties Involved"}, "impact_on_business": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Impact On Business"}, "precedent_weight": {"type": "string", "enum": ["binding", "persuasive", "informational"], "title": "Precedent Weight", "default": "informational"}, "full_text_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Full Text Url"}, "pdf_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Pdf Url"}, "source_url": {"type": "string", "title": "Source Url"}, "source_excerpt": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Excerpt"}, "source_checksum": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Checksum"}, "confidence": {"type": "number", "title": "Confidence", "default": 0.9}, "fetched_at": {"type": "string", "title": "Fetched At"}, "updated_at": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Updated At"}}, "additionalProperties": true, "type": "object", "required": ["unified_id", "case_name", "court_level", "decision_type", "source_url", "fetched_at"], "title": "CourtDecision"}, "CourtDecisionByStatuteRequest": {"properties": {"law_id": {"type": "string", "title": "Law Id", "description": "LAW-<10 hex> unified_id"}, "article_citation": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Article Citation", "description": "e.g. '第5条第2項'. Optional — omit for whole-law matches."}, "limit": {"type": "integer", "maximum": 100.0, "minimum": 1.0, "title": "Limit", "default": 20}, "offset": {"type": "integer", "minimum": 0.0, "title": "Offset", "default": 0}}, "type": "object", "required": ["law_id"], "title": "CourtDecisionByStatuteRequest", "description": "Body for POST /v1/court-decisions/by-statute.\n\nResolves decisions that cite a given law (and optionally a specific\narticle). Matches against `related_law_ids_json` on court_decisions.\nWhen `article_citation` is supplied, the match is tightened via\nLIKE on `key_ruling` / `source_excerpt` — the 判例 ingest does not\nyet store a structured citation map, so a fuzzy contains-check is\nthe honest signal."}, "CourtDecisionSearchResponse": {"properties": {"total": {"type": "integer", "title": "Total"}, "limit": {"type": "integer", "title": "Limit"}, "offset": {"type": "integer", "title": "Offset"}, "results": {"items": {"$ref": "#/components/schemas/CourtDecision"}, "type": "array", "title": "Results"}}, "type": "object", "required": ["total", "limit", "offset", "results"], "title": "CourtDecisionSearchResponse"}, "CoverageResponse": {"properties": {"programs": {"type": "integer", "title": "Programs", "default": 0}, "case_studies": {"type": "integer", "title": "Case Studies", "default": 0}, "loan_programs": {"type": "integer", "title": "Loan Programs", "default": 0}, "enforcement_cases": {"type": "integer", "title": "Enforcement Cases", "default": 0}, "exclusion_rules": {"type": "integer", "title": "Exclusion Rules", "default": 0}, "laws_jpintel": {"type": "integer", "title": "Laws Jpintel", "default": 0}, "tax_rulesets": {"type": "integer", "title": "Tax Rulesets", "default": 0}, "court_decisions": {"type": "integer", "title": "Court Decisions", "default": 0}, "bids": {"type": "integer", "title": "Bids", "default": 0}, "invoice_registrants": {"type": "integer", "title": "Invoice Registrants", "default": 0}, "generated_at": {"type": "string", "title": "Generated At"}}, "additionalProperties": true, "type": "object", "required": ["generated_at"], "title": "CoverageResponse", "description": "``GET /v1/stats/coverage`` — dataset row counts."}, "CreateSavedSearchRequest": {"properties": {"name": {"type": "string", "maxLength": 128, "minLength": 1, "title": "Name"}, "query": {"$ref": "#/components/schemas/SavedSearchQuery"}, "frequency": {"type": "string", "enum": ["daily", "weekly"], "title": "Frequency", "default": "daily"}, "notify_email": {"type": "string", "format": "email", "title": "Notify Email"}, "channel_format": {"type": "string", "enum": ["email", "slack"], "title": "Channel Format", "default": "email"}, "channel_url": {"anyOf": [{"type": "string", "maxLength": 512}, {"type": "null"}], "title": "Channel Url"}}, "type": "object", "required": ["name", "query", "notify_email"], "title": "CreateSavedSearchRequest"}, "DashboardSummary": {"properties": {"key_hash_prefix": {"type": "string", "title": "Key Hash Prefix"}, "tier": {"type": "string", "title": "Tier"}, "days": {"type": "integer", "title": "Days"}, "series": {"items": {"$ref": "#/components/schemas/jpintel_mcp__api__me__UsageDay"}, "type": "array", "title": "Series"}, "today_calls": {"type": "integer", "title": "Today Calls"}, "last_7_calls": {"type": "integer", "title": "Last 7 Calls"}, "last_30_calls": {"type": "integer", "title": "Last 30 Calls"}, "last_30_amount_yen": {"type": "integer", "title": "Last 30 Amount Yen"}, "peak_day": {"anyOf": [{"$ref": "#/components/schemas/jpintel_mcp__api__me__UsageDay"}, {"type": "null"}]}, "monthly_cap_yen": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Monthly Cap Yen"}, "month_to_date_calls": {"type": "integer", "title": "Month To Date Calls"}, "month_to_date_amount_yen": {"type": "integer", "title": "Month To Date Amount Yen"}, "cap_remaining_yen": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Cap Remaining Yen"}, "unit_price_yen": {"type": "integer", "title": "Unit Price Yen", "default": 3}, "subscription_status": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Subscription Status"}, "current_period_end": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Current Period End"}}, "type": "object", "required": ["key_hash_prefix", "tier", "days", "series", "today_calls", "last_7_calls", "last_30_calls", "last_30_amount_yen", "peak_day", "monthly_cap_yen", "month_to_date_calls", "month_to_date_amount_yen", "cap_remaining_yen"], "title": "DashboardSummary", "description": "Top-level dashboard payload — sized for a single render pass."}, "DataHealthResponse": {"properties": {"status": {"type": "string", "title": "Status"}, "checks": {"items": {"$ref": "#/components/schemas/_DataHealthCheck"}, "type": "array", "title": "Checks"}, "timestamp_utc": {"type": "string", "title": "Timestamp Utc"}}, "type": "object", "required": ["status", "checks", "timestamp_utc"], "title": "DataHealthResponse"}, "DataLineage": {"properties": {"last_fetched_at": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Last Fetched At"}, "unique_checksums": {"type": "integer", "title": "Unique Checksums", "default": 0}}, "type": "object", "title": "DataLineage"}, "DataQualityResponse": {"properties": {"fact_count_total": {"type": "integer", "title": "Fact Count Total", "default": 0}, "mean_score": {"anyOf": [{"type": "number"}, {"type": "null"}], "title": "Mean Score"}, "label_histogram": {"additionalProperties": {"type": "integer"}, "type": "object", "title": "Label Histogram"}, "license_breakdown": {"additionalProperties": {"type": "integer"}, "type": "object", "title": "License Breakdown"}, "freshness_buckets": {"additionalProperties": {"type": "integer"}, "type": "object", "title": "Freshness Buckets"}, "field_kind_breakdown": {"additionalProperties": {"additionalProperties": true, "type": "object"}, "type": "object", "title": "Field Kind Breakdown"}, "cross_source_agreement": {"additionalProperties": true, "type": "object", "title": "Cross Source Agreement"}, "model": {"type": "string", "title": "Model", "default": "beta_posterior_v1"}, "generated_at": {"type": "string", "title": "Generated At"}}, "additionalProperties": true, "type": "object", "required": ["generated_at"], "title": "DataQualityResponse", "description": "``GET /v1/stats/data_quality`` — per-fact uncertainty rollup (O8).\n\nAggregates the `am_uncertainty_view` view into a transparency-grade\nsummary: average per-record_kind score, license breakdown, freshness\ndistribution, and a count of cross-source-agreed facts. Emitted via\nthe same 5-min L4 cache as the other ``/v1/stats/*`` endpoints."}, "DdBatchRequest": {"properties": {"houjin_bangous": {"items": {"type": "string"}, "type": "array", "maxItems": 200, "minItems": 1, "title": "Houjin Bangous", "description": "1..200 法人番号 (13 digits, NFKC + T prefix + hyphens auto-stripped). Each id contributes ¥3 to the metered total."}, "depth": {"type": "string", "enum": ["summary", "full"], "title": "Depth", "description": "summary = entity + counts + recent_history; full = entity + adoption_timeline + amendment_recent + bids.recent_won + extended enforcement history.", "default": "summary"}, "max_cost_jpy": {"anyOf": [{"type": "integer", "minimum": 0.0}, {"type": "null"}], "title": "Max Cost Jpy", "description": "Optional in-body cost cap. The lower of this and the `X-Cost-Cap-JPY` header binds. 400 if predicted (`len(houjin_bangous) * 3`) exceeds the cap."}}, "type": "object", "required": ["houjin_bangous"], "title": "DdBatchRequest", "description": "`POST /v1/am/dd_batch` request body."}, "DdExportRequest": {"properties": {"deal_id": {"type": "string", "maxLength": 128, "minLength": 1, "pattern": "^[A-Za-z0-9_\\-:.]+$", "title": "Deal Id", "description": "Free-form audit deal identifier; written into the bundle manifest. Boutiques typically use 'PROJECT-ALPHA-2026' shaped tags so the bundle ZIP filename round-trips through their deal-room."}, "houjin_bangous": {"items": {"type": "string"}, "type": "array", "maxItems": 200, "minItems": 1, "title": "Houjin Bangous"}, "format": {"type": "string", "enum": ["zip", "pdf"], "title": "Format", "default": "zip"}, "max_cost_jpy": {"anyOf": [{"type": "integer", "minimum": 0.0}, {"type": "null"}], "title": "Max Cost Jpy"}}, "type": "object", "required": ["deal_id", "houjin_bangous"], "title": "DdExportRequest"}, "DeactivateResponse": {"properties": {"ok": {"type": "boolean", "title": "Ok"}, "id": {"type": "integer", "title": "Id"}}, "type": "object", "required": ["ok", "id"], "title": "DeactivateResponse"}, "DeadlineEntry": {"properties": {"unified_id": {"type": "string", "title": "Unified Id"}, "primary_name": {"type": "string", "title": "Primary Name"}, "tier": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Tier"}, "authority_level": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authority Level"}, "prefecture": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Prefecture"}, "end_date": {"type": "string", "title": "End Date", "description": "ISO YYYY-MM-DD of the next open-window close date."}, "days_remaining": {"type": "integer", "minimum": 0.0, "title": "Days Remaining", "description": "Whole days from today (UTC date) to end_date, inclusive of today."}, "amount_max_man_yen": {"anyOf": [{"type": "number"}, {"type": "null"}], "title": "Amount Max Man Yen"}, "application_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Application Url", "description": "Where to send the applicant — aliases official_url."}}, "additionalProperties": false, "type": "object", "required": ["unified_id", "primary_name", "tier", "authority_level", "prefecture", "end_date", "days_remaining", "amount_max_man_yen", "application_url"], "title": "DeadlineEntry", "description": "One program whose submission window ends within the query horizon."}, "DeadlinesResponse": {"properties": {"as_of": {"type": "string", "title": "As Of", "description": "Today's ISO date (UTC). Makes days_remaining reproducible."}, "within_days": {"type": "integer", "title": "Within Days"}, "total": {"type": "integer", "title": "Total", "description": "Matching rows before `limit` was applied."}, "results": {"items": {"$ref": "#/components/schemas/DeadlineEntry"}, "type": "array", "title": "Results"}}, "additionalProperties": false, "type": "object", "required": ["as_of", "within_days", "total", "results"], "title": "DeadlinesResponse"}, "DeepHealthResponse": {"properties": {"status": {"type": "string", "title": "Status", "description": "ok | degraded | unhealthy"}, "checks": {"additionalProperties": true, "type": "object", "title": "Checks"}, "generated_at": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Generated At"}}, "additionalProperties": true, "type": "object", "required": ["status"], "title": "DeepHealthResponse", "description": "``GET /v1/am/health/deep`` — 10-check aggregate."}, "DeleteCourseResponse": {"properties": {"ok": {"type": "boolean", "title": "Ok"}, "course_slug": {"type": "string", "title": "Course Slug"}}, "type": "object", "required": ["ok", "course_slug"], "title": "DeleteCourseResponse"}, "DeletionRequest": {"properties": {"requester_email": {"type": "string", "format": "email", "title": "Requester Email"}, "requester_legal_name": {"type": "string", "maxLength": 200, "minLength": 1, "title": "Requester Legal Name"}, "target_houjin_bangou": {"anyOf": [{"type": "string", "maxLength": 13, "minLength": 13}, {"type": "null"}], "title": "Target Houjin Bangou"}, "target_data_categories": {"items": {"type": "string", "enum": ["representative", "address", "postal_code", "phone", "email", "company_url", "all_personal_data"]}, "type": "array", "maxItems": 7, "minItems": 1, "title": "Target Data Categories"}, "identity_verification_method": {"type": "string", "enum": ["drivers_license", "my_number_card", "passport", "residence_card", "health_insurance_card", "other"], "title": "Identity Verification Method"}, "deletion_reason": {"anyOf": [{"type": "string", "maxLength": 2000}, {"type": "null"}], "title": "Deletion Reason"}}, "type": "object", "required": ["requester_email", "requester_legal_name", "target_data_categories", "identity_verification_method"], "title": "DeletionRequest"}, "DeletionResponse": {"properties": {"request_id": {"type": "string", "title": "Request Id"}, "received_at": {"type": "string", "title": "Received At"}, "expected_response_within_days": {"type": "integer", "title": "Expected Response Within Days", "default": 30}, "contact": {"type": "string", "title": "Contact", "default": "<email-redacted>"}}, "type": "object", "required": ["request_id", "received_at"], "title": "DeletionResponse"}, "DeliveryRow": {"properties": {"id": {"type": "integer", "title": "Id"}, "event_type": {"type": "string", "title": "Event Type"}, "event_id": {"type": "string", "title": "Event Id"}, "status_code": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Status Code"}, "attempt_count": {"type": "integer", "title": "Attempt Count"}, "delivered_at": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Delivered At"}, "error": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Error"}, "created_at": {"type": "string", "title": "Created At"}}, "type": "object", "required": ["id", "event_type", "event_id", "status_code", "attempt_count", "delivered_at", "error", "created_at"], "title": "DeliveryRow"}, "DisclosureRequest": {"properties": {"requester_email": {"type": "string", "format": "email", "title": "Requester Email"}, "requester_legal_name": {"type": "string", "maxLength": 200, "minLength": 1, "title": "Requester Legal Name"}, "target_houjin_bangou": {"anyOf": [{"type": "string", "maxLength": 13, "minLength": 13}, {"type": "null"}], "title": "Target Houjin Bangou"}, "identity_verification_method": {"type": "string", "enum": ["drivers_license", "my_number_card", "passport", "residence_card", "health_insurance_card", "other"], "title": "Identity Verification Method"}}, "type": "object", "required": ["requester_email", "requester_legal_name", "identity_verification_method"], "title": "DisclosureRequest"}, "DisclosureResponse": {"properties": {"request_id": {"type": "string", "title": "Request Id"}, "received_at": {"type": "string", "title": "Received At"}, "expected_response_within_days": {"type": "integer", "title": "Expected Response Within Days", "default": 14}, "contact": {"type": "string", "title": "Contact", "default": "<email-redacted>"}}, "type": "object", "required": ["request_id", "received_at"], "title": "DisclosureResponse"}, "EmailConnectRequest": {"properties": {"reply_from": {"type": "string", "maxLength": 128, "minLength": 4, "title": "Reply From", "default": "<email-redacted>"}}, "type": "object", "title": "EmailConnectRequest"}, "EnforcementCase": {"properties": {"case_id": {"type": "string", "title": "Case Id"}, "event_type": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Event Type"}, "program_name_hint": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Program Name Hint"}, "recipient_name": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Recipient Name"}, "recipient_kind": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Recipient Kind"}, "recipient_houjin_bangou": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Recipient Houjin Bangou"}, "is_sole_proprietor": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Sole Proprietor"}, "bureau": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Bureau"}, "intermediate_recipient": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Intermediate Recipient"}, "prefecture": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Prefecture"}, "ministry": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Ministry"}, "occurred_fiscal_years": {"items": {"type": "integer"}, "type": "array", "title": "Occurred Fiscal Years", "default": []}, "amount_yen": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Amount Yen"}, "amount_project_cost_yen": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Amount Project Cost Yen"}, "amount_grant_paid_yen": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Amount Grant Paid Yen"}, "amount_improper_grant_yen": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Amount Improper Grant Yen"}, "amount_improper_project_cost_yen": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Amount Improper Project Cost Yen"}, "reason_excerpt": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Reason Excerpt"}, "legal_basis": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Legal Basis"}, "source_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Url"}, "source_section": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Section"}, "source_title": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Title"}, "disclosed_date": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Disclosed Date"}, "disclosed_until": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Disclosed Until"}, "fetched_at": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Fetched At"}, "confidence": {"anyOf": [{"type": "number"}, {"type": "null"}], "title": "Confidence"}}, "type": "object", "required": ["case_id"], "title": "EnforcementCase", "description": "A single 会計検査院 (Board of Audit) finding.\n\nBacks /v1/enforcement-cases/*. These are historical records of improper\nsubsidy handling (over-payment, diversion, documentation failure, etc.)\nused for compliance / due-diligence checks before advising a client on a\nprogram with prior clawback history."}, "EnforcementCaseSearchResponse": {"properties": {"total": {"type": "integer", "title": "Total"}, "limit": {"type": "integer", "title": "Limit"}, "offset": {"type": "integer", "title": "Offset"}, "results": {"items": {"$ref": "#/components/schemas/EnforcementCase"}, "type": "array", "title": "Results"}}, "type": "object", "required": ["total", "limit", "offset", "results"], "title": "EnforcementCaseSearchResponse"}, "ErrorBody": {"properties": {"code": {"type": "string", "enum": ["missing_required_arg", "invalid_enum", "invalid_date_format", "out_of_range", "no_matching_records", "ambiguous_query", "seed_not_found", "db_locked", "db_unavailable", "subsystem_unavailable", "internal", "unknown_query_parameter", "auth_required", "auth_invalid", "rate_limit_exceeded", "route_not_found", "method_not_allowed", "internal_error", "service_unavailable", "cap_reached"], "title": "Code", "description": "Closed-enum machine-readable error code. Agents should branch on this rather than parsing `message`."}, "message": {"type": "string", "title": "Message", "description": "Plain-Japanese end-user-readable message. ≤200 chars. Mirrored in `user_message` extra for legacy clients that read that key."}, "details": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Details", "description": "Per-code extras: e.g. `retry_after` seconds for 503, `field_errors` for 422, `suggested_paths` for 404."}, "request_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Request Id", "description": "Echoed `x-request-id`. Always populated server-side with a real 16-char hex token; freshly minted when no upstream id can be resolved (never the literal `'unset'`)."}}, "additionalProperties": true, "type": "object", "required": ["code", "message"], "title": "ErrorBody", "description": "Body of the canonical error envelope.\n\nRequired fields are ``code`` + ``message``. ``request_id`` is always\npresent in production (``make_error`` defaults to a freshly-minted\n``secrets.token_hex(8)`` value when no upstream id can be resolved)\nbut is marked optional here so SDK generators emit a nullable type.\n\nExtras (``retry_after``, ``suggested_paths``, ``field_errors``,\n``severity``, ``documentation``, ``user_message_en``) are tolerated via\n``extra=\"allow\"`` so the OpenAPI schema can stay a stable minimum\ncontract without needing to enumerate per-code keys.", "examples": [{"code": "no_matching_records", "details": {"hint": "Try removing prefecture or expanding tier to ['S','A','B'].", "queried": {"prefecture": "宮城県", "tier": ["S"]}}, "message": "No rows matched the supplied filters.", "request_id": "a3f12c7b9e8d4501"}]}, "ErrorEnvelope": {"properties": {"error": {"$ref": "#/components/schemas/ErrorBody", "description": "Error body — see ErrorBody."}}, "additionalProperties": true, "type": "object", "required": ["error"], "title": "ErrorEnvelope", "description": "Top-level wrapper. The JSON body of every 4xx / 5xx is `{ \"error\": {...} }`.\n\nNote: legacy 5xx bodies also include a back-compat `detail` field at the\ntop level alongside `error`; that is documented separately on the route\ndocs and is intentionally omitted from the strict schema so callers\nmigrate to reading `error.code`.", "examples": [{"error": {"code": "rate_limit_exceeded", "details": {"retry_after": 30}, "message": "レート制限を超過しました。Retry-After ヘッダの秒数だけ待ってから再試行してください。", "request_id": "a3f12c7b9e8d4501"}}]}, "EvaluateRequest": {"properties": {"business_profile": {"additionalProperties": true, "type": "object", "title": "Business Profile", "description": "Caller-supplied key/value bag. Keys referenced by predicate `field` values are looked up here. Arbitrary schema; the evaluator never fabricates values — a missing field yields a false condition with an explicit 'field missing' reason."}, "target_ruleset_ids": {"anyOf": [{"items": {"type": "string"}, "type": "array", "maxItems": 100}, {"type": "null"}], "title": "Target Ruleset Ids", "description": "Optional list of TAX-<10hex> ids to evaluate. When omitted, all CURRENT rulesets (effective_until IS NULL OR >= today) are evaluated. Cap: 100 ids per request."}}, "additionalProperties": false, "type": "object", "required": ["business_profile"], "title": "EvaluateRequest"}, "EvaluateResponse": {"properties": {"results": {"items": {"$ref": "#/components/schemas/EvaluateResult"}, "type": "array", "title": "Results"}}, "additionalProperties": true, "type": "object", "required": ["results"], "title": "EvaluateResponse"}, "EvaluateResult": {"properties": {"unified_id": {"type": "string", "title": "Unified Id"}, "ruleset_name": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Ruleset Name"}, "applicable": {"type": "boolean", "title": "Applicable"}, "reasons": {"items": {"type": "string"}, "type": "array", "title": "Reasons"}, "conditions_matched": {"items": {"additionalProperties": true, "type": "object"}, "type": "array", "title": "Conditions Matched"}, "conditions_unmatched": {"items": {"additionalProperties": true, "type": "object"}, "type": "array", "title": "Conditions Unmatched"}, "error": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Error", "description": "Populated when the ruleset row had malformed JSON or an unsupported predicate op. `applicable` is False in that case and `reasons` carries the parse/eval error."}}, "additionalProperties": true, "type": "object", "required": ["unified_id", "applicable", "reasons", "conditions_matched", "conditions_unmatched"], "title": "EvaluateResult"}, "ExampleProfileDetail": {"properties": {"id": {"type": "string", "title": "Id"}, "profile": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Profile"}}, "additionalProperties": true, "type": "object", "required": ["id"], "title": "ExampleProfileDetail"}, "ExampleProfileItem": {"properties": {"id": {"type": "string", "title": "Id"}, "filename": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Filename"}, "size_bytes": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Size Bytes"}}, "additionalProperties": true, "type": "object", "required": ["id"], "title": "ExampleProfileItem"}, "ExampleProfileList": {"properties": {"total": {"type": "integer", "title": "Total"}, "results": {"items": {"$ref": "#/components/schemas/ExampleProfileItem"}, "type": "array", "title": "Results"}}, "additionalProperties": true, "type": "object", "required": ["total"], "title": "ExampleProfileList"}, "ExclusionCheckRequest": {"properties": {"program_ids": {"items": {"type": "string"}, "type": "array", "minItems": 1, "title": "Program Ids"}}, "type": "object", "required": ["program_ids"], "title": "ExclusionCheckRequest"}, "ExclusionCheckResponse": {"properties": {"program_ids": {"items": {"type": "string"}, "type": "array", "title": "Program Ids"}, "hits": {"items": {"$ref": "#/components/schemas/ExclusionHit"}, "type": "array", "title": "Hits"}, "checked_rules": {"type": "integer", "title": "Checked Rules"}}, "type": "object", "required": ["program_ids", "hits", "checked_rules"], "title": "ExclusionCheckResponse"}, "ExclusionHit": {"properties": {"rule_id": {"type": "string", "title": "Rule Id"}, "kind": {"type": "string", "title": "Kind"}, "severity": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Severity"}, "programs_involved": {"items": {"type": "string"}, "type": "array", "title": "Programs Involved"}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "source_urls": {"items": {"type": "string"}, "type": "array", "title": "Source Urls", "default": []}}, "type": "object", "required": ["rule_id", "kind", "severity", "programs_involved", "description"], "title": "ExclusionHit"}, "ExclusionRule": {"properties": {"rule_id": {"type": "string", "title": "Rule Id"}, "kind": {"type": "string", "title": "Kind"}, "severity": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Severity"}, "program_a": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Program A"}, "program_b": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Program B"}, "program_b_group": {"items": {"type": "string"}, "type": "array", "title": "Program B Group", "default": []}, "description": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Description"}, "source_notes": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Notes"}, "source_urls": {"items": {"type": "string"}, "type": "array", "title": "Source Urls", "default": []}, "extra": {"additionalProperties": true, "type": "object", "title": "Extra", "default": {}}}, "type": "object", "required": ["rule_id", "kind"], "title": "ExclusionRule"}, "FeedbackRequest": {"properties": {"message": {"type": "string", "maxLength": 4000, "minLength": 1, "title": "Message"}, "rating": {"anyOf": [{"type": "integer", "maximum": 5.0, "minimum": 1.0}, {"type": "null"}], "title": "Rating"}, "endpoint": {"anyOf": [{"type": "string", "maxLength": 256}, {"type": "null"}], "title": "Endpoint"}, "request_id": {"anyOf": [{"type": "string", "maxLength": 128}, {"type": "null"}], "title": "Request Id"}}, "type": "object", "required": ["message"], "title": "FeedbackRequest"}, "FeedbackResponse": {"properties": {"received": {"type": "boolean", "title": "Received"}, "feedback_id": {"type": "integer", "title": "Feedback Id"}}, "type": "object", "required": ["received", "feedback_id"], "title": "FeedbackResponse"}, "FreshnessResponse": {"properties": {"sources": {"additionalProperties": {"$ref": "#/components/schemas/FreshnessSourceStat"}, "type": "object", "title": "Sources"}, "generated_at": {"type": "string", "title": "Generated At"}}, "additionalProperties": true, "type": "object", "required": ["generated_at"], "title": "FreshnessResponse", "description": "``GET /v1/stats/freshness`` — per-source min/max/avg fetched_at."}, "FreshnessSourceStat": {"properties": {"min": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Min"}, "max": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Max"}, "count": {"type": "integer", "title": "Count", "default": 0}, "avg_interval_days": {"anyOf": [{"type": "number"}, {"type": "null"}], "title": "Avg Interval Days"}}, "additionalProperties": true, "type": "object", "title": "FreshnessSourceStat", "description": "Per-source freshness stats inside ``FreshnessResponse.sources``."}, "GetResponse": {"properties": {"result": {"$ref": "#/components/schemas/InvoiceRegistrantOut"}, "attribution": {"$ref": "#/components/schemas/AttributionBlock"}}, "additionalProperties": false, "type": "object", "required": ["result", "attribution"], "title": "GetResponse"}, "HTTPValidationError": {"properties": {"detail": {"items": {"$ref": "#/components/schemas/ValidationError"}, "type": "array", "title": "Detail"}}, "type": "object", "title": "HTTPValidationError"}, "InvoiceRegistrantOut": {"properties": {"invoice_registration_number": {"type": "string", "title": "Invoice Registration Number", "description": "'T' + 13 digits (14 chars total). Primary key."}, "houjin_bangou": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Houjin Bangou", "description": "13-digit 法人番号. NULL for sole proprietors / 'other'. Soft reference to houjin_master (no hard FK)."}, "normalized_name": {"type": "string", "title": "Normalized Name", "description": "Registered business name (事業者名 / 公表名称) — as published by NTA."}, "address_normalized": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Address Normalized", "description": "Normalized registered address (所在地). May be NULL when NTA withholds it (sole proprietors who declined disclosure)."}, "prefecture": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Prefecture", "description": "Prefecture (都道府県) — full-suffix kanji form, e.g. 東京都."}, "registered_date": {"type": "string", "title": "Registered Date", "description": "Registration date / 登録日 (ISO 8601 YYYY-MM-DD)."}, "revoked_date": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Revoked Date", "description": "Revocation date / 取消日 (ISO 8601). NULL = not revoked (未取消)."}, "expired_date": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Expired Date", "description": "Expiration date / 失効日 (ISO 8601). NULL = not expired (未失効)."}, "registrant_kind": {"type": "string", "enum": ["corporation", "sole_proprietor", "other"], "title": "Registrant Kind", "description": "corporation (法人) | sole_proprietor (個人事業主) | other"}, "trade_name": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Trade Name", "description": "屋号等 (may be NULL)"}, "last_updated_nta": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Last Updated Nta", "description": "NTA's timestamp on this record"}, "source_url": {"type": "string", "title": "Source Url", "description": "primary source URL (https://www.invoice-kohyo.nta.go.jp/download/...)"}, "source_checksum": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Checksum", "description": "optional SHA-256 of raw bulk file"}, "confidence": {"type": "number", "title": "Confidence", "description": "0..1 lineage confidence"}, "fetched_at": {"type": "string", "title": "Fetched At", "description": "ISO 8601 UTC when we last successfully fetched this row. Rendered as '出典取得' on public surfaces (not '最終更新')."}, "updated_at": {"type": "string", "title": "Updated At", "description": "ISO 8601 UTC of last row write in our DB"}}, "additionalProperties": false, "type": "object", "required": ["invoice_registration_number", "normalized_name", "registered_date", "registrant_kind", "source_url", "confidence", "fetched_at", "updated_at"], "title": "InvoiceRegistrantOut", "description": "Single 適格請求書発行事業者 row. Columns map 1:1 onto\n019_invoice_registrants.sql's `invoice_registrants` table."}, "KeyIssueRequest": {"properties": {"session_id": {"type": "string", "title": "Session Id"}}, "type": "object", "required": ["session_id"], "title": "KeyIssueRequest"}, "KeyIssueResponse": {"properties": {"api_key": {"type": "string", "title": "Api Key"}, "tier": {"type": "string", "title": "Tier"}, "customer_id": {"type": "string", "title": "Customer Id"}}, "type": "object", "required": ["api_key", "tier", "customer_id"], "title": "KeyIssueResponse"}, "KintoneConnectRequest": {"properties": {"domain": {"type": "string", "maxLength": 63, "minLength": 4, "title": "Domain", "description": "acme.cybozu.com"}, "app_id": {"type": "integer", "maximum": 999999999.0, "minimum": 1.0, "title": "App Id"}, "api_token": {"type": "string", "maxLength": 512, "minLength": 8, "title": "Api Token"}}, "type": "object", "required": ["domain", "app_id", "api_token"], "title": "KintoneConnectRequest"}, "KintoneRequest": {"properties": {"query": {"type": "string", "maxLength": 200, "minLength": 1, "title": "Query"}, "prefecture": {"anyOf": [{"type": "string", "maxLength": 20}, {"type": "null"}], "title": "Prefecture"}, "target_type": {"anyOf": [{"items": {"type": "string"}, "type": "array", "maxItems": 8}, {"type": "null"}], "title": "Target Type"}, "record_id": {"anyOf": [{"type": "string", "maxLength": 64}, {"type": "null"}], "title": "Record Id", "description": "Calling kintone record id (logged for audit, not used to filter)"}}, "type": "object", "required": ["query"], "title": "KintoneRequest"}, "KintoneSyncRequest": {"properties": {"saved_search_id": {"type": "integer", "minimum": 1.0, "title": "Saved Search Id"}, "idempotency_key": {"anyOf": [{"type": "string", "maxLength": 120}, {"type": "null"}], "title": "Idempotency Key"}, "max_rows": {"type": "integer", "maximum": 200.0, "minimum": 1.0, "title": "Max Rows", "default": 50}}, "type": "object", "required": ["saved_search_id"], "title": "KintoneSyncRequest"}, "Law": {"properties": {"unified_id": {"type": "string", "title": "Unified Id", "description": "LAW-<10 lowercase hex>"}, "law_number": {"type": "string", "title": "Law Number"}, "law_title": {"type": "string", "title": "Law Title"}, "law_short_title": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Law Short Title"}, "law_type": {"type": "string", "enum": ["constitution", "act", "cabinet_order", "imperial_order", "ministerial_ordinance", "rule", "notice", "guideline"], "title": "Law Type"}, "ministry": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Ministry"}, "promulgated_date": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Promulgated Date"}, "enforced_date": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Enforced Date"}, "last_amended_date": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Last Amended Date"}, "revision_status": {"type": "string", "enum": ["current", "superseded", "repealed"], "title": "Revision Status", "default": "current"}, "superseded_by_law_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Superseded By Law Id"}, "article_count": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Article Count"}, "full_text_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Full Text Url"}, "summary": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Summary"}, "subject_areas": {"items": {"type": "string"}, "type": "array", "title": "Subject Areas", "default": []}, "source_url": {"type": "string", "title": "Source Url"}, "source_checksum": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Checksum"}, "confidence": {"type": "number", "title": "Confidence", "default": 0.95}, "fetched_at": {"type": "string", "title": "Fetched At"}, "updated_at": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Updated At"}}, "additionalProperties": true, "type": "object", "required": ["unified_id", "law_number", "law_title", "law_type", "source_url", "fetched_at"], "title": "Law"}, "LawSearchResponse": {"properties": {"total": {"type": "integer", "title": "Total"}, "limit": {"type": "integer", "title": "Limit"}, "offset": {"type": "integer", "title": "Offset"}, "results": {"items": {"$ref": "#/components/schemas/Law"}, "type": "array", "title": "Results"}}, "type": "object", "required": ["total", "limit", "offset", "results"], "title": "LawSearchResponse"}, "LoanProgram": {"properties": {"id": {"type": "integer", "title": "Id"}, "program_name": {"type": "string", "title": "Program Name"}, "provider": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Provider"}, "loan_type": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Loan Type"}, "amount_max_yen": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Amount Max Yen"}, "loan_period_years_max": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Loan Period Years Max"}, "grace_period_years_max": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Grace Period Years Max"}, "interest_rate_base_annual": {"anyOf": [{"type": "number"}, {"type": "null"}], "title": "Interest Rate Base Annual"}, "interest_rate_special_annual": {"anyOf": [{"type": "number"}, {"type": "null"}], "title": "Interest Rate Special Annual"}, "rate_names": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Rate Names"}, "security_required": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Security Required"}, "target_conditions": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Target Conditions"}, "official_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Official Url"}, "source_excerpt": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Excerpt"}, "fetched_at": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Fetched At"}, "confidence": {"anyOf": [{"type": "number"}, {"type": "null"}], "title": "Confidence"}, "collateral_required": {"anyOf": [{"type": "string", "enum": ["required", "not_required", "negotiable", "unknown"]}, {"type": "null"}], "title": "Collateral Required"}, "personal_guarantor_required": {"anyOf": [{"type": "string", "enum": ["required", "not_required", "negotiable", "unknown"]}, {"type": "null"}], "title": "Personal Guarantor Required"}, "third_party_guarantor_required": {"anyOf": [{"type": "string", "enum": ["required", "not_required", "negotiable", "unknown"]}, {"type": "null"}], "title": "Third Party Guarantor Required"}, "security_notes": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Security Notes"}}, "type": "object", "required": ["id", "program_name"], "title": "LoanProgram", "description": "A 融資プログラム row — 日本政策金融公庫 / 地方自治体 / 信金 etc.\n\nBacks /v1/loan-programs/*. Post-2026-04-23 the `security_required` free\ntext has been normalised into three independent axes (collateral,\npersonal guarantor, third-party guarantor) so callers can filter\n\"無担保・無保証 only\" vs. \"担保あり＋代表者保証あり\" without parsing JP prose."}, "LoanProgramSearchResponse": {"properties": {"total": {"type": "integer", "title": "Total"}, "limit": {"type": "integer", "title": "Limit"}, "offset": {"type": "integer", "title": "Offset"}, "results": {"items": {"$ref": "#/components/schemas/LoanProgram"}, "type": "array", "title": "Results"}}, "type": "object", "required": ["total", "limit", "offset", "results"], "title": "LoanProgramSearchResponse"}, "MatchResponse": {"properties": {"total": {"type": "integer", "title": "Total"}, "results": {"items": {"$ref": "#/components/schemas/AdvisorOut"}, "type": "array", "title": "Results"}, "ranking": {"additionalProperties": {"type": "string"}, "type": "object", "title": "Ranking"}}, "additionalProperties": false, "type": "object", "required": ["total", "results"], "title": "MatchResponse"}, "MeResponse": {"properties": {"tier": {"type": "string", "title": "Tier"}, "key_hash_prefix": {"type": "string", "title": "Key Hash Prefix"}, "customer_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Customer Id"}, "created_at": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Created At"}, "subscription_status": {"type": "string", "title": "Subscription Status"}, "subscription_current_period_end": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Subscription Current Period End"}, "subscription_cancel_at_period_end": {"type": "boolean", "title": "Subscription Cancel At Period End"}}, "type": "object", "required": ["tier", "key_hash_prefix", "customer_id", "created_at", "subscription_status", "subscription_current_period_end", "subscription_cancel_at_period_end"], "title": "MeResponse"}, "Meta": {"properties": {"total_programs": {"type": "integer", "title": "Total Programs"}, "tier_counts": {"additionalProperties": {"type": "integer"}, "type": "object", "title": "Tier Counts"}, "prefecture_counts": {"additionalProperties": {"type": "integer"}, "type": "object", "title": "Prefecture Counts"}, "exclusion_rules_count": {"type": "integer", "title": "Exclusion Rules Count"}, "last_ingested_at": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Last Ingested At"}, "data_as_of": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Data As Of"}, "data_lineage": {"$ref": "#/components/schemas/DataLineage", "default": {"unique_checksums": 0}}}, "type": "object", "required": ["total_programs", "tier_counts", "prefecture_counts", "exclusion_rules_count", "last_ingested_at"], "title": "Meta"}, "MetaFreshnessResponse": {"properties": {"total": {"type": "integer", "title": "Total", "default": 0}, "median_fetched_at": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Median Fetched At"}, "pct_within_30d": {"type": "number", "title": "Pct Within 30D", "default": 0.0}, "pct_over_180d": {"type": "number", "title": "Pct Over 180D", "default": 0.0}, "top_rows": {"items": {"$ref": "#/components/schemas/MetaFreshnessRow"}, "type": "array", "title": "Top Rows"}, "generated_at": {"type": "string", "title": "Generated At"}}, "additionalProperties": true, "type": "object", "required": ["generated_at"], "title": "MetaFreshnessResponse", "description": "``GET /v1/meta/freshness`` — public anti-staleness feed."}, "MetaFreshnessRow": {"properties": {"canonical_id": {"type": "string", "title": "Canonical Id"}, "name": {"type": "string", "title": "Name"}, "tier": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Tier"}, "source_fetched_at": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Fetched At"}, "days_ago": {"type": "integer", "title": "Days Ago", "default": 0}}, "additionalProperties": true, "type": "object", "required": ["canonical_id", "name"], "title": "MetaFreshnessRow"}, "PatchSavedSearchRequest": {"properties": {"channel_format": {"anyOf": [{"type": "string", "enum": ["email", "slack"]}, {"type": "null"}], "title": "Channel Format"}, "channel_url": {"anyOf": [{"type": "string", "maxLength": 512}, {"type": "null"}], "title": "Channel Url"}}, "type": "object", "title": "PatchSavedSearchRequest", "description": "Partial update — only channel fields may be edited post-create.\n\nRenaming or rewriting the query is intentionally not supported (delete\n+ create instead) so we have a clean audit trail. Channel routing is\nthe only knob that legitimately flips post-create (consultant adds a\nSlack channel after onboarding via email)."}, "PingResponse": {"properties": {"ok": {"type": "boolean", "title": "Ok"}, "authenticated": {"type": "boolean", "title": "Authenticated"}, "tier": {"type": "string", "title": "Tier"}, "server_time_utc": {"type": "string", "title": "Server Time Utc"}, "server_version": {"type": "string", "title": "Server Version"}, "rate_limit_remaining": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Rate Limit Remaining"}}, "type": "object", "required": ["ok", "authenticated", "tier", "server_time_utc", "server_version", "rate_limit_remaining"], "title": "PingResponse"}, "PortalRequest": {"properties": {"return_url": {"type": "string", "title": "Return Url"}, "customer_id": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Customer Id"}}, "type": "object", "required": ["return_url"], "title": "PortalRequest"}, "PrescreenMatch": {"properties": {"unified_id": {"type": "string", "title": "Unified Id"}, "primary_name": {"type": "string", "title": "Primary Name"}, "tier": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Tier"}, "authority_level": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authority Level"}, "prefecture": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Prefecture"}, "amount_max_man_yen": {"anyOf": [{"type": "number"}, {"type": "null"}], "title": "Amount Max Man Yen"}, "official_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Official Url"}, "static_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Static Url", "description": "Site-relative path to the program's static SEO page on jpcite.com. Computed from primary_name + unified_id via jpintel_mcp.utils.slug. Use this for deep-links."}, "fit_score": {"type": "integer", "title": "Fit Score", "description": "Heuristic positive-match count in v1 (higher = better fit). Ranges 0..~5. NOT a probability; compare rows within one response only."}, "match_reasons": {"items": {"type": "string"}, "type": "array", "title": "Match Reasons", "description": "Human-readable reasons this row scored positively."}, "caveats": {"items": {"type": "string"}, "type": "array", "title": "Caveats", "description": "Conditions the caller has NOT met or we couldn't verify (e.g., missing 認定新規就農者 prerequisite, amount_max below planned_investment). Empty list == no known caveats."}}, "additionalProperties": false, "type": "object", "required": ["unified_id", "primary_name", "tier", "authority_level", "prefecture", "amount_max_man_yen", "official_url", "fit_score", "match_reasons", "caveats"], "title": "PrescreenMatch"}, "PrescreenRequest": {"properties": {"prefecture": {"anyOf": [{"type": "string", "maxLength": 40}, {"type": "null"}], "title": "Prefecture", "description": "Caller's prefecture. Accepts canonical ('東京都'), short ('東京'), or romaji ('Tokyo'). Use '全国' / 'national' / None to skip the prefecture filter entirely (you still get national programs)."}, "industry_jsic": {"anyOf": [{"type": "string", "maxLength": 10}, {"type": "null"}], "title": "Industry Jsic", "description": "JSIC 大分類 letter (A..T). Accepts JP names ('製造業', '農業'). Used for hints only in v1 — does not exclude programs because program-level industry tagging coverage is thin."}, "is_sole_proprietor": {"anyOf": [{"type": "boolean"}, {"type": "null"}], "title": "Is Sole Proprietor", "description": "True = 個人事業主. False = 法人 (incl. 株式会社/合同会社/組合). None = unspecified (match against both target_types)."}, "employee_count": {"anyOf": [{"type": "integer", "maximum": 100000.0, "minimum": 0.0}, {"type": "null"}], "title": "Employee Count", "description": "Number of employees."}, "revenue_yen": {"anyOf": [{"type": "integer", "minimum": 0.0}, {"type": "null"}], "title": "Revenue Yen", "description": "Annual revenue in JPY (NOT 万円). Used for SME/大企業 split only."}, "founded_year": {"anyOf": [{"type": "integer", "maximum": 2100.0, "minimum": 1800.0}, {"type": "null"}], "title": "Founded Year", "description": "Western calendar year of incorporation / founding."}, "planned_investment_man_yen": {"anyOf": [{"type": "number", "minimum": 0.0}, {"type": "null"}], "title": "Planned Investment Man Yen", "description": "Planned project cost in 万円 (NOT 円). Used for amount sufficiency check — programs whose amount_max_man_yen is below this value are flagged as 'undersized'."}, "houjin_bangou": {"anyOf": [{"type": "string", "maxLength": 13}, {"type": "null"}], "title": "Houjin Bangou", "description": "13-digit 国税庁 法人番号. Stored for identity only."}, "declared_certifications": {"anyOf": [{"items": {"type": "string"}, "type": "array", "maxItems": 20}, {"type": "null"}], "title": "Declared Certifications", "description": "Certifications the caller has declared (e.g., '認定新規就農者', '認定農業者', '経営革新計画承認'). Used to suppress 'prerequisite-missing' flags."}, "limit": {"type": "integer", "maximum": 50.0, "minimum": 1.0, "title": "Limit", "description": "Max rows to return. Default 10.", "default": 10}, "company_url": {"anyOf": [{"type": "string", "maxLength": 500}, {"type": "null"}], "title": "Company Url", "description": "Honeypot. Real callers MUST leave this null/empty. The web form hides this field via CSS; only autofilled bots populate it. Any non-empty value is treated as abuse and rejected."}}, "additionalProperties": false, "type": "object", "title": "PrescreenRequest", "description": "Caller's business profile. All fields optional — the more you supply,\nthe sharper the scoring. An empty profile returns the same default\nranking search_programs uses (tier first), just wrapped in the prescreen\nenvelope so the caller gets a consistent shape."}, "PrescreenResponse": {"properties": {"total_considered": {"type": "integer", "title": "Total Considered", "description": "Rows passing the hard prefecture / national filter before ranking. `results` is ranked top-N of this set."}, "limit": {"type": "integer", "title": "Limit"}, "results": {"items": {"$ref": "#/components/schemas/PrescreenMatch"}, "type": "array", "title": "Results"}, "profile_echo": {"additionalProperties": true, "type": "object", "title": "Profile Echo", "description": "The normalized profile actually used for matching, so the caller can verify e.g. that 'Tokyo' -> '東京都'."}}, "additionalProperties": false, "type": "object", "required": ["total_considered", "limit", "results", "profile_echo"], "title": "PrescreenResponse"}, "Program": {"properties": {"unified_id": {"type": "string", "title": "Unified Id"}, "primary_name": {"type": "string", "title": "Primary Name"}, "aliases": {"items": {"type": "string"}, "type": "array", "title": "Aliases", "default": []}, "authority_level": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authority Level"}, "authority_name": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authority Name"}, "prefecture": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Prefecture"}, "municipality": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Municipality"}, "program_kind": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Program Kind"}, "official_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Official Url"}, "amount_max_man_yen": {"anyOf": [{"type": "number"}, {"type": "null"}], "title": "Amount Max Man Yen"}, "amount_min_man_yen": {"anyOf": [{"type": "number"}, {"type": "null"}], "title": "Amount Min Man Yen"}, "subsidy_rate": {"anyOf": [{"type": "number"}, {"type": "null"}], "title": "Subsidy Rate"}, "trust_level": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Trust Level"}, "tier": {"anyOf": [{"type": "string", "enum": ["S", "A", "B", "C", "X"]}, {"type": "null"}], "title": "Tier"}, "coverage_score": {"anyOf": [{"type": "number"}, {"type": "null"}], "title": "Coverage Score"}, "gap_to_tier_s": {"items": {"type": "string"}, "type": "array", "title": "Gap To Tier S", "default": []}, "a_to_j_coverage": {"additionalProperties": true, "type": "object", "title": "A To J Coverage", "default": {}}, "excluded": {"type": "boolean", "title": "Excluded", "default": false}, "exclusion_reason": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Exclusion Reason"}, "crop_categories": {"items": {"type": "string"}, "type": "array", "title": "Crop Categories", "default": []}, "equipment_category": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Equipment Category"}, "target_types": {"items": {"type": "string"}, "type": "array", "title": "Target Types", "default": []}, "funding_purpose": {"items": {"type": "string"}, "type": "array", "title": "Funding Purpose", "default": []}, "amount_band": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Amount Band"}, "application_window": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Application Window"}, "next_deadline": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Next Deadline", "description": "ISO date of the next open-window end_date from application_window, or null when the window is rolling / unknown / already past."}, "application_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Application Url", "description": "URL the caller should send an applicant to. Currently aliases official_url; once enriched 申請方法 extraction stabilises this will prefer the dedicated apply page when one exists."}, "static_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Static Url", "description": "Site-relative path to the per-program SEO page on jpcite.com (`/programs/{slug}-{sha1-6}.html`). Generated from `primary_name` + `unified_id` via `jpintel_mcp.utils.slug.program_static_url`. Use this to deep-link result cards / share URLs / mailto bodies into the static site instead of constructing `/programs/{unified_id}.html` (no such file exists; that pattern returns 404)."}}, "type": "object", "required": ["unified_id", "primary_name"], "title": "Program"}, "ProgramDetail": {"properties": {"unified_id": {"type": "string", "title": "Unified Id"}, "primary_name": {"type": "string", "title": "Primary Name"}, "aliases": {"items": {"type": "string"}, "type": "array", "title": "Aliases", "default": []}, "authority_level": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authority Level"}, "authority_name": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authority Name"}, "prefecture": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Prefecture"}, "municipality": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Municipality"}, "program_kind": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Program Kind"}, "official_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Official Url"}, "amount_max_man_yen": {"anyOf": [{"type": "number"}, {"type": "null"}], "title": "Amount Max Man Yen"}, "amount_min_man_yen": {"anyOf": [{"type": "number"}, {"type": "null"}], "title": "Amount Min Man Yen"}, "subsidy_rate": {"anyOf": [{"type": "number"}, {"type": "null"}], "title": "Subsidy Rate"}, "trust_level": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Trust Level"}, "tier": {"anyOf": [{"type": "string", "enum": ["S", "A", "B", "C", "X"]}, {"type": "null"}], "title": "Tier"}, "coverage_score": {"anyOf": [{"type": "number"}, {"type": "null"}], "title": "Coverage Score"}, "gap_to_tier_s": {"items": {"type": "string"}, "type": "array", "title": "Gap To Tier S", "default": []}, "a_to_j_coverage": {"additionalProperties": true, "type": "object", "title": "A To J Coverage", "default": {}}, "excluded": {"type": "boolean", "title": "Excluded", "default": false}, "exclusion_reason": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Exclusion Reason"}, "crop_categories": {"items": {"type": "string"}, "type": "array", "title": "Crop Categories", "default": []}, "equipment_category": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Equipment Category"}, "target_types": {"items": {"type": "string"}, "type": "array", "title": "Target Types", "default": []}, "funding_purpose": {"items": {"type": "string"}, "type": "array", "title": "Funding Purpose", "default": []}, "amount_band": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Amount Band"}, "application_window": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Application Window"}, "next_deadline": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Next Deadline", "description": "ISO date of the next open-window end_date from application_window, or null when the window is rolling / unknown / already past."}, "application_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Application Url", "description": "URL the caller should send an applicant to. Currently aliases official_url; once enriched 申請方法 extraction stabilises this will prefer the dedicated apply page when one exists."}, "static_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Static Url", "description": "Site-relative path to the per-program SEO page on jpcite.com (`/programs/{slug}-{sha1-6}.html`). Generated from `primary_name` + `unified_id` via `jpintel_mcp.utils.slug.program_static_url`. Use this to deep-link result cards / share URLs / mailto bodies into the static site instead of constructing `/programs/{unified_id}.html` (no such file exists; that pattern returns 404)."}, "enriched": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"type": "null"}], "title": "Enriched"}, "source_mentions": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"items": {}, "type": "array"}], "title": "Source Mentions", "default": {}}, "source_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Url"}, "source_fetched_at": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Fetched At"}, "source_checksum": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Checksum"}, "required_documents": {"items": {"type": "string"}, "type": "array", "title": "Required Documents", "description": "Best-effort list of required document names extracted from the enriched procedure dimension. Empty list = we haven't extracted documents for this program yet (not 'none needed')."}}, "type": "object", "required": ["unified_id", "primary_name"], "title": "ProgramDetail"}, "RefundRequest": {"properties": {"requester_email": {"type": "string", "format": "email", "title": "Requester Email"}, "customer_id": {"type": "string", "maxLength": 120, "minLength": 1, "title": "Customer Id"}, "amount_yen": {"anyOf": [{"type": "integer", "maximum": 10000000.0, "minimum": 1.0}, {"type": "null"}], "title": "Amount Yen"}, "reason": {"type": "string", "maxLength": 2000, "minLength": 1, "title": "Reason"}}, "type": "object", "required": ["requester_email", "customer_id", "reason"], "title": "RefundRequest"}, "RefundResponse": {"properties": {"request_id": {"type": "string", "title": "Request Id"}, "received_at": {"type": "string", "title": "Received At"}, "expected_response_within_days": {"type": "integer", "title": "Expected Response Within Days", "default": 14}, "contact": {"type": "string", "title": "Contact", "default": "<email-redacted>"}, "note": {"type": "string", "title": "Note", "default": "返金は手動審査となります。既に課金済みの ¥3/req メータリング分は 自動取消しされません — 審査完了後、運営から個別にご連絡します。"}}, "type": "object", "required": ["request_id", "received_at"], "title": "RefundResponse"}, "RegisterRequest": {"properties": {"url": {"type": "string", "maxLength": 2048, "title": "Url"}, "event_types": {"items": {"type": "string", "enum": ["program.created", "program.amended", "enforcement.added", "tax_ruleset.amended", "invoice_registrant.matched"]}, "type": "array", "maxItems": 5, "minItems": 1, "title": "Event Types"}}, "type": "object", "required": ["url", "event_types"], "title": "RegisterRequest"}, "RelatedProgramRef": {"properties": {"program_unified_id": {"type": "string", "title": "Program Unified Id"}, "ref_kind": {"type": "string", "title": "Ref Kind", "description": "One of: authority | eligibility | exclusion | reference | penalty"}, "article_citation": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Article Citation"}, "program_name": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Program Name"}, "source_url": {"type": "string", "title": "Source Url"}, "fetched_at": {"type": "string", "title": "Fetched At"}, "confidence": {"type": "number", "title": "Confidence", "default": 0.9}}, "type": "object", "required": ["program_unified_id", "ref_kind", "source_url", "fetched_at"], "title": "RelatedProgramRef", "description": "A program citing a given law (reverse lookup via program_law_refs)."}, "RelatedProgramsResponse": {"properties": {"law_unified_id": {"type": "string", "title": "Law Unified Id"}, "total": {"type": "integer", "title": "Total"}, "limit": {"type": "integer", "title": "Limit"}, "offset": {"type": "integer", "title": "Offset"}, "results": {"items": {"$ref": "#/components/schemas/RelatedProgramRef"}, "type": "array", "title": "Results"}}, "type": "object", "required": ["law_unified_id", "total", "limit", "offset", "results"], "title": "RelatedProgramsResponse"}, "ReportConversionRequest": {"properties": {"referral_token": {"type": "string", "title": "Referral Token"}, "conversion_value_yen": {"anyOf": [{"type": "integer", "minimum": 0.0}, {"type": "null"}], "title": "Conversion Value Yen"}, "evidence_url": {"anyOf": [{"type": "string", "maxLength": 2083, "minLength": 1, "format": "uri"}, {"type": "null"}], "title": "Evidence Url"}}, "additionalProperties": false, "type": "object", "required": ["referral_token"], "title": "ReportConversionRequest"}, "RotateKeyResponse": {"properties": {"api_key": {"type": "string", "title": "Api Key"}, "tier": {"type": "string", "title": "Tier"}}, "type": "object", "required": ["api_key", "tier"], "title": "RotateKeyResponse"}, "SavedSearchQuery": {"properties": {"q": {"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}], "title": "Q"}, "prefecture": {"anyOf": [{"type": "string", "maxLength": 20}, {"type": "null"}], "title": "Prefecture"}, "authority_level": {"anyOf": [{"type": "string", "maxLength": 20}, {"type": "null"}], "title": "Authority Level"}, "target_types": {"anyOf": [{"items": {"type": "string"}, "type": "array", "maxItems": 20}, {"type": "null"}], "title": "Target Types"}, "funding_purpose": {"anyOf": [{"items": {"type": "string"}, "type": "array", "maxItems": 20}, {"type": "null"}], "title": "Funding Purpose"}, "amount_min": {"anyOf": [{"type": "number", "minimum": 0.0}, {"type": "null"}], "title": "Amount Min"}, "amount_max": {"anyOf": [{"type": "number", "minimum": 0.0}, {"type": "null"}], "title": "Amount Max"}, "tier": {"anyOf": [{"items": {"type": "string"}, "type": "array", "maxItems": 4}, {"type": "null"}], "title": "Tier"}, "include_excluded": {"type": "boolean", "title": "Include Excluded", "default": false}}, "type": "object", "title": "SavedSearchQuery", "description": "The query criteria for a saved search.\n\nMirrors the params accepted by ``GET /v1/programs/search`` (api/programs.py)\nso the cron can replay the saved search verbatim. All fields are\noptional, BUT the create endpoint enforces \"at least one filter\" so a\ncustomer cannot save the empty-corpus query (which would email them\nevery program every day)."}, "SavedSearchResponse": {"properties": {"id": {"type": "integer", "title": "Id"}, "name": {"type": "string", "title": "Name"}, "query": {"additionalProperties": true, "type": "object", "title": "Query"}, "frequency": {"type": "string", "title": "Frequency"}, "notify_email": {"type": "string", "title": "Notify Email"}, "channel_format": {"type": "string", "title": "Channel Format"}, "channel_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Channel Url"}, "last_run_at": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Last Run At"}, "created_at": {"type": "string", "title": "Created At"}}, "type": "object", "required": ["id", "name", "query", "frequency", "notify_email", "channel_format", "channel_url", "last_run_at", "created_at"], "title": "SavedSearchResponse"}, "SessionRequest": {"properties": {"api_key": {"type": "string", "maxLength": 256, "minLength": 8, "title": "Api Key"}}, "type": "object", "required": ["api_key"], "title": "SessionRequest"}, "SessionResponse": {"properties": {"tier": {"type": "string", "title": "Tier"}, "key_hash_prefix": {"type": "string", "title": "Key Hash Prefix"}}, "type": "object", "required": ["tier", "key_hash_prefix"], "title": "SessionResponse"}, "SetSlackRequest": {"properties": {"saved_search_id": {"type": "integer", "title": "Saved Search Id"}, "channel_url": {"type": "string", "maxLength": 512, "minLength": 1, "title": "Channel Url"}}, "type": "object", "required": ["saved_search_id", "channel_url"], "title": "SetSlackRequest"}, "SetSlackResponse": {"properties": {"ok": {"type": "boolean", "title": "Ok"}, "saved_search_id": {"type": "integer", "title": "Saved Search Id"}, "test_delivered": {"type": "boolean", "title": "Test Delivered"}}, "type": "object", "required": ["ok", "saved_search_id", "test_delivered"], "title": "SetSlackResponse"}, "SheetsRequest": {"properties": {"query": {"type": "string", "maxLength": 200, "minLength": 1, "title": "Query"}, "field": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Field", "description": "Which scalar to return for the FIRST result. One of: `title`, `url`, `prefecture`, `authority`, `amount`, `disclaimer`. Returns `''` if no results.", "default": "title"}}, "type": "object", "required": ["query"], "title": "SheetsRequest"}, "SlaResponse": {"properties": {"window": {"type": "string", "title": "Window", "description": "\"24h\" or \"7d\""}, "uptime_pct": {"type": "number", "title": "Uptime Pct", "description": "Successful (status<500) / total"}, "p95_latency_ms": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "P95 Latency Ms", "description": "p95 of latency_ms across non-error events; None if too few samples."}, "sample_count": {"type": "integer", "title": "Sample Count"}, "generated_at": {"type": "string", "title": "Generated At"}, "target": {"additionalProperties": true, "type": "object", "title": "Target"}}, "type": "object", "required": ["window", "uptime_pct", "sample_count", "generated_at"], "title": "SlaResponse"}, "StartEmailCourseRequest": {"properties": {"notify_email": {"type": "string", "format": "email", "title": "Notify Email"}, "course_slug": {"type": "string", "enum": ["invoice", "dencho"], "title": "Course Slug", "default": "invoice"}}, "type": "object", "required": ["notify_email"], "title": "StartEmailCourseRequest"}, "StaticResourceDetail": {"properties": {"id": {"type": "string", "title": "Id"}, "license": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "License"}, "content": {"anyOf": [{"additionalProperties": true, "type": "object"}, {"items": {}, "type": "array"}, {"type": "string"}, {"type": "null"}], "title": "Content"}}, "additionalProperties": true, "type": "object", "required": ["id"], "title": "StaticResourceDetail"}, "StaticResourceItem": {"properties": {"id": {"type": "string", "title": "Id"}, "filename": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Filename"}, "path_relative": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Path Relative"}, "size_bytes": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Size Bytes"}}, "additionalProperties": true, "type": "object", "required": ["id"], "title": "StaticResourceItem"}, "StaticResourceList": {"properties": {"total": {"type": "integer", "title": "Total"}, "results": {"items": {"$ref": "#/components/schemas/StaticResourceItem"}, "type": "array", "title": "Results"}}, "additionalProperties": true, "type": "object", "required": ["total"], "title": "StaticResourceList"}, "SubscribeCourseRequest": {"properties": {"course_slug": {"type": "string", "enum": ["invoice", "dencho"], "title": "Course Slug"}, "notify_email": {"type": "string", "format": "email", "title": "Notify Email"}}, "type": "object", "required": ["course_slug", "notify_email"], "title": "SubscribeCourseRequest"}, "SubscriptionResponse": {"properties": {"id": {"type": "integer", "title": "Id"}, "filter_type": {"type": "string", "title": "Filter Type"}, "filter_value": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Filter Value"}, "min_severity": {"type": "string", "title": "Min Severity"}, "webhook_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Webhook Url"}, "email": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Email"}, "active": {"type": "boolean", "title": "Active"}, "created_at": {"type": "string", "title": "Created At"}, "updated_at": {"type": "string", "title": "Updated At"}, "last_triggered": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Last Triggered"}}, "type": "object", "required": ["id", "filter_type", "filter_value", "min_severity", "webhook_url", "email", "active", "created_at", "updated_at", "last_triggered"], "title": "SubscriptionResponse"}, "TaxRulesetOut": {"properties": {"unified_id": {"type": "string", "title": "Unified Id"}, "ruleset_name": {"type": "string", "title": "Ruleset Name"}, "tax_category": {"type": "string", "title": "Tax Category"}, "ruleset_kind": {"type": "string", "title": "Ruleset Kind"}, "effective_from": {"type": "string", "title": "Effective From"}, "effective_until": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Effective Until"}, "related_law_ids": {"items": {"type": "string"}, "type": "array", "title": "Related Law Ids"}, "eligibility_conditions": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Eligibility Conditions"}, "eligibility_conditions_json": {"anyOf": [{}, {"type": "null"}], "title": "Eligibility Conditions Json", "description": "Parsed predicate tree (list / dict of {op, field, value, ...}). None if the row has no machine-readable predicates or if the stored JSON is malformed (never 500s — see evaluator)."}, "rate_or_amount": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Rate Or Amount"}, "calculation_formula": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Calculation Formula"}, "filing_requirements": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Filing Requirements"}, "authority": {"type": "string", "title": "Authority"}, "authority_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Authority Url"}, "source_url": {"type": "string", "title": "Source Url"}, "source_excerpt": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Excerpt"}, "source_checksum": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Checksum"}, "confidence": {"type": "number", "title": "Confidence"}, "fetched_at": {"type": "string", "title": "Fetched At"}, "updated_at": {"type": "string", "title": "Updated At"}}, "additionalProperties": true, "type": "object", "required": ["unified_id", "ruleset_name", "tax_category", "ruleset_kind", "effective_from", "effective_until", "related_law_ids", "eligibility_conditions", "eligibility_conditions_json", "rate_or_amount", "calculation_formula", "filing_requirements", "authority", "authority_url", "source_url", "source_excerpt", "source_checksum", "confidence", "fetched_at", "updated_at"], "title": "TaxRulesetOut"}, "TaxRulesetSearchResponse": {"properties": {"total": {"type": "integer", "title": "Total"}, "limit": {"type": "integer", "title": "Limit"}, "offset": {"type": "integer", "title": "Offset"}, "results": {"items": {"$ref": "#/components/schemas/TaxRulesetOut"}, "type": "array", "title": "Results"}}, "additionalProperties": true, "type": "object", "required": ["total", "limit", "offset", "results"], "title": "TaxRulesetSearchResponse"}, "TestDeliveryResponse": {"properties": {"ok": {"type": "boolean", "title": "Ok"}, "status_code": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Status Code"}, "error": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Error"}, "signature": {"type": "string", "title": "Signature"}, "sent_at": {"type": "string", "title": "Sent At"}}, "type": "object", "required": ["ok", "status_code", "error", "signature", "sent_at"], "title": "TestDeliveryResponse"}, "TestimonialListResponse": {"properties": {"total": {"type": "integer", "title": "Total"}, "rows": {"items": {"$ref": "#/components/schemas/TestimonialPublic"}, "type": "array", "title": "Rows"}}, "type": "object", "required": ["total", "rows"], "title": "TestimonialListResponse"}, "TestimonialPublic": {"properties": {"id": {"type": "integer", "title": "Id"}, "audience": {"type": "string", "title": "Audience"}, "text": {"type": "string", "title": "Text"}, "name": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Name"}, "organization": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Organization"}, "linkedin_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Linkedin Url"}, "approved_at": {"type": "string", "title": "Approved At"}}, "type": "object", "required": ["id", "audience", "text", "name", "organization", "linkedin_url", "approved_at"], "title": "TestimonialPublic"}, "TestimonialSubmit": {"properties": {"audience": {"type": "string", "enum": ["税理士", "行政書士", "SMB", "VC", "Dev"], "title": "Audience"}, "text": {"type": "string", "maxLength": 2000, "minLength": 10, "title": "Text"}, "name": {"anyOf": [{"type": "string", "maxLength": 80}, {"type": "null"}], "title": "Name"}, "organization": {"anyOf": [{"type": "string", "maxLength": 120}, {"type": "null"}], "title": "Organization"}, "linkedin_url": {"anyOf": [{"type": "string", "maxLength": 300}, {"type": "null"}], "title": "Linkedin Url"}}, "type": "object", "required": ["audience", "text"], "title": "TestimonialSubmit"}, "TestimonialSubmitResponse": {"properties": {"received": {"type": "boolean", "title": "Received"}, "testimonial_id": {"type": "integer", "title": "Testimonial Id"}, "pending_review": {"type": "boolean", "title": "Pending Review"}}, "type": "object", "required": ["received", "testimonial_id", "pending_review"], "title": "TestimonialSubmitResponse"}, "TokenRequest": {"properties": {"grant_type": {"type": "string", "title": "Grant Type"}, "device_code": {"type": "string", "title": "Device Code"}, "client_id": {"type": "string", "title": "Client Id", "default": "autonomath-mcp"}}, "type": "object", "required": ["grant_type", "device_code"], "title": "TokenRequest"}, "TokenSuccess": {"properties": {"access_token": {"type": "string", "title": "Access Token"}, "token_type": {"type": "string", "const": "Bearer", "title": "Token Type", "default": "Bearer"}, "scope": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Scope"}}, "type": "object", "required": ["access_token"], "title": "TokenSuccess"}, "ToolRecommendation": {"properties": {"endpoint": {"type": "string", "title": "Endpoint"}, "name": {"type": "string", "title": "Name"}, "why": {"type": "string", "title": "Why"}, "confidence": {"type": "number", "maximum": 1.0, "minimum": 0.0, "title": "Confidence"}}, "type": "object", "required": ["endpoint", "name", "why", "confidence"], "title": "ToolRecommendation"}, "ToolRecommendationResponse": {"properties": {"intent": {"type": "string", "title": "Intent"}, "tools": {"items": {"$ref": "#/components/schemas/ToolRecommendation"}, "type": "array", "title": "Tools"}, "fallback_used": {"type": "boolean", "title": "Fallback Used", "description": "True when no keyword matched and we fell back to the catalog. Mirrors envelope.meta.alternative_intents semantics — caller can downgrade UI to 'browse all' instead of 'best match'."}}, "type": "object", "required": ["intent", "tools", "fallback_used"], "title": "ToolRecommendationResponse"}, "ToolUsageResponse": {"properties": {"days": {"type": "integer", "title": "Days"}, "total_calls": {"type": "integer", "title": "Total Calls"}, "total_amount_yen": {"type": "integer", "title": "Total Amount Yen"}, "top": {"items": {"$ref": "#/components/schemas/ToolUsageRow"}, "type": "array", "title": "Top"}}, "type": "object", "required": ["days", "total_calls", "total_amount_yen", "top"], "title": "ToolUsageResponse"}, "ToolUsageRow": {"properties": {"endpoint": {"type": "string", "title": "Endpoint"}, "calls": {"type": "integer", "title": "Calls"}, "amount_yen": {"type": "integer", "title": "Amount Yen"}, "avg_latency_ms": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Avg Latency Ms", "description": "Average request latency for this endpoint over the window, if telemetry is recorded. Currently unused — usage_events does not persist latency_ms — so the field is None today."}}, "type": "object", "required": ["endpoint", "calls", "amount_yen"], "title": "ToolUsageRow"}, "TrackRequest": {"properties": {"advisor_id": {"type": "integer", "title": "Advisor Id"}, "source_query_hash": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Source Query Hash"}, "source_program_id": {"anyOf": [{"type": "string", "maxLength": 120}, {"type": "null"}], "title": "Source Program Id"}}, "additionalProperties": false, "type": "object", "required": ["advisor_id"], "title": "TrackRequest"}, "TrackResponse": {"properties": {"token": {"type": "string", "title": "Token"}, "redirect_url": {"type": "string", "title": "Redirect Url"}}, "additionalProperties": false, "type": "object", "required": ["token", "redirect_url"], "title": "TrackResponse"}, "UnsubscribeResponse": {"properties": {"unsubscribed": {"type": "boolean", "title": "Unsubscribed"}, "at": {"type": "string", "title": "At"}}, "type": "object", "required": ["unsubscribed", "at"], "title": "UnsubscribeResponse"}, "UsageByClientTag": {"properties": {"client_tag": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Client Tag"}, "calls": {"type": "integer", "title": "Calls"}, "yen": {"type": "integer", "title": "Yen"}}, "type": "object", "required": ["client_tag", "calls", "yen"], "title": "UsageByClientTag", "description": "Per-client_tag aggregate row (税理士 顧問先 attribution).\n\nMigration 085: surfaced by GET /v1/me/usage?group_by=client_tag and\nGET /v1/me/usage.csv?group_by=client_tag. `client_tag=None` is the\ncatch-all bucket for requests that did not pass X-Client-Tag."}, "UsageDayBucket": {"properties": {"date": {"type": "string", "title": "Date"}, "count": {"type": "integer", "title": "Count", "default": 0}, "cumulative": {"type": "integer", "title": "Cumulative", "default": 0}}, "additionalProperties": true, "type": "object", "required": ["date"], "title": "UsageDayBucket"}, "UsageResponse": {"properties": {"window_days": {"type": "integer", "title": "Window Days", "default": 30}, "since": {"type": "string", "title": "Since"}, "until": {"type": "string", "title": "Until"}, "daily": {"items": {"$ref": "#/components/schemas/UsageDayBucket"}, "type": "array", "title": "Daily"}, "total": {"type": "integer", "title": "Total", "default": 0}, "generated_at": {"type": "string", "title": "Generated At"}}, "additionalProperties": true, "type": "object", "required": ["since", "until", "generated_at"], "title": "UsageResponse", "description": "``GET /v1/stats/usage`` — past-30d anonymous request counts."}, "UsageStatus": {"properties": {"tier": {"type": "string", "title": "Tier"}, "limit": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Limit"}, "remaining": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Remaining"}, "used": {"type": "integer", "title": "Used"}, "reset_at": {"type": "string", "title": "Reset At"}, "reset_timezone": {"type": "string", "title": "Reset Timezone"}, "upgrade_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Upgrade Url"}, "note": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Note"}}, "type": "object", "required": ["tier", "limit", "remaining", "used", "reset_at", "reset_timezone"], "title": "UsageStatus", "description": "Single shape covers anonymous + paid + free (dunning) tiers.\n\n`limit` and `remaining` are nullable so the metered (\"paid\") tier can\nreturn both as None — there is no upper bound on a metered key, the\ncustomer pays ¥3/req for whatever volume they consume. The dashboard\n(`/v1/me/dashboard`) is the right surface for \"how much will this\ncost me this month\", not /v1/usage."}, "ValidationError": {"properties": {"loc": {"items": {"anyOf": [{"type": "string"}, {"type": "integer"}]}, "type": "array", "title": "Location"}, "msg": {"type": "string", "title": "Message"}, "type": {"type": "string", "title": "Error Type"}}, "type": "object", "required": ["loc", "msg", "type"], "title": "ValidationError"}, "WatchRegisterRequest": {"properties": {"watch_kind": {"type": "string", "enum": ["houjin", "program", "law"], "title": "Watch Kind", "description": "One of 'houjin' | 'program' | 'law'."}, "target_id": {"type": "string", "maxLength": 128, "minLength": 1, "title": "Target Id", "description": "houjin_bangou (13 digits) for kind='houjin'; programs.unified_id for kind='program'; laws.law_id for kind='law'. Opaque to the API server — the dispatcher resolves it per-kind."}}, "type": "object", "required": ["watch_kind", "target_id"], "title": "WatchRegisterRequest"}, "WatchResponse": {"properties": {"id": {"type": "integer", "title": "Id"}, "watch_kind": {"type": "string", "title": "Watch Kind"}, "target_id": {"type": "string", "title": "Target Id"}, "status": {"type": "string", "title": "Status"}, "registered_at": {"type": "string", "title": "Registered At"}, "last_event_at": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Last Event At"}, "created_at": {"type": "string", "title": "Created At"}}, "type": "object", "required": ["id", "watch_kind", "target_id", "status", "registered_at", "last_event_at", "created_at"], "title": "WatchResponse"}, "WebhookResponse": {"properties": {"id": {"type": "integer", "title": "Id"}, "url": {"type": "string", "title": "Url"}, "event_types": {"items": {"type": "string"}, "type": "array", "title": "Event Types"}, "status": {"type": "string", "title": "Status"}, "failure_count": {"type": "integer", "title": "Failure Count"}, "last_delivery_at": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Last Delivery At"}, "created_at": {"type": "string", "title": "Created At"}, "secret_hmac": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Secret Hmac"}, "secret_last4": {"type": "string", "title": "Secret Last4"}}, "type": "object", "required": ["id", "url", "event_types", "status", "failure_count", "last_delivery_at", "created_at", "secret_last4"], "title": "WebhookResponse"}, "WidgetSignupRequest": {"properties": {"email": {"type": "string", "format": "email", "title": "Email"}, "origins": {"items": {"type": "string"}, "type": "array", "maxItems": 20, "minItems": 1, "title": "Origins"}, "plan": {"type": "string", "title": "Plan", "default": "business"}, "label": {"anyOf": [{"type": "string", "maxLength": 120}, {"type": "null"}], "title": "Label"}, "success_url": {"type": "string", "title": "Success Url"}, "cancel_url": {"type": "string", "title": "Cancel Url"}}, "type": "object", "required": ["email", "origins", "success_url", "cancel_url"], "title": "WidgetSignupRequest"}, "WidgetSignupResponse": {"properties": {"checkout_url": {"type": "string", "title": "Checkout Url"}, "session_id": {"type": "string", "title": "Session Id"}}, "type": "object", "required": ["checkout_url", "session_id"], "title": "WidgetSignupResponse"}, "WorkpaperRequest": {"properties": {"client_id": {"type": "string", "maxLength": 128, "minLength": 1, "title": "Client Id", "description": "Audit firm's internal client identifier. Echoed back in the work-paper header. NEVER 法人番号 or other PII — the auditor controls the namespace. ASCII only, ≤128 chars."}, "target_ruleset_ids": {"items": {"type": "string"}, "type": "array", "maxItems": 100, "minItems": 1, "title": "Target Ruleset Ids", "description": "List of TAX-<10hex> ids to evaluate. Order is preserved in the work-paper. Cap: 100."}, "business_profile": {"additionalProperties": true, "type": "object", "title": "Business Profile", "description": "Client's business attribute bag — same shape as ``/v1/tax_rulesets/evaluate``."}, "report_format": {"type": "string", "maxLength": 4, "minLength": 2, "title": "Report Format", "description": "Output format. One of: csv | pdf | md | docx.", "default": "pdf"}, "audit_period": {"anyOf": [{"type": "string", "maxLength": 16, "minLength": 1}, {"type": "null"}], "title": "Audit Period", "description": "Audit period token (used as cache key + cover-page label). Accepts ``YYYY`` / ``YYYY-Q1..Q4`` / ``YYYY-MM``. Falls back to the current calendar year when omitted. PDF outputs are cached to ``data/workpapers/{api_key_id}_{audit_period}.pdf`` so a re-pull within the same period is read-from-disk and NOT re-metered."}}, "additionalProperties": false, "type": "object", "required": ["client_id", "target_ruleset_ids", "business_profile"], "title": "WorkpaperRequest", "description": "POST /v1/audit/workpaper input.\n\nA single client + their business profile + the rulesets the auditor\nwants evaluated. Produces a downloadable artefact (CSV / PDF / MD /\nDOCX) plus structured JSON suitable for paste-into-engagement-system."}, "_DataHealthCheck": {"properties": {"table": {"type": "string", "title": "Table"}, "db": {"type": "string", "title": "Db"}, "expected_min_rows": {"type": "integer", "title": "Expected Min Rows"}, "actual_rows": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Actual Rows"}, "status": {"type": "string", "title": "Status"}, "detail": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Detail"}}, "type": "object", "required": ["table", "db", "expected_min_rows", "actual_rows", "status"], "title": "_DataHealthCheck"}, "jpintel_mcp__api__advisors__SignupRequest": {"properties": {"firm_name": {"type": "string", "maxLength": 200, "minLength": 1, "title": "Firm Name"}, "firm_name_kana": {"anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}], "title": "Firm Name Kana"}, "houjin_bangou": {"type": "string", "title": "Houjin Bangou", "description": "13 digits"}, "firm_type": {"type": "string", "enum": ["税理士法人", "認定支援機関", "社会保険労務士", "中小企業診断士", "行政書士", "弁護士", "銀行", "商工会議所", "その他"], "title": "Firm Type"}, "specialties": {"items": {"type": "string", "enum": ["subsidy", "loan", "tax", "enforcement_defense", "invoice", "ebook"]}, "type": "array", "maxItems": 6, "minItems": 1, "title": "Specialties"}, "industries": {"anyOf": [{"items": {"type": "string", "enum": ["agri", "manufacture", "it", "service", "construction", "retail"]}, "type": "array", "maxItems": 6}, {"type": "null"}], "title": "Industries"}, "prefecture": {"type": "string", "title": "Prefecture", "description": "canonical ('東京都')"}, "city": {"anyOf": [{"type": "string", "maxLength": 100}, {"type": "null"}], "title": "City"}, "address": {"anyOf": [{"type": "string", "maxLength": 500}, {"type": "null"}], "title": "Address"}, "contact_url": {"anyOf": [{"type": "string", "maxLength": 2083, "minLength": 1, "format": "uri"}, {"type": "null"}], "title": "Contact Url"}, "contact_email": {"type": "string", "format": "email", "title": "Contact Email"}, "contact_phone": {"anyOf": [{"type": "string", "maxLength": 30}, {"type": "null"}], "title": "Contact Phone"}, "intro_blurb": {"anyOf": [{"type": "string", "maxLength": 400}, {"type": "null"}], "title": "Intro Blurb"}, "commission_model": {"type": "string", "enum": ["flat", "percent"], "title": "Commission Model", "default": "flat"}, "commission_rate_pct": {"type": "integer", "maximum": 30.0, "minimum": 1.0, "title": "Commission Rate Pct", "default": 5}, "commission_yen_per_intro": {"type": "integer", "maximum": 100000.0, "minimum": 100.0, "title": "Commission Yen Per Intro", "default": 3000}, "agreed_to_terms": {"type": "boolean", "title": "Agreed To Terms", "description": "must be true"}}, "additionalProperties": false, "type": "object", "required": ["firm_name", "houjin_bangou", "firm_type", "specialties", "prefecture", "contact_email", "agreed_to_terms"], "title": "SignupRequest"}, "jpintel_mcp__api__advisors__SignupResponse": {"properties": {"advisor_id": {"type": "integer", "title": "Advisor Id"}, "next_step": {"type": "string", "const": "stripe_connect", "title": "Next Step", "default": "stripe_connect"}, "stripe_connect_onboarding_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Stripe Connect Onboarding Url", "description": "Returned when STRIPE_SECRET_KEY is set. Null in dev/offline mode — the signup row is still created so the advisor can retry onboarding."}}, "additionalProperties": false, "type": "object", "required": ["advisor_id"], "title": "SignupResponse"}, "jpintel_mcp__api__alerts__SubscribeRequest": {"properties": {"filter_type": {"type": "string", "enum": ["tool", "law_id", "program_id", "industry_jsic", "all"], "title": "Filter Type"}, "filter_value": {"anyOf": [{"type": "string", "maxLength": 256}, {"type": "null"}], "title": "Filter Value"}, "min_severity": {"type": "string", "enum": ["critical", "important", "info"], "title": "Min Severity", "default": "important"}, "webhook_url": {"anyOf": [{"type": "string", "maxLength": 2048}, {"type": "null"}], "title": "Webhook Url"}, "email": {"anyOf": [{"type": "string", "format": "email"}, {"type": "null"}], "title": "Email"}}, "type": "object", "required": ["filter_type"], "title": "SubscribeRequest"}, "jpintel_mcp__api__billing__CheckoutRequest": {"properties": {"success_url": {"type": "string", "title": "Success Url"}, "cancel_url": {"type": "string", "title": "Cancel Url"}, "customer_email": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Customer Email"}}, "type": "object", "required": ["success_url", "cancel_url"], "title": "CheckoutRequest"}, "jpintel_mcp__api__client_profiles__DeleteResponse": {"properties": {"ok": {"type": "boolean", "title": "Ok"}, "profile_id": {"type": "integer", "title": "Profile Id"}}, "type": "object", "required": ["ok", "profile_id"], "title": "DeleteResponse"}, "jpintel_mcp__api__compliance__CheckoutRequest": {"properties": {"subscriber_id": {"type": "integer", "title": "Subscriber Id"}, "success_url": {"type": "string", "title": "Success Url", "default": "https://jpcite.com/alerts.html?status=ok"}, "cancel_url": {"type": "string", "title": "Cancel Url", "default": "https://jpcite.com/alerts.html?status=canceled"}}, "type": "object", "required": ["subscriber_id"], "title": "CheckoutRequest"}, "jpintel_mcp__api__compliance__CheckoutResponse": {"properties": {"url": {"type": "string", "title": "Url"}, "session_id": {"type": "string", "title": "Session Id"}}, "type": "object", "required": ["url", "session_id"], "title": "CheckoutResponse"}, "jpintel_mcp__api__compliance__SubscribeRequest": {"properties": {"email": {"type": "string", "format": "email", "title": "Email"}, "houjin_bangou": {"anyOf": [{"type": "string", "maxLength": 13, "minLength": 13}, {"type": "null"}], "title": "Houjin Bangou"}, "industry_codes": {"items": {"type": "string"}, "type": "array", "maxItems": 12, "title": "Industry Codes"}, "areas_of_interest": {"items": {"type": "string"}, "type": "array", "maxItems": 7, "minItems": 1, "title": "Areas Of Interest"}, "prefecture": {"anyOf": [{"type": "string", "maxLength": 16}, {"type": "null"}], "title": "Prefecture"}, "plan": {"type": "string", "enum": ["free", "paid"], "title": "Plan", "default": "free"}, "source_lang": {"type": "string", "enum": ["ja", "en"], "title": "Source Lang", "default": "ja"}}, "type": "object", "required": ["email", "areas_of_interest"], "title": "SubscribeRequest"}, "jpintel_mcp__api__compliance__SubscribeResponse": {"properties": {"subscriber_id": {"type": "integer", "title": "Subscriber Id"}, "next_step": {"type": "string", "enum": ["verify", "checkout"], "title": "Next Step"}, "checkout_url": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Checkout Url"}}, "type": "object", "required": ["subscriber_id", "next_step"], "title": "SubscribeResponse"}, "jpintel_mcp__api__customer_webhooks__DeleteResponse": {"properties": {"ok": {"type": "boolean", "title": "Ok"}, "id": {"type": "integer", "title": "Id"}}, "type": "object", "required": ["ok", "id"], "title": "DeleteResponse"}, "jpintel_mcp__api__invoice_registrants__SearchResponse": {"properties": {"total": {"type": "integer", "title": "Total"}, "limit": {"type": "integer", "title": "Limit"}, "offset": {"type": "integer", "title": "Offset"}, "results": {"items": {"$ref": "#/components/schemas/InvoiceRegistrantOut"}, "type": "array", "title": "Results"}, "attribution": {"$ref": "#/components/schemas/AttributionBlock"}}, "additionalProperties": false, "type": "object", "required": ["total", "limit", "offset", "results", "attribution"], "title": "SearchResponse"}, "jpintel_mcp__api__me__UsageDay": {"properties": {"date": {"type": "string", "title": "Date"}, "calls": {"type": "integer", "title": "Calls"}}, "type": "object", "required": ["date", "calls"], "title": "UsageDay"}, "jpintel_mcp__api__saved_searches__DeleteResponse": {"properties": {"ok": {"type": "boolean", "title": "Ok"}, "id": {"type": "integer", "title": "Id"}}, "type": "object", "required": ["ok", "id"], "title": "DeleteResponse"}, "jpintel_mcp__api__signup__SignupRequest": {"properties": {"email": {"type": "string", "format": "email", "title": "Email", "description": "Reachable email address — a magic-link verification mail is sent here. (連絡可能なメールアドレス。マジックリンクが届きます。)"}}, "type": "object", "required": ["email"], "title": "SignupRequest"}, "jpintel_mcp__api__signup__SignupResponse": {"properties": {"accepted": {"type": "boolean", "title": "Accepted", "default": true}, "detail": {"type": "string", "title": "Detail", "default": "メールに記載されたリンクをクリックすると API キーが発行されます。リンクの有効期限は 24 時間です。"}}, "type": "object", "title": "SignupResponse", "description": "202 Accepted body.\n\nWe deliberately do NOT echo the email back — it's already in the\nrequest. Returning a stable shape with a request_id-equivalent makes\nit easy for the homepage form to confirm \"we got it\" without leaking\nthe dedup state (a 409 vs 202 distinction would let an attacker probe\nfor whether a given address has already used its trial)."}, "jpintel_mcp__api__subscribers__SubscribeRequest": {"properties": {"email": {"type": "string", "format": "email", "title": "Email"}, "source": {"anyOf": [{"type": "string", "maxLength": 64}, {"type": "null"}], "title": "Source"}}, "type": "object", "required": ["email"], "title": "SubscribeRequest"}, "jpintel_mcp__api__subscribers__SubscribeResponse": {"properties": {"subscribed": {"type": "boolean", "title": "Subscribed"}}, "type": "object", "required": ["subscribed"], "title": "SubscribeResponse"}, "jpintel_mcp__models__SearchResponse": {"properties": {"total": {"type": "integer", "title": "Total"}, "limit": {"type": "integer", "title": "Limit"}, "offset": {"type": "integer", "title": "Offset"}, "results": {"items": {"$ref": "#/components/schemas/Program"}, "type": "array", "title": "Results"}}, "type": "object", "required": ["total", "limit", "offset", "results"], "title": "SearchResponse"}}, "securitySchemes": {"ApiKeyAuth": {"type": "apiKey", "in": "header", "name": "X-API-Key", "description": "Customer API key issued via Stripe Checkout. Anonymous tier (no key) gets 50 req/月 per IP."}}}, "servers": [{"url": "https://api.jpcite.com", "description": "Production"}, {"url": "http://localhost:8080", "description": "Local development"}], "security": [{"ApiKeyAuth": []}]}