Core APIs
Categories API
List and Search
8 min
list and search categories get get /categories the categories api exposes just one endpoint /categories you can use this endpoint to list or search for categories on a given amazon domain categories are expressed in a hierarchical structure, each category may have one or more child categories as determined by the has children property you can retrieve the child categories of a given category by passing the parent category id in the parent id parameter to retrieve the top level categories make a request without any parent id top level categories have their is root=true property set to true parameters the following querystring (http get) parameters allow you to refine the results returned by the categories api parameter required description api key required the api key for your account domain required filters the categories returned to only those from the amazon domain https //docs trajectdata com/rainforestapi/product data api/reference/amazon domains i e domain=amazon de type optional determines the type of category to search for valid values are standard for regular amazon categories compatible with the category id parameter on type=search or type=category requests bestsellers , gift ideas , most wished for , movers and shakers or new releases for bestseller amazon categories compatible with the category id parameter on type=bestseller requests deals for deals amazon categories compatible with the category id parameter on type=deals requests defaults to standard when the type parameter is not specified id optional a single id of the category to retrieve note that id cannot be used when parent id or search term are used parent id optional the id of the parent category to retrieve child categories for note that parent id cannot be used when id or search term are used search term optional searches the entire category hierarchy for categories containing the search term i e search term=appliances (to return only categories containing the string appliances ) note that search term cannot be used when id or parent id are used results the categories api returns the following properties true falsefalse left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type example listing root categories in the example below we retrieve all top level (root) categories for the amazon com domain curl l get https //api rainforestapi com/categories \\ d api key="demo" \\ d domain="amazon com"const axios = require('axios'); axios get('https //api rainforestapi com/categories?api key=demo\&domain=amazon com') then(response => { const apiresponse = response data; console log("categories ", json stringify(apiresponse, 0, 2); }) catch(error => { console error(error); });import requests import json params = { 'api key' 'demo', 'domain' 'amazon com' } api result = requests get('https //api rainforestapi com/categories', { params }) api response = api result json() print "categories ", json dumps(api response)\<?php $querystring = http build query(\[ 'api key' => 'demo', 'domain' => 'amazon com', ]); $ch = curl init('https //api rainforestapi com/categories', $querystring); curl setopt($ch, curlopt returntransfer, true); curl setopt($ch, curlopt followlocation, true); \# the following options are required if you're using an outdated openssl version \# more details https //www openssl org/blog/blog/2021/09/13/letsencryptrootcertexpire/ curl setopt($ch, curlopt ssl verifyhost, false); curl setopt($ch, curlopt ssl verifypeer, false); curl setopt($ch, curlopt timeout, 180); $json = curl exec($ch); curl close($ch); $api result = json decode($json, true); print r($api result); ?> the categories api responds with the top level (root) categories for amazon com in the categories property { "request info" { "success" true, "credits used" 1, "credits remaining" 999, "credits used this request" 1, "credits reset at" "2020 01 01t00 00 00 000z" }, "categories" \[ { "domain" "amazon com", "id" "2619526011", "name" "appliances", "has children" true, "is root" true, "path" "appliances" }, { "domain" "amazon com", "id" "2617942011", "name" "arts, crafts & sewing", "has children" true, "is root" true, "path" "arts, crafts & sewing" } ] } example listing child categories in the example below we retrieve child categories for a parent category with id 2619526011 on amazon com curl l get https //api rainforestapi com/categories \\ d api key="demo" \\ d parent id="2619526011" \\ d domain="amazon com"const axios = require('axios'); axios get('https //api rainforestapi com/categories?api key=demo\&parent id=2619526011\&domain=amazon com') then(response => { const apiresponse = response data; console log("categories ", json stringify(apiresponse, 0, 2); }) catch(error => { console error(error); });import requests import json params = { 'api key' 'demo', 'parent id' '2619526011', 'domain' 'amazon com' } api result = requests get('https //api rainforestapi com/categories', { params }) api response = api result json() print "categories ", json dumps(api response)\<?php $querystring = http build query(\[ 'api key' => 'demo', 'parent id' => '2619526011', 'domain' => 'amazon com', ]); $ch = curl init('https //api rainforestapi com/categories', $querystring); curl setopt($ch, curlopt returntransfer, true); curl setopt($ch, curlopt followlocation, true); \# the following options are required if you're using an outdated openssl version \# more details https //www openssl org/blog/blog/2021/09/13/letsencryptrootcertexpire/ curl setopt($ch, curlopt ssl verifyhost, false); curl setopt($ch, curlopt ssl verifypeer, false); curl setopt($ch, curlopt timeout, 180); $json = curl exec($ch); curl close($ch); $api result = json decode($json, true); print r($api result); ?> the categories api responds with the child categories for parent category with id 2619526011 on amazon com in the categories property { "request info" { "success" true }, "current category" { "domain" "amazon com", "id" "2619526011", "name" "appliances", "has children" true, "is root" true, "path" "appliances" }, "categories" \[ { "domain" "amazon com", "id" "17921061011", "name" "refrigerators, freezers & ice makers", "has children" true, "is root" false, "path" "appliances > refrigerators, freezers & ice makers", "parent id" "2619526011", "parent name" "appliances" }, { "domain" "amazon com", "id" "18116194011", "name" "laundry appliances", "has children" true, "is root" false, "path" "appliances > laundry appliances", "parent id" "2619526011", "parent name" "appliances" } ] } next steps categories api overview https //docs trajectdata com/rainforestapi/categories api/overview