eBay Trading APIVersion 1375
 

GetCategories

Use this call to retrieve the latest category hierarchy for the eBay site specified in the CategorySiteID property. By default, this is the site to which you submit the request. You can retrieve all categories on the site, or you can use CategoryParent to retrieve one particular category and its subcategories. The returned category list is contained in the CategoryArray property.

Usage Details

eBay requires sellers to specify a category ID for most new listings and you can only add item listings in leaf categories. The GetCategories call can help you find the leaf categories on any eBay site.

For each category, the call returns the category name, its unique ID (within the site to which you sent the request), and meta-data that helps you determine where the category fits in the hierarchy. The call also identifies a few eBay features that are only supported in some categories. For example, some categories support immediate payment (AutoPay). For information about additional features that vary by category, use GetCategoryFeatures.

The API provides other calls that supplement GetCategories. For example, consider using GetSuggestedCategories to help the seller choose a category ID. In certain cases, it may be helpful to use GetCategoryMappings to update locally stored item data (although most applications can use the simpler CategoryMappingAllowed flag in AddItem for this purpose).

See Retrieving the Category Hierarchy for a Site for a detailed description of retrieving the category data for an eBay site.

Working with the Response

GetCategories returns the category data for the specified eBay site into a CategoryArrayType object in the CategoryArray property of the GetCategories response object. Within this array is one CategoryType object for each category retrieved.

  1. Traverse the category array to visit each of the category objects it contains.
  2. Inspect the properties of each CategoryType object to get the values for the category it represents.
  3. Remember that the value of ReservePriceAllowed (specifying whether the site allows listings with reserve prices) can be reversed by the CategoryType.ORPA field for an individual category.
  4. As applicable for the application, store the data (for example, to a table).

Best Practices

The following sections list several hints and suggestions for working with GetCategories.

Data Filters

There is no limit on the number of categories that can be returned using GetCategories. Unless otherwise specified by a filter, all of the categories for a particular site can be returned in one call.

Because category data can be quite voluminous, applications can reduce the volume of data retrieved by using the CategoryParent input property to target the specific categories used by the application. By specifying a category with CategoryParent, a call retrieves a subset of the total category hierarchy. Using this method, you can download the portions of the category hierarchy that you need. While several calls might be needed to gain all the category data required, the individual responses are more targeted.

You can use the LevelLimit property to limit the categories returned to just those up to the specified level in the category hierarchy.

Setting the ViewAllNodes property to false (the default) limits the categories returned; only leaf categories are returned, representing the categories in which you must list an item.

Optimizing Your Calls

Retrieving the full set of eBay categories can be time-consuming and the result sets can be quite large. It can be worthwhile to issue one GetCategories call to retrieve the data for the top-level categories (set LevelLimit to 1), then get the full hierarchy of the branches you are interested by specifying those categories as CategoryParent values in subsequent calls to GetCategories.

Use GetCategories to retrieve the category hierarchy only when necessary and retrieve category data only when a change in the category hierarchy version is indicated for the specified site (see "Checking the Category Hierarchy Version" in Maintaining Category Data for details on category versioning). Although checking the category version does not reduce the number of calls you make to GetCategories, you can optimize your calls by downloading category data only when needed.

Testing GetCategories

Use the following methods to test GetCategories:

Related Information

See Categories.



Input

See also Samples.

The box below lists all fields that could be included in the call request. To learn more about an individual field or its type, click its name in the box (or scroll down to find it in the table below the box).

See also the Deprecated Objects link above. Fields presented in this color are deprecated, and fields presented in this color are (or soon will be) non-operational.

The XML prototype does not include requester credentials. This is a documentation limitation only (see Standard Requester Credentials for Making Calls).

<?xml version="1.0" encoding="utf-8"?>
<GetCategoriesRequest xmlns="urn:ebay:apis:eBLBaseComponents">
  <!-- Call-specific Input Fields -->
  <CategoryParent> string </CategoryParent>
  <!-- ... more CategoryParent values allowed here ... -->
  <CategorySiteID> string </CategorySiteID>
  <LevelLimit> int </LevelLimit>
  <ViewAllNodes> boolean </ViewAllNodes>
  <!-- Standard Input Fields -->
  <DetailLevel> DetailLevelCodeType </DetailLevel>
  <!-- ... more DetailLevel values allowed here ... -->
  <ErrorLanguage> string </ErrorLanguage>
  <MessageID> string </MessageID>
  <OutputSelector> string </OutputSelector>
  <!-- ... more OutputSelector values allowed here ... -->
  <Version> string </Version>
  <WarningLevel> WarningLevelCodeType </WarningLevel>
