---
agentTools:
  projectIndex: https://sellerapis.snapdeal.com/v1.0/llms.txt
---

# Get Categories

Get parent categories for given search key .if search key is not provided it will give all perent categories

[block:callout]
{
  "type": "info",
  "title": "Note :",
  "body": "Default pageNumber = 1\n           Default pageSize = 10"
}
[/block]

[block:html]
{
  "html": "<div></div>\n<h4>Request</h4>\n<style></style>"
}
[/block]

[block:parameters]
{
  "data": {
    "h-0": "ParameterName",
    "h-1": "DataType",
    "h-2": "ParameterType",
    "h-3": "Requirement",
    "h-4": "Description",
    "1-0": "pageNumber",
    "1-4": "pageNumber used for pagination",
    "2-0": "pageSize",
    "2-4": "pageSize used for pagination",
    "1-3": "Optional",
    "2-3": "Optional",
    "1-1": "int",
    "2-1": "int",
    "1-2": "Query",
    "2-2": "Query",
    "0-0": "searchKey",
    "0-3": "Mandatory",
    "0-4": "Text input for searching list of primary categories",
    "0-1": "String",
    "0-2": "Query"
  },
  "cols": 5,
  "rows": 3
}
[/block]

[block:html]
{
  "html": "<div></div>\n<h4>Response</h4>\n<style></style>"
}
[/block]

metadata :

[block:parameters]
{
  "data": {
    "h-0": "FieldName",
    "h-1": "DataType",
    "h-2": "Description",
    "0-0": "requestId",
    "1-0": "clientId",
    "2-0": "responseTime",
    "3-0": "requestedURI",
    "4-0": "message",
    "0-2": "Unique ID for the request",
    "1-2": "PartnerI Id",
    "2-2": "Response Time",
    "3-2": "Requested URI",
    "4-2": "Error message",
    "0-1": "String",
    "1-1": "String",
    "3-1": "String",
    "4-1": "String",
    "2-1": "Long"
  },
  "cols": 3,
  "rows": 5
}
[/block]

payload :

[block:parameters]
{
  "data": {
    "h-0": "FieldName",
    "h-1": "DataType",
    "h-2": "Description",
    "0-0": "results",
    "1-0": "pageNumber",
    "2-0": "pageSize",
    "1-2": "pageNumber",
    "2-2": "pageSize",
    "0-1": "List<CategoryDTO>",
    "0-2": "List of CategoryDTOs",
    "1-1": "int",
    "2-1": "int"
  },
  "cols": 3,
  "rows": 3
}
[/block]

CategoryDTO :

[block:parameters]
{
  "data": {
    "h-0": "FieldName",
    "h-1": "DataType",
    "h-2": "Description",
    "0-0": "id",
    "0-1": "Integer",
    "0-2": "Category Id",
    "1-0": "name",
    "2-0": "productType",
    "1-2": "Category Name",
    "2-2": "value false means category contains child categories.",
    "1-1": "String",
    "2-1": "boolean",
    "3-0": "categoryUrl",
    "3-1": "String",
    "3-2": "categoryUrl",
    "4-0": "parentCategory",
    "4-1": "CategoryDTO",
    "4-2": "parentCategory"
  },
  "cols": 3,
  "rows": 5
}
[/block]

