Documentación Mercado Libre

Descubre toda la información que debes conocer sobre las APIs de Mercado Libre.
circulos azuis em degrade

Documentación

Última actualización 30/05/2023

Sending tax data

Important:
This functionality is available only in Chile.

For the automatic invoicing of the items by Mercado Libre, the seller must first send the fiscal data of the products.


Send tax data

First, you must create the fiscal configurations before linking with an item.

Request:

curl -X POST -H 'Authorization: Bearer $ACCESS_TOKEN' -H "Content-Type: application/json" -d
{
    "query": "mutation createFiscalInformationMLC($input: CreateFiscalInformationMLCInput!) {\n    createFiscalInformationMLC(input: $input) {\n        sku\n        iva\n        description\n        ila\n\t\tretention\n\t\ttaxCode\n    }\n}",
    "variables": {
        "input": {
            "sku": "String",
            "iva": "19",
            "description": "String",
            "ila": "",
            "retention": "14",
            "taxCode": "14"
        }
    }
}

https://api.mercadolibre.com/fiscal_information/graphql

Example:

curl -X POST -H 'Authorization: Bearer $ACCESS_TOKEN' -H "Content-Type: application/json" -d
{
    "query": "mutation createFiscalInformationMLC($input: CreateFiscalInformationMLCInput!) {\n    createFiscalInformationMLC(input: $input) {\n        sku\n        iva\n        description\n        ila\n\t\tretention\n\t\ttaxCode\n    }\n}",
    "variables": {
        "input": {
            "sku": "DOCMLC1",
            "iva": "19",
            "description": "Tacho De Basura Set De 2, Piezas De12 Litros Marca Begonia",
            "ila": "",
            "retention": "14",
            "taxCode": "14"
        }
    }
}
https://api.mercadolibre.com/fiscal_information/graphql

Response:

{
    "data": {
        "createFiscalInformationMLC": {
            "sku": "DOCMLC1",
            "iva": "19",
            "description": "Tacho De Basura Set De 2, Piezas De12 Litros Marca Begonia",
            "ila": "",
            "retention": "14",
            "taxCode": "14"
        }
    }
}

Configure tax data by product/variation

After reporting the fiscal data, link the item through the SKU:

Request:

curl -X POST -H 'Authorization: Bearer $ACCESS_TOKEN' -H "Content-Type: application/json" -d
{
    "query": "mutation createFiscalInformationLinkToItem($input: CreateFiscalInformationLinkToItemInput!) {\n    createFiscalInformationLinkToItem(input: $input) {\n        itemId\n        variationId\n        type\n        components {\n            sku\n            quantity\n            percentageShare\n        }\n    }\n}",
    "variables": {
        "input": {
            "itemId": "String",
            "variationId": "String",
            "components": [
                {
                    "sku": "String",
                    "quantity": 1,
                    "percentageShare": 100
                }
            ]
        }
    }
}

https://api.mercadolibre.com/fiscal_information/graphql

Example:

curl -X POST -H 'Authorization: Bearer $ACCESS_TOKEN' -H "Content-Type: application/json" -d
{
    "query": "mutation createFiscalInformationLinkToItem($input: CreateFiscalInformationLinkToItemInput!) {\n    createFiscalInformationLinkToItem(input: $input) {\n        itemId\n        variationId\n        type\n        components {\n            sku\n            quantity\n            percentageShare\n        }\n    }\n}",
    "variables": {
        "input": {
            "itemId": "MLC1056231867",
            "variationId": "175219804700",
            "components": [
                {
                    "sku": "DOCMLC1",
                    "quantity": 1,
                    "percentageShare": 100
                }
            ]
        }
    }
}
https://api.mercadolibre.com/fiscal_information/graphql

Response:

{
    "data": {
        "createFiscalInformationLinkToItem": {
            "itemId": "MLC1056231867",
            "variationId": "175219804700",
            "components": [
              {
                "sku": "DOCMLC1",
                "quantity": 1,
                "percentageShare": 100
              }
            ]
        }
    }
}

When the item is unique, the variation_id field will be null.

Send and configure fiscal data by product/variation

You can also send the tax data and link to the item/variation in a single call:


Request:

curl -X POST -H 'Authorization: Bearer $ACCESS_TOKEN' -H "Content-Type: application/json" -d
{
    "query": "mutation($input: CreateOrUpdateFiscalInformationMLCAndLinkToItemInput!) {\n  createOrUpdateFiscalInformationMLCAndLinkToItem(input: $input) {\n    itemId\n    variationId\n    type\n    components {\n      quantity\n      percentageShare\n      fiscalInformation {\n        ... on FiscalInformationMLC {\n          sku\n          iva\n          description\n          ila\n          retention\n          taxCode\n          taxDescription\n        }\n      }\n    }\n  }\n}\n",
    "variables": {
        "input": {
            "itemId": "String",
            "variationId": "String",
            "components": [
                {
                    "quantity": 1,
                    "percentageShare": 100,
                    "sku": "String",
                    "iva": "19",
                    "description": "String",
                    "ila": "",
                    "retention": "14",
                    "taxCode": "14"
                }
            ]
        }
    }
}
https://api.mercadolibre.com/fiscal_information/graphql

