{
  "components": {
    "schemas": {
      "AMActiveAtResponse": {
        "additionalProperties": true,
        "description": "``GET /v1/am/active_at`` — paginated list with the snapshot date.",
        "properties": {
          "error": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "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.",
            "title": "Error"
          },
          "limit": {
            "description": "Page size echoed from the request.",
            "title": "Limit",
            "type": "integer"
          },
          "meta": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional envelope: alternative_intents, retrieval_note, next_cursor, advisory hints. Wired by L5.",
            "title": "Meta"
          },
          "offset": {
            "description": "Page offset echoed from the request.",
            "title": "Offset",
            "type": "integer"
          },
          "pivot_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pivot Date"
          },
          "results": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Results",
            "type": "array"
          },
          "retrieval_note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "One-line provenance hint, e.g. 'fts5_trigram + LIKE fallback (3 rows from 285)'.",
            "title": "Retrieval Note"
          },
          "total": {
            "description": "Total candidate rows before paging.",
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "total",
          "limit",
          "offset"
        ],
        "title": "AMActiveAtResponse",
        "type": "object"
      },
      "AMAnnotationsResponse": {
        "additionalProperties": true,
        "description": "``GET /v1/am/annotations/{entity_id}`` — examiner / quality / ML notes.",
        "properties": {
          "entity_id": {
            "title": "Entity Id",
            "type": "string"
          },
          "error": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "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.",
            "title": "Error"
          },
          "filters": {
            "additionalProperties": true,
            "title": "Filters",
            "type": "object"
          },
          "limit": {
            "description": "Page size echoed from the request.",
            "title": "Limit",
            "type": "integer"
          },
          "meta": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional envelope: alternative_intents, retrieval_note, next_cursor, advisory hints. Wired by L5.",
            "title": "Meta"
          },
          "offset": {
            "description": "Page offset echoed from the request.",
            "title": "Offset",
            "type": "integer"
          },
          "results": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Results",
            "type": "array"
          },
          "retrieval_note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "One-line provenance hint, e.g. 'fts5_trigram + LIKE fallback (3 rows from 285)'.",
            "title": "Retrieval Note"
          },
          "total": {
            "description": "Total candidate rows before paging.",
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "total",
          "limit",
          "offset",
          "entity_id"
        ],
        "title": "AMAnnotationsResponse",
        "type": "object"
      },
      "AMByLawResponse": {
        "additionalProperties": true,
        "description": "``GET /v1/am/by_law`` — adds the alias-resolution debug field.",
        "properties": {
          "error": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "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.",
            "title": "Error"
          },
          "law_aliases_tried": {
            "description": "Fuzzy-match alias attempts tried before settling on a hit.",
            "items": {
              "type": "string"
            },
            "title": "Law Aliases Tried",
            "type": "array"
          },
          "limit": {
            "description": "Page size echoed from the request.",
            "title": "Limit",
            "type": "integer"
          },
          "meta": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional envelope: alternative_intents, retrieval_note, next_cursor, advisory hints. Wired by L5.",
            "title": "Meta"
          },
          "offset": {
            "description": "Page offset echoed from the request.",
            "title": "Offset",
            "type": "integer"
          },
          "results": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Results",
            "type": "array"
          },
          "retrieval_note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "One-line provenance hint, e.g. 'fts5_trigram + LIKE fallback (3 rows from 285)'.",
            "title": "Retrieval Note"
          },
          "total": {
            "description": "Total candidate rows before paging.",
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "total",
          "limit",
          "offset"
        ],
        "title": "AMByLawResponse",
        "type": "object"
      },
      "AMEnforcementCheckResponse": {
        "additionalProperties": true,
        "description": "``GET /v1/am/enforcement`` — 排除期間チェック result.",
        "properties": {
          "active_exclusions": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Active Exclusions",
            "type": "array"
          },
          "all_count": {
            "default": 0,
            "title": "All Count",
            "type": "integer"
          },
          "currently_excluded": {
            "default": false,
            "title": "Currently Excluded",
            "type": "boolean"
          },
          "error": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "found": {
            "default": false,
            "title": "Found",
            "type": "boolean"
          },
          "queried": {
            "additionalProperties": true,
            "title": "Queried",
            "type": "object"
          },
          "recent_history": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Recent History",
            "type": "array"
          }
        },
        "title": "AMEnforcementCheckResponse",
        "type": "object"
      },
      "AMEnumValuesResponse": {
        "additionalProperties": true,
        "description": "``GET /v1/am/enums/{enum_name}`` — distinct values + counts for an enum.",
        "properties": {
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "enum_name": {
            "title": "Enum Name",
            "type": "string"
          },
          "error": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "frequency_map": {
            "additionalProperties": {
              "type": "integer"
            },
            "title": "Frequency Map",
            "type": "object"
          },
          "last_updated": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Updated"
          },
          "values": {
            "items": {
              "type": "string"
            },
            "title": "Values",
            "type": "array"
          }
        },
        "required": [
          "enum_name"
        ],
        "title": "AMEnumValuesResponse",
        "type": "object"
      },
      "AMIntentResponse": {
        "additionalProperties": true,
        "description": "``GET /v1/am/intent`` — natural-language → tool routing.",
        "properties": {
          "all_scores": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "All Scores",
            "type": "array"
          },
          "confidence": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Confidence"
          },
          "error": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "intent_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Intent Id"
          },
          "intent_name_ja": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Intent Name Ja"
          },
          "sample_queries": {
            "items": {
              "type": "string"
            },
            "title": "Sample Queries",
            "type": "array"
          }
        },
        "title": "AMIntentResponse",
        "type": "object"
      },
      "AMLawArticleResponse": {
        "additionalProperties": true,
        "description": "``GET /v1/am/law_article`` — 条文 lookup.",
        "properties": {
          "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"
          },
          "effective_from": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Effective From"
          },
          "effective_until": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Effective Until"
          },
          "error": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "found": {
            "default": false,
            "title": "Found",
            "type": "boolean"
          },
          "last_amended": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Amended"
          },
          "law": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Law"
          },
          "source_fetched_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Fetched At"
          },
          "source_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Url"
          },
          "text_full": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Text Full"
          },
          "text_summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Text Summary"
          },
          "title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Title"
          }
        },
        "title": "AMLawArticleResponse",
        "type": "object"
      },
      "AMLoanSearchResponse": {
        "additionalProperties": true,
        "description": "``GET /v1/am/loans`` / ``mutual_plans`` — three-axis loan/共済 search.",
        "properties": {
          "error": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "limit": {
            "default": 10,
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "default": 0,
            "title": "Offset",
            "type": "integer"
          },
          "result_count": {
            "default": 0,
            "title": "Result Count",
            "type": "integer"
          },
          "results": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Results",
            "type": "array"
          },
          "total": {
            "default": 0,
            "title": "Total",
            "type": "integer"
          }
        },
        "title": "AMLoanSearchResponse",
        "type": "object"
      },
      "AMOpenProgramsResponse": {
        "additionalProperties": true,
        "description": "``GET /v1/am/open_programs`` — adds ``pivot_date`` (the date the snapshot\nwas taken on, defaulting to today).",
        "properties": {
          "error": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "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.",
            "title": "Error"
          },
          "limit": {
            "description": "Page size echoed from the request.",
            "title": "Limit",
            "type": "integer"
          },
          "meta": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional envelope: alternative_intents, retrieval_note, next_cursor, advisory hints. Wired by L5.",
            "title": "Meta"
          },
          "offset": {
            "description": "Page offset echoed from the request.",
            "title": "Offset",
            "type": "integer"
          },
          "pivot_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "ISO YYYY-MM-DD of the snapshot date.",
            "title": "Pivot Date"
          },
          "results": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Results",
            "type": "array"
          },
          "retrieval_note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "One-line provenance hint, e.g. 'fts5_trigram + LIKE fallback (3 rows from 285)'.",
            "title": "Retrieval Note"
          },
          "total": {
            "description": "Total candidate rows before paging.",
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "total",
          "limit",
          "offset"
        ],
        "title": "AMOpenProgramsResponse",
        "type": "object"
      },
      "AMProvenanceResponse": {
        "additionalProperties": true,
        "description": "``GET /v1/am/provenance/{entity_id}`` and the per-fact variant.",
        "properties": {
          "error": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "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.",
            "title": "Error"
          },
          "limit": {
            "description": "Page size echoed from the request.",
            "title": "Limit",
            "type": "integer"
          },
          "meta": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional envelope: alternative_intents, retrieval_note, next_cursor, advisory hints. Wired by L5.",
            "title": "Meta"
          },
          "offset": {
            "description": "Page offset echoed from the request.",
            "title": "Offset",
            "type": "integer"
          },
          "results": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Results",
            "type": "array"
          },
          "retrieval_note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "One-line provenance hint, e.g. 'fts5_trigram + LIKE fallback (3 rows from 285)'.",
            "title": "Retrieval Note"
          },
          "total": {
            "description": "Total candidate rows before paging.",
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "total",
          "limit",
          "offset"
        ],
        "title": "AMProvenanceResponse",
        "type": "object"
      },
      "AMReasonResponse": {
        "additionalProperties": true,
        "description": "``GET /v1/am/reason`` — citation-backed narrative answer.",
        "properties": {
          "answer_skeleton": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Answer Skeleton"
          },
          "confidence": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Confidence"
          },
          "db_bind_notes": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Db Bind Notes"
          },
          "db_bind_ok": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Db Bind Ok"
          },
          "error": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "filters_extracted": {
            "additionalProperties": true,
            "title": "Filters Extracted",
            "type": "object"
          },
          "intent": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Intent"
          },
          "intent_name_ja": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Intent Name Ja"
          },
          "missing_data": {
            "items": {
              "type": "string"
            },
            "title": "Missing Data",
            "type": "array"
          },
          "persona_hint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Persona Hint"
          },
          "precompute_gaps": {
            "items": {
              "type": "string"
            },
            "title": "Precompute Gaps",
            "type": "array"
          },
          "retry_with": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Retry With"
          },
          "source_urls": {
            "items": {
              "type": "string"
            },
            "title": "Source Urls",
            "type": "array"
          }
        },
        "title": "AMReasonResponse",
        "type": "object"
      },
      "AMRelatedResponse": {
        "additionalProperties": true,
        "description": "``GET /v1/am/related/{program_id}`` — graph walk over am_relation.",
        "properties": {
          "depth": {
            "default": 1,
            "title": "Depth",
            "type": "integer"
          },
          "error": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "hint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hint"
          },
          "nodes": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Nodes",
            "type": "array"
          },
          "relations": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Relations",
            "type": "array"
          },
          "retry_with": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Retry With"
          },
          "seed_id": {
            "title": "Seed Id",
            "type": "string"
          },
          "seed_kind": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Seed Kind"
          },
          "total_edges": {
            "default": 0,
            "title": "Total Edges",
            "type": "integer"
          }
        },
        "required": [
          "seed_id"
        ],
        "title": "AMRelatedResponse",
        "type": "object"
      },
      "AMSearchResponse": {
        "additionalProperties": true,
        "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.",
        "properties": {
          "error": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "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.",
            "title": "Error"
          },
          "limit": {
            "description": "Page size echoed from the request.",
            "title": "Limit",
            "type": "integer"
          },
          "meta": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional envelope: alternative_intents, retrieval_note, next_cursor, advisory hints. Wired by L5.",
            "title": "Meta"
          },
          "offset": {
            "description": "Page offset echoed from the request.",
            "title": "Offset",
            "type": "integer"
          },
          "results": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Results",
            "type": "array"
          },
          "retrieval_note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "One-line provenance hint, e.g. 'fts5_trigram + LIKE fallback (3 rows from 285)'.",
            "title": "Retrieval Note"
          },
          "total": {
            "description": "Total candidate rows before paging.",
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "total",
          "limit",
          "offset"
        ],
        "title": "AMSearchResponse",
        "type": "object"
      },
      "AMSimpleSearchResponse": {
        "additionalProperties": true,
        "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.",
        "properties": {
          "error": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "results": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Results",
            "type": "array"
          },
          "total": {
            "default": 0,
            "title": "Total",
            "type": "integer"
          }
        },
        "title": "AMSimpleSearchResponse",
        "type": "object"
      },
      "AMTaxRuleResponse": {
        "additionalProperties": true,
        "description": "``GET /v1/am/tax_rule`` — single-measure tax rule lookup.",
        "properties": {
          "error": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "results": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Results",
            "type": "array"
          },
          "total": {
            "default": 0,
            "title": "Total",
            "type": "integer"
          }
        },
        "title": "AMTaxRuleResponse",
        "type": "object"
      },
      "AMValidateResponse": {
        "additionalProperties": true,
        "description": "``POST /v1/am/validate`` — generic intake validator output.",
        "properties": {
          "applicant_hash": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Applicant Hash"
          },
          "entity_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Entity Id"
          },
          "error": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "results": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Results",
            "type": "array"
          },
          "scope": {
            "default": "intake",
            "title": "Scope",
            "type": "string"
          },
          "summary": {
            "additionalProperties": true,
            "title": "Summary",
            "type": "object"
          },
          "total": {
            "default": 0,
            "title": "Total",
            "type": "integer"
          }
        },
        "title": "AMValidateResponse",
        "type": "object"
      },
      "AdvisorDashboardReferral": {
        "additionalProperties": true,
        "properties": {
          "clicked_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Clicked At"
          },
          "commission_paid_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Commission Paid At"
          },
          "commission_yen": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Commission Yen"
          },
          "conversion_value_yen": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Conversion Value Yen"
          },
          "converted_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Converted At"
          },
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "source_program_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Program Id"
          },
          "token_prefix": {
            "title": "Token Prefix",
            "type": "string"
          }
        },
        "required": [
          "id",
          "token_prefix"
        ],
        "title": "AdvisorDashboardReferral",
        "type": "object"
      },
      "AdvisorDashboardResponse": {
        "additionalProperties": true,
        "properties": {
          "advisor": {
            "additionalProperties": true,
            "title": "Advisor",
            "type": "object"
          },
          "referrals": {
            "items": {
              "$ref": "#/components/schemas/AdvisorDashboardReferral"
            },
            "title": "Referrals",
            "type": "array"
          },
          "summary": {
            "$ref": "#/components/schemas/AdvisorDashboardSummary"
          }
        },
        "required": [
          "advisor",
          "summary"
        ],
        "title": "AdvisorDashboardResponse",
        "type": "object"
      },
      "AdvisorDashboardSummary": {
        "additionalProperties": true,
        "properties": {
          "clicks": {
            "default": 0,
            "title": "Clicks",
            "type": "integer"
          },
          "conversions": {
            "default": 0,
            "title": "Conversions",
            "type": "integer"
          },
          "paid_yen": {
            "default": 0,
            "title": "Paid Yen",
            "type": "integer"
          },
          "unpaid_yen": {
            "default": 0,
            "title": "Unpaid Yen",
            "type": "integer"
          }
        },
        "title": "AdvisorDashboardSummary",
        "type": "object"
      },
      "AdvisorOut": {
        "additionalProperties": false,
        "description": "Public-facing advisor row. Excludes internal-only columns\n(stripe_connect_account_id, disabled_reason, raw success_count math).",
        "properties": {
          "address": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Address"
          },
          "city": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "City"
          },
          "commission_model": {
            "default": "flat",
            "enum": [
              "flat",
              "percent"
            ],
            "title": "Commission Model",
            "type": "string"
          },
          "commission_rate_pct": {
            "default": 5,
            "title": "Commission Rate Pct",
            "type": "integer"
          },
          "commission_yen_per_intro": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "default": 3000,
            "title": "Commission Yen Per Intro"
          },
          "contact_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Contact Email"
          },
          "contact_phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Contact Phone"
          },
          "contact_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Contact Url"
          },
          "firm_name": {
            "title": "Firm Name",
            "type": "string"
          },
          "firm_name_kana": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Firm Name Kana"
          },
          "firm_type": {
            "enum": [
              "税理士法人",
              "認定支援機関",
              "社会保険労務士",
              "中小企業診断士",
              "行政書士",
              "弁護士",
              "銀行",
              "商工会議所",
              "その他"
            ],
            "title": "Firm Type",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "industries": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Industries"
          },
          "intro_blurb": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Intro Blurb"
          },
          "prefecture": {
            "title": "Prefecture",
            "type": "string"
          },
          "specialties": {
            "items": {
              "type": "string"
            },
            "title": "Specialties",
            "type": "array"
          },
          "success_count": {
            "default": 0,
            "title": "Success Count",
            "type": "integer"
          },
          "verified_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Verified At"
          }
        },
        "required": [
          "id",
          "firm_name",
          "firm_type",
          "specialties",
          "prefecture"
        ],
        "title": "AdvisorOut",
        "type": "object"
      },
      "AttributionBlock": {
        "additionalProperties": false,
        "description": "PDL v1.0 attribution (出典明記 + 編集・加工注記).",
        "properties": {
          "edited": {
            "title": "Edited",
            "type": "boolean"
          },
          "license": {
            "title": "License",
            "type": "string"
          },
          "notice": {
            "title": "Notice",
            "type": "string"
          },
          "source": {
            "title": "Source",
            "type": "string"
          },
          "source_url": {
            "title": "Source Url",
            "type": "string"
          }
        },
        "required": [
          "source",
          "source_url",
          "license",
          "edited",
          "notice"
        ],
        "title": "AttributionBlock",
        "type": "object"
      },
      "AuthorizeRequest": {
        "properties": {
          "client_id": {
            "default": "autonomath-mcp",
            "title": "Client Id",
            "type": "string"
          },
          "scope": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": "api:read api:metered",
            "description": "Space-delimited scopes. Defaults to 'api:read api:metered'.",
            "title": "Scope"
          }
        },
        "title": "AuthorizeRequest",
        "type": "object"
      },
      "AuthorizeResponse": {
        "properties": {
          "device_code": {
            "title": "Device Code",
            "type": "string"
          },
          "expires_in": {
            "title": "Expires In",
            "type": "integer"
          },
          "interval": {
            "title": "Interval",
            "type": "integer"
          },
          "user_code": {
            "title": "User Code",
            "type": "string"
          },
          "verification_uri": {
            "title": "Verification Uri",
            "type": "string"
          },
          "verification_uri_complete": {
            "title": "Verification Uri Complete",
            "type": "string"
          }
        },
        "required": [
          "device_code",
          "user_code",
          "verification_uri",
          "verification_uri_complete",
          "expires_in",
          "interval"
        ],
        "title": "AuthorizeResponse",
        "type": "object"
      },
      "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.",
        "properties": {
          "unified_ids": {
            "items": {
              "type": "string"
            },
            "maxItems": 50,
            "minItems": 1,
            "title": "Unified Ids",
            "type": "array"
          }
        },
        "required": [
          "unified_ids"
        ],
        "title": "BatchGetProgramsRequest",
        "type": "object"
      },
      "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.",
        "properties": {
          "not_found": {
            "items": {
              "type": "string"
            },
            "title": "Not Found",
            "type": "array"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/ProgramDetail"
            },
            "title": "Results",
            "type": "array"
          }
        },
        "required": [
          "results",
          "not_found"
        ],
        "title": "BatchGetProgramsResponse",
        "type": "object"
      },
      "BidOut": {
        "additionalProperties": false,
        "description": "Single 入札 row. Columns map 1:1 onto 017_bids.sql's `bids` table.",
        "properties": {
          "announcement_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Announcement date / 公告日 (ISO 8601 YYYY-MM-DD).",
            "title": "Announcement Date"
          },
          "awarded_amount_yen": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Awarded amount (落札金額) in JPY, tax-inclusive when disclosed.",
            "title": "Awarded Amount Yen"
          },
          "bid_deadline": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Bid-submission deadline / 入札書提出期限 (ISO 8601 YYYY-MM-DD).",
            "title": "Bid Deadline"
          },
          "bid_description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Procurement scope / specification summary (調達概要 / 仕様要旨).",
            "title": "Bid Description"
          },
          "bid_kind": {
            "description": "Bid procedure kind. open = 一般競争 (open competitive); selective = 指名競争 (selective tender); negotiated = 随意契約 (negotiated contract); kobo_subsidy = 公募型補助 (subsidy-style open call).",
            "enum": [
              "open",
              "selective",
              "negotiated",
              "kobo_subsidy"
            ],
            "title": "Bid Kind",
            "type": "string"
          },
          "bid_title": {
            "description": "Bid title (案件名) — short headline as published by the procuring entity.",
            "title": "Bid Title",
            "type": "string"
          },
          "budget_ceiling_yen": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Budget ceiling / contract cap (予定価格 / 契約限度額) in JPY, tax-inclusive when disclosed by the procuring entity.",
            "title": "Budget Ceiling Yen"
          },
          "classification_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "'役務' | '物品' | '工事' (or finer JGS code)",
            "title": "Classification Code"
          },
          "confidence": {
            "description": "0..1 lineage confidence",
            "title": "Confidence",
            "type": "number"
          },
          "decision_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Award-decision date / 落札決定日 (ISO 8601 YYYY-MM-DD).",
            "title": "Decision Date"
          },
          "eligibility_conditions": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Participation eligibility conditions (参加資格要件) — grade rating / location / past-performance requirements.",
            "title": "Eligibility Conditions"
          },
          "fetched_at": {
            "description": "ISO 8601 UTC of last successful fetch",
            "title": "Fetched At",
            "type": "string"
          },
          "ministry": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Ministry / agency in charge (所管府省) — e.g. 農林水産省, 経済産業省.",
            "title": "Ministry"
          },
          "participant_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Number of participating bidders (入札参加者数).",
            "title": "Participant Count"
          },
          "prefecture": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Prefecture (都道府県) — full-suffix kanji form, e.g. 東京都. NULL for nationwide bids.",
            "title": "Prefecture"
          },
          "procuring_entity": {
            "description": "Procuring entity name (発注機関名) — ministry / agency / 自治体 issuing the tender.",
            "title": "Procuring Entity",
            "type": "string"
          },
          "procuring_houjin_bangou": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "13-digit 法人番号 of the procuring entity (soft ref to houjin_master).",
            "title": "Procuring Houjin Bangou"
          },
          "program_id_hint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Soft reference to programs.unified_id when this bid is the procurement arm of a funded 補助事業.",
            "title": "Program Id Hint"
          },
          "question_deadline": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Question-submission deadline / 質問受付期限 (ISO 8601 YYYY-MM-DD).",
            "title": "Question Deadline"
          },
          "source_checksum": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "optional SHA-256 of raw fetch body",
            "title": "Source Checksum"
          },
          "source_excerpt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "relevant passage for audit",
            "title": "Source Excerpt"
          },
          "source_url": {
            "description": "primary source (GEPS / ministry / *.lg.jp)",
            "title": "Source Url",
            "type": "string"
          },
          "unified_id": {
            "description": "BID-<10 lowercase hex>",
            "title": "Unified Id",
            "type": "string"
          },
          "updated_at": {
            "description": "ISO 8601 UTC of last row write",
            "title": "Updated At",
            "type": "string"
          },
          "winner_houjin_bangou": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "13-digit 法人番号 of the winning bidder (soft ref to houjin_master).",
            "title": "Winner Houjin Bangou"
          },
          "winner_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Winning bidder name (落札者名) — as published by the procuring entity.",
            "title": "Winner Name"
          }
        },
        "required": [
          "unified_id",
          "bid_title",
          "bid_kind",
          "procuring_entity",
          "source_url",
          "confidence",
          "fetched_at",
          "updated_at"
        ],
        "title": "BidOut",
        "type": "object"
      },
      "BidsSearchResponse": {
        "additionalProperties": false,
        "properties": {
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/BidOut"
            },
            "title": "Results",
            "type": "array"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "total",
          "limit",
          "offset",
          "results"
        ],
        "title": "BidsSearchResponse",
        "type": "object"
      },
      "BillingHistoryResponse": {
        "properties": {
          "cached_at": {
            "title": "Cached At",
            "type": "string"
          },
          "customer_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Customer Id"
          },
          "invoices": {
            "items": {
              "$ref": "#/components/schemas/BillingInvoice"
            },
            "title": "Invoices",
            "type": "array"
          }
        },
        "required": [
          "invoices",
          "cached_at",
          "customer_id"
        ],
        "title": "BillingHistoryResponse",
        "type": "object"
      },
      "BillingInvoice": {
        "properties": {
          "amount_due_yen": {
            "title": "Amount Due Yen",
            "type": "integer"
          },
          "amount_paid_yen": {
            "title": "Amount Paid Yen",
            "type": "integer"
          },
          "created": {
            "title": "Created",
            "type": "string"
          },
          "currency": {
            "title": "Currency",
            "type": "string"
          },
          "hosted_invoice_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hosted Invoice Url"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "invoice_pdf": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Invoice Pdf"
          },
          "number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Number"
          },
          "period_end": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Period End"
          },
          "period_start": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Period Start"
          },
          "status": {
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "id",
          "number",
          "period_start",
          "period_end",
          "amount_due_yen",
          "amount_paid_yen",
          "currency",
          "status",
          "hosted_invoice_url",
          "invoice_pdf",
          "created"
        ],
        "title": "BillingInvoice",
        "type": "object"
      },
      "BillingPortalResponse": {
        "properties": {
          "url": {
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "url"
        ],
        "title": "BillingPortalResponse",
        "type": "object"
      },
      "Body_rest_validate_v1_am_validate_post": {
        "properties": {
          "applicant_data": {
            "additionalProperties": true,
            "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.",
            "title": "Applicant Data",
            "type": "object"
          },
          "entity_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional am_entities.canonical_id. Filters rules pinned via scope_entity_id and is part of the cache key.",
            "title": "Entity Id"
          },
          "scope": {
            "default": "intake",
            "description": "applies_to scope. Default 'intake' selects the 6 generic predicates ported from autonomath.intake_consistency_rules.",
            "title": "Scope",
            "type": "string"
          }
        },
        "required": [
          "applicant_data"
        ],
        "title": "Body_rest_validate_v1_am_validate_post",
        "type": "object"
      },
      "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.",
        "properties": {
          "monthly_cap_yen": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "JPY hard cap for the calendar month. NULL = unlimited. Once reached, requests return 503 with cap_reached=true until JST 月初.",
            "title": "Monthly Cap Yen"
          }
        },
        "title": "CapRequest",
        "type": "object"
      },
      "CapResponse": {
        "properties": {
          "monthly_cap_yen": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Monthly Cap Yen"
          },
          "ok": {
            "title": "Ok",
            "type": "boolean"
          }
        },
        "required": [
          "ok",
          "monthly_cap_yen"
        ],
        "title": "CapResponse",
        "type": "object"
      },
      "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.",
        "properties": {
          "capital_yen": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Capital Yen"
          },
          "case_id": {
            "title": "Case Id",
            "type": "string"
          },
          "case_summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Case Summary"
          },
          "case_title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Case Title"
          },
          "company_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Company Name"
          },
          "confidence": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Confidence"
          },
          "employees": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Employees"
          },
          "fetched_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fetched At"
          },
          "founded_year": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Founded Year"
          },
          "houjin_bangou": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Houjin Bangou"
          },
          "industry_jsic": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Industry Jsic"
          },
          "industry_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Industry Name"
          },
          "is_sole_proprietor": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Sole Proprietor"
          },
          "municipality": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Municipality"
          },
          "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"
          },
          "prefecture": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Prefecture"
          },
          "programs_used": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Programs Used",
            "type": "array"
          },
          "publication_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Publication Date"
          },
          "source_excerpt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Excerpt"
          },
          "source_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Url"
          },
          "total_subsidy_received_yen": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Total Subsidy Received Yen"
          }
        },
        "required": [
          "case_id"
        ],
        "title": "CaseStudy",
        "type": "object"
      },
      "CaseStudySearchResponse": {
        "properties": {
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/CaseStudy"
            },
            "title": "Results",
            "type": "array"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "total",
          "limit",
          "offset",
          "results"
        ],
        "title": "CaseStudySearchResponse",
        "type": "object"
      },
      "CompleteRequest": {
        "properties": {
          "stripe_checkout_session_id": {
            "title": "Stripe Checkout Session Id",
            "type": "string"
          },
          "user_code": {
            "title": "User Code",
            "type": "string"
          }
        },
        "required": [
          "user_code",
          "stripe_checkout_session_id"
        ],
        "title": "CompleteRequest",
        "type": "object"
      },
      "CompleteResponse": {
        "properties": {
          "ok": {
            "title": "Ok",
            "type": "boolean"
          }
        },
        "required": [
          "ok"
        ],
        "title": "CompleteResponse",
        "type": "object"
      },
      "ConfidencePerToolRow": {
        "additionalProperties": true,
        "properties": {
          "by_cohort": {
            "additionalProperties": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "By Cohort",
            "type": "object"
          },
          "discovery": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Discovery"
          },
          "discovery_ci95": {
            "anyOf": [
              {
                "items": {
                  "type": "number"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Discovery Ci95"
          },
          "discovery_hits": {
            "default": 0,
            "title": "Discovery Hits",
            "type": "integer"
          },
          "discovery_trials": {
            "default": 0,
            "title": "Discovery Trials",
            "type": "integer"
          },
          "tool": {
            "title": "Tool",
            "type": "string"
          },
          "use": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Use"
          },
          "use_ci95": {
            "anyOf": [
              {
                "items": {
                  "type": "number"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Use Ci95"
          },
          "use_hits": {
            "default": 0,
            "title": "Use Hits",
            "type": "integer"
          },
          "use_trials": {
            "default": 0,
            "title": "Use Trials",
            "type": "integer"
          }
        },
        "required": [
          "tool"
        ],
        "title": "ConfidencePerToolRow",
        "type": "object"
      },
      "ConfidenceResponse": {
        "additionalProperties": true,
        "description": "``GET /v1/stats/confidence`` — Bayesian Discovery+Use posteriors.",
        "properties": {
          "generated_at": {
            "title": "Generated At",
            "type": "string"
          },
          "overall": {
            "additionalProperties": true,
            "title": "Overall",
            "type": "object"
          },
          "per_tool": {
            "items": {
              "$ref": "#/components/schemas/ConfidencePerToolRow"
            },
            "title": "Per Tool",
            "type": "array"
          },
          "since": {
            "title": "Since",
            "type": "string"
          },
          "until": {
            "title": "Until",
            "type": "string"
          },
          "window_days": {
            "title": "Window Days",
            "type": "integer"
          }
        },
        "required": [
          "window_days",
          "since",
          "until",
          "generated_at"
        ],
        "title": "ConfidenceResponse",
        "type": "object"
      },
      "CourtDecision": {
        "additionalProperties": true,
        "properties": {
          "case_name": {
            "title": "Case Name",
            "type": "string"
          },
          "case_number": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Case Number"
          },
          "confidence": {
            "default": 0.9,
            "title": "Confidence",
            "type": "number"
          },
          "court": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Court"
          },
          "court_level": {
            "enum": [
              "supreme",
              "high",
              "district",
              "summary",
              "family"
            ],
            "title": "Court Level",
            "type": "string"
          },
          "decision_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Decision Date"
          },
          "decision_type": {
            "enum": [
              "判決",
              "決定",
              "命令"
            ],
            "title": "Decision Type",
            "type": "string"
          },
          "fetched_at": {
            "title": "Fetched At",
            "type": "string"
          },
          "full_text_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Full Text Url"
          },
          "impact_on_business": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Impact On Business"
          },
          "key_ruling": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Key Ruling"
          },
          "parties_involved": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Parties Involved"
          },
          "pdf_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pdf Url"
          },
          "precedent_weight": {
            "default": "informational",
            "enum": [
              "binding",
              "persuasive",
              "informational"
            ],
            "title": "Precedent Weight",
            "type": "string"
          },
          "related_law_ids": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Related Law Ids",
            "type": "array"
          },
          "source_checksum": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Checksum"
          },
          "source_excerpt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Excerpt"
          },
          "source_url": {
            "title": "Source Url",
            "type": "string"
          },
          "subject_area": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Subject Area"
          },
          "unified_id": {
            "description": "HAN-<10 lowercase hex>",
            "title": "Unified Id",
            "type": "string"
          },
          "updated_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated At"
          }
        },
        "required": [
          "unified_id",
          "case_name",
          "court_level",
          "decision_type",
          "source_url",
          "fetched_at"
        ],
        "title": "CourtDecision",
        "type": "object"
      },
      "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.",
        "properties": {
          "article_citation": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "e.g. '第5条第2項'. Optional — omit for whole-law matches.",
            "title": "Article Citation"
          },
          "law_id": {
            "description": "LAW-<10 hex> unified_id",
            "title": "Law Id",
            "type": "string"
          },
          "limit": {
            "default": 20,
            "maximum": 100.0,
            "minimum": 1.0,
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "default": 0,
            "minimum": 0.0,
            "title": "Offset",
            "type": "integer"
          }
        },
        "required": [
          "law_id"
        ],
        "title": "CourtDecisionByStatuteRequest",
        "type": "object"
      },
      "CourtDecisionSearchResponse": {
        "properties": {
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/CourtDecision"
            },
            "title": "Results",
            "type": "array"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "total",
          "limit",
          "offset",
          "results"
        ],
        "title": "CourtDecisionSearchResponse",
        "type": "object"
      },
      "CoverageResponse": {
        "additionalProperties": true,
        "description": "``GET /v1/stats/coverage`` — dataset row counts.",
        "properties": {
          "bids": {
            "default": 0,
            "title": "Bids",
            "type": "integer"
          },
          "case_studies": {
            "default": 0,
            "title": "Case Studies",
            "type": "integer"
          },
          "court_decisions": {
            "default": 0,
            "title": "Court Decisions",
            "type": "integer"
          },
          "enforcement_cases": {
            "default": 0,
            "title": "Enforcement Cases",
            "type": "integer"
          },
          "exclusion_rules": {
            "default": 0,
            "title": "Exclusion Rules",
            "type": "integer"
          },
          "generated_at": {
            "title": "Generated At",
            "type": "string"
          },
          "invoice_registrants": {
            "default": 0,
            "title": "Invoice Registrants",
            "type": "integer"
          },
          "laws_jpintel": {
            "default": 0,
            "title": "Laws Jpintel",
            "type": "integer"
          },
          "loan_programs": {
            "default": 0,
            "title": "Loan Programs",
            "type": "integer"
          },
          "programs": {
            "default": 0,
            "title": "Programs",
            "type": "integer"
          },
          "tax_rulesets": {
            "default": 0,
            "title": "Tax Rulesets",
            "type": "integer"
          }
        },
        "required": [
          "generated_at"
        ],
        "title": "CoverageResponse",
        "type": "object"
      },
      "CreateSavedSearchRequest": {
        "properties": {
          "frequency": {
            "default": "daily",
            "enum": [
              "daily",
              "weekly"
            ],
            "title": "Frequency",
            "type": "string"
          },
          "name": {
            "maxLength": 128,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          },
          "notify_email": {
            "format": "email",
            "title": "Notify Email",
            "type": "string"
          },
          "query": {
            "$ref": "#/components/schemas/SavedSearchQuery"
          }
        },
        "required": [
          "name",
          "query",
          "notify_email"
        ],
        "title": "CreateSavedSearchRequest",
        "type": "object"
      },
      "DashboardSummary": {
        "description": "Top-level dashboard payload — sized for a single render pass.",
        "properties": {
          "cap_remaining_yen": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cap Remaining Yen"
          },
          "current_period_end": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Current Period End"
          },
          "days": {
            "title": "Days",
            "type": "integer"
          },
          "key_hash_prefix": {
            "title": "Key Hash Prefix",
            "type": "string"
          },
          "last_30_amount_yen": {
            "title": "Last 30 Amount Yen",
            "type": "integer"
          },
          "last_30_calls": {
            "title": "Last 30 Calls",
            "type": "integer"
          },
          "last_7_calls": {
            "title": "Last 7 Calls",
            "type": "integer"
          },
          "month_to_date_amount_yen": {
            "title": "Month To Date Amount Yen",
            "type": "integer"
          },
          "month_to_date_calls": {
            "title": "Month To Date Calls",
            "type": "integer"
          },
          "monthly_cap_yen": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Monthly Cap Yen"
          },
          "peak_day": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/jpintel_mcp__api__me__UsageDay"
              },
              {
                "type": "null"
              }
            ]
          },
          "series": {
            "items": {
              "$ref": "#/components/schemas/jpintel_mcp__api__me__UsageDay"
            },
            "title": "Series",
            "type": "array"
          },
          "subscription_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Subscription Status"
          },
          "tier": {
            "title": "Tier",
            "type": "string"
          },
          "today_calls": {
            "title": "Today Calls",
            "type": "integer"
          },
          "unit_price_yen": {
            "default": 3,
            "title": "Unit Price Yen",
            "type": "integer"
          }
        },
        "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",
        "type": "object"
      },
      "DataLineage": {
        "properties": {
          "last_fetched_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Fetched At"
          },
          "unique_checksums": {
            "default": 0,
            "title": "Unique Checksums",
            "type": "integer"
          }
        },
        "title": "DataLineage",
        "type": "object"
      },
      "DataQualityResponse": {
        "additionalProperties": true,
        "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.",
        "properties": {
          "cross_source_agreement": {
            "additionalProperties": true,
            "title": "Cross Source Agreement",
            "type": "object"
          },
          "fact_count_total": {
            "default": 0,
            "title": "Fact Count Total",
            "type": "integer"
          },
          "field_kind_breakdown": {
            "additionalProperties": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Field Kind Breakdown",
            "type": "object"
          },
          "freshness_buckets": {
            "additionalProperties": {
              "type": "integer"
            },
            "title": "Freshness Buckets",
            "type": "object"
          },
          "generated_at": {
            "title": "Generated At",
            "type": "string"
          },
          "label_histogram": {
            "additionalProperties": {
              "type": "integer"
            },
            "title": "Label Histogram",
            "type": "object"
          },
          "license_breakdown": {
            "additionalProperties": {
              "type": "integer"
            },
            "title": "License Breakdown",
            "type": "object"
          },
          "mean_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mean Score"
          },
          "model": {
            "default": "beta_posterior_v1",
            "title": "Model",
            "type": "string"
          }
        },
        "required": [
          "generated_at"
        ],
        "title": "DataQualityResponse",
        "type": "object"
      },
      "DeactivateResponse": {
        "properties": {
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "ok": {
            "title": "Ok",
            "type": "boolean"
          }
        },
        "required": [
          "ok",
          "id"
        ],
        "title": "DeactivateResponse",
        "type": "object"
      },
      "DeadlineEntry": {
        "additionalProperties": false,
        "description": "One program whose submission window ends within the query horizon.",
        "properties": {
          "amount_max_man_yen": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Amount Max Man Yen"
          },
          "application_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Where to send the applicant — aliases official_url.",
            "title": "Application Url"
          },
          "authority_level": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authority Level"
          },
          "days_remaining": {
            "description": "Whole days from today (UTC date) to end_date, inclusive of today.",
            "minimum": 0.0,
            "title": "Days Remaining",
            "type": "integer"
          },
          "end_date": {
            "description": "ISO YYYY-MM-DD of the next open-window close date.",
            "title": "End Date",
            "type": "string"
          },
          "prefecture": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Prefecture"
          },
          "primary_name": {
            "title": "Primary Name",
            "type": "string"
          },
          "tier": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tier"
          },
          "unified_id": {
            "title": "Unified Id",
            "type": "string"
          }
        },
        "required": [
          "unified_id",
          "primary_name",
          "tier",
          "authority_level",
          "prefecture",
          "end_date",
          "days_remaining",
          "amount_max_man_yen",
          "application_url"
        ],
        "title": "DeadlineEntry",
        "type": "object"
      },
      "DeadlinesResponse": {
        "additionalProperties": false,
        "properties": {
          "as_of": {
            "description": "Today's ISO date (UTC). Makes days_remaining reproducible.",
            "title": "As Of",
            "type": "string"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/DeadlineEntry"
            },
            "title": "Results",
            "type": "array"
          },
          "total": {
            "description": "Matching rows before `limit` was applied.",
            "title": "Total",
            "type": "integer"
          },
          "within_days": {
            "title": "Within Days",
            "type": "integer"
          }
        },
        "required": [
          "as_of",
          "within_days",
          "total",
          "results"
        ],
        "title": "DeadlinesResponse",
        "type": "object"
      },
      "DeepHealthResponse": {
        "additionalProperties": true,
        "description": "``GET /v1/am/health/deep`` — 10-check aggregate.",
        "properties": {
          "checks": {
            "additionalProperties": true,
            "title": "Checks",
            "type": "object"
          },
          "generated_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Generated At"
          },
          "status": {
            "description": "ok | degraded | unhealthy",
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "status"
        ],
        "title": "DeepHealthResponse",
        "type": "object"
      },
      "DeletionRequest": {
        "properties": {
          "deletion_reason": {
            "anyOf": [
              {
                "maxLength": 2000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Deletion Reason"
          },
          "identity_verification_method": {
            "enum": [
              "drivers_license",
              "my_number_card",
              "passport",
              "residence_card",
              "health_insurance_card",
              "other"
            ],
            "title": "Identity Verification Method",
            "type": "string"
          },
          "requester_email": {
            "format": "email",
            "title": "Requester Email",
            "type": "string"
          },
          "requester_legal_name": {
            "maxLength": 200,
            "minLength": 1,
            "title": "Requester Legal Name",
            "type": "string"
          },
          "target_data_categories": {
            "items": {
              "enum": [
                "representative",
                "address",
                "postal_code",
                "phone",
                "email",
                "company_url",
                "all_personal_data"
              ],
              "type": "string"
            },
            "maxItems": 7,
            "minItems": 1,
            "title": "Target Data Categories",
            "type": "array"
          },
          "target_houjin_bangou": {
            "anyOf": [
              {
                "maxLength": 13,
                "minLength": 13,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Houjin Bangou"
          }
        },
        "required": [
          "requester_email",
          "requester_legal_name",
          "target_data_categories",
          "identity_verification_method"
        ],
        "title": "DeletionRequest",
        "type": "object"
      },
      "DeletionResponse": {
        "properties": {
          "contact": {
            "default": "info@bookyou.net",
            "title": "Contact",
            "type": "string"
          },
          "expected_response_within_days": {
            "default": 30,
            "title": "Expected Response Within Days",
            "type": "integer"
          },
          "received_at": {
            "title": "Received At",
            "type": "string"
          },
          "request_id": {
            "title": "Request Id",
            "type": "string"
          }
        },
        "required": [
          "request_id",
          "received_at"
        ],
        "title": "DeletionResponse",
        "type": "object"
      },
      "DeliveryRow": {
        "properties": {
          "attempt_count": {
            "title": "Attempt Count",
            "type": "integer"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "delivered_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Delivered At"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "event_id": {
            "title": "Event Id",
            "type": "string"
          },
          "event_type": {
            "title": "Event Type",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "status_code": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status Code"
          }
        },
        "required": [
          "id",
          "event_type",
          "event_id",
          "status_code",
          "attempt_count",
          "delivered_at",
          "error",
          "created_at"
        ],
        "title": "DeliveryRow",
        "type": "object"
      },
      "DisclosureRequest": {
        "properties": {
          "identity_verification_method": {
            "enum": [
              "drivers_license",
              "my_number_card",
              "passport",
              "residence_card",
              "health_insurance_card",
              "other"
            ],
            "title": "Identity Verification Method",
            "type": "string"
          },
          "requester_email": {
            "format": "email",
            "title": "Requester Email",
            "type": "string"
          },
          "requester_legal_name": {
            "maxLength": 200,
            "minLength": 1,
            "title": "Requester Legal Name",
            "type": "string"
          },
          "target_houjin_bangou": {
            "anyOf": [
              {
                "maxLength": 13,
                "minLength": 13,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Houjin Bangou"
          }
        },
        "required": [
          "requester_email",
          "requester_legal_name",
          "identity_verification_method"
        ],
        "title": "DisclosureRequest",
        "type": "object"
      },
      "DisclosureResponse": {
        "properties": {
          "contact": {
            "default": "info@bookyou.net",
            "title": "Contact",
            "type": "string"
          },
          "expected_response_within_days": {
            "default": 14,
            "title": "Expected Response Within Days",
            "type": "integer"
          },
          "received_at": {
            "title": "Received At",
            "type": "string"
          },
          "request_id": {
            "title": "Request Id",
            "type": "string"
          }
        },
        "required": [
          "request_id",
          "received_at"
        ],
        "title": "DisclosureResponse",
        "type": "object"
      },
      "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.",
        "properties": {
          "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"
          },
          "amount_project_cost_yen": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Amount Project Cost Yen"
          },
          "amount_yen": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Amount Yen"
          },
          "bureau": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bureau"
          },
          "case_id": {
            "title": "Case Id",
            "type": "string"
          },
          "confidence": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Confidence"
          },
          "disclosed_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Disclosed Date"
          },
          "disclosed_until": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Disclosed Until"
          },
          "event_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Event Type"
          },
          "fetched_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fetched At"
          },
          "intermediate_recipient": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Intermediate Recipient"
          },
          "is_sole_proprietor": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Sole Proprietor"
          },
          "legal_basis": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Legal Basis"
          },
          "ministry": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ministry"
          },
          "occurred_fiscal_years": {
            "default": [],
            "items": {
              "type": "integer"
            },
            "title": "Occurred Fiscal Years",
            "type": "array"
          },
          "prefecture": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Prefecture"
          },
          "program_name_hint": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Program Name Hint"
          },
          "reason_excerpt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason Excerpt"
          },
          "recipient_houjin_bangou": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Recipient Houjin Bangou"
          },
          "recipient_kind": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Recipient Kind"
          },
          "recipient_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Recipient Name"
          },
          "source_section": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Section"
          },
          "source_title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Title"
          },
          "source_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Url"
          }
        },
        "required": [
          "case_id"
        ],
        "title": "EnforcementCase",
        "type": "object"
      },
      "EnforcementCaseSearchResponse": {
        "properties": {
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/EnforcementCase"
            },
            "title": "Results",
            "type": "array"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "total",
          "limit",
          "offset",
          "results"
        ],
        "title": "EnforcementCaseSearchResponse",
        "type": "object"
      },
      "ErrorBody": {
        "additionalProperties": true,
        "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"
          }
        ],
        "properties": {
          "code": {
            "description": "Closed-enum machine-readable error code. Agents should branch on this rather than parsing `message`.",
            "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",
            "type": "string"
          },
          "details": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Per-code extras: e.g. `retry_after` seconds for 503, `field_errors` for 422, `suggested_paths` for 404.",
            "title": "Details"
          },
          "message": {
            "description": "Plain-Japanese end-user-readable message. ≤200 chars. Mirrored in `user_message` extra for legacy clients that read that key.",
            "title": "Message",
            "type": "string"
          },
          "request_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "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'`).",
            "title": "Request Id"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "title": "ErrorBody",
        "type": "object"
      },
      "ErrorEnvelope": {
        "additionalProperties": true,
        "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"
            }
          }
        ],
        "properties": {
          "error": {
            "$ref": "#/components/schemas/ErrorBody",
            "description": "Error body — see ErrorBody."
          }
        },
        "required": [
          "error"
        ],
        "title": "ErrorEnvelope",
        "type": "object"
      },
      "EvaluateRequest": {
        "additionalProperties": false,
        "properties": {
          "business_profile": {
            "additionalProperties": true,
            "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.",
            "title": "Business Profile",
            "type": "object"
          },
          "target_ruleset_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "maxItems": 100,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "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.",
            "title": "Target Ruleset Ids"
          }
        },
        "required": [
          "business_profile"
        ],
        "title": "EvaluateRequest",
        "type": "object"
      },
      "EvaluateResponse": {
        "additionalProperties": true,
        "properties": {
          "results": {
            "items": {
              "$ref": "#/components/schemas/EvaluateResult"
            },
            "title": "Results",
            "type": "array"
          }
        },
        "required": [
          "results"
        ],
        "title": "EvaluateResponse",
        "type": "object"
      },
      "EvaluateResult": {
        "additionalProperties": false,
        "properties": {
          "applicable": {
            "title": "Applicable",
            "type": "boolean"
          },
          "conditions_matched": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Conditions Matched",
            "type": "array"
          },
          "conditions_unmatched": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Conditions Unmatched",
            "type": "array"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "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.",
            "title": "Error"
          },
          "reasons": {
            "items": {
              "type": "string"
            },
            "title": "Reasons",
            "type": "array"
          },
          "ruleset_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ruleset Name"
          },
          "unified_id": {
            "title": "Unified Id",
            "type": "string"
          }
        },
        "required": [
          "unified_id",
          "applicable",
          "reasons",
          "conditions_matched",
          "conditions_unmatched"
        ],
        "title": "EvaluateResult",
        "type": "object"
      },
      "ExampleProfileDetail": {
        "additionalProperties": true,
        "properties": {
          "id": {
            "title": "Id",
            "type": "string"
          },
          "profile": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Profile"
          }
        },
        "required": [
          "id"
        ],
        "title": "ExampleProfileDetail",
        "type": "object"
      },
      "ExampleProfileItem": {
        "additionalProperties": true,
        "properties": {
          "filename": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Filename"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "size_bytes": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Size Bytes"
          }
        },
        "required": [
          "id"
        ],
        "title": "ExampleProfileItem",
        "type": "object"
      },
      "ExampleProfileList": {
        "additionalProperties": true,
        "properties": {
          "results": {
            "items": {
              "$ref": "#/components/schemas/ExampleProfileItem"
            },
            "title": "Results",
            "type": "array"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "total"
        ],
        "title": "ExampleProfileList",
        "type": "object"
      },
      "ExclusionCheckRequest": {
        "properties": {
          "program_ids": {
            "items": {
              "type": "string"
            },
            "minItems": 1,
            "title": "Program Ids",
            "type": "array"
          }
        },
        "required": [
          "program_ids"
        ],
        "title": "ExclusionCheckRequest",
        "type": "object"
      },
      "ExclusionCheckResponse": {
        "properties": {
          "checked_rules": {
            "title": "Checked Rules",
            "type": "integer"
          },
          "hits": {
            "items": {
              "$ref": "#/components/schemas/ExclusionHit"
            },
            "title": "Hits",
            "type": "array"
          },
          "program_ids": {
            "items": {
              "type": "string"
            },
            "title": "Program Ids",
            "type": "array"
          }
        },
        "required": [
          "program_ids",
          "hits",
          "checked_rules"
        ],
        "title": "ExclusionCheckResponse",
        "type": "object"
      },
      "ExclusionHit": {
        "properties": {
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "programs_involved": {
            "items": {
              "type": "string"
            },
            "title": "Programs Involved",
            "type": "array"
          },
          "rule_id": {
            "title": "Rule Id",
            "type": "string"
          },
          "severity": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Severity"
          },
          "source_urls": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Source Urls",
            "type": "array"
          }
        },
        "required": [
          "rule_id",
          "kind",
          "severity",
          "programs_involved",
          "description"
        ],
        "title": "ExclusionHit",
        "type": "object"
      },
      "ExclusionRule": {
        "properties": {
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "extra": {
            "additionalProperties": true,
            "default": {},
            "title": "Extra",
            "type": "object"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "program_a": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Program A"
          },
          "program_b": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Program B"
          },
          "program_b_group": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Program B Group",
            "type": "array"
          },
          "rule_id": {
            "title": "Rule Id",
            "type": "string"
          },
          "severity": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Severity"
          },
          "source_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Notes"
          },
          "source_urls": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Source Urls",
            "type": "array"
          }
        },
        "required": [
          "rule_id",
          "kind"
        ],
        "title": "ExclusionRule",
        "type": "object"
      },
      "FeedbackRequest": {
        "properties": {
          "endpoint": {
            "anyOf": [
              {
                "maxLength": 256,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Endpoint"
          },
          "message": {
            "maxLength": 4000,
            "minLength": 1,
            "title": "Message",
            "type": "string"
          },
          "rating": {
            "anyOf": [
              {
                "maximum": 5.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rating"
          },
          "request_id": {
            "anyOf": [
              {
                "maxLength": 128,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Request Id"
          }
        },
        "required": [
          "message"
        ],
        "title": "FeedbackRequest",
        "type": "object"
      },
      "FeedbackResponse": {
        "properties": {
          "feedback_id": {
            "title": "Feedback Id",
            "type": "integer"
          },
          "received": {
            "title": "Received",
            "type": "boolean"
          }
        },
        "required": [
          "received",
          "feedback_id"
        ],
        "title": "FeedbackResponse",
        "type": "object"
      },
      "FreshnessResponse": {
        "additionalProperties": true,
        "description": "``GET /v1/stats/freshness`` — per-source min/max/avg fetched_at.",
        "properties": {
          "generated_at": {
            "title": "Generated At",
            "type": "string"
          },
          "sources": {
            "additionalProperties": {
              "$ref": "#/components/schemas/FreshnessSourceStat"
            },
            "title": "Sources",
            "type": "object"
          }
        },
        "required": [
          "generated_at"
        ],
        "title": "FreshnessResponse",
        "type": "object"
      },
      "FreshnessSourceStat": {
        "additionalProperties": true,
        "description": "Per-source freshness stats inside ``FreshnessResponse.sources``.",
        "properties": {
          "avg_interval_days": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avg Interval Days"
          },
          "count": {
            "default": 0,
            "title": "Count",
            "type": "integer"
          },
          "max": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max"
          },
          "min": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Min"
          }
        },
        "title": "FreshnessSourceStat",
        "type": "object"
      },
      "GetResponse": {
        "additionalProperties": false,
        "properties": {
          "attribution": {
            "$ref": "#/components/schemas/AttributionBlock"
          },
          "result": {
            "$ref": "#/components/schemas/InvoiceRegistrantOut"
          }
        },
        "required": [
          "result",
          "attribution"
        ],
        "title": "GetResponse",
        "type": "object"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "title": "Detail",
            "type": "array"
          }
        },
        "title": "HTTPValidationError",
        "type": "object"
      },
      "InvoiceRegistrantOut": {
        "additionalProperties": false,
        "description": "Single 適格請求書発行事業者 row. Columns map 1:1 onto\n019_invoice_registrants.sql's `invoice_registrants` table.",
        "properties": {
          "address_normalized": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Normalized registered address (所在地). May be NULL when NTA withholds it (sole proprietors who declined disclosure).",
            "title": "Address Normalized"
          },
          "confidence": {
            "description": "0..1 lineage confidence",
            "title": "Confidence",
            "type": "number"
          },
          "expired_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Expiration date / 失効日 (ISO 8601). NULL = not expired (未失効).",
            "title": "Expired Date"
          },
          "fetched_at": {
            "description": "ISO 8601 UTC when we last successfully fetched this row. Rendered as '出典取得' on public surfaces (not '最終更新').",
            "title": "Fetched At",
            "type": "string"
          },
          "houjin_bangou": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "13-digit 法人番号. NULL for sole proprietors / 'other'. Soft reference to houjin_master (no hard FK).",
            "title": "Houjin Bangou"
          },
          "invoice_registration_number": {
            "description": "'T' + 13 digits (14 chars total). Primary key.",
            "title": "Invoice Registration Number",
            "type": "string"
          },
          "last_updated_nta": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "NTA's timestamp on this record",
            "title": "Last Updated Nta"
          },
          "normalized_name": {
            "description": "Registered business name (事業者名 / 公表名称) — as published by NTA.",
            "title": "Normalized Name",
            "type": "string"
          },
          "prefecture": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Prefecture (都道府県) — full-suffix kanji form, e.g. 東京都.",
            "title": "Prefecture"
          },
          "registered_date": {
            "description": "Registration date / 登録日 (ISO 8601 YYYY-MM-DD).",
            "title": "Registered Date",
            "type": "string"
          },
          "registrant_kind": {
            "description": "corporation (法人) | sole_proprietor (個人事業主) | other",
            "enum": [
              "corporation",
              "sole_proprietor",
              "other"
            ],
            "title": "Registrant Kind",
            "type": "string"
          },
          "revoked_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Revocation date / 取消日 (ISO 8601). NULL = not revoked (未取消).",
            "title": "Revoked Date"
          },
          "source_checksum": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "optional SHA-256 of raw bulk file",
            "title": "Source Checksum"
          },
          "source_url": {
            "description": "primary source URL (https://www.invoice-kohyo.nta.go.jp/download/...)",
            "title": "Source Url",
            "type": "string"
          },
          "trade_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "屋号等 (may be NULL)",
            "title": "Trade Name"
          },
          "updated_at": {
            "description": "ISO 8601 UTC of last row write in our DB",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "invoice_registration_number",
          "normalized_name",
          "registered_date",
          "registrant_kind",
          "source_url",
          "confidence",
          "fetched_at",
          "updated_at"
        ],
        "title": "InvoiceRegistrantOut",
        "type": "object"
      },
      "KeyIssueRequest": {
        "properties": {
          "session_id": {
            "title": "Session Id",
            "type": "string"
          }
        },
        "required": [
          "session_id"
        ],
        "title": "KeyIssueRequest",
        "type": "object"
      },
      "KeyIssueResponse": {
        "properties": {
          "api_key": {
            "title": "Api Key",
            "type": "string"
          },
          "customer_id": {
            "title": "Customer Id",
            "type": "string"
          },
          "tier": {
            "title": "Tier",
            "type": "string"
          }
        },
        "required": [
          "api_key",
          "tier",
          "customer_id"
        ],
        "title": "KeyIssueResponse",
        "type": "object"
      },
      "Law": {
        "additionalProperties": true,
        "properties": {
          "article_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Article Count"
          },
          "confidence": {
            "default": 0.95,
            "title": "Confidence",
            "type": "number"
          },
          "enforced_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Enforced Date"
          },
          "fetched_at": {
            "title": "Fetched At",
            "type": "string"
          },
          "full_text_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Full Text Url"
          },
          "last_amended_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Amended Date"
          },
          "law_number": {
            "title": "Law Number",
            "type": "string"
          },
          "law_short_title": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Law Short Title"
          },
          "law_title": {
            "title": "Law Title",
            "type": "string"
          },
          "law_type": {
            "enum": [
              "constitution",
              "act",
              "cabinet_order",
              "imperial_order",
              "ministerial_ordinance",
              "rule",
              "notice",
              "guideline"
            ],
            "title": "Law Type",
            "type": "string"
          },
          "ministry": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ministry"
          },
          "promulgated_date": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Promulgated Date"
          },
          "revision_status": {
            "default": "current",
            "enum": [
              "current",
              "superseded",
              "repealed"
            ],
            "title": "Revision Status",
            "type": "string"
          },
          "source_checksum": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Checksum"
          },
          "source_url": {
            "title": "Source Url",
            "type": "string"
          },
          "subject_areas": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Subject Areas",
            "type": "array"
          },
          "summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Summary"
          },
          "superseded_by_law_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Superseded By Law Id"
          },
          "unified_id": {
            "description": "LAW-<10 lowercase hex>",
            "title": "Unified Id",
            "type": "string"
          },
          "updated_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated At"
          }
        },
        "required": [
          "unified_id",
          "law_number",
          "law_title",
          "law_type",
          "source_url",
          "fetched_at"
        ],
        "title": "Law",
        "type": "object"
      },
      "LawSearchResponse": {
        "properties": {
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/Law"
            },
            "title": "Results",
            "type": "array"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "total",
          "limit",
          "offset",
          "results"
        ],
        "title": "LawSearchResponse",
        "type": "object"
      },
      "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.",
        "properties": {
          "amount_max_yen": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Amount Max Yen"
          },
          "collateral_required": {
            "anyOf": [
              {
                "enum": [
                  "required",
                  "not_required",
                  "negotiable",
                  "unknown"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Collateral Required"
          },
          "confidence": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Confidence"
          },
          "fetched_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fetched At"
          },
          "grace_period_years_max": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Grace Period Years Max"
          },
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "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"
          },
          "loan_period_years_max": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Loan Period Years Max"
          },
          "loan_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Loan Type"
          },
          "official_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Official Url"
          },
          "personal_guarantor_required": {
            "anyOf": [
              {
                "enum": [
                  "required",
                  "not_required",
                  "negotiable",
                  "unknown"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Personal Guarantor Required"
          },
          "program_name": {
            "title": "Program Name",
            "type": "string"
          },
          "provider": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Provider"
          },
          "rate_names": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rate Names"
          },
          "security_notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Security Notes"
          },
          "security_required": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Security Required"
          },
          "source_excerpt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Excerpt"
          },
          "target_conditions": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Conditions"
          },
          "third_party_guarantor_required": {
            "anyOf": [
              {
                "enum": [
                  "required",
                  "not_required",
                  "negotiable",
                  "unknown"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Third Party Guarantor Required"
          }
        },
        "required": [
          "id",
          "program_name"
        ],
        "title": "LoanProgram",
        "type": "object"
      },
      "LoanProgramSearchResponse": {
        "properties": {
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/LoanProgram"
            },
            "title": "Results",
            "type": "array"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "total",
          "limit",
          "offset",
          "results"
        ],
        "title": "LoanProgramSearchResponse",
        "type": "object"
      },
      "MatchResponse": {
        "additionalProperties": false,
        "properties": {
          "ranking": {
            "additionalProperties": {
              "type": "string"
            },
            "title": "Ranking",
            "type": "object"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/AdvisorOut"
            },
            "title": "Results",
            "type": "array"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "total",
          "results"
        ],
        "title": "MatchResponse",
        "type": "object"
      },
      "MeResponse": {
        "properties": {
          "created_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          },
          "customer_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Customer Id"
          },
          "key_hash_prefix": {
            "title": "Key Hash Prefix",
            "type": "string"
          },
          "subscription_cancel_at_period_end": {
            "title": "Subscription Cancel At Period End",
            "type": "boolean"
          },
          "subscription_current_period_end": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Subscription Current Period End"
          },
          "subscription_status": {
            "title": "Subscription Status",
            "type": "string"
          },
          "tier": {
            "title": "Tier",
            "type": "string"
          }
        },
        "required": [
          "tier",
          "key_hash_prefix",
          "customer_id",
          "created_at",
          "subscription_status",
          "subscription_current_period_end",
          "subscription_cancel_at_period_end"
        ],
        "title": "MeResponse",
        "type": "object"
      },
      "Meta": {
        "properties": {
          "data_as_of": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Data As Of"
          },
          "data_lineage": {
            "$ref": "#/components/schemas/DataLineage",
            "default": {
              "unique_checksums": 0
            }
          },
          "exclusion_rules_count": {
            "title": "Exclusion Rules Count",
            "type": "integer"
          },
          "last_ingested_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Ingested At"
          },
          "prefecture_counts": {
            "additionalProperties": {
              "type": "integer"
            },
            "title": "Prefecture Counts",
            "type": "object"
          },
          "tier_counts": {
            "additionalProperties": {
              "type": "integer"
            },
            "title": "Tier Counts",
            "type": "object"
          },
          "total_programs": {
            "title": "Total Programs",
            "type": "integer"
          }
        },
        "required": [
          "total_programs",
          "tier_counts",
          "prefecture_counts",
          "exclusion_rules_count",
          "last_ingested_at"
        ],
        "title": "Meta",
        "type": "object"
      },
      "MetaFreshnessResponse": {
        "additionalProperties": true,
        "description": "``GET /v1/meta/freshness`` — public anti-staleness feed.",
        "properties": {
          "generated_at": {
            "title": "Generated At",
            "type": "string"
          },
          "median_fetched_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Median Fetched At"
          },
          "pct_over_180d": {
            "default": 0.0,
            "title": "Pct Over 180D",
            "type": "number"
          },
          "pct_within_30d": {
            "default": 0.0,
            "title": "Pct Within 30D",
            "type": "number"
          },
          "top_rows": {
            "items": {
              "$ref": "#/components/schemas/MetaFreshnessRow"
            },
            "title": "Top Rows",
            "type": "array"
          },
          "total": {
            "default": 0,
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "generated_at"
        ],
        "title": "MetaFreshnessResponse",
        "type": "object"
      },
      "MetaFreshnessRow": {
        "additionalProperties": true,
        "properties": {
          "canonical_id": {
            "title": "Canonical Id",
            "type": "string"
          },
          "days_ago": {
            "default": 0,
            "title": "Days Ago",
            "type": "integer"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "source_fetched_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Fetched At"
          },
          "tier": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tier"
          }
        },
        "required": [
          "canonical_id",
          "name"
        ],
        "title": "MetaFreshnessRow",
        "type": "object"
      },
      "PingResponse": {
        "properties": {
          "authenticated": {
            "title": "Authenticated",
            "type": "boolean"
          },
          "ok": {
            "title": "Ok",
            "type": "boolean"
          },
          "rate_limit_remaining": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rate Limit Remaining"
          },
          "server_time_utc": {
            "title": "Server Time Utc",
            "type": "string"
          },
          "server_version": {
            "title": "Server Version",
            "type": "string"
          },
          "tier": {
            "title": "Tier",
            "type": "string"
          }
        },
        "required": [
          "ok",
          "authenticated",
          "tier",
          "server_time_utc",
          "server_version",
          "rate_limit_remaining"
        ],
        "title": "PingResponse",
        "type": "object"
      },
      "PortalRequest": {
        "properties": {
          "customer_id": {
            "title": "Customer Id",
            "type": "string"
          },
          "return_url": {
            "title": "Return Url",
            "type": "string"
          }
        },
        "required": [
          "customer_id",
          "return_url"
        ],
        "title": "PortalRequest",
        "type": "object"
      },
      "PrescreenMatch": {
        "additionalProperties": false,
        "properties": {
          "amount_max_man_yen": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Amount Max Man Yen"
          },
          "authority_level": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authority Level"
          },
          "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.",
            "items": {
              "type": "string"
            },
            "title": "Caveats",
            "type": "array"
          },
          "fit_score": {
            "description": "Heuristic positive-match count in v1 (higher = better fit). Ranges 0..~5. NOT a probability; compare rows within one response only.",
            "title": "Fit Score",
            "type": "integer"
          },
          "match_reasons": {
            "description": "Human-readable reasons this row scored positively.",
            "items": {
              "type": "string"
            },
            "title": "Match Reasons",
            "type": "array"
          },
          "official_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Official Url"
          },
          "prefecture": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Prefecture"
          },
          "primary_name": {
            "title": "Primary Name",
            "type": "string"
          },
          "static_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "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.",
            "title": "Static Url"
          },
          "tier": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tier"
          },
          "unified_id": {
            "title": "Unified Id",
            "type": "string"
          }
        },
        "required": [
          "unified_id",
          "primary_name",
          "tier",
          "authority_level",
          "prefecture",
          "amount_max_man_yen",
          "official_url",
          "fit_score",
          "match_reasons",
          "caveats"
        ],
        "title": "PrescreenMatch",
        "type": "object"
      },
      "PrescreenRequest": {
        "additionalProperties": false,
        "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.",
        "properties": {
          "company_url": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "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.",
            "title": "Company Url"
          },
          "declared_certifications": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "maxItems": 20,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "Certifications the caller has declared (e.g., '認定新規就農者', '認定農業者', '経営革新計画承認'). Used to suppress 'prerequisite-missing' flags.",
            "title": "Declared Certifications"
          },
          "employee_count": {
            "anyOf": [
              {
                "maximum": 100000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Number of employees.",
            "title": "Employee Count"
          },
          "founded_year": {
            "anyOf": [
              {
                "maximum": 2100.0,
                "minimum": 1800.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Western calendar year of incorporation / founding.",
            "title": "Founded Year"
          },
          "houjin_bangou": {
            "anyOf": [
              {
                "maxLength": 13,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "13-digit 国税庁 法人番号. Stored for identity only.",
            "title": "Houjin Bangou"
          },
          "industry_jsic": {
            "anyOf": [
              {
                "maxLength": 10,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "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.",
            "title": "Industry Jsic"
          },
          "is_sole_proprietor": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "True = 個人事業主. False = 法人 (incl. 株式会社/合同会社/組合). None = unspecified (match against both target_types).",
            "title": "Is Sole Proprietor"
          },
          "limit": {
            "default": 10,
            "description": "Max rows to return. Default 10.",
            "maximum": 50.0,
            "minimum": 1.0,
            "title": "Limit",
            "type": "integer"
          },
          "planned_investment_man_yen": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "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'.",
            "title": "Planned Investment Man Yen"
          },
          "prefecture": {
            "anyOf": [
              {
                "maxLength": 40,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Caller's prefecture. Accepts canonical ('東京都'), short ('東京'), or romaji ('Tokyo'). Use '全国' / 'national' / None to skip the prefecture filter entirely (you still get national programs).",
            "title": "Prefecture"
          },
          "revenue_yen": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Annual revenue in JPY (NOT 万円). Used for SME/大企業 split only.",
            "title": "Revenue Yen"
          }
        },
        "title": "PrescreenRequest",
        "type": "object"
      },
      "PrescreenResponse": {
        "additionalProperties": false,
        "properties": {
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "profile_echo": {
            "additionalProperties": true,
            "description": "The normalized profile actually used for matching, so the caller can verify e.g. that 'Tokyo' -> '東京都'.",
            "title": "Profile Echo",
            "type": "object"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/PrescreenMatch"
            },
            "title": "Results",
            "type": "array"
          },
          "total_considered": {
            "description": "Rows passing the hard prefecture / national filter before ranking. `results` is ranked top-N of this set.",
            "title": "Total Considered",
            "type": "integer"
          }
        },
        "required": [
          "total_considered",
          "limit",
          "results",
          "profile_echo"
        ],
        "title": "PrescreenResponse",
        "type": "object"
      },
      "Program": {
        "properties": {
          "a_to_j_coverage": {
            "additionalProperties": true,
            "default": {},
            "title": "A To J Coverage",
            "type": "object"
          },
          "aliases": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Aliases",
            "type": "array"
          },
          "amount_band": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Amount Band"
          },
          "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"
          },
          "application_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "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.",
            "title": "Application Url"
          },
          "application_window": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Application Window"
          },
          "authority_level": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authority Level"
          },
          "authority_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authority Name"
          },
          "coverage_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Coverage Score"
          },
          "crop_categories": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Crop Categories",
            "type": "array"
          },
          "equipment_category": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Equipment Category"
          },
          "excluded": {
            "default": false,
            "title": "Excluded",
            "type": "boolean"
          },
          "exclusion_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Exclusion Reason"
          },
          "funding_purpose": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Funding Purpose",
            "type": "array"
          },
          "gap_to_tier_s": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Gap To Tier S",
            "type": "array"
          },
          "municipality": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Municipality"
          },
          "next_deadline": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "ISO date of the next open-window end_date from application_window, or null when the window is rolling / unknown / already past.",
            "title": "Next Deadline"
          },
          "official_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Official Url"
          },
          "prefecture": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Prefecture"
          },
          "primary_name": {
            "title": "Primary Name",
            "type": "string"
          },
          "program_kind": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Program Kind"
          },
          "static_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "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).",
            "title": "Static Url"
          },
          "subsidy_rate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Subsidy Rate"
          },
          "target_types": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Target Types",
            "type": "array"
          },
          "tier": {
            "anyOf": [
              {
                "enum": [
                  "S",
                  "A",
                  "B",
                  "C",
                  "X"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tier"
          },
          "trust_level": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Trust Level"
          },
          "unified_id": {
            "title": "Unified Id",
            "type": "string"
          }
        },
        "required": [
          "unified_id",
          "primary_name"
        ],
        "title": "Program",
        "type": "object"
      },
      "ProgramDetail": {
        "properties": {
          "a_to_j_coverage": {
            "additionalProperties": true,
            "default": {},
            "title": "A To J Coverage",
            "type": "object"
          },
          "aliases": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Aliases",
            "type": "array"
          },
          "amount_band": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Amount Band"
          },
          "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"
          },
          "application_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "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.",
            "title": "Application Url"
          },
          "application_window": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Application Window"
          },
          "authority_level": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authority Level"
          },
          "authority_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authority Name"
          },
          "coverage_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Coverage Score"
          },
          "crop_categories": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Crop Categories",
            "type": "array"
          },
          "enriched": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Enriched"
          },
          "equipment_category": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Equipment Category"
          },
          "excluded": {
            "default": false,
            "title": "Excluded",
            "type": "boolean"
          },
          "exclusion_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Exclusion Reason"
          },
          "funding_purpose": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Funding Purpose",
            "type": "array"
          },
          "gap_to_tier_s": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Gap To Tier S",
            "type": "array"
          },
          "municipality": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Municipality"
          },
          "next_deadline": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "ISO date of the next open-window end_date from application_window, or null when the window is rolling / unknown / already past.",
            "title": "Next Deadline"
          },
          "official_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Official Url"
          },
          "prefecture": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Prefecture"
          },
          "primary_name": {
            "title": "Primary Name",
            "type": "string"
          },
          "program_kind": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Program Kind"
          },
          "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').",
            "items": {
              "type": "string"
            },
            "title": "Required Documents",
            "type": "array"
          },
          "source_checksum": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Checksum"
          },
          "source_fetched_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Fetched At"
          },
          "source_mentions": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "items": {},
                "type": "array"
              }
            ],
            "default": {},
            "title": "Source Mentions"
          },
          "source_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Url"
          },
          "static_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "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).",
            "title": "Static Url"
          },
          "subsidy_rate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Subsidy Rate"
          },
          "target_types": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Target Types",
            "type": "array"
          },
          "tier": {
            "anyOf": [
              {
                "enum": [
                  "S",
                  "A",
                  "B",
                  "C",
                  "X"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tier"
          },
          "trust_level": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Trust Level"
          },
          "unified_id": {
            "title": "Unified Id",
            "type": "string"
          }
        },
        "required": [
          "unified_id",
          "primary_name"
        ],
        "title": "ProgramDetail",
        "type": "object"
      },
      "RefundRequest": {
        "properties": {
          "amount_yen": {
            "anyOf": [
              {
                "maximum": 10000000.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Amount Yen"
          },
          "customer_id": {
            "maxLength": 120,
            "minLength": 1,
            "title": "Customer Id",
            "type": "string"
          },
          "reason": {
            "maxLength": 2000,
            "minLength": 1,
            "title": "Reason",
            "type": "string"
          },
          "requester_email": {
            "format": "email",
            "title": "Requester Email",
            "type": "string"
          }
        },
        "required": [
          "requester_email",
          "customer_id",
          "reason"
        ],
        "title": "RefundRequest",
        "type": "object"
      },
      "RefundResponse": {
        "properties": {
          "contact": {
            "default": "info@bookyou.net",
            "title": "Contact",
            "type": "string"
          },
          "expected_response_within_days": {
            "default": 14,
            "title": "Expected Response Within Days",
            "type": "integer"
          },
          "note": {
            "default": "返金は手動審査となります。既に課金済みの ¥3/req メータリング分は 自動取消しされません — 審査完了後、運営から個別にご連絡します。",
            "title": "Note",
            "type": "string"
          },
          "received_at": {
            "title": "Received At",
            "type": "string"
          },
          "request_id": {
            "title": "Request Id",
            "type": "string"
          }
        },
        "required": [
          "request_id",
          "received_at"
        ],
        "title": "RefundResponse",
        "type": "object"
      },
      "RegisterRequest": {
        "properties": {
          "event_types": {
            "items": {
              "enum": [
                "program.created",
                "program.amended",
                "enforcement.added",
                "tax_ruleset.amended",
                "invoice_registrant.matched"
              ],
              "type": "string"
            },
            "maxItems": 5,
            "minItems": 1,
            "title": "Event Types",
            "type": "array"
          },
          "url": {
            "maxLength": 2048,
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "url",
          "event_types"
        ],
        "title": "RegisterRequest",
        "type": "object"
      },
      "RelatedProgramRef": {
        "description": "A program citing a given law (reverse lookup via program_law_refs).",
        "properties": {
          "article_citation": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Article Citation"
          },
          "confidence": {
            "default": 0.9,
            "title": "Confidence",
            "type": "number"
          },
          "fetched_at": {
            "title": "Fetched At",
            "type": "string"
          },
          "program_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Program Name"
          },
          "program_unified_id": {
            "title": "Program Unified Id",
            "type": "string"
          },
          "ref_kind": {
            "description": "One of: authority | eligibility | exclusion | reference | penalty",
            "title": "Ref Kind",
            "type": "string"
          },
          "source_url": {
            "title": "Source Url",
            "type": "string"
          }
        },
        "required": [
          "program_unified_id",
          "ref_kind",
          "source_url",
          "fetched_at"
        ],
        "title": "RelatedProgramRef",
        "type": "object"
      },
      "RelatedProgramsResponse": {
        "properties": {
          "law_unified_id": {
            "title": "Law Unified Id",
            "type": "string"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/RelatedProgramRef"
            },
            "title": "Results",
            "type": "array"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "law_unified_id",
          "total",
          "limit",
          "offset",
          "results"
        ],
        "title": "RelatedProgramsResponse",
        "type": "object"
      },
      "ReportConversionRequest": {
        "additionalProperties": false,
        "properties": {
          "conversion_value_yen": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Conversion Value Yen"
          },
          "evidence_url": {
            "anyOf": [
              {
                "format": "uri",
                "maxLength": 2083,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Evidence Url"
          },
          "referral_token": {
            "title": "Referral Token",
            "type": "string"
          }
        },
        "required": [
          "referral_token"
        ],
        "title": "ReportConversionRequest",
        "type": "object"
      },
      "RotateKeyResponse": {
        "properties": {
          "api_key": {
            "title": "Api Key",
            "type": "string"
          },
          "tier": {
            "title": "Tier",
            "type": "string"
          }
        },
        "required": [
          "api_key",
          "tier"
        ],
        "title": "RotateKeyResponse",
        "type": "object"
      },
      "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).",
        "properties": {
          "amount_max": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Amount Max"
          },
          "amount_min": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Amount Min"
          },
          "authority_level": {
            "anyOf": [
              {
                "maxLength": 20,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authority Level"
          },
          "funding_purpose": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "maxItems": 20,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Funding Purpose"
          },
          "include_excluded": {
            "default": false,
            "title": "Include Excluded",
            "type": "boolean"
          },
          "prefecture": {
            "anyOf": [
              {
                "maxLength": 20,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Prefecture"
          },
          "q": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Q"
          },
          "target_types": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "maxItems": 20,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Types"
          },
          "tier": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "maxItems": 4,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tier"
          }
        },
        "title": "SavedSearchQuery",
        "type": "object"
      },
      "SavedSearchResponse": {
        "properties": {
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "frequency": {
            "title": "Frequency",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "last_run_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Run At"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "notify_email": {
            "title": "Notify Email",
            "type": "string"
          },
          "query": {
            "additionalProperties": true,
            "title": "Query",
            "type": "object"
          }
        },
        "required": [
          "id",
          "name",
          "query",
          "frequency",
          "notify_email",
          "last_run_at",
          "created_at"
        ],
        "title": "SavedSearchResponse",
        "type": "object"
      },
      "SessionRequest": {
        "properties": {
          "api_key": {
            "maxLength": 256,
            "minLength": 8,
            "title": "Api Key",
            "type": "string"
          }
        },
        "required": [
          "api_key"
        ],
        "title": "SessionRequest",
        "type": "object"
      },
      "SessionResponse": {
        "properties": {
          "key_hash_prefix": {
            "title": "Key Hash Prefix",
            "type": "string"
          },
          "tier": {
            "title": "Tier",
            "type": "string"
          }
        },
        "required": [
          "tier",
          "key_hash_prefix"
        ],
        "title": "SessionResponse",
        "type": "object"
      },
      "StaticResourceDetail": {
        "additionalProperties": true,
        "properties": {
          "content": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "items": {},
                "type": "array"
              },
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Content"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "license": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "License"
          }
        },
        "required": [
          "id"
        ],
        "title": "StaticResourceDetail",
        "type": "object"
      },
      "StaticResourceItem": {
        "additionalProperties": true,
        "properties": {
          "filename": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Filename"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "path_relative": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Path Relative"
          },
          "size_bytes": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Size Bytes"
          }
        },
        "required": [
          "id"
        ],
        "title": "StaticResourceItem",
        "type": "object"
      },
      "StaticResourceList": {
        "additionalProperties": true,
        "properties": {
          "results": {
            "items": {
              "$ref": "#/components/schemas/StaticResourceItem"
            },
            "title": "Results",
            "type": "array"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "total"
        ],
        "title": "StaticResourceList",
        "type": "object"
      },
      "SubscriptionResponse": {
        "properties": {
          "active": {
            "title": "Active",
            "type": "boolean"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email"
          },
          "filter_type": {
            "title": "Filter Type",
            "type": "string"
          },
          "filter_value": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Filter Value"
          },
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "last_triggered": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Triggered"
          },
          "min_severity": {
            "title": "Min Severity",
            "type": "string"
          },
          "updated_at": {
            "title": "Updated At",
            "type": "string"
          },
          "webhook_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Webhook Url"
          }
        },
        "required": [
          "id",
          "filter_type",
          "filter_value",
          "min_severity",
          "webhook_url",
          "email",
          "active",
          "created_at",
          "updated_at",
          "last_triggered"
        ],
        "title": "SubscriptionResponse",
        "type": "object"
      },
      "TaxRulesetOut": {
        "additionalProperties": true,
        "properties": {
          "authority": {
            "title": "Authority",
            "type": "string"
          },
          "authority_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Authority Url"
          },
          "calculation_formula": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Calculation Formula"
          },
          "confidence": {
            "title": "Confidence",
            "type": "number"
          },
          "effective_from": {
            "title": "Effective From",
            "type": "string"
          },
          "effective_until": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Effective Until"
          },
          "eligibility_conditions": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Eligibility Conditions"
          },
          "eligibility_conditions_json": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ],
            "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).",
            "title": "Eligibility Conditions Json"
          },
          "fetched_at": {
            "title": "Fetched At",
            "type": "string"
          },
          "filing_requirements": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Filing Requirements"
          },
          "rate_or_amount": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rate Or Amount"
          },
          "related_law_ids": {
            "items": {
              "type": "string"
            },
            "title": "Related Law Ids",
            "type": "array"
          },
          "ruleset_kind": {
            "title": "Ruleset Kind",
            "type": "string"
          },
          "ruleset_name": {
            "title": "Ruleset Name",
            "type": "string"
          },
          "source_checksum": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Checksum"
          },
          "source_excerpt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Excerpt"
          },
          "source_url": {
            "title": "Source Url",
            "type": "string"
          },
          "tax_category": {
            "title": "Tax Category",
            "type": "string"
          },
          "unified_id": {
            "title": "Unified Id",
            "type": "string"
          },
          "updated_at": {
            "title": "Updated At",
            "type": "string"
          }
        },
        "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",
        "type": "object"
      },
      "TaxRulesetSearchResponse": {
        "additionalProperties": true,
        "properties": {
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/TaxRulesetOut"
            },
            "title": "Results",
            "type": "array"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "total",
          "limit",
          "offset",
          "results"
        ],
        "title": "TaxRulesetSearchResponse",
        "type": "object"
      },
      "TestDeliveryResponse": {
        "properties": {
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "ok": {
            "title": "Ok",
            "type": "boolean"
          },
          "sent_at": {
            "title": "Sent At",
            "type": "string"
          },
          "signature": {
            "title": "Signature",
            "type": "string"
          },
          "status_code": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status Code"
          }
        },
        "required": [
          "ok",
          "status_code",
          "error",
          "signature",
          "sent_at"
        ],
        "title": "TestDeliveryResponse",
        "type": "object"
      },
      "TestimonialListResponse": {
        "properties": {
          "rows": {
            "items": {
              "$ref": "#/components/schemas/TestimonialPublic"
            },
            "title": "Rows",
            "type": "array"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "total",
          "rows"
        ],
        "title": "TestimonialListResponse",
        "type": "object"
      },
      "TestimonialPublic": {
        "properties": {
          "approved_at": {
            "title": "Approved At",
            "type": "string"
          },
          "audience": {
            "title": "Audience",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "linkedin_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Linkedin Url"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "organization": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Organization"
          },
          "text": {
            "title": "Text",
            "type": "string"
          }
        },
        "required": [
          "id",
          "audience",
          "text",
          "name",
          "organization",
          "linkedin_url",
          "approved_at"
        ],
        "title": "TestimonialPublic",
        "type": "object"
      },
      "TestimonialSubmit": {
        "properties": {
          "audience": {
            "enum": [
              "税理士",
              "行政書士",
              "SMB",
              "VC",
              "Dev"
            ],
            "title": "Audience",
            "type": "string"
          },
          "linkedin_url": {
            "anyOf": [
              {
                "maxLength": 300,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Linkedin Url"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 80,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "organization": {
            "anyOf": [
              {
                "maxLength": 120,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Organization"
          },
          "text": {
            "maxLength": 2000,
            "minLength": 10,
            "title": "Text",
            "type": "string"
          }
        },
        "required": [
          "audience",
          "text"
        ],
        "title": "TestimonialSubmit",
        "type": "object"
      },
      "TestimonialSubmitResponse": {
        "properties": {
          "pending_review": {
            "title": "Pending Review",
            "type": "boolean"
          },
          "received": {
            "title": "Received",
            "type": "boolean"
          },
          "testimonial_id": {
            "title": "Testimonial Id",
            "type": "integer"
          }
        },
        "required": [
          "received",
          "testimonial_id",
          "pending_review"
        ],
        "title": "TestimonialSubmitResponse",
        "type": "object"
      },
      "TokenRequest": {
        "properties": {
          "client_id": {
            "default": "autonomath-mcp",
            "title": "Client Id",
            "type": "string"
          },
          "device_code": {
            "title": "Device Code",
            "type": "string"
          },
          "grant_type": {
            "title": "Grant Type",
            "type": "string"
          }
        },
        "required": [
          "grant_type",
          "device_code"
        ],
        "title": "TokenRequest",
        "type": "object"
      },
      "TokenSuccess": {
        "properties": {
          "access_token": {
            "title": "Access Token",
            "type": "string"
          },
          "scope": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Scope"
          },
          "token_type": {
            "const": "Bearer",
            "default": "Bearer",
            "title": "Token Type",
            "type": "string"
          }
        },
        "required": [
          "access_token"
        ],
        "title": "TokenSuccess",
        "type": "object"
      },
      "ToolRecommendation": {
        "properties": {
          "confidence": {
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Confidence",
            "type": "number"
          },
          "endpoint": {
            "title": "Endpoint",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "why": {
            "title": "Why",
            "type": "string"
          }
        },
        "required": [
          "endpoint",
          "name",
          "why",
          "confidence"
        ],
        "title": "ToolRecommendation",
        "type": "object"
      },
      "ToolRecommendationResponse": {
        "properties": {
          "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'.",
            "title": "Fallback Used",
            "type": "boolean"
          },
          "intent": {
            "title": "Intent",
            "type": "string"
          },
          "tools": {
            "items": {
              "$ref": "#/components/schemas/ToolRecommendation"
            },
            "title": "Tools",
            "type": "array"
          }
        },
        "required": [
          "intent",
          "tools",
          "fallback_used"
        ],
        "title": "ToolRecommendationResponse",
        "type": "object"
      },
      "ToolUsageResponse": {
        "properties": {
          "days": {
            "title": "Days",
            "type": "integer"
          },
          "top": {
            "items": {
              "$ref": "#/components/schemas/ToolUsageRow"
            },
            "title": "Top",
            "type": "array"
          },
          "total_amount_yen": {
            "title": "Total Amount Yen",
            "type": "integer"
          },
          "total_calls": {
            "title": "Total Calls",
            "type": "integer"
          }
        },
        "required": [
          "days",
          "total_calls",
          "total_amount_yen",
          "top"
        ],
        "title": "ToolUsageResponse",
        "type": "object"
      },
      "ToolUsageRow": {
        "properties": {
          "amount_yen": {
            "title": "Amount Yen",
            "type": "integer"
          },
          "avg_latency_ms": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "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.",
            "title": "Avg Latency Ms"
          },
          "calls": {
            "title": "Calls",
            "type": "integer"
          },
          "endpoint": {
            "title": "Endpoint",
            "type": "string"
          }
        },
        "required": [
          "endpoint",
          "calls",
          "amount_yen"
        ],
        "title": "ToolUsageRow",
        "type": "object"
      },
      "TrackRequest": {
        "additionalProperties": false,
        "properties": {
          "advisor_id": {
            "title": "Advisor Id",
            "type": "integer"
          },
          "source_program_id": {
            "anyOf": [
              {
                "maxLength": 120,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Program Id"
          },
          "source_query_hash": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Query Hash"
          }
        },
        "required": [
          "advisor_id"
        ],
        "title": "TrackRequest",
        "type": "object"
      },
      "TrackResponse": {
        "additionalProperties": false,
        "properties": {
          "redirect_url": {
            "title": "Redirect Url",
            "type": "string"
          },
          "token": {
            "title": "Token",
            "type": "string"
          }
        },
        "required": [
          "token",
          "redirect_url"
        ],
        "title": "TrackResponse",
        "type": "object"
      },
      "UnsubscribeResponse": {
        "properties": {
          "at": {
            "title": "At",
            "type": "string"
          },
          "unsubscribed": {
            "title": "Unsubscribed",
            "type": "boolean"
          }
        },
        "required": [
          "unsubscribed",
          "at"
        ],
        "title": "UnsubscribeResponse",
        "type": "object"
      },
      "UsageDayBucket": {
        "additionalProperties": true,
        "properties": {
          "count": {
            "default": 0,
            "title": "Count",
            "type": "integer"
          },
          "cumulative": {
            "default": 0,
            "title": "Cumulative",
            "type": "integer"
          },
          "date": {
            "title": "Date",
            "type": "string"
          }
        },
        "required": [
          "date"
        ],
        "title": "UsageDayBucket",
        "type": "object"
      },
      "UsageResponse": {
        "additionalProperties": true,
        "description": "``GET /v1/stats/usage`` — past-30d anonymous request counts.",
        "properties": {
          "daily": {
            "items": {
              "$ref": "#/components/schemas/UsageDayBucket"
            },
            "title": "Daily",
            "type": "array"
          },
          "generated_at": {
            "title": "Generated At",
            "type": "string"
          },
          "since": {
            "title": "Since",
            "type": "string"
          },
          "total": {
            "default": 0,
            "title": "Total",
            "type": "integer"
          },
          "until": {
            "title": "Until",
            "type": "string"
          },
          "window_days": {
            "default": 30,
            "title": "Window Days",
            "type": "integer"
          }
        },
        "required": [
          "since",
          "until",
          "generated_at"
        ],
        "title": "UsageResponse",
        "type": "object"
      },
      "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.",
        "properties": {
          "limit": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Limit"
          },
          "note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Note"
          },
          "remaining": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Remaining"
          },
          "reset_at": {
            "title": "Reset At",
            "type": "string"
          },
          "reset_timezone": {
            "title": "Reset Timezone",
            "type": "string"
          },
          "tier": {
            "title": "Tier",
            "type": "string"
          },
          "upgrade_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Upgrade Url"
          },
          "used": {
            "title": "Used",
            "type": "integer"
          }
        },
        "required": [
          "tier",
          "limit",
          "remaining",
          "used",
          "reset_at",
          "reset_timezone"
        ],
        "title": "UsageStatus",
        "type": "object"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "title": "Location",
            "type": "array"
          },
          "msg": {
            "title": "Message",
            "type": "string"
          },
          "type": {
            "title": "Error Type",
            "type": "string"
          }
        },
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError",
        "type": "object"
      },
      "WebhookResponse": {
        "properties": {
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "event_types": {
            "items": {
              "type": "string"
            },
            "title": "Event Types",
            "type": "array"
          },
          "failure_count": {
            "title": "Failure Count",
            "type": "integer"
          },
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "last_delivery_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Delivery At"
          },
          "secret_hmac": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Secret Hmac"
          },
          "secret_last4": {
            "title": "Secret Last4",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "url": {
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "id",
          "url",
          "event_types",
          "status",
          "failure_count",
          "last_delivery_at",
          "created_at",
          "secret_last4"
        ],
        "title": "WebhookResponse",
        "type": "object"
      },
      "WidgetSignupRequest": {
        "properties": {
          "cancel_url": {
            "title": "Cancel Url",
            "type": "string"
          },
          "email": {
            "format": "email",
            "title": "Email",
            "type": "string"
          },
          "label": {
            "anyOf": [
              {
                "maxLength": 120,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Label"
          },
          "origins": {
            "items": {
              "type": "string"
            },
            "maxItems": 20,
            "minItems": 1,
            "title": "Origins",
            "type": "array"
          },
          "plan": {
            "default": "business",
            "title": "Plan",
            "type": "string"
          },
          "success_url": {
            "title": "Success Url",
            "type": "string"
          }
        },
        "required": [
          "email",
          "origins",
          "success_url",
          "cancel_url"
        ],
        "title": "WidgetSignupRequest",
        "type": "object"
      },
      "WidgetSignupResponse": {
        "properties": {
          "checkout_url": {
            "title": "Checkout Url",
            "type": "string"
          },
          "session_id": {
            "title": "Session Id",
            "type": "string"
          }
        },
        "required": [
          "checkout_url",
          "session_id"
        ],
        "title": "WidgetSignupResponse",
        "type": "object"
      },
      "jpintel_mcp__api__advisors__SignupRequest": {
        "additionalProperties": false,
        "properties": {
          "address": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Address"
          },
          "agreed_to_terms": {
            "description": "must be true",
            "title": "Agreed To Terms",
            "type": "boolean"
          },
          "city": {
            "anyOf": [
              {
                "maxLength": 100,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "City"
          },
          "commission_model": {
            "default": "flat",
            "enum": [
              "flat",
              "percent"
            ],
            "title": "Commission Model",
            "type": "string"
          },
          "commission_rate_pct": {
            "default": 5,
            "maximum": 30.0,
            "minimum": 1.0,
            "title": "Commission Rate Pct",
            "type": "integer"
          },
          "commission_yen_per_intro": {
            "default": 3000,
            "maximum": 100000.0,
            "minimum": 100.0,
            "title": "Commission Yen Per Intro",
            "type": "integer"
          },
          "contact_email": {
            "format": "email",
            "title": "Contact Email",
            "type": "string"
          },
          "contact_phone": {
            "anyOf": [
              {
                "maxLength": 30,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Contact Phone"
          },
          "contact_url": {
            "anyOf": [
              {
                "format": "uri",
                "maxLength": 2083,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Contact Url"
          },
          "firm_name": {
            "maxLength": 200,
            "minLength": 1,
            "title": "Firm Name",
            "type": "string"
          },
          "firm_name_kana": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Firm Name Kana"
          },
          "firm_type": {
            "enum": [
              "税理士法人",
              "認定支援機関",
              "社会保険労務士",
              "中小企業診断士",
              "行政書士",
              "弁護士",
              "銀行",
              "商工会議所",
              "その他"
            ],
            "title": "Firm Type",
            "type": "string"
          },
          "houjin_bangou": {
            "description": "13 digits",
            "title": "Houjin Bangou",
            "type": "string"
          },
          "industries": {
            "anyOf": [
              {
                "items": {
                  "enum": [
                    "agri",
                    "manufacture",
                    "it",
                    "service",
                    "construction",
                    "retail"
                  ],
                  "type": "string"
                },
                "maxItems": 6,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Industries"
          },
          "intro_blurb": {
            "anyOf": [
              {
                "maxLength": 400,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Intro Blurb"
          },
          "prefecture": {
            "description": "canonical ('東京都')",
            "title": "Prefecture",
            "type": "string"
          },
          "specialties": {
            "items": {
              "enum": [
                "subsidy",
                "loan",
                "tax",
                "enforcement_defense",
                "invoice",
                "ebook"
              ],
              "type": "string"
            },
            "maxItems": 6,
            "minItems": 1,
            "title": "Specialties",
            "type": "array"
          }
        },
        "required": [
          "firm_name",
          "houjin_bangou",
          "firm_type",
          "specialties",
          "prefecture",
          "contact_email",
          "agreed_to_terms"
        ],
        "title": "SignupRequest",
        "type": "object"
      },
      "jpintel_mcp__api__advisors__SignupResponse": {
        "additionalProperties": false,
        "properties": {
          "advisor_id": {
            "title": "Advisor Id",
            "type": "integer"
          },
          "next_step": {
            "const": "stripe_connect",
            "default": "stripe_connect",
            "title": "Next Step",
            "type": "string"
          },
          "stripe_connect_onboarding_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "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.",
            "title": "Stripe Connect Onboarding Url"
          }
        },
        "required": [
          "advisor_id"
        ],
        "title": "SignupResponse",
        "type": "object"
      },
      "jpintel_mcp__api__alerts__SubscribeRequest": {
        "properties": {
          "email": {
            "anyOf": [
              {
                "format": "email",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email"
          },
          "filter_type": {
            "enum": [
              "tool",
              "law_id",
              "program_id",
              "industry_jsic",
              "all"
            ],
            "title": "Filter Type",
            "type": "string"
          },
          "filter_value": {
            "anyOf": [
              {
                "maxLength": 256,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Filter Value"
          },
          "min_severity": {
            "default": "important",
            "enum": [
              "critical",
              "important",
              "info"
            ],
            "title": "Min Severity",
            "type": "string"
          },
          "webhook_url": {
            "anyOf": [
              {
                "maxLength": 2048,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Webhook Url"
          }
        },
        "required": [
          "filter_type"
        ],
        "title": "SubscribeRequest",
        "type": "object"
      },
      "jpintel_mcp__api__billing__CheckoutRequest": {
        "properties": {
          "cancel_url": {
            "title": "Cancel Url",
            "type": "string"
          },
          "customer_email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Customer Email"
          },
          "success_url": {
            "title": "Success Url",
            "type": "string"
          }
        },
        "required": [
          "success_url",
          "cancel_url"
        ],
        "title": "CheckoutRequest",
        "type": "object"
      },
      "jpintel_mcp__api__compliance__CheckoutRequest": {
        "properties": {
          "cancel_url": {
            "default": "https://jpcite.com/alerts.html?status=canceled",
            "title": "Cancel Url",
            "type": "string"
          },
          "subscriber_id": {
            "title": "Subscriber Id",
            "type": "integer"
          },
          "success_url": {
            "default": "https://jpcite.com/alerts.html?status=ok",
            "title": "Success Url",
            "type": "string"
          }
        },
        "required": [
          "subscriber_id"
        ],
        "title": "CheckoutRequest",
        "type": "object"
      },
      "jpintel_mcp__api__compliance__CheckoutResponse": {
        "properties": {
          "session_id": {
            "title": "Session Id",
            "type": "string"
          },
          "url": {
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "url",
          "session_id"
        ],
        "title": "CheckoutResponse",
        "type": "object"
      },
      "jpintel_mcp__api__compliance__SubscribeRequest": {
        "properties": {
          "areas_of_interest": {
            "items": {
              "type": "string"
            },
            "maxItems": 7,
            "minItems": 1,
            "title": "Areas Of Interest",
            "type": "array"
          },
          "email": {
            "format": "email",
            "title": "Email",
            "type": "string"
          },
          "houjin_bangou": {
            "anyOf": [
              {
                "maxLength": 13,
                "minLength": 13,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Houjin Bangou"
          },
          "industry_codes": {
            "items": {
              "type": "string"
            },
            "maxItems": 12,
            "title": "Industry Codes",
            "type": "array"
          },
          "plan": {
            "default": "free",
            "enum": [
              "free",
              "paid"
            ],
            "title": "Plan",
            "type": "string"
          },
          "prefecture": {
            "anyOf": [
              {
                "maxLength": 16,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Prefecture"
          },
          "source_lang": {
            "default": "ja",
            "enum": [
              "ja",
              "en"
            ],
            "title": "Source Lang",
            "type": "string"
          }
        },
        "required": [
          "email",
          "areas_of_interest"
        ],
        "title": "SubscribeRequest",
        "type": "object"
      },
      "jpintel_mcp__api__compliance__SubscribeResponse": {
        "properties": {
          "checkout_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Checkout Url"
          },
          "next_step": {
            "enum": [
              "verify",
              "checkout"
            ],
            "title": "Next Step",
            "type": "string"
          },
          "subscriber_id": {
            "title": "Subscriber Id",
            "type": "integer"
          }
        },
        "required": [
          "subscriber_id",
          "next_step"
        ],
        "title": "SubscribeResponse",
        "type": "object"
      },
      "jpintel_mcp__api__invoice_registrants__SearchResponse": {
        "additionalProperties": false,
        "properties": {
          "attribution": {
            "$ref": "#/components/schemas/AttributionBlock"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/InvoiceRegistrantOut"
            },
            "title": "Results",
            "type": "array"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "total",
          "limit",
          "offset",
          "results",
          "attribution"
        ],
        "title": "SearchResponse",
        "type": "object"
      },
      "jpintel_mcp__api__me__UsageDay": {
        "properties": {
          "calls": {
            "title": "Calls",
            "type": "integer"
          },
          "date": {
            "title": "Date",
            "type": "string"
          }
        },
        "required": [
          "date",
          "calls"
        ],
        "title": "UsageDay",
        "type": "object"
      },
      "jpintel_mcp__api__saved_searches__DeleteResponse": {
        "properties": {
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "ok": {
            "title": "Ok",
            "type": "boolean"
          }
        },
        "required": [
          "ok",
          "id"
        ],
        "title": "DeleteResponse",
        "type": "object"
      },
      "jpintel_mcp__api__signup__SignupRequest": {
        "properties": {
          "email": {
            "description": "Reachable email address — a magic-link verification mail is sent here. (連絡可能なメールアドレス。マジックリンクが届きます。)",
            "format": "email",
            "title": "Email",
            "type": "string"
          }
        },
        "required": [
          "email"
        ],
        "title": "SignupRequest",
        "type": "object"
      },
      "jpintel_mcp__api__signup__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).",
        "properties": {
          "accepted": {
            "default": true,
            "title": "Accepted",
            "type": "boolean"
          },
          "detail": {
            "default": "メールに記載されたリンクをクリックすると API キーが発行されます。リンクの有効期限は 24 時間です。",
            "title": "Detail",
            "type": "string"
          }
        },
        "title": "SignupResponse",
        "type": "object"
      },
      "jpintel_mcp__api__subscribers__SubscribeRequest": {
        "properties": {
          "email": {
            "format": "email",
            "title": "Email",
            "type": "string"
          },
          "source": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source"
          }
        },
        "required": [
          "email"
        ],
        "title": "SubscribeRequest",
        "type": "object"
      },
      "jpintel_mcp__api__subscribers__SubscribeResponse": {
        "properties": {
          "subscribed": {
            "title": "Subscribed",
            "type": "boolean"
          }
        },
        "required": [
          "subscribed"
        ],
        "title": "SubscribeResponse",
        "type": "object"
      },
      "jpintel_mcp__models__SearchResponse": {
        "properties": {
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "results": {
            "items": {
              "$ref": "#/components/schemas/Program"
            },
            "title": "Results",
            "type": "array"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "total",
          "limit",
          "offset",
          "results"
        ],
        "title": "SearchResponse",
        "type": "object"
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "description": "Customer API key issued via Stripe Checkout. Anonymous tier (no key) gets 50 req/月 per IP.",
        "in": "header",
        "name": "X-API-Key",
        "type": "apiKey"
      }
    }
  },
  "info": {
    "contact": {
      "email": "info@bookyou.net",
      "name": "AutonoMath Support"
    },
    "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 rows are on public-hold pending secondary review 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), 代表 梅田茂利, info@bookyou.net. Canonical site: https://jpcite.com. MCP package: `pip install autonomath-mcp` (PyPI). MCP exposes 89 tools at default gates  + 30 autonomath; protocol 2025-06-18).\n\n---\n\n## 日本語要約 (JP summary)\n\nAutonoMath (jpcite) は **10,790 件の補助金 / 融資 / 税制 / 認定** (tier S/A/B/C のみ検索対象、公開保留 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 / 代表 梅田茂利 / info@bookyou.net / 東京都文京区小日向2-22-1)。商号: jpcite。公式サイト: https://jpcite.com/.",
    "license": {
      "name": "Proprietary - see termsOfService"
    },
    "termsOfService": "https://jpcite.com/terms.html",
    "title": "AutonoMath",
    "version": "0.3.1"
  },
  "openapi": "3.1.0",
  "paths": {
    "/healthz": {
      "get": {
        "operationId": "healthz_healthz_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Healthz Healthz Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Healthz",
        "tags": [
          "meta"
        ]
      }
    },
    "/readyz": {
      "get": {
        "operationId": "readyz_readyz_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Readyz"
      }
    },
    "/v1/advisors/match": {
      "get": {
        "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": [
          {
            "description": "都道府県. Accepts canonical, short, or romaji.",
            "in": "query",
            "name": "prefecture",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "都道府県. Accepts canonical, short, or romaji.",
              "title": "Prefecture"
            }
          },
          {
            "in": "query",
            "name": "specialty",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "subsidy",
                    "loan",
                    "tax",
                    "enforcement_defense",
                    "invoice",
                    "ebook"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Specialty"
            }
          },
          {
            "in": "query",
            "name": "industry",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "agri",
                    "manufacture",
                    "it",
                    "service",
                    "construction",
                    "retail"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Industry"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 3,
              "maximum": 10,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MatchResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Match Advisors",
        "tags": [
          "advisors"
        ]
      }
    },
    "/v1/advisors/report-conversion": {
      "post": {
        "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": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "conversion recorded"
          },
          "404": {
            "description": "token unknown"
          },
          "409": {
            "description": "already converted"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Report Conversion",
        "tags": [
          "advisors"
        ]
      }
    },
    "/v1/advisors/signup": {
      "post": {
        "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": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/jpintel_mcp__api__advisors__SignupResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "409": {
            "description": "houjin_bangou already registered"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Signup Advisor",
        "tags": [
          "advisors"
        ]
      }
    },
    "/v1/advisors/track": {
      "post": {
        "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": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TrackRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrackResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Track Click",
        "tags": [
          "advisors"
        ]
      }
    },
    "/v1/advisors/verify-houjin/{advisor_id}": {
      "post": {
        "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": [
          {
            "in": "path",
            "name": "advisor_id",
            "required": true,
            "schema": {
              "title": "Advisor Id",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "verified"
          },
          "404": {
            "description": "advisor not found"
          },
          "422": {
            "description": "houjin_bangou not found in NTA registry"
          }
        },
        "summary": "Verify Houjin",
        "tags": [
          "advisors"
        ]
      }
    },
    "/v1/advisors/{advisor_id}/dashboard-data": {
      "get": {
        "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": [
          {
            "in": "path",
            "name": "advisor_id",
            "required": true,
            "schema": {
              "title": "Advisor Id",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdvisorDashboardResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Dashboard Data",
        "tags": [
          "advisors"
        ]
      }
    },
    "/v1/am/acceptance_stats": {
      "get": {
        "description": "採択率 / 採択事例 statistics from am_entities (supersedes cross-DB acceptance_stats_tool).",
        "operationId": "rest_search_acceptance_stats_v1_am_acceptance_stats_get",
        "parameters": [
          {
            "in": "query",
            "name": "program_name",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Program Name"
            }
          },
          {
            "in": "query",
            "name": "year",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maximum": 2099,
                  "minimum": 1988,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Year"
            }
          },
          {
            "in": "query",
            "name": "region",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 100,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Region"
            }
          },
          {
            "in": "query",
            "name": "industry",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 100,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Industry"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AMSearchResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rest Search Acceptance Stats",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/active_at": {
      "get": {
        "description": "Point-in-time snapshot: programs whose effective window covered a given date.",
        "operationId": "rest_active_programs_at_v1_am_active_at_get",
        "parameters": [
          {
            "description": "ISO YYYY-MM-DD",
            "in": "query",
            "name": "date",
            "required": true,
            "schema": {
              "description": "ISO YYYY-MM-DD",
              "maxLength": 10,
              "minLength": 10,
              "title": "Date",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "region",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 100,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Region"
            }
          },
          {
            "in": "query",
            "name": "industry",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 100,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Industry"
            }
          },
          {
            "in": "query",
            "name": "size",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "sole",
                    "small",
                    "sme",
                    "mid",
                    "large"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Size"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AMActiveAtResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rest Active Programs At",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/annotations/{entity_id}": {
      "get": {
        "description": "am_entity_annotation 逆引き — examiner feedback / quality score / ML 推論 等を 1 コール (16,474 行).",
        "operationId": "rest_get_annotations_v1_am_annotations__entity_id__get",
        "parameters": [
          {
            "description": "am_entities.canonical_id (TEXT)",
            "in": "path",
            "name": "entity_id",
            "required": true,
            "schema": {
              "description": "am_entities.canonical_id (TEXT)",
              "maxLength": 200,
              "minLength": 1,
              "title": "Entity Id",
              "type": "string"
            }
          },
          {
            "description": "Filter on annotation kind (examiner_warning / examiner_correction / quality_score / validation_failure / ml_inference / manual_note). Repeat the param to OR-combine.",
            "in": "query",
            "name": "kinds",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                {
                  "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": "Include visibility='internal' rows (default False = public only). 'private' is never returned.",
            "in": "query",
            "name": "include_internal",
            "required": false,
            "schema": {
              "default": false,
              "description": "Include visibility='internal' rows (default False = public only). 'private' is never returned.",
              "title": "Include Internal",
              "type": "boolean"
            }
          },
          {
            "description": "Include superseded / expired annotations (default False = currently-live only).",
            "in": "query",
            "name": "include_superseded",
            "required": false,
            "schema": {
              "default": false,
              "description": "Include superseded / expired annotations (default False = currently-live only).",
              "title": "Include Superseded",
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 500,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AMAnnotationsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rest Get Annotations",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/audit-log": {
      "get": {
        "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": [
          {
            "description": "ISO YYYY-MM-DD UTC floor on detected_at.",
            "in": "query",
            "name": "since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 10,
                  "minLength": 10,
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "ISO YYYY-MM-DD UTC floor on detected_at.",
              "title": "Since"
            }
          },
          {
            "description": "Exact match on am_entities.canonical_id.",
            "in": "query",
            "name": "entity_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "minLength": 1,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Exact match on am_entities.canonical_id.",
              "title": "Entity Id"
            }
          },
          {
            "description": "Opaque pagination cursor from a previous response. Omit for the first page.",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "minLength": 1,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Opaque pagination cursor from a previous response. Omit for the first page.",
              "title": "Cursor"
            }
          },
          {
            "description": "Max rows per page (default 50).",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "description": "Max rows per page (default 50).",
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "filter": {
                    "since": "2026-04-01"
                  },
                  "limit": 100,
                  "next_cursor": "MjAyNi0wNC0yOFQwMzoxNDoyMnwxMjM0NQ",
                  "results": [
                    {
                      "detected_at": "2026-04-28T03:14:22+00:00",
                      "diff_id": 12345,
                      "entity_id": "program_jigyou_saikouchiku_2026",
                      "field_name": "amount_max_yen",
                      "field_name_ja": "補助上限額",
                      "new_hash": "7a1b2d...",
                      "new_value": "200000000",
                      "prev_hash": "9c3f8e...",
                      "prev_value": "150000000",
                      "source_url": "https://jigyou-saikouchiku.go.jp/..."
                    }
                  ]
                },
                "schema": {}
              }
            },
            "description": "Reverse-chrono diff rows + next_cursor."
          },
          "400": {
            "description": "Invalid cursor / since format."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Public audit log of am_amendment_diff (reverse-chrono, cursor-paginated)",
        "tags": [
          "audit-log"
        ]
      }
    },
    "/v1/am/by_law": {
      "get": {
        "description": "Programs / tax rules / certifications linked to a specific law (fuzzy name match).",
        "operationId": "rest_search_by_law_v1_am_by_law_get",
        "parameters": [
          {
            "in": "query",
            "name": "law_name",
            "required": true,
            "schema": {
              "maxLength": 200,
              "minLength": 1,
              "title": "Law Name",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "article",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 40,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Article"
            }
          },
          {
            "in": "query",
            "name": "amendment_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 10,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Amendment Date"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AMByLawResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rest Search By Law",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/certifications": {
      "get": {
        "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": [
          {
            "in": "query",
            "name": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Query"
            }
          },
          {
            "in": "query",
            "name": "authority",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "経済産業省",
                    "日本健康会議",
                    "厚生労働省",
                    "内閣府",
                    "都道府県",
                    "市町村",
                    "農林水産省",
                    "国土交通省",
                    "その他"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authority"
            }
          },
          {
            "in": "query",
            "name": "size",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "sole",
                    "small",
                    "sme",
                    "mid",
                    "large"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Size"
            }
          },
          {
            "in": "query",
            "name": "industry",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 100,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Industry"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "limit": 20,
                  "offset": 0,
                  "results": [
                    {
                      "authority": "厚生労働省",
                      "entity_id": "cert_kurumin_2026",
                      "industry_target": [
                        "all"
                      ],
                      "issuance_basis": "次世代育成支援対策推進法",
                      "name": "くるみん認定 (子育てサポート企業)",
                      "size_target": [
                        "sme",
                        "large"
                      ],
                      "source_url": "https://www.mhlw.go.jp/general/seido/koyou/kurumin/",
                      "validity_years": 2
                    }
                  ],
                  "total": 1
                },
                "schema": {
                  "$ref": "#/components/schemas/AMSearchResponse"
                }
              }
            },
            "description": "AMSearchResponse — paginated certification entities."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Search 認定・認証制度 (健康経営, えるぼし, くるみん, 経営革新等支援機関 etc.)",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/data-freshness": {
      "get": {
        "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": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Data Freshness V1 Am Data Freshness Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Data Freshness",
        "tags": [
          "transparency",
          "trust"
        ]
      }
    },
    "/v1/am/enforcement": {
      "get": {
        "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": [
          {
            "in": "query",
            "name": "houjin_bangou",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 20,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Houjin Bangou"
            }
          },
          {
            "in": "query",
            "name": "target_name",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Target Name"
            }
          },
          {
            "in": "query",
            "name": "as_of_date",
            "required": false,
            "schema": {
              "default": "today",
              "maxLength": 10,
              "title": "As Of Date",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "active_cases": [],
                  "as_of_date": "2026-04-29",
                  "houjin_bangou": "1234567890123",
                  "is_currently_barred": false,
                  "past_cases": [
                    {
                      "amount_improper_grant_yen": 89073000,
                      "case_id": "jbaudit_r03_2021-r03-0046-0_1",
                      "disclosed_date": "2022-11-07",
                      "disclosed_until": "2027-11-06",
                      "event_type": "clawback",
                      "legal_basis": "補助金等に係る予算の執行の適正化に関する法律 第17条",
                      "ministry": "内閣府",
                      "source_url": "https://report.jbaudit.go.jp/org/r03/2021-r03-0046-0.htm"
                    }
                  ]
                },
                "schema": {
                  "$ref": "#/components/schemas/AMEnforcementCheckResponse"
                }
              }
            },
            "description": "Enforcement status snapshot at `as_of_date`."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Check 行政処分 / 排除期間 status for a 法人番号 or 事業者名",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/enums/{enum_name}": {
      "get": {
        "description": "List canonical enum values + frequency for a given enum_name.",
        "operationId": "rest_enum_values_v1_am_enums__enum_name__get",
        "parameters": [
          {
            "in": "path",
            "name": "enum_name",
            "required": true,
            "schema": {
              "enum": [
                "authority",
                "tier",
                "industry",
                "funding_purpose",
                "target_type",
                "region",
                "tax_category",
                "program_kind",
                "loan_type",
                "event_type",
                "ministry",
                "certification_authority"
              ],
              "title": "Enum Name",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AMEnumValuesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rest Enum Values",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/example_profiles": {
      "get": {
        "description": "List 5 canonical client-intake example payloads (PII-clean).",
        "operationId": "rest_list_example_profiles_v1_am_example_profiles_get",
        "parameters": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExampleProfileList"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rest List Example Profiles",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/example_profiles/{profile_id}": {
      "get": {
        "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": [
          {
            "description": "Profile id; see /v1/am/example_profiles.",
            "in": "path",
            "name": "profile_id",
            "required": true,
            "schema": {
              "description": "Profile id; see /v1/am/example_profiles.",
              "maxLength": 64,
              "minLength": 1,
              "title": "Profile Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExampleProfileDetail"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rest Get Example Profile",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/gx_programs": {
      "get": {
        "description": "GX / 脱炭素 / 再エネ / EV / ZEB-ZEH curated 補助金 programs.",
        "operationId": "rest_search_gx_programs_v1_am_gx_programs_get",
        "parameters": [
          {
            "in": "query",
            "name": "theme",
            "required": false,
            "schema": {
              "default": "ghg_reduction",
              "enum": [
                "ghg_reduction",
                "ev",
                "renewable",
                "zeb_zeh",
                "carbon_credit"
              ],
              "title": "Theme",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "company_size",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "sme",
                    "midsize",
                    "large",
                    "individual",
                    "municipality",
                    "farmer"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Company Size"
            }
          },
          {
            "in": "query",
            "name": "region",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 100,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Region"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AMSimpleSearchResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rest Search Gx Programs",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/health/deep": {
      "get": {
        "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": [
          {
            "in": "query",
            "name": "force",
            "required": false,
            "schema": {
              "default": false,
              "title": "Force",
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeepHealthResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rest Deep Health",
        "tags": [
          "autonomath-health"
        ]
      }
    },
    "/v1/am/intent": {
      "get": {
        "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": [
          {
            "in": "query",
            "name": "query",
            "required": true,
            "schema": {
              "maxLength": 500,
              "minLength": 1,
              "title": "Query",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AMIntentResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rest Intent Of",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/law_article": {
      "get": {
        "description": "Exact 条文 lookup: '租税特別措置法' + '41の19' → full article text + amendment history.",
        "operationId": "rest_get_law_article_v1_am_law_article_get",
        "parameters": [
          {
            "in": "query",
            "name": "law_name_or_canonical_id",
            "required": true,
            "schema": {
              "maxLength": 200,
              "minLength": 1,
              "title": "Law Name Or Canonical Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "article_number",
            "required": true,
            "schema": {
              "maxLength": 40,
              "minLength": 1,
              "title": "Article Number",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AMLawArticleResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rest Get Law Article",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/loans": {
      "get": {
        "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": [
          {
            "in": "query",
            "name": "loan_kind",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "ippan",
                    "trou",
                    "seirei",
                    "sanko",
                    "sogyo",
                    "rinsei",
                    "saigai",
                    "shingiseikyu",
                    "kiki",
                    "other"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Loan Kind"
            }
          },
          {
            "in": "query",
            "name": "no_collateral",
            "required": false,
            "schema": {
              "default": false,
              "title": "No Collateral",
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "no_personal_guarantor",
            "required": false,
            "schema": {
              "default": false,
              "title": "No Personal Guarantor",
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "no_third_party_guarantor",
            "required": false,
            "schema": {
              "default": false,
              "title": "No Third Party Guarantor",
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "max_amount_yen",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 0,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Max Amount Yen"
            }
          },
          {
            "in": "query",
            "name": "min_amount_yen",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 0,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Min Amount Yen"
            }
          },
          {
            "in": "query",
            "name": "lender_entity_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 100,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Lender Entity Id"
            }
          },
          {
            "in": "query",
            "name": "name_query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Name Query"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 10,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "limit": 10,
                  "results": [
                    {
                      "amount_max_yen": 72000000,
                      "collateral_required": "negotiable",
                      "entity_id": "loan_jfc_kokumin_shinki_kaigyou",
                      "interest_rate_annual": 0.041,
                      "lender": "日本政策金融公庫 国民生活事業",
                      "loan_kind": "special_rate",
                      "loan_period_years_max": 20,
                      "name": "新規開業・スタートアップ支援資金",
                      "personal_guarantor_required": "negotiable",
                      "source_url": "https://www.jfc.go.jp/n/finance/search/01_sinkikaigyou_m.html",
                      "third_party_guarantor_required": "negotiable"
                    }
                  ],
                  "total": 1
                },
                "schema": {
                  "$ref": "#/components/schemas/AMLoanSearchResponse"
                }
              }
            },
            "description": "AMLoanSearchResponse — ranked loan products."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Search loan products (公庫 / 商工中金 / 自治体制度融資) with 3-axis risk filter",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/mutual_plans": {
      "get": {
        "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": [
          {
            "in": "query",
            "name": "plan_kind",
            "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"
            }
          },
          {
            "in": "query",
            "name": "premium_monthly_yen",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 0,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Premium Monthly Yen"
            }
          },
          {
            "in": "query",
            "name": "tax_deduction_type",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "small_enterprise_deduction",
                    "idekodc",
                    "group_retirement",
                    "corp_expense",
                    "none"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Tax Deduction Type"
            }
          },
          {
            "in": "query",
            "name": "provider_entity_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 100,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Provider Entity Id"
            }
          },
          {
            "in": "query",
            "name": "name_query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Name Query"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 10,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AMLoanSearchResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Search mutual-aid / pension / workers' comp plans (共済 / 年金 / 労災)",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/open_programs": {
      "get": {
        "description": "Currently-open (公募中) program rounds on a target date.",
        "operationId": "rest_list_open_programs_v1_am_open_programs_get",
        "parameters": [
          {
            "description": "ISO YYYY-MM-DD. Default = today.",
            "in": "query",
            "name": "on_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 10,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "ISO YYYY-MM-DD. Default = today.",
              "title": "On Date"
            }
          },
          {
            "in": "query",
            "name": "region",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 100,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Region"
            }
          },
          {
            "in": "query",
            "name": "industry",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 100,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Industry"
            }
          },
          {
            "in": "query",
            "name": "size",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "sole",
                    "small",
                    "sme",
                    "mid",
                    "large"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Size"
            }
          },
          {
            "in": "query",
            "name": "natural_query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 500,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Natural Query"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AMOpenProgramsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rest List Open Programs",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/programs/active_v2": {
      "get": {
        "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": [
          {
            "description": "ISO YYYY-MM-DD. effective window pivot. Defaults to today (JST date as ISO).",
            "in": "query",
            "name": "as_of",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 10,
                  "minLength": 10,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "ISO YYYY-MM-DD. effective window pivot. Defaults to today (JST date as ISO).",
              "title": "As Of"
            }
          },
          {
            "description": "Filter to rounds whose application_open_date <= this date.",
            "in": "query",
            "name": "application_open_by",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 10,
                  "minLength": 10,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to rounds whose application_open_date <= this date.",
              "title": "Application Open By"
            }
          },
          {
            "description": "Filter to rounds whose application_close_date >= this date (締切がこの日以降).",
            "in": "query",
            "name": "application_close_by",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 10,
                  "minLength": 10,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter to rounds whose application_close_date >= this date (締切がこの日以降).",
              "title": "Application Close By"
            }
          },
          {
            "description": "Optional prefecture filter (e.g. '東京都').",
            "in": "query",
            "name": "prefecture",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 20,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Optional prefecture filter (e.g. '東京都').",
              "title": "Prefecture"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rest Programs Active At V2",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/programs/{program_id}/sources": {
      "get": {
        "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": [
          {
            "in": "path",
            "name": "program_id",
            "required": true,
            "schema": {
              "maxLength": 120,
              "minLength": 1,
              "title": "Program Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Program Sources V1 Am Programs  Program Id  Sources Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Program Sources",
        "tags": [
          "transparency",
          "trust"
        ]
      }
    },
    "/v1/am/provenance/fact/{fact_id}": {
      "get": {
        "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": [
          {
            "description": "am_entity_facts.id (INTEGER PK)",
            "in": "path",
            "name": "fact_id",
            "required": true,
            "schema": {
              "description": "am_entity_facts.id (INTEGER PK)",
              "minimum": 1,
              "title": "Fact Id",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AMProvenanceResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rest Get Provenance For Fact",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/provenance/{entity_id}": {
      "get": {
        "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": [
          {
            "description": "am_entities.canonical_id (TEXT)",
            "in": "path",
            "name": "entity_id",
            "required": true,
            "schema": {
              "description": "am_entities.canonical_id (TEXT)",
              "maxLength": 200,
              "minLength": 1,
              "title": "Entity Id",
              "type": "string"
            }
          },
          {
            "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.",
            "in": "query",
            "name": "include_facts",
            "required": false,
            "schema": {
              "default": false,
              "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.",
              "title": "Include Facts",
              "type": "boolean"
            }
          },
          {
            "description": "Max facts when include_facts=True (default 200).",
            "in": "query",
            "name": "fact_limit",
            "required": false,
            "schema": {
              "default": 200,
              "description": "Max facts when include_facts=True (default 200).",
              "maximum": 1000,
              "minimum": 1,
              "title": "Fact Limit",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AMProvenanceResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rest Get Provenance",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/reason": {
      "get": {
        "description": "Return a citation-backed narrative answer (source_url + snippet per claim).",
        "operationId": "rest_reason_answer_v1_am_reason_get",
        "parameters": [
          {
            "in": "query",
            "name": "query",
            "required": true,
            "schema": {
              "maxLength": 500,
              "minLength": 1,
              "title": "Query",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "persona",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 100,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Persona"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AMReasonResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rest Reason Answer",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/related/{program_id}": {
      "get": {
        "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": [
          {
            "in": "path",
            "name": "program_id",
            "required": true,
            "schema": {
              "title": "Program Id",
              "type": "string"
            }
          },
          {
            "description": "Filter edge types (prerequisite / compatible / incompatible / replaces / …).",
            "in": "query",
            "name": "relation_types",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter edge types (prerequisite / compatible / incompatible / replaces / …).",
              "title": "Relation Types"
            }
          },
          {
            "in": "query",
            "name": "depth",
            "required": false,
            "schema": {
              "default": 1,
              "maximum": 3,
              "minimum": 1,
              "title": "Depth",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "max_edges",
            "required": false,
            "schema": {
              "default": 100,
              "maximum": 500,
              "minimum": 1,
              "title": "Max Edges",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AMRelatedResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rest Related Programs",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/static": {
      "get": {
        "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": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StaticResourceList"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rest List Static Resources",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/static/{resource_id}": {
      "get": {
        "description": "Load one taxonomy/lookup file. Returns full JSON content + license.",
        "operationId": "rest_get_static_resource_v1_am_static__resource_id__get",
        "parameters": [
          {
            "description": "Resource id; see /v1/am/static for the catalog.",
            "in": "path",
            "name": "resource_id",
            "required": true,
            "schema": {
              "description": "Resource id; see /v1/am/static for the catalog.",
              "maxLength": 64,
              "minLength": 1,
              "title": "Resource Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StaticResourceDetail"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rest Get Static Resource",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/tax_incentives": {
      "get": {
        "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": [
          {
            "in": "query",
            "name": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Query"
            }
          },
          {
            "in": "query",
            "name": "authority",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "国税庁",
                    "財務省",
                    "経済産業省",
                    "中小企業庁",
                    "農林水産省",
                    "総務省",
                    "国土交通省",
                    "厚生労働省",
                    "自治体"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authority"
            }
          },
          {
            "in": "query",
            "name": "industry",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 100,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Industry"
            }
          },
          {
            "in": "query",
            "name": "target_year",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maximum": 2099,
                  "minimum": 1988,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Target Year"
            }
          },
          {
            "in": "query",
            "name": "target_entity",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "中小企業",
                    "小規模事業者",
                    "個人事業主",
                    "大企業",
                    "認定事業者",
                    "青色申告者",
                    "農業法人",
                    "特定事業者等"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Target Entity"
            }
          },
          {
            "in": "query",
            "name": "natural_query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 500,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Natural Query"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "_disclaimer": "本情報は公開情報の検索結果であり、税務助言ではありません。申告・適用判断は税理士にご確認ください。",
                  "limit": 20,
                  "offset": 0,
                  "results": [
                    {
                      "amount_cap_yen": 30000000,
                      "authority": "国税庁",
                      "effective_from": "2025-04-01",
                      "effective_until": "2027-03-31",
                      "entity_id": "tax_measure_chusho_kvestigation_credit_2026",
                      "incentive_type": "credit",
                      "name": "中小企業投資促進税制 (税額控除7%)",
                      "rate": "7%",
                      "source_url": "https://www.nta.go.jp/...",
                      "tax_kind": "corporate"
                    }
                  ],
                  "total": 1
                },
                "schema": {
                  "$ref": "#/components/schemas/AMSearchResponse"
                }
              }
            },
            "description": "AMSearchResponse + `_disclaimer` (税理士法 §52 fence)."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Search 税制特例 (special depreciation, tax credits, NOL carryforward, exemptions)",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/tax_rule": {
      "get": {
        "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": [
          {
            "in": "query",
            "name": "measure_name_or_id",
            "required": true,
            "schema": {
              "maxLength": 200,
              "minLength": 1,
              "title": "Measure Name Or Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "rule_type",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 60,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Rule Type"
            }
          },
          {
            "description": "ISO YYYY-MM-DD (default today)",
            "in": "query",
            "name": "as_of",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 10,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "ISO YYYY-MM-DD (default today)",
              "title": "As Of"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AMTaxRuleResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rest Get Tax Rule",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/am/validate": {
      "post": {
        "description": "汎用 intake 検証 — am_validation_rule の active 述語を applicant_data に対して評価し\nrule 単位の passed/failed/deferred を返す (deferred = jpintel 内で評価できない外部依存述語).",
        "operationId": "rest_validate_v1_am_validate_post",
        "parameters": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Body_rest_validate_v1_am_validate_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AMValidateResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rest Validate",
        "tags": [
          "autonomath"
        ]
      }
    },
    "/v1/bids/search": {
      "get": {
        "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": [
          {
            "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.",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "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": "Filter by bid_kind. One of: open | selective | negotiated | kobo_subsidy.",
            "in": "query",
            "name": "bid_kind",
            "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": "Exact 13-digit 法人番号 of the procuring entity.",
            "in": "query",
            "name": "procuring_houjin_bangou",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^\\d{13}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Exact 13-digit 法人番号 of the procuring entity.",
              "title": "Procuring Houjin Bangou"
            }
          },
          {
            "description": "Exact 13-digit 法人番号 of the落札者.",
            "in": "query",
            "name": "winner_houjin_bangou",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^\\d{13}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Exact 13-digit 法人番号 of the落札者.",
              "title": "Winner Houjin Bangou"
            }
          },
          {
            "description": "Exact programs.unified_id (UNI-* / TAX-* / LAW-* etc.) — returns bids linked to that program via ingest matchers.",
            "in": "query",
            "name": "program_id_hint",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "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": "Inclusive lower bound on awarded_amount_yen (JPY). Rows with NULL awarded_amount_yen are excluded from the filtered set when this is set.",
            "in": "query",
            "name": "min_amount",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 0,
                  "type": "integer"
                },
                {
                  "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 upper bound on awarded_amount_yen (JPY). Rows with NULL awarded_amount_yen are excluded from the filtered set when this is set.",
            "in": "query",
            "name": "max_amount",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 0,
                  "type": "integer"
                },
                {
                  "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": "ISO date (YYYY-MM-DD) — inclusive lower bound on bid_deadline. Useful for 'still-open' queries.",
            "in": "query",
            "name": "deadline_after",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "ISO date (YYYY-MM-DD) — inclusive lower bound on bid_deadline. Useful for 'still-open' queries.",
              "title": "Deadline After"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "limit": 20,
                  "offset": 0,
                  "results": [
                    {
                      "announcement_date": "2026-04-14",
                      "bid_deadline": "2026-04-27",
                      "bid_kind": "open",
                      "bid_title": "農林水産省永年勤続者表彰用銀杯等の製造（単価契約）",
                      "classification_code": "物品の製造",
                      "confidence": 0.92,
                      "fetched_at": "2026-04-25T04:06:20Z",
                      "ministry": "農林水産省",
                      "procuring_entity": "農林水産省",
                      "source_url": "https://www.maff.go.jp/j/supply/nyusatu/buppin_ekimu/sonota1/index.html",
                      "unified_id": "BID-cf1aff5eb7",
                      "updated_at": "2026-04-25T04:06:20Z"
                    }
                  ],
                  "total": 1
                },
                "schema": {
                  "$ref": "#/components/schemas/BidsSearchResponse"
                }
              }
            },
            "description": "Paginated bids."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Search Japanese government bids (入札案件)",
        "tags": [
          "bids"
        ]
      }
    },
    "/v1/bids/{unified_id}": {
      "get": {
        "description": "Return a single 入札案件 by BID-<10 hex> unified_id.",
        "operationId": "get_bid_v1_bids__unified_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "unified_id",
            "required": true,
            "schema": {
              "title": "Unified Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BidOut"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Bid",
        "tags": [
          "bids"
        ]
      }
    },
    "/v1/billing/checkout": {
      "post": {
        "operationId": "create_checkout_v1_billing_checkout_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/jpintel_mcp__api__billing__CheckoutRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/jpintel_mcp__api__compliance__CheckoutResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Checkout",
        "tags": [
          "billing"
        ]
      }
    },
    "/v1/billing/keys/from-checkout": {
      "post": {
        "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": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyIssueResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Issue From Checkout",
        "tags": [
          "billing"
        ]
      }
    },
    "/v1/billing/portal": {
      "post": {
        "operationId": "create_portal_v1_billing_portal_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PortalRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Create Portal V1 Billing Portal Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Portal",
        "tags": [
          "billing"
        ]
      }
    },
    "/v1/billing/refund_request": {
      "post": {
        "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": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RefundResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Submit a refund request for ¥3/req metered Stripe charges (manual review)",
        "tags": [
          "billing"
        ]
      }
    },
    "/v1/billing/webhook": {
      "post": {
        "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": [
          {
            "in": "header",
            "name": "stripe-signature",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Stripe-Signature"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Webhook V1 Billing Webhook Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Webhook",
        "tags": [
          "billing"
        ]
      }
    },
    "/v1/calendar/deadlines": {
      "get": {
        "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": [
          {
            "description": "Only return programs whose end_date falls between today and today + within_days (inclusive). Default 30.",
            "in": "query",
            "name": "within_days",
            "required": false,
            "schema": {
              "default": 30,
              "description": "Only return programs whose end_date falls between today and today + within_days (inclusive). Default 30.",
              "maximum": 180,
              "minimum": 1,
              "title": "Within Days",
              "type": "integer"
            }
          },
          {
            "description": "Prefecture filter. Canonical kanji ('東京都'), short ('東京'), romaji ('Tokyo'), or '全国' / 'national'. Nationwide programs and prefecture-unassigned rows are always included.",
            "in": "query",
            "name": "prefecture",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 40,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Prefecture filter. Canonical kanji ('東京都'), short ('東京'), romaji ('Tokyo'), or '全国' / 'national'. Nationwide programs and prefecture-unassigned rows are always included.",
              "title": "Prefecture"
            }
          },
          {
            "description": "Authority level filter. Canonical EN: national / prefecture / municipality / financial. Also accepts JP (国 / 都道府県 / 市区町村).",
            "in": "query",
            "name": "authority_level",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 20,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Authority level filter. Canonical EN: national / prefecture / municipality / financial. Also accepts JP (国 / 都道府県 / 市区町村).",
              "title": "Authority Level"
            }
          },
          {
            "description": "Repeat to OR across tiers (e.g. tier=S&tier=A).",
            "in": "query",
            "name": "tier",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Repeat to OR across tiers (e.g. tier=S&tier=A).",
              "title": "Tier"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeadlinesResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Deadlines",
        "tags": [
          "calendar"
        ]
      }
    },
    "/v1/case-studies/search": {
      "get": {
        "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": [
          {
            "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.",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "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"
            }
          },
          {
            "in": "query",
            "name": "prefecture",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 80,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Prefecture"
            }
          },
          {
            "description": "JSIC industry code prefix (e.g. 'A' for 農林水産業, '05' for 食料品製造業).",
            "in": "query",
            "name": "industry_jsic",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 10,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "JSIC industry code prefix (e.g. 'A' for 農林水産業, '05' for 食料品製造業).",
              "title": "Industry Jsic"
            }
          },
          {
            "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.",
            "in": "query",
            "name": "houjin_bangou",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 13,
                  "type": "string"
                },
                {
                  "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": "Match rows whose programs_used_json list contains this program name or unified_id substring.",
            "in": "query",
            "name": "program_used",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Match rows whose programs_used_json list contains this program name or unified_id substring.",
              "title": "Program Used"
            }
          },
          {
            "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.",
            "in": "query",
            "name": "min_subsidy_yen",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 0,
                  "type": "integer"
                },
                {
                  "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": "Upper bound on total_subsidy_received_yen (JPY). Same <1% sparsity as min_subsidy_yen — avoid unless the user explicitly asked for a ceiling.",
            "in": "query",
            "name": "max_subsidy_yen",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 0,
                  "type": "integer"
                },
                {
                  "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"
            }
          },
          {
            "in": "query",
            "name": "min_employees",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 0,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Min Employees"
            }
          },
          {
            "in": "query",
            "name": "max_employees",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 0,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Max Employees"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "limit": 20,
                  "offset": 0,
                  "results": [
                    {
                      "amount_received_man_yen": 150,
                      "case_id": "CS-meti-jizokuka-2024-00123",
                      "case_summary": "EC サイト構築費 200 万円補助で売上 1.4 倍。",
                      "case_title": "持続化補助金で新規販路開拓に成功",
                      "company_name": "株式会社ヤマダ製作所",
                      "confidence": 0.92,
                      "fetched_at": "2026-04-20T05:14:33Z",
                      "fiscal_year": 2024,
                      "houjin_bangou": "1234567890123",
                      "industry_jsic": "29",
                      "prefecture": "群馬県",
                      "program_used": "小規模事業者持続化補助金",
                      "source_url": "https://www.jizokukahojokin.info/case/123"
                    }
                  ],
                  "total": 1
                },
                "schema": {
                  "$ref": "#/components/schemas/CaseStudySearchResponse"
                }
              }
            },
            "description": "Paginated case_studies. Search via FTS5 trigram on company_name + case_title + summary."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Authentication required — `code='auth_required'`. Send `X-API-Key`."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Not found — `code` ∈ {no_matching_records, seed_not_found, route_not_found}."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`)."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}."
          }
        },
        "summary": "Search 採択事例 (awarded grant case studies)",
        "tags": [
          "case-studies"
        ]
      }
    },
    "/v1/case-studies/{case_id}": {
      "get": {
        "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": [
          {
            "in": "path",
            "name": "case_id",
            "required": true,
            "schema": {
              "title": "Case Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "amount_received_man_yen": 150,
                  "case_id": "CS-meti-jizokuka-2024-00123",
                  "case_summary": "EC サイト構築費 200 万円補助で売上 1.4 倍。",
                  "case_title": "持続化補助金で新規販路開拓に成功",
                  "company_name": "株式会社ヤマダ製作所",
                  "confidence": 0.92,
                  "employee_count": 8,
                  "fetched_at": "2026-04-20T05:14:33Z",
                  "fiscal_year": 2024,
                  "houjin_bangou": "1234567890123",
                  "industry_jsic": "29",
                  "outcomes": {
                    "new_channels": 2,
                    "sales_yoy_pct": 40
                  },
                  "patterns": [
                    "EC構築",
                    "販路開拓"
                  ],
                  "prefecture": "群馬県",
                  "programs_used": [
                    "小規模事業者持続化補助金"
                  ],
                  "publication_date": "2024-12-15",
                  "source_excerpt": "EC化により…",
                  "source_url": "https://www.jizokukahojokin.info/case/123"
                },
                "schema": {
                  "$ref": "#/components/schemas/CaseStudy"
                }
              }
            },
            "description": "Single case study row."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Authentication required — `code='auth_required'`. Send `X-API-Key`."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "case study not found — `error.code='no_matching_records'`."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`)."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}."
          }
        },
        "summary": "Get a single 採択事例 case study by case_id",
        "tags": [
          "case-studies"
        ]
      }
    },
    "/v1/compliance/stripe-checkout": {
      "post": {
        "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": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/jpintel_mcp__api__compliance__CheckoutResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Stripe Checkout",
        "tags": [
          "compliance"
        ]
      }
    },
    "/v1/compliance/stripe-webhook": {
      "post": {
        "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": [
          {
            "in": "header",
            "name": "stripe-signature",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Stripe-Signature"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Stripe Webhook V1 Compliance Stripe Webhook Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Stripe Webhook",
        "tags": [
          "compliance"
        ]
      }
    },
    "/v1/compliance/subscribe": {
      "post": {
        "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": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/jpintel_mcp__api__compliance__SubscribeResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Subscribe",
        "tags": [
          "compliance"
        ]
      }
    },
    "/v1/compliance/unsubscribe/{unsubscribe_token}": {
      "post": {
        "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": [
          {
            "in": "path",
            "name": "unsubscribe_token",
            "required": true,
            "schema": {
              "title": "Unsubscribe Token",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Unsubscribe",
        "tags": [
          "compliance"
        ]
      }
    },
    "/v1/compliance/verify/{verification_token}": {
      "get": {
        "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": [
          {
            "in": "path",
            "name": "verification_token",
            "required": true,
            "schema": {
              "title": "Verification Token",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Verify",
        "tags": [
          "compliance"
        ]
      }
    },
    "/v1/court-decisions/by-statute": {
      "post": {
        "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": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CourtDecisionByStatuteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CourtDecisionSearchResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Decisions By Statute",
        "tags": [
          "court-decisions"
        ]
      }
    },
    "/v1/court-decisions/search": {
      "get": {
        "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": [
          {
            "description": "Free-text search across case_name + subject_area + key_ruling + impact_on_business (FTS5 with quoted-phrase workaround for 2+ character kanji compounds).",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "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": "Filter by 裁判所名 (exact match, e.g. '最高裁判所第三小法廷').",
            "in": "query",
            "name": "court",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 160,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by 裁判所名 (exact match, e.g. '最高裁判所第三小法廷').",
              "title": "Court"
            }
          },
          {
            "description": "Filter by court tier. One of: supreme | high | district | summary | family.",
            "in": "query",
            "name": "court_level",
            "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 decision shape. One of: 判決 | 決定 | 命令.",
            "in": "query",
            "name": "decision_type",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "判決",
                    "決定",
                    "命令"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by decision shape. One of: 判決 | 決定 | 命令.",
              "title": "Decision Type"
            }
          },
          {
            "description": "Filter by 分野 (substring LIKE — the column is free-text and varies by 判例集, so exact-match is too brittle).",
            "in": "query",
            "name": "subject_area",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 120,
                  "type": "string"
                },
                {
                  "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 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.",
            "in": "query",
            "name": "references_law_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^LAW-[0-9a-f]{10}$",
                  "type": "string"
                },
                {
                  "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": "ISO date (YYYY-MM-DD) — inclusive lower bound on decision_date.",
            "in": "query",
            "name": "decided_from",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "ISO date (YYYY-MM-DD) — inclusive lower bound on decision_date.",
              "title": "Decided From"
            }
          },
          {
            "description": "ISO date (YYYY-MM-DD) — inclusive upper bound on decision_date.",
            "in": "query",
            "name": "decided_to",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "ISO date (YYYY-MM-DD) — inclusive upper bound on decision_date.",
              "title": "Decided To"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "limit": 20,
                  "offset": 0,
                  "results": [
                    {
                      "case_name": "所得税更正処分取消等請求事件",
                      "case_number": "平成30(行ヒ)422",
                      "court": "最高裁判所第三小法廷",
                      "court_level": "supreme",
                      "decision_date": "2020-03-24",
                      "decision_type": "判決",
                      "fetched_at": "2026-04-20T05:14:33Z",
                      "full_text_url": "https://www.courts.go.jp/app/hanrei_jp/detail2?id=89311",
                      "key_ruling": "国税通則法24条所定の更正処分の取消…",
                      "precedent_weight": "binding",
                      "source_url": "https://www.courts.go.jp/...",
                      "subject_area": "租税",
                      "unified_id": "HAN-5954003266"
                    }
                  ],
                  "total": 1
                },
                "schema": {
                  "$ref": "#/components/schemas/CourtDecisionSearchResponse"
                }
              }
            },
            "description": "Paginated court decisions."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Search Japanese court decisions (判決 / 決定 / 命令)",
        "tags": [
          "court-decisions"
        ]
      }
    },
    "/v1/court-decisions/{unified_id}": {
      "get": {
        "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": [
          {
            "in": "path",
            "name": "unified_id",
            "required": true,
            "schema": {
              "title": "Unified Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "case_name": "所得税更正処分取消等請求事件",
                  "case_number": "平成30(行ヒ)422",
                  "confidence": 0.9,
                  "court": "最高裁判所第三小法廷",
                  "court_level": "supreme",
                  "decision_date": "2020-03-24",
                  "decision_type": "判決",
                  "fetched_at": "2026-04-20T05:14:33Z",
                  "full_text_url": "https://www.courts.go.jp/app/hanrei_jp/detail2?id=89311",
                  "impact_on_business": "国税不服審判の段階で…",
                  "key_ruling": "更正処分の理由付記の…",
                  "pdf_url": "https://www.courts.go.jp/app/files/hanrei_jp/311/089311_hanrei.pdf",
                  "precedent_weight": "binding",
                  "source_excerpt": "…(裁判所サイトより抜粋)",
                  "source_url": "https://www.courts.go.jp/app/hanrei_jp/detail2?id=89311",
                  "subject_area": "租税",
                  "unified_id": "HAN-5954003266"
                },
                "schema": {
                  "$ref": "#/components/schemas/CourtDecision"
                }
              }
            },
            "description": "Single court decision row."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get a single court decision by unified_id (HAN-*)",
        "tags": [
          "court-decisions"
        ]
      }
    },
    "/v1/device/authorize": {
      "post": {
        "description": "Mint a fresh (device_code, user_code) pair (RFC 8628 §3.1).",
        "operationId": "authorize_v1_device_authorize_post",
        "parameters": [
          {
            "in": "header",
            "name": "user-agent",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "User-Agent"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthorizeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthorizeResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Authorize",
        "tags": [
          "device"
        ]
      }
    },
    "/v1/device/complete": {
      "post": {
        "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": [
          {
            "in": "header",
            "name": "origin",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Origin"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompleteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompleteResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Complete",
        "tags": [
          "device"
        ]
      }
    },
    "/v1/device/token": {
      "post": {
        "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": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenSuccess"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Token",
        "tags": [
          "device"
        ]
      }
    },
    "/v1/email/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": [
          {
            "in": "query",
            "name": "email",
            "required": true,
            "schema": {
              "maxLength": 320,
              "minLength": 3,
              "title": "Email",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "token",
            "required": true,
            "schema": {
              "maxLength": 128,
              "minLength": 16,
              "title": "Token",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Unsubscribe Get",
        "tags": [
          "email"
        ]
      },
      "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": [
          {
            "in": "query",
            "name": "email",
            "required": true,
            "schema": {
              "maxLength": 320,
              "minLength": 3,
              "title": "Email",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "token",
            "required": true,
            "schema": {
              "maxLength": 128,
              "minLength": 16,
              "title": "Token",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "reason",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Reason"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnsubscribeResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Unsubscribe Post",
        "tags": [
          "email"
        ]
      }
    },
    "/v1/email/webhook": {
      "post": {
        "operationId": "postmark_webhook_v1_email_webhook_post",
        "parameters": [
          {
            "in": "header",
            "name": "X-Postmark-Signature",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Postmark-Signature"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Postmark Webhook V1 Email Webhook Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Postmark Webhook",
        "tags": [
          "email"
        ]
      }
    },
    "/v1/enforcement-cases/search": {
      "get": {
        "description": "Search enforcement cases for compliance / DD lookup.",
        "operationId": "search_enforcement_cases_v1_enforcement_cases_search_get",
        "parameters": [
          {
            "description": "Free-text search over program_name_hint + reason_excerpt + source_title (LIKE, case-insensitive).",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Free-text search over program_name_hint + reason_excerpt + source_title (LIKE, case-insensitive).",
              "title": "Q"
            }
          },
          {
            "in": "query",
            "name": "event_type",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 80,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Event Type"
            }
          },
          {
            "in": "query",
            "name": "ministry",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 120,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Ministry"
            }
          },
          {
            "in": "query",
            "name": "prefecture",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 80,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Prefecture"
            }
          },
          {
            "in": "query",
            "name": "legal_basis",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Legal Basis"
            }
          },
          {
            "in": "query",
            "name": "program_name_hint",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Program Name Hint"
            }
          },
          {
            "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.",
            "in": "query",
            "name": "recipient_houjin_bangou",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 13,
                  "type": "string"
                },
                {
                  "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"
            }
          },
          {
            "in": "query",
            "name": "min_improper_grant_yen",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 0,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Min Improper Grant Yen"
            }
          },
          {
            "in": "query",
            "name": "max_improper_grant_yen",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 0,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Max Improper Grant Yen"
            }
          },
          {
            "description": "ISO date (YYYY-MM-DD) — inclusive lower bound on disclosed_date.",
            "in": "query",
            "name": "disclosed_from",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "ISO date (YYYY-MM-DD) — inclusive lower bound on disclosed_date.",
              "title": "Disclosed From"
            }
          },
          {
            "description": "ISO date (YYYY-MM-DD) — inclusive upper bound on disclosed_date.",
            "in": "query",
            "name": "disclosed_until",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "ISO date (YYYY-MM-DD) — inclusive upper bound on disclosed_date.",
              "title": "Disclosed Until"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "limit": 20,
                  "offset": 0,
                  "results": [
                    {
                      "amount_yen": 12500000,
                      "case_id": "ENF-jftc-2024-00045",
                      "confidence": 0.98,
                      "disclosed_date": "2024-02-15",
                      "event_type": "排除措置命令",
                      "fetched_at": "2026-04-22T08:11:00Z",
                      "ministry": "公正取引委員会",
                      "prefecture": "大阪府",
                      "reason_excerpt": "公共工事入札談合の事実を認定。",
                      "recipient_houjin_bangou": "9876543210987",
                      "recipient_kind": "houjin",
                      "recipient_name": "株式会社サンプル建設",
                      "source_title": "排除措置命令及び課徴金納付命令について",
                      "source_url": "https://www.jftc.go.jp/houdou/pressrelease/2024/feb/..."
                    }
                  ],
                  "total": 1
                },
                "schema": {
                  "$ref": "#/components/schemas/EnforcementCaseSearchResponse"
                }
              }
            },
            "description": "Paginated 行政処分 / 会計検査院 indications. Use this for compliance / due-diligence on a recipient or program."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Authentication required — `code='auth_required'`. Send `X-API-Key`."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Not found — `code` ∈ {no_matching_records, seed_not_found, route_not_found}."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`)."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}."
          }
        },
        "summary": "Search Enforcement Cases",
        "tags": [
          "enforcement-cases"
        ]
      }
    },
    "/v1/enforcement-cases/{case_id}": {
      "get": {
        "operationId": "get_enforcement_case_v1_enforcement_cases__case_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "case_id",
            "required": true,
            "schema": {
              "title": "Case Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnforcementCase"
                }
              }
            },
            "description": "Successful Response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Authentication required — `code='auth_required'`. Send `X-API-Key`."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "case not found — `error.code='no_matching_records'`."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`)."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}."
          }
        },
        "summary": "Get Enforcement Case",
        "tags": [
          "enforcement-cases"
        ]
      }
    },
    "/v1/exclusions/check": {
      "post": {
        "operationId": "check_exclusions_v1_exclusions_check_post",
        "parameters": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExclusionCheckRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExclusionCheckResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Check Exclusions",
        "tags": [
          "exclusions"
        ]
      }
    },
    "/v1/exclusions/rules": {
      "get": {
        "operationId": "list_rules_v1_exclusions_rules_get",
        "parameters": [
          {
            "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.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 200,
              "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.",
              "maximum": 500,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "Number of rules to skip for pagination (0 = first page).",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "description": "Number of rules to skip for pagination (0 = first page).",
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ExclusionRule"
                  },
                  "title": "Response List Rules V1 Exclusions Rules Get",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Rules",
        "tags": [
          "exclusions"
        ]
      }
    },
    "/v1/feedback": {
      "post": {
        "operationId": "submit_feedback_v1_feedback_post",
        "parameters": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FeedbackRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FeedbackResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Submit Feedback",
        "tags": [
          "feedback"
        ]
      }
    },
    "/v1/invoice_registrants/search": {
      "get": {
        "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": [
          {
            "description": "Prefix match on 事業者名 (normalized_name). Index-eligible LIKE — not FTS. Short queries (< 2 chars) are rejected to keep the match selective.",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "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": "Exact 13-digit 法人番号 filter. Returns only rows where houjin_bangou matches (sole-proprietor rows excluded).",
            "in": "query",
            "name": "houjin_bangou",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^\\d{13}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Exact 13-digit 法人番号 filter. Returns only rows where houjin_bangou matches (sole-proprietor rows excluded).",
              "title": "Houjin Bangou"
            }
          },
          {
            "description": "corporate = 法人 (registrant_kind='corporation'); individual = 個人事業主 (registrant_kind='sole_proprietor'). Omit to include both plus 'other'.",
            "in": "query",
            "name": "kind",
            "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": "Prefecture name. Canonical = full-suffix kanji ('東京都'); short form ('東京') and romaji also accepted.",
            "in": "query",
            "name": "prefecture",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 20,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Prefecture name. Canonical = full-suffix kanji ('東京都'); short form ('東京') and romaji also accepted.",
              "title": "Prefecture"
            }
          },
          {
            "description": "ISO date (YYYY-MM-DD) — inclusive lower bound on registered_date.",
            "in": "query",
            "name": "registered_after",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "ISO date (YYYY-MM-DD) — inclusive lower bound on registered_date.",
              "title": "Registered After"
            }
          },
          {
            "description": "ISO date (YYYY-MM-DD) — inclusive upper bound on registered_date.",
            "in": "query",
            "name": "registered_before",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "ISO date (YYYY-MM-DD) — inclusive upper bound on registered_date.",
              "title": "Registered Before"
            }
          },
          {
            "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.",
            "in": "query",
            "name": "active_only",
            "required": false,
            "schema": {
              "default": true,
              "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.",
              "title": "Active Only",
              "type": "boolean"
            }
          },
          {
            "description": "Page size. Default 50, hard cap 100. No wildcard bulk export — point consumers at NTA's own download URL for full snapshots.",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "description": "Page size. Default 50, hard cap 100. No wildcard bulk export — point consumers at NTA's own download URL for full snapshots.",
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "attribution": {
                    "edited": true,
                    "license": "公共データ利用規約 第1.0版 (PDL v1.0)",
                    "notice": "本データは国税庁公表データを編集加工したものであり、原データと完全には一致しません。公表データは本API経由ではなく、発行元サイトで最新のものを確認してください。",
                    "source": "国税庁適格請求書発行事業者公表サイト（国税庁）",
                    "source_url": "https://www.invoice-kohyo.nta.go.jp/"
                  },
                  "limit": 50,
                  "offset": 0,
                  "results": [
                    {
                      "address_normalized": "東京都文京区小日向2-22-1",
                      "confidence": 0.98,
                      "fetched_at": "2026-04-25T03:30:00Z",
                      "houjin_bangou": "8010001213708",
                      "invoice_registration_number": "T8010001213708",
                      "last_updated_nta": "2025-05-13",
                      "normalized_name": "Bookyou株式会社",
                      "prefecture": "東京都",
                      "registered_date": "2025-05-12",
                      "registrant_kind": "corporation",
                      "source_checksum": "0e5e54184ed778eb2fd797dc7f100b80cb7e892b15134de629d860ae76546398",
                      "source_url": "https://www.invoice-kohyo.nta.go.jp/regno-search/download",
                      "trade_name": "jpcite",
                      "updated_at": "2026-04-25T03:30:00Z"
                    }
                  ],
                  "total": 1
                },
                "schema": {
                  "$ref": "#/components/schemas/jpintel_mcp__api__invoice_registrants__SearchResponse"
                }
              }
            },
            "description": "SearchResponse. Every 2xx body carries a PDL v1.0 `attribution` block — required by 公共データ利用規約 第1.0版."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Search 適格請求書発行事業者 (NTA invoice registrants)",
        "tags": [
          "invoice_registrants"
        ]
      }
    },
    "/v1/invoice_registrants/{invoice_registration_number}": {
      "get": {
        "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": [
          {
            "in": "path",
            "name": "invoice_registration_number",
            "required": true,
            "schema": {
              "title": "Invoice Registration Number",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "attribution": {
                    "edited": true,
                    "license": "公共データ利用規約 第1.0版 (PDL v1.0)",
                    "notice": "本データは国税庁公表データを編集加工したものであり、原データと完全には一致しません。公表データは本API経由ではなく、発行元サイトで最新のものを確認してください。",
                    "source": "国税庁適格請求書発行事業者公表サイト（国税庁）",
                    "source_url": "https://www.invoice-kohyo.nta.go.jp/"
                  },
                  "result": {
                    "address_normalized": "東京都文京区小日向2-22-1",
                    "confidence": 0.98,
                    "fetched_at": "2026-04-25T03:30:00Z",
                    "houjin_bangou": "8010001213708",
                    "invoice_registration_number": "T8010001213708",
                    "last_updated_nta": "2025-05-13",
                    "normalized_name": "Bookyou株式会社",
                    "prefecture": "東京都",
                    "registered_date": "2025-05-12",
                    "registrant_kind": "corporation",
                    "source_url": "https://www.invoice-kohyo.nta.go.jp/regno-search/download",
                    "updated_at": "2026-04-25T03:30:00Z"
                  }
                },
                "schema": {
                  "$ref": "#/components/schemas/GetResponse"
                }
              }
            },
            "description": "GetResponse. Every 2xx body carries a PDL v1.0 `attribution` block — required by 公共データ利用規約 第1.0版."
          },
          "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}$')"
          }
        },
        "summary": "Lookup adequate-invoice (適格請求書) registrant by T-number",
        "tags": [
          "invoice_registrants"
        ]
      }
    },
    "/v1/laws/search": {
      "get": {
        "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": [
          {
            "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.",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "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": "Filter by law_type. One of: constitution | act | cabinet_order | imperial_order | ministerial_ordinance | rule | notice | guideline.",
            "in": "query",
            "name": "law_type",
            "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 所管府省 (exact match).",
            "in": "query",
            "name": "ministry",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 120,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by 所管府省 (exact match).",
              "title": "Ministry"
            }
          },
          {
            "description": "When true (default), only `revision_status='current'` rows are returned. Flip to false to include 'superseded' rows.",
            "in": "query",
            "name": "currently_effective_only",
            "required": false,
            "schema": {
              "default": true,
              "description": "When true (default), only `revision_status='current'` rows are returned. Flip to false to include 'superseded' rows.",
              "title": "Currently Effective Only",
              "type": "boolean"
            }
          },
          {
            "description": "When false (default), `revision_status='repealed'` rows are excluded. Flip to true for historical research.",
            "in": "query",
            "name": "include_repealed",
            "required": false,
            "schema": {
              "default": false,
              "description": "When false (default), `revision_status='repealed'` rows are excluded. Flip to true for historical research.",
              "title": "Include Repealed",
              "type": "boolean"
            }
          },
          {
            "description": "ISO date (YYYY-MM-DD) — inclusive lower bound on promulgated_date.",
            "in": "query",
            "name": "promulgated_from",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "ISO date (YYYY-MM-DD) — inclusive lower bound on promulgated_date.",
              "title": "Promulgated From"
            }
          },
          {
            "description": "ISO date (YYYY-MM-DD) — inclusive upper bound on promulgated_date.",
            "in": "query",
            "name": "promulgated_to",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "ISO date (YYYY-MM-DD) — inclusive upper bound on promulgated_date.",
              "title": "Promulgated To"
            }
          },
          {
            "description": "ISO date (YYYY-MM-DD) — inclusive lower bound on enforced_date.",
            "in": "query",
            "name": "enforced_from",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "ISO date (YYYY-MM-DD) — inclusive lower bound on enforced_date.",
              "title": "Enforced From"
            }
          },
          {
            "description": "ISO date (YYYY-MM-DD) — inclusive upper bound on enforced_date.",
            "in": "query",
            "name": "enforced_to",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "ISO date (YYYY-MM-DD) — inclusive upper bound on enforced_date.",
              "title": "Enforced To"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "limit": 20,
                  "offset": 0,
                  "results": [
                    {
                      "article_count": 245,
                      "confidence": 1.0,
                      "enforced_date": "1965-04-01",
                      "fetched_at": "2026-04-20T05:14:33Z",
                      "full_text_url": "https://laws.e-gov.go.jp/law/340AC0000000033",
                      "last_amended_date": "2025-03-31",
                      "law_number": "昭和四十年法律第三十三号",
                      "law_short_title": "所得税法",
                      "law_title": "所得税法",
                      "law_type": "act",
                      "ministry": "財務省",
                      "promulgated_date": "1965-03-31",
                      "revision_status": "current",
                      "source_url": "https://laws.e-gov.go.jp/law/340AC0000000033",
                      "subject_areas": [
                        "税法",
                        "所得税"
                      ],
                      "unified_id": "LAW-jp-shotokuzeiho"
                    }
                  ],
                  "total": 1
                },
                "schema": {
                  "$ref": "#/components/schemas/LawSearchResponse"
                }
              }
            },
            "description": "Paginated laws (e-Gov 法令 catalog, CC-BY 4.0)."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Authentication required — `code='auth_required'`. Send `X-API-Key`."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Not found — `code` ∈ {no_matching_records, seed_not_found, route_not_found}."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`)."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}."
          }
        },
        "summary": "Search Japanese laws (法令): 憲法 / 法律 / 政令 / 省令 / 告示",
        "tags": [
          "laws"
        ]
      }
    },
    "/v1/laws/{unified_id}": {
      "get": {
        "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": [
          {
            "in": "path",
            "name": "unified_id",
            "required": true,
            "schema": {
              "title": "Unified Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "article_count": 245,
                  "confidence": 1.0,
                  "enforced_date": "2026-04-01",
                  "fetched_at": "2026-04-20T05:14:33Z",
                  "full_text_url": "https://laws.e-gov.go.jp/law/340AC0000000033",
                  "last_amended_date": "2026-03-31",
                  "law_number": "昭和四十年法律第三十三号",
                  "law_short_title": "所得税法",
                  "law_title": "所得税法",
                  "law_type": "act",
                  "ministry": "財務省",
                  "promulgated_date": "1965-03-31",
                  "revision_status": "current",
                  "source_url": "https://laws.e-gov.go.jp/law/340AC0000000033",
                  "subject_areas": [
                    "税法",
                    "所得税"
                  ],
                  "summary": "所得に対する税の課税標準・税額等を定める。",
                  "unified_id": "LAW-64c08d2649"
                },
                "schema": {
                  "$ref": "#/components/schemas/Law"
                }
              }
            },
            "description": "Single law row."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Authentication required — `code='auth_required'`. Send `X-API-Key`."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "law not found — `error.code='no_matching_records'`."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`)."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}."
          }
        },
        "summary": "Get a single law (法令) by unified_id (LAW-*)",
        "tags": [
          "laws"
        ]
      }
    },
    "/v1/laws/{unified_id}/related-programs": {
      "get": {
        "description": "Reverse lookup: which programs cite this law via program_law_refs.",
        "operationId": "get_related_programs_v1_laws__unified_id__related_programs_get",
        "parameters": [
          {
            "in": "path",
            "name": "unified_id",
            "required": true,
            "schema": {
              "title": "Unified Id",
              "type": "string"
            }
          },
          {
            "description": "Filter by citation kind. One of: authority | eligibility | exclusion | reference | penalty. Omit to return all kinds.",
            "in": "query",
            "name": "ref_kind",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 20,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by citation kind. One of: authority | eligibility | exclusion | reference | penalty. Omit to return all kinds.",
              "title": "Ref Kind"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RelatedProgramsResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Authentication required — `code='auth_required'`. Send `X-API-Key`."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "law not found — `error.code='no_matching_records'`."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`)."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}."
          }
        },
        "summary": "Get Related Programs",
        "tags": [
          "laws"
        ]
      }
    },
    "/v1/loan-programs/search": {
      "get": {
        "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": [
          {
            "description": "Free-text search over program_name + provider + target_conditions.",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Free-text search over program_name + provider + target_conditions.",
              "title": "Q"
            }
          },
          {
            "in": "query",
            "name": "provider",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Provider"
            }
          },
          {
            "in": "query",
            "name": "loan_type",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 80,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Loan Type"
            }
          },
          {
            "description": "Risk axis 1 (物的担保). One of: required | not_required | negotiable | unknown.",
            "in": "query",
            "name": "collateral_required",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 20,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Risk axis 1 (物的担保). One of: required | not_required | negotiable | unknown.",
              "title": "Collateral Required"
            }
          },
          {
            "description": "Risk axis 2 (代表者/役員/家族保証). One of: required | not_required | negotiable | unknown.",
            "in": "query",
            "name": "personal_guarantor_required",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 20,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Risk axis 2 (代表者/役員/家族保証). One of: required | not_required | negotiable | unknown.",
              "title": "Personal Guarantor Required"
            }
          },
          {
            "description": "Risk axis 3 (第三者保証). One of: required | not_required | negotiable | unknown.",
            "in": "query",
            "name": "third_party_guarantor_required",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 20,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Risk axis 3 (第三者保証). One of: required | not_required | negotiable | unknown.",
              "title": "Third Party Guarantor Required"
            }
          },
          {
            "in": "query",
            "name": "min_amount_yen",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 0,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Min Amount Yen"
            }
          },
          {
            "in": "query",
            "name": "max_amount_yen",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 0,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Max Amount Yen"
            }
          },
          {
            "description": "Upper bound on interest_rate_base_annual (e.g. 0.015 for 1.5%).",
            "in": "query",
            "name": "max_interest_rate",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 0.0,
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Upper bound on interest_rate_base_annual (e.g. 0.015 for 1.5%).",
              "title": "Max Interest Rate"
            }
          },
          {
            "in": "query",
            "name": "min_loan_period_years",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 0,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Min Loan Period Years"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "limit": 20,
                  "offset": 0,
                  "results": [
                    {
                      "amount_max_yen": 72000000,
                      "collateral_required": "negotiable",
                      "confidence": 0.95,
                      "fetched_at": "2026-04-22T08:11:00Z",
                      "grace_period_years_max": 2,
                      "id": 12,
                      "interest_rate_base_annual": 1.5,
                      "interest_rate_special_annual": 0.95,
                      "loan_period_years_max": 20,
                      "loan_type": "国民生活事業",
                      "official_url": "https://www.jfc.go.jp/n/finance/search/02_kaigyou_m.html",
                      "personal_guarantor_required": "negotiable",
                      "program_name": "新規開業資金（女性、若者/シニア起業家支援関連）",
                      "provider": "日本政策金融公庫",
                      "rate_names": "基準利率/特別利率A",
                      "security_notes": "代表者保証は希望に応じて. 第三者保証人は原則不要.",
                      "third_party_guarantor_required": "not_required"
                    }
                  ],
                  "total": 1
                },
                "schema": {
                  "$ref": "#/components/schemas/LoanProgramSearchResponse"
                }
              }
            },
            "description": "Three-axis loan search. Filter on collateral / personal_guarantor / third_party_guarantor independently — see migration 013 for the axis split."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Authentication required — `code='auth_required'`. Send `X-API-Key`."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Not found — `code` ∈ {no_matching_records, seed_not_found, route_not_found}."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`)."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}."
          }
        },
        "summary": "Search loan programs (公庫 / 商工中金 / 自治体) — 3-axis risk filter",
        "tags": [
          "loan-programs"
        ]
      }
    },
    "/v1/loan-programs/{loan_id}": {
      "get": {
        "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": [
          {
            "in": "path",
            "name": "loan_id",
            "required": true,
            "schema": {
              "title": "Loan Id",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "amount_max_yen": 72000000,
                  "collateral_required": "negotiable",
                  "confidence": 0.9,
                  "fetched_at": "2026-04-23T04:32:55Z",
                  "grace_period_years_max": 5,
                  "id": 1,
                  "interest_rate_base_annual": 0.041,
                  "loan_period_years_max": 20,
                  "loan_type": "special_rate",
                  "official_url": "https://www.jfc.go.jp/n/finance/search/01_sinkikaigyou_m.html",
                  "personal_guarantor_required": "negotiable",
                  "program_name": "新規開業・スタートアップ支援資金",
                  "provider": "日本政策金融公庫 国民生活事業",
                  "rate_names": "基準利率,特別利率",
                  "security_notes": "要相談（担保・保証）",
                  "third_party_guarantor_required": "negotiable"
                },
                "schema": {
                  "$ref": "#/components/schemas/LoanProgram"
                }
              }
            },
            "description": "Single LoanProgram row."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Authentication required — `code='auth_required'`. Send `X-API-Key`."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "loan program not found — `error.code='no_matching_records'`."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`)."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}."
          }
        },
        "summary": "Get a single loan program by integer id",
        "tags": [
          "loan-programs"
        ]
      }
    },
    "/v1/me": {
      "get": {
        "operationId": "get_me_v1_me_get",
        "parameters": [
          {
            "in": "cookie",
            "name": "am_session",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Am Session"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MeResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Me",
        "tags": [
          "me"
        ]
      }
    },
    "/v1/me/alerts/subscribe": {
      "post": {
        "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": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/jpintel_mcp__api__alerts__SubscribeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Subscription",
        "tags": [
          "alerts"
        ]
      }
    },
    "/v1/me/alerts/subscriptions": {
      "get": {
        "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": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionResponse"
                  },
                  "title": "Response List Subscriptions V1 Me Alerts Subscriptions Get",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Subscriptions",
        "tags": [
          "alerts"
        ]
      }
    },
    "/v1/me/alerts/subscriptions/{sub_id}": {
      "delete": {
        "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": [
          {
            "in": "path",
            "name": "sub_id",
            "required": true,
            "schema": {
              "title": "Sub Id",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeactivateResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Deactivate Subscription",
        "tags": [
          "alerts"
        ]
      }
    },
    "/v1/me/billing-portal": {
      "post": {
        "operationId": "billing_portal_v1_me_billing_portal_post",
        "parameters": [
          {
            "in": "cookie",
            "name": "am_session",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Am Session"
            }
          },
          {
            "in": "cookie",
            "name": "am_csrf",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Am Csrf"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingPortalResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Billing Portal",
        "tags": [
          "me"
        ]
      }
    },
    "/v1/me/billing_history": {
      "get": {
        "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": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingHistoryResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Billing History",
        "tags": [
          "dashboard"
        ]
      }
    },
    "/v1/me/cap": {
      "post": {
        "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": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CapRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CapResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Set Monthly Cap",
        "tags": [
          "me"
        ]
      }
    },
    "/v1/me/dashboard": {
      "get": {
        "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": [
          {
            "in": "query",
            "name": "days",
            "required": false,
            "schema": {
              "default": 30,
              "maximum": 90,
              "minimum": 1,
              "title": "Days",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DashboardSummary"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Dashboard",
        "tags": [
          "dashboard"
        ]
      }
    },
    "/v1/me/rotate-key": {
      "post": {
        "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": [
          {
            "in": "cookie",
            "name": "am_session",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Am Session"
            }
          },
          {
            "in": "cookie",
            "name": "am_csrf",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Am Csrf"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RotateKeyResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Rotate Key",
        "tags": [
          "me"
        ]
      }
    },
    "/v1/me/saved_searches": {
      "get": {
        "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": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SavedSearchResponse"
                  },
                  "title": "Response List Saved Searches V1 Me Saved Searches Get",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Saved Searches",
        "tags": [
          "saved-searches"
        ]
      },
      "post": {
        "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": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSavedSearchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedSearchResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Saved Search",
        "tags": [
          "saved-searches"
        ]
      }
    },
    "/v1/me/saved_searches/{saved_id}": {
      "delete": {
        "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": [
          {
            "in": "path",
            "name": "saved_id",
            "required": true,
            "schema": {
              "title": "Saved Id",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/jpintel_mcp__api__saved_searches__DeleteResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Saved Search",
        "tags": [
          "saved-searches"
        ]
      }
    },
    "/v1/me/testimonials": {
      "post": {
        "operationId": "submit_testimonial_v1_me_testimonials_post",
        "parameters": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TestimonialSubmit"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TestimonialSubmitResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Submit Testimonial",
        "tags": [
          "testimonials",
          "me"
        ]
      }
    },
    "/v1/me/testimonials/{testimonial_id}": {
      "delete": {
        "operationId": "delete_my_testimonial_v1_me_testimonials__testimonial_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "testimonial_id",
            "required": true,
            "schema": {
              "title": "Testimonial Id",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete My Testimonial",
        "tags": [
          "testimonials",
          "me"
        ]
      }
    },
    "/v1/me/tool_recommendation": {
      "get": {
        "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": [
          {
            "in": "query",
            "name": "intent",
            "required": true,
            "schema": {
              "maxLength": 500,
              "minLength": 1,
              "title": "Intent",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 5,
              "maximum": 10,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolRecommendationResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Tool Recommendation",
        "tags": [
          "dashboard"
        ]
      }
    },
    "/v1/me/usage": {
      "get": {
        "operationId": "get_me_usage_v1_me_usage_get",
        "parameters": [
          {
            "in": "query",
            "name": "days",
            "required": false,
            "schema": {
              "default": 30,
              "title": "Days",
              "type": "integer"
            }
          },
          {
            "in": "cookie",
            "name": "am_session",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Am Session"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/jpintel_mcp__api__me__UsageDay"
                  },
                  "title": "Response Get Me Usage V1 Me Usage Get",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Me Usage",
        "tags": [
          "me"
        ]
      }
    },
    "/v1/me/usage_by_tool": {
      "get": {
        "description": "Top N endpoints by call count over the requested window.",
        "operationId": "get_usage_by_tool_v1_me_usage_by_tool_get",
        "parameters": [
          {
            "in": "query",
            "name": "days",
            "required": false,
            "schema": {
              "default": 30,
              "maximum": 90,
              "minimum": 1,
              "title": "Days",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 10,
              "maximum": 50,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToolUsageResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Usage By Tool",
        "tags": [
          "dashboard"
        ]
      }
    },
    "/v1/me/webhooks": {
      "get": {
        "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": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/WebhookResponse"
                  },
                  "title": "Response List Webhooks V1 Me Webhooks Get",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Webhooks",
        "tags": [
          "customer_webhooks"
        ]
      },
      "post": {
        "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": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Register Webhook",
        "tags": [
          "customer_webhooks"
        ]
      }
    },
    "/v1/me/webhooks/{webhook_id}": {
      "delete": {
        "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": [
          {
            "in": "path",
            "name": "webhook_id",
            "required": true,
            "schema": {
              "title": "Webhook Id",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/jpintel_mcp__api__saved_searches__DeleteResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Delete Webhook",
        "tags": [
          "customer_webhooks"
        ]
      }
    },
    "/v1/me/webhooks/{webhook_id}/deliveries": {
      "get": {
        "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": [
          {
            "in": "path",
            "name": "webhook_id",
            "required": true,
            "schema": {
              "title": "Webhook Id",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 10,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/DeliveryRow"
                  },
                  "title": "Response List Deliveries V1 Me Webhooks  Webhook Id  Deliveries Get",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "List Deliveries",
        "tags": [
          "customer_webhooks"
        ]
      }
    },
    "/v1/me/webhooks/{webhook_id}/test": {
      "post": {
        "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": [
          {
            "in": "path",
            "name": "webhook_id",
            "required": true,
            "schema": {
              "title": "Webhook Id",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TestDeliveryResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Test Delivery",
        "tags": [
          "customer_webhooks"
        ]
      }
    },
    "/v1/meta": {
      "get": {
        "operationId": "get_meta_v1_meta_get",
        "parameters": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Meta"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Meta",
        "tags": [
          "meta"
        ]
      }
    },
    "/v1/meta/freshness": {
      "get": {
        "operationId": "meta_freshness_v1_meta_freshness_get",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 500,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "sort_by",
            "required": false,
            "schema": {
              "default": "fetched_at_desc",
              "pattern": "^(fetched_at_desc|fetched_at_asc|tier)$",
              "title": "Sort By",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "tier",
            "required": false,
            "schema": {
              "default": "all",
              "pattern": "^(all|S|A|B|C)$",
              "title": "Tier",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MetaFreshnessResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Meta Freshness",
        "tags": [
          "meta",
          "transparency"
        ]
      }
    },
    "/v1/ping": {
      "get": {
        "operationId": "ping_v1_ping_get",
        "parameters": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PingResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Ping",
        "tags": [
          "meta"
        ]
      }
    },
    "/v1/privacy/deletion_request": {
      "post": {
        "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 (info@bookyou.net).\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": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletionResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Submit an APPI Article 33 personal-data deletion request",
        "tags": [
          "privacy"
        ]
      }
    },
    "/v1/privacy/disclosure_request": {
      "post": {
        "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 (info@bookyou.net).\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": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DisclosureResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Submit an APPI Article 31 personal-data disclosure request",
        "tags": [
          "privacy"
        ]
      }
    },
    "/v1/programs/batch": {
      "post": {
        "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": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchGetProgramsRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "not_found": [
                    "UNI-deadbeef00"
                  ],
                  "results": [
                    {
                      "amount_max_man_yen": 200.0,
                      "authority_level": "national",
                      "authority_name": "日本商工会議所/全国商工会連合会",
                      "official_url": "https://r3.jizokukahojokin.info/",
                      "primary_name": "小規模事業者持続化補助金",
                      "program_kind": "subsidy",
                      "source_fetched_at": "2026-04-22T13:20:57Z",
                      "tier": "B",
                      "unified_id": "UNI-2611050f9a"
                    },
                    {
                      "amount_max_man_yen": 450.0,
                      "authority_level": "national",
                      "authority_name": "国（農水省等）",
                      "official_url": "https://it-shien.smrj.go.jp/",
                      "primary_name": "デジタル化・AI導入補助金（旧IT導入補助金）",
                      "program_kind": "subsidy",
                      "source_fetched_at": "2026-04-22T13:20:57Z",
                      "tier": "B",
                      "unified_id": "UNI-185c08e0c1"
                    }
                  ]
                },
                "schema": {
                  "$ref": "#/components/schemas/BatchGetProgramsResponse"
                }
              }
            },
            "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."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Authentication required — `code='auth_required'`. Send `X-API-Key`."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Not found — `code` ∈ {no_matching_records, seed_not_found, route_not_found}."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "input validation failed (empty list, >50 ids, bad shape). `error.code='invalid_enum'`."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}."
          }
        },
        "summary": "Batch fetch up to 50 programs by unified_id",
        "tags": [
          "programs"
        ]
      }
    },
    "/v1/programs/prescreen": {
      "post": {
        "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": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrescreenRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "limit": 20,
                  "profile_echo": {
                    "declared_certifications": [],
                    "industry_jsic": "G",
                    "is_sole_proprietor": true,
                    "planned_investment_man_yen": 80,
                    "prefecture": "東京都"
                  },
                  "results": [
                    {
                      "amount_max_man_yen": 200.0,
                      "authority_level": "national",
                      "caveats": [],
                      "fit_score": 3,
                      "match_reasons": [
                        "prefecture match: 全国 program covers 東京都",
                        "target_types に 個人事業主 相当 (sole_proprietor) を含む",
                        "amount_max 200万円 ≥ 予定投資 80万円"
                      ],
                      "official_url": "https://r3.jizokukahojokin.info/",
                      "prefecture": "全国",
                      "primary_name": "小規模事業者持続化補助金",
                      "static_url": "/programs/shoukibo-jigyousha-jizokuka-hojokin-2611050f9a.html",
                      "tier": "B",
                      "unified_id": "UNI-2611050f9a"
                    }
                  ],
                  "total_considered": 312
                },
                "schema": {
                  "$ref": "#/components/schemas/PrescreenResponse"
                }
              }
            },
            "description": "Ranked prescreen matches with reasons + caveats."
          },
          "400": {
            "description": "Malformed profile."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Prescreen — rank programs by fit to a business profile",
        "tags": [
          "programs"
        ]
      }
    },
    "/v1/programs/search": {
      "get": {
        "description": "Discover candidate Japanese public-funding programs by free-text + structured filters across **10,790 active rows** (tier S/A/B/C — public-hold rows are pending secondary review and 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": [
          {
            "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.",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "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": "filter tier, repeat for OR",
            "in": "query",
            "name": "tier",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "items": {
                    "enum": [
                      "S",
                      "A",
                      "B",
                      "C",
                      "X"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                },
                {
                  "type": "null"
                }
              ],
              "description": "filter tier, repeat for OR",
              "title": "Tier"
            }
          },
          {
            "description": "Prefecture name. Canonical = full-suffix kanji ('東京都'). Also accepts short ('東京') and romaji ('Tokyo'/'tokyo'); normalized server-side. Use '全国' (or 'national'/'all') for nationwide programs.",
            "in": "query",
            "name": "prefecture",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 20,
                  "type": "string"
                },
                {
                  "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": "Authority level. Canonical (English): `national` / `prefecture` / `municipality` / `financial`. Also accepts Japanese: `国` / `都道府県` / `市区町村` (normalized server-side).",
            "in": "query",
            "name": "authority_level",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 20,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Authority level. Canonical (English): `national` / `prefecture` / `municipality` / `financial`. Also accepts Japanese: `国` / `都道府県` / `市区町村` (normalized server-side).",
              "title": "Authority Level"
            }
          },
          {
            "in": "query",
            "name": "funding_purpose",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "items": {
                    "type": "string"
                  },
                  "maxItems": 64,
                  "type": "array"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Funding Purpose"
            }
          },
          {
            "in": "query",
            "name": "target_type",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "items": {
                    "type": "string"
                  },
                  "maxItems": 64,
                  "type": "array"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Target Type"
            }
          },
          {
            "in": "query",
            "name": "amount_min",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 0,
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Amount Min"
            }
          },
          {
            "in": "query",
            "name": "amount_max",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 0,
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Amount Max"
            }
          },
          {
            "in": "query",
            "name": "include_excluded",
            "required": false,
            "schema": {
              "default": false,
              "title": "Include Excluded",
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "description": "Payload size knob. minimal = 7-key whitelist (~300 B/row). default = full Program shape (current behavior). full = Program + enriched + source_mentions + lineage.",
            "in": "query",
            "name": "fields",
            "required": false,
            "schema": {
              "default": "default",
              "description": "Payload size knob. minimal = 7-key whitelist (~300 B/row). default = full Program shape (current behavior). full = Program + enriched + source_mentions + lineage.",
              "enum": [
                "minimal",
                "default",
                "full"
              ],
              "title": "Fields",
              "type": "string"
            }
          },
          {
            "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.",
            "in": "query",
            "name": "include_advisors",
            "required": false,
            "schema": {
              "default": false,
              "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.",
              "title": "Include Advisors",
              "type": "boolean"
            }
          },
          {
            "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.",
            "in": "query",
            "name": "as_of_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 10,
                  "type": "string"
                },
                {
                  "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"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "limit": 20,
                  "offset": 0,
                  "results": [
                    {
                      "amount_max_man_yen": 450.0,
                      "authority_level": "national",
                      "authority_name": "国（農水省等）",
                      "funding_purpose": [
                        "DX",
                        "デジタル化"
                      ],
                      "official_url": "https://it-shien.smrj.go.jp/",
                      "primary_name": "デジタル化・AI導入補助金（旧IT導入補助金）",
                      "program_kind": "subsidy",
                      "source_fetched_at": "2026-04-22T13:20:57Z",
                      "source_url": "https://it-shien.smrj.go.jp/",
                      "subsidy_rate": 0.5,
                      "target_types": [
                        "sme",
                        "sole_proprietor"
                      ],
                      "tier": "B",
                      "unified_id": "UNI-185c08e0c1"
                    },
                    {
                      "amount_max_man_yen": 200.0,
                      "authority_level": "national",
                      "authority_name": "日本商工会議所/全国商工会連合会",
                      "funding_purpose": [
                        "販路開拓",
                        "業務効率化"
                      ],
                      "primary_name": "小規模事業者持続化補助金",
                      "program_kind": "subsidy",
                      "source_fetched_at": "2026-04-22T13:20:57Z",
                      "target_types": [
                        "sole_proprietor",
                        "sme"
                      ],
                      "tier": "B",
                      "unified_id": "UNI-2611050f9a"
                    }
                  ],
                  "total": 3
                },
                "schema": {
                  "$ref": "#/components/schemas/jpintel_mcp__models__SearchResponse"
                }
              }
            },
            "description": "SearchResponse. `results[]` shape depends on `fields`: minimal = 7-key whitelist, default = Program, full = ProgramDetail."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Authentication required — `code='auth_required'`. Send `X-API-Key`."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Not found — `code` ∈ {no_matching_records, seed_not_found, route_not_found}."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`)."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}."
          }
        },
        "summary": "Search 補助金 / 助成金 / 融資 / 税制 / 認定 programs",
        "tags": [
          "programs"
        ]
      }
    },
    "/v1/programs/{unified_id}": {
      "get": {
        "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:** public-hold rows return 404 — the stable slug must never serve a 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": [
          {
            "in": "path",
            "name": "unified_id",
            "required": true,
            "schema": {
              "title": "Unified Id",
              "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).",
            "in": "query",
            "name": "fields",
            "required": false,
            "schema": {
              "default": "default",
              "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).",
              "enum": [
                "minimal",
                "default",
                "full"
              ],
              "title": "Fields",
              "type": "string"
            }
          },
          {
            "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).",
            "in": "query",
            "name": "as_of_date",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 10,
                  "type": "string"
                },
                {
                  "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"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "amount_max_man_yen": 200.0,
                  "authority_level": "national",
                  "authority_name": "日本商工会議所/全国商工会連合会",
                  "funding_purpose": [
                    "販路開拓",
                    "業務効率化"
                  ],
                  "official_url": "https://r3.jizokukahojokin.info/",
                  "primary_name": "小規模事業者持続化補助金",
                  "program_kind": "subsidy",
                  "required_documents": [
                    "事業計画書",
                    "経費明細書"
                  ],
                  "source_fetched_at": "2026-04-22T13:20:57Z",
                  "source_mentions": {},
                  "source_url": "https://r3.jizokukahojokin.info/",
                  "target_types": [
                    "sole_proprietor",
                    "sme"
                  ],
                  "tier": "B",
                  "unified_id": "UNI-2611050f9a"
                },
                "schema": {
                  "$ref": "#/components/schemas/ProgramDetail"
                }
              }
            },
            "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)."
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Validation error — `code` ∈ {invalid_enum, invalid_date_format, missing_required_arg, out_of_range, ambiguous_query}."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Authentication required — `code='auth_required'`. Send `X-API-Key`."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "program not found — `error.code='no_matching_records'`."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Unprocessable entity — Pydantic validation failure (`code='invalid_enum'`)."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Rate limit — `code='rate_limit_exceeded'`. Honour `Retry-After`."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Internal error — `code` ∈ {internal, internal_error, db_locked, db_unavailable}."
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            },
            "description": "Subsystem unavailable — `code` ∈ {subsystem_unavailable, service_unavailable, cap_reached}."
          }
        },
        "summary": "Get a single program by unified_id (UNI-*)",
        "tags": [
          "programs"
        ]
      }
    },
    "/v1/session": {
      "post": {
        "operationId": "create_session_v1_session_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SessionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Create Session",
        "tags": [
          "me"
        ]
      }
    },
    "/v1/session/logout": {
      "post": {
        "operationId": "logout_v1_session_logout_post",
        "parameters": [
          {
            "in": "cookie",
            "name": "am_csrf",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Am Csrf"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Logout",
        "tags": [
          "me"
        ]
      }
    },
    "/v1/signup": {
      "post": {
        "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": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/jpintel_mcp__api__signup__SignupResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "メール認証だけで 14 日 / 200 req のトライアル鍵を発行",
        "tags": [
          "signup"
        ]
      }
    },
    "/v1/signup/verify": {
      "get": {
        "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": [
          {
            "in": "query",
            "name": "email",
            "required": true,
            "schema": {
              "maxLength": 320,
              "minLength": 3,
              "title": "Email",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "token",
            "required": true,
            "schema": {
              "maxLength": 128,
              "minLength": 32,
              "title": "Token",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "マジックリンクを検証してトライアル API 鍵を発行 (1 回限りの reveal)",
        "tags": [
          "signup"
        ]
      }
    },
    "/v1/stats/confidence": {
      "get": {
        "description": "Live Bayesian Discovery + Use posteriors per tool, last 30 days.",
        "operationId": "stats_confidence_v1_stats_confidence_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConfidenceResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Stats Confidence",
        "tags": [
          "stats",
          "transparency"
        ]
      }
    },
    "/v1/stats/coverage": {
      "get": {
        "operationId": "stats_coverage_v1_stats_coverage_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CoverageResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Stats Coverage",
        "tags": [
          "stats",
          "transparency"
        ]
      }
    },
    "/v1/stats/data_quality": {
      "get": {
        "operationId": "stats_data_quality_v1_stats_data_quality_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataQualityResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Stats Data Quality",
        "tags": [
          "stats",
          "transparency"
        ]
      }
    },
    "/v1/stats/freshness": {
      "get": {
        "operationId": "stats_freshness_v1_stats_freshness_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FreshnessResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Stats Freshness",
        "tags": [
          "stats",
          "transparency"
        ]
      }
    },
    "/v1/stats/usage": {
      "get": {
        "operationId": "stats_usage_v1_stats_usage_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Stats Usage",
        "tags": [
          "stats",
          "transparency"
        ]
      }
    },
    "/v1/subscribers": {
      "post": {
        "operationId": "subscribe_v1_subscribers_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/jpintel_mcp__api__subscribers__SubscribeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/jpintel_mcp__api__subscribers__SubscribeResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Subscribe",
        "tags": [
          "subscribers"
        ]
      }
    },
    "/v1/subscribers/unsubscribe": {
      "get": {
        "operationId": "unsubscribe_v1_subscribers_unsubscribe_get",
        "parameters": [
          {
            "in": "query",
            "name": "token",
            "required": true,
            "schema": {
              "maxLength": 128,
              "minLength": 16,
              "title": "Token",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "email",
            "required": true,
            "schema": {
              "maxLength": 320,
              "minLength": 3,
              "title": "Email",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Unsubscribe",
        "tags": [
          "subscribers"
        ]
      }
    },
    "/v1/tax_rulesets/evaluate": {
      "post": {
        "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": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EvaluateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvaluateResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Evaluate Tax Rulesets",
        "tags": [
          "tax_rulesets"
        ]
      }
    },
    "/v1/tax_rulesets/search": {
      "get": {
        "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": [
          {
            "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.",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "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": "Filter by tax_category. One of: consumption | corporate | income | property | local | inheritance.",
            "in": "query",
            "name": "tax_category",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 20,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by tax_category. One of: consumption | corporate | income | property | local | inheritance.",
              "title": "Tax Category"
            }
          },
          {
            "description": "Filter by ruleset_kind. One of: registration | credit | deduction | special_depreciation | exemption | preservation | other.",
            "in": "query",
            "name": "ruleset_kind",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 30,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by ruleset_kind. One of: registration | credit | deduction | special_depreciation | exemption | preservation | other.",
              "title": "Ruleset Kind"
            }
          },
          {
            "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).",
            "in": "query",
            "name": "effective_on",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 10,
                  "type": "string"
                },
                {
                  "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"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "_disclaimer": "本情報は税務助言ではありません。AutonoMath は公的機関が公表する税制・補助金・法令情報を検索・整理して提供するサービスで、税理士法 §52 に基づき個別具体的な税務判断・申告書作成代行は行いません。",
                  "limit": 20,
                  "offset": 0,
                  "results": [
                    {
                      "authority": "国税庁",
                      "authority_url": "https://www.nta.go.jp/",
                      "calculation_formula": "納付消費税額 = 課税売上に係る消費税額 × 0.2",
                      "confidence": 0.95,
                      "effective_from": "2023-10-01",
                      "effective_until": "2026-09-30",
                      "eligibility_conditions": "インボイス制度を機に免税事業者から課税事業者となった小規模事業者は、2023-10-01 から 2026-09-30 までの属する課税期間について、売上税額の 2 割を納税額とできる。基準期間の課税売上高が1,000 万円以下であることが前提。",
                      "eligibility_conditions_json": {
                        "of": [
                          {
                            "field": "newly_registered_invoice_issuer",
                            "op": "eq",
                            "value": true
                          },
                          {
                            "field": "was_exempt_business_before_registration",
                            "op": "eq",
                            "value": true
                          },
                          {
                            "field": "taxable_sales_jpy_base_period",
                            "op": "lte",
                            "value": 10000000
                          }
                        ],
                        "op": "all"
                      },
                      "fetched_at": "2026-04-24T06:08:43Z",
                      "filing_requirements": "事前届出不要。消費税確定申告書に2割特例適用の旨を記載。",
                      "rate_or_amount": "納税額 = 売上税額 × 20%",
                      "related_law_ids": [
                        "PENDING:所得税法等の一部を改正する法律(令和五年法律第三号)附則第51条の2",
                        "PENDING:消費税法第37条"
                      ],
                      "ruleset_kind": "exemption",
                      "ruleset_name": "2割特例 (小規模事業者の消費税納税額軽減)",
                      "source_checksum": "9a1c4f0d6e3b2a7c8d5f1e4b9a2c7d6e",
                      "source_excerpt": "適格請求書発行事業者となる小規模事業者の負担軽減措置 (2割特例)",
                      "source_url": "https://www.nta.go.jp/taxes/shiraberu/zeimokubetsu/shohi/keigenzeiritsu/invoice_tokurei.htm",
                      "tax_category": "consumption",
                      "unified_id": "TAX-b886afca81",
                      "updated_at": "2026-04-24T06:08:43Z"
                    }
                  ],
                  "total": 1
                },
                "schema": {
                  "$ref": "#/components/schemas/TaxRulesetSearchResponse"
                }
              }
            },
            "description": "Paginated tax rulesets + `_disclaimer` (税理士法 §52 fence)."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Search 税務判定ルールセット (e.g. 2割特例, 適格請求書発行事業者登録, 経過措置)",
        "tags": [
          "tax_rulesets"
        ]
      }
    },
    "/v1/tax_rulesets/{unified_id}": {
      "get": {
        "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": [
          {
            "in": "path",
            "name": "unified_id",
            "required": true,
            "schema": {
              "title": "Unified Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "_disclaimer": "本情報は公開情報の検索結果であり、税務助言ではありません。申告・適用判断は税理士にご確認ください。",
                  "authority": "国税庁",
                  "calculation_formula": "納付税額 = 課税売上消費税 × 20%",
                  "effective_from": "2023-10-01",
                  "effective_until": "2026-09-30",
                  "eligibility_conditions": "免税事業者から登録した小規模事業者…",
                  "filing_requirements": "確定申告書「2割特例適用」欄に記入。届出書 不要。",
                  "rate_or_amount": "課税売上にかかる消費税額の20%",
                  "related_law_ids": [
                    "LAW-4e95177b82"
                  ],
                  "ruleset_kind": "exemption",
                  "ruleset_name": "2割特例 (小規模事業者の消費税納税額軽減)",
                  "source_url": "https://www.nta.go.jp/...",
                  "tax_category": "consumption",
                  "unified_id": "TAX-b886afca81"
                },
                "schema": {
                  "$ref": "#/components/schemas/TaxRulesetOut"
                }
              }
            },
            "description": "Single ruleset row + `_disclaimer`."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get a single 税務判定ルールセット by TAX-* id",
        "tags": [
          "tax_rulesets"
        ]
      }
    },
    "/v1/testimonials": {
      "get": {
        "operationId": "list_testimonials_v1_testimonials_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TestimonialListResponse"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "List Testimonials",
        "tags": [
          "testimonials"
        ]
      }
    },
    "/v1/usage": {
      "get": {
        "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": [
          {
            "in": "header",
            "name": "X-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageStatus"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Usage",
        "tags": [
          "usage"
        ]
      }
    },
    "/v1/widget/enum_values": {
      "get": {
        "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": [
          {
            "in": "query",
            "name": "key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Key"
            }
          },
          {
            "in": "header",
            "name": "X-Widget-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Widget-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Widget Enum Values",
        "tags": [
          "widget"
        ]
      }
    },
    "/v1/widget/search": {
      "get": {
        "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": [
          {
            "description": "widget key; wgt_live_...",
            "in": "query",
            "name": "key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "widget key; wgt_live_...",
              "title": "Key"
            }
          },
          {
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Q"
            }
          },
          {
            "in": "query",
            "name": "prefecture",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 20,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Prefecture"
            }
          },
          {
            "in": "query",
            "name": "authority_level",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 20,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authority Level"
            }
          },
          {
            "in": "query",
            "name": "industry",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 20,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Industry"
            }
          },
          {
            "in": "query",
            "name": "target",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "items": {
                    "type": "string"
                  },
                  "maxItems": 64,
                  "type": "array"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Target"
            }
          },
          {
            "in": "query",
            "name": "funding_purpose",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "items": {
                    "type": "string"
                  },
                  "maxItems": 64,
                  "type": "array"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Funding Purpose"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 5,
              "maximum": 20,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "in": "header",
            "name": "X-Widget-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Widget-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Widget Search",
        "tags": [
          "widget"
        ]
      }
    },
    "/v1/widget/signup": {
      "post": {
        "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": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WidgetSignupResponse"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Widget Signup",
        "tags": [
          "widget"
        ]
      }
    },
    "/v1/widget/stripe-webhook": {
      "post": {
        "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": [
          {
            "in": "header",
            "name": "stripe-signature",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Stripe-Signature"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Widget Stripe Webhook V1 Widget Stripe Webhook Post",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Widget Stripe Webhook",
        "tags": [
          "widget"
        ]
      }
    },
    "/v1/widget/{key_id}/usage": {
      "get": {
        "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": [
          {
            "in": "path",
            "name": "key_id",
            "required": true,
            "schema": {
              "title": "Key Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "authorization",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {}
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Widget Usage",
        "tags": [
          "widget"
        ]
      }
    }
  },
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "servers": [
    {
      "description": "Production",
      "url": "https://api.jpcite.com"
    },
    {
      "description": "Local development",
      "url": "http://localhost:8080"
    }
  ]
}