Authentication issue (API)

We are trying to connect to the API and have generated the keys as required. However we are not getting any authentication.

Please could someone explain where we are going wrong. We are using jave and springboot.

1 Like

The process of authentication is detailed in the attached post. If this doesn’t help could you let me know what error you are receiving and what steps the code is following.

Thanks

Mark

@mfairhurst - hope all is well!

I am very new to this site and have been trying to access the API website…I have seen a few of your posts here so figured you might be a good person to ask.

I have registered at CH and can log in - although I don’t think this is the authentication key - would welcome your thoughts on that please.

I have run: curl -u My_Log_In_Username: “https://api.company-information.service.gov.uk/company{Inserted_Actual_Co_Num}” on my terminal and received the following "{“error”:“Invalid Authorization”, “type”:“ch:service”} / additionally, I ran:

Import requests
url = “https://api.company-information.service.gov.uk/company/00000006
response = requests.get(url, auth=(My_Log_In_Username:, ))
print(response)

And received a response 400 error message…on this basis I assume it is the authorisation code, so not sure where I find this…any assistance would be fab!

Thanks!

Not sure if it is of any help… I found the following…

curl -v -uYOUR_APIKEY_FOLLOWED_BY_A_COLON: https://api.companieshouse.gov.uk/company/00002065

You don’t use your username but you use your API key… (don’t forget the colon “:” at the end)

I presume the URL has changed for this now. Unless I am mistaken, you just need to substitute the username with the API key.