<p>You can also make a request by explicitly mentioning the username and password in the URI:</p>
<p><code>http://bitcoinrpc:anything@127.0.0.1:8332/</code></p>
<p>Making your request to this address should be sufficient.</p>
<p>So, full command:</p>
<pre><code>curl --data-binary '{&quot;jsonrpc&quot;:&quot;1.0&quot;,&quot;id&quot;:&quot;curltext&quot;,&quot;method&quot;:&quot;getblockchaininfo&quot;,&quot;params&quot;:[]}' -H 'content-type:text/plain;' http://bitcoinrpc:anything@127.0.0.1:8332/
</code></pre>

CC BY-SA 4.0
2014-01-04T18:26:46.277Z
2023-10-19T09:15:27.970Z
2023-10-19T09:15:27.970Z
Steven Roose
<p>I got it to work by adding the password to the --user value, separated with ":".
So the example becomes:</p>

<pre><code>curl --user bitcoinrpc:xxxxxxxxxxxxxxx --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getinfo","params":[]}' -H 'content-type:text/plain;' http://127.0.0.1:8332
</code></pre>

<p>Where "xxxxxxxxxxxxxxx" is the rpcpassword stored in the .conf file. </p>

CC BY-SA 3.0
2015-12-30T02:38:39.007Z
Have you tried ?  
curl --user bitcoinrpc --password xxxxxxxxxxxxxxx --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getinfo","params":[]}' -H 'content-type:text/plain;' http://127.0.0.1:8332
szydan
CC BY-SA 3.0
2016-12-19T13:29:22.260Z
curl: option --password: is unknown
e18r
CC BY-SA 4.0
2021-04-22T23:31:18.957Z
`getinfo` is deprecated.  Should now be `getnetworkinfo`, `getblockchaininfo` or `getwalletinfo`.
Jonathan Cross
CC BY-SA 3.0
2015-12-28T19:22:57.413Z
2015-12-28T19:22:57.413Z
Jeroen Flamman
<p>I'am running Bitcoin-qt 0.8.6.1-beta on Qt 4.8.3 on windows 7 64.</p>

<p>below is my .conf content in %appdata%/bitcoin folder</p>

<pre><code>rpcuser=bitcoinrpc
rpcpassword=ahything
rpcallowip=127.0.0.1
rpcallowip=192.168.*.*
rpcport=9332 
server=1
daemon=0
addnode=69.164.218.197
</code></pre>

<p>using curl 7.26.0 (i686-pc-mingw32), I run the following command:</p>

<pre><code>curl --user 'bitcoinrpc' --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getinfo","params":[]}' -H 'content-type:text/plain;' http://127.0.0.1:8332
</code></pre>

<p>the pc ask for host password.</p>

<p>I have tried the .conf password and also the PC password (which is the one I log into my PC)</p>

<p>I always get error 401 (unauthorized) result.</p>

<p>Can anyone advice me where did I went wrong or how do I know which password it refer to?</p>

<p>TIA </p>

<p>Regards,
KK Gian</p>

<json-rpc>
json-rpc via curl
Gian
# json-rpc via curl

(Asked by: username_0 on 2014-01-01)

I'am running Bitcoin-qt 0.8.6.1-beta on Qt 4.8.3 on windows 7 64.

below is my .conf content in %appdata%/bitcoin folder

```
rpcuser=bitcoinrpc
rpcpassword=ahything
rpcallowip=127.0.0.1
rpcallowip=192.168.*.*
rpcport=9332 
server=1
daemon=0
addnode=69.164.218.197

```

using curl 7.26.0 (i686-pc-mingw32), I run the following command:

```
curl --user 'bitcoinrpc' --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getinfo","params":[]}' -H 'content-type:text/plain;' http://127.0.0.1:8332

```

the pc ask for host password.

I have tried the .conf password and also the PC password (which is the one I log into my PC)

I always get error 401 (unauthorized) result.

Can anyone advice me where did I went wrong or how do I know which password it refer to?

TIA

Regards,
KK username_0

**Tags:** json-rpc


---

## 2 answers

### Answer by username_1 on 2014-01-04. Score: 22

You can also make a request by explicitly mentioning the username and password in the URI:

`http://bitcoinrpc:anything@127.0.0.1:8332/`

Making your request to this address should be sufficient.

So, full command:

```
curl --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getblockchaininfo","params":[]}' -H 'content-type:text/plain;' http://bitcoinrpc:anything@127.0.0.1:8332/

```


---

### Answer by username_2 on 2015-12-28. Score: 15

I got it to work by adding the password to the --user value, separated with ":".
So the example becomes:

```
curl --user bitcoinrpc:xxxxxxxxxxxxxxx --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getinfo","params":[]}' -H 'content-type:text/plain;' http://127.0.0.1:8332

```

Where "xxxxxxxxxxxxxxx" is the rpcpassword stored in the .conf file.

> **Comments:**
> **username_3**: Have you tried ?   curl --user bitcoinrpc --password xxxxxxxxxxxxxxx --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getinfo","params":[]}' -H 'content-type:text/plain;' http://127.0.0.1:8332  
> **username_4**: curl: option --password: is unknown  
> **username_5**: `getinfo` is deprecated.  Should now be `getnetworkinfo`, `getblockchaininfo` or `getwalletinfo`.  

---