</GetCategoriesRequest>
Argument Type Occurrence Meaning
Call-specific Input Fields [Jump to standard fields]
CategoryParent string Optional,
repeatable: [0..*]
This field is used if the user wishes to retrieve category hierarchy information on one or more specific eBay categories, and optionally, one or more levels of each category's children (if a category has one or more levels of children). For example, if you wanted to view the entire category hierarchy under the Home & Garden L1 category, you would include this field and set its value to 11700. As long as the LevelLimit field is omitted, all of Home & Garden's child categories are returned. If you only wanted to see the next level (L2s) of Home & Garden categories, you would include the LevelLimit field and set its value to 2, allowing the L1 category (Home & Garden) and all of its L2 categories to appear in the response.

If you wanted to see all of the Category IDs for the eBay site's L1 categories, you could omit the CategoryParent field but include the LevelLimit field and set its value to 1.

Note: Numerous Category IDs may be specified under multiple CategoryParent fields in a GetCategories request, but if multiple CategoryParent fields are used, the specified Category IDs should all be at the same level (L1, L2, L3, etc.).
CategorySiteID string Optional This field is used if the user wants to retrieve category data for another eBay site (other than the one specified in the X-EBAY-API-SITEID request header).

If this field is omitted, the categories from the site specified in the required X-EBAY-API-SITEID request header are returned. If this field is included, the site specified in this field overrides the site ID in the request header.

See eBay Site IDs.

LevelLimit int Optional This field is used if the user wants to control the maximum depth of the category hierarchy to retrieve, or in other words, how many levels of eBay categories that are returned in the response. If this field is omitted, every eBay category from the root on down will be returned, or, if a CategoryParent category is specified, the specified category and all of its children (down to the leaf categories) are returned.

If the CategoryParent is not used, but the LevelLimit field is used and set to 1, only the top-level categories (also known as L1 categories) are returned in the response.
ViewAllNodes boolean Optional This flag controls whether all eBay categories (that satisfy input filters) are returned, or only leaf categories (you can only list items in leaf categories) are returned. The default value is 'true', so if this field is omitted, all eBay categories will be returned. If you only want to retrieve leaf categories, include this flag and set it to false.

Default: true.
Standard Input Fields  
DetailLevel DetailLevelCodeType Optional,
repeatable: [0..*]
Detail levels are instructions that define standard subsets of data to return for particular data components (e.g., each Item, Transaction, or User) within the response payload. For example, a particular detail level might cause the response to include buyer-related data in every result (e.g., for every Item), but no seller-related data.

Specifying a detail level is like using a predefined attribute list in the SELECT clause of an SQL query. Use the DetailLevel element to specify the required detail level that the client application needs pertaining to the data components that are applicable to the request.

The DetailLevelCodeType defines the global list of available detail levels for all request types. Most request types support certain detail levels or none at all. If you pass a detail level that exists in the schema but that isn't valid for a particular request, eBay ignores it and processes the request without it.

For each request type, see the detail level tables in the Input/Output Reference to determine which detail levels are applicable and which elements are returned for each applicable detail level.

Note that DetailLevel is required input for GetMyMessages.

With GetSellerList and other calls that retrieve large data sets, please avoid using ReturnAll when possible. For example, if you use GetSellerList, use GranularityLevel instead, or use GetSellerEvents. If you do use 'ReturnAll' with GetSellerList, use a small Pagination.EntriesPerPage value and a narrow EndTimeFrom/EndTimeTo date range for better performance.

Applicable values:

ReturnAll
(in) Returns all available data. With GetSellerList and other calls that retrieve large data sets, please avoid using ReturnAll when possible. For example, if you use GetSellerList, use a GranularityLevel or use the GetSellerEvents call instead. If you use ReturnAll with GetSellerList, use a small EntriesPerPage value and a short EndTimeFrom/EndTimeTo range for better performance.

(Not all values in DetailLevelCodeType apply to this field.)
ErrorLanguage string Optional Use ErrorLanguage to return error strings for the call in a different language from the language commonly associated with the site that the requesting user is registered with. Below are some examples from different countries.

ID Country
en_AU Australia
de_AT Austria
nl_BE Belgium (Dutch)
fr_BE Belgium (French)
en_CA Canada
fr_CA Canada (French)
zh_CN China
fr_FR France
de_DE Germany
zh_HK Hong Kong
en_IN India
en_IE Ireland
it_IT Italy
nl_NL Netherlands
en_SG Singapore
es_ES Spain
de_CH Switzerland
en_GB United Kingdom
en_US United States
MessageID string Optional Most Trading API calls support a MessageID element in the request and a CorrelationID element in the response. If you pass in a MessageID in a request, the same value will be returned in the CorrelationID field in the response. Pairing these values can help you track and confirm that a response is returned for every request and to match specific responses to specific requests. If you do not pass a MessageID value in the request, CorrelationID is not returned.

