Home
Pricing
ROI Calculator
Case Studies
Knowledge Base
Contact
Login
Menu
Home
Knowledge-base
Ai-agent
Best Practices
Best Practices
Home
Knowledge Base
SaaS AI Agent
Best Practices
1. API Key Management
Store keys in environment variables or secrets manager
Use separate keys for dev/staging/production
Rotate keys every 90 days
Never log full API keys (only last 4-8 characters)
Revoke compromised keys immediately
2. Request Optimization
Cache frequently requested company data
Batch requests when possible
Use streaming for long queries
Implement request deduplication
Add timeout handling (300s recommended)
3. Error Handling
Implement exponential backoff for retries
Log errors with context (user, company, timestamp)
Handle rate limits gracefully
Provide user-friendly error messages
Monitor error rates and alert on spikes
4. User Tracking
Always include
x-user-id
header
Use consistent user ID format
Include additional context in
x-user-name
if helpful
Never send PII in plain text (hash if needed)
5. Security
Use HTTPS only (never HTTP)
Validate all user inputs before sending
Sanitize company names and queries
Implement IP whitelisting when possible
Monitor for unusual usage patterns
6. Performance
Set appropriate timeout values (300s for complex queries)
Use connection pooling for multiple requests
Implement client-side caching
Monitor latency and optimize slow queries
Use streaming for better perceived performance
7. Testing
Test with sample companies (Salesforce, Slack, etc.)
Verify error handling for all status codes
Test rate limit behavior
Validate response parsing
Run load tests before production launch
8. Monitoring
Track request success/failure rates
Monitor quota usage daily
Set up alerts for error rate spikes
Log all API interactions
Review usage patterns regularly
Related articles
Getting Started
Integration Methods
Prerequisites & Security
Authentication & Authorization
OAuth 2.0 Authentication