Skip to content

Usage Metering

Report customer consumption to cloud marketplaces for accurate billing.


Overview

Usage metering allows you to report customer consumption data to AWS and Azure marketplaces. This is essential for products with usage-based pricing models where customers are charged based on actual consumption rather than flat subscription fees.

Automatum provides a unified API for reporting usage to both AWS Marketplace and Azure Marketplace, with built-in validation, queuing, and retry mechanisms.


How It Works

┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│  Your           │     │   Automatum     │     │   Marketplace   │
│  Application    │────▶│   Metering      │────▶│   (AWS/Azure)   │
│                 │     │   Service       │     │                 │
└─────────────────┘     └─────────────────┘     └─────────────────┘
        │                       │                       │
        │   Report Usage        │   Validate &          │   Confirm
        │   via API             │   Queue               │   Receipt
        └───────────────────────┴───────────────────────┘
  1. Your application tracks customer usage
  2. Usage is reported to Automatum via API
  3. Automatum validates the data
  4. Usage is queued and sent to the marketplace
  5. Marketplace confirms receipt
  6. Status updates in your dashboard

Supported Marketplaces

AWS Marketplace

Supported Product Types:

  • SaaS with usage-based pricing
  • SaaS contracts with consumption
  • AMI with metered pricing

Metering Method: AWS Marketplace Metering Service API

Timing Requirements:

  • Must report within 1 hour of usage
  • Maximum 25 records per batch request
  • Timestamp must be in UTC

Azure Marketplace

Supported Product Types:

  • SaaS offers with custom meters
  • Managed applications with metering

Metering Method: Azure Marketplace Metering Service API

Timing Requirements:

  • Must report within 24 hours of usage
  • One record per dimension per hour
  • effectiveStartTime must be in UTC

Setting Up Metering

Prerequisites

Before you can report usage:

  1. Product configured for metering - Your marketplace listing must have metered dimensions defined
  2. Active customer subscription - Customer must have an active entitlement
  3. Cloud account connected - AWS or Azure account connected to Automatum
  4. Dimensions synced - Product dimensions imported to Automatum

Step 1: Define Dimensions in Marketplace

AWS Marketplace:

When creating your product listing, define dimensions:

json
{
  "Dimensions": [
    {
      "Name": "Users",
      "Description": "Number of active users",
      "Key": "users",
      "Unit": "Units",
      "Types": ["Entitled"]
    },
    {
      "Name": "API Calls",
      "Description": "Number of API requests",
      "Key": "api_calls",
      "Unit": "Units",
      "Types": ["ExternallyMetered"]
    },
    {
      "Name": "Storage",
      "Description": "GB of storage used",
      "Key": "storage_gb",
      "Unit": "Units",
      "Types": ["ExternallyMetered"]
    }
  ]
}

Azure Marketplace:

Define custom meters in Partner Center:

json
{
  "planId": "premium",
  "billingDimensions": [
    {
      "id": "users",
      "displayName": "Active Users",
      "unitOfMeasure": "Users",
      "pricePerUnit": 10.00
    },
    {
      "id": "api_calls",
      "displayName": "API Calls",
      "unitOfMeasure": "1000 Calls",
      "pricePerUnit": 0.50
    },
    {
      "id": "storage_gb",
      "displayName": "Storage",
      "unitOfMeasure": "GB",
      "pricePerUnit": 0.10
    }
  ]
}

Step 2: Sync Product to Automatum

  1. Navigate to Listings
  2. Click Sync from AWS or Sync from Azure
  3. Select your metered product
  4. Verify dimensions are imported correctly

Step 3: Verify Customer Entitlement

Before reporting usage, ensure the customer has an active subscription:

bash
GET https://api.automatum.io/api/v1/entitlements?customer=cust_123
Authorization: Bearer YOUR_ACCESS_TOKEN

Response:

json
{
  "code": 200,
  "data": [
    {
      "id": "ent_456",
      "customerId": "cust_123",
      "listingId": "listing_789",
      "details": {
        "subscriptionStatus": "subscribed",
        "entries": [
          {
            "name": "api_calls",
            "units": 1,
            "price": ""
          }
        ]
      },
      "vendor": "aws"
    }
  ]
}

Reporting Usage

Via API

AWS Marketplace Usage:

bash
POST https://api.automatum.io/api/v1/metering
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

{
  "vendor": "aws",
  "listingId": "listing_789",
  "details": {
    "customer": {
      "id": "cust_123"
    },
    "reportingDate": "2026-01-16",
    "charged": 150.00,
    "usages": [
      {
        "apiKey": "api_calls",
        "units": 15000,
        "title": "API Calls",
        "description": "Number of API requests",
        "per": "request",
        "price": "0.01"
      }
    ]
  }
}

