Build a Smart Company Search with Autocomplete
Many applications require users to search for companies, whether for lead verification in registration forms or finding business profiles in job boards and CRMs.
Introduction
Here is an example of an autocomplete field to suggest businesses, which you can create with our API.
This feature can be useful to enhance the user experience on your product by making your form easier to use.
Try the demo
Try with a company name
How it works
We have designed an API endpoint to help you search companies by name.
This feature is rate limited to a specific number of requests per second according to your plan. Make sure to read our pricing to know more about the API limits.
The three important parameters to know are:
name
: The name of the company to search for.simplified
: Whether to return a short version of a company profile. This does not cost credits when set totrue
.size
: The number of results to return.
For all other parameters, refer to
.API token
Before using The Companies API, you'll need an API token. Make sure to read our documentation to properly authenticate your requests.
Select or create a token
Code examples
Here are code examples in various languages to help you implement an autocomplete field. Each demonstrates making API requests to search companies by name and handle responses.
async function autocompleteCompanies(name, page = 1) {
const baseUrl = 'https://api.thecompaniesapi.com/v2/companies/by-name';
const params = new URLSearchParams({
name,
page,
simplified: 'true',
size: '25'
});
const url = `${baseUrl}?${params.toString()}`;
const response = await fetch(url, {
headers: {
Authorization: `Basic ${process.env.TCA_API_TOKEN}`,
},
});
if (!response.ok) {
throw new Error(`API request failed: ${response.status}`);
}
return await response.json();
}
Libraries & components
Explore these autocomplete components to quickly implement company search functionality in your preferred web framework. Each component provides robust features like dropdown suggestions, keyboard navigation, and customizable styling.
shadcn.com
Versatile React combobox for enhanced user input and selection.
nuxt.com
Powerful Nuxt component for dynamic input with dropdown options.
svelte.dev
Interactive Svelte REPL showcasing autocomplete functionality.
angular.io
Comprehensive guide to Angular Material's autocomplete feature.
jqueryui.com
A jQuery UI widget that provides autocomplete functionality on text inputs.
js.org
Feature-rich select/dropdown/autocomplete component for Vue.js
react-select.com
Flexible and powerful Select Input control for ReactJS with multiselect and autocomplete.
downshift-js.com
Primitive to build simple, flexible, WAI-ARIA compliant React autocomplete components
primevue.org
Advanced autocomplete component for Vue with multiple modes and customization options
Need help implementing your use case?
Reach out to us in the chat below, and let's solve it together!