# Query order statistics per product This endpoint can be used to query order statistics grouped by product. Endpoint: POST /api/v3/vendor/contracts/{contractId}/orders/stats/query Version: 0.0.7224 Security: BasicAuth, BearerAuth ## Path parameters: - `contractId` (string, required) Unique identifier of the contract Example: "qbcxvb" ## Request fields (application/json): - `pagination` (object, required) Specifies the pagination details such as the start index and the number of records to fetch (limit). At maximum it's allowed to query 10,000 records. - `pagination.start` (integer, required) - `pagination.limit` (integer, required) - `range` (object, required) Defines the time range for which order statistics are queried. Note: The maximum time span between the start and end should not exceed 30 days. - `range.start` (string, required) The starting point of the time range, represented as a timestamp in ISO 8601 format (e.g., "2023-10-19T13:45:30Z") in UTC. - `range.end` (string, required) The ending point of the time range, represented as a timestamp in ISO 8601 format (e.g., "2023-10-19T14:45:30Z") in UTC. - `filter` (object) An optional parameter to further filter the data based on product criteria. - `filter.oneOf` (object, required) The 'oneOf' represents a product query. - `filter.oneOf.field` (string, required) Specifies the attribute to filter by. It accepts two values: - "customerProductId": Your unique identifier for the product. - "productId": Patagona's internal product id (must be a numerical integer). - `filter.oneOf.values` (array, required) An array of strings containing the ids of the products to be queried. ## Response 200 fields (application/json): - `data` (array, required) - `data.productId` (string, required) Pricemonitor's internal unique product identifier. - `data.itemId` (string, required) The unique identifier of the sold item, expected to align with the customerProductId. - `data.numberOfSoldItems` (integer, required) The total count of how often the product has been sold. ## Response 400 fields (application/json): - `errors` (array, required) List of errors that occurred during request processing Example: [{"code":"request.invalid","message":"The provided request data is invalid"},{"code":"resource.invalid","message":"The requested resource could not be found"}] - `errors.code` (string, required) Machine-readable error code for programmatic error handling. Typically follows a structured format like 'request.invalid' or 'resource.invalid'. Example: "request.invalid" - `errors.message` (string, required) Human-readable error message providing details about the issue Example: "The provided email address is not in a valid format"