Answered

How to duplicate/ clone boards using the REST Api


As the title states, how can I duplicate an existing board programmatically using the REST api?

 

I couldn’t find anything in the documentation, and get all the widgets and then creating them in a new board are not practical as this method doesn’t support frames.

icon

Best answer by Daniela Gavidia 30 March 2021, 15:53

View original

19 replies

Interested too!

Interested too!

Userlevel 2
Badge +3

I’m also curious!

Userlevel 4
Badge

Hi,
 

We currently have an undocumented API endpoint for cloning boards:

POST https://api.miro.com/v1/boards/{id}/copy

This will create a copy of the board with the id you passed in the url and return the copy. You could give it a try, but be aware that this endpoint will probably change in the next API version release.

 

Kind regards.
 

Daniela

Userlevel 2
Badge +3

Thanks, @Daniela Gavidia 

With this API Endpoint, I need an access token. So I could only use it for myself, right? 

My plan is to create a public “Use Template” button on our website. So others can quickly duplicate a board. 

Best, 

Daniel

Userlevel 4
Badge

Hi Daniel,

 

Yes, you would need an access token for an app that is installed in a team. Calling the “copy” endpoint would let you duplicate a board in a team where the app is installed.

 

Kind regards.

 

Daniela

Badge

Hi @Daniela Gavidia, :)

 

Have create a dummy board, trying to duplicate but KO. 

https://api.miro.com/v1/boards/o9J_lMf3sjg=/copy

Got this error. 

{  "status" : 401,  "code" : "tokenNotProvided",  "message" : "No authorization data was found on the request",  "context" : null,  "type" : "error"}

 

Question 1/ 

In your latest comment to Daniel you say: “you would need an access token for an app that is installed in a team”. Could you please tell us how to create such an access token?/ Share a resource/ 

 

Question 2/

If I want to duplicate a board 20 times, do I need to run the API URL 20 times or is there a more convenient way?

 

Thanks :)

Antoine. 

 

 

Userlevel 5
Badge +1

Hi @AntoineOne ,

 

You are almost there! :)

 

You get the tokenNotProvided error when you don't pass the access_token into the header of your request (you can find more information here). Adding in the header of your request:

Authorization: Bearer {access_token} will solve this issue.

 

This is a cURL example showing how to do this. You only need to replace {access_token} by your access token:

curl --request POST 'https://api.miro.com/v1/boards/o9J_lGY8JuA=/copy' -H 'Authorization: Bearer {access_token}'

 

Question 1: The complete Authorization flow is described here. Not that you can use the access_token you get when Installing an application using "Your apps" setting as explained here.

Question 2: Yes, if you want to create 20 copies of the board you will need to call the API 20 times.

 

Let me know if you have any other questions.

Anthony

Userlevel 1

Hi @Daniela Gavidia any chance the copy endpoint will work in the future with public shared boards provided by an other account ? 

Greetings, 

Manuel 

Hi,

 

Can I have feedback on how stable this undocumented end point for this functionality? Want to utilize this feature as well.

 

Kind Regards,

Userlevel 5
Badge +1

Hi @Ronrick Jet, this API was an experimental API and is not available anymore. The team is working on a new version based on the feedback collected. I will let you know when it is available.

Userlevel 1

Hi @Ronrick Jet, this API was an experimental API and is not available anymore. The team is working on a new version based on the feedback collected. I will let you know when it is available.

Hey @Anthony Roux, seems like the POST endpoint “/copy” is still reachable and seems to work (tested 2 min ago).  What do you mean exactly with “is not available anymore”? Will you shut down the endpoint method  til the new version is available? 

Hi @Ronrick Jet, this API was an experimental API and is not available anymore. The team is working on a new version based on the feedback collected. I will let you know when it is available.

Hey @Anthony Roux, seems like the POST endpoint “/copy” is still reachable and seems to work (tested 2 min ago).  What do you mean exactly with “is not available anymore”? Will you shut down the endpoint method  til the new version is available? 

I would like to hear about this as well. I hope they retain the test version while waiting for the official release so the dev can utilize this function for the meantime.

Userlevel 1

Hi @Ronrick Jet, this API was an experimental API and is not available anymore. The team is working on a new version based on the feedback collected. I will let you know when it is available.

Hey @Anthony Roux, seems like the POST endpoint “/copy” is still reachable and seems to work (tested 2 min ago).  What do you mean exactly with “is not available anymore”? Will you shut down the endpoint method  til the new version is available? 

I would like to hear about this as well. I hope they retain the test version while waiting for the official release so the dev can utilize this function for the meantime.

@Anthony Roux Thanks for your quick answer. Any chance we could find out if they will retain the “test version” til the new one is ready? We currently rely on this endpoint. 

Userlevel 5
Badge +1

Hi,

 

I am sorry for the confusion with my previous message. Discard my previous message:

  • If you use the /v1/ version: https://api.miro.com/v1/boards/o9J_lGY8JuA=/copy, it is still available but still an experimental API. We don’t plan to update or work on this version anymore.
  • If you were using the /vNext/ endpoint this one should not work anymore.
  • Based on the feedback we have collected we are working on a new version of this API that will be the stable version. We will let you know when it is ready and you will have plenty of time to migrate after it is published (no ETA for the moment). 

 

Sorry again for the confusion,

Anthony

Userlevel 2
Badge +1

Would be sad to see this feature go, as it’s one of the features that really reduces work for us in using Miro. :-)

Userlevel 2
Badge +1

Here’s the new API endpoint: https://developers.miro.com/reference/copy-board

Unexpectedly, when copy_from is a board that is out of your reach, you get an empty board back instead of an error or warning.

Userlevel 2
Badge +1

… or there’s something wrong. I’m getting empty boards all the time now :-(

Userlevel 2
Badge +1

… or there’s something wrong. I’m getting empty boards all the time now :-(

Doh: I was using POST instead of PUT.

Reply