[block:html]
{
  "html": "<div class=\"threes-nav\"><a href=\"http://sandbox-sellerapi.snapdeal.com/apidocs/index.html#!/Product_Listing/getCategories\" target=\"_blank\" class=\"btn btn-default\"><div class=\"fa fa-compass fa-right\"></div>Test in the&nbsp;<strong>API Explorer</strong></a></div>\n\n"
}
[/block]

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "API Settings",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "http://staging-apigateway.snapdeal.com/seller-api"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "name": "X-Auth-Token",
        "in": "header",
        "x-default": ""
      },
      "sec1": {
        "type": "apiKey",
        "name": "clientId",
        "in": "header",
        "x-default": "SellerAPITesting"
      },
      "sec2": {
        "type": "apiKey",
        "name": "x-seller-authz-token",
        "in": "header",
        "x-default": ""
      }
    }
  },
  "security": [
    {
      "sec0": [],
      "sec1": [],
      "sec2": []
    }
  ],
  "paths": {
    "/categories": {
      "get": {
        "summary": "Get Categories",
        "description": "Get parent categories for given search key .if search key is not provided it will give all perent categories",
        "operationId": "get-categories",
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"metadata\": {\n    \"requestId\": \"c2435b20-3ba0-4d3a-af58-05863592f5b6\",\n    \"clientId\": \"partnerId\",\n    \"responseTime\": 36,\n    \"requestedURI\": \"GET /categories\"\n  },\n  \"payload\": {\n    \"results\": [\n      {\n        \"id\": 36473,\n        \"name\": \"abc\",\n        \"productType\": false\n      },\n      {\n        \"id\": 1520,\n        \"name\": \"Appliances\",\n        \"productType\": false\n      },\n      {\n        \"id\": 1546,\n        \"name\": \"Automotive\",\n        \"productType\": false\n      },\n      {\n        \"id\": 1698,\n        \"name\": \"Cameras & Accessories\",\n        \"productType\": false\n      },\n      {\n        \"id\": 2976,\n        \"name\": \"Baby Care\",\n        \"productType\": false\n      },\n      {\n        \"id\": 1830,\n        \"name\": \"Eyewear\",\n        \"productType\": false\n      },\n      {\n        \"id\": 1858,\n        \"name\": \"Fashion Accessories\",\n        \"productType\": false\n      },\n      {\n        \"id\": 2103,\n        \"name\": \"Footwear\",\n        \"productType\": false\n      },\n      {\n        \"id\": 2913,\n        \"name\": \"Furniture\",\n        \"productType\": false\n      },\n      {\n        \"id\": 2208,\n        \"name\": \"Gaming\",\n        \"productType\": false\n      }\n    ],\n    \"pageNumber\": 1,\n    \"pageSize\": 10\n  }\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "metadata": {
                      "type": "object",
                      "properties": {
                        "requestId": {
                          "type": "string",
                          "example": "c2435b20-3ba0-4d3a-af58-05863592f5b6"
                        },
                        "clientId": {
                          "type": "string",
                          "example": "partnerId"
                        },
                        "responseTime": {
                          "type": "integer",
                          "example": 36,
                          "default": 0
                        },
                        "requestedURI": {
                          "type": "string",
                          "example": "GET /categories"
                        }
                      }
                    },
                    "payload": {
                      "type": "object",
                      "properties": {
                        "results": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "integer",
                                "example": 36473,
                                "default": 0
                              },
                              "name": {
                                "type": "string",
                                "example": "abc"
                              },
                              "productType": {
                                "type": "boolean",
                                "example": false,
                                "default": true
                              }
                            }
                          }
                        },
                        "pageNumber": {
                          "type": "integer",
                          "example": 1,
                          "default": 0
                        },
                        "pageSize": {
                          "type": "integer",
                          "example": 10,
                          "default": 0
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"metadata\": {\n    \"requestId\": \"a9193039-6742-4163-b46c-dd3db11275f0\",\n    \"message\": \"Missing client identifier in headers\",\n    \"responseTime\": 0,\n    \"requestedURI\": \"GET /categories\"\n  }\n}"
                  }
                },
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "metadata": {
                          "type": "object",
                          "properties": {
                            "requestId": {
                              "type": "string",
                              "example": "a9193039-6742-4163-b46c-dd3db11275f0"
                            },
                            "clientId": {
                              "type": "string",
                              "example": "partnerName"
                            },
                            "message": {
                              "type": "string",
                              "example": "Page number should be greater than 0"
                            },
                            "responseTime": {
                              "type": "integer",
                              "example": 0,
                              "default": 0
                            },
                            "requestedURI": {
                              "type": "string",
                              "example": "GET /categories"
                            }
                          }
                        }
                      }
                    },
                    {
                      "type": "object",
                      "properties": {
                        "metadata": {
                          "type": "object",
                          "properties": {
                            "requestId": {
                              "type": "string",
                              "example": "a9193039-6742-4163-b46c-dd3db11275f0"
                            },
                            "clientId": {
                              "type": "string",
                              "example": "partnerName"
                            },
                            "message": {
                              "type": "string",
                              "example": "Page size should be greater than 0"
                            },
                            "responseTime": {
                              "type": "integer",
                              "example": 0,
                              "default": 0
                            },
                            "requestedURI": {
                              "type": "string",
                              "example": "GET /categories"
                            }
                          }
                        }
                      }
                    },
                    {
                      "type": "object",
                      "properties": {
                        "metadata": {
                          "type": "object",
                          "properties": {
                            "requestId": {
                              "type": "string",
                              "example": "a9193039-6742-4163-b46c-dd3db11275f0"
                            },
                            "clientId": {
                              "type": "string",
                              "example": "partnerName"
                            },
                            "message": {
                              "type": "string",
                              "example": "page size excedded the maximum limit"
                            },
                            "responseTime": {
                              "type": "integer",
                              "example": 0,
                              "default": 0
                            },
                            "requestedURI": {
                              "type": "string",
                              "example": "GET /categories"
                            }
                          }
                        }
                      }
                    },
                    {
                      "type": "object",
                      "properties": {
                        "metadata": {
                          "type": "object",
                          "properties": {
                            "requestId": {
                              "type": "string",
                              "example": "a9193039-6742-4163-b46c-dd3db11275f0"
                            },
                            "message": {
                              "type": "string",
                              "example": "Missing client identifier in headers"
                            },
                            "responseTime": {
                              "type": "integer",
                              "example": 0,
                              "default": 0
                            },
                            "requestedURI": {
                              "type": "string",
                              "example": "GET /categories"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "503": {
            "description": "503",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"metadata\": {\n    \"requestId\": \"a9193039-6742-4163-b46c-dd3db11275f0\",\n    \"clientId\": \"partnerName\",\n    \"message\": \"Request unservicable\",\n    \"responseTime\": 0,\n    \"requestedURI\": \"GET /categories\"\n  }\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "metadata": {
                      "type": "object",
                      "properties": {
                        "requestId": {
                          "type": "string",
                          "example": "a9193039-6742-4163-b46c-dd3db11275f0"
                        },
                        "clientId": {
                          "type": "string",
                          "example": "partnerName"
                        },
                        "message": {
                          "type": "string",
                          "example": "Request unservicable"
                        },
                        "responseTime": {
                          "type": "integer",
                          "example": 0,
                          "default": 0
                        },
                        "requestedURI": {
                          "type": "string",
                          "example": "GET /categories"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": false,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "630541309807941f67a93274:56aa11da1801ac0d00881c23"
}
```