Appearance
Authentication Guide
Securing your requests to the AgencyHub API is crucial. This guide will walk you through the process of authenticating your API requests.
API Keys
AgencyHub uses API keys to authenticate requests. You need two keys:
- Access Key: Identifies your API client
- Secret Key: Authenticates your requests
To obtain your API keys:
- Contact your AgencyHub administrator or account manager
- Request your access key and secret key for API access
- Securely store the provided keys
Important: Keep your API keys secure and never share them publicly. If you believe your keys have been compromised, contact your administrator immediately for new keys.
Making Authenticated Requests
To authenticate an API request, include your API keys in the request headers:
javascript
const headers = {
"x-access-key": "your_access_key_here",
"x-secret-key": "your_secret_key_here",
};
fetch("https://agencyhubapi.stepps.net/api/v1/listings", {
method: "GET",
headers: headers,
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
Best Practices
- Server-Side Requests: Always make API requests from your server, never from client-side code.
- Environment Variables: Store your API keys in environment variables, not in your source code.
Error Handling
If your authentication fails, you'll receive a 401 Unauthorized
HTTP status code. Common reasons for authentication errors include:
- Missing or incorrect API keys
- Expired API keys
- Insufficient permissions for the requested operation
Securing Your API Keys
To keep your API keys secure:
- Never commit them to version control
- Don't share them in client-side code or public repositories
- Use environment variables or a secure key management system
- Implement IP whitelisting if possible
Need Help?
If you're having trouble authenticating your requests, please contact our support team.
Remember, securing your API keys is crucial to protecting your account and data. If you suspect your keys have been compromised, regenerate them immediately in your AgencyHub account settings.