Add API - File argument 'path' is required

Hi all,

I am trying to use the API to add a file to my IPFS server. On my server I have a file sitting at the location /share_content/textfile.txt. So I’m attempting the following cURL request:

curl -X POST "http://ipfs:5001/api/v0/add" -d arg=path=%2Fshare_content%2Ftextfile.txt

I tried this in various ways:

curl "http://ipfs:5001/api/v0/add?path=%2Fshare_content%2Ftextfile.txt"
curl "http://ipfs:5001/api/v0/add?arg=%2Fshare_content%2Ftextfile.txt"

Each time I get the error File argument 'path' is required.

What am I doing wrong in the request?

This should work

curl -F "file=@/share_content/textfile.txt" "http://localhost:5001/api/v0/add"

Reference
https://ipfs.io/docs/api/#apiv0add

1 Like

That helped. Thank you!