Note: GetCategories is designed to retrieve very large sets of metadata that change once a day or less often. To improve performance, these calls return cached responses when you request all available data (with no filters). When this occurs, the MessageID and CorrelationID fields aren't applicable. However, if you specify an input filter to reduce the amount of data returned, the calls retrieve the latest data (not cached). When this occurs, MessageID and CorrelationID are applicable.
OutputSelector string Optional,
repeatable: [0..*]
You can use the OutputSelector field to restrict the data returned by a call. This field can make the call response easier to manage, especially when a large payload is returned. If you use the OutputSelector field, the output data will only include the field(s) you specified in the request, as well as all of its child fields (if a field is a container) and its parent fields (if any). Note that it is possible that a field included through an OutputSelector field may still not be returned if it is not applicable, or if it is not found based on other criteria set up in the request payload.

For example, if you are using GetItem and you only want to retrieve the URL of the View Item page (emitted in ViewItemURL field) and the item's Buy It Now price (emitted in BuyItNowPrice field), you would include two separate OutputSelector fields and set the value for each one as ViewItemURL and BuyItNowPrice as in the following example:

 If the following output selectors are used: 

...
<OutputSelector>ViewItemURL</OutputSelector>
<OutputSelector>BuyItNowPrice</OutputSelector>

...

...the response might look like the following

<Item>
<BuyItNowPrice currencyID="USD">0.0</BuyItNowPrice>
<ListingDetails>
<ViewItemURL>http://www.ebay.com/itm/Tag-Heuer-Mens-Watch/182879833261</ViewItemURL>
</ListingDetails>
</Item>

See OutputSelector.

Version string Conditional The version number of the API code that you are programming against (e.g., 1149). The version you specify for a call has these basic effects:
  • It indicates the version of the code lists and other data that eBay should use to process your request.
  • It indicates the schema version you are using.
You need to use a version that is greater than or equal to the lowest supported version.
For the SOAP API: If you are using the SOAP API, this field is required. Specify the version of the WSDL your application is using.

For the XML API: If you are using the XML API, this field has no effect. Instead, specify the version in the X-EBAY-API-COMPATIBILITY-LEVEL HTTP header. (If you specify Version in the body of an XML API request and it is different from the value in the HTTP header, eBay returns an informational warning that the value in the HTTP header was used instead.)

See:
    HTTP headers
    eBay Schema Versioning Strategy
    Lowest Supported Version

WarningLevel WarningLevelCodeType Optional Controls whether or not to return warnings when the application passes unrecognized or deprecated elements in a request.

An unrecognized element is one that is not defined in any supported version of the schema. Schema element names are case-sensitive, so using WarningLevel can also help you remove any potential hidden bugs within your application due to incorrect case or spelling in field names before you put your application into the Production environment.

WarningLevel only validates elements; it doesn't validate XML attributes. It also doesn't control warnings related to user-entered strings or numbers, or warnings for logical errors.

We recommend that you only use this during development and debugging. Do not use this in requests performed in the Production environment.

Applicable values:

High
(in) The WarningLevel value is set to High if the user wishes to receive warnings when the application passes unrecognized or deprecated elements in an API call request. Setting the WarningLevel value to High is not recommended in a production environment. Instead, it should only be used during the development/debugging stage.
Low
(in) The WarningLevel value is set to Low if the user does not wish to receive warnings when the application passes unrecognized or deprecated elements in an API call request. This is the default value if WarningLevel is not specified in the call request.

See Warning Level.



Output

See also Samples.

The box below lists all fields that might be returned in the response. To learn more about an individual field or its type, click its name in the box (or scroll down to find it in the table below the box).

See also the Deprecated Objects link above. Fields presented in this color are deprecated, and fields presented in this color are not returned (or soon will not be returned) or are not operational (or soon will be non-operational).

