Skip to main content
POST
Upload a file to Public or Private IPFS

Cost

Example Usage

In order to access these endpoints you will need to use either @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.
Uploading files to Public IPFS means you can access them through a gateway like https://ipfs.io/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.

Authorizations

X-PAYMENT
string
header
required

Base64 encoded x402 payment payload

Path Parameters

network
enum<string>
required

Upload to either public or private IPFS network

Available options:
public,
private

Body

application/json
fileSize
integer
required

Size of the file to be uploaded in bytes

Response

Successful operation

url
string

The signed URL for file upload