Set categories for your products
Contents
→Categories predictor ↳Mandatory parameters ↳Optional parameters ↳Response fields →Categories by site →Categories JSON →Name →Path from root
Categories predictor
Make a GET request to predict one article at a time and thus, you will be able to recognize the category with the attributes that you must load in order for the publication to have quality. Keep in mind that the answer will be made up of a list of predictions from the title provided, the first being the one with the highest probability.
Mandatory parameters
site_id: the site where you make the publication.
q: the title of the article to be predicted and must be completely in the language of the site.
Optional parameters
limit: By default, the limit will be 4 with a maximum of 8, so you could define a limit between 1 to 8.
target: It can be composed of core (Product) or classified (Classified) depending on the vertical in which you are publishing.
Request:
curl -X GET -H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com/sites/$SITE_ID/domain_discovery/search?q=$Q
Example:
curl -X GET -H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com/sites/MLA/domain_discovery/search?limit=1&q=celular%20iphone
Response:
[
{
"domain_id": "MLA-CELLPHONES",
"domain_name": "Celulares",
"category_id": "MLA1055",
"category_name": "Celulares y Smartphones",
"attributes": [
{
"id": "BRAND",
"value_id": "9344",
"value_name": "Apple"
},
{
"id": "LINE",
"value_id": "58993",
"value_name": "iPhone"
},
{
"id": "MODEL",
"value_id": "14608",
"value_name": "iPhone"
}
]
}
]
Response fields
domain_id: ID of the domain you predict for the article.
domain_name: domain name you predict.
category_id: ID of the category you predict for the article.
category_name: name of the category you predict.
attributes: list of attributes for the predicted category.
To get more information about path_from_root, shipping_modes and variations fields,check the /categories resource.
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:
Next: List products.