Authentication
Distribution Hub XML API uses API keys embedded in every request. No OAuth, no tokens, no sessions — just an AccessKey and SecretKey in each API call over HTTPS.
Authentication method
Every request must include an <Authentication> element with your API key pair:
<Authentication>
<AccessKey>[AccessKey]</AccessKey>
<SecretKey>[SecretKey]</SecretKey>
</Authentication>
Complete request example
<?xml version="1.0" encoding="UTF-8"?>
<Pull_ListProp_RQ>
<Authentication>
<AccessKey>[AccessKey]</AccessKey>
<SecretKey>[SecretKey]</SecretKey>
</Authentication>
<IncludeNLA>false</IncludeNLA>
</Pull_ListProp_RQ>
The <Authentication> element must be the first child element in every request.
Both values are mandatory. Treat the SecretKey as a secret; never expose it in logs, client-side code, screenshots, or support messages.
Obtaining API keys
Step 1: Partnership agreement
Contact the Distribution Hub Partnership Team to begin the onboarding process. You will need a partnership agreement and an integration plan.
Step 2: Staging and production keys
You'll receive API key pairs for both environments:
| Environment | Purpose | Credentials |
|---|---|---|
| Staging | Development & testing | Staging AccessKey / SecretKey |
| Production | Live operations | Production AccessKey / SecretKey |
Managing keys
To create, rotate, list, or revoke API keys, contact API Support at apisupport@rentalsunited.com.
API key management applies to Rentals United credentials. It does not create, list, or delete Guesty credentials.
Existing API users
Creating an API key does not by itself disable existing account credentials. Rentals United's migration to API-key-only authentication is irreversible: before migrating, create keys for every API scope you use and deploy AccessKey/SecretKey authentication for all outbound requests.
Authentication flow
1. Your system stores API keys securely
2. For each API call:
- Build XML request with <Authentication> element
- Send POST request to DH endpoint
- DH validates the AccessKey / SecretKey pair
- DH returns response (or 401 if invalid)
Error handling
Invalid credentials
HTTP Status: 401 Unauthorized
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Status>
<Success>false</Success>
<ErrorCode>AuthenticationFailed</ErrorCode>
<ErrorMessage>Invalid username or password</ErrorMessage>
</Status>
</Error>
Actions:
- ❌ Don't retry automatically
- ✅ Verify the
AccessKeyandSecretKeybelong to the same pair - ✅ Check environment (staging vs production)
- ✅ Contact API Support if the keys should be valid
Security best practices
1. Always use HTTPS
✅ Correct:
https://api.distribution-hub.com/api/Handler.asmx
❌ Never:
http://api.distribution-hub.com/api/Handler.asmx
2. Store keys securely
Environment variables (recommended)
# Linux/Mac
export DH_API_ACCESS_KEY="[AccessKey]"
export DH_API_SECRET_KEY="[SecretKey]"
# Windows PowerShell
$env:DH_API_ACCESS_KEY="[AccessKey]"
$env:DH_API_SECRET_KEY="[SecretKey]"
Application code
Python:
import os
access_key = os.environ.get('DH_API_ACCESS_KEY')
secret_key = os.environ.get('DH_API_SECRET_KEY')
C#:
string accessKey = Environment.GetEnvironmentVariable("DH_API_ACCESS_KEY");
string secretKey = Environment.GetEnvironmentVariable("DH_API_SECRET_KEY");
Node.js:
const accessKey = process.env.DH_API_ACCESS_KEY;
const secretKey = process.env.DH_API_SECRET_KEY;
Secure vaults (production)
For production, consider using secure credential management:
- AWS: AWS Secrets Manager, Parameter Store
- Azure: Azure Key Vault
- GCP: Google Secret Manager
- HashiCorp: Vault
- Docker: Docker Secrets
Example with AWS Secrets Manager (Python):
import boto3
import json
def get_dh_credentials():
client = boto3.client('secretsmanager', region_name='us-east-1')
response = client.get_secret_value(SecretId='dh-api-credentials')
secret = json.loads(response['SecretString'])
return {
'access_key': secret['access_key'],
'secret_key': secret['secret_key']
}
3. Never hardcode keys
❌ NEVER DO THIS:
# DON'T: Hardcoded keys
access_key = "hardcoded-access-key"
secret_key = "hardcoded-secret-key"
// DON'T: Hardcoded in code
string accessKey = "hardcoded-access-key";
string secretKey = "hardcoded-secret-key";
// DON'T: Hardcoded in config files committed to git
const config = {
accessKey: "hardcoded-access-key",
secretKey: "hardcoded-secret-key"
};
4. Never commit keys to version control
Add to .gitignore:
# Environment variables
.env
.env.local
.env.production
# Configuration files with secrets
config/credentials.yml
config/secrets.json
appsettings.*.json
# IDE files that might contain secrets
.vscode/launch.json
.idea/
5. Never log the SecretKey
❌ Bad:
logger.info(f"Calling API with access_key={access_key}, secret_key={secret_key}")
✅ Good:
logger.info(f"Calling API with access_key={access_key}, secret_key=***")
# Or better:
logger.info("Calling DH API (credentials masked)")
6. Rotate keys periodically
- ✅ Rotate keys every 90–180 days
- ✅ Use different keys for staging and production
- ✅ Rotate keys if an employee with access leaves
- ✅ Rotate keys if potential compromise is suspected
Process:
- Contact API Support at apisupport@rentalsunited.com to request a new key
- Store the new
SecretKeyimmediately; it is displayed only once - Update secure storage and deploy to every client instance
- Verify connectivity with the new key
- Ask API Support to revoke the old key
7. Restrict key access
- ✅ Only give keys to team members who need them
- ✅ Use different keys for different environments
- ✅ Document who has access
- ✅ Revoke access when no longer needed
8. Monitor for unauthorized access
Track authentication failures:
class AuthMonitor:
def __init__(self):
self.failed_attempts = 0
self.last_failure_time = None
def record_auth_failure(self):
self.failed_attempts += 1
self.last_failure_time = datetime.now()
# Alert on repeated failures
if self.failed_attempts >= 5:
alert_security_team(
"Multiple authentication failures detected",
count=self.failed_attempts
)
Testing authentication
Verify staging keys
curl -X POST https://api.dev.distribution-hub.com/api/Handler.asmx \
-H "Content-Type: application/xml" \
-d '<?xml version="1.0" encoding="UTF-8"?>
<Pull_ListLocations_RQ>
<Authentication>
<AccessKey>[AccessKey]</AccessKey>
<SecretKey>[SecretKey]</SecretKey>
</Authentication>
</Pull_ListLocations_RQ>'
Verify production keys
curl -X POST https://api.distribution-hub.com/api/Handler.asmx \
-H "Content-Type: application/xml" \
-d '<?xml version="1.0" encoding="UTF-8"?>
<Pull_ListLocations_RQ>
<Authentication>
<AccessKey>[AccessKey]</AccessKey>
<SecretKey>[SecretKey]</SecretKey>
</Authentication>
</Pull_ListLocations_RQ>'
Only test production keys after thorough testing in staging. Production API calls affect live data.
Credential management checklist
Before going live:
- Staging keys tested and working
- Production keys tested and working
- Keys stored in a secure vault (not environment variables for production)
- Keys never hardcoded in source code
- Keys never committed to version control
-
.gitignoreconfigured properly - Logging configured to mask the
SecretKey - Access to keys documented and restricted
- Key rotation policy defined (90–180 days)
- Monitoring for authentication failures implemented
- Emergency revocation process documented (contact API Support)
Troubleshooting
Problem: 401 Unauthorized
Possible causes:
- Wrong
AccessKeyorSecretKey, or a mismatched pair - Using staging keys against the production endpoint (or vice versa)
- Extra whitespace in keys
- Key revoked or rotated
- Account or key disabled
- Key missing the required API scope
Solutions:
- Verify keys with API Support
- Check you're using the correct environment endpoint
- Trim whitespace from keys
- Request a new key from API Support
- Contact API Support if the pair should still be valid
Problem: Keys working intermittently
Possible causes:
- Multiple key pairs deployed (old and new)
- Caching old keys
- Load balancer using old keys on some servers
Solutions:
- Ensure all instances use the same active key pair
- Clear credential cache
- Restart all application instances
Problem: Keys leaked
Immediate actions:
- ⚠️ Immediately contact API Support at apisupport@rentalsunited.com to revoke the keys
- Request emergency key rotation
- Investigate how the leak occurred
- Update all systems with the new keys
- Review and improve security practices
Next steps
Now that you understand authentication:
- Getting Started - Make your first API call
- Error Handling - Handle authentication errors
- Rate Limiting - Manage API limits
- Complete Integration Guide - Tie everything together
Contact API Support at apisupport@rentalsunited.com for key issues, rotation, or security questions.