Example:

curl -X POST -H 'Authorization: Bearer $ACCESS_TOKEN' -H "Content-Type: application/json" -d
{
    "query": "mutation($input: CreateOrUpdateFiscalInformationMLCAndLinkToItemInput!) {\n  createOrUpdateFiscalInformationMLCAndLinkToItem(input: $input) {\n    itemId\n    variationId\n    type\n    components {\n      quantity\n      percentageShare\n      fiscalInformation {\n        ... on FiscalInformationMLC {\n          sku\n          iva\n          description\n          ila\n          retention\n          taxCode\n          taxDescription\n        }\n      }\n    }\n  }\n}\n",
    "variables": {
        "input": {
            "itemId": "MLC1056231867",
            "variationId": "175219804700",
            "components": [
                {
                    "quantity": 1,
                    "percentageShare": 100,
                    "sku": "DOCMLC1",
                    "iva": "19",
                    "description": "Tacho De Basura Set De 2, Piezas De12 Litros Marca Begonia",
                    "ila": "",
                    "retention": "14",
                    "taxCode": "14"
                }
            ]
        }
    }
}

https://api.mercadolibre.com/fiscal_information/graphql

Response:

{


    "data": {
        "createOrUpdateFiscalInformationMLCAndLinkToItem": {
            "itemId": "MLC1056231867",
            "variationId": "175219804700",
            "type": "SINGLE",
            "components": [
                {
                    "quantity": 1,
                    "percentageShare": 100,
                    "fiscalInformation": {
                        "sku": "DOCMLC1",
                        "iva": "19",
                        "description": "Tacho De Basura Set De 2, Piezas De12 Litros Marca Begonia",
                        "ila": "",
                        "retention": "14",
                        "taxCode": "14"
                   }
                }
            ]
        }
    }
}

Consult all the items associated with the SKU

Request:

curl -X POST -H 'Authorization: Bearer $ACCESS_TOKEN' -H "Content-Type: application/json" -d
{
    "query": "query getAllItemsLinkedBySku($sku: String!) {\n  getAllItemsLinkedBySku(sku: $sku) {\n    itemId\n    variationId\n  }\n}",
    "variables": {
        "sku": "teste2"
    }
}
https://api.mercadolibre.com/fiscal_information/graphql

Example:

curl -X POST -H 'Authorization: Bearer $ACCESS_TOKEN' -H "Content-Type: application/json" -d
{
    "query": "query getAllItemsLinkedBySku($sku: String!) {\n  getAllItemsLinkedBySku(sku: $sku) {\n    itemId\n    variationId\n  }\n}",
    "variables": {
        "sku": "DOCMLC1"
    }
}
https://api.mercadolibre.com/fiscal_information/graphql

Response:

{
  "data": {
        "getAllItemsLinkedBySku": [
            {
                "itemId": "MLC1056231867",
                "variationId": "175219804700"
            }
        ]
    }
}

Consult fiscal data by item/variation

You can also search for the information linked to a publication in Mercado Libre:


Request:

curl -X POST -H 'Authorization: Bearer $ACCESS_TOKEN' -H "Content-Type: application/json" -d
{
    "query": "query getFiscalInformationsByItem($itemId: String!, $defaultDataIfNotExists: Boolean, $allVariations: Boolean) {\n    getFiscalInformationsByItem(itemId: $itemId, allVariations: $allVariations, defaultDataIfNotExists: $defaultDataIfNotExists) {\n        itemId\n        variationId\n        type\n        components {\n            sku\n            quantity\n            percentageShare\n            fiscalInformation {\n            ... on FiscalInformationMLC {\n                    sku\n                    iva\n                    description\n                    ila\n                    retention\n                    taxCode\n                    taxDescription\n                }\n            }\n        }\n    }\n}",
    "variables": {
        "itemId": "String",
        "allVariations": true,
        "defaultDataIfNotExists": true
    }
}
https://api.mercadolibre.com/fiscal_information/graphql

Example:

curl -X POST -H 'Authorization: Bearer $ACCESS_TOKEN' -H "Content-Type: application/json" -d
{
    "query": "query getFiscalInformationsByItem($itemId: String!, $defaultDataIfNotExists: Boolean, $allVariations: Boolean) {\n    getFiscalInformationsByItem(itemId: $itemId, allVariations: $allVariations, defaultDataIfNotExists: $defaultDataIfNotExists) {\n        itemId\n        variationId\n        type\n        components {\n            sku\n            quantity\n            percentageShare\n            fiscalInformation {\n            ... on FiscalInformationMLC {\n                    sku\n                    iva\n                    description\n                    ila\n                    retention\n                    taxCode\n                    taxDescription\n                }\n            }\n        }\n    }\n}",
    "variables": {
        "itemId": "MLC1056231867",
        "allVariations": true,
        "defaultDataIfNotExists": true
    }
}
https://api.mercadolibre.com/fiscal_information/graphql

