- View usage for your compute metric broken down by
cluster_name
, where a user may have hundreds of clusters active in a given time period. - Understand how much a specific transaction contributed to a processing charge by point-filtering to a known
transaction_id
. - Provide more detailed analytics, such as breaking down usage and cost data by
bucket_name
anddata_tier
which is included in events you send to Orb. - Build an interactive explorer in your application to view hourly data over a day time range, rather than the default daily views available through Orb’s subscription usage and cost APIs.
- Provide a view into end customer usage by
api_key
prefix, allowing users to understand the source of API requests.
Evaluate Prices API
The evaluate prices API is Orb’s most powerful querying tool, enabling you to slice, dice, and rate event data with SQL-like flexibility. This endpoint allows you to evaluate prices on existing data with advanced filtering and grouping capabilities.Core Capabilities
The endpoint can evaluate:- Up to 100 price evaluations in a single request (existing or inline-defined prices)
- Historical data up to 100 days in the past (for ingested events)
- Complex filtering and grouping using computed properties with SQL-like expressions
- Results limited to 1000 rows to ensure performance
timeframe_start
(required): Inclusive lower bound for event timestampstimeframe_end
(required): Exclusive upper bound for event timestampscustomer_id
(optional): Required when querying ingested events, omit for preview eventsexternal_customer_id
(optional): Alternative to customer_idprice_evaluations
(required): Array of prices to evaluate with optional filtering and grouping
Key Use Cases
1. Customer-Facing Usage Analytics
Scenario: Provide your customers with detailed breakdowns of their usage and costs, going beyond standard invoice line items. Example: A cloud storage provider wants to show customers their costs broken down by storage tier, region, and time period.2. Invoice Line Item Auditing
Scenario: Provide detailed breakdowns of invoice charges to help customers understand exactly what they’re being billed for. Example: Breaking down a monthly API usage charge by endpoint and customer tier.3. High-Dimensional Usage Analysis
Scenario: Analyze usage patterns across multiple dimensions that aren’t part of your standard billing structure. Example: A data processing platform analyzing usage by job type, data source, and processing complexity.4. Transaction-Level Cost Attribution
Scenario: Understand the cost impact of specific transactions or operations. Example: Analyzing the cost contribution of individual database queries or API calls.Evaluate Preview Events API
The evaluate preview events API rates hypothetical events on existing prices in Orb allowing you to build price calculators and “what-if” scenarios off prices in Orb.Core Capabilities
The endpoint can evaluate:- Up to 100 price evaluations in a single request (existing or inline-defined prices)
- Up to 500 preview events in a single request
- Complex filtering and grouping using computed properties with SQL-like expressions
- Results limited to 1000 rows to ensure performance
timeframe_start
(required): Inclusive lower bound for event timestampstimeframe_end
(required): Exclusive upper bound for event timestampscustomer_id
(optional): Required when querying ingested events, omit for preview eventsevents
(required): Array of preview eventsexternal_customer_id
(optional): Alternative to customer_idprice_evaluations
(required): Array of prices to evaluate with optional filtering and grouping
Key Use Cases
1. Price Calculator and Modeling
Scenario: Build an interactive price calculator that shows potential costs before customers commit to a plan. Example: A compute platform wants to let prospects estimate costs based on expected usage patterns.Evaluate Prices API vs. Evaluate Preview Events API
Preview Events (Rating Mode)
Use preview events when you want to:- Build price calculators
- Model “what-if” scenarios
- Test new pricing structures
- Provide cost estimates before usage occurs
- Events are provided directly in the request
- No historical data required
- Perfect for forward-looking analysis
- Limited to 500 events per request
- No customer_id required - the API rates the provided events directly
Ingested Events (Query Mode)
Use ingested events when you want to:- Analyze historical usage patterns
- Provide detailed billing breakdowns
- Audit past charges
- Build usage analytics dashboards
- Uses events already stored in Orb
- Requires customer_id to specify which customer’s events to query
- Can query up to 100 days of historical data
- Supports complex filtering and aggregation
- Ideal for retrospective analysis
Advanced Filtering and Grouping
Computed Properties
The API supports computed properties for sophisticated data manipulation using Orb’s supported functions:Time-based Functions
Aggregation Functions
Filtering Examples
Basic Property Filtering
Advanced Filtering
Response Structure and Interpretation
The API returns results grouped according to your specifiedgrouping_keys
. The response contains a data
array where each element represents the results for a specific price, with the following structure:
- price_groups: Array of grouped results for this price
- grouping_values: The specific values for each grouping dimension
- quantity: The aggregated metric value for the group
- amount: The calculated cost for the group
- currency: The currency of the price
- price_id: The ID of the price (for existing prices)
- inline_price_index: The index of the inline price (for inline-defined prices)
Example Response
Multiple Prices Response
When evaluating multiple prices, you’ll get separate entries in thedata
array:
Best Practices
Performance Optimization
- Limit result sets: Use filters to reduce the number of rows returned
- Choose appropriate time ranges: Shorter ranges perform better
- Optimize grouping: Avoid excessive grouping dimensions
- Use specific filters: More specific filters improve query performance
Data Accuracy
- Validate preview events: Ensure preview events match your actual event schema
- Test with small datasets: Start with limited time ranges when exploring
- Verify metric definitions: Ensure your billable metrics align with expectations
- Handle edge cases: Consider how your filters handle null or missing properties
Integration Patterns
- Caching: Cache results for frequently accessed data
- Pagination: Use time-based pagination for large datasets
- Error handling: Implement robust error handling for API limits
- Rate limiting: Respect API rate limits in high-frequency scenarios