Allows the user to change the name and keyvalues associated with content pinned to Pinata.
Changes made via this endpoint only affect the metadata for the hash passed in. Metadata is specific to Pinata and does not modify the actual content stored on IPFS in any way. It is simply a convenient way of keeping track of what content you have stored.
pinata.hashMetadata(ipfsPinHash, metadata)
Params
ipfsPinHash - A string for a valid IPFS Hash that you have pinned on Pinata.
metadata A JSON object containing the following:
name (optional) - A new name that Pinata will associate with this particular hash.
keyvalues (optional) - A JSON object with the updated keyvalues you want associated with the hash provided (see more below)
Adding or modifying keyvalues
To add or modify existing keyvalues, simply provide them in the following format for the keyvalues object:
keyvalues: {
newKey: 'newValue', //this adds a keyvalue pair
existingKey: 'newValue' //this modifies the value of an existing key if that key already exists
}
Removing keyvalues
To remove a keyvalue pair, simply provide null as the value for an existing key like so:
keyvalues: {
existingKeyToRemove: null //this removes a keyvalue pair
}
Response
If the operation is successful, you will receive back an "OK" REST 200 status.
Adds a hash to Pinata's pin queue to be pinned asynchronously. For the synchronous version of this operation see: pinHashToIPFS
pinata.pinByHash(hashToPin, options)
Params
hashToPin - A string for a valid IPFS Hash (Also known as a CID)
options (optional): A JSON object that can contain following keyvalues:
pinataMetadata (optional): A JSON object with optional metadata for the hash being pinned
pinataOptions
hostNodes (optional): An array of multiaddresses for nodes that are currently hosting the content to be pinned
Response
{
id: This is Pinata's ID for the pin job,
ipfsHash: This is the IPFS multi-hash provided to Pinata to pin,
status: The current status of the pin job. If the request was successful the status should be 'searching'.
name: The name of the pin (if provided initially)
}
readableStream - A readableStream of the file to be added
options (optional): A JSON object that can contain the following keyvalues:
pinataMetadata (optional): A JSON object with optional metadata for the file being pinned
pinataOptions (optional): A JSON object with additional options for the file being pinned
Response
{
IpfsHash: This is the IPFS multi-hash 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)
}
Read from a location on your local file system and recursively pin the contents to IPFS (node.js only).
Both individual files, as well as directories can be read from.
pinata.pinFromFs(sourcePath, options)
Params
sourcePath - The location on your local filesystem that should be read from.
options (optional): A JSON object that can contain the following keyvalues:
pinataMetadata (optional): A JSON object with optional metadata for the file being pinned
pinataOptions (optional): A JSON object with additional options for the file being pinned
Response
{
IpfsHash: This is the IPFS multi-hash 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)
}
This endpoint allows users to search for the status of all hashes that are currently in Pinata's pin queue. Records in the pin queue arrived there through either the pinByHash operation or by failing during a pinHashToIPFS operation.
pinata.pinJobs(filters)
Params
filters (optional): An object that can consist of the following optional query parameters:
sort (optional): How you wish for the records in the response to be sorted. Valid inputs for this are:
'ASC'
'DESC'
status (optional): What the current status of the record is in the pin queue. Valid statuses and their meanings are:
prechecking - Pinata is running preliminary validations on your pin request.
searching - Pinata is actively searching for your content on the IPFS network. This may take some time if your content is isolated.
retrieving - Pinata has located your content and is now in the process of retrieving it.
expired - Pinata wasn't able to find your content after a day of searching the IPFS network. Please make sure your content is hosted on the IPFS network before trying to pin again.
over_free_limit - Pinning this object would put you over the free tier limit. Please add a credit card to continue pinning content.
over_max_size - This object is too large of an item to pin. If you're seeing this, please contact us for a more custom solution.
invalid_object - The object you're attempting to pin isn't readable by IPFS nodes. Please contact us if you receive this, as we'd like to better understand what you're attempting to pin.
bad_host_node - The provided host node(s) were either invalid or unreachable. Please make sure all provided host nodes are online and reachable.
ipfs_pin_hash (optional): A string for a valid IPFS hash (also known as a CID) to search for
limit (optional): Limit the amount of results returned per page of results (default is 5, and max is also 1000)
offset (optional): Provide the record offset for records being returned. This is how you retrieve records on additional pages (default is 0)
Response
{
count: (this is the total number of pin job records that exist for the query filters you passed in),
rows: [
{
id: (the id for the pin job record),
ipfs_pin_hash: (the IPFS multi-hash for the content you pinned),
date_queued: (The date this hash was initially queued to be pinned - represented in ISO 8601 format),
name: (If you passed in a name for your hash, it will be listed here),
status: (The current status for the pin job)
},
{
same record format as above
}
.
.
.
]
}
options (optional): A JSON object that can contain the following keyvalues:
metadata (optional): A JSON object with optional metadata for the hash being pinned
pinataOptions (optional): A JSON object with additional options for the JSON being pinned
Response
{
IpfsHash: This is the IPFS multi-hash 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)
}