Skip to content

Usage examples

Andrei Krivenko edited this page Jun 18, 2025 · 3 revisions

Upload file

Request body type: form-data

It should contain a "files" field, which can accept an array of files up to 5 pieces at a time.

Request

POST /api/file/upload

curl -i --location 'http://localhost:4000/api/file/upload' --form 'files=@"file.txt"'

Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
...

{"filesNames":["file.txt"],"cids":["bafkreif7v2d2wdyh6pz5y2pwmrpegfpdgh5u7n5vomxnbofraqhuk2wapm"]}

Get file

Request

GET /api/file/:cid

curl -i --location 'http://localhost:4000/api/file/bafkreif7v2d2wdyh6pz5y2pwmrpegfpdgh5u7n5vomxnbofraqhuk2wapm'

Response

HTTP/1.1 200 OK
Content-Type: application/octet-stream
...

Hello ipfs-node!

Get node info

Request

GET /api/node/info

curl -i --location 'http://localhost:4000/api/node/info'

Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
...

{
  "version": "0.0.1",
  "timestamp": 1720614998797,
  "heliaStatus": "started",
  "peerId": "12D3KooWJSiMDfyDLK3EMe2567sSM1VKQVnUn2getimGqVTWqKX9",
  "multiAddresses": [
    "/ip4/127.0.0.1/tcp/4001/p2p/12D3KooWJSiMDfyDLK3EMe2567sSM1VKQVnUn2getimGqVTWqKX9",
    "/ip4/62.72.43.99/tcp/4001/p2p/12D3KooWJSiMDfyDLK3EMe2567sSM1VKQVnUn2getimGqVTWqKX9"
  ],
  "blockstoreSizeMb": 0.0009489059448242188,
  "datastoreSizeMb": 0.006007194519042969,
  "availableSizeInMb": 2257731
}
Clone this wiki locally