Skip to main content
Learn how to use the Metrics API with detailed examples. This guide covers common patterns, step-by-step workflows, and code samples for tracking transaction volume, activity patterns, and user growth.
Prerequisite: Before diving into examples, make sure you’ve read the Metrics documentation to understand core concepts like metric templates, saved metrics, and breakdowns.

Quickstart

List available templates to see what you can measure:
curl -X GET "https://sandbox.hifibridge.com/v2/reporting/templates" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response:
{
  "status": "success",
  "data": [
    {
      "template": "GROSS_VOLUME",
      "displayName": "Gross Volume",
      "description": "Total combined USD-equivalent value of completed Onramp and Offramp transactions",
      "breakdownOptions": ["transactionType", "userId"]
    },
    {
      "template": "TRANSACTION_COUNT",
      "displayName": "Transaction Count",
      "description": "Aggregated count of transactions grouped by status and type over time",
      "breakdownOptions": ["transactionType", "transactionStatus", "userId"]
    },
    {
      "template": "NEW_USERS",
      "displayName": "New Users",
      "description": "Count of new unique end-users onboarded within the time period",
      "breakdownOptions": null
    }
  ]
}

Configuration Examples

Every metric requires a date range:
{
  "createdAfter": "2025-01-01",
  "createdBefore": "2025-01-31"
}
Dates use ISO 8601 format (YYYY-MM-DD). Available parameters vary by template—check the template response for supported params.

Common Patterns

Track daily volume split by transaction type (onramp vs offramp):
curl -X POST "https://sandbox.hifibridge.com/v2/reporting/metrics" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "template": "GROSS_VOLUME",
    "name": "Daily Volume Split",
    "params": {
      "createdAfter": "2025-01-01",
      "createdBefore": "2025-01-31",
      "calculationInterval": "day",
      "breakdowns": ["transactionType"]
    }
  }'
Returns separate volume numbers for onramps and offramps each day.

Managing Saved Metrics

List all your saved metrics:
curl -X GET "https://sandbox.hifibridge.com/v2/reporting/metrics" \
  -H "Authorization: Bearer YOUR_API_KEY"