Best Practices
Follow these guidelines to use the PageSight API effectively and securely.
Security
Security Checklist
✅ Store API keys in environment variables
✅ Use secrets managers in production
✅ Never commit API keys to version control
✅ Rotate API keys periodically
✅ Use different keys for different environments
Error Handling
URL Encoding
Rate Limit Handling
Implement retry logic with exponential backoff when rate limited.
Performance Tips
• Use caching to reduce API calls
• Request only needed categories
• Batch requests when possible
• Monitor your rate limit usage
• Use Pro plan for custom cache control
• Requesting all categories unnecessarily
• Not using cache for repeated requests
• Making requests in tight loops
• Ignoring rate limit headers
• Not handling errors gracefully
General Guidelines
Validate URLs before sending
Ensure URLs are valid HTTP/HTTPS
Check response headers
Monitor X-RateLimit-* headers
Use appropriate categories
Only request what you need
Implement retry logic
Handle transient errors gracefully
Don't expose API keys
Never commit keys to repositories
Don't ignore errors
Always handle API errors properly
Don't make excessive requests
Respect rate limits
Don't skip URL encoding
Always encode special characters
PageSight