Answered

How to duplicate/ clone boards using the REST Api

  • 16 March 2021
  • 9 replies
  • 319 views

Badge

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

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

View original

9 replies

Badge

Interested too!

Badge +1

Interested too!

Userlevel 1
Badge +2

I’m also curious!

Userlevel 3
Badge +7

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 1
Badge +2

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 3
Badge +7

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 4
Badge +6

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

Badge +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 

Reply