<?xml version="1.0" encoding="utf-8"?>
<GetCategoriesResponse xmlns="urn:ebay:apis:eBLBaseComponents">
  <!-- Call-specific Output Fields -->
  <CategoryArray> CategoryArrayType
    <Category> CategoryType
      <AutoPayEnabled> boolean </AutoPayEnabled>
      <B2BVATEnabled> boolean </B2BVATEnabled>
      <BestOfferEnabled> boolean </BestOfferEnabled>
      <CategoryID> string </CategoryID>
      <CategoryLevel> int </CategoryLevel>
      <CategoryName> string </CategoryName>
      <CategoryParentID> string </CategoryParentID>
      <!-- ... more CategoryParentID values allowed here ... -->
      <Expired> boolean </Expired>
      <LeafCategory> boolean </LeafCategory>
      <LSD> boolean </LSD>
      <ORPA> boolean </ORPA>
      <ORRA> boolean </ORRA>
      <Virtual> boolean </Virtual>
    </Category>
    <!-- ... more Category nodes allowed here ... -->
  </CategoryArray>
  <CategoryCount> int </CategoryCount>
  <CategoryVersion> string </CategoryVersion>
  <MinimumReservePrice> double </MinimumReservePrice>
  <ReduceReserveAllowed> boolean </ReduceReserveAllowed>
  <ReservePriceAllowed> boolean </ReservePriceAllowed>
  <UpdateTime> dateTime </UpdateTime>
  <!-- Standard Output Fields -->
  <Ack> AckCodeType </Ack>
  <Build> string </Build>
  <CorrelationID> string </CorrelationID>
  <Errors> ErrorType
    <ErrorClassification> ErrorClassificationCodeType </ErrorClassification>
    <ErrorCode> token </ErrorCode>
    <ErrorParameters ParamID="string"> ErrorParameterType
      <Value> string </Value>
    </ErrorParameters>
    <!-- ... more ErrorParameters nodes allowed here ... -->
    <LongMessage> string </LongMessage>
    <SeverityCode> SeverityCodeType </SeverityCode>
    <ShortMessage> string </ShortMessage>
  </Errors>
  <!-- ... more Errors nodes allowed here ... -->
  <HardExpirationWarning> string </HardExpirationWarning>
  <Timestamp> dateTime </Timestamp>
  <Version> string </Version>
</GetCategoriesResponse>
Return Value Type Occurrence Meaning
Call-specific Output Fields [Jump to standard fields]
CategoryArray CategoryArrayType Always List of the returned categories. The category array contains one CategoryType object for each returned category. Returns empty if no detail level is specified.

DetailLevel: ReturnAll.
CategoryArray.Category CategoryType Conditionally,
repeatable: [0..*]
This container provides details about the eBay category identified in the CategoryID field. The DetailLevel field must be included and set to ReturnAll for Category, nodes to appear.

DetailLevel: ReturnAll.
CategoryArray.Category
  .AutoPayEnabled
boolean Conditionally If this field is returned as true, the corresponding category supports immediate payment for listings. The immediate payment feature is applicable to fixed-price listings, to auction listings with the Buy It Now option enabled, and for a motor vehicle listing that requires an initial deposit. If the immediate payment feature is enabled for a listing, the buyer must pay immediately after clicking the 'Buy it Now' button. This field is only returned when true.

DetailLevel: ReturnAll.

See Require immediate payment.

CategoryArray.Category
  .B2BVATEnabled
boolean Conditionally If this field is returned as true, the corresponding category supports business-to-business (B2B) VAT listings. If this field is not present, the category does not B2B VAT listings. This field is not returned when false. This feature is applicable to the eBay Germany (DE), Austria (AT), and Switzerland (CH) sites only.

DetailLevel: ReturnAll.

See Value-added tax (VAT).

CategoryArray.Category
  .BestOfferEnabled
boolean Conditionally If this field is returned as true, the corresponding category supports Best Offers. If this field is not present, the category does not support Best Offers. This field is not returned when false.

DetailLevel: ReturnAll.
CategoryArray.Category
  .CategoryID
string Always This string value is the unique identifier of an eBay category. In GetItem and related calls, see the CategoryName field for the text name of the category. The parent category of this eBay category is only shown in GetCategories.
Note: When listing in categoryID 173651 (Auto Performance Tuning Devices & Software), use of catalog products is required. For more information, see Tuning devices and software. In an Add call, the PrimaryCategory.CategoryID is conditionally required unless the seller successfully uses the ProductListingDetails container to find an eBay catalog product match. When the seller successfully uses an eBay catalog product to create a listing, the listing title, listing description, item specifics, listing category, and stock photo defined in the catalog product is used to create the listing.

In an Add/Revise/Relist call, the SecondaryCategory.CategoryID is conditionally required if a Secondary Category is used. Using a Secondary Category can incur a listing fee.

For ReviseItem only: Previously, removing the listing from a secondary category was only possible within 12 hours of the listing's scheduled end time when an auction listing had no active bids or a multiple-quantity, fixed-price listing had no items sold, but this restriction no longer exists. Now, the secondary category can be dropped for any active listing at any time, regardless of whether an auction listing has bids or a fixed-price listing has sales. To drop a secondary category, the seller passes in a value of 0 in the SecondaryCategory.CategoryID field.

Max length: 10.

DetailLevel: ReturnAll.
CategoryArray.Category
  .CategoryLevel
int Always This integer value indicates the level where the category fits in the eBay site's category hierarchy. For example, if this field has a value of 2, then the category is two levels below the root category in the eBay site's category hierarchy.

DetailLevel: ReturnAll.
CategoryArray.Category
  .CategoryName
string Always This string value is the display name of the eBay primary category, as it would appear on the eBay site. In GetItem, this will be a fully-qualified category name (e.g., Collectibles:Decorative Collectibles:Hummel, Goebel).
Max length: 50.

