Postman API call

I have registered a test account to see if I can get the API working.
In postman’s Authorization section I am using the “API Key” as the value and “Key Name” as key - but I get the following ( I have Add to Header enabled):

{“error”:“Empty Authorization header”,“type”:“ch:service”}

Set your Authorization type as “Basic Auth” and set your apikey as the username, blank password. Doesn’t make sense but it works.

1 Like

I am still getting a 401 - “Invalid Authorization” response. See image.
Am I using the correct url to retrieve data on a company (I have inserted a dummy value in url)?

Try this instead - https://api.companieshouse.gov.uk

so for example

https://api.companieshouse.gov.uk/company/NF00XXXX

why do you guys give wrong answers?What’s wrong with you.

@sachin.vbsllp i’m sorry do you have the correct answer then? I am only giving this answer because i have a full postman api collection and its working and i am using them in a live project.

Here is a screenshot of KPMG LLP (OC301540)

GET URL : https://api.companieshouse.gov.uk/company/OC301540

I changed
Application environment - test
to
Application environment - live
it works for me now.

4 Likes

@jeremy where did you do this? I have not had to do set this anywhere?

@berto did you get this working evenutally


for ‘test’
I had received
{
“error”: “Invalid Authorization”,
“type”: “ch:service”
}

for ‘live’
response is good

1 Like

thanks @jeremy it looks like this has been recently updated there was no “manage application” section before where you had you had to choose live or test. just create an api key and use.

@jeremy’s answer is the crucial answer here.

Luckily, I guessed this from an almost entirely unrelated post in another thread before reading this one, but not before I’d spent a fruitless hour going back and forth with my code and eventually performing the example curl call with no success.

Sorry for shouting, but…

To access the live api.company-information.service.co.uk you must have a ‘live’ application.

1 Like

This did it for me. Why do they have test API keys if they don’t work…

It worked for me with the live API key:

Get: https://api.company-information.service.gov.uk/company/01624297

Authorization: Basic Auth (username: {your api key}, Password: blank)

Response:
{
“undeliverable_registered_office_address”: false,
“type”: “ltd”,
“date_of_creation”: “1982-03-24”,
“has_been_liquidated”: false,
“company_name”: “MICROSOFT LIMITED”,
“jurisdiction”: “england-wales”,
“accounts”: {
“overdue”: false,
“last_accounts”: {
“type”: “full”,
“period_end_on”: “2022-06-30”,
“made_up_to”: “2022-06-30”,
“period_start_on”: “2021-07-01”
},
“next_accounts”: {
“period_end_on”: “2023-06-30”,
“period_start_on”: “2022-07-01”,
“due_on”: “2024-03-31”,
“overdue”: false
},
“accounting_reference_date”: {
“day”: “30”,
“month”: “06”
},
“next_made_up_to”: “2023-06-30”,
“next_due”: “2024-03-31”
},
“company_number”: “01624297”,
“registered_office_address”: {
“address_line_1”: “Microsoft Campus”,
“region”: “Berkshire”,
“postal_code”: “RG6 1WG”,
“address_line_2”: “Thames Valley Park”,
“locality”: “Reading”
},
“sic_codes”: [
“62020”
],
“last_full_members_list_date”: “2016-06-24”,
“company_status”: “active”,
“has_insolvency_history”: false,
“etag”: “c12dfbc102246d5febcec29bf2718c4beb5e15ab”,
“has_charges”: true,
“previous_company_names”: [
{
“name”: “MICROSOFT EUROPE LIMITED”,
“ceased_on”: “1983-06-16”,
“effective_from”: “1982-05-25”
},
{
“name”: “DIALMAIN LIMITED”,
“ceased_on”: “1982-05-25”,
“effective_from”: “1982-03-24”
}
],
“confirmation_statement”: {
“overdue”: false,
“last_made_up_to”: “2022-06-23”,
“next_due”: “2023-07-07”,
“next_made_up_to”: “2023-06-23”
},
“links”: {
“self”: “/company/01624297”,
“filing_history”: “/company/01624297/filing-history”,
“officers”: “/company/01624297/officers”,
“charges”: “/company/01624297/charges”,
“persons_with_significant_control_statements”: “/company/01624297/persons-with-significant-control-statements”,
“persons_with_significant_control”: “/company/01624297/persons-with-significant-control”
},
“registered_office_is_in_dispute”: false,
“has_super_secure_pscs”: false,
“can_file”: true
}