# Authentication issue with API on Salesforce

**URL:** <http://forum.companieshouse.gov.uk/t/authentication-issue-with-api-on-salesforce/11984>\
**Category:** API Issues\
**Created:** [August 14, 2025, 10:23am UTC](http://forum.companieshouse.gov.uk/t/authentication-issue-with-api-on-salesforce/11984 "2025-08-14T10:23:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![richa.sharma](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/r/e68b1a/32.png) [@richa.sharma](http://forum.companieshouse.gov.uk/u/richa.sharma)\
**Post date:** [August 14, 2025, 10:23am UTC](http://forum.companieshouse.gov.uk/t/authentication-issue-with-api-on-salesforce/11984/1 "2025-08-14T10:23:49Z")

</div>

I have installed the app on my Salesforce sandbox. I have followed all the steps to configure.

An Apex error occurred: comp\_house.CompanyHouseAPI.customSettingException: {“error”:“Invalid Authorization”,“type”:“ch:service”}

How shall I debug this? I have saved the api key on Salesforce as instructed.

Thanks  
Richa Sharma

---

<div class="post-metadata">

**Author:** ![voracityemail](http://forum.companieshouse.gov.uk/letter_avatar_proxy/v4/letter/v/b77776/32.png) [@voracityemail](http://forum.companieshouse.gov.uk/u/voracityemail)\
**Post date:** [August 14, 2025, 12:45pm UTC](http://forum.companieshouse.gov.uk/t/authentication-issue-with-api-on-salesforce/11984/2 "2025-08-14T12:45:43Z")

</div>

I don’t use Salesforce but looks like there are documents on working with that - e.g. here’s an example (only http, not https) using http Basic Authorization (in case your issue is “how to send that” - although perhaps you use a graphic interface to set this up):

> **[Salesforce Developers](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_classes_restful_http_httprequest.htm)**
>
> Salesforce Developer Website

Check the following in Companies House application registration:

1. Ensure you chose “live”, not test/sandbox.
2. Ensure you have either entered the server’s IP address(es) OR used the local host workaround (if using locally) OR registered the javascript domain name(s).

Double-check your API key as well, several people have gone a long way then found they weren’t using the key they thought they needed e.g. they’d an old key, or had the non-live key, or extra spaces…

Check you have the correct fields in the correct places. The system uses http Authorization - that means there is a username and a password. For some reason Companies House requires that you effectively have the “password” part (the API key) as the username, and the password is blank / empty.

There may be issues with setting that up in SalesForce:

> [@Salesforce struggles with no password for HTTP Basic Authentication](https://forum.companieshouse.gov.uk/t/salesforce-struggles-with-no-password-for-http-basic-authentication/1882):
>
> The API Basic authentication requires no password (seperate issue logged because documentation erroneously says it ignores the password). I’m using Salesforce - its platform method for creating and securing the call-outs to Companies House struggles to allow No password at all. I can code it, but its a shame to have to workaround the platform capabilities. Would like to see the ability to ignore it (as originally advertised), so in salesforce we can genuinely set any password, or be able to se…

It’s sometimes helpful to try another tool e.g. curl if you’ve got access to that (from your registered server) - it’s really simple and you can turn on a very verbose mode to inspect traffic. A simple test would be:

curl -u YOURAPIKEYHERE: [https://api.company-information.service.gov.uk/company/03279730](https://api.company-information.service.gov.uk/company/03279730)

Good luck.