DetailLevel: ReturnAll.
CategoryArray.Category
  .CategoryParentID
string Always,
repeatable: [1..*]
This string value is the Category ID of the primary category's (indicated in the CategoryID field) parent category. The number of CategoryParentID values that are returned will depend on the LevelLimit value that is set (in GetCategories) and on how far up the primary category is in the eBay category hierarchy. CategoryParentID values are returned in correct sequence, starting from the root category and ending with the category that is the direct parent of the primary category specified in CategoryID. The CategoryID and CategoryParentID values will be the same if the LevelLimit value is set to 1.
Max length: 10.

DetailLevel: ReturnAll.
CategoryArray.Category.Expired boolean Always If this field is returned as true, the corresponding category is no longer a valid eBay category on the site, and items may not be listed in this category. This field is not returned when false.

DetailLevel: ReturnAll.
CategoryArray.Category
  .LeafCategory
boolean Always If this field is returned as true, the corresponding category is an eBay leaf category, a category in which items may be listed. This field is not returned when false.

DetailLevel: ReturnAll.
CategoryArray.Category.LSD boolean Always If this field is returned as true, the corresponding category does not support lot listings. A lot listing is a listing that features multiple related items that must be purchased by one buyer in one transaction. 'LSD' is an acronym for 'Lot Size Disabled'. 'Lot Size' refers to the LotSize field in the Add/Revise/Relisting calls that is conditionally required if the seller is creating a lot listing. The LSD field is not returned when false.

DetailLevel: ReturnAll.
CategoryArray.Category.ORPA boolean Always If this field is returned as true, the corresponding category is an exception to the eBay site's standard Reserve Price policy on auction listings. For example, if the site's default setting is to allow setting a Reserve Price, but ORPA is returned as true, this particular category does not support setting a Reserve Price. Or, if the site's default setting is not to allow setting a Reserve Price, but ORPA is returned as true, this particular category is the exception to that rule and does support setting a Reserve Price. If ORPA is true for the corresponding category, you can generally assume that the category's subcategories inherit the same setting. 'ORPA' is an acronym for 'Override Reserve Price Allowed'.

This field is not returned when false.

DetailLevel: ReturnAll.
CategoryArray.Category.ORRA boolean Conditionally If this field is returned as true, the corresponding category is an exception to the eBay site's standard Reduce Reserve Price (on active auction listing) policy. For example, if the site's default setting is to allow reducing a Reserve Price for the active auction listing, but ORRA is returned as true, this particular category does not support reducing a Reserve Price. Or, if the site's default setting is not to allow reducting a Reserve Price, but ORRA is returned as true, this particular category is the exception to that rule and does support reducing a Reserve Price. If ORRA is true for the corresponding category, you can generally assume that the category's subcategories inherit the same setting. 'ORRA' is an acronym for 'Override Reduce Reserve Allowed'.

This field is not returned when false.

DetailLevel: ReturnAll.
CategoryArray.Category.Virtual boolean Always If this field is returned as true, the corresponding category is an eBay virtual category, a category in which items may not be listed. This field is not returned when false.

DetailLevel: ReturnAll.
CategoryCount int Always Indicates the number of categories returned (i.e., the number of CategoryType objects in CategoryArray).

DetailLevel: ReturnAll.
CategoryVersion string Always Indicates the version of the category hierarchy on the specified eBay site.

DetailLevel: ReturnAll. Also returned if DetailLevel is not provided on input.
MinimumReservePrice double Always Indicates the lowest possible reserve price allowed for any item listed in any category on the site. You can use the fields returned by GetCategoryFeatures to determine if a different Minimum Reserve Price is defined for the category you want to use.

DetailLevel: ReturnAll. Also returned if DetailLevel is not provided on input.
ReduceReserveAllowed boolean Always If true, ReduceReserveAllowed indicates that all categories on the site allow the seller to reduce an item's reserve price. If false, this field is not returned in the response and all categories on the site do not normally allow sellers to reduce an item's reserve price. The Category.ORRA (override reduce reserve price) field can override (or toggle) the reserve price reduction setting for a given category. For example, if ReduceReserveAllowed is false and Category.ORRA is true, the category overrides the site setting and supports reducing reserve prices. If ReduceReserveAllowed is true and Category.ORRA is true, the category overrides the site setting and does does not support reducing reserve prices.

DetailLevel: ReturnAll. Also returned if DetailLevel is not provided on input.
ReservePriceAllowed boolean Always If true, ReservePriceAllowed indicates that all categories on the site allow the seller to specify a reserve price for an item. If false, this field is not returned in the response and all categories on the site do not normally allow sellers to specify reserve prices. The Category.ORPA (override reserve price allowed) field can override (or toggle) the reserve price allowed setting for a given category. For example, if ReservePriceAllowed is false and Category.ORPA is true, the category overrides the site setting and supports reserve prices. If ReservePriceAllowed is true and Category.ORPA is true, the category overrides the site setting and does does not support reserve prices.

