Skip to main content

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>
info

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:

EnvironmentPurposeCredentials
StagingDevelopment & testingStaging AccessKey / SecretKey
ProductionLive operationsProduction AccessKey / SecretKey

Managing keys​

To create, rotate, list, or revoke API keys, contact API Support at apisupport@rentalsunited.com.

RU vs Guesty

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 AccessKey and SecretKey belong 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​

# 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:

  1. Contact API Support at apisupport@rentalsunited.com to request a new key
  2. Store the new SecretKey immediately; it is displayed only once
  3. Update secure storage and deploy to every client instance
  4. Verify connectivity with the new key
  5. 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>'
Test carefully

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
  • .gitignore configured 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:

  1. Wrong AccessKey or SecretKey, or a mismatched pair
  2. Using staging keys against the production endpoint (or vice versa)
  3. Extra whitespace in keys
  4. Key revoked or rotated
  5. Account or key disabled
  6. Key missing the required API scope

Solutions:

  1. Verify keys with API Support
  2. Check you're using the correct environment endpoint
  3. Trim whitespace from keys
  4. Request a new key from API Support
  5. Contact API Support if the pair should still be valid

Problem: Keys working intermittently​

Possible causes:

  1. Multiple key pairs deployed (old and new)
  2. Caching old keys
  3. Load balancer using old keys on some servers

Solutions:

  1. Ensure all instances use the same active key pair
  2. Clear credential cache
  3. Restart all application instances

Problem: Keys leaked​

Immediate actions:

  1. ⚠️ Immediately contact API Support at apisupport@rentalsunited.com to revoke the keys
  2. Request emergency key rotation
  3. Investigate how the leak occurred
  4. Update all systems with the new keys
  5. Review and improve security practices

Next steps​

Now that you understand authentication:


Questions about API keys?

Contact API Support at apisupport@rentalsunited.com for key issues, rotation, or security questions.