GET/item_sales/search
Note: This is a (Limited Release) API available only to select developers approved by business units. For information on how to obtain access to this API in production, see the Buy APIs Requirements.
This method searches for sold eBay items by various URI query parameters and retrieves the sales history of the items for the last 90 days. You can search by keyword, category, eBay product ID (ePID), or GTIN, or a combination of these.
This method also supports the following:
- Filtering by the value of one or multiple fields, such as listing format, item condition, price range, location, and more. For the fields supported by this method, see the filter parameter.
- Retrieving the refinements (metadata) of an item , such as item aspects (color, brand), condition, category, etc. using the fieldgroups parameter.
- Filtering by item aspects and other refinements using the aspect_filter parameter.
- Creating aspects histograms, which enables shoppers to drill down in each refinement narrowing the search results.
For details and examples of these capabilities, see Browse API in the Buying Integration Guide.
Pagination and sort controls
There are pagination controls (limit and offset fields) and sort query parameters that control/sort the data that is returned. By default, the results are sorted by "Best Match". For more information about Best Match, see the eBay help page Best Match.
URL Encoding for Parameters
Query parameter values need to be URL encoded. For details, see URL encoding query parameter values.
Restrictions
This method can return a maximum of 10,000 items. For a list of supported sites and other restrictions, see API Restrictions.
Input
Resource URI
This method is supported in Sandbox environment. To access the endpoint, just replace the api.ebay.com
root URI with api.sandbox.ebay.com
URI parameters
Parameter | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
q | string | A string consisting of one or more keywords that are used to search for items on eBay. The keywords are handled as follows:
* wildcard character is not allowed in this field. Required: At least 1 category_ids Optional: Any combination of epid, gtin, or q Occurrence: Optional | ||||||
category_ids | array of string | This query parameter specifies the category ID used to limit the result set. For example, if you search for 'shirt' the result set will be very large. But if you also include the category ID 137084 , the results will be limited to 'Men's Athletic Apparel'. For example: /buy/marketplace-insights/v1_beta/item_sales/search?q=shirt&category_ids=137084 The list of eBay category IDs is not published and category IDs are not the same across all the eBay marketplaces. You can use the following techniques to find a category by site:
Occurrence: Required | ||||||
filter | array of FilterField | This query parameter supports multiple field filters that can be used to limit/customize the result set. The following lists the supported filters. For details and examples for all the filters, see Buy API Field Filters. The following example filters the result set by price. Note: To filter by price, price and priceCurrency must always be used together. /buy/marketplace-insights/v1_beta/item_sales/search?q=iphone&category_ids=15724&filter=price:[50..500],priceCurrency:USD Occurrence: Optional | ||||||
sort | array of SortField | This query parameter specifies the order and the field name to use to sort the items. To sort in descending order use - before the field name. Currently, you can only sort by price (in ascending or descending order). If no sort parameter is submitted, the result set is sorted by "Best Match". The following are examples of using the sort query parameter.
Default: ascending Occurrence: Optional | ||||||
limit | string | This query parameter specifies the number of items from the result set returned in a single page. Note: If a value is set in the limit field, the value of offset must be either zero or a multiple of the limit value. An error is returned for invalid values of offset. Note: This method can return a maximum of 10,000 items in one results set. Min: 1 Max: 200 Default: 50 Occurrence: Optional | ||||||
offset | string | This query parameter specifies the number of items to skip in the result set. This is used with the limit field to control the pagination of the output. For example, if offset is 0 and limit is 10, the method will retrieve items 1-10 from the list of items returned; if offset is 10 and limit is 10, the method will retrieve items 11-20 from the list of items returned. Note: The value of offset must be either zero or a multiple of the value set in the limit field. An error is returned for invalid values of offset. Note: This method can return a maximum of 10,000 items in one results set. Min: 0 Max: 9,999 Default: 0 Occurrence: Optional | ||||||
fieldgroups | array of string | This query parameter lets you control what is to be returned in the response and accepts a comma separated list of values. The default is MATCHING_ITEMS, which returns the items that match the keyword or category specified. The other values return data that can be used to create histograms. For code examples see, aspect_filter. Valid Values:
Default: MATCHING_ITEMS Occurrence: Optional | ||||||
aspect_filter | AspectFilter | This query parameter lets you filter by item aspects. The aspect name/value pairs and category, which is required, is used to limit the results to specific aspects of the item. For example, in a clothing category one aspect pair would be Color/Red. The results are returned in the refinement container. For example, the method below uses the category ID for Women's Clothing. This will return only sold items for a woman's red or blue shirt. /buy/marketplace_insights/v1_beta/item_sales/search?q=shirt&category_ids=15724&aspect_filter=categoryId:15724,Color:{Red|Blue} To get a list of the aspects pairs and the category, which is returned in the dominantCategoryId field, set fieldgroups to ASPECT_REFINEMENTS . /buy/marketplace_insights/v1_beta/item_sales/search?q=shirt&category_ids=15724&fieldgroups=ASPECT_REFINEMENTS Format: aspectName:{value1|value2} Required: The category ID is required twice; once as a URI parameter and as part of the aspect_filter parameter. Occurrence: Optional | ||||||
epid | string | The ePID is the eBay product identifier of a product from the eBay product catalog. This query parameter limits the results to only items in the specified ePID. /buy/marketplace-insights/v1_beta/item_sales/search?epid=241986085&category_ids=168058 You can use the product_summary/search method in the Catalog API to search for the ePID of the product. Required: At least 1 category_ids Maximum: 1 epid Optional: Any combination of epid, gtin, or q Occurrence: Optional | ||||||
gtin | string | This query parameter lets you search by the Global Trade Item Number of the item as defined by https://www.gtin.info. This can be a UPC (Universal Product Code), EAN (European Article Number), or an ISBN (International Standard Book Number) value. /buy/marketplace-insights/v1_beta/item_sales/search?gtin=241986085&category_ids=9355 Required: At least 1 category_ids Maximum: 1 gtin Optional: Any combination of epid, gtin, or q Occurrence: Optional |
HTTP request headers
All requests made to eBay REST operations require you to provide the Authorization
HTTP header for authentication authorization.
The table below shows additional HTTP request headers that are either required, conditionally required, or strongly recommended for this method. Other standard HTTP request headers- opens rest request components page (not in this table) can also be used, but they are optional.
Header | Type | Description |
---|---|---|
X-EBAY-C-ENDUSERCTX | string | This header is required to support revenue sharing for eBay Partner Network and to improve the accuracy of shipping and delivery time estimations. If you are an eBay Network Partner you must use affiliateCampaignId=ePNCampaignId,affiliateReferenceId=referenceId in the header in order to be paid for selling eBay items on your site.For additional information, refer to Use request headers. Occurrence: Optional |
X-EBAY-C-MARKETPLACE-ID | string | This header identifies the seller's eBay marketplace. See HTTP request headers for the marketplace ID values. Occurrence: Required |
OAuth scope
This request requires an access token created with the client credentials grant flow, using one or more scopes from the following list (please check your Application Keys page for a list of OAuth scopes available to your application):
https://api.ebay.com/oauth/api_scope/buy.marketplace.insights
See OAuth access tokens for more information.
Request payload
This call has no payload.
Request fields
This call has no field definitions.
Output
HTTP response headers
This call has no response headers.
Response payload
Response fields
Output container/field | Type | Description |
---|---|---|
href | string | The URI of the current page of results from the result set. Occurrence: Always |
itemSales | array of ItemSales | The type that defines the fields for a paginated result set of the sold items. The response consists of 0 or more sequenced result sets where each result sets has 0 or more items. Occurrence: Conditional |
itemSales.additionalImages | array of Image | An array of containers with the URLs for the images that are in addition to the primary image. The primary image is returned in the image.imageUrl field. Occurrence: Conditional |
itemSales.additionalImages.height | integer | Reserved for future use. Occurrence: Conditional |
itemSales.additionalImages.imageUrl | string | The URL of the image. Occurrence: Conditional |
itemSales.additionalImages.width | integer | Reserved for future use. Occurrence: Conditional |
itemSales.adultOnly | boolean | This indicates if the item is for adults only. For more information about adult-only items on eBay, see Adult items policy for sellers and Adult-Only items on eBay for buyers. Occurrence: Always |
itemSales.bidCount | integer | This integer value indicates the total number of bids that have been placed for an auction item. This field is only returned for auction items. Occurrence: Conditional |
itemSales.buyingOptions | array of string | A comma separated list of the purchase options available for the item, such as FIXED_PRICE, AUCTION.
Occurrence: Always |
itemSales.categories | array of Category | This container returns the primary category ID of the item, as well as the secondary category if the item was listed in two categories. Occurrence: Always |
itemSales.categories.categoryId | string | The unique identifier of the primary item category of the item, as well as the secondary item category if item was listed in two categories. Occurrence: Always |
itemSales.condition | string | The text describing the condition of the item, such as New or Used. For a list of condition names, see Item Condition IDs and Names. Occurrence: Conditional |
itemSales.conditionId | string | The identifier of the condition of the item. For example, 1000 is the identifier for NEW. For a list of condition names and IDs, see Item Condition IDs and Names. Occurrence: Always |
itemSales.epid | string | An ePID is the eBay product identifier of a product from the eBay product catalog. This indicates the product in which the item belongs. Occurrence: Conditional |
itemSales.image | Image | The URL to the primary image of the item. Occurrence: Always |
itemSales.image.height | integer | Reserved for future use. Occurrence: Conditional |
itemSales.image.imageUrl | string | The URL of the image. Occurrence: Conditional |
itemSales.image.width | integer | Reserved for future use. Occurrence: Conditional |
itemSales.itemAffiliateWebUrl | string | The URL to the View Item page of the item, which includes the affiliate tracking ID. This field is only returned if the eBay partner enables affiliate tracking for the item by including the Occurrence: Conditional |
itemSales.itemGroupHref | string | The HATEOAS reference of the parent page of the item group. An item group is an item that has various aspect differences, such as color, size, storage capacity, etc. Occurrence: Conditional |
itemSales.itemGroupType | string | Indicates the item group type. An item group is an item that has various aspect differences, such as color, size, storage capacity, etc. Occurrence: Conditional |
itemSales.itemHref | string | The URI of the item. Occurrence: Always |
itemSales.itemId | string | The unique RESTful identifier of the item. Occurrence: Always |
itemSales.itemLocation | ItemLocation | This container returns the postal code and country of the location of the item. Occurrence: Conditional |
itemSales.itemLocation.addressLine1 | string | The first line of the street address. Occurrence: Conditional |
itemSales.itemLocation.addressLine2 | string | The second line of the street address. This field may contain such values as an apartment or suite number. Occurrence: Conditional |
itemSales.itemLocation.city | string | The city in which the item is located. Occurrence: Conditional |
itemSales.itemLocation.country | CountryCodeEnum | The two-letter ISO 3166 standard code that indicates the country in which the item is located. Occurrence: Always |
itemSales.itemLocation.county | string | The county in which the item is located. Occurrence: Conditional |
itemSales.itemLocation.postalCode | string | The postal code (or zip code in US) where the item is located. Occurrence: Always |
itemSales.itemLocation.stateOrProvince | string | The state or province in which the item is located. Occurrence: Always |
itemSales.itemWebUrl | string | The URL to the View Item page of the item. Occurrence: Always |
itemSales.lastSoldDate | string | The date the last item was purchased within the last 90 days. The totalSoldQuantity returns the total number of items that were sold. This field returns the date the last item in that group was sold. Occurrence: Always |
itemSales.lastSoldPrice | ConvertedAmount | The sold price of the last item purchased within the last 90 days. Occurrence: Always |
itemSales.lastSoldPrice.convertedFromCurrency | CurrencyCodeEnum | A three-letter ISO 4217 code that indicates the currency of the amount in the convertedFromValue field. This value represents the pre-conversion currency. Occurrence: Conditional |
itemSales.lastSoldPrice.convertedFromValue | string | The monetary amount before any conversion is performed, in the currency specified by the convertedFromCurrency field. The value field contains the converted amount of this value, in the currency specified by the currency field. Occurrence: Conditional |
itemSales.lastSoldPrice.currency | CurrencyCodeEnum | A three-letter ISO 4217 code that indicates the currency of the amount in the value field. This value represents the post-conversion currency of the amount in the value field. Occurrence: Always |
itemSales.lastSoldPrice.value | string | The monetary value in the currency specified in the currency field. Occurrence: Always |
itemSales.seller | Seller | This container returns basic information about the seller of the item, such as name, feedback score, etc. Occurrence: Always |
itemSales.seller.feedbackPercentage | string | The percentage of the total positive feedback. Occurrence: Always |
itemSales.seller.feedbackScore | integer | The feedback score of the seller. This value is based on the ratings from eBay members that bought items from this seller. Occurrence: Always |
itemSales.seller.username | string | The username created by the seller for use on eBay. Occurrence: Always |
itemSales.thumbnailImages | array of Image | An array of thumbnail images for the item. Occurrence: Conditional |
itemSales.thumbnailImages.height | integer | Reserved for future use. Occurrence: Conditional |
itemSales.thumbnailImages.imageUrl | string | The URL of the image. Occurrence: Conditional |
itemSales.thumbnailImages.width | integer | Reserved for future use. Occurrence: Conditional |
itemSales.title | string | The seller-created title of the item. Occurrence: Always |
itemSales.totalSoldQuantity | integer | The total number of this item that have been sold. Occurrence: Always |
limit | integer | The number of items returned on a single page from the result set. This value can be set in the request with the limit query parameter. Occurrence: Always |
next | string | The URI for the following page of results. This value is returned only if there is an additional page of results to display from the result set. Occurrence: Conditional |
offset | integer | The number of results skipped in the result set before listing the first returned result. This value can be set in the request with the offset query parameter. Occurrence: Always |
prev | string | The URI for the preceding page of results. This value is returned only if there is a previous page of results to display from the result set. Occurrence: Conditional |
refinement | Refinement | The container for all the search refinements. Occurrence: Conditional |
refinement.aspectDistributions | array of AspectDistribution | A array of containers for the all the aspect refinements. Occurrence: Conditional |
refinement.aspectDistributions.aspectValueDistributions | array of AspectValueDistribution | An array of containers for the various values of the aspect and the match count and a HATEOAS reference ( refinementHref) for this aspect. Occurrence: Conditional |
refinement.aspectDistributions.aspectValueDistributions.localizedAspectValue | string | The value of an aspect. For example, Red is a value for the aspect Color. Occurrence: Always |
refinement.aspectDistributions.aspectValueDistributions.matchCount | integer | The number of items with this aspect. Occurrence: Always |
refinement.aspectDistributions.aspectValueDistributions.refinementHref | string | A HATEOAS reference for this aspect. Occurrence: Always |
refinement.aspectDistributions.localizedAspectName | string | Name of an aspect, such as Brand, Color, etc. Occurrence: Conditional |
refinement.buyingOptionDistributions | array of BuyingOptionDistribution | A array of containers for the all the buying option refinements. Occurrence: Conditional |
refinement.buyingOptionDistributions.buyingOption | string |
Occurrence: Conditional |
refinement.buyingOptionDistributions.matchCount | integer | The number of items having this buying option. Occurrence: Always |
refinement.buyingOptionDistributions.refinementHref | string | The HATEOAS reference for this buying option. Occurrence: Always |
refinement.categoryDistributions | array of CategoryDistribution | A array of containers for the all the category refinements. Occurrence: Conditional |
refinement.categoryDistributions.categoryId | string | The identifier of the category. Occurrence: Always |
refinement.categoryDistributions.categoryName | string | The name of the category, such as Baby & Toddler Clothing. Occurrence: Always |
refinement.categoryDistributions.matchCount | integer | The number of items in this category. Occurrence: Always |
refinement.categoryDistributions.refinementHref | string | The HATEOAS reference of this category. Occurrence: Always |
refinement.conditionDistributions | array of ConditionDistribution | A array of containers for the all the condition refinements. Occurrence: Conditional |
refinement.conditionDistributions.condition | string | The text describing the condition of the item, such as New or Used. For a list of condition names, see ConditionEnum. Occurrence: Conditional |
refinement.conditionDistributions.conditionId | string | The identifier of the condition. For example, 1000 is the identifier for NEW. Occurrence: Always |
refinement.conditionDistributions.matchCount | integer | The number of items having the condition. Occurrence: Always |
refinement.conditionDistributions.refinementHref | string | The HATEOAS reference of this condition. Occurrence: Always |
refinement.dominantCategoryId | string | The identifier of the category that most of the items are part of. Occurrence: Always |
total | integer | The total number of items retrieved in the result set. Occurrence: Always |
HTTP status codes
This call can return one of the following HTTP status codes. For an overview of the status codes, see HTTP status codes in Using eBay RESTful APIs.
Status | Meaning |
---|---|
200 | Success |
400 | Bad Request |
500 | Internal Server Error |
Error codes
For more on errors, plus the codes of other common errors, see Handling errors.
Code | Domain | Category | Meaning |
---|---|---|---|
100000 | API_MARKETPLACE_INSIGHTS | APPLICATION | There was a problem with an eBay internal system or process. Contact eBay developer support for assistance. |
100001 | API_MARKETPLACE_INSIGHTS | REQUEST | The call must have a valid 'q', 'category_ids', 'epid' or 'gtin' query parameter. |
100002 | API_MARKETPLACE_INSIGHTS | REQUEST | The 'offset' value is invalid. Offset cannot be negative and must be an integer. |
100003 | API_MARKETPLACE_INSIGHTS | REQUEST | The 'limit' value should be between 1 and 200 (inclusive). |
100004 | API_MARKETPLACE_INSIGHTS | BUSINESS | The category specified is a top-level category. To use this category, you must include a keyword or epid or gtin. |
100005 | API_MARKETPLACE_INSIGHTS | BUSINESS | Currently, the {marketplaceId} marketplace is not supported. The supported Marketplaces are: {allowedMarketplaces} . |
100006 | API_MARKETPLACE_INSIGHTS | REQUEST | The 'sort' value is invalid. For the valid values, refer to the API call documentation. |
100007 | API_MARKETPLACE_INSIGHTS | REQUEST | A valid 'price' filter and a valid 'priceCurrency' filter is required to filter based on price. |
100008 | API_MARKETPLACE_INSIGHTS | REQUEST | The 'epid' value {epid} is invalid. For more information, see the API call reference documentation. |
100009 | API_MARKETPLACE_INSIGHTS | REQUEST | The 'gtin' value {gtin} is invalid. Please input a valid UPC, EAN, or ISBN value. |
100010 | API_MARKETPLACE_INSIGHTS | REQUEST | This keyword search results in a response that is too large to return. Either change the keyword or add additional query parameters and/or filters. |
100011 | API_MARKETPLACE_INSIGHTS | REQUEST | The {filterName} value is invalid. For the valid values, refer to the API call documentation. |
100012 | API_MARKETPLACE_INSIGHTS | REQUEST | The 'fieldgroups' value {fieldgroups} is invalid. The supported fieldgroups are: {supportedFieldgroups} |
100013 | API_MARKETPLACE_INSIGHTS | REQUEST | The 'aspect_filter' query parameter must include a categoryId. For more information, see the API call reference documentation. |
100014 | API_MARKETPLACE_INSIGHTS | REQUEST | The {aspectFilter} aspect_filter value is invalid. For more information, see the API call reference documentation. |
100015 | API_MARKETPLACE_INSIGHTS | BUSINESS | The category {categoryId} is not supported. |
100016 | API_MARKETPLACE_INSIGHTS | BUSINESS | The 'fieldgroups' value {fieldgroups} is invalid when multiple 'category_ids' are specified. Either change the call to have only one value in 'category_ids' or remove the 'fieldgroups'. |
100017 | API_MARKETPLACE_INSIGHTS | REQUEST | Insufficient permissions to use this API. |
100018 | API_MARKETPLACE_INSIGHTS | REQUEST | This query requires at least one category. |
100019 | API_MARKETPLACE_INSIGHTS | REQUEST | You have exceeded the maximum number of categories. The maximum number is {categorySizeLimit}. |
100020 | API_MARKETPLACE_INSIGHTS | REQUEST | The header 'X-EBAY-C-MARKETPLACE-ID' is required. The valid Marketplaces are: {allowedMarketplaces}. |
100021 | API_MARKETPLACE_INSIGHTS | REQUEST | The maximum number of listings that can be retrieved is 10,000, so your offset value must be less than 10,000. If 10,000 or more listings are matching your search criteria, consider narrowing the scope of your search. |
Warnings
This call has no warnings.
Samples
New to making API calls? Please see Making a Call.
Note: Identifiers, such as order IDs or user IDs, and personal data in these samples might be anonymized or may no longer be active on eBay. If necessary, substitute current, relevant eBay data in your requests.
Sample 1: Get Item Sales History using Search
This call searches for iPhones that have been sold.
Input
The input is the search keyword and the category ID.
GEThttps://api.ebay.com/buy/marketplace_insights/v1_beta/item_sales/search?q=iphone&category_ids=9355&limit=3
Output
This call returns the sales history of iPhones.
Sample 2: Get Item Sales History by Keyword and Condition
This call searches for iPhone that have been sold and filters the results by condition.
Input
The input is the keyword, category ID, and the condition.
GEThttps://api.ebay.com/buy/marketplace_insights/v1_beta/item_sales/search?q=iphone&category_ids=9355&Conditions%3A%7BNEW%7D&limit=3
Output
This call returns the sales history for iPhones in New condition.
Sample 3: Get Item Sales History by Product
This call searches for items that have been sold in the eBay product 241067840, or 228707839 which is the product ID for the "Nest E Programmable Thermostat in White".
Input
The input is the ePID for the product and the category ID.
GEThttps://api.ebay.com/buy/marketplace_insights/v1_beta/item_sales/search?epid=241067840&category_ids=159907&limit=3
Output
This call returns the sales history for White Nest E Programmable Thermostats.
Sample 4: Get Item Sales History Filtered by Price
This call searches for iPhones that have been sold for $200 through $220 inclusive.
Input
The input is a keyword, the category ID, price range, and currency.
GEThttps://api.ebay.com/buy/marketplace_insights/v1_beta/item_sales/search?q=iphone&category_ids=9355&filter=price:[200..220],priceCurrency:USD&limit=3
Output
This call returns the sales history for iPhones that sold within the specified price range.
Sample 5: Get Item Sales History by Category and Filtered by Item Aspect
This call searches for items sold in the Cell Phones & Smartphones category (9355) and work on the AT&T network.
Input
The input is the category ID and the item aspect.
GEThttps://api.ebay.com/buy/marketplace_insights/v1_beta/item_sales/search?category_ids=9355&aspect_filter=categoryId%3A9355%2CNetwork%3A%7BAT%26T%7D&limit=3
Output
This call returns the sales history for mobile phones that work on the specified network.
Sample 6: Get Item Aspects of Sold Items
This call searches for iPhones that have been sold and returns the item aspects of these items.
Input
The input is the a keyword, the category ID, and field group.
GEThttps://api.ebay.com/buy/marketplace_insights/v1_beta/item_sales/search?q=iphone&category_ids=9355&fieldgroups=ASPECT_REFINEMENTS
Output
This call returns the item aspects of the iPhones that have been sold.
Sample 7: Get the Items and Item Aspects of Sold Items
This call searches for iPhones that have been sold and returns the item and the item aspects of these items.
Input
The input is the a keyword and field group.
GEThttps://api.ebay.com/buy/marketplace_insights/v1_beta/item_sales/search?q=iphone&category_ids=9355&fieldgroups=ASPECT_REFINEMENTS,MATCHING_ITEMS&limit=3
Output
This call returns the items and the item aspects of the iPhones that have been sold.