Company autocomplete

The user types three letters of a company name and picks from the list. Address, company ID and tax number fill themselves in. It is the simplest FirmAPI deployment and the one users appreciate most.

The problem

Forms where billing details are typed by hand produce typos in company IDs, stale addresses and company names in three different spellings. The error surfaces at invoicing or during a review and gets fixed manually.

It is also the most tedious part of signing up. Every extra field lowers form completion.

How FirmAPI solves it

The name search endpoint returns matches with company ID and registered address. After a selection you fetch the detail and prefill the whole form. The user types three characters instead of six fields.

Search runs across all entities including sole traders, so the autocomplete also works for customers who are not in the Commercial Register.

Search and prefill
// 1. User types a name
const res = await fetch(
  'https://api.firmapi.sk/v1/search/name?q=' + encodeURIComponent(query),
  { headers: { 'X-API-Key': KEY } }
);
const { data } = await res.json();

// 2. Fetch the detail after selection
const detail = await fetch(
  'https://api.firmapi.sk/v1/company/ico/' + data[0].ico + '?scope=tax',
  { headers: { 'X-API-Key': KEY } }
).then(r => r.json());

form.name.value    = detail.data.name;
form.street.value  = detail.data.address.street;
form.icDph.value   = detail.data.tax.ic_dph ?? '';

Frequently asked questions

How many credits does an autocomplete cost?

Search and detail are separate calls. For an autocomplete it pays to fire the query only from the third character and to cache results briefly – that cuts the call count by an order of magnitude.

Does search by company ID work too?

Yes, there is a dedicated endpoint. If the input looks like eight digits, going straight to the detail by company ID is faster.

Try it on your own data

A free account requires no payment card. Our database holds 2 160 466 entities from 48 public registers.

We respect your privacy

We use necessary cookies to make the site work. With your consent we also use analytics cookies (Google Analytics) to understand how the site is used. More in our Privacy Policy.