Skip to main content
1 of 3
Roland Kofler
  • 11.7k
  • 3
  • 44
  • 83

Read the documentation:

Every command usable from the cli is also available through the HTTP API. For example:

ipfs swarm peers

curl http://127.0.0.1:5001/api/v0/swarm/peers

So for the command:

USAGE ipfs add ... - Add a file to ipfs.

ARGUMENTS

< path >... - The path to a file to be added to IPFS.

https://ipfs.io/docs/commands/#ipfs-add

the equivalent API call would be:

curl -F "image=@/home/bar.jpg" 127.0.0.1:5001/api/v0/add
Roland Kofler
  • 11.7k
  • 3
  • 44
  • 83