Skip to main content
Limited Release
Metric management helps you monitor, update, and delete existing metrics. You can retrieve metric configurations and modify metric settings to track different usage patterns and adjust billing calculations as your business requirements change.

List metrics

Use a valid access token and make a GET call to the /v1/commerce/billing/metrics endpoint. Include the following query parameters:
ParameterAction
page
integer
Set the page number for paginated results. Default is 1.
per_page
integer
Set the number of items to return per page. Default is 10, maximum is 100.
curl -X GET 'https://api-m.sandbox.paypal.com/v1/commerce/billing/metrics?page=1&per_page=10' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <ACCESS-TOKEN>'
A successful call returns a 200 OK response with a paginated list of all configured metrics.

Update metric details

Use a valid access token and make a PUT call to the /v1/commerce/billing/metrics/{metric_code} endpoint with the modified request parameters such as name, description, aggregation type, aggregation field, and field filters. Path parameter: metric_code is the code you provided when you created the metric.
You cannot modify the metric code or type after creation. You can only update the name, description, aggregation type, aggregation field, and field filters.
For information on all parameters, see API reference.
curl -X PUT 'https://api-m.sandbox.paypal.com/v1/commerce/billing/metrics/api_requests' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <ACCESS-TOKEN>' \
-d '{
  "name": "Updated API Requests",
  "description": "Measures the total number of API requests made across all regions",
  "aggregation_type": "COUNT",
  "field_filters": [
    {
      "key": "region",
      "values": [
        "us-east-1",
        "us-west-1",
        "eu-west-1",
        "ap-southeast-1"
      ]
    }
  ]
}'
A successful call returns a 200 OK response with the updated metric information.

Delete metric

Use a valid access token and make a DELETE call to the /v1/commerce/billing/metrics/{metric_code} endpoint to permanently delete a metric. Path parameter: metric_code is the code you provided when you created the metric.
Deleting a metric is permanent and affects all pricing plans and subscriptions using this metric. Ensure you remove the metric from all plans before deletion to avoid billing disruptions.
curl -X DELETE 'https://api-m.sandbox.paypal.com/v1/commerce/billing/metrics/api_requests' \
-H 'Authorization: Bearer <ACCESS-TOKEN>'
A successful call returns a 204 No Content response.