DetailLevel: ReturnAll. Also returned if DetailLevel is not provided on input.
UpdateTime dateTime Always Indicates the last date and time that eBay modified the category hierarchy for the specified eBay site.

DetailLevel: ReturnAll. Also returned if DetailLevel is not provided on input.
Standard Output Fields  
Ack AckCodeType Always A token representing the application-level acknowledgement code that indicates the response status (e.g., success). The AckCodeType list specifies the possible values for the Ack field.

Applicable values:

CustomCode
(out) Reserved for internal or future use.
Failure
(out) This value indicates that the call request processing failed.
Success
(out) This value indicates that the call request was processed successfully without any issues.
Warning
(out) This value indicates that the call request was successful, but processing was not without any issues. These issues can be checked in the Errors container, that will also be returned when one or more known issues occur with the call request.

(Not all values in AckCodeType apply to this field.)

Code so that your app gracefully handles any future changes to this list.
Build string Always This refers to the specific software build that eBay used when processing the request and generating the response. This includes the version number plus additional information. eBay Developer Support may request the build information when helping you resolve technical issues.
CorrelationID string Conditionally Most Trading API calls support a MessageID element in the request and a CorrelationID element in the response. If you pass in a MessageID in a request, the same value will be returned in the CorrelationID field in the response. Pairing these values can help you track and confirm that a response is returned for every request and to match specific responses to specific requests. If you do not pass a MessageID value in the request, CorrelationID is not returned.

Note: GetCategories is designed to retrieve very large sets of metadata that change once a day or less often. To improve performance, these calls return cached responses when you request all available data (with no filters). When this occurs, the MessageID and CorrelationID fields aren't applicable. However, if you specify an input filter to reduce the amount of data returned, the calls retrieve the latest data (not cached). When this occurs, MessageID and CorrelationID are applicable.
Errors ErrorType Conditionally,
repeatable: [0..*]
A list of application-level errors (if any) that occurred when eBay processed the request.
Errors.ErrorClassification ErrorClassificationCodeType Conditionally API errors are divided between two classes: system errors and request errors.

Applicable values:

CustomCode
(out) Reserved for internal or future use.
RequestError
(out) An error has occurred either as a result of a problem in the sending application or because the application's end-user has attempted to submit invalid data (or missing data). In these cases, do not retry the request. The problem must be corrected before the request can be made again. If the problem is due to something in the application (such as a missing required field), the application must be changed. If the problem is a result of end-user data, the application must alert the end-user to the problem and provide the means for the end-user to correct the data. Once the problem in the application or data is resolved, resend the request to eBay with the corrected data.
SystemError
(out) Indicates that an error has occurred on the eBay system side, such as a database or server down. An application can retry the request as-is a reasonable number of times (eBay recommends twice). If the error persists, contact Developer Technical Support. Once the problem has been resolved, the request may be resent in its original form.

Code so that your app gracefully handles any future changes to this list.
Errors.ErrorCode token Conditionally A unique code that identifies the particular error condition that occurred. Your application can use error codes as identifiers in your customized error-handling algorithms.

See Errors By Number.

Errors.ErrorParameters ErrorParameterType Conditionally,
repeatable: [0..*]
This optional element carries a list of context-specific error variables that indicate details about the error condition. These are useful when multiple instances of ErrorType are returned.
Errors.ErrorParameters
  [ attribute ParamID ]
string Conditionally This optional element carries a list of context-specific error variables that indicate details about the error condition. These are useful when multiple instances of ErrorType are returned.
Errors.ErrorParameters.Value string Conditionally This is the value of the request parameter noted in the ParamID attribute. So, if the ParamID value was ItemID, the value in this field would be the actual value of that ItemID.
Errors.LongMessage string Conditionally A more detailed description of the condition that raised the error.
Errors.SeverityCode SeverityCodeType Conditionally Indicates whether the error is a severe error (causing the request to fail) or an informational error (a warning) that should be communicated to the user.

Applicable values:

CustomCode
(out) Reserved for internal or future use.
Error
(out) The request that triggered the error was not processed successfully. When a serious application-level error occurs, the error is returned instead of the business data.

If the source of the problem is within the application (such as a missing required element), change the application before you retry the request.
  • If the problem is due to end-user input data, please alert the end-user to the problem and provide the means for them to correct the data. Once the problem in the application or data is resolved, you can attempt to re-send the request to eBay.
  • If the source of the problem is on eBay's side, An application can retry the request as-is a reasonable number of times (eBay recommends twice). If the error persists, contact Developer Technical Support. Once the problem has been resolved, the request may be resent in its original form.


