Appearance
Files
Upload, list, and retrieve files on IPFS.

Upload File
POST /upload/new
Upload any file to IPFS. The file is pinned and a permanent CID is returned.
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
content | string | object | Yes | JSON object/array, or base64-encoded file data (images, PDFs, HTML, or any file type). |
description | string | No | Short description of the uploaded content. |
metadata | object | No | Custom key-value pairs to attach to the file. Max 10 keys. Keys must be alphanumeric or underscore, 1-64 characters. Values must be strings, max 256 characters each. Total metadata size must not exceed 4 KB. |
Example request
bash
curl -X POST https://api.ipfs.ninja/upload/new \
-H "X-Api-Key: bws_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"content": { "name": "example", "value": 42 },
"description": "Test upload",
"metadata": {
"project": "my-app",
"environment": "production"
}
}'Uploading an image (base64)
javascript
const fs = require("fs");
const image = fs.readFileSync("photo.png").toString("base64");
const response = await fetch("https://api.ipfs.ninja/upload/new", {
method: "POST",
headers: {
"X-Api-Key": "bws_your_api_key_here",
"Content-Type": "application/json"
},
body: JSON.stringify({
content: image,
description: "Profile photo"
})
});Response 200 OK
json
{
"cid": "QmXmCX9S6ANVjYJh3rJmXjqgYtYv7WZLUDL2XCwdPrvUwN",
"sizeMB": 0.042,
"uris": {
"ipfs": "ipfs://QmXmCX9S6ANVjYJh3rJmXjqgYtYv7WZLUDL2XCwdPrvUwN",
"url": "https://ipfs.ninja/ipfs/QmXmCX9S6ANVjYJh3rJmXjqgYtYv7WZLUDL2XCwdPrvUwN"
}
}List Files
GET /upload/list
Retrieve a list of your uploaded IPFS files within a time range.
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
from | number | Yes | Start of time range, Unix timestamp in milliseconds. |
to | number | Yes | End of time range, Unix timestamp in milliseconds. |
Example request
bash
curl "https://api.ipfs.ninja/upload/list?from=1704067200000&to=1735689600000" \
-H "X-Api-Key: bws_your_api_key_here"Response 200 OK
json
[
{
"cid": "QmXmCX9S6ANVjYJh3rJmXjqgYtYv7WZLUDL2XCwdPrvUwN",
"fileName": "Test upload",
"fileType": "json",
"sizeMB": 0.001,
"createdAt": 1711036800000,
"metadata": {
"project": "my-app",
"environment": "production"
},
"uris": {
"ipfs": "ipfs://QmXmCX9S6ANVjYJh3rJmXjqgYtYv7WZLUDL2XCwdPrvUwN",
"url": "https://ipfs.ninja/ipfs/QmXmCX9S6ANVjYJh3rJmXjqgYtYv7WZLUDL2XCwdPrvUwN"
}
}
]Get File
GET /file/:cid
Retrieve metadata for a specific uploaded file by its CID.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
cid | string | Yes | The IPFS content identifier of the file. |
Example request
bash
curl https://api.ipfs.ninja/file/QmXmCX9S6ANVjYJh3rJmXjqgYtYv7WZLUDL2XCwdPrvUwN \
-H "X-Api-Key: bws_your_api_key_here"Response 200 OK
json
{
"cid": "QmXmCX9S6ANVjYJh3rJmXjqgYtYv7WZLUDL2XCwdPrvUwN",
"fileName": "Test upload",
"fileType": "json",
"sizeMB": 0.001,
"createdAt": 1711036800000,
"uris": {
"ipfs": "ipfs://QmXmCX9S6ANVjYJh3rJmXjqgYtYv7WZLUDL2XCwdPrvUwN",
"url": "https://ipfs.ninja/ipfs/QmXmCX9S6ANVjYJh3rJmXjqgYtYv7WZLUDL2XCwdPrvUwN"
}
}