Skip to main content

Hi!!

 

I would appreciate if someone could give me an example of uploading a new image with https://api.miro.com/v2/boards/{board_id}/images described (not completely) in https://developers.miro.com/reference/create-image-item-using-file-from-device

In fact, what I’m trying is duplicating an existing image in a board into a new one. Because its url is private, I cannot use it by speciffying its url so I’m reading its content and trying to upload it in the same way if it would be an image from device.

 

Thanks in advance!!!

Hey @Pepe Cáceres -- I believe the reason your duplication isn’t working is because of the `Image` response object when reading the original image. At this time, the Miro REST API doesn’t return the original image, or even the link to the image, when returning an `Image` object. I’ve included an example `Image` response object below, with some commentary on the links it contains.

We are working on making the original image accessible via the API, though, and there is an issue on our Roadmap that you can subscribe to by voting on it, as well as add your own comments to. Once subscribed, you’ll receive an email for any updates we make on this feature.

In the meantime, you’ll need the image file or a hosting link in order to successfully create an `Image` item on the Miro board.

 

{
id,
data: {
title:
},
position: { ... },
geometry: { ... },
createdAt,
createdBy,
modifiedAt,
modifiedBy,
parent: // The parent item of the image on the Miro board,
links: {
related: // A list of other board items belonging to the same parent item,
self: // The direct link to the image item on the board
},
type: image
}

 

-Joanna


Hi @Joanna Smith !!

Thanks for your response but I think it would be helpful if you provided me with a complete sample of the code in Miro web: https://developers.miro.com/reference/create-image-item-using-file-from-device

Based on that page, it is supposed that there is a way to upload images with the raw data of the image or something similar, is that correct?!

 

Thanks!


Hi @Joanna Smith !!!

 

Any news on this!?

Thanks!!!


Uploading a new image using API v2 is a straightforward process! Make sure to use the correct endpoint and include the image file in the request body. Also, do not forget to check for proper authentication and any size limitations to avoid errors.


Haloo ist jemand da?


It can be a little bit tricky to upload image via API v2 for someone who doesn’t have the basic developer’s knowledge. My team also faced this problem while uploading images on https://reminiiapp.com/remini-web/, a photography based application website. An expert developer suggested us to follow the guide on https://community.miro.com/developer-platform-and-apis-57/how-to-upload-new-image-using-api-v2-9184. Guess what, it worked


Hi ​@Leon Schill ​@Pepe Cáceres ​@Jof 

I’ve just tested this out a few minutes ago and this worked. Make sure to change the resource to be the location of the file. For example, I tried it out with a file called “picture.png” on my Desktop, so the path to that file was /Users/horeaporutiu/Desktop/picture.png. So please change that in your own request.

curl -X "POST" "https://api.miro.com/v2/boards/{add-your-board-id}/images" \
-H "accept: application/json" \
-H "Authorization: Bearer {add-your-access-token}" \
-H "Content-Type: multipart/form-data" \
-F "data={\"position\":{\"x\":3000,\"y\":3000}};type=application/json" \
-F "resource=@/Users/horeaporutiu/Desktop/picture.png;type=image/png"

Please let me know if this worked for you. 


Hi @Joanna Smith !!

Thanks for your response but I think it would be helpful if you provided me with a complete sample of the code in Miro web: https://developers.miro.com/reference/create-image-item-using-file-from-device

Based on that page, it is supposed that there is a way to upload images with the raw data of the image or something similar, is that correct?!

 

Thanks!

This script uploads an image to a Miro board by encoding the image in base64 and sending it through the Miro API to create an image item.


Uploading an image using API v2 can be a bit tricky if you don’t have basic developer knowledge. My team had the same issue while trying to upload images on https://yaalo.com/, a website for photography. A developer expert recommended we follow the guide on this Miro community page. And guess what? It worked!


This thread does a great job highlighting the challenges of uploading images via Miro’s API v2, especially when trying to duplicate images or work with raw data. The curl example shared is a solid starting point for uploading images from a device, with clear steps on setting the file path and content type. For duplicating board images, it’s frustrating that the API doesn’t yet provide access to the original image data, but subscribing to the roadmap issue seems like the best way to track progress. Using base64 encoding for raw image data is a handy workaround for similar use cases. Thanks for the insights, this discussion is super helpful for anyone navigating the API!


Upload a new image using API v2 by sending a POST request to /v2/images with the image file in the body and proper authentication headers.

want to know about eSIM for remote workers use defy esim.


Thanks for this clear walkthrough! I’ve recently been working on optimizing my site where I share highly compressed PC games, and efficient image handling through APIs is something I’ve been looking into. This guide really helped clarify some of the implementation steps. Appreciate it!


Great question, Pepe! Duplicating an image from the board when the URL is private can be tricky. Since Miro API v2 doesn't allow reusing private URL directly, you're on the right track by reading the image content and re-uploading it as if it came from a device.

Make sure you're using a proper multipart/form-data POST request with the image file included, as shown in the API docs. Also, don't forget to include the correct content-type and authorization headers. Here's a basic cURL example if it helps others:

 

bash

CopyEdit

curl -X POST "https://api.miro.com/v2/boards/{board_id}/images" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: multipart/form-data" \ -F "image=@/path/to/your/image.png"

Let me know if you need help structuring it in Python or JS. Good luck!

 

You said:

Reply