openapi: 3.2.0 info: description: The Selling Partner API for Sales provides APIs related to sales performance. version: v1 title: Selling Partner Sales API contact: name: Selling Partner API Developer Support url: https://sellercentral.amazon.com/gp/mws/contactus.html license: name: Apache License 2.0 url: http://www.apache.org/licenses/LICENSE-2.0 servers: - url: https://sellingpartnerapi-na.amazon.com tags: - name: Sales paths: /sales/v1/orderMetrics: get: tags: - Sales description: 'Returns aggregated order metrics for given interval, broken down by granularity, for given buyer type. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | .5 | 15 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values than those shown here. For more information, see Usage Plans and Rate Limits in the Selling Partner API.' operationId: getOrderMetrics parameters: - name: marketplaceIds in: query description: 'A marketplace identifier. This specifies the marketplace in which the order was placed. Only one marketplace can be specified. For example, ATVPDKIKX0DER indicates the US marketplace.' required: true schema: type: array items: type: string - name: interval in: query description: 'A time interval used for selecting order metrics. This takes the form of two dates separated by two hyphens (first date is inclusive; second date is exclusive). Dates are in ISO8601 format and must represent absolute time (either Z notation or offset notation). Example: 2018-09-01T00:00:00-07:00--2018-09-04T00:00:00-07:00 requests order metrics for Sept 1st, 2nd and 3rd in the -07:00 zone.' required: true schema: type: string - name: granularityTimeZone in: query description: 'An IANA-compatible time zone for determining the day boundary. Required when specifying a granularity value greater than Hour. The granularityTimeZone value must align with the offset of the specified interval value. For example, if the interval value uses Z notation, then granularityTimeZone must be UTC. If the interval value uses an offset, then granularityTimeZone must be an IANA-compatible time zone that matches the offset. Example: US/Pacific to compute day boundaries, accounting for daylight time savings, for US/Pacific zone.' required: false schema: type: string - name: granularity in: query description: 'The granularity of the grouping of order metrics, based on a unit of time. Specifying granularity=Hour results in a successful request only if the interval specified is less than or equal to 30 days from now. For all other granularities, the interval specified must be less or equal to 2 years from now. Specifying granularity=Total results in order metrics that are aggregated over the entire interval that you specify. If the interval start and end date don’t align with the specified granularity, the head and tail end of the response interval will contain partial data. Example: Day to get a daily breakdown of the request interval, where the day boundary is defined by the granularityTimeZone.' required: true x-docgen-enum-table-extension: - value: Hour description: Hour - value: Day description: Day - value: Week description: Week - value: Month description: Month - value: Year description: Year - value: Total description: Total schema: type: string enum: - Hour - Day - Week - Month - Year - Total - name: buyerType in: query description: 'Filters the results by the buyer type that you specify, B2B (business to business) or B2C (business to customer). Example: B2B, if you want the response to include order metrics for only B2B buyers.' required: false x-docgen-enum-table-extension: - value: B2B description: Business to business. - value: B2C description: Business to customer. - value: All description: Business to business and business to customer. schema: type: string enum: - B2B - B2C - All default: All - name: fulfillmentNetwork in: query description: 'Filters the results by the fulfillment network that you specify, MFN (merchant fulfillment network) or AFN (Amazon fulfillment network). Do not include this filter if you want the response to include order metrics for all fulfillment networks. Example: AFN, if you want the response to include order metrics for only Amazon fulfillment network.' required: false schema: type: string - name: firstDayOfWeek in: query description: 'Specifies the day that the week starts on when granularity=Week, either Monday or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday.' required: false x-docgen-enum-table-extension: - value: Monday description: Monday - value: Sunday description: Sunday schema: type: string enum: - Monday - Sunday default: Monday - name: asin in: query description: 'Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all ASINs. Example: B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN.' required: false schema: type: string - name: sku in: query description: 'Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all SKUs. Example: TestSKU, if you want the response to include order metrics for only SKU TestSKU.' required: false schema: type: string - name: amazonProgram in: query description: Filters the results by the Amazon program that you specify. Do not include this filter if you want the response to include order metrics for all programs. **Example:** `AmazonHaul` returns order metrics for the Amazon Haul program only. required: false x-docgen-enum-table-extension: - value: AmazonHaul description: Amazon Haul sales schema: type: string enum: - AmazonHaul responses: '200': description: OrderMetric action taken on the resource OrderMetrics. headers: x-amzn-RateLimit-Limit: description: Your rate limit (requests per second) for this operation.. schema: type: string x-amzn-RequestId: description: Unique request reference identifier. schema: type: string x-amzn-api-sandbox: static: - request: parameters: granularity: value: Total response: payload: - interval: 2019-08-01T00:00-07:00--2018-08-03T00:00-07:00 unitCount: 2 orderItemCount: 2 orderCount: 2 averageUnitPrice: amount: '12.5' currencyCode: USD totalSales: amount: '25' currencyCode: USD - request: parameters: granularity: value: Day response: payload: - interval: 2019-08-01T00:00-07:00--2018-08-02T00:00-07:00 unitCount: 1 orderItemCount: 1 orderCount: 1 averageUnitPrice: amount: '22.95' currencyCode: USD totalSales: amount: '22.95' currencyCode: USD - interval: 2019-08-02T00:00-07:00--2018-08-03T00:00-07:00 unitCount: 1 orderItemCount: 1 orderCount: 1 averageUnitPrice: amount: '2.05' currencyCode: USD totalSales: amount: '2.05' currencyCode: USD - request: parameters: granularity: value: Total asin: value: B008OLKVEW response: payload: - interval: 2018-05-01T00:00-07:00--2018-05-03T00:00-07:00 unitCount: 1 orderItemCount: 1 orderCount: 1 averageUnitPrice: amount: '22.95' currencyCode: USD totalSales: amount: '22.95' currencyCode: USD - request: parameters: granularity: value: Day asin: value: B008OLKVEW response: payload: - interval: 2018-05-01T00:00-07:00--2018-05-02T00:00-07:00 unitCount: 1 orderItemCount: 1 orderCount: 1 averageUnitPrice: amount: '22.95' currencyCode: USD totalSales: amount: '22.95' currencyCode: USD - interval: 2018-05-02T00:00-07:00--2018-05-03T00:00-07:00 unitCount: 0 orderItemCount: 0 orderCount: 0 averageUnitPrice: amount: '0' currencyCode: USD totalSales: amount: '0' currencyCode: USD content: application/json: schema: $ref: '#/components/schemas/GetOrderMetricsResponse' '400': description: Request has missing or invalid parameters and cannot be parsed. headers: x-amzn-RateLimit-Limit: description: Your rate limit (requests per second) for this operation. schema: type: string x-amzn-RequestId: description: Unique request reference identifier. schema: type: string content: application/json: schema: $ref: '#/components/schemas/GetOrderMetricsResponse' '403': description: 403 can be caused for reasons like Access Denied, Unauthorized, Expired Token, Invalid Signature or Resource Not Found. headers: x-amzn-RequestId: description: Unique request reference identifier. schema: type: string content: application/json: schema: $ref: '#/components/schemas/GetOrderMetricsResponse' '404': description: The resource specified does not exist. headers: x-amzn-RateLimit-Limit: description: Your rate limit (requests per second) for this operation. schema: type: string x-amzn-RequestId: description: Unique request reference identifier. schema: type: string content: application/json: schema: $ref: '#/components/schemas/GetOrderMetricsResponse' '413': description: The request size exceeded the maximum accepted size. headers: x-amzn-RateLimit-Limit: description: 'Your rate limit (requests per second) for this operation. _Note:_ For this status code, the rate limit header is deprecated and no longer returned.' schema: type: string x-amzn-RequestId: description: Unique request reference identifier. schema: type: string content: application/json: schema: $ref: '#/components/schemas/GetOrderMetricsResponse' '415': description: The entity of the request is in a format not supported by the requested resource. headers: x-amzn-RateLimit-Limit: description: 'Your rate limit (requests per second) for this operation. _Note:_ For this status code, the rate limit header is deprecated and no longer returned.' schema: type: string x-amzn-RequestId: description: Unique request reference identifier. schema: type: string content: application/json: schema: $ref: '#/components/schemas/GetOrderMetricsResponse' '429': description: The frequency of requests was greater than allowed. headers: x-amzn-RateLimit-Limit: description: 'Your rate limit (requests per second) for this operation. _Note:_ For this status code, the rate limit header is deprecated and no longer returned.' schema: type: string x-amzn-RequestId: description: Unique request reference identifier. schema: type: string content: application/json: schema: $ref: '#/components/schemas/GetOrderMetricsResponse' '500': description: Encountered an unexpected condition which prevented the server from fulfilling the request. headers: x-amzn-RateLimit-Limit: description: 'Your rate limit (requests per second) for this operation. _Note:_ For this status code, the rate limit header is deprecated and no longer returned.' schema: type: string x-amzn-RequestId: description: Unique request reference identifier. schema: type: string content: application/json: schema: $ref: '#/components/schemas/GetOrderMetricsResponse' '503': description: Temporary overloading or maintenance of the server. headers: x-amzn-RateLimit-Limit: description: 'Your rate limit (requests per second) for this operation. _Note:_ For this status code, the rate limit header is deprecated and no longer returned.' schema: type: string x-amzn-RequestId: description: Unique request reference identifier. schema: type: string content: application/json: schema: $ref: '#/components/schemas/GetOrderMetricsResponse' summary: Get order metrics x-summary-source: derived components: schemas: Decimal: type: string description: A decimal number with no loss of precision. Useful when precision loss is unnaceptable, as with currencies. Follows RFC7159 for number representation. OrderMetricsList: type: array description: A set of order metrics, each scoped to a particular time interval. items: $ref: '#/components/schemas/OrderMetricsInterval' Money: type: object required: - amount - currencyCode properties: currencyCode: type: string description: Three-digit currency code. In ISO 4217 format. amount: description: The currency amount. $ref: '#/components/schemas/Decimal' description: The currency type and the amount. GetOrderMetricsResponse: type: object properties: payload: description: The payload for the getOrderMetrics operation. $ref: '#/components/schemas/OrderMetricsList' errors: description: Encountered errors for the getOrderMetrics operation. $ref: '#/components/schemas/ErrorList' description: The response schema for the getOrderMetrics operation. OrderMetricsInterval: type: object required: - averageUnitPrice - interval - orderCount - orderItemCount - totalSales - unitCount properties: interval: type: string description: The interval of time based on requested granularity (ex. Hour, Day, etc.) If this is the first or the last interval from the list, it might contain incomplete data if the requested interval doesn't align with the requested granularity (ex. request interval 2018-09-01T02:00:00Z--2018-09-04T19:00:00Z and granularity day will result in Sept 1st UTC day and Sept 4th UTC days having partial data). unitCount: type: integer description: The number of units in orders based on the specified filters. orderItemCount: type: integer description: The number of order items based on the specified filters. orderCount: type: integer description: The number of orders based on the specified filters. averageUnitPrice: description: The average price for an item based on the specified filters. Formula is totalSales/unitCount. $ref: '#/components/schemas/Money' totalSales: description: The total ordered product sales for all orders based on the specified filters. $ref: '#/components/schemas/Money' description: Contains order metrics. ErrorList: type: array description: A list of error responses returned when a request is unsuccessful. items: $ref: '#/components/schemas/Error' Error: type: object required: - code - message properties: code: type: string description: An error code that identifies the type of error that occured. message: type: string description: A message that describes the error condition in a human-readable form. details: type: string description: Additional details that can help the caller understand or fix the issue. description: Error response returned when the request is unsuccessful.