# Get transaction metrics by Redox product

`GET /v1/organizations/{organizationId}/product-classifications/{productClassificationId}/transaction-metrics/connections`

Available as MCP tool `get-org-connection-metrics` (Read).

> **Deprecating soon**
>
> This endpoint will be deprecated soon. Talk to your Technical Account Manager about migrating or using new endpoints for this function. 

Transaction usage endpoints allow you to review and export transaction usage data for your current Redox contract. This allows you to easily monitor your usage and limits as you go.   

You can get details for all the Redox product(s) in your contract, retrieve metrics by product type, and export metrics.

### Get transaction metrics by Redox product

> **Deprecating soon**
>
> This endpoint will be deprecated soon. Talk to your Technical Account Manager about migrating or using new endpoints for this function. 

Retrieve transaction usage metrics for one of your organization's Redox products for a particular time range. Metrics include counts of total transactions or transactions over time.

You can modify the query by date range and duration (i.e., day or month). 

## Request parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `organizationId` | path | string | Yes | Identifies the Redox organization that you're operating in. |
| `productClassificationId` | path | string | Yes | Contains the UUID of the product classification that you want to retrieve transaction counts for. |
| `startDate` | query | string | Yes | Contains the date-time in ISO 8601 format to define the beginning of the date range for the transaction metrics you want to review. |
| `endDate` | query | string | Yes | Contains the date-time in ISO 8601 format to define the end of the date range for the transaction metrics you want to review. The end date-time is exclusive, which means results may be returned up to this date-time, but not including it. |
| `aggregateBy` | query | string | Yes | Defines the period of time for transaction counts over time, whether by day or month. |

## Request example

```bash
curl 'https://api.redoxengine.com/platform/v1/organizations/{organizationId}/product-classifications/{productClassificationId}/transaction-metrics/connections' \
--request GET \
--header 'Authorization: Bearer $API_TOKEN' \
--header 'accept: application/json'
```

## Responses

### 200

This endpoint returns a `payload` object containing the transaction count data for a given Redox product broken down by connection.

Contains the payload and metadata returned for `Get transaction metrics by Redox product`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `meta` | object | No |  |
| `meta.version` | string | No | Lists the major and minor version number for the format of the returned payload. The payload format or shape may change between minor versions, like including additional or extended fields in later versions. We include the version data in each response so that you have the option to handle the signaled differences. |
| `payload` | object | No |  |
| `payload.startDate` | string | No | Contains the date-time in ISO 8601 format to define the start of the date range for results. |
| `payload.endDate` | string | No | Contains the date-time in ISO 8601 format to define the end of the date range for results. The end date-time is exclusive, which means results may be returned up to this date-time, but not including it. |
| `payload.aggregateBy` | string | No | Defines the time window for grouping individual logs together, whether by day or month. Possible values: day, month |
| `payload.productClassificationId` | string | No | Displays the Redox product classification ID that the metrics pertain to. |
| `payload.aggregateMetrics` | object | No | Contains the properties for aggregate value metrics (e.g., total count). |
| `payload.aggregateMetrics.totalCount` | number | No | Lists the total count of logs occurring within the date range. |
| `payload.connectionStats` | Array of object | No | Contains all product connections and their associated log metrics. |
| `payload.connectionStats[].connectionId` | number | No | Displays the connection identifier for the contained metrics. |
| `payload.connectionStats[].name` | string | No | Displays the name of this connection. Usually this is typically your connection's organization name. |
| `payload.connectionStats[].aggregateMetrics` | object | No | Contains the properties for aggregate value metrics (e.g., total count). |
| `payload.connectionStats[].aggregateMetrics.totalCount` | number | No | Lists the total count of logs occurring within the date range. |
| `payload.connectionStats[].dataPoints` | Array of object | No | Contains the over-time data points within the specified time range for this connection. |
| `payload.connectionStats[].dataPoints[].startDateTime` | string | No | Contains the date-time in ISO 8601 format to define the start of the date range for this data point. |
| `payload.connectionStats[].dataPoints[].endDateTime` | string | No | Contains the date-time in ISO 8601 format to define the end of the date range for this data point. The end date-time is exclusive, which means results may be returned up to this date-time, but not including it. |
| `payload.connectionStats[].dataPoints[].count` | number | No | Defines the total count of logs that occurred within the specified date range of this data point. |
| `payload.connectionStats[].dataPoints[].cumulativeSum` | number | No | Defines the total sum of logs that have occurred up to the end of this data point's date range, including all prior data points. |

_Generated from the schema: the values are placeholders, not a real payload._

```json
{
  "meta": {
    "version": "1.0.0"
  },
  "payload": {
    "startDate": "2023-01-01T00:00:00.000Z",
    "endDate": "2024-01-01T00:00:00.000Z",
    "aggregateBy": "day",
    "productClassificationId": "d222fc9e-039a-4486-8be4-cdebcc4c9a06",
    "aggregateMetrics": {
      "totalCount": 21478
    },
    "connectionStats": [
      {
        "connectionId": 122,
        "name": "Redox Org",
        "aggregateMetrics": {
          "totalCount": 21478
        },
        "dataPoints": [
          {
            "startDateTime": "2023-01-01T00:00:00.000Z",
            "endDateTime": "2023-02-01T00:00:00.000Z",
            "count": 9056,
            "cumulativeSum": 36803
          }
        ]
      }
    ]
  }
}
```

### 400

Bad Request

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `payload` | object | No | Contains the error message. |
| `payload.error` | object | No | Contains the error message details. |
| `payload.error.title` | string | No | Displays the high-level error message, typically something succinct like `Bad Request`. |
| `payload.error.code` | string | No | Contains an alternative ID for the error type, which can be used to find relevant troubleshooting information. |
| `payload.error.detail` | string | No | Contains the specific error details for this message. |
| `payload.error.status` | number | No | Displays the corresponding HTTP status code for the error. |
| `payload.error.transient` | boolean | No | Describes whether the error will resolve itself. If `true`, no further action needs to be taken. If `false`, you may need to troubleshoot on your end to resolve the issue before the error can be processed. |

```json
{
  "payload": {
    "error": {
      "title": "Bad Request",
      "code": "validation.error.bad.request",
      "detail": "Error details",
      "status": 400,
      "transient": false
    }
  }
}
```

### 500

Internal Server Error

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `payload` | object | No | Contains the error message. |
| `payload.error` | object | No | Contains the error message details. |
| `payload.error.title` | string | No | Displays the high-level error message, typically something succinct like `Failed in step X`. |
| `payload.error.code` | string | No | Contains an alternative ID for the error type, which can be used to find relevant troubleshooting information. |
| `payload.error.detail` | string | No | Contains the specific error details for this message. |
| `payload.error.status` | number | No | Displays the corresponding HTTP status code for the error. |
| `payload.error.transient` | boolean | No | Describes whether the error will resolve itself. If `true`, no further action needs to be taken. If `false`, you may need to troubleshoot on your end to resolve the issue before the error can be processed. |

```json
{
  "payload": {
    "error": {
      "title": "Internal Server Error",
      "code": "failed.db.lookup",
      "detail": "Error details",
      "status": 500,
      "transient": true
    }
  }
}
```
