REST API Authentication - 401 Unauthorised authentication failure

Updated 4 years ago

If you're getting this error, you're not using the correct authentication.

When using our REST API, Basic HTTP authentication should be used in the header. Our docs explain this here:


username - Your API username

password - Your API key

You can get your API credentials by clicking 'API Credentials' on the top right of the dashboard.


username - Your account username

password - Your account password

These are the same credentials that you use to login to the dashboard.

The Authorization header is constructed as follows:

  • Username and password are combined into a string "username:password"
  • The resulting string is then encoded using Base64 encoding
  • The authorization method and a space i.e. "Basic " is then put before the encoded string.

For example, if the user agent uses 'Aladdin' as the username and 'open sesame' as the password then the header is formed as follows:

Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

If you're not sure how to do this, you can use the online service

Curl example:

curl --include \
--header "Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=" \

Generate the Authentication header with code

PHP Authentication Header Example

"Authorization: Basic ".base64_encode($username.":".$password)

How Did We Do?

Powered by HelpDocs (opens in a new tab)