Skip to main content
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.

Fields

Example Event


Send via API

The recommended method for real-time event ingestion. POST /events always takes an events array — a single event is an array of one.

Single Event

Batch Events

Send multiple events in a single request (recommended for high volume). A request accepts up to 100 events:

cURL Example

Response

The response echoes the unique_id of every event that was accepted and every one that was not:

Send via CSV

Upload a CSV in the dashboard for batch ingestion or historical data.

CSV Format

Three columns are required — timestamp, account and event_name. Add one column per event property, each prefixed with prop_:

Upload via Dashboard

  1. Navigate to Events in the dashboard
  2. Click Upload via File
  3. Download the provided CSV template
  4. Add your events and export the file as CSV
  5. Upload the file
Uploaded files and their processing results are listed on the Uploaded tab of the Events page.

CSV Best Practices

  • Use the downloaded template so the required headers match exactly
  • Use RFC 3339 timestamps
  • Prefix every property column with prop_
  • Leave no blank cells — rows with empty values are rejected

Send via Data Sources

Connect an external data source and let Alguna pull billable events in on a schedule.

Customer Identification

Using the Alguna Customer ID

Using Aliases

Use your own customer identifiers by adding them as aliases on the customer:
Any alias then resolves to that customer:

Idempotency & Deduplication

Unique ID Requirements

The unique_id field is an idempotency key: an event that repeats a unique_id already ingested for the same customer, event name and timestamp is counted once, not twice. It is capped at 72 characters — hash longer natural keys before sending.

Timestamps

Requirements

  • Must be RFC 3339 (ISO 8601) format
  • Optional — omit it and Alguna stamps the event with the time it was received
  • Use the time the usage actually occurred: the timestamp decides which billing period the event falls into

Examples

Backdating Events

Ingest historical events in batches of up to 100:

Properties

Properties carry event data used for filtering and aggregation. properties is a flat key/value map of up to 50 keys.

Common Property Patterns

Property Types

Nesting is not supported. Flatten structured data into prefixed keys — request_method, response_bytes — so metric filters and aggregations can reach it.

Error Handling

The API returns errors as a status and a detail message. See the API overview for the full status-code list.
The SDK turns those into typed errors — ValidationError, AuthenticationError, NotFoundError, RateLimitError — all extending AlgunaError. See error handling in the SDK reference.

Partial Failures

A 200 response does not mean every event landed. Check the failed array — it lists the unique_id of each event that could not be ingested, so you can correct and resend just those.

Retry Strategy

Retries are safe: the same unique_id is deduplicated rather than double-counted.

High-Volume Ingestion

Batch Recommendations

A request carries at most 100 events, so scale by sending more requests rather than bigger ones. For backfills and continuous high-volume feeds, prefer a data source integration over the API.

Best Practices

Batch Events

Send events in batches of up to 100 for better performance.

Unique IDs

Generate truly unique IDs, under 72 characters, to prevent duplicates.

Accurate Timestamps

Use the actual event time, not ingestion time.

Rich Properties

Include the flat properties needed for filtering and aggregation.

Troubleshooting

Events Not Appearing

  1. Check event timestamp is within the billing period
  2. Verify account is a known customer ID or a configured alias
  3. Confirm event_name matches your metric
  4. Review the failed array in the API response

Usage Shows Zero

  1. Verify events are being sent successfully
  2. Check metric configuration and filters
  3. Confirm event properties match metric requirements

Duplicate Charges

  1. Ensure unique_id is truly unique per event
  2. Check for duplicate event sends in your code
  3. Review event logs for repeated ingestion

Next Steps

Define Metrics

Configure billable metrics.

Metrics Reference

Complete metrics configuration guide.