Set categories for your products
Contents
→Categories by site →Categories JSON →Name →Path from root →Finding the best category for your item
Categories by site
The /sites resource can give you the category structure for a particular country, in this case Argentina.
curl -X GET https://api.mercadolibre.com/sites/MLA/categories
"categories": [
{
"id": "MLA5725",
"name": "Accesorios para Vehiculos",
},
{
"id": "MLA1071",
"name": "Animales y Mascotas",
},
{
"id": "MLA1367",
"name": "Antigüedades",
},
{
"id": "MLA1743",
"name": "Autos, Motos y Otros",
},
For a second level categories, or information related to specific categories, you have to use the Categories resource, sending the category Id as a URL parameter. The next example shows the “Animales y Mascotas" category:
https://api.mercadolibre.com/categories/MLA1071
{
"id": "MLA1071",
"name": "Animales y Mascotas",
"permalink": "http://home.mercadolibre.com.ar/animales-y-mascotas",
"total_items_in_this_category": "30434",
"path_from_root": [
{
"id": "MLA1071",
"name": "Animales y Mascotas",
},
],
"children_categories": [
{
"id": "MLA1100",
"name": "Aves",
"total_items_in_this_category": "1430",
},
{
"id": "MLA1117",
"name": "Caballos",
"total_items_in_this_category": "1092",
},
.
.
As you can see, you get the “path_from_root” and children_categories attributes. Use these attributes to browse through the category tree and find the specific category for your item.
Categories JSON
Make a request to a specific category will allow you to know the information and specific description of it. Below you will find the description of some of these attributes.
Request:
curl -X GET https://api.mercadolibre.com/categories/$CATEGORY_ID
Ejemplo:
curl -X GET https://api.mercadolibre.com/categories/MLA1271
Respuesta:
{
"id": "MLA1271",
"name": "Perfumes",
"picture": "http://resources.mlstatic.com/category/images/ebc2e89f-1664-45eb-8354-686cde860c05.png",
"permalink": null,
"total_items_in_this_category": 58377,
"path_from_root": [
{
"id": "MLA1246",
"name": "Belleza y Cuidado Personal"
},
{
"id": "MLA1271",
"name": "Perfumes"
}
],
"children_categories": [
],
"attribute_types": "attributes",
"settings": {
"adult_content": false,
"buying_allowed": true,
"buying_modes": [
"buy_it_now",
"auction"
],
"catalog_domain": "MLA-PERFUMES",
"coverage_areas": "not_allowed",
"currencies": [
"ARS"
],
"fragile": false,
"immediate_payment": "required",
"item_conditions": [
"new",
"not_specified",
"used"
],
"items_reviews_allowed": false,
"listing_allowed": true,
"max_description_length": 50000,
"max_pictures_per_item": 12,
"max_pictures_per_item_var": 10,
"max_sub_title_length": 70,
"max_title_length": 60,
"maximum_price": null,
"minimum_price": 22,
"mirror_category": null,
"mirror_master_category": null,
"mirror_slave_categories": [
],
"price": "required",
"reservation_allowed": "not_allowed",
"restrictions": [
],
"rounded_address": false,
"seller_contact": "not_allowed",
"shipping_modes": [
"custom",
"me1",
"me2",
"not_specified"
],
"shipping_options": [
"carrier",
"custom"
],
"shipping_profile": "optional",
"show_contact_information": false,
"simple_shipping": "optional",
"stock": "required",
"sub_vertical": "beauty",
"subscribable": false,
"tags": [
],
"vertical": "consumer_goods",
"vip_subdomain": "articulo",
"buyer_protection_programs": [
],
"status": "enabled"
},
"meta_categ_id": null,
"attributable": false,
"date_created": "2018-04-25T08:12:56.000Z"
}
Name
This attribute shows a human-friendly label. You cannot use this label to search items. If you are interested in searching using categories ids, you can use the following request:
curl -X GET https://api.mercadolibre.com/sites/MLA/search?category=MLA5726
See more on search items by category article.
Path from root
When you are in a category you can know the path from root to the category selected. Take a look how Mercado Libre uses this path to show the item’s category:
Finding the best category for your item
A leaf category is the last category on the tree and those are the only categories where you can post items. Choosing the right category for your item will determine how quickly buyers will find your item and will improve your chances of selling it. For this reason, we highly recommend to use our Category predictor tool before listing an item. Maybe some categories won't have a good suggestions, so you'll have to make the user of your system to map manually the categories for his products. The simplest process could be to use the Category API and navigate the category tree to detect the best option. You must use only those categories retrieved from the API which don’t have subcategories related. Another option could be to find similar items in Mercado Libre and use their category.