API Reference - Events Ingestion
Complete API documentation with examples and response codes.
Event Structure
Required Fields
Required Fields
Unique identifier. Use UUIDs or combine customer ID + timestamp + action.
Dodo Payments customer ID. Must be a valid existing customer.
Event type that matches your meter’s event name (case-sensitive). Examples:
api.call
, image.generated
Optional Fields
Optional Fields
Sending Events
Batch up to 100 events per request for better performance.
Ingestion Blueprints
Ready-made event patterns for common use cases. Start with a proven blueprint instead of building from scratch.LLM Blueprint
Track AI token usage across OpenAI, Anthropic, Groq, Gemini, and more.
API Gateway Blueprint
Meter API requests with endpoint filtering and rate limiting support.
Object Storage Blueprint
Track file uploads and storage consumption for cloud storage services.
Stream Blueprint
Measure streaming bandwidth for video, audio, and real-time data.
Time Range Blueprint
Bill by elapsed time for serverless functions and compute instances.
View All Blueprints
See all available blueprints with detailed implementation guides.
Best Practices
Use Unique Event IDs
Use Unique Event IDs
Use deterministic IDs to prevent duplicates:
${customerId}_${action}_${timestamp}
Implement Retries
Implement Retries
Retry on 5xx errors with exponential backoff. Don’t retry 4xx errors.
Include Timestamps
Include Timestamps
Omit for real-time events. Include for delayed/batch events for accuracy.
Monitor Delivery
Monitor Delivery
Track success rates and queue failed events for retry.
Troubleshooting
Events not appearing
Events not appearing
- Event name must exactly match meter (case-sensitive)
- Customer ID must exist
- Check meter filters aren’t excluding events
- Verify timestamps are recent
Authentication errors (401)
Authentication errors (401)
Verify API key is correct and use format:
Bearer YOUR_API_KEY
Validation errors (400)
Validation errors (400)
Ensure all required fields are present:
event_id
, customer_id
, event_name
Metadata not aggregating
Metadata not aggregating
- Metadata keys must match meter’s “Over Property” exactly
- Use numbers, not strings:
tokens: 150
nottokens: "150"
Next Steps
Create Meters
Define how your events are aggregated into billable quantities with filters and aggregation functions.
Ingestion Blueprints
Use ready-made blueprints for common use cases like LLM tracking, API gateways, and storage.
Complete Tutorial
Build a full AI image generator with usage-based billing from scratch.
API Reference
Complete API documentation with all parameters, response codes, and interactive testing.