Every now and then you might find yourself in a spot where you need to transfer your files or folders from one Pinata account to another, or from another pinning service to Pinata. Thankfully IPFS makes this process pretty simple thanks to the magical CID, allowing content to be portable across the network! We've seen plenty of people use this when they want to move content to a new Pinata account or save an NFT project that got rugged. In this guide we'll show you how to do that!
Locate the Existing CIDs
The first step you will want to take is noting the CIDs you need to transfer. If this is from a Pinata account or another pinning service this will be pretty simple as your files page will list all of your CIDs for your content. Just copy them down somewhere along with a name for each one like "images" or "metadata," as shown below. If you have all of that you can go to the next step!
If you're trying to backup or save content that's on a smart contract, there are a few ways you could do that. Most NFT projects have a Metadata folder, and an Images folder. You will need to find the CID for both. One way to do that is to go straight to the source. If you visit the smart contract on Etherscan, and the contract is verified, there should be a Contract tab followed by either "Read" or "Read as Proxy."
In the read functions there should be one for tokenURI, where you can put in say "1" and then hit query. It should return a URL with the CID, like so:
Copy that root CID down and mark it as Metadata. Then you will want to visit that CID and file using a gateway, like this:
You should see some metadata with information about the NFT, including an image URL. If it's a folder, it should have a similar pattern of having a root CID. You will want to copy that down as well and mark it as "Images."
Pin By CID to Pinata
Now that you have the CIDs and the names of the files/folders, it's time to pin them to your Pinata account! There's two ways you can do that.
Pinata Web App
By visiting the Files Page on the Pinata App, you can simply click "Upload", then select "CID."
From there you will want to paste in the CID, and type in the name of the file/folder. After that, just hit "search and pin"!
After that, your CID will enter a pin by CID queue. You might see different statuses which are listed below:
Pinata is prechecking the CID before searching, making sure it's a valid CID. e.g. if you put in random words instead of a valid CID it would fail the prechecking
Pinata is currently looking for the CID content on IPFS.
If your pin job is stuck in the searching status, that usually means we can't find the CID on IPFS.
Pinata has found the CID and is currently pinning the content to Pinata IPFS nodes
Pinata was in the middle of retrieving the files, but there was an interruption in the connection.
Pin by CID with Pinata API
If you have a lot of CIDs and need a more programmable solution, you can use the pinByHash API endpoint listed here in our docs! Any CIDs submitted will enter the same pin by CID queue as with the web app and will use the same statuses.
If you are trying to move everything from one Pinata account to another, you should also consider moving the Dedicated Gateway in addition to IPFS CIDs.
🚨This process will interrupt the gateway's ability to serve content, please keep this in mind and make sure it is not in use while making this transfer! 🚨
In order to do that, you will need to visit the Gateways Page on the old account, copy down the name of the gateway, click on the three dots next to the gateway, then click "remove gateway."
Now go to the new account, go to the same gateway tab, and click "Create Gateway" and enter in the same gateway domain as the one before!
Once the CID shows up on you files page, that means it's done! It has officially been transferred and the content is safe with Pinata 🎉