Uploads a file to Pinata’s public IPFS network
Price | Duration |
---|---|
$0.10/GB * 12 | Pins for 12 months |
x402-axios
or x402-fetch
. Once installed you will also need either Viem or a Coinbase developer account. From there you can create an account
locally or through the CDP Wallet API.
When you make a request to one of the Pinata x402 endpoints it will return a 402 error saying payment is required. Then the fetchWithPayment
method from the fetch or axios library will make a second requst for the requested payment amount. After payment is settled then you can use the returned presigned URL to upload the file to Pinata.
https://gateway.pinata.cloud/ipfs/:CID
. If you upload a file as private
then it will not be accessible on public IPFS, so in order to access it you need to create a temporary access URL. This flow is similar to the previous one, except you would provide the CID that you uploded previously that you would like to access. After a successful payment the server will return a URL you can access the file with.
Base64 encoded x402 payment payload
Upload to either public or private IPFS network
public
, private
Successful operation
The response is of type object
.