How to make a request to the Beauhurst API
This guide aims to run you through the steps needed to make a successful request using the Beauhurst API.
The successful request this will guide to make is to find the name, registration date, description and website for Beauhurst.
1 Initial setup
To find these details for Beauhurst you will need to use the get companies data endpoint which is part of the Companies API
The Companies API uses the Beauhurst Company ID to return data on that company. The Company ID for Beauhurst is qahx24
which should be entered in the company_ids
parameter to return data on that company.
To only return the data needed you should use the includes
parameter and include the fields needed, such as for this example - name
, registration_date
, description
and website
.
2 Authentication
Use your API key to authenticate your requests by completing the following steps:
- Use a request header named
Authorization
- The value of
Authorization
needs to beAPIkey
followed by your API key
For example, where examplekey
should be replaced by your API key:
--header 'Authorization: apikey examplekey' \
3 Send an API request
Send the request below including your API key using the language of your choice.
curl --request GET \
--url 'https://platform.beauhurst.com/_api/v1/companies?includes=registration_date&includes=website&includes=description' \
--header 'Authorization: apikey examplekey' \
--header 'accept: application/json'
const sdk = require('api')('@beauhurst/v1.0#gh4j01jlgz6c7n3');
sdk.auth('apikey examplekey');
sdk.v1_companies_list({includes: ['registration_date', 'website', 'description']})
.then(({ data }) => console.log(data))
.catch(err => console.error(err));
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://platform.beauhurst.com/_api/v1/companies?includes=registration_date&includes=website&includes=description")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["Authorization"] = 'apikey examplekey'
response = http.request(request)
puts response.read_body
<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://platform.beauhurst.com/_api/v1/companies?includes=registration_date&includes=website&includes=description', [
'headers' => [
'Authorization' => 'apikey examplekey',
'accept' => 'application/json',
],
]);
echo $response->getBody();
import requests
url = "https://platform.beauhurst.com/_api/v1/companies?includes=registration_date&includes=website&includes=description"
headers = {
"accept": "application/json",
"Authorization": "apikey examplekey"
}
response = requests.get(url, headers=headers)
print(response.text)
You should receive a 200 successful response. If not have a look at our error handling guide to see what to do to correct this.
4 Use the response
The 200 response should look like the following:
{
"meta": {
"total": 1,
"limit": 20,
"offset": 0,
"count": 1
},
"results": [
{
"id": "qahx24",
"basic": {
"name": "Beauhurst",
"registration_date": "2010-07-13",
"website": "https://www.beauhurst.com/"
},
"classification": {
"description": "<p>Beauhurst develops subscription-based software that provides information on high-growth UK companies, their events and the wider ecosystem of funders and accelerators.</p>"
}
}
]
}
The response will always follow the same structure starting with the Company ID followed by the data fields you have requested to be included, grouped into high level objects such as basic
or classification
.
You can now build your own requests using the relevant APIs to return data that is valuable to you.