Core APIs
Categories API
List and Search
8 min
list and search categories get get /categories the categories api exposes just one endpoint /categories 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 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 curl l get https //api bluecartapi com/categories \\ d api key="demo"const axios = require('axios'); axios get('https //api bluecartapi com/categories?api key=demo') 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' } api result = requests get('https //api bluecartapi com/categories', { params }) api response = api result json() print "categories ", json dumps(api response)\<?php $querystring = http build query(\[ 'api key' => 'demo' ]); $ch = curl init('https //api bluecartapi 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 in the categories property { "request info" { "success" true }, "categories" \[ { "id" "30dbe538899dd8488f134d3a20ac10d6783c1701", "name" "clothing", "has children" false, "is root" true, "path" "clothing", "link" "https //www walmart com/cp/clothing/5438" }, { "id" "f05e1591a5e9f1a4ed549929915a765c3c0fb534", "name" "patio & garden", "has children" false, "is root" true, "path" "patio & garden", "link" "https //www walmart com/cp/patio garden/5428" }, { "id" "7c1cc4ed255d79efaecc18c1d4de912c77c00401", "name" "sports & outdoors", "has children" true, "is root" true, "path" "sports & outdoors", "link" "https //www walmart com/cp/sports outdoors/4125" } ] } example listing child categories in the example below we retrieve child categories for a parent category with id 7c1cc4ed255d79efaecc18c1d4de912c77c00401 curl l get https //api bluecartapi com/categories \\ d api key="demo" \\ d parent id="7c1cc4ed255d79efaecc18c1d4de912c77c00401"const axios = require('axios'); axios get('https //api bluecartapi com/categories?api key=demo\&parent id=7c1cc4ed255d79efaecc18c1d4de912c77c00401') 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' '7c1cc4ed255d79efaecc18c1d4de912c77c00401' } api result = requests get('https //api bluecartapi com/categories', { params }) api response = api result json() print "categories ", json dumps(api response)\<?php $querystring = http build query(\[ 'api key' => 'demo', 'parent id' => '7c1cc4ed255d79efaecc18c1d4de912c77c00401' ]); $ch = curl init('https //api bluecartapi 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 7c1cc4ed255d79efaecc18c1d4de912c77c00401 in the categories property { "request info" { "success" true }, "current category" { "id" "7c1cc4ed255d79efaecc18c1d4de912c77c00401", "name" "sports & outdoors", "has children" true, "is root" true, "path" "sports & outdoors", "link" "https //www walmart com/cp/sports outdoors/4125" }, "categories" \[ { "id" "b5af583c3248d6fa46ddb6ed428e8c936a4373fb", "name" "recreation", "has children" false, "is root" false, "path" "sports & outdoors > recreation", "link" "https //www walmart com/cp/recreation/1224931", "parent id" "7c1cc4ed255d79efaecc18c1d4de912c77c00401", "parent name" "sports & outdoors" }, { "id" "376997ff0443257d205182dda381cedb234e1431", "name" "outdoor sports", "has children" false, "is root" false, "path" "sports & outdoors > outdoor sports", "link" "https //www walmart com/cp/outdoor sports/546956", "parent id" "7c1cc4ed255d79efaecc18c1d4de912c77c00401", "parent name" "sports & outdoors" } ] } next steps categories api overview https //docs trajectdata com/bluecartapi/categories api/overview