Skip to main content
POST
Pin File to IPFS

Guides

Usually you can pass a Blob directly into the request but to help guarantee success we recommend passing it into a File object.
Pin Blob
To upload a file from an external URL you can stream the contents into an arrayBuffer, which then gets passed into a new Blob that can then be uploaded to Pinata.
Upload by URL
To upload a file in base64 simply turn the contents into a buffer that is passed into a Blob.
Upload base64
Folders can also be uploaded via the API by creating an array of files and mapping over them to add them to the form data. This is different then having a single file entry and having multiple files for that one entry, which does not work.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

multipart/form-data
file
file
required
pinataMetadata
object

Optional stringified object

Example:

"{\"name\":\"Test file\"}"

pinataOptions
object

Optional stringified object

Example:

"{\"cidVersion\":0}"

Response

200 - application/json

{ "IpfsHash": "This is the IPFS multi-hash (CID) provided back for your content," "PinSize": "This is how large (in bytes) the content you just pinned is," "Timestamp": "This is the timestamp for your content pinning (represented in ISO 8601 format)" }

IpfsHash
string
PinSize
integer
Timestamp
string
isDuplicate
boolean