Skip to main content

Introduction

Once minted, you could directly upload files to a W3Bucket via Http API.

Generally, there are 3 steps to take:

  1. Generate a W3Auth Token, with information like W3BKT NFT contract address and target tokenId encoded.
  2. Upload file to a selected gateway via the standand IPFS API, to get the CID. The W3Auth Token generated above will be used as Http Bearer Token for authentication.
  3. Pin the CID with the standard IPFS Pinning Service API. Similarly, the W3Auth Token generated above will be used as Http Bearer Token for authentication.

Generate W3Auth Token

W3Auth Token could be generated either from Dapp with MetaMask, or from some backend scripts using SDKs like web3.js or ethers.js with some hot wallet secret.

Upload File to IPFS Gateway

$ curl --location --request POST 'https://<GATEWAY_HOST>/api/v0/add?pin=true' \
--header 'Authorization: Bearer <W3AUTH_TOKEN>' \
--form 'path=@"<FILE_PATH>"'

Pin with CID

$ curl --location --request POST 'https://pin.cloud3.cc/psa/pins' \
--header 'Authorization: Bearer <W3AUTH_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"cid": "<FILE_CID>",
"name": "<FILE_NAME>"
}'