{"openapi": "3.1.0", "info": {"title": "Soroban Data Works - Japan Micro-Data API", "version": "0.5.2", "contact": {"name": "Soroban Data Works", "url": "https://soroban.phoenixrefurbtools.workers.dev/"}, "x-guidance": "Paid endpoints use x402 v2 (USDC on Base, network eip155:8453). Call a paid endpoint with valid query parameters to receive a 402 challenge (PAYMENT-REQUIRED header), sign the payment, and retry with a PAYMENT-SIGNATURE header. Parameters are validated before any settlement, so an invalid request is never charged.", "description": "Rule-based Japanese business calendar and consumption-tax data for AI agents. Paid endpoints use x402 (USDC on Base): call without payment to receive 402 payment requirements, then retry with a PAYMENT-SIGNATURE header."}, "paths": {"/v1/jp/holidays": {"get": {"summary": "Japanese national holidays for a year (free)", "description": "Full Japanese national holiday calendar for any year, including substitute and citizen's holidays, computed from the official rules. Free.", "security": [], "parameters": [{"name": "year", "in": "query", "required": false, "schema": {"type": "integer", "minimum": 2000, "maximum": 2100}}], "responses": {"200": {"description": "Holiday list for the requested year", "content": {"application/json": {"schema": {"type": "object", "properties": {"year": {"type": "integer"}, "count": {"type": "integer"}, "holidays": {"type": "array", "items": {"type": "object", "properties": {"date": {"type": "string", "format": "date"}, "name": {"type": "string"}, "weekday": {"type": "string"}}, "required": ["date", "name", "weekday"]}}}, "required": ["year", "count", "holidays"]}, "example": {"year": 2026, "count": 18, "holidays": [{"date": "2026-01-01", "name": "元日", "weekday": "Thu"}]}}}}, "400": {"description": "Invalid year", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "string"}}, "required": ["error"]}}}}, "429": {"description": "Rate limit exceeded", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "string"}}, "required": ["error"]}}}}, "503": {"description": "Service stopped by operator or busy", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "string"}}, "required": ["error"]}}}}}}}, "/v1/jp/is-business-day": {"get": {"summary": "Is a date a Japanese business day? ($0.002 via x402)", "description": "Reports whether a given date (YYYY-MM-DD) is a business day in Japan, based on the official national holiday rules including substitute and citizen's holidays.", "parameters": [{"name": "date", "in": "query", "required": true, "schema": {"type": "string", "format": "date"}}], "responses": {"200": {"description": "Data, returned only after a settled payment", "content": {"application/json": {"schema": {"type": "object", "properties": {"date": {"type": "string", "format": "date"}, "weekday": {"type": "string"}, "is_business_day": {"type": "boolean"}, "holiday_name": {"type": ["string", "null"]}}, "required": ["date", "weekday", "is_business_day", "holiday_name"]}, "example": {"date": "2026-11-04", "weekday": "Wed", "is_business_day": true, "holiday_name": null}}}}, "400": {"description": "Invalid parameters (validated before payment; never charged)", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "string"}}, "required": ["error"]}}}}, "402": {"description": "Payment required, or the presented payment was rejected. The PAYMENT-REQUIRED header carries the same requirements document as base64 JSON. Invalid payments never unlock data.", "headers": {"PAYMENT-REQUIRED": {"description": "Base64-encoded payment requirements (x402 v2)", "schema": {"type": "string"}}}, "content": {"application/json": {"schema": {"type": "object", "properties": {"x402Version": {"type": "integer", "const": 2}, "error": {"type": "string"}, "resource": {"type": "object"}, "accepts": {"type": "array", "items": {"type": "object", "properties": {"scheme": {"type": "string"}, "network": {"type": "string"}, "amount": {"type": "string"}, "asset": {"type": "string"}, "payTo": {"type": ["string", "null"]}, "maxTimeoutSeconds": {"type": "integer"}}, "required": ["scheme", "network", "amount", "asset", "payTo"]}}, "extensions": {"type": "object"}}, "required": ["x402Version", "accepts"]}}}}, "429": {"description": "Rate limit exceeded (payment attempts are limited separately)", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "string"}}, "required": ["error"]}}}}, "503": {"description": "Service stopped by operator or busy", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "string"}}, "required": ["error"]}}}}}, "security": [{"x402Payment": []}], "x-payment-info": {"price": {"mode": "fixed", "currency": "USD", "amount": "0.002000"}, "protocols": [{"x402": {"network": "eip155:8453", "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "payTo": "0xD53Bb51b474b3a133F5eCc4f7bCF6e26fdB55A5b"}}]}}}, "/v1/jp/business-days": {"get": {"summary": "Business days between two dates ($0.003 via x402)", "description": "Counts business days in Japan between a start and end date (inclusive) and lists them, using the official national holiday rules including substitute and citizen's holidays.", "parameters": [{"name": "start", "in": "query", "required": true, "schema": {"type": "string", "format": "date"}}, {"name": "end", "in": "query", "required": true, "schema": {"type": "string", "format": "date"}}], "responses": {"200": {"description": "Data, returned only after a settled payment", "content": {"application/json": {"schema": {"type": "object", "properties": {"start": {"type": "string", "format": "date"}, "end": {"type": "string", "format": "date"}, "business_days": {"type": "integer"}, "dates": {"type": "array", "items": {"type": "string", "format": "date"}}}, "required": ["start", "end", "business_days", "dates"]}, "example": {"start": "2026-11-01", "end": "2026-11-30", "business_days": 19, "dates": ["2026-11-02"]}}}}, "400": {"description": "Invalid parameters (validated before payment; never charged)", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "string"}}, "required": ["error"]}}}}, "402": {"description": "Payment required, or the presented payment was rejected. The PAYMENT-REQUIRED header carries the same requirements document as base64 JSON. Invalid payments never unlock data.", "headers": {"PAYMENT-REQUIRED": {"description": "Base64-encoded payment requirements (x402 v2)", "schema": {"type": "string"}}}, "content": {"application/json": {"schema": {"type": "object", "properties": {"x402Version": {"type": "integer", "const": 2}, "error": {"type": "string"}, "resource": {"type": "object"}, "accepts": {"type": "array", "items": {"type": "object", "properties": {"scheme": {"type": "string"}, "network": {"type": "string"}, "amount": {"type": "string"}, "asset": {"type": "string"}, "payTo": {"type": ["string", "null"]}, "maxTimeoutSeconds": {"type": "integer"}}, "required": ["scheme", "network", "amount", "asset", "payTo"]}}, "extensions": {"type": "object"}}, "required": ["x402Version", "accepts"]}}}}, "429": {"description": "Rate limit exceeded (payment attempts are limited separately)", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "string"}}, "required": ["error"]}}}}, "503": {"description": "Service stopped by operator or busy", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "string"}}, "required": ["error"]}}}}}, "security": [{"x402Payment": []}], "x-payment-info": {"price": {"mode": "fixed", "currency": "USD", "amount": "0.003000"}, "protocols": [{"x402": {"network": "eip155:8453", "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "payTo": "0xD53Bb51b474b3a133F5eCc4f7bCF6e26fdB55A5b"}}]}}}, "/v1/jp/consumption-tax": {"get": {"summary": "Consumption tax with qualified-invoice rounding ($0.002 via x402)", "description": "Computes Japanese consumption tax for a tax-exclusive amount under the qualified invoice system: tax is rounded once per tax rate, with floor, round and ceil variants returned.", "parameters": [{"name": "amount", "in": "query", "required": true, "schema": {"type": "integer", "minimum": 0}}, {"name": "rate", "in": "query", "required": false, "schema": {"type": "integer", "enum": [10, 8]}}], "responses": {"200": {"description": "Data, returned only after a settled payment", "content": {"application/json": {"schema": {"type": "object", "properties": {"amount_excl_tax": {"type": "integer"}, "rate_percent": {"type": "integer", "enum": [10, 8]}, "tax_raw": {"type": "string"}, "variants": {"type": "object", "additionalProperties": {"type": "object", "properties": {"tax": {"type": "integer"}, "amount_incl_tax": {"type": "integer"}}, "required": ["tax", "amount_incl_tax"]}}, "recommended": {"type": "string"}, "note": {"type": "string"}}, "required": ["amount_excl_tax", "rate_percent", "tax_raw", "variants"]}, "example": {"amount_excl_tax": 10000, "rate_percent": 10, "tax_raw": "1000.00", "variants": {"floor": {"tax": 1000, "amount_incl_tax": 11000}}}}}}, "400": {"description": "Invalid parameters (validated before payment; never charged)", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "string"}}, "required": ["error"]}}}}, "402": {"description": "Payment required, or the presented payment was rejected. The PAYMENT-REQUIRED header carries the same requirements document as base64 JSON. Invalid payments never unlock data.", "headers": {"PAYMENT-REQUIRED": {"description": "Base64-encoded payment requirements (x402 v2)", "schema": {"type": "string"}}}, "content": {"application/json": {"schema": {"type": "object", "properties": {"x402Version": {"type": "integer", "const": 2}, "error": {"type": "string"}, "resource": {"type": "object"}, "accepts": {"type": "array", "items": {"type": "object", "properties": {"scheme": {"type": "string"}, "network": {"type": "string"}, "amount": {"type": "string"}, "asset": {"type": "string"}, "payTo": {"type": ["string", "null"]}, "maxTimeoutSeconds": {"type": "integer"}}, "required": ["scheme", "network", "amount", "asset", "payTo"]}}, "extensions": {"type": "object"}}, "required": ["x402Version", "accepts"]}}}}, "429": {"description": "Rate limit exceeded (payment attempts are limited separately)", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "string"}}, "required": ["error"]}}}}, "503": {"description": "Service stopped by operator or busy", "content": {"application/json": {"schema": {"type": "object", "properties": {"error": {"type": "string"}}, "required": ["error"]}}}}}, "security": [{"x402Payment": []}], "x-payment-info": {"price": {"mode": "fixed", "currency": "USD", "amount": "0.002000"}, "protocols": [{"x402": {"network": "eip155:8453", "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "payTo": "0xD53Bb51b474b3a133F5eCc4f7bCF6e26fdB55A5b"}}]}}}}, "components": {"securitySchemes": {"x402Payment": {"type": "apiKey", "in": "header", "name": "PAYMENT-SIGNATURE", "description": "x402 v2 payment signature (base64-encoded payment payload). Call without it to receive a 402 challenge first."}}}}