Skip to main content
GET
/
usage
Get usage statistics
curl --request GET \
  --url https://api.lavapayments.com/v1/usage \
  --header 'Authorization: Bearer <token>'
{
  "items": [
    {
      "date": "2023-05-15",
      "start": "2023-05-15T00:00:00Z",
      "end": "2023-05-15T23:59:59Z",
      "total_requests": 100,
      "total_usage_tokens": 45823,
      "total_usage_cost": "2.5741000000",
      "total_fee_amount": "0.2574100000",
      "total_service_charge_amount": "0.2574100000",
      "total_request_cost": "2.8315100000",
      "total_wallet_cost": "2.8315100000",
      "total_merchant_cost": "0.0000000000"
    }
  ],
  "totals": {
    "total_requests": 1000,
    "total_usage_tokens": 458230,
    "total_usage_cost": "25.7410000000",
    "total_fee_amount": "2.5741000000",
    "total_service_charge_amount": "2.5741000000",
    "total_request_cost": "28.3151000000",
    "total_wallet_cost": "28.3151000000",
    "total_merchant_cost": "0.0000000000"
  }
}

Authorizations

Authorization
string
header
required

Bearer token authentication used for standard API calls. Format: 'Bearer YOUR_API_KEY'

Query Parameters

start
string<date>
required

Start of the usage period (inclusive) in ISO 8601 format, this also sets the timezone of the grouped usage data

end
string<date>

End of the usage period (inclusive) in ISO 8601 format, if not specified, usage data will be returned up to the current time

connection_id
string

Filter usage by connection ID

product_id
string

Filter usage by product ID

metadata_filters
string

Filter usage by metadata key-value pairs. Must be a JSON array of [key, value] pairs, where both key and value are strings. Keys must contain only ASCII letters, numbers, and underscores (no spaces or special characters). Example: [['user_id', '123'], ['session_id', 'abc']]

Response

Usage statistics

items
object[]
required
totals
object
required