Retrieving Files
Gateways are Pinata’s tool to deliver your content with speed and security. They’re similar to CDNs but with way more features. When you create a Pinata account, you’ll automatically have a Gateway created for you! To see it, simply visit the Gateways Page.
The gateway domains are randomly generated and might look something like this:
Retrieving Private Files
All content uploaded to Pinata is by default private, and there are a few ways you can view it. One of the simplest ways to fetch content is through the get method in the SDK. All content is referenced by the cid
, a special identifier given to each file based on the cotnent of that file.
Under the hood this method generates a 30 second signed url to access the content with. Alternatively you can also create a signed URL that can be used to access the content for a specified limited amount of time.
Image Optmizations
In order ot use Image Optmizations with private files the query parameters must be part of the request of getting a signed url.
Retrieving Public Files
If you uploaded or added files to a public group then you can access them with the methods mentioned previously, or just by appending the cid
to the gateway
url like so:
Since these files are public there is no need create a temporary url. At this point you can also use some handy queries such as ?filename=image.png
, ?download=true
.
Image Optimizations
With public files you can simply append the Image Optimizations queries which would look something like this:
Adding a Custom Domain
Pinata also allows you to create a custom domain for your Dedicated Gateway. Simply visit the Gateways Page, click the menu button on the right side of your gateway, then click Add Custom Domain. You’ll need to own the domain you want to use. When you enter your domain, you will be prompted to enter DNS information through your registrar.