September 12, 2024

new project: Hōjin Bangō Custom APIs (Japanese Corporate Number)

I was recently in Japan (not my first time there) and each time I try to learn a bit about the culture.
One of my recent encounters is the Corporate Number called in Japan hōjin bangō (法人番号), in a certain way the equivalent of a VAT Number to identify a company.

My next thought was: I am sure there is a service to check the validity of these corporate numbers.

There is indeed a web site by the National Tax Agency in English and Japanese and looks like there is also a web service to check the validity by using an API, more info (only in Japanese) here.

I am not proficient in Japanese but with the help of Google Translate looks like this endpoint is not public (like the EU one) but requires a registration and can take up to a month.

For me it's not possible to use this API endpoint but their website allows to search without registration a corporate number.

Next step was to search for some Japanese corporate numbers to verify them, quickly I found the number of two companies: Nintendo (1130001011420) and Sony (5010401067252) ;)

This is a website screenshot with a result, if the number is correct, the website returns the company name (also in Furigana) and the address:

My goal was to create a Custom API to verify a corporate number, because I am not able to use their API, I used the old WebClient to call the page and parse the returned content.

I am aware this is not a robust situation but we can apply this technique when an API is not available and the parsing of the page is not complex.

The Tax Agency website accepts a URL in the following format:

https://www.houjin-bangou.nta.go.jp/henkorireki-johoto.html?selHouzinNo=

followed by the corporate number

and if the number is found, the details are contained inside a dl tag (Description List).

The Custom API call the parameterized URL, parse the response and returns 4 properties:

  • Success (if the number is found or not)
  • CompanyName1
  • CompanyName2
  • Address
You can find the code and the managed solution inside the repository:

Here a screenshot of this Custom API inside a Power Automate flow using the "Perform an unbound action":



hope it helps!

0 comments:

Post a Comment