> This page is for Developers.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://zuora.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://zuora.ferndocs.com/_mcp/server.

# List the customer group metrics

GET https://payment-retry.apps.zuora.com/api/v1/metrics/customer_group

Gets the following metrics for each customer group that is in the active status:
  - Document Success Rate and trend
  - Retry Success Rate
  - Average Attempts


Reference: https://zuora.ferndocs.com/developers/api-reference/zuora-api/payments/configurable-payment-retry/get-customer-group-metrics

## Authentication

- `Authorization` header (basic auth, required) — The user name is the email address that you use for logging in Zuora. The password is the API token that is shown in the settings of Configurable Payment Retry.

## Response

### 200

- `customer_groups` (list of GetCustomerGroupMetricsResponseCustomerGroupsItems, optional) — An array containing the following information for each customer group. - Customer group ID - Customer group name - Whether Smart Retry is enabled for this customer group - Document Success Rate indicating the percentage of billing documents that are successfully collected - The trend of change in Document Success Rate over the last 30 days - Retry Success Rate indicating the percentage of the successful payment attempts - Average Attempts indicating the average number of attempts required to recover funds
- `success` (boolean, optional) — Indicates whether the metrics are retrieved successfully. If no data is loaded yet, a 200 response code will be returned with the success field set to `true`. All expected fields will be present but the value will be `null`.

## Types

### GetCustomerGroupMetricsResponseCustomerGroupsItems

## Examples

**Response**

```json
{
  "customer_groups": [
    {
      "average_attempts": "4.11",
      "document_success_rate": "17.17",
      "document_success_rate_trend": "up",
      "id": 1,
      "name": "batch22",
      "retry_success_rate": "21.76",
      "smart_retry": false
    },
    {
      "average_attempts": "1.32",
      "document_success_rate": "74.17",
      "document_success_rate_trend": "down",
      "id": 2,
      "name": "Smart Retry",
      "retry_success_rate": "81.21",
      "smart_retry": true
    },
    {
      "average_attempts": "3.32",
      "document_success_rate": "16.35",
      "document_success_rate_trend": "up",
      "id": 4,
      "name": "All Remaining Customers",
      "retry_success_rate": "15.21",
      "smart_retry": false
    }
  ],
  "success": true
}
```

**SDK Code**

```python
import requests

url = "https://payment-retry.apps.zuora.com/api/v1/metrics/customer_group"

response = requests.get(url, auth=("<username>", "<password>"))

print(response.json())
```

```javascript
const url = 'https://payment-retry.apps.zuora.com/api/v1/metrics/customer_group';
const credentials = btoa("<username>:<password>");

const options = {method: 'GET', headers: {Authorization: `Basic ${credentials}`}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://payment-retry.apps.zuora.com/api/v1/metrics/customer_group"

	req, _ := http.NewRequest("GET", url, nil)

	req.SetBasicAuth("<username>", "<password>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://payment-retry.apps.zuora.com/api/v1/metrics/customer_group")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request.basic_auth("<username>", "<password>")

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://payment-retry.apps.zuora.com/api/v1/metrics/customer_group")
  .basicAuth("<username>", "<password>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://payment-retry.apps.zuora.com/api/v1/metrics/customer_group', [
  'headers' => [
  ],
    'auth' => ['<username>', '<password>'],
]);

echo $response->getBody();
```

```csharp
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://payment-retry.apps.zuora.com/api/v1/metrics/customer_group");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.GET);

IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let credentials = Data("<username>:<password>".utf8).base64EncodedString()

let headers = ["Authorization": "Basic \(credentials)"]

let request = NSMutableURLRequest(url: NSURL(string: "https://payment-retry.apps.zuora.com/api/v1/metrics/customer_group")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```