GET/category_tree/{category_tree_id}
This method retrieves the complete category tree that is identified by the category_tree_id parameter. The value of category_tree_id was returned by the getDefaultCategoryTreeId method in the categoryTreeId field. The response contains details of all nodes of the specified eBay category tree, as well as the eBay marketplaces that use this category tree.
Note: This method can return a very large payload, so gzip compression is supported. To enable gzip compression, include the Accept-Encoding
header and set its value to gzip
as shown below: Accept-Encoding: gzip
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 |
---|---|---|
category_tree_id | string | The unique identifier of the eBay category tree. The category tree ID for an eBay marketplace can be retrieved using the getDefaultCategoryTreeId method. Occurrence: Required |
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 |
---|---|---|
Accept-Encoding | string | This header indicates the compression-encoding algorithms the client accepts for the response. This value should be set to gzip . For more information, refer to HTTP request headers. Occurrence: Optional |
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
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 |
---|---|---|
applicableMarketplaceIds | array of MarketplaceIdEnum | A list of one or more identifiers of the eBay marketplaces that use this category tree. Occurrence: Always |
categoryTreeId | string | The unique identifier of this eBay category tree. Occurrence: Always |
categoryTreeVersion | string | The version of this category tree. It's a good idea to cache this value for comparison so you can determine if this category tree has been modified in subsequent calls. Occurrence: Always |
rootCategoryNode | CategoryTreeNode | Contains details of all nodes of the category tree hierarchy, starting with the root node and down to the leaf nodes. This is a recursive structure. Occurrence: Always |
rootCategoryNode.category | Category | Contains details about the current category tree node. Occurrence: Always |
rootCategoryNode.category.categoryId | string | The unique identifier of the eBay category within its category tree. Occurrence: Always |
rootCategoryNode.category.categoryName | string | The name of the category identified by categoryId. Occurrence: Always |
rootCategoryNode.categoryTreeNodeLevel | integer | The absolute level of the current category tree node in the hierarchy of its category tree. Occurrence: Always |
rootCategoryNode.childCategoryTreeNodes | array of CategoryTreeNode | An array of one or more category tree nodes that are the immediate children of the current category tree node, as well as their children, recursively down to the leaf nodes. Occurrence: Conditional |
rootCategoryNode.childCategoryTreeNodes.category | Category | Contains details about the current category tree node. Occurrence: Always |
rootCategoryNode.childCategoryTreeNodes.category.categoryId | string | The unique identifier of the eBay category within its category tree. Occurrence: Always |
rootCategoryNode.childCategoryTreeNodes.category.categoryName | string | The name of the category identified by categoryId. Occurrence: Always |
rootCategoryNode.childCategoryTreeNodes.categoryTreeNodeLevel | integer | The absolute level of the current category tree node in the hierarchy of its category tree. Occurrence: Always |
rootCategoryNode.childCategoryTreeNodes.childCategoryTreeNodes | array of CategoryTreeNode | An array of one or more category tree nodes that are the immediate children of the current category tree node, as well as their children, recursively down to the leaf nodes. Occurrence: Conditional |
rootCategoryNode.childCategoryTreeNodes.childCategoryTreeNodes.category | Category | Contains details about the current category tree node. Occurrence: Always |
rootCategoryNode.childCategoryTreeNodes.childCategoryTreeNodes.category.categoryId | string | The unique identifier of the eBay category within its category tree. Occurrence: Always |
rootCategoryNode.childCategoryTreeNodes.childCategoryTreeNodes.category.categoryName | string | The name of the category identified by categoryId. Occurrence: Always |
rootCategoryNode.childCategoryTreeNodes.childCategoryTreeNodes.categoryTreeNodeLevel | integer | The absolute level of the current category tree node in the hierarchy of its category tree. Occurrence: Always |
rootCategoryNode.childCategoryTreeNodes.childCategoryTreeNodes.childCategoryTreeNodes | array of CategoryTreeNode | An array of one or more category tree nodes that are the immediate children of the current category tree node, as well as their children, recursively down to the leaf nodes. Occurrence: Conditional |
rootCategoryNode.childCategoryTreeNodes.childCategoryTreeNodes.leafCategoryTreeNode | boolean | A value of Occurrence: Conditional |
rootCategoryNode.childCategoryTreeNodes.childCategoryTreeNodes.parentCategoryTreeNodeHref | string | The href portion of the getCategorySubtree call that retrieves the subtree below the parent of this category tree node. Occurrence: Conditional |
rootCategoryNode.childCategoryTreeNodes.leafCategoryTreeNode | boolean | A value of Occurrence: Conditional |
rootCategoryNode.childCategoryTreeNodes.parentCategoryTreeNodeHref | string | The href portion of the getCategorySubtree call that retrieves the subtree below the parent of this category tree node. Occurrence: Conditional |
rootCategoryNode.leafCategoryTreeNode | boolean | A value of Occurrence: Conditional |
rootCategoryNode.parentCategoryTreeNodeHref | string | The href portion of the getCategorySubtree call that retrieves the subtree below the parent of this category tree node. Occurrence: Conditional |
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 |
404 | Not Found |
500 | Internal Server Error |
Error codes
For more on errors, plus the codes of other common errors, see Handling errors.
Code | Domain | Category | Meaning |
---|---|---|---|
62000 | API_TAXONOMY | APPLICATION | There was a problem with an eBay internal system or process. Contact eBay developer support for assistance. |
62004 | API_TAXONOMY | REQUEST | The specified category tree ID was not found. |
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 a complete category tree
This sample retrieves the complete content of the specified category tree.
Input
Use the category_tree_id path parameter to specify the category tree to retrieve. It is not necessary to specify an eBay marketplace.
GEThttps://api.ebay.com/commerce/taxonomy/v1/category_tree/0
Output
A successful call returns the complete category tree specified, from the root node to all leaf nodes of the tree. In this sample, the returned category tree contains almost 20,000 categories, so the response shown here has most of the nodes removed for easier viewing.