Prerequisites
- A metered feature created in Flexprice
- Your API key from the Admin Dashboard
- The Event Name from your feature configuration
API Endpoints
Single Event
Bulk Events
Authentication
Include your API key in the request header:Event Payload Structure
Required Fields
Conditional Fields
Optional Fields
Single Event Examples
Basic Event (Count Aggregation)
If your feature uses Count aggregation, you only need the required fields:Event with Properties (Sum Aggregation)
If your feature uses Sum aggregation with fieldcredits:
Complete Event Example
cURL Examples
Single Event

Response

Bulk Events
Transmit multiple events in a single request for better performance:Language Examples
JavaScript (Node.js)
Python
Go
PHP
Data Types and Best Practices
Property Values
-
Numbers: Use for Sum, Max aggregations
-
Strings: Use for Unique Count, Latest aggregations
Timestamps
- Use ISO 8601 format in UTC
- Example:
"2025-08-22T07:05:49.441Z" - If omitted, server time is used
Event IDs
- Optional but recommended for traceability
- Should be unique within your system
- Helps with debugging and idempotency
Common Patterns
API Usage Tracking
Storage Usage
User Activity
Error Handling
HTTP Status Codes
- 202 Accepted: Event accepted for processing
- 400 Bad Request: Invalid payload or missing required fields
- 401 Unauthorized: Invalid or missing API key
- 429 Too Many Requests: Rate limit exceeded
Common Errors
Missing required fieldRate Limits
- Single events: 1000 requests per minute
- Bulk events: 100 requests per minute (up to 1000 events per request)
- Response: 429 status code when exceeded
Best Practices
1. Validate Your Configuration
Before transmitting production events:- Verify Event Name matches your feature exactly
- Confirm Aggregation Field exists in your events
- Test with a small number of events first
2. Handle Failures Gracefully
3. Use Bulk Events for High Volume
When transmitting many events, use the bulk endpoint:4. Include Relevant Metadata
Add useful properties to your events for debugging:Related Documentation
- API Reference — Complete API documentation
- Validating Events — Check that events are being processed correctly
- Troubleshooting — Fix common issues
Next Steps
After sending events, you should:- Validate Events - Verify that events are being processed correctly
- Connect to Billing - Set up pricing and subscriptions
Troubleshooting
”Event not found” error
- Check that Event Name matches your feature exactly
- Verify the feature exists and is active
”Customer not found” error
- Ensure the customer exists in Flexprice
- Check that
external_customer_idmatches exactly
”Missing required field” error
- Verify all required fields are present
- Check field names match exactly (case-sensitive)
Events not appearing in dashboard
- Check the Event Debugger for processing status
- Verify Event Name and Aggregation Field configuration
- Ensure customer has an active subscription with the feature

