API Key Authentication

Obtaining your API key

To obtain your API key, log into KeyPay and click your name in the top right corner, then click My Account

Click Generate API Key and a key will be generated for you.

Your key will now be generated. Double click the text and copy it. Store this key somewhere safe. Please note that clicking Change API Key will invalidate your old API key.

Authenticating HTTP requests

Requests will be authenticated using HTTP Basic Authentication . The API Key will become the username of your request and the password can be left blank.

To confirm that your API key is working, you can use the curl command line application.

curl -u RURQT1UyMm5vSnViZnNxZGlhMmJuUT09: https://{yourwhitelabel}.yourpayroll.com.au/api/v2/user

and you should receive a reponse:

{
“id”: 14144,
“email”: “joe.bloggs@test.com”,
“displayName”: “Joe Bloggs”,
“timeZone”: “AUS Eastern Standard Time”
}

I am having some issues with the API Key Authentication.
I am using HTML & JavaScript.

Here is my existing code:

Please see the reply below for what I get when I run the code as I can only attach one image per post.

This is the first step of what I am trying to achieve.
I am planning on using the Business ID to get the Pay Run ID’s and then the Pay Run ID will be used to get the relevant totals for a defined period. The use for this is to get the total wages & total tax withheld for a defined period. This will be used to prepare the BAS for businesses.

I would appreciate any help is solving this as I am new to working with API’s.

Here is what I get when I run the code:
image

Tony,

Sorry for the delay. Could you please drop us an email via support@yourpayroll.com.au and we’ll provide further assistance there.

thanks,
Paul.