API Integration Guide
This guide covers integrating Pullbay's data APIs into backend applications and services. Learn authentication, error handling, rate limiting, and how to build robust integrations across Python, Node.js, PHP, and Ruby.
Architecture: Server-Side Integration Only
Why Server-Side Only?
API keys are secrets. Exposing them in client-side JavaScript, mobile apps, or public repositories allows attackers to:
Consume your API quota and credits
Impersonate your application
Access your data
Cause financial damage through runaway API usage
Where to Store Your API Key
Do:
Environment variables in your backend application
Secrets manager (AWS Secrets Manager, HashiCorp Vault, Google Secret Manager)
Encrypted configuration files (accessed only by your backend)
Secure CI/CD pipeline secrets
Don't:
Hardcoded in source files
Client-side JavaScript
Mobile app code
Public repositories (GitHub, GitLab, etc.)
Unencrypted configuration files
Client-Side Access: Build a Backend Proxy
If your frontend needs to fetch Pullbay data, never call Pullbay directly from the browser. Instead, build a backend API endpoint that acts as a proxy:
Proxy Pattern
Benefits:
API key never leaves your backend
Control who can access review data
Add authentication/authorization
Rate limit per user
Cache responses to reduce credits
Example Backend Proxy (Node.js):
Response Envelope
All Pullbay responses follow the same envelope. Understanding this structure is essential before implementing any client:
requestId
Unique request identifier — log this for every call. Also returned as the X-Request-Id header.
status
HTTP status code mirrored in the body
success
true on success, false on error
data
Array of result objects
pagination
Present on paginated endpoints; fields are null when not applicable
pricing.creditsCharged
Credits consumed by this request
Error responses:
Centralized PullbayClient Class
Create a centralized client class for all Pullbay API calls. This ensures consistent authentication, error handling, and credit tracking across your application.
Python Example
Implementation Checklist
Before deploying your integration, ensure you've implemented:
Language-Specific Examples
Testing and Mocking
Mocking Responses in Unit Tests
Never make real API calls in unit tests. Mock the Pullbay response envelope instead.
Python mock example:
Security Considerations
Environment Variables vs Secrets Manager
For development — use .env files:
For production — use a secrets manager:
API Key Rotation
Generate a new API key in the Pullbay dashboard
Update your secrets manager with the new key
Redeploy or reload configuration
Verify the new key works
Deactivate the old key
Frequently Asked Questions
Last updated