Numbers Protocol
Search
⌃K

[IPFS] Create Metadata on IPFS

This API allows you to create a Metadata file needed by NFT, on-chain records or other purposed, store it on the IPFS network through the Numbers Gateway (https://ipfs-pin.numbersprotocol.io/ipfs/) and keep it permanently stored. t requires either a fileURL or a file object along with a valid Capture Token for authorization. If you do not already have a Capture Token yet, please follow the instruction provided to create one.
The Numbers API charges you only for the files you pin, making it a cost-effective solution. Payments are taken every 30 days from your Capture Account's Asset Wallet and must be made in Credits or NUM. To avoid having your files unpinned, it's important to keep your wallet topped up and have sufficient funds. If a payment fails, you will receive an email notification and have 10 days to deposit more funds.
Payment for services is processed using NUM; if you want to know how much it costs in USD, you can check CoinGecko or CoinMarketCap.
API Endpoint: https://eow75n0xni8ruiy.m.pipedream.net
​
Cost: 0.001 NUM + Gas (~0.004 NUM per transaction) per file per month. No Gas is required if paid with Credits.
​
Method: POST
​
Description:
This API allows you to create a Metadata file needed by NFT, on-chain records or other purposed, store it on the IPFS network through the Numbers Gateway.
​
Authentication:
This API requires a valid token for Authorization. The token should be passed in the headers of the request using the following format: "Authorization: token YOUR_CAPTURE_TOKEN"
​
Header:
Authorization: token $YOUR_CAPTURE_TOKEN (required)
Content-Type: application/json
​
Request Body:
Data in the body should be the metadata that you want to pin on IPFS. When sending the request, the body is a required component.
​
Example:
curl -X POST "https://eow75n0xni8ruiy.m.pipedream.net" \
-H "Content-Type: application/json" \
-H "Authorization: token YOUR_CAPTURE_TOKEN" \
-d '{
"name": "Numbers Co., Ltd.",
"wallet": "0x51130dB91B91377A24d6Ebeb2a5fC02748b53ce1",
"profile": "bafkreidedkuz2mim2pfetxkhy2ysq75ooqe73bnuz5izhs6wzxoi567hua",
"social": {
"website": "https://numbersprotocol.io",
"twitter": "https://twitter.com/numbersprotocol"
},
"type": "provider",
"information": "Numbers Protocol is a decentralised photo network, for creating community, value and trust in digital media."
}'
​
Response:
{
"fileURL": string, // URL of the pinned metadata
"cid": string, // content identifier of the metadata file
"fileSize": integer, // size of the metadata file
"cid_version": integer // version of the cid
"orderID": string // ID of this order
}
​
200: Metadata has been created and pinned successfully
400: Bad request
401: Unauthorized
403: Forbidden
500: Internal Server Error
​
In this example, you would replace YOUR_CAPTURE_TOKEN with your actual Capture token and the body with the actual metadata you want to create. More examples can be found below:
Python
Javascript
import requests
​
url = "https://eow75n0xni8ruiy.m.pipedream.net"
headers = {
"Content-Type": "application/json",
"Authorization": "token YOUR_CAPTURE_TOKEN"
}
data = {
"name": "Numbers Co., Ltd.",
"wallet": "0x51130dB91B91377A24d6Ebeb2a5fC02748b53ce1",
"profile": "bafkreidedkuz2mim2pfetxkhy2ysq75ooqe73bnuz5izhs6wzxoi567hua",
"social": {
"website": "https://numbersprotocol.io",
"twitter": "https://twitter.com/numbersprotocol"
},
"type": "provider",
"information": "Numbers Protocol is a decentralised photo network, for creating community, value and trust in digital media."
}
​
response = requests.post(url, headers=headers, json=data)
​
if response.status_code == 200:
response_json = response.json()
print(response_json)
else:
print("Request failed with status code:", response.status_code)
​
const https = require("https");
const data = JSON.stringify({
name: "Numbers Co., Ltd.",
wallet: "0x51130dB91B91377A24d6Ebeb2a5fC02748b53ce1",
profile: "bafkreidedkuz2mim2pfetxkhy2ysq75ooqe73bnuz5izhs6wzxoi567hua",
social: {
website: "https://numbersprotocol.io",
twitter: "https://twitter.com/numbersprotocol"
},
type: "provider",
information: "Numbers Protocol is a decentralised photo network, for creating community, value and trust in digital media."
});
​
const options = {
hostname: "eow75n0xni8ruiy.m.pipedream.net",
port: 443,
path: "/",
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "token YOUR_CAPTURE_TOKEN",
"Content-Length": data.length
}
};
​
const req = https.request(options, res => {
let responseData = "";
​
res.on("data", chunk => {
responseData += chunk;
});
​
res.on("end", () => {
const responseJson = JSON.parse(responseData);
console.log(responseJson);
});
});
​
req.on("error", error => {
console.error(error);
});
​
req.write(data);
req.end();
​
​