Fetch Company Details
Learn and practice how to fetch a company's data using Clearbit's company API.
Introduction
Similar to any person signing up for our company, a company interested in our offer can also try to reach us. This is useful only if the company is original and not a scam. Let's see how Clearbit's Enrichment API works when it comes to searching for companies.
The company API
We can use Clearbit's company endpoint to get the primary data of a company, like the company name, the market category to which it belongs, the revenue it raised annually, its number of employees, and more. This endpoint takes in a required parameter— domain
— and returns the data associated with the specified company in a single JSON response. We can also pass optional parameters like a company name and a LinkedIn or Twitter handle to get more accurate and reliable results.
The base URL for this endpoint is as follows:
https://company.clearbit.com/v2/companies/find?domain={domain_of_company}
Request parameters
This endpoint supports the following request parameters:
Name | Type | Category | Description |
| string | required | This is the domain for which we want the details. |
| string | optional | This is the name of the company whose domain we use. |
| string | optional | This is the URL of the person's LinkedIn profile. |
| string | optional | This is the Twitter handle associated with this person. |
| string | optional | This is the URL of the person's Facebook profile. |
| string | optional | This is the webhook URL on which we can request the results that might face delays otherwise. |
| string | optional | This is the custom identifier for the webhook request, if any. |
Fetch the company data
Let's make a call to this endpoint using the code widget below. Enter the company's domain in place of {{DOMAIN}}
in line 13. For this example, you can use any domain value or one of the following:
Company Domain |
airbnb.com |
google.com |
apple.com |
educative.io |
tesla.com |
Now, click "Run" to get the data associated with the company whose domain we provided.
import fetch from 'node-fetch';const API_KEY = 'Bearer {{API_KEY}}';const endpointUrl = new URL('https://company.clearbit.com/v2/companies/find');const headerParameters = {authorization: API_KEY,contentType: 'application/json',};const queryParameters = new URLSearchParams({domain:'{{DOMAIN}}'});const options = {method: 'GET',headers: headerParameters,};async function fetchData() {try {endpointUrl.search = queryParameters;const response = await fetch(endpointUrl, options);// Custom function for printing the API responseprintResponse(response);} catch (error) {// Custom function for printing the error messageprintError(error);}}// Calling function to make API callfetchData();
In the code above:
Line 1: We import the
node-fetch
library.Line 5: We define the URL for the company endpoint.
Lines 7–10: We define the header parameters for the request, including the required API key parameter.
Lines 12–14: We define the query parameters for the request.
Lines 16–19: We set the options for the API call, specifying the HTTP request type as
GET
.Lines 21–33: We define a function called
fetchData
to make the API call.Lines 22–27: Within a try block, we make a call to the API, printing the response to the console.
Lines 28–32: We catch all errors and exceptions within a catch block and print them to the console.
Line 36: We invoke the
fetchData
function.
Response parameters
As we know, the output of the company endpoint is a JSON response, so the table below explains some attributes of this response. If you want details for all the objects in the output response, then check this lesson.
Name | Type | Description |
| string | This is the internal ID associated with the company on Clearbit. |
| string | This is the name of the company. |
| string | This is the domain of the company's website. |
| object | This is the object that contains the information mentioned on the company's website. |
| array | This is an array that contains all the market categories applicable to this company. Clearbit has its own set of market categories. "Accounting," "Biotechnology," "Cosmetics," and "Fine Art" are a few examples. |
| object | This is the object that contains details of the category to which this company belongs. |
| string | This is the description of the company. For example, "Get a taxi, private car or rideshare from your mobile phone..." is the description for the company "Uber." |
| integer | This is the year when the company was established. |
| string | This is the address of the company. |
| object | This is the object that contains the company's geographical information like latitude, longitude, city, state, street number, and others. |
| object | This is the object that contains the matrix details of the company. For example, the number of employees, annual revenue, and others. |
| string | This is the src of the company's logo. |
| string | This is the type of company. Possible values include either "education," "government," "nonprofit," "private," "public," or "personal." |
| string | This is the phone number of the company's international headquarters. |
| array | This is an array that contains all the technology tags associated with the company. |
Note: Clearbit has its own defined set of company categories, sectors, technology tags, and so on (details of which can be found here).
As we explained earlier, Clearbit sometimes returns incorrect results because their search method is not an exact one. We can label company data as incorrect using the flag the company endpoint. In addition, we can also pass the correct set of attributes so Clearbit can fix the incorrect information. Once received, Clearbit looks into the request and incorporates the fixes if required. Flagging a company is a POST
method.
The base URL for this endpoint is as follows:
https://company.clearbit.com/v2/companies/flag?domain={domain_of_company}
Request parameters
The optional attributes we can send to suggest the correct information to Clearbit are as follows:
Name | Type | Category | Description |
| string | optional | This is the name of the company. |
| array | optional | This is an array that contains all the market categories applicable to this company. Clearbit has its own set of market categories. "Accounting," "Biotechnology," "Cosmetics," and "Fine Art" are a few examples. |
| string | optional | This is the description of the company. For example, "Get a taxi, private car or rideshare from your mobile phone..." is the description for the company "Uber." |
| integer | optional | This is the total amount raised by the company (up till now). |
| string | optional | This is the address of the company. |
| string | optional | This is the Facebook ID of the company. |
| string | optional | This is the name this company has on Twitter. |
| string | optional | This is the Linkedin URL of the company. |
| string | optional | This is the company's Crunchbase handle. |
| integer | optional | This is the number of employees the company has. |
| string | optional | This is the src of the company's logo. |
| boolean | optional | This is the flag that shows whether the email domain is associated with a free email provider, that is, Gmail or not. |
| string | optional | This is the type of company. Possible values include either "education," "government," "nonprofit," "private," "public," or "personal." |
Flag a company
Let's flag a company by its domain using the code widget below. Enter the company's domain in place of {{DOMAIN}}
in line 13. Now, click "Run" to execute the code.
import fetch from 'node-fetch';const API_KEY = 'Bearer {{API_KEY}}';const endpointUrl = new URL('https://company.clearbit.com/v2/companies/flag');const headerParameters = {authorization: API_KEY,contentType: 'application/json',};const queryParameters = new URLSearchParams({domain: '{{DOMAIN}}'});const options = {method: 'POST',headers: headerParameters,};async function fetchData() {try {endpointUrl.search = queryParameters;const response = await fetch(endpointUrl, options);// Custom function for printing the API responseprintResponse(response);} catch (error) {// Custom function for printing the error messageprintError(error);}}// Calling function to make API callfetchData();
If we successfully flag a company, Clearbit sends the status code 200
. Otherwise, it sends 404
, meaning the company is not found.