403 Forbidden response using the API to access Company Profiles

Hi,

I am attempting to use Company Profile api to download company profiles but am getting a 403 Forbidden error.

I intend to write PHP code to do this but am carrying out initial testing (to verify that I am using the API correctly) using curl (api key and company number obfuscated):

curl -v -XGET -u 01234567-89ab-cdef-0123-456789abcdef: https://api.company-information.service.gov.uk/company/01234567

This is giving the following response:

< HTTP/1.1 403 Forbidden
< Date: Mon, 16 Aug 2021 15:51:42 GMT
< Content-Length: 0
< Connection: keep-alive

The API Key was created today by me with the Live options selected. I had initially tried creating a Test API key and used that with sandbox url but that also just fails. I had also initially restricted the IP addresses, but then tried removing the restriction without success.

Am I doing something wrong? Can you help?

Peter Clements