Building an AI agent that handles Japanese dates? Japanese government documents, invoices, and legacy systems still use wareki (元号) era years — Reiwa, Heisei, Showa, Taisho, Meiji. Converting between wareki and ISO 8601 requires hardcoded era tables and careful handling of era boundary dates. Torify handles this with a single API call.
https://torify.dev/v1/wareki/convert
| Name | Type | Required | Description | Example |
|---|---|---|---|---|
direction |
string | Yes | Conversion direction: g2w (Gregorian → wareki) or w2g (wareki → Gregorian) | g2w |
date |
string | No | YYYY-MM-DD (required for direction=g2w) | 2024-05-01 |
era |
string | No | Era name (令和/平成/昭和/大正/明治 or Reiwa/Heisei/...) for direction=w2g | reiwa |
eraYear |
integer | No | Era year (>= 1) for direction=w2g | 6 |
month |
integer | No | Month 1-12 for direction=w2g | 5 |
day |
integer | No | Day 1-31 for direction=w2g | 1 |
{
"ok": true,
"data": {
"era": "令和",
"eraRomaji": "Reiwa",
"eraYear": 6,
"eraYearLabel": "6年",
"formatted": "令和6年5月1日"
}
}
curl "https://torify.dev/v1/wareki/convert?direction=g2w"
import { wrapFetchWithPayment } from 'x402-fetch';
import { privateKeyToAccount } from 'viem/accounts';
const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
const fetchWithPayment = wrapFetchWithPayment(fetch, account);
const res = await fetchWithPayment(
'https://torify.dev/v1/wareki/convert?direction=g2w'
);
const data = await res.json();
console.log(data); // { ok: true, data: { ... } }
import requests
# Free MCP tier (no auth) or API key (X-API-Key header)
res = requests.get(
"https://torify.dev/v1/wareki/convert?direction=g2w",
headers={"X-API-Key": "your_torify_pro_key"}
)
print(res.json())
When an AI agent extracts dates from NTA filings, invoice PDFs, or legacy ERP systems, the wareki era format ("令和6年5月1日") cannot be parsed by Date.parse(). Torify converts it in one call.
Birth dates and hire dates in legacy Japanese HR systems are stored as wareki. When syncing to a global HRIS (Workday, HiBob), wareki → ISO 8601 conversion is required.
Japanese B2B invoices reference dates in wareki. Verifying invoice issuance dates against fiscal year boundaries requires accurate era boundary handling (e.g., Showa 64 vs Heisei 1 on January 8, 1989).
/v1/holiday/check — Japan Public Holiday Check API
/v1/legal-holiday/check — Japan Statutory Rest Day API: Labor Standards Act Art. 35
/v1/age/calculate — Japan Age & School Year Calculation API
/v1/name/romanize — Japanese Name Romanization API: Passport-Style Hepburn