---
title: "Contract Rate Statistics"
method: POST
path: "/v2/truckload/rates/contract/statistics"
tags: ["Truckload V2"]
---

# Contract Rate Statistics

`POST /v2/truckload/rates/contract/statistics`

This endpoint allows permissioned users to get statistical aggregations of SONAR KMA contract rates across specified time periods.

You can click on the Body Sample to the right to populate the example in the test body below.

For more information about getting access to this endpoint or using this endpoint, please reach out to our Customer Success team (cs@gosonar.com).

This endpoint handles the following input fields:

*   start\_date: the earliest date of the range over which the statistics are being calculated (YYYY-MM-DD), required
*   end\_date: the most recent date of the range over which the statistics are being calculated (YYYY-MM-DD), required
*   aggregation: the time period aggregation type - 'SUMMARY', 'WEEKLY', 'MONTHLY', 'QUARTERLY', 'YEARLY', or 'WTD' (week-to-date), required
*   lane\_id: a unique identifier set by the client and will be returned with the response; optional field, not required
*   origin: the 3 character KMA airport code, Zip3 or Zip5 for USA, Zip3 or Zip6 for CAN the origin, required
*   origin\_country\_code: country code for the origin; at this time only lanes within the contiguous US markets and Canada are available, must be 'USA' or 'CAN', required
*   destination: the 3 character KMA airport code, Zip3 or Zip5 for USA, Zip3 or Zip6 for CAN the origin, required
*   destination\_country\_code: country code for the destination; at this time only lanes within the contiguous US markets and Canada are available, must be 'USA' or 'CAN', required
*   equipment\_type: may be 'VAN' or 'REEFER' for USA, 'VAN' only for CAN, required
*   input\_miles: the specific lane miles the rates will be adjusted to; this field is optional but must not be negative and will be calculated if not provided, not required

Here are the output fields returned in a successful call:

*   lanes: a list object that contains lane-specific statistics
    *   lane\_id: the unique identifier sent in the corresponding call
    *   origin: the origin KMA code resolved from the origin input provided
    *   origin\_market: the 3-letter airport code for the origin
    *   origin\_country\_code: 'USA' or 'CAN'
    *   destination: the destination KMA code resolved from the destination input provided
    *   destination\_market: the 3-letter airport code for the destination
    *   destination\_country\_code: 'USA' or 'CAN'
    *   equipment\_type: the equipment\_type provided in the API call by the client
    *   miles: the miles provided by the user or calculated from the O/D pair
    *   mileage\_type: 'INPUT' if miles were provided, 'INTERNAL' if calculated
    *   period\_start\_date: the start date of the aggregation period
    *   period\_end\_date: the end date of the aggregation period
    *   data\_timestamp: the timestamp when the statistics were generated
    *   aggregation: the aggregation type used for this period
    *   lowest\_rpm: the lowest (minimum) RPM value in the period
    *   highest\_rpm: the highest (maximum) RPM value in the period
    *   avg\_rpm: the average RPM value in the period
    *   avg\_rpm\_low: the average of minimum RPM values in the period
    *   avg\_rpm\_high: the average of maximum RPM values in the period
    *   std\_dev\_rpm: the standard deviation of RPM values in the period
    *   lowest\_rate: the lowest (minimum) rate value in the period
    *   highest\_rate: the highest (maximum) rate value in the period
    *   avg\_rate: the average rate value in the period
    *   avg\_rate\_low: the average of minimum rate values in the period
    *   avg\_rate\_high: the average of maximum rate values in the period
    *   std\_dev\_rate: the standard deviation of rate values in the period
    *   avg\_confidence\_score: the average confidence score for rates in the period
    *   avg\_origin\_radius\_expansion: the average origin radius expansion used in rate calculations
    *   avg\_destination\_radius\_expansion: the average destination radius expansion used in rate calculations
    *   avg\_timeframe\_expansion: the average days back needed for rate calculations
    *   avg\_total\_load\_count: the average number of loads found per calculation
    *   avg\_total\_contributor\_count: the average number of data contributors per calculation
*   errors: a list object that contains information on lanes that are not valid for the statistics request
    *   lane\_id: the unique identifier sent in the corresponding call
    *   origin: the origin string provided in the request
    *   origin\_country\_code: 'USA' or 'CAN'
    *   destination: the destination string provided in the request
    *   destination\_country\_code: 'USA' or 'CAN'
    *   equipment\_type: the equipment\_type provided in the API call by the client
    *   input\_miles: the miles provided by the user in the request or calculated (if origin and destination inputs were valid)
    *   error\_found: A lane/date/equipment specific explanation of the issue with the lane information that caused an error

## Headers

- `x-api-version` string

## Request body

- ContractRateStatisticsJsonRequest
  - `start_date` string, date-time, required
  - `end_date` string, date-time, required
  - `aggregation` string, required
  - `lanes` TracStatisticsLaneJsonRequest[], required
    - `lane_id` string
    - `origin` string, required
    - `origin_country_code` string, required
    - `destination` string, required
    - `destination_country_code` string, required
    - `equipment_type` string, required
    - `input_miles` number, double

## Response `200`

OK

- ContractRateStatisticsJsonResponse
  - `lanes` ContractRateLaneStatistics[], required
    - `lane_id` string, required
    - `miles` number, double, required
    - `mileage_type` string, required
    - `origin` string, required
    - `origin_market` string, required
    - `origin_country_code` string, required
    - `destination` string, required
    - `destination_market` string, required
    - `destination_country_code` string, required
    - `equipment_type` string, required
    - `data_timestamp` string, date-time, required
    - `period_start_date` string, date-time, required
    - `period_end_date` string, date-time, required
    - `aggregation` string, required
    - `lowest_rpm` number, double, required
    - `highest_rpm` number, double, required
    - `std_dev_rpm` number, double, required
    - `lowest_rate` number, double, required
    - `highest_rate` number, double, required
    - `std_dev_rate` number, double, required
    - `avg_rpm` number, double, required
    - `avg_rpm_high` number, double, required
    - `avg_rpm_low` number, double, required
    - `avg_rate` number, double, required
    - `avg_rate_high` number, double, required
    - `avg_rate_low` number, double, required
    - `avg_confidence_score` number, double, required
    - `avg_origin_radius_expansion` number, double, required
    - `avg_destination_radius_expansion` number, double, required
    - `avg_timeframe_expansion` number, double, required
    - `avg_total_load_count` number, double, required
    - `avg_total_contributor_count` number, double, required
  - `errors` TracStatisticsJsonError[], required
    - `lane_id` string
    - `origin` string
    - `origin_country_code` string
    - `destination` string
    - `destination_country_code` string
    - `equipment_type` string
    - `input_miles` number, double
    - `error_found` string

---

[API](https://skmtc.net/freightwaves/apis/sonar-api.md) · [All operations](https://skmtc.net/freightwaves/apis/sonar-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/freightwaves/sonar-api/revisions/3a995f316cda/schema)
