Pinata makes file uploads easy for developers who need fast and zero-setup soltuions. We’ve seen the struggles with solutions like S3 for file uploads, and we knew we could make it better Our primary product, the Files API, makes it as simple as one line of code to upload a file:
Built on years of experience with IPFS, Pinata has scaled companies to serve high volumes of requests and bandwidth, as well as developers who are just starting out. Next time you think you need S3, consider spending less time and go with Pinata.
Inside the Pinata App select “API Keys” from the sidebar, then click “New Key” in the top right. We would recommend starting with Admin privileges and unlimited uses to start. You will receive a pinata_api_key, pinata_api_secret, and a JWT. The JWT is the most common authentication method and what we’ll be using below.
Next you will want to grab your Gateway domain by clicking the Gateways tab in the sidebar. You should see it listed in the format fun-llama-300.mypinata.cloud and you will want to copy it exactly like that.
2. Install and Setup SDK
In the root of your project run the install command with your package manager of choice.
Import and initialize the SDK in your codebase with the API key and Gateway from the previous step
The PINATA_JWT is a secret key, be sure to initialize the SDK in a secure environment and practice basic variable security practices. If you need to upload from a client environment, consider using signed JWTs
3. Upload a File
Use the upload method to upload a File object.
You should get a response object like the one below
Awarded to the best app using Pinata. To qualify, use either the Files API or IPFS API as part of your app. Apps that have a heavy use case for uploads will have a greater chance of winning.
$2500 - AI Challnge
Awarded to the best app that uses Pinata as part of an AI stack. To qualify, use either the Files API or IPFS API as part of a bigger AI stack. Creative use cases will have a greater chance of winning.
$2500 - Enterprise Challnge
Best app using Pinata for an enterprise scale business solution. To qualify, use either the Files API or IPFS API as part of a primary part of the app. Creative use cases will have a greater chance of winning.