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?


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. 


You can upload an image using API v2 with a simple POST request. Most APIs expect:

  • An endpoint URL (like /v2/images or /v2/upload)

  • Authorization header (API key or Bearer token)

  • The file in multipart/form-data

✅ Example with cURL

 

curl -X POST "https://api.example.com/v2/images" \ -H "Authorization: Bearer YOUR_API_KEY" \ -F "file=@/path/to/your/image.jpg" \ -F "title=My New Image"

✅ Example with JavaScript (fetch)

 

const formData = new FormData(); formData.append("file", document.querySelector("#fileInput").files.0]); formData.append("title", "My New Image"); fetch("https://api.example.com/v2/images", { method: "POST", headers: { "Authorization": "Bearer YOUR_API_KEY" }, body: formData }) .then(res => res.json()) .then(data => console.log("Uploaded:", data)) .catch(err => console.error("Error:", err));

👉 After uploading, the response usually includes the image ID or URL, which you can then use or display.

For more details, visit https://remified.com


Reply