Azure Marketplace Usage:

bash
POST https://api.automatum.io/api/v1/metering
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

{
  "vendor": "azure",
  "listingId": "listing_789",
  "details": {
    "customer": {
      "id": "cust_123"
    },
    "reportingDate": "2026-01-16",
    "charged": 15.50,
    "usages": [
      {
        "apiKey": "api_calls",
        "units": 15.5,
        "title": "API Calls",
        "description": "Number of API requests",
        "per": "1000 calls",
        "price": "1.00",
        "planId": "premium"
      }
    ]
  }
}

Response:

json
{
  "code": 201,
  "data": {
    "id": "meter_abc123",
    "status": {
      "type": "pending",
      "message": "Metering data submitted successfully"
    }
  }
}

Via Dashboard

For manual or one-off usage reporting:

  1. Navigate to Metering
  2. Fill in the form:
    • Select customer
    • Select product
    • Choose dimension
    • Enter quantity
  3. Click Submit

Metering Event Schema

Required Fields

FieldTypeDescription
vendorstringaws or azure
listingIdstringAutomatum listing ID
details.customer.idstringAutomatum customer ID (required)
details.reportingDatestringDate in YYYY-MM-DD format
details.chargednumberTotal amount charged (can be 0)
details.usagesarrayArray of usage objects (required)

Usage Object Fields

FieldTypeDescription
apiKeystringDimension/API key identifier (required)
unitsnumberUsage quantity (required)
titlestringDisplay title for the usage
descriptionstringDescription of the usage
perstringUnit of measure (e.g., "request", "GB")
pricestringPrice per unit
planIdstringPlan identifier (Azure only, optional)

Example Request Body

json
{
  "vendor": "aws",
  "listingId": "listing_789",
  "details": {
    "customer": {
      "id": "cust_123"
    },
    "reportingDate": "2026-01-16",
    "charged": 150.00,
    "usages": [
      {
        "apiKey": "api_calls",
        "units": 15000,
        "title": "API Calls",
        "description": "Number of API requests",
        "per": "request",
        "price": "0.01"
      },
      {
        "apiKey": "storage_gb",
        "units": 250,
        "title": "Storage",
        "description": "GB of storage used",
        "per": "GB",
        "price": "0.10"
      }
    ]
  }
}

Validation Rules

Automatum validates all metering events before submission:

Quantity Validation

  • Must be a positive number
  • AWS: Must be integer (whole numbers only)
  • Azure: Can be decimal (up to 5 decimal places)
  • Cannot exceed reasonable limits

Timestamp Validation

  • Must be valid ISO 8601 format
  • Must be in UTC timezone
  • Cannot be in the future
  • AWS: Must be within last 1 hour
  • Azure: Must be within last 24 hours

Dimension Validation

  • Dimension must exist in product
  • Dimension must be configured for metering
  • Customer must be entitled to dimension

Customer Validation

  • Customer must exist in Automatum
  • Customer must have active entitlement
  • Entitlement must not be expired

Metering Status

Track the status of your metering events:

StatusDescriptionAction Required
pendingQueued for submissionNone - processing
submittedSent to marketplaceNone - awaiting confirmation
confirmedAccepted by marketplaceNone - success
failedRejected by marketplaceReview error and retry
duplicateAlready reportedNone - informational

View Status

Via Dashboard:

  1. Navigate to Metering
  2. View all events with status indicators
  3. Filter by status using the dropdown
  4. Click on any event for details

Error Handling

Common Errors

INVALID_DIMENSION

json
{
  "error": {
    "code": "INVALID_DIMENSION",
    "message": "Dimension 'invalid_key' not found in product listing"
  }
}

Solution: Verify dimension key matches exactly what's in your product configuration.

NO_ENTITLEMENT

json
{
  "error": {
    "code": "NO_ENTITLEMENT",
    "message": "Customer does not have active entitlement for this product"
  }
}

Solution: Verify customer has purchased and has an active subscription.

TIMESTAMP_OUT_OF_RANGE

json
{
  "error": {
    "code": "TIMESTAMP_OUT_OF_RANGE",
    "message": "Timestamp must be within last 1 hour for AWS"
  }
}

Solution: Report usage within the allowed time window.

DUPLICATE_RECORD

json
{
  "error": {
    "code": "DUPLICATE_RECORD",
    "message": "Usage already reported for this customer/dimension/timestamp"
  }
}

Solution: This is informational - the usage was already recorded.

QUANTITY_INVALID

json
{
  "error": {
    "code": "QUANTITY_INVALID",
    "message": "Quantity must be a positive integer for AWS"
  }
}

