Authentication
All API endpoints (except authentication endpoints) require Basic Authentication using your API Key credentials. This guide explains how to create API keys and use them to authenticate your requests.
Step 1: Create an API Key
First, you need to create an API key. Navigate to the API Keys section and create a new key. You'll need to:
- Log in using your credentials (Get OTP and Verify OTP)
- Create a new API key with a friendly name
- Save the credentials securely - the password is only shown once!
The API key creation response will include:
{
"apiUsername": "39534898-f44e-461e-99fb-c27f3bdd515b",
"apiPassword": "(Qlpej#UXs5NLCS$Rk&+"
}⚠️ Important: The apiPassword is only shown once when the API key is created. Store it securely as it cannot be retrieved later. If you lose it, you'll need to create a new API key.
Step 2: Encode Your Credentials
To use Basic Authentication, you need to combine your apiUsername and apiPassword with a colon (:) and encode the result in base64.
Format
Format: apiUsername:apiPasswordExample
Example:
- Username: 39534898-f44e-461e-99fb-c27f3bdd515b
- Password: (Qlpej#UXs5NLCS$Rk&+
- Combined: 39534898-f44e-461e-99fb-c27f3bdd515b:(Qlpej#UXs5NLCS$Rk&+
- Base64 encoded: Mzk1MzQ4OTgtZjQ0ZS00NjFlLTk5ZmItYzI3ZjNiZGQ1MTViOihRbHBlaiNVWHM1TkxDUyRScysmNote: Most HTTP clients and libraries handle base64 encoding automatically when you provide the username and password separately. You typically don't need to manually encode the credentials.
Step 3: Send Authorization Header
Include the encoded credentials in the Authorization header of your HTTP requests:
Authorization: Basic Mzk1MzQ4OTgtZjQ0ZS00NjFlLTk5ZmItYzI3ZjNiZGQ1MTViOihRbHBlaiNVWHM1TkxDUyRScysmExamples in Different Languages
cURL
curl 'https://super.mygigsters.com.au/v1/employees' \
-u "apiUsername:apiPassword"JavaScript (Fetch API)
const username = 'your-apiUsername';
const password = 'your-apiPassword';
const credentials = btoa(`${username}:${password}`);
fetch('https://super.mygigsters.com.au/v1/employees', {
method: 'GET',
headers: {
'Authorization': `Basic ${credentials}`,
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));Python (requests library)
import requests
from requests.auth import HTTPBasicAuth
url = 'https://super.mygigsters.com.au/v1/employees'
username = 'your-apiUsername'
password = 'your-apiPassword'
response = requests.get(
url,
auth=HTTPBasicAuth(username, password)
)
print(response.json())Postman
- Open Postman and create a new request
- Set the HTTP method (GET, POST, etc.)
- Enter the full URL
- Go to the "Authorization" tab
- Select "Basic Auth" and enter your
apiUsernameas username andapiPasswordas password - Click "Send" to make the request
Security Best Practices
- Never commit API keys to version control: Use environment variables or secure secret management
- Rotate keys regularly: Create new keys periodically and delete old ones
- Use different keys for different environments: Separate keys for development, staging, and production
- Monitor key usage: Regularly review which keys are being used and delete unused ones
- Store passwords securely: Use a password manager or secure vault to store your API passwords