Use Cases
Explore common scenarios supported by the API Gateway Blueprint:API-as-a-Service
Track usage per customer for API platforms and charge based on number of calls.
Rate Limiting
Monitor API usage patterns and implement usage-based rate limiting.
Performance Monitoring
Track response times and error rates alongside billing data.
Multi-Tenant SaaS
Bill customers based on their API consumption across different endpoints.
Ideal for tracking API endpoint usage, rate limiting, and implementing usage-based API billing.
Quick Start
Track API calls at the gateway level with automatic batching for high-volume scenarios:1
Install the SDK
2
Get Your API Keys
- Dodo Payments API Key: Get it from Dodo Payments Dashboard
3
Create a Meter
Create a meter in your Dodo Payments Dashboard:
- Event Name:
api_call
(or your preferred name) - Aggregation Type:
count
for tracking number of calls - Configure additional properties if tracking metadata like response times, status codes, etc.
4
Track API Calls
Configuration
Ingestion Configuration
Your Dodo Payments API key from the dashboard.
Environment mode:
test_mode
or live_mode
.Event name that matches your meter configuration.
Track API Call Options
The customer ID for billing attribution.
Optional metadata about the API call like endpoint, method, status code, response time, etc.
Batch Configuration
Maximum number of events before auto-flush. Default:
100
.Auto-flush interval in milliseconds. Default:
5000
(5 seconds).Best Practices
Use Batching for High Volume: For applications handling more than 10 requests per second, use
createBatch()
to reduce overhead and improve performance.Always Clean Up Batches: Call
batch.cleanup()
on application shutdown to flush pending events and prevent data loss.