Skip to main content

How do I get the metadata from an `preview` type item? The preview items contain urls to external pages that I need to extract. 

>
{
"output":
{
"id": "3458764612000528999",
"type": "preview",
"geometry": {
"width": 250,
"height": 223.5234375
},
"position": {
"x": -340.9169006347656,
"y": -154.68751525878906,
"origin": "center",
"relativeTo": "canvas_center"
},
"links": {
"self": "https://api.miro.com/v2/boards/uXjVLyMfaRI%3D/items/3458764612000528999"
},
"createdAt": "2025-01-01T19:01:43Z",
"createdBy": {
"id": "3074457346783176524",
"type": "user"
},
"isSupported": false,
"modifiedAt": "2025-01-01T19:01:43Z",
"modifiedBy": {
"id": "3074457346783176524",
"type": "user"
}
}
]
}
]

 

I also found that when you slect type `preview` from the dropdown in the official api doc you get a 400 error.

{
"type": "error",
"code": "2.0703",
"context": {
"fields": "
{
"field": "type",
"message": "Unexpected enum value preview, expected one of: text, shape, sticky_note, image, document, card, app_card, frame, embed, mindmap_node"
}
]
},
"message": "Invalid parameters",
"status": 400
}

 

Hey ​@marcfon 

You should be able to get URLs from a preview item by using the following code:
 

const previews = await miro.board.get({ type: 'preview' });
console.log(previews)


With this code, you should see an array of preview items, and when you log them out, you should see each URL associated with the preview item. 

Hope this helps! Please let me know if you have further questions. 


@Horea Porutiu thanks for stepping in. I’m using the REST call https://api.miro.com/v2/boards/oboard_id]/items This call only returns the JSON that I posted in the first message. There are no additional details about the preview item.


Hi ​@marcfon 

Unfortunately, I don’t think getting the URLs via the API is possible at the moment. Even with get specific item API, it doesn’t return the URLs. 

Right now, the only option to retrieve the URLs is the code snippet I shared above, which is using the WebSDK. 

I will add this as feedback to our development team, to consider adding these details to the API as well. 


@Horea Porutiu yeah that’s what I thought as well. Too bad this isn’t supported in the REST api currently. Would there be a workaround? Is there a way for instance to export the full board to a CSV file?


Hi ​@marcfon 

You should be able to go to top left → 3 dots → Board → export → Export to spreadsheet. When I checked the CSV, I did see the URLs in there. 

Please let me know if this solves your issue. 

 


@Horea Porutiu yeah I know that option exists but I need to do it programmatically, not manually. There are hundreds boards that I need to export.


Thank you for explaining ​@marcfon. We do have a board export API but unfortunately, I do not think it provides details such as URLs. 

I’m asking internally to see if there may be another way to retrieve this information. I’ll keep you updated if I find a way. 

May I please ask the use case of why you need these URL details? Is it for discovery / compliance purposes? It will help me build a case for prioritizing these details in our product roadmaps.


@Horea Porutiu I hope you’ll find a way to retrieve this information. It’s crucial for us. We need to export the board content for long term archival purposes (yes, compliance related).


Hi ​@marcfon

Right now, the only way to get this info programmatically (outside of WebSDK) would be to use content logs REST API method. I’ve tested this to ensure you can get URL details. The output would look something like this (omitted any PII):
 

 {
"action": "CREATE",
"boardKey": "*****=",
"createdAt": "2025-01-07T21:01:32Z",
"createdBy": {
"id": "*****",
"email": "*****@*****.com",
"firstName": "*****",
"lastName": "*****"
},
"hidden": false,
"id": "*****",
"itemId": "*****",
"logData": {
"text": "Yahoo | Mail, Weather, Search, Politics, News, Finance, Sports & Videos",
"metadata": {
"description": "Latest news coverage, email, free stock quotes, live scores and video are just the beginning. Discover more every day at Yahoo!",
"url": "https://www.yahoo.com/"
}
},
"modifiedAt": "2025-01-07T21:01:32Z",
"modifiedBy": {
"id": "*****",
"email": "*****@*****.com",
"firstName": "*****",
"lastName": "*****"
},
"type": "preview"
},

You would need to purchase Enterprise Guard to use this method, as it’s part of our security and compliance offerings. 

Hope this helps! 


@Horea Porutiu I appreciate the support and great that you’ve found a way to retrieve the URL. It feels odd that I would need to update my license to get access to my own content.

 

As for the WebSDK, it’s not possible to load that outside the context of a miro board, right? It’s not possible to create a standalone TS application and call the functions?


Reply