Working with pictures

Pictures are optional when listing an item, but they sure make a big difference in terms of quality and it will improve your possibilities of selling by attracting more visits to your items. When you list a new item, you can add pictures at that moment. This tutorial shows how to upload pictures to our servers and add them on your items.

Contents:

Considerations & Best Practices

RGB pictures are highly recommended over CMYK pictures.
There is um maximum imagens per item allowed to publish according to the category.
You’re allowed to upload pictures up to 10 MB in the following formats:

  • JPG
  • JPEG
  • PNG
  • not animated GIF

Zooming

For pictures wider than 800 pixels, a zoom widget is activated so when buyers roll over they can take a close-up look. This is highly recommended for Clothes and Real Estate properties.
Upload a picture
Now is the time to upload your first image file to be stored on our servers. This is really easy to do, just take note of the exact path where you have your image saved:

curl -F file=@/home/user/picture.jpg

https://api.mercadolibre.com/pictures?access_token=$ACCESS_TOKEN



As a response you’ll get a JSON describing the picture details.
Remember to keep the picture id. The other fields represent different picture sizes.

{
   "id":"MLA430387888_032012",
   "quality":"",
   "variations":[...]
}


Link a picture to your Item

Using the picture_id obtained before you can link the picture to your item, like this:

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d
'{"id":"MLA430387888_032012"}'

https://api.mercadolibre.com/items/MLA421101451/pictures?access_token=$ACCESS_TOKEN



That’s all! Go to your item’s description page (using the permalink field) and check how your picture displays.

Replace pictures

If you need to replace the current pictures of an item, you need to make a PUT including the Item ID and the picture url, with your access_token like in the example that follows:

curl -X PUT -H "Content-Type: application/json" -H "Accept: application/json" -d
'{
  "pictures":[
    {"source":"http://www.apertura.com/export/sites/revistaap/img/Tecnologia/Logo_ML_NUEVO.jpg_33442984.jpg"},
    {"source":"http://appsuser.net/www/wp-content/uploads/2012/10/logo-mercadolibre.jpg"}
  ]
}' https://api.mercadolibre.com/items/{item_id}?access_token=$ACCESS_TOKEN



Important!

  • If you want to replace an image, you should create a new source (re-name image); otherwise, if the same existing source is used with different content the image will not be updated.
  • In case you have a set of images and you wish to perform the following actions:
    Add an image: you should send the IDs of the uploaded images you wish to keep, along with the source (URL) of the new images. Besides, you can change the order by sending the body of the PUT as you wish to view them.

    curl -X PUT -H "Content-Type: application/json" -H "Accept: application/json" -d
    '{
    "pictures": [{"source": "http://SOURCE_IMAGEN_NUEVA.jpg"},
    			{"id": "111111 - IMAGEN_EXISTENTE_111111"},
    			{"id": "111111 - IMAGEN_EXISTENTE_111111"},
    			{"id": "111111 - IMAGEN_EXISTENTE_111111"}
    ],
    
    "variations": [{
    "id": "16787985187",
    "picture_ids": [
    		"http://SOURCE_IMAGEN_NUEVA.jpg", 
            "111111 - IMAGEN_EXISTENTE_111111", 
            "111111 - IMAGEN_EXISTENTE_111111", 
            "111111 - IMAGEN_EXISTENTE_111111"]},
    {
    "id": "16787985190",
    "picture_ids": [
    		"http://SOURCE_IMAGEN_NUEVA.jpg", 
            "111111 - IMAGEN_EXISTENTE_111111", 
            "111111 - IMAGEN_EXISTENTE_111111", 
            "111111 - IMAGEN_EXISTENTE_111111"]},
    
    {
    "id": "16787985193",
    "picture_ids": [
    		"http://SOURCE_IMAGEN_NUEVA.jpg", 
            "111111 - IMAGEN_EXISTENTE_111111", 
            "111111 - IMAGEN_EXISTENTE_111111", 
            "111111 - IMAGEN_EXISTENTE_111111"]}]
    }' http://api.mercadolibre.com/items/ITEM_ID?access_token=ACCESS_TOKEN

    Delete an image: you should only send the IDs of the uploaded images you wish to keep.



Great! now the new picture will be showing on your item. Now you know how to add or replace pictures, remember good pictures will attract more buyers!

Please rate this