Numbers Protocol
Search
⌃K

Get Nid from file

This is a free API to help you retrieve the Cid/Nid of any file. It 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.
API Endpoint: https://eoaw7tnt9xlliga.m.pipedream.net
​
Cost: 0 NUM (free to use)
​
Method: POST
​
Description:
This is a free API to help you retrieve the Nid of any file.
​
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 (required):
fileURL (string) or file (object): Either the URL of the file or the file object itself must be specified. If the fileURL is used, it should be passed as a string. If the file object is used, it should be the direct upload from the system.
​
Request Body (optional):
version (integer): CID version (default: 1)
​
Example 1 (direct file upload):
curl -F "file=@/tmp/MYFILE.png" \
-H "Authorization: token YOUR_CAPTURE_TOKEN" \
"https://eoaw7tnt9xlliga.m.pipedream.net"
​
Example 2 (upload via URL)
curl -X POST "https://eoaw7tnt9xlliga.m.pipedream.net" \
-H "Content-Type: application/json" \
-H "Authorization: token YOUR_CAPTURE_TOKEN" \
-d '{
"fileURL": FILE_URL
}'
​
Response:
{
"cid": string, // content identifier of the file
"fileSize": integer, // size of the file
"cid_version": integer // version of the cid
}
​
200: Cid/Nid retrieved 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 /tmp/MYFILE.png with the actual file on your filesystem. More examples can be found below:
Python
Javascript
import requests
​
url = "https://eoaw7tnt9xlliga.m.pipedream.net"
headers = {
"Content-Type": "application/json",
"Authorization": "token YOUR_CAPTURE_TOKEN"
}
data = {
"fileURL": FILE_URL,
"version": 1
}
​
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 request = require("request");
​
const url = "https://eoaw7tnt9xlliga.m.pipedream.net";
const headers = {
"Content-Type": "application/json",
"Authorization": "token YOUR_CAPTURE_TOKEN"
};
​
const data = {
"fileURL": FILE_URL,
"version": 1
};
​
request.post(
{
url,
headers,
json: data
},
function(error, response, body) {
console.log(body);
}
);
​