API Reference
API Keys
Overview
API keys authenticate requests to your collections. Each key can be configured with:
- Type - Live (production) or Test (development)
- Domain Whitelist - Restrict which domains can use the key
- Rate Limit - Maximum requests per minute
Key Types
Live Keys
Use live keys (pk_live_*) for production websites:
- Access production data
- Strict domain validation
- Usage tracked for billing
Test Keys
Use test keys (pk_test_*) for development:
- Access same data as live keys
- Relaxed domain validation (localhost allowed)
- Useful for local development
Creating API Keys
- Go to your Dashboard
- Navigate to API Keys
- Click Create API Key
- Configure:
- Name - Descriptive name (e.g., "Production Website")
- Type - Live or Test
- Allowed Domains - Comma-separated list
- Rate Limit - Requests per minute
Domain Whitelisting
Specify which domains can use each API key:
dbindly.com
www.dbindly.com
app.dbindly.com
Wildcard Patterns
You can use wildcards for subdomains:
*.dbindly.com
Development Domains
For test keys, these are automatically allowed:
localhost127.0.0.1*.local
Rate Limits
Configure how many requests each key can make per minute:
| Plan | Default Limit | Max Limit |
|---|---|---|
| Free | 100/min | 100/min |
| Pro | 1,000/min | 10,000/min |
| Enterprise | 10,000/min | 100,000/min |
Handling Rate Limits
When rate limited, the API returns:
{
"error": "Too Many Requests",
"message": "Rate limit exceeded. Try again in 60 seconds."
}
DBindly automatically retries with exponential backoff.
Security Best Practices
Keep Keys Secret
- Never commit API keys to version control
- Use environment variables in build tools
- Don't expose keys in client-side code (use DBindly instead)
Use Domain Restrictions
- Always specify allowed domains for live keys
- Use specific domains, not wildcards in production
Rotate Keys Regularly
- Create new keys periodically
- Delete old keys after transitioning
Monitor Usage
- Check the dashboard for unusual activity
- Set up alerts for rate limit warnings
Using API Keys
With DBindly
DBindly.init({
apiUrl: 'https://dbindly.com/api',
apiKey: 'pk_live_your_key'
});
Direct API Calls
curl -H "X-API-Key: pk_live_your_key" \
https://dbindly.com/api/public/data/your-data-id
In Environment Variables
# .env
DBINDLY_API_KEY=pk_live_your_key
Managing Keys
View All Keys
Go to Dashboard → API Keys to see all your keys with:
- Key name and type
- Masked key value
- Created date
- Last used date
- Request count
Copy Key
Click the copy button to copy the full key value. Keys are only shown in full once when created.
Delete Key
- Find the key in the list
- Click the delete button
- Confirm deletion
Deleted keys are immediately invalidated.
Troubleshooting
"Invalid API key"
- Check the key is copied correctly
- Verify the key hasn't been deleted
- Ensure you're using the right environment (live vs test)
"Domain not allowed"
- Add your domain to the key's whitelist
- Check for typos in domain names
- Remember to include both root and www versions
"Rate limit exceeded"
- Wait for the reset period
- Reduce request frequency
- Upgrade your plan for higher limits
- Enable caching in DBindly
Next Steps
- API Endpoints - Available endpoints
- Configuration - Configure caching and retries