Solution: Ensure quantity is a positive whole number (for AWS).

Retry Logic

Automatum automatically retries failed submissions:

AttemptDelayNotes
1ImmediateFirst attempt
21 minuteAfter first failure
35 minutesExponential backoff
430 minutesContinued backoff
52 hoursFinal automatic retry

After 5 failures:

  • Event marked as permanently failed
  • Alert sent to organization admins
  • Manual retry available in dashboard

Manual Retry

To retry a failed event:

  1. Go to Metering
  2. Filter by status: failed
  3. Click on the failed event
  4. Review error details
  5. Click Retry

::: note API Limitation The OAuth API currently only supports creating metering events. To view status, retry failed events, or manage metering events, use the Automatum dashboard. :::


Best Practices

1. Report Frequently

Don't wait until the end of the billing period:

  • Report at least hourly
  • More frequent = more accurate billing
  • Reduces risk of missing reporting windows

2. Use Idempotency Keys

Prevent duplicate submissions:

bash
POST https://api.automatum.io/api/v1/metering
Authorization: Bearer YOUR_ACCESS_TOKEN
Idempotency-Key: cust_123-api_calls-2026-01-16T10:00:00Z
Content-Type: application/json

{
  "vendor": "aws",
  "listingId": "listing_789",
  "details": {
    "customer": {
      "id": "cust_123"
    },
    "reportingDate": "2026-01-16",
    "charged": 150.00,
    "usages": [
      {
        "apiKey": "api_calls",
        "units": 15000,
        "title": "API Calls",
        "description": "Number of API requests",
        "per": "request",
        "price": "0.01"
      }
    ]
  }
}

3. Implement Queuing

Buffer usage locally before reporting:

javascript
const usageQueue = [];

// Collect usage throughout the hour
function recordUsage(customerId, dimension, quantity) {
  usageQueue.push({ customerId, dimension, quantity, timestamp: new Date() });
}

// Report hourly
setInterval(async () => {
  for (const usage of usageQueue) {
    await reportToAutomatum(usage);
  }
  usageQueue.length = 0;
}, 3600000); // Every hour

4. Monitor for Failures

Set up alerts for metering failures:

  1. Go to Settings > Notifications
  2. Enable Metering Failure alerts
  3. Add recipients (technical team)
  4. Choose notification channels

5. Validate Before Sending

Check data before reporting:

javascript
function validateMeteringEvent(event) {
  if (event.quantity <= 0) {
    throw new Error('Quantity must be positive');
  }
  if (event.vendor === 'aws' && !Number.isInteger(event.quantity)) {
    throw new Error('AWS requires integer quantities');
  }
  if (new Date(event.timestamp) > new Date()) {
    throw new Error('Timestamp cannot be in the future');
  }
  return true;
}

6. Keep Audit Logs

Maintain records of all usage:

  • Log all metering events locally
  • Store submission responses
  • Track status changes
  • Retain for billing disputes


API Reference

Create Metering Event

Endpoint: POST https://api.automatum.io/api/v1/metering

Required Scope: write:metering

Request:

bash
POST https://api.automatum.io/api/v1/metering
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

{
  "vendor": "aws",
  "listingId": "listing_789",
  "details": {
    "customer": {
      "id": "cust_123"
    },
    "reportingDate": "2026-01-16",
    "charged": 150.00,
    "usages": [
      {
        "apiKey": "api_calls",
        "units": 15000,
        "title": "API Calls",
        "description": "Number of API requests",
        "per": "request",
        "price": "0.01"
      }
    ]
  }
}

Response:

json
{
  "code": 201,
  "data": {
    "id": "meter_abc123",
    "status": {
      "type": "pending",
      "message": "Metering data submitted successfully"
    }
  }
}

::: note Viewing Metering Events To view metering event status, history, or manage events, use the Automatum dashboard. The OAuth API currently only supports creating new metering events. :::


Troubleshooting

Usage Not Appearing in Marketplace

  1. Check metering event status in Automatum
  2. Verify customer has active entitlement
  3. Confirm dimension configuration matches
  4. Allow up to 24 hours for processing
  5. Check marketplace console directly

Incorrect Billing Amounts

  1. Verify quantity units match dimension configuration
  2. Check for duplicate submissions
  3. Review timestamp accuracy
  4. Compare with local usage logs

High Failure Rate

  1. Review error messages in failed events
  2. Verify API credentials are valid
  3. Check network connectivity
  4. Ensure customer entitlements are active
  5. Contact support if persistent

Next Steps


Need Help?

Contact support@automatum.io for metering assistance.

Automatum GTM Platform