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

domain

string

required

This is the domain for which we want the details.

company_name

string

optional

This is the name of the company whose domain we use.

linkedin

string

optional

This is the URL of the person's LinkedIn profile.

twitter

string

optional

This is the Twitter handle associated with this person.

facebook

string

optional

This is the URL of the person's Facebook profile.

webhook_url

string

optional

This is the webhook URL on which we can request the results that might face delays otherwise.

webhook_id

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.

Press + to interact
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 response
printResponse(response);
} catch (error) {
// Custom function for printing the error message
printError(error);
}
}
// Calling function to make API call
fetchData();

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

id

string

This is the internal ID associated with the company on Clearbit.

name

string

This is the name of the company.

domain

string

This is the domain of the company's website.

site

object

This is the object that contains the information mentioned on the company's website.

tags

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.

category

object

This is the object that contains details of the category to which this company belongs.

description

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."

foundedYear

integer

This is the year when the company was established.

location

string

This is the address of the company.

geo

object

This is the object that contains the company's geographical information like latitude, longitude, city, state, street number, and others.

metrics

object

This is the object that contains the matrix details of the company. For example, the number of employees, annual revenue, and others.

logo

string

This is the src of the company's logo.

type

string

This is the type of company. Possible values include either "education," "government," "nonprofit," "private," "public," or "personal."


phone

string

This is the phone number of the company's international headquarters.

tech

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

name

string

optional

This is the name of the company.

tags

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.

description

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."

raised

integer

optional

This is the total amount raised by the company (up till now).

location

string

optional

This is the address of the company.

facebook_handle

string

optional

This is the Facebook ID of the company.

twitter_handle

string

optional

This is the name this company has on Twitter.

linkedin_handle

string

optional

This is the Linkedin URL of the company.

crunchbase_handle

string

optional

This is the company's Crunchbase handle.

employees

integer

optional

This is the number of employees the company has.

logo

string

optional

This is the src of the company's logo.

email_provider

boolean

optional

This is the flag that shows whether the email domain is associated with a free email provider, that is, Gmail or not.

type

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.

Press + to interact
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 response
printResponse(response);
} catch (error) {
// Custom function for printing the error message
printError(error);
}
}
// Calling function to make API call
fetchData();

If we successfully flag a company, Clearbit sends the status code 200. Otherwise, it sends 404, meaning the company is not found.