See the Error handling section of the Making a Trading API call guide for more information.
Warning
(out) The request was processed successfully, but something occurred that may affect your application or the user. For example, eBay may have changed a value the user sent in. In this case, eBay returns a normal, successful response and also returns the warning.

When a warning occurs, the error is returned in addition to the business data. In this case, you do not need to retry the request (as the original request was successful). However, depending on the cause or nature of the warning, you might need to contact either the end user or eBay to effect a long term solution to the problem to prevent it from reoccurring in the future.

Code so that your app gracefully handles any future changes to this list.
Errors.ShortMessage string Conditionally A brief description of the condition that raised the error.
HardExpirationWarning string Conditionally Expiration date of the user's authentication token. Only returned within the 7-day period prior to a token's expiration. To ensure that user authentication tokens are secure and to help avoid a user's token being compromised, tokens have a limited life span. A token is only valid for a period of time (set by eBay). After this amount of time has passed, the token expires and must be replaced with a new token.
Timestamp dateTime Always This value represents the date and time when eBay processed the request. The time zone of this value is GMT and the format is the ISO 8601 date and time format (YYYY-MM-DDTHH:MM:SS.SSSZ). See the Time Values section in the eBay Features Guide for information about this time format and converting to and from the GMT time zone.

Note: GetCategories and other Trading API calls are designed to retrieve very large sets of metadata that change once a day or less often. To improve performance, these calls return cached responses when you request all available data (with no filters). When this occurs, this time value reflects the time the cached response was created. Thus, this value is not necessarily when the request was processed. However, if you specify an input filter to reduce the amount of data returned, the calls retrieve the latest data (not cached). When this occurs, this time value does reflect when the request was processed.
Version string Always The version of the response payload schema. Indicates the version of the schema that eBay used to process the request. See the Standard Data for All Calls section in the eBay Features Guide for information on using the response version when troubleshooting CustomCode values that appear in the response.



Detail Controls


DetailLevel

The DetailLevel input field influences which call-specific fields may be returned. (All standard output fields are returned regardless of DetailLevel.)

The none column indicates the fields that are returned when you do not specify a DetailLevel.

YThe field is always returned.
(Y)The field is conditionally returned. See the field documentation for clarification of conditions.
-The field is not returned.

Output Field none ReturnAll
CategoryArray-Y
CategoryArray.Category-(Y)
CategoryArray.Category.AutoPayEnabled-(Y)
CategoryArray.Category.B2BVATEnabled-(Y)
CategoryArray.Category.BestOfferEnabled-(Y)
CategoryArray.Category.CategoryID-Y
CategoryArray.Category.CategoryLevel-Y
CategoryArray.Category.CategoryName-Y
CategoryArray.Category.CategoryParentID-Y
CategoryArray.Category.Expired-Y
CategoryArray.Category.LeafCategory-Y
CategoryArray.Category.LSD-Y
CategoryArray.Category.ORPA-Y
CategoryArray.Category.ORRA-(Y)
CategoryArray.Category.Virtual-Y
CategoryCount-Y
CategoryVersionYY
MinimumReservePriceYY
ReduceReserveAllowedYY
ReservePriceAllowedYY
UpdateTimeYY



Samples

New to making API calls? Please see Making a Call.

Note: Some item IDs, user IDs, or other data in these samples might no longer be active on eBay. If necessary, you can substitute current eBay data in your requests.

Available samples:

Sample: Basic Call

Retrieves the current category version.

Description

This basic sample has no input parameters and returns the current version of the category hierarchy in CategoryVersion. The XML sample uses the X-EBAY-API-SITEID header value to determine the target eBay site (in this case, X-EBAY-API-SITEID equals 0, indicating the US eBay site).

Use this simple call to get the latest version number of the category hierarchy. Compare the version number returned with the version of your stored category data to determine if your stored category data needs updating.

Input

XML format.

<?xml version="1.0" encoding="utf-8"?>
<GetCategoriesRequest xmlns="urn:ebay:apis:eBLBaseComponents">
  <RequesterCredentials>
    <eBayAuthToken>A*******3</eBayAuthToken>
  </RequesterCredentials>
</GetCategoriesRequest> 

Output

XML format.
<GetCategoriesResponse xmlns="urn:ebay:apis:eBLBaseComponents">
  <Timestamp>2019-10-01T11:20:26.219Z</Timestamp>
  <Ack>Success</Ack>
  <Version>1119</Version>
  <Build>E1119_CORE_APICATALOG_19043596_R1</Build>
  <UpdateTime>2019-06-11T03:16:04.000Z</UpdateTime>
  <CategoryVersion>121</CategoryVersion>
  <ReservePriceAllowed>true</ReservePriceAllowed>
  <MinimumReservePrice>0.0</MinimumReservePrice>
</GetCategoriesResponse>

Back to list of samples

