Send Usage Events
Send usage events to Alguna to power usage-based billing. Events are aggregated according to your billable metrics and automatically appear on customer invoices.Event Structure
Events are the basic unit of billable usage. Each event represents a single action a customer may be billed for.Required Fields
| Field | Type | Description |
|---|---|---|
uniqueId | string | Unique identifier for deduplication |
eventName | string | Event type (matches your metric) |
accountId | string | Customer ID or alias |
timestamp | ISO 8601 | When the event occurred |
properties | object | Event data for filtering/aggregation |
Example Event
Send via API
The recommended method for real-time event ingestion.Single Event
Batch Events
Send multiple events in a single request (recommended for high volume):cURL Example
Response
Send via CSV
Upload CSV files for batch ingestion or historical data.CSV Format
Upload via Dashboard
- Navigate to Usage Metering in the dashboard
- Click Upload CSV
- Select your CSV file
- Map columns to fields
- Click Upload
Upload via API
CSV Best Practices
- Maximum file size: 100MB
- Maximum rows per file: 1,000,000
- Use ISO 8601 timestamps
- JSON-encode properties column
- Include header row
Send via Data Sources
Connect external data sources for automated ingestion.BigQuery Integration
Supported Data Sources
| Source | Description |
|---|---|
| BigQuery | Google BigQuery tables |
| Snowflake | Snowflake data warehouse |
| PostgreSQL | Direct database connection |
| S3 | AWS S3 buckets (CSV/JSON) |
| Segment | Segment events |
| Webhooks | Incoming webhooks |
Customer Identification
Using Alguna Account ID
Using External ID (Alias)
Use your own customer identifiers:Using Multiple Aliases
Idempotency & Deduplication
Unique ID Requirements
TheuniqueId field prevents duplicate processing:
Deduplication Window
Events with the sameuniqueId are deduplicated within a 7-day window.
Upsert Mode
Update existing events by using the sameuniqueId:
Timestamps
Requirements
- Must be ISO 8601 format
- Must be within the current or previous billing period
- Future timestamps are rejected
Examples
Backdating Events
Ingest historical events (within billing period):Properties
Properties carry event data used for filtering and aggregation.Common Property Patterns
Property Types
| Type | Example | Use Case |
|---|---|---|
| String | "us-east-1" | Filtering, grouping |
| Number | 1024 | Aggregation (sum, max) |
| Boolean | true | Filtering |
Nested Properties
Error Handling
Validation Errors
Common Errors
| Error | Cause | Solution |
|---|---|---|
INVALID_TIMESTAMP | Wrong format or future date | Use ISO 8601, current/past dates |
ACCOUNT_NOT_FOUND | Unknown accountId | Create account or check alias |
DUPLICATE_EVENT | Same uniqueId processed | Use unique IDs per event |
INVALID_PROPERTIES | Non-JSON properties | Ensure valid JSON structure |
Retry Strategy
High-Volume Ingestion
Batch Recommendations
| Volume | Batch Size | Frequency |
|---|---|---|
| < 1,000/min | 1-100 | Real-time |
| 1,000-10,000/min | 100-500 | Every 1-5 seconds |
| > 10,000/min | 500-1,000 | Continuous batching |
Async Ingestion
For very high volume, use async mode:Rate Limits
| Tier | Requests/sec | Events/request |
|---|---|---|
| Standard | 100 | 1,000 |
| Enterprise | 500 | 10,000 |
Query Usage
Current Period Usage
Usage History
Usage by Property
Webhooks
| Event | Description |
|---|---|
usage.recorded | Event processed (opt-in) |
usage.threshold_exceeded | Usage exceeded threshold |
Threshold Alerts
Best Practices
Batch Events
Send events in batches for better performance.
Unique IDs
Generate truly unique IDs to prevent duplicates.
Accurate Timestamps
Use the actual event time, not ingestion time.
Rich Properties
Include properties needed for filtering and aggregation.
Troubleshooting
Events Not Appearing
- Check event timestamp is within billing period
- Verify accountId exists or alias is configured
- Confirm eventName matches your metric
- Review API response for errors
Usage Shows Zero
- Verify events are being sent successfully
- Check metric configuration and filters
- Confirm event properties match metric requirements
Duplicate Charges
- Ensure uniqueId is truly unique per event
- Check for duplicate event sends in your code
- Review event logs for repeated ingestion