# Japan Qualified Invoice (インボイス) Compliance Checker (`autoworks-jp/japan-qualified-invoice-compliance-checker`) Actor

Check whether Japanese invoices meet Qualified Invoice System requirements: required fields, T-number format and check digit, reduced-rate marking, per-rate totals and the once-per-rate tax rounding rule. Pure computation, no scraping.

- **URL**: https://apify.com/autoworks-jp/japan-qualified-invoice-compliance-checker.md
- **Developed by:** [AutoWorks JP](https://apify.com/autoworks-jp) (community)
- **Categories:** Business, Automation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 invoice checkeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Japan Qualified Invoice (インボイス) Compliance Checker

Check whether Japanese invoices actually **meet the Qualified Invoice System (適格請求書等保存方式) requirements** before you claim input consumption tax credit (仕入税額控除) — in bulk, deterministically, with no AI guesses.

Other tools only tell you whether a T-number is registered. This Actor checks **the invoice itself**:

| Check | What it catches |
|---|---|
| Required fields | Missing issuer name, registration number, transaction date, line descriptions, recipient (standard invoices) |
| Registration number | Not `T` + 13 digits (full-width / hyphens are normalized first), corporate-number check-digit mismatch (typo detection, offline) |
| Reduced-rate marking | 8% items not marked as reduced-rate (e.g. `※`) |
| Per-rate totals | Missing 10% / 8% totals, totals that don't match the line items, invalid tax rates |
| **Tax rounding rule** | Tax must be rounded **once per tax rate per invoice**. Detects per-line rounding and wrong tax amounts; accepts floor, round-half-up and ceiling |
| Grand total | Grand total that doesn't add up (warning) |

Supports **standard** qualified invoices (適格請求書) and **simplified** ones (適格簡易請求書, recipient optional, tax amount or rate), and **tax-exclusive or tax-inclusive** pricing.

Pure computation: no scraping, no API keys, no data leaves the run.

### Input

```json
{
  "strict": false,
  "invoices": [
    {
      "id": "INV-0001",
      "invoiceType": "standard",
      "issuerName": "株式会社サンプル商事",
      "registrationNumber": "T1180301018771",
      "recipientName": "株式会社テスト",
      "transactionDate": "2026-10-01",
      "priceBasis": "exclusive",
      "reducedRateIndicated": true,
      "lineItems": [
        { "description": "コピー用紙", "amount": 5000, "taxRate": 10 },
        { "description": "お茶", "amount": 1980, "taxRate": 8, "reducedRateMark": true }
      ],
      "rateSummaries": [
        { "taxRate": 10, "amount": 5000, "taxAmount": 500 },
        { "taxRate": 8, "amount": 1980, "taxAmount": 158 }
      ],
      "grandTotal": 7638
    }
  ]
}
```

| Field | Notes |
|---|---|
| `invoiceType` | `standard` (default) or `simplified` |
| `priceBasis` | `exclusive` (default) or `inclusive` |
| `lineItems[].taxRate` | `10`, `8`, `0` (non-taxable), also `"10%"` or `0.1` |
| `lineItems[].taxAmount` | Optional. If given, used to detect per-line rounding |
| `reducedRateIndicated` | `true` if the invoice has a legend such as "※は軽減税率対象" |
| `strict` | Treat warnings as failures |

Amounts may be numbers or strings like `"１,９８０円"`.

### Output

One dataset item per invoice:

```json
{
  "id": "INV-0002",
  "status": "FAIL",
  "compliant": false,
  "errorCount": 1,
  "errors": [
    {
      "code": "LINE_LEVEL_ROUNDING",
      "severity": "error",
      "field": "rateSummaries[8%].taxAmount",
      "message": "8% tax 78 equals the sum of per-line rounded taxes. Rounding must be done once per tax rate per invoice.",
      "messageJa": "8%の消費税額78が明細ごとの端数処理の合計になっています。…"
    }
  ],
  "warnings": [],
  "taxBreakdown": [
    { "taxRate": 8, "lineItemTotal": 999, "expectedTax": { "floor": 79, "roundHalfUp": 80, "ceil": 80 },
      "reportedAmount": 999, "reportedTax": 78, "roundingMethodDetected": null }
  ]
}
```

`status` is `PASS`, `WARN` or `FAIL`. A run summary is saved to the key-value store as `SUMMARY`.

### Typical pipeline

OCR / invoice-extraction tool → this Actor → accounts-payable approval.
Pair it with a T-number registry lookup Actor to also confirm the issuer was registered on the invoice date.

### Limitations

- Does not query the NTA registry; it checks format and check digit only.
- Check-digit mismatch is a **warning**, because the algorithm is defined for corporate numbers.
- Whether an item legally qualifies for the 8% rate is not judged; only that 8% items are marked.
- This is a validation aid, not tax advice.

***

#### 日本語概要

請求書データ(JSON)が適格請求書の記載要件を満たしているかを一括で検証します。チェック対象は、登録番号の形式とチェックデジット、必須項目の漏れ、軽減税率対象の表示、税率ごとの合計、そして「1請求書につき税率ごとに1回」の端数処理ルールです。適格簡易請求書と税込・税抜の両方に対応しています。外部通信はなく、計算のみで判定します。

詳しい解説記事（Qiita）: [インボイスの「端数処理ミス」と源泉徴収の「10%計算ミス」をPythonで一括検出する](https://qiita.com/autoworks2/items/b208f61c0fa479740cb0)

# Actor input Schema

## `invoices` (type: `array`):

Array of invoice objects. Fields: id, invoiceType ('standard' | 'simplified'), issuerName, registrationNumber (T + 13 digits), recipientName, transactionDate, priceBasis ('exclusive' | 'inclusive'), reducedRateIndicated (bool), lineItems \[{description, amount, taxRate (10|8|0), reducedRateMark, taxAmount?}], rateSummaries \[{taxRate, amount, taxAmount}], grandTotal.

## `strict` (type: `boolean`):

Treat warnings (e.g. check-digit mismatch, grand-total mismatch) as failures.

## Actor input object example

```json
{
  "invoices": [
    {
      "id": "INV-0001",
      "invoiceType": "standard",
      "issuerName": "株式会社サンプル商事",
      "registrationNumber": "T1180301018771",
      "recipientName": "株式会社テスト",
      "transactionDate": "2026-10-01",
      "priceBasis": "exclusive",
      "reducedRateIndicated": true,
      "lineItems": [
        {
          "description": "コピー用紙",
          "amount": 5000,
          "taxRate": 10
        },
        {
          "description": "お茶(※軽減税率対象)",
          "amount": 1980,
          "taxRate": 8,
          "reducedRateMark": true
        }
      ],
      "rateSummaries": [
        {
          "taxRate": 10,
          "amount": 5000,
          "taxAmount": 500
        },
        {
          "taxRate": 8,
          "amount": 1980,
          "taxAmount": 158
        }
      ],
      "grandTotal": 7638
    }
  ],
  "strict": false
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "invoices": [
        {
            "id": "INV-0001",
            "invoiceType": "standard",
            "issuerName": "株式会社サンプル商事",
            "registrationNumber": "T1180301018771",
            "recipientName": "株式会社テスト",
            "transactionDate": "2026-10-01",
            "priceBasis": "exclusive",
            "reducedRateIndicated": true,
            "lineItems": [
                {
                    "description": "コピー用紙",
                    "amount": 5000,
                    "taxRate": 10
                },
                {
                    "description": "お茶(※軽減税率対象)",
                    "amount": 1980,
                    "taxRate": 8,
                    "reducedRateMark": true
                }
            ],
            "rateSummaries": [
                {
                    "taxRate": 10,
                    "amount": 5000,
                    "taxAmount": 500
                },
                {
                    "taxRate": 8,
                    "amount": 1980,
                    "taxAmount": 158
                }
            ],
            "grandTotal": 7638
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("autoworks-jp/japan-qualified-invoice-compliance-checker").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "invoices": [{
            "id": "INV-0001",
            "invoiceType": "standard",
            "issuerName": "株式会社サンプル商事",
            "registrationNumber": "T1180301018771",
            "recipientName": "株式会社テスト",
            "transactionDate": "2026-10-01",
            "priceBasis": "exclusive",
            "reducedRateIndicated": True,
            "lineItems": [
                {
                    "description": "コピー用紙",
                    "amount": 5000,
                    "taxRate": 10,
                },
                {
                    "description": "お茶(※軽減税率対象)",
                    "amount": 1980,
                    "taxRate": 8,
                    "reducedRateMark": True,
                },
            ],
            "rateSummaries": [
                {
                    "taxRate": 10,
                    "amount": 5000,
                    "taxAmount": 500,
                },
                {
                    "taxRate": 8,
                    "amount": 1980,
                    "taxAmount": 158,
                },
            ],
            "grandTotal": 7638,
        }] }

# Run the Actor and wait for it to finish
run = client.actor("autoworks-jp/japan-qualified-invoice-compliance-checker").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "invoices": [
    {
      "id": "INV-0001",
      "invoiceType": "standard",
      "issuerName": "株式会社サンプル商事",
      "registrationNumber": "T1180301018771",
      "recipientName": "株式会社テスト",
      "transactionDate": "2026-10-01",
      "priceBasis": "exclusive",
      "reducedRateIndicated": true,
      "lineItems": [
        {
          "description": "コピー用紙",
          "amount": 5000,
          "taxRate": 10
        },
        {
          "description": "お茶(※軽減税率対象)",
          "amount": 1980,
          "taxRate": 8,
          "reducedRateMark": true
        }
      ],
      "rateSummaries": [
        {
          "taxRate": 10,
          "amount": 5000,
          "taxAmount": 500
        },
        {
          "taxRate": 8,
          "amount": 1980,
          "taxAmount": 158
        }
      ],
      "grandTotal": 7638
    }
  ]
}' |
apify call autoworks-jp/japan-qualified-invoice-compliance-checker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,autoworks-jp/japan-qualified-invoice-compliance-checker"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/4L6Q1tb9G8XY5UWAA/builds/GwZg2bX5KCeNLJ3o0/openapi.json