Sample: Complete Category Hierarchy

Retrieves a hierarchical list of all categories, with full details, for the specified eBay site.

Description

This sample retrieves all the details for the US eBay site (Site ID 0) category hierarchy. The full output for this call is well over 200,000 lines and it is possible for the call to time out. The sample output shown is an abbreviated version of the full output.

The recommended process for getting comprehensive category information is described in the Knowledge Base article Best practices for GetCategories API call. For more information about retrieving the category hierarchy, see Retrieving the Category Hierarchy for a Site in the eBay Features Guide.

Input

The critical input for this sample is DetailLevel with a value of ReturnAll. You can set CategorySiteID if you need to override the Site ID set in the XML headers.

XML format.

<?xml version="1.0" encoding="utf-8"?>
<GetCategoriesRequest xmlns="urn:ebay:apis:eBLBaseComponents">
  <RequesterCredentials>
    <eBayAuthToken>A*******3</eBayAuthToken>
  </RequesterCredentials>
  <CategorySiteID>0</CategorySiteID>
  <DetailLevel>ReturnAll</DetailLevel>
  <LevelLimit>7</LevelLimit>
  <ViewAllNodes>true</ViewAllNodes>
</GetCategoriesRequest> 

Output

Each Category node in the response contains information needed to build a category tree. The data includes information reflecting the CategoryID, CategoryName, CategoryParentID, CategoryLevel, and LeafCategory status of each category.

XML format.

  2018-10-29T21:34:24.627Z
  Success
  1077
  E1077_CORE_APICATALOG_18794058_R1
  
    
      true
      true
      20081
      1
      Antiques
      20081
    
    
      true
      true
      37903
      2
      Antiquities
      20081
    

    ...

    
			true
			true
			183625
			3
			LL Child Revived 1
			183627
			true
		
		
			true
			true
			178211
			3
			LL Child Revived 2
			183627
			true
		
	
	19169
	2018-08-01T02:57:25.000Z
	119
	true
	0.0


Back to list of samples



Change History

Change Date Description
1019
2017-06-09
  • CategoryType.CategoryName (modified): The maximum length of a single eBay category name has increased from 30 to 50 characters
0551
2008-02-07
  • CategoryArray.Category.AutoPayEnabled (modified): If this field is to be included in the response (e.g. per the DetailLevel specified in the request), only returned if true. Not returned if false or if not set by eBay.
  • CategoryArray.Category.B2BVATEnabled (modified): If this field is to be included in the response (e.g. per the DetailLevel specified in the request), only returned if true. Not returned if false or if not set by eBay.
  • CategoryArray.Category.BestOfferEnabled (modified): If this field is to be included in the response (e.g. per the DetailLevel specified in the request), only returned if true. Not returned if false or if not set by eBay.
  • CategoryArray.Category.Expired (modified): If this field is to be included in the response (e.g. per the DetailLevel specified in the request), only returned if true. Not returned if false or if not set by eBay.
  • CategoryArray.Category.IntlAutosFixedCat (modified): If this field is to be included in the response (e.g. per the DetailLevel specified in the request), only returned if true. Not returned if false or if not set by eBay.
  • CategoryArray.Category.LeafCategory (modified): If this field is to be included in the response (e.g. per the DetailLevel specified in the request), only returned if true. Not returned if false or if not set by eBay.
  • CategoryArray.Category.LSD (modified): If this field is to be included in the response (e.g. per the DetailLevel specified in the request), only returned if true. Not returned if false or if not set by eBay.
  • CategoryArray.Category.ORPA (modified): If this field is to be included in the response (e.g. per the DetailLevel specified in the request), only returned if true. Not returned if false or if not set by eBay.
  • CategoryArray.Category.ORRA (modified): If this field is to be included in the response (e.g. per the DetailLevel specified in the request), only returned if true. Not returned if false or if not set by eBay.
  • CategoryArray.Category.SellerGuaranteeEligible (modified): If this field is to be included in the response (e.g. per the DetailLevel specified in the request), only returned if true. Not returned if false or if not set by eBay.
  • CategoryArray.Category.Virtual (modified): If this field is to be included in the response (e.g. per the DetailLevel specified in the request), only returned if true. Not returned if false or if not set by eBay.
  • GetCategories.ReduceReserveAllowed (modified): If this field is to be included in the response (e.g. per the DetailLevel specified in the request), only returned if true. Not returned if false or if not set by eBay.
  • GetCategories.ReservePriceAllowed (modified): If this field is to be included in the response (e.g. per the DetailLevel specified in the request), only returned if true. Not returned if false or if not set by eBay.
0499
2007-02-07
  • Currency, ReduceReserveInclusive, ReservePriceInclusive (modified): Deleted previously deprecated objects from the latest schema. Some of these objects are still supported with lower request versions. See Deprecated Objects.