post https://api.nftport.xyz/v0/files
Uploads a file to IPFS which makes your NFT storage easy. You can use the returned ipfs_url
with Upload metadata to IPFS to mint your NFT.
If you prefer hosting files in your own servers, you can skip this step. Otherwise, we recommend using IPFS because it's an industry standard for decentralized storage and guarantees the immutability of your files.
We use nft.storage to pin the files with Filecoin, which ensures that your important data is retained in IPFS.
Supports all file types and maximum file size is 50MB. For higher limits, see pricing.
Useful for:
- Storing your NFT files easily and according to the industry standards.
Related:
- To see all your previous IPFS uploads, see List all your IPFS uploads.
- After uploading files, use Upload metadata to IPFS to continue with your NFT minting.
- If you want to learn how to use the customizable minting, see Customizable Minting Quickstart.
Example Requests in cURL, Python & JS
curl --request POST \
--url 'https://api.nftport.xyz/v0/files' \
--header 'Authorization: API Key Here' \
--header 'Content-Type: multipart/form-data' \
--form 'file=@/path/to/file_to_upload.png;type=image/png'
import requests
file = open("image.png", "rb")
response = requests.post(
"https://api.nftport.xyz/v0/files",
headers={"Authorization": 'API-Key-Here'},
files={"file": file}
)
const fs = require('fs');
const fetch = require('node-fetch');
const FormData = require('form-data');
const form = new FormData();
const fileStream = fs.createReadStream('image.jpg');
form.append('file', fileStream);
const options = {
method: 'POST',
body: form,
headers: {
"Authorization": "API-Key-Here",
},
};
fetch("https://api.nftport.xyz/v0/files", options)
.then(response => {
return response.json()
})
.then(responseJson => {
// Handle the response
console.log(responseJson);
})