HomeDocumentationCode SamplesAPI ReferenceAnnouncementsModelsRelease NotesFAQGitHubVideos
Developer HubAPI StatusSupport
Documentation
Developer HubAPI StatusSupport

Sales API v1 Model

Swagger model for the Sales API v1.

{
  "swagger": "2.0",
  "info": {
    "description": "The Selling Partner API for Sales provides APIs related to sales performance.",
    "version": "v1",
    "title": "Selling Partner API for Sales",
    "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"
    }
  },
  "host": "sellingpartnerapi-na.amazon.com",
  "schemes": [
    "https"
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "paths": {
    "/sales/v1/orderMetrics": {
      "get": {
        "tags": [
          "sales"
        ],
        "description": "Returns aggregated order metrics for given interval, broken down by granularity, for given buyer type.\n\n**Usage Plan:**\n\n| Rate (requests per second) | Burst |\n| ---- | ---- |\n| .5 | 15 |\n\nThe `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](doc:usage-plans-and-rate-limits-in-the-sp-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.\n\nFor example, ATVPDKIKX0DER indicates the US marketplace.",
            "required": true,
            "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,
            "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,
            "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,
            "type": "string",
            "enum": [
              "Hour",
              "Day",
              "Week",
              "Month",
              "Year",
              "Total"
            ],
            "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"
              }
            ]
          },
          {
            "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,
            "type": "string",
            "default": "All",
            "enum": [
              "B2B",
              "B2C",
              "All"
            ],
            "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."
              }
            ]
          },
          {
            "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,
            "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,
            "type": "string",
            "default": "Monday",
            "enum": [
              "Monday",
              "Sunday"
            ],
            "x-docgen-enum-table-extension": [
              {
                "value": "Monday",
                "description": "Monday"
              },
              {
                "value": "Sunday",
                "description": "Sunday"
              }
            ]
          },
          {
            "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,
            "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,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OrderMetric action taken on the resource OrderMetrics.",
            "schema": {
              "$ref": "#/definitions/GetOrderMetricsResponse"
            },
            "examples": {
              "payload": {
                "dayGranularity": {
                  "metrics": [
                    {
                      "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": 1,
                      "orderItemCount": 1,
                      "orderCount": 1,
                      "averageUnitPrice": {
                        "amount": "2.05",
                        "currencyCode": "USD"
                      },
                      "totalSales": {
                        "amount": "2.05",
                        "currencyCode": "USD"
                      }
                    }
                  ]
                },
                "totalGranularity": {
                  "metrics": [
                    {
                      "interval": "2018-05-01T00:00-07:00--2018-05-03T00:00-07:00",
                      "unitCount": 2,
                      "orderItemCount": 2,
                      "orderCount": 2,
                      "averageUnitPrice": {
                        "amount": "12.5",
                        "currencyCode": "USD"
                      },
                      "totalSales": {
                        "amount": "25",
                        "currencyCode": "USD"
                      }
                    }
                  ]
                },
                "asinFilter": {
                  "metrics": [
                    {
                      "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"
                      }
                    }
                  ]
                }
              }
            },
            "headers": {
              "x-amzn-RateLimit-Limit": {
                "type": "string",
                "description": "Your rate limit (requests per second) for this operation.."
              },
              "x-amzn-RequestId": {
                "type": "string",
                "description": "unique request reference id."
              }
            },
            "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"
                      }
                    }
                  ]
                }
              }
              ]
            }
          },
          "400": {
            "description": "Request has missing or invalid parameters and cannot be parsed.",
            "schema": {
              "$ref": "#/definitions/GetOrderMetricsResponse"
            },
            "headers": {
              "x-amzn-RateLimit-Limit": {
                "type": "string",
                "description": "Your rate limit (requests per second) for this operation."
              },
              "x-amzn-RequestId": {
                "type": "string",
                "description": "Unique request reference id."
              }
            }
          },
          "403": {
            "description": "403 can be caused for reasons like Access Denied, Unauthorized, Expired Token, Invalid Signature or Resource Not Found.",
            "schema": {
              "$ref": "#/definitions/GetOrderMetricsResponse"
            },
            "headers": {
              "x-amzn-RequestId": {
                "type": "string",
                "description": "Unique request reference id."
              }
            }
          },
          "404": {
            "description": "The resource specified does not exist.",
            "schema": {
              "$ref": "#/definitions/GetOrderMetricsResponse"
            },
            "headers": {
              "x-amzn-RateLimit-Limit": {
                "type": "string",
                "description": "Your rate limit (requests per second) for this operation."
              },
              "x-amzn-RequestId": {
                "type": "string",
                "description": "Unique request reference id."
              }
            }
          },
          "413": {
            "description": "The request size exceeded the maximum accepted size.",
            "schema": {
              "$ref": "#/definitions/GetOrderMetricsResponse"
            },
            "headers": {
              "x-amzn-RateLimit-Limit": {
                "type": "string",
                "description": "Your rate limit (requests per second) for this operation.\n_Note:_ For this status code, the rate limit header is deprecated and no longer returned."
              },
              "x-amzn-RequestId": {
                "type": "string",
                "description": "Unique request reference id."
              }
            }
          },
          "415": {
            "description": "The entity of the request is in a format not supported by the requested resource.",
            "schema": {
              "$ref": "#/definitions/GetOrderMetricsResponse"
            },
            "headers": {
              "x-amzn-RateLimit-Limit": {
                "type": "string",
                "description": "Your rate limit (requests per second) for this operation.\n_Note:_ For this status code, the rate limit header is deprecated and no longer returned."
              },
              "x-amzn-RequestId": {
                "type": "string",
                "description": "Unique request reference id."
              }
            }
          },
          "429": {
            "description": "The frequency of requests was greater than allowed.",
            "schema": {
              "$ref": "#/definitions/GetOrderMetricsResponse"
            },
            "headers": {
              "x-amzn-RateLimit-Limit": {
                "type": "string",
                "description": "Your rate limit (requests per second) for this operation.\n_Note:_ For this status code, the rate limit header is deprecated and no longer returned."
              },
              "x-amzn-RequestId": {
                "type": "string",
                "description": "Unique request reference id."
              }
            }
          },
          "500": {
            "description": "Encountered an unexpected condition which prevented the server from fulfilling the request.",
            "schema": {
              "$ref": "#/definitions/GetOrderMetricsResponse"
            },
            "headers": {
              "x-amzn-RateLimit-Limit": {
                "type": "string",
                "description": "Your rate limit (requests per second) for this operation.\n_Note:_ For this status code, the rate limit header is deprecated and no longer returned."
              },
              "x-amzn-RequestId": {
                "type": "string",
                "description": "Unique request reference id."
              }
            }
          },
          "503": {
            "description": "Temporary overloading or maintenance of the server.",
            "schema": {
              "$ref": "#/definitions/GetOrderMetricsResponse"
            },
            "headers": {
              "x-amzn-RateLimit-Limit": {
                "type": "string",
                "description": "Your rate limit (requests per second) for this operation.\n_Note:_ For this status code, the rate limit header is deprecated and no longer returned."
              },
              "x-amzn-RequestId": {
                "type": "string",
                "description": "Unique request reference id."
              }
            }
          }
        }
      }
    }
  },
  "definitions": {
    "GetOrderMetricsResponse": {
      "type": "object",
      "properties": {
        "payload": {
          "description": "The payload for the getOrderMetrics operation.",
          "$ref": "#/definitions/OrderMetricsList"
        },
        "errors": {
          "description": "Encountered errors for the getOrderMetrics operation.",
          "$ref": "#/definitions/ErrorList"
        }
      },
      "description": "The response schema for the getOrderMetrics operation."
    },
    "OrderMetricsList": {
      "type": "array",
      "description": "A set of order metrics, each scoped to a particular time interval.",
      "items": {
        "$ref": "#/definitions/OrderMetricsInterval"
      }
    },
    "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": "#/definitions/Money"
        },
        "totalSales": {
          "description": "The total ordered product sales for all orders based on the specified filters.",
          "$ref": "#/definitions/Money"
        }
      },
      "description": "Contains order metrics."
    },
    "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."
    },
    "ErrorList": {
      "type": "array",
      "description": "A list of error responses returned when a request is unsuccessful.",
      "items": {
        "$ref": "#/definitions/Error"
      }
    },
    "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": "#/definitions/Decimal"
        }
      },
      "description": "The currency type and the amount."
    },
    "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."
    }
  }
}