Pinning Services API
You can ask NFT.Storage to archive data that is already on the IPFS distributed storage network with this API. This data will remain perpetually available over IPFS (backed by Filecoin decentralized storage).
NFT.Storage provides a pinning service that is modeled closely on the IPFS Pinning Service API specification. NFT.Storage's Pinning Service API is not to be used for ongoing production traffic, but rather for one-time migrations.
You do not need to request access if you are storing data with NFT.Storage directly. Data stored with NFT.Storage is persisted indefinitely by default. This API is only useful if you are looking to store data with NFT.Storage that is already available on the IPFS network. Even in these situations, if you are able to, we recommend you generate a CAR file from a IPFS node hosting the content and directly upload that to NFT.Storage (e.g., run ipfs dag export
from your local node) rather than use the Pinning API.
For a full list and documentation of all the available pinning service endpoints, visit the IPFS Pinning Service API endpoint documentation.
Requesting access
To request access to the pinning service for your NFT.Storage account, you will need to request access from your API Key account page. Once approved, you will be able to access the pinning service API endpoints using your API token.
Using the HTTP API
The NFT.Storage pinning service endpoint for all requests is https://api.nft.storage/pins. For additional documentation, please see the IPFS Pinning Service API endpoint documentation.
Add a pin
curl -X POST 'https://api.nft.storage/pins' \ --header 'Accept: */*' \ --header 'Authorization: Bearer <YOUR_AUTH_KEY_JWT>' \ --header 'Content-Type: application/json' \ -d '{ "cid": "QmCIDToBePinned", "name": "PreciousData.pdf"}'
List successful pins
curl -X GET 'https://api.nft.storage/pins' \ --header 'Accept: */*' \ --header 'Authorization: Bearer <YOUR_AUTH_KEY_JWT>'
Delete a pincurl -X DELETE 'https://api.nft.storage/pins/<requestId>' \ --header 'Accept: */*' \ --header 'Authorization: Bearer <YOUR_AUTH_KEY_JWT>'
Using the IPFS CLI
The IPFS CLI can be used to maintain pins by first adding the NFT.Storage pinning service.
ipfs pin remote service add nftstorage https://api.nft.storage/ <YOUR_AUTH_KEY_JWT>
See more extensive documentation in the IPFS Docs.
Add a pin
ipfs pin remote add --service=nftstorage --name=<PIN-NAME> <CID>
List pins
ipfs pin remote ls --service=nftstorage
Remove a pin
ipfs pin remote rm --service=nftstorage --cid=<CID>