# Export metrics

`GET /v1/organizations/{organizationId}/transaction-metrics/export`

> **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.

### Export metrics

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

Review transaction usage metrics for your Redox product in a CSV file. Or, you may use the CSV file to import metrics into your own app dashboard.

Metrics include counts of total transactions or transactions over time. You can modify the query by date range, duration (i.e., day or month), or a specific connection.

## Request parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `organizationId` | path | string | Yes | Identifies the Redox organization that you're operating in. |
| `productClassificationId` | query | string | No | 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. |
| `connectionId` | query | number | No | Contains the connection ID for filtering counts and over-time data to a specific connection. |

## Request example

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

## Responses

### 200

This endpoint returns a plain-text CSV file containing the requested metric data. The header row will be `Product,ConnectionId,ConnectionName,StartDateTime,EndDateTime,Count`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `(body)` | string | No |  |

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

```json
Product,ConnectionId,ConnectionName,StartDateTime,EndDateTime,Count
d222fc9e-039a-4486-8be4-cdebcc4c9a06,122,Redox Org,2023-01-01T00:00:00.000Z,2023-02-01T00:00:00.000Z,21457
```

### 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
    }
  }
}
```
