# Mercado Libre Categories API Documentation

Without category_id the endpoint lists the root categories of the site (about 30), each with its item count. With category_id it returns that category with its path from the root and its child categories, each with an item count. Walk the tree by sending a child id as the next category_id. Failed requests (404, 422, 503) are never billed. A valid answer with zero rows is a successful, billable 200.

- **Documentation:** [https://scrappa.co/docs/mercadolibre-api/mercadolibre_categories](https://scrappa.co/docs/mercadolibre-api/mercadolibre_categories)
- **API group:** Mercado Libre API
- **Endpoint:** `GET https://scrappa.co/api/mercadolibre/categories`

## Authentication

Send your Scrappa API key in the `X-API-KEY` request header. Paid endpoints also support accountless x402 payments when called without an API key.

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `site` | string | No | Country site id, for example MLA. Required when category_id is empty. |
| `category_id` | string | No | Category id, for example MLA1574. Leave empty to list the root categories of the site. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/mercadolibre/categories?site=MLA&category_id=MLA1574"
```

## Example response

```json
{
    "success": true,
    "data": {
        "id": "MLA1574",
        "name": "Hogar, Muebles y Jard\u00edn",
        "permalink": "https://www.mercadolibre.com.ar/c/hogar-muebles-y-jardin",
        "total_items": 25108499,
        "path": [
            {
                "id": "MLA1574",
                "name": "Hogar, Muebles y Jard\u00edn"
            }
        ],
        "children": [
            {
                "id": "MLA1631",
                "name": "Adornos y Decoraci\u00f3n del Hogar",
                "total_items": 7060835
            },
            {
                "id": "MLA1592",
                "name": "Bazar y Cocina",
                "total_items": 5748428
            }
        ]
    },
    "meta": {
        "endpoint_family": "categories",
        "billable": true
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 404 | Not Found | The item, category or store does not exist on this site. This response is not billable. |
| 422 | Validation Error | A parameter is invalid: unknown site, an id that does not belong to the site, a limit out of range, rating other than 1 to 5, or a zip code of another country. This response is not billable. |
| 503 | Service Unavailable | The service could not obtain a complete result from Mercado Libre. This response is not billable. |

## More Scrappa resources

- [API documentation](https://scrappa.co/docs)
- [Full LLM-readable API reference](https://scrappa.co/llms-full.txt)
- [OpenAPI specification](https://scrappa.co/docs/api.json)
- [Pricing](https://scrappa.co/pricing)
