Help migrating category from one instance to another without admin on the source instance

Our team has been operating as a guest on another Discourse instance. We are standing up our own Discourse instance and would like to migrate our categories from the existing instance to the new instance. We do not have admin access to the existing server but the admins are willing to do a category export for us. However this export does not contain any attachments or images. We do have api access to the existing instance but only to our categories. We do have admin access on the new instance.

Is it possible to migrate attachments and images using only the API for the existing instance?

I was looking at the exported json and the attachment file names are different randomized strings than what is served in the browser which makes reverse engineering the API to download attachments and images not as straight forward. Even if we could download all the attachments from the existing instance I am not sure how to add them to the new instance. This post makes me want to believe it is as easy as dropping them in to that location with the requirement that the filenames are identical to what is in the exported json but that doesn’t seem to work.

Any Ideas?

1 Like

Can you explain what you mean by this?

If you look at the cooked data for a json post stream then you will get the regular attachment URLs.


Sorry, I have not been able to reply as am I new and my account was on hold.

In the category export json (using the method linked above), the attachment in a particular post looks like this


In the cooked json from the api that same image has the following url

There appears to be no relationship in filenames. Given this information I can use the api to fetch the attachments that are not included in the export. But i am not sure what filename to give it and where to place it on the new server.

Once that is sorted out would it be possible to have the attachments appear on the rendered topics pages when loaded as before the migration.

1 Like

If I look at the cooked via the API (for instance this) then I do see the full URLs to the images.

But I think you might be looking for this:


Reporting back with a solution that works with a test instance that I have not tried on prod.

This is for future me to pass on to the team who will actually be doing the migration or anyone else who needs something similar.

Attachments should be given the long form name, which can be converted from the short form in the json via the python script in Converting short upload URLs to full URLs

Attachments should be placed in discourse/public/uploads/tombstone/default/original/

Then run uploads:recover_from_tombstone while in /var/discourse/