FullContact API Documentation
FullContact API provides developers a set of tools to build applications that leverage insights from people’s information. This API allows developers to add identity verification, enrich contact data, and engage in data-driven marketing and sales.
In this blog post, we will go through the FullContact API documentation and provide examples of how to use this API in JavaScript.
Getting Started
Before you can start using FullContact API, you need to sign up for an API key. You can do this by visiting the FullContact API website and clicking the Get Started
button.
Once you have your API key, you can start making API requests. FullContact API supports RESTful API and returns responses in JSON format.
API Endpoints
FullContact API offers multiple endpoints that allow you to get different sets of information about a person. Some of the available endpoints include:
- Person API: allows you to retrieve information about a person based on their email address, phone number, or social profile URL.
- Company API: allows you to retrieve information about a company based on their company domain or name.
- Card Reader API: allows you to extract information from a business card image.
To access any of the FullContact endpoints, you need to use the following URL structure:
https://api.fullcontact.com/v3/{endpoint}?{parameters}
Where {endpoint}
is the specific endpoint you want to access (e.g. person
, company
, cardReader
), and {parameters}
are optional and depend on the endpoint you are accessing.
JavaScript Examples
Now, let’s take a look at some JavaScript examples that demonstrate how to use FullContact API.
Example 1: Person API
In this example, we will retrieve information about a person based on their email address. We will use the fetch()
method to send an API request and parse the JSON response.
const apiKey = 'your-api-key';
const email = 'john.doe@example.com';
const url = `https://api.fullcontact.com/v3/person.enrich?email=${email}`;
fetch(url, {
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
})
.then((response) => response.json())
.then((data) => {
console.log(data);
})
.catch((error) => console.error(error));
Example 2: Company API
In this example, we will retrieve information about a company based on their domain. We will use the XMLHttpRequest
object to send an API request and parse the JSON response.
const apiKey = 'your-api-key';
const domain = 'example.com';
const url = `https://api.fullcontact.com/v3/company.enrich?domain=${domain}`;
const xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.setRequestHeader('Authorization', `Bearer ${apiKey}`);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onreadystatechange = function () {
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
const data = JSON.parse(this.responseText);
console.log(data);
} else if (this.readyState === XMLHttpRequest.DONE) {
console.error('Error!');
}
};
xhr.send();
Example 3: Card Reader API
In this example, we will extract information from a business card image using FullContact Card Reader API. We will use the axios
library to send an API request and parse the JSON response.
const apiKey = 'your-api-key';
const imageUrl = 'http://example.com/card.jpg';
const url = `https://api.fullcontact.com/v3/cardReader`;
const formData = new FormData();
formData.append('front', imageUrl);
axios
.post(url, formData, {
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'multipart/form-data',
},
})
.then((response) => {
console.log(response.data);
})
.catch((error) => console.error(error));
Conclusion
FullContact API provides developers with a powerful set of tools to enrich contact data and build applications that leverage people’s information. In this blog post, we went through the FullContact API documentation and provided examples of how to use this API in JavaScript.