Answers: <p>Based on a tip from the <a href="https://www.reddit.com/r/ipfs/comments/rfe48b/comment/hoheoko/?utm_source=share&amp;utm_medium=web2x&amp;context=3" rel="nofollow noreferrer">Reddit user techiesaravana</a> who says</p>
  <blockquote>
  <p>Hi, you have to edit ipfs config file you need to change the Address field to</p>
  <p>&quot;/ip4/0.0.0.0/tcp/5001&quot;</p>
  </blockquote>
  <p>I was able to solve the issue. To do so, I ran</p>
  <pre><code>ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
  </code></pre>
  <p>and then</p>
  <pre><code>systemctl restart ipfs
  </code></pre>
  <p>Now I get the expected result</p>
  <p><a href="https://i.sstatic.net/s2CpH.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/s2CpH.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.sstatic.net/mKd5D.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/mKd5D.png" alt="enter image description here" /></a></p>
  
Answers: CC BY-SA 4.0
Answers: 2021-12-14T10:01:11.693Z
Answers: 2021-12-14T10:01:11.693Z
Answers: Tiago Peres
Body: <p>Created a Digital Ocean Ubuntu 20.04 droplet and setup an IPFS server node in it based on <a href="https://medium.com/pinata/how-to-deploy-an-ipfs-node-on-digital-ocean-c59b9e83098e" rel="nofollow noreferrer">this tutorial</a>.</p>
  <p>If I run the following command in the server</p>
  <blockquote>
  <p>ipfs swarm peers</p>
  </blockquote>
  <p>I get the expected results</p>
  <p><a href="https://i.sstatic.net/sxcHR.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/sxcHR.png" alt="enter image description here" /></a></p>
  <p>In addition, according to <a href="https://docs.ipfs.io/reference/http/api/#getting-started" rel="nofollow noreferrer">the documentation</a></p>
  <blockquote>
  <p>Every command usable from the cli is also available through the HTTP API. For example:</p>
  <p>ipfs swarm peers</p>
  <p>curl -X POST <a href="http://127.0.0.1:5001/api/v0/swarm/peers" rel="nofollow noreferrer">http://127.0.0.1:5001/api/v0/swarm/peers</a></p>
  </blockquote>
  <p>so, as I try</p>
  <ul>
  <li>In Postman</li>
  </ul>
  <blockquote>
  <p>Error: connect ECONNREFUSED 164.92.254.19:5001</p>
  </blockquote>
  <p><a href="https://i.sstatic.net/Na9np.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Na9np.png" alt="enter image description here" /></a></p>
  <ul>
  <li>In curl</li>
  </ul>
  <blockquote>
  <p>curl: (7) Failed to connect to 164.92.254.19 port 5001 after 2295 ms: Connection refused</p>
  </blockquote>
  <p><a href="https://i.sstatic.net/wC6Z5.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/wC6Z5.png" alt="enter image description here" /></a></p>
  <hr />
  <p>For reference, here's the firewall</p>
  <p><a href="https://i.sstatic.net/aKb3q.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/aKb3q.png" alt="enter image description here" /></a></p>
  <p>and as you can see TCP 5001 is open.</p>
  
Tags: <networking><api><curl><firewall><ipfs>
Title: Why do I get "Connection Refused" when attempting to connect to IPFS API using HTTP?
UserDisplayName: Tiago Peres
ThreadText: # Why do I get "Connection Refused" when attempting to connect to IPFS API using HTTP?
  
  (Asked by: username_0 on 2021-12-13)
  
  Created a Digital Ocean Ubuntu 20.04 droplet and setup an IPFS server node in it based on [this tutorial](https://medium.com/pinata/how-to-deploy-an-ipfs-node-on-digital-ocean-c59b9e83098e).
  
  If I run the following command in the server
  
  > ipfs swarm peers
  
  I get the expected results
  
  [![enter image description here](https://i.sstatic.net/sxcHR.png)](https://i.sstatic.net/sxcHR.png)
  
  In addition, according to [the documentation](https://docs.ipfs.io/reference/http/api/#getting-started)
  
  > Every command usable from the cli is also available through the HTTP API. For example:
  >
  > ipfs swarm peers
  >
  > curl -X POST <http://127.0.0.1:5001/api/v0/swarm/peers>
  
  so, as I try
  
  * In Postman
  
  > Error: connect ECONNREFUSED 164.92.254.19:5001
  
  [![enter image description here](https://i.sstatic.net/Na9np.png)](https://i.sstatic.net/Na9np.png)
  
  * In curl
  
  > curl: (7) Failed to connect to 164.92.254.19 port 5001 after 2295 ms: Connection refused
  
  [![enter image description here](https://i.sstatic.net/wC6Z5.png)](https://i.sstatic.net/wC6Z5.png)
  
  ---
  
  For reference, here's the firewall
  
  [![enter image description here](https://i.sstatic.net/aKb3q.png)](https://i.sstatic.net/aKb3q.png)
  
  and as you can see TCP 5001 is open.
  
  **Tags:** networking, api, curl, firewall, ipfs
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2021-12-14. Score: 1 | Accepted answer
  
  Based on a tip from the [Reddit user techiesaravana](https://www.reddit.com/r/ipfs/comments/rfe48b/comment/hoheoko/?utm_source=share&utm_medium=web2x&context=3) who says
  
  > Hi, you have to edit ipfs config file you need to change the Address field to
  >
  > "/ip4/0.0.0.0/tcp/5001"
  
  I was able to solve the issue. To do so, I ran
  
  ```
  ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
  
  ```
  
  and then
  
  ```
  systemctl restart ipfs
  
  ```
  
  Now I get the expected result
  
  [![enter image description here](https://i.sstatic.net/s2CpH.png)](https://i.sstatic.net/s2CpH.png)
  
  [![enter image description here](https://i.sstatic.net/mKd5D.png)](https://i.sstatic.net/mKd5D.png)
  
  
  ---
  
  