Obtaining API key

Hello,

How do I obtain API key?

Start here.

https://developer-specs.company-information.service.gov.uk/guides/gettingStarted

If you didn’t already (I guess not as you’re asking this question) I would definitely recommend first reading through:

a) what data you can get and the limitations eg. what the API is for (searching for specific company, officer or PSC / RLE / Legal Person detail and the documents filed which back this, primarily).

b) If you want “all the data” then use the bulk data products instead.

c) If you want to follow things in real time / keep a database of company information updated, the Streaming API may be what you need.

You can find answers to all common questions by searching this forum.

Hi, sorry I am a bit lost here. I simply want to use the URL request with JSON. What application am I supposed to create/register in order to get the authentication key please? Thanks!

Would the free, no-need-to-register URI service be what you’re looking for?

Our free URI service gives access to basic company details using a simple uniform resource identifier (URI) for each company on our register.

The URI is a unique web address for each company. Simply use the company number within the URI structure: http://data.companieshouse.gov.uk/doc/company/{companynumber}

Hi, thank you for the reply. No, the following is what i found online and i am trying to replicate.

import requests
import json
url = “https://api.companieshouse.gov.uk/search/companies?q={}
query = “tesco”
api_key = “_______”
response = requests.get(url.format(query),auth=(api_key,’’))
json_search_result = response.text

For an approach like this, what application should i create to get the API key please?

Ah, OK. That is using the public data API. You will need to register. See How to register / create an application / obtain an API key.

Make sure you choose “live” application.

I strongly recommend you read the introduction documentation linked in my first post on this thread. Also search this forum using the search here (magnifying glass icon).

This API is free and while there is documentation the general ethos is “it’s up to you”. What you don’t know about may cause you problems! That definitely applies to using “some code I found on the net”. At the least is a very large and long-lived public-entered data set so be prepared to deal with unexpected data.

Good luck

Hi, I have read the documentation and I have registered. My question is with this, when i try to create an application, what name should I give to the application since the few lines there certainly do not constitute an application proper if you see my problem here? Should I just give it a random name and use that to get a REST Key? Thank you for your help!

I’m not sure I do see the problem.

As far as I’m aware the name and the description fields mean nothing, except to yourself. I’m not aware they’re publically available (I think more likely not) and I don’t think Companies House are “reading” them. (I’m not even sure that the name has to be unique across Companies House.)

How about “Myapplication” for a name and “My application” for a description?

As far as I know the only significant fields here are:

  • making sure you choose “live”.
  • for the code you listed, you need to create a key for the REST API.
  • if your code is running from a server environment list your external IP address(es)
  • … else if you have code which runs client-side in a browser (like javascript) list the relevant domain names in “javascript domains”. (Or both, if you plan to do both).

Ultimately for the REST API you’re just interested in getting an “API Key”.

Note that the API key is actually the “username” part of the http basic username and password. So effectively you log on as:
user: API key
password:
(The password is an empty string / nothing)