Response:

{
    "data": {
        "getFiscalInformationsByItem": [
            {
                "itemId": "MLC1056231867",
                "variationId": "175219804700",
                "type": "SINGLE",
                "components": [
                    {
                        "sku": "DOCMLC1",
                        "quantity": 1,
                        "percentageShare": 100,
                        "fiscalInformation": {
                            "sku": "DOCMLC1",
                            "iva": "19",
                            "description": "Tacho De Basura Set De 2, Piezas De12 Litros Marca Begonia",
                            "ila": "",
                            "retention": "14",
                            "taxCode": "14",
                            "taxDescription": "Para Facturas de venta del contribuyente."
                        }
                    }
                ]
            }
        ]
    }
}

These are the possible ways of doing the search:

  • itemId: when the publication has no variation.
  • itemId + variationId: when the publication has a variation, to obtain the data only of the requested variations.
  • itemId + allVariations: when the publication has variation, to obtain the data of all the variations of this publication.

Update tax data

The resource allows the complete or partial update of the fiscal data of a publication:


Request:

curl -X POST -H 'Authorization: Bearer $ACCESS_TOKEN' -H "Content-Type: application/json" -d
{
    "query": "mutation updateFiscalInformationMLC(\n    $where: UpdateFiscalInformationMLCWhere!\n    $input: UpdateFiscalInformationMLCInput!\n) {\n    updateFiscalInformationMLC(where: $where, input: $input) {\n        sku\n        iva\n        description\n        retention\n        ila\n        taxCode\n    }\n}",
    "variables": {
        "where": {
            "sku": "String"
        },
        "input": {
            "iva": "19",
            "description": "String",
            "retention": "14",
            "ila": "",
            "taxCode": "14"
        }
    }
}
https://api.mercadolibre.com/fiscal_information/graphql

Example:

curl -X POST -H 'Authorization: Bearer $ACCESS_TOKEN' -H "Content-Type: application/json" -d
{
	"query": mutation updateFiscalInformationMLC(
    $where: UpdateFiscalInformationMLCWhere!
    $input: UpdateFiscalInformationMLCInput!) {
      updateFiscalInformationMLC(where: $where, input: $input) {
        sku
        iva
        description
        ila
        retention
        taxCode
    }
}
"variables": {
 "where": {
        "sku": "String"
    },
 "input": {
        "iva": "19",
        "description": "New description",
        "ila": "",
        "retention": "14",
        "taxCode": "14"
    }
}
{
    "query": "mutation updateFiscalInformationMLC(\n    $where: UpdateFiscalInformationMLCWhere!\n    $input: UpdateFiscalInformationMLCInput!\n) {\n    updateFiscalInformationMLC(where: $where, input: $input) {\n        sku\n        iva\n        description\n        retention\n        ila\n        taxCode\n    }\n}",
    "variables": {
        "where": {
            "sku": "DOCMLC1"
        },
        "input": {
            "iva": "19",
            "description": "New description",
            "retention": "14",
            "ila": "",
            "taxCode": "14"
        }
    }
}
https://api.mercadolibre.com/fiscal_information/graphql

Response:

{

    "data": {
        "updateFiscalInformationMLC": {
            "sku": "DOCMLC1",
            "iva": "19",
            "description": "New description",
            "ila": "",
            "retention": "14",
            "taxCode": "14"
        }
    }
}

To partially update the fiscal data, it is necessary to send only the necessary fields in the variables after the input.

Check if a publication can be billed

This resource allows us to identify if a specific publication has all the necessary data so that our biller can issue the sales invoice. You can search by publication or by variations:


Query by publication:

Request:

curl -X GET -H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com//can_invoice/items/$ITEM_ID

Example:

curl -X GET -H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com//can_invoice/items/MLC1984512046

Response:

{
   "item_id": "MLC1984512046",
   "seller_id": "809726122",
   "variation_id": "",
   "status": true
}
Note:
If you search for a publication with variations, it will only have status = true when all variations are suitable. If not, you need to identify which variance has missing or incorrect tax data and change it.


Query for variation:

Request:

curl -X GET -H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com//can_invoice/items/$ITEM_IDvariations/$VARIATION_ID

Example:

curl -X GET -H 'Authorization: Bearer $ACCESS_TOKEN' https://api.mercadolibre.com//can_invoice/items/MLB1398143045/variations/$VARIATION_ID


Response:

{
   "item_id": "MLC1984512046",
   "seller_id": "809726122",
   "variation_id": "94754627308",
   "status": true
}

The status field indicates whether the post is ready to be billed.