{
  "openapi": "3.0.3",
  "info": {
    "title": "jp-pint",
    "version": "0.1.0",
    "description": "Validate Japanese qualified invoices (適格請求書) and registration numbers (T+13). For developers and AI agents."
  },
  "servers": [{ "url": "https://jp-pint-rryxbfcsxq-an.a.run.app" }],
  "paths": {
    "/v1/registration/{number}": {
      "get": {
        "summary": "Validate a 適格請求書発行事業者登録番号 (free, no key)",
        "parameters": [{ "name": "number", "in": "path", "required": true, "schema": { "type": "string" }, "example": "T2010401021385" }],
        "responses": { "200": { "description": "validation result", "content": { "application/json": { "schema": { "type": "object", "properties": { "number": { "type": "string" }, "valid": { "type": "boolean" }, "errors": { "type": "array", "items": { "type": "string" } } } } } } } }
      }
    },
    "/v1/keys": {
      "post": {
        "summary": "Issue a free API key (200 validations/month)",
        "requestBody": { "required": false, "content": { "application/json": { "schema": { "type": "object", "properties": { "email": { "type": "string", "format": "email" } } } } } },
        "responses": { "200": { "description": "key issued" } }
      }
    },
    "/v1/validate": {
      "post": {
        "summary": "Validate a full qualified invoice",
        "security": [{ "ApiKeyAuth": [] }],
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": {
            "type": "object",
            "properties": {
              "seller_name": { "type": "string" },
              "registration_number": { "type": "string" },
              "issue_date": { "type": "string" },
              "recipient_name": { "type": "string" },
              "lines": { "type": "array", "items": { "type": "object", "properties": { "description": { "type": "string" }, "amount": { "type": "number" }, "tax_rate": { "type": "number", "enum": [0.1, 0.08, 0] } } } },
              "tax_summary": { "type": "array", "items": { "type": "object", "properties": { "tax_rate": { "type": "number" }, "taxable_amount": { "type": "number" }, "tax_amount": { "type": "number" } } } }
            }
          } } }
        },
        "responses": {
          "200": { "description": "validation result", "content": { "application/json": { "schema": { "type": "object", "properties": { "valid": { "type": "boolean" }, "errors": { "type": "array", "items": { "type": "string" } }, "warnings": { "type": "array", "items": { "type": "string" } } } } } } },
          "401": { "description": "missing/invalid key" }, "402": { "description": "free limit reached" }
        }
      }
    }
  },
  "components": { "securitySchemes": { "ApiKeyAuth": { "type": "apiKey", "in": "header", "name": "x-api-key" } } }
}
