Shoshiki API documentation
APIs for Japanese business documents. Base URL https://shoshiki.com (/v1/... and /api/v1/... are the same). JSON in and out (PDFs are application/pdf).
Getting started
- Sign up (free, no card) and create a key under "API keys". Pick the products it can use.
- The key is shown once. Store it in the SHOSHIKI_KEY environment variable.
- Check it with GET /v1/ping.
curl https://shoshiki.com/v1/ping -H "Authorization: Bearer $SHOSHIKI_KEY"
Auth and quotas
Send Authorization: Bearer shk_live_... on every call. Usage is counted per product per month (Japan time); over the limit you get 429 quota_exceeded until the next month. Headers X-Shoshiki-Quota-Limit / -Used show the count. Each key may call 120 times per minute (429 rate_limited with Retry-After).
| Product | Counted as | Free |
|---|---|---|
| Shoshiki PDF | 1 render = 1 document (validate and tax/calc are free) | 100 |
| Shoshiki Receipts for Stripe | 1 receipt = 1 | 20 |
| Shoshiki Extract | 1 page = 1 (failures are not counted) | 50 |
| Shoshiki Registration Watch | 1 number checked = 1 / companies watched | 100 companies / 300 |
Errors
Errors look like this.
{ "error": { "code": "validation_failed", "message": "...", "issues": [
{ "path": "recipient.name", "code": "required", "message": "..." }
] } }401 unauthorized | Missing, wrong or revoked key |
403 forbidden | The key is not allowed for this product |
422 validation_failed | Invalid input or missing required items (see issues) |
429 quota_exceeded / rate_limited | Monthly quota or per-minute limit |
502 ai_unavailable / 503 ai_budget | Extraction failed / daily AI budget (not counted) |
Shoshiki PDF
POST /v1/pdf/render with template and data returns a PDF. With qualified: true the API checks the Japanese qualified-invoice requirements (issuer name and registration number, transaction date, items, totals and tax per rate, recipient) and returns 422 with issues if anything is missing. Consumption tax is rounded once per rate per document (rounding: floor by default, round, ceil).
template:invoice receipt delivery_note quote postcard_address postcard_letter address_labels
curl https://shoshiki.com/v1/pdf/render \
-H "Authorization: Bearer $SHOSHIKI_KEY" \
-H "Content-Type: application/json" \
-d '{
"template": "invoice",
"data": {
"qualified": true,
"issue_date": "2026-10-31",
"transaction_date": "2026-10-31",
"issuer": { "name": "Example Shop", "registration_number": "T9999999999999" },
"recipient": { "name": "Example Customer Inc." },
"lines": [
{ "description": "Coffee beans", "quantity": 12, "unit_price": 2380, "tax_rate": 8 },
{ "description": "Paper cups", "quantity": 20, "unit_price": 1450, "tax_rate": 10 }
]
}
}' -o invoice.pdfVertical postcards (postcard_address)
{ "template": "postcard_address", "data": {
"recipients": [{ "postal_code": "123-4567", "address1": "東京都足立区梅田6-9-3",
"address2": "ひなたビル205号", "name": "山田 太郎", "honorific": "様" }],
"sender": { "postal_code": "120-0000", "address": "東京都足立区梅田1-2-3", "name": "ひなた商店" },
"kanji_digits": true, "offset_mm": { "x": 0, "y": 0 } } }Up to 100 cards per call (counted as one document). Digits become kanji numerals; hyphens become vertical bars. Use offset_mm to adjust for your printer.
Validate / tax only (free)
POST /v1/pdf/validate(same body)、POST /v1/tax/calc({ lines, prices, rounding })
Receipts for Stripe
In the app, add a Stripe restricted key (read access to Charges, Customers, Checkout Sessions, Invoices, Products) and your issuer details. For each payment after connecting, a Japanese receipt is created within 5 minutes and emailed to the payer, who can edit the addressee and description and reissue (up to 10 versions; amounts, dates and numbers are fixed). "Qualified invoice" wording and the registration number are printed only when your registration number is valid.
Default tax rate is 10%. Set product metadata shoshiki_tax_rate=8 for the reduced rate.
curl https://shoshiki.com/v1/receipts -H "Authorization: Bearer $SHOSHIKI_KEY"
curl https://shoshiki.com/v1/receipts/{id}/pdf -H "Authorization: Bearer $SHOSHIKI_KEY" -o receipt.pdfExtract
POST /v1/extract with a base64 file returns fields and arithmetic checks. Review fields marked uncertain and checks with status mismatch. Registration numbers are matched against the public registry (registration_status). Neither the image nor the result is stored.
curl https://shoshiki.com/v1/extract \
-H "Authorization: Bearer $SHOSHIKI_KEY" \
-H "Content-Type: application/json" \
-d '{ "file": "<base64>", "media_type": "image/jpeg", "document_type": "invoice" }'CSV output
The default response is JSON. With format: csv, the same result is returned as CSV; counting, retries and checks are identical. csv.mode is summary (one row per document, default) or lines (one row per line item), reported in the X-Shoshiki-Csv-Mode and X-Shoshiki-Csv-Rows headers. Choose columns with csv.columns (unknown columns return 422 before reading).
curl https://shoshiki.com/v1/extract \
-H "Authorization: Bearer $SHOSHIKI_KEY" \
-H "Content-Type: application/json" \
-d '{ "file": "<base64>", "media_type": "image/jpeg", "format": "csv", "csv": { "mode": "lines" } }'Text is UTF-8 with BOM and CRLF line ends (csv.encoding can select utf-8). Unreadable amounts are left blank, never 0, and listed in the review column. The check column is one of 一致, 不一致 or 確認できず. In text columns, values that look like formulas (starting with = + - @ etc.) or that spreadsheets would alter (leading zeros, date-like text) are prefixed with '.
Registration watch
POST /v1/registrations/check returns the status (registered, revoked, expired, not_found). Add numbers with POST /v1/watch/entries; every morning (~6:30 JST) the daily NTA diff is matched and revocations, expirations and changes are sent by email and webhook.
curl https://shoshiki.com/v1/registrations/check \
-H "Authorization: Bearer $SHOSHIKI_KEY" \
-H "Content-Type: application/json" \
-d '{ "numbers": ["T9999999999999", "1234567890123"] }'This service is built from data published on the National Tax Agency Qualified Invoice Issuer Publication Site (downloads), processed by SBGG LLC. Its content is not guaranteed by the National Tax Agency. Source: https://www.invoice-kohyo.nta.go.jp/download/
Webhook
Create an https endpoint in the app; the secret (whsec_...) is shown once. Verify Shoshiki-Signature: t=<sec>,v1=<HMAC-SHA256(secret, t + "." + body)> and reject signatures older than 5 minutes. Non-2xx responses are retried (1, 5, 30 min, 2, 6, 12 h, ...) and the endpoint is disabled after 10 consecutive failures.
Events:receipt.createdreceipt.reissuedregistration.revokedregistration.expiredregistration.changedquota.reached
import crypto from "node:crypto";
// header: Shoshiki-Signature: t=1761300000,v1=<hex>
export function verify(secret, rawBody, header) {
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
if (Math.abs(Date.now() / 1000 - Number(parts.t)) > 300) return false;
const expected = crypto.createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex");
return crypto.timingSafeEqual(Buffer.from(expected, "hex"), Buffer.from(parts.v1, "hex"));
}MCP
Use it from AI agents (Claude etc.). Endpoint https://shoshiki.com/api/mcp (Streamable HTTP, JSON-RPC 2.0). Tools: validate_invoice, calc_tax, render_pdf, check_registrations, extract_document, list_receipts. Same keys and quotas as the API.
claude mcp add --transport http shoshiki https://shoshiki.com/api/mcp \ --header "Authorization: Bearer $SHOSHIKI_KEY"
Data handling
- PDF: returned immediately, not stored.
- Extract: neither images nor results are stored. AI processing by Anthropic (USA), which does not train on API data and deletes it within 30 days.
- Receipts: receipt contents (amounts, lines, addressee, payer email) are stored. Stripe keys are encrypted with AES-256-GCM. Deleted 90 days after cancellation.
- Hosting: Tokyo (Vercel, Supabase).