Skip to content

Commit 4e75e6a

Browse files
committed
docs: document --api flag and api file for remote node access
add documentation for connecting to remote IPFS nodes: - --api flag for per-command override - $IPFS_PATH/api file for persistent configuration updated in both CLI reference and quick-start guide with cross-references between them.
1 parent c5f6329 commit 4e75e6a

File tree

4 files changed

+83
-1
lines changed

4 files changed

+83
-1
lines changed

docs/how-to/command-line-quick-start.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,44 @@ Next, take your node online and interact with the IPFS network:
202202

203203
By default, your gateway is not exposed to the world. It only works locally.
204204

205+
## Interact with a remote node
206+
207+
By default, CLI commands talk to the daemon running on your local machine. If your daemon runs on a different machine or inside a container, there are two ways to connect to it.
208+
209+
### Using the --api flag
210+
211+
Use the `--api` flag to specify the remote API address:
212+
213+
```bash
214+
ipfs --api /ip4/192.168.1.100/tcp/5001 id
215+
```
216+
217+
The address uses [multiaddr](../concepts/glossary.md#multiaddr) format. Some common examples:
218+
219+
- `/ip4/192.168.1.100/tcp/5001` - IPv4 address
220+
- `/ip6/::1/tcp/5001` - IPv6 address
221+
- `/dns/node.example.com/tcp/5001` - DNS name
222+
223+
### Using the api file
224+
225+
To avoid passing `--api` to every command, create an `api` file in your IPFS repository containing the multiaddr of the remote API:
226+
227+
```bash
228+
echo "/ip4/192.168.1.100/tcp/5001" > ~/.ipfs/api
229+
```
230+
231+
Now all commands will use the remote node:
232+
233+
```bash
234+
ipfs id
235+
```
236+
237+
:::tip
238+
Kubo creates `$IPFS_PATH/api` automatically when `ipfs daemon` starts. When connecting to a remote node, you can create this file manually to point to the remote API instead.
239+
:::
240+
241+
For TLS-secured remote APIs with authentication (`--api-auth`), see [Securing Kubo RPC API](kubo-rpc-tls-auth.md).
242+
205243
## Interact with the node using the web console
206244

207245
You can view the web console for your local node by navigating to `localhost:5001/webui`.

docs/install/run-ipfs-inside-docker.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ You can run Kubo IPFS inside Docker to simplify your deployment processes, as we
6262
docker exec ipfs_host ipfs add -r /export/<something>
6363
```
6464

65+
:::tip Using your local ipfs CLI
66+
If you have `ipfs` installed on the host and the RPC API port is exposed, you can run commands without `docker exec`. See [Interact with a remote node](../how-to/command-line-quick-start.md#interact-with-a-remote-node) for details.
67+
:::
68+
6569
1. Stop the running container:
6670

6771
```shell

docs/reference/kubo/cli.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: API documentation for the Kubo command-line executable.
55

66
# Kubo command-line
77

8-
::: tip Generated on 2025-11-27 03:54:28, from kubo 0.39.0
8+
::: tip Generated on 2025-12-02 20:59:35, from kubo 0.39.0
99
This document was autogenerated from CLI help text in [kubo 0.39.0](https://github.com/ipfs/kubo/releases/tag/v0.39.0)
1010
For issues and support, check out the [generate-cli-docs.sh](https://github.com/ipfs/ipfs-docs/blob/main/docs/reference/kubo/generate-cli-docs.sh) script on GitHub.
1111
:::
@@ -38,6 +38,26 @@ Every command usable from the CLI is also available through the [RPC API v0](/re
3838
}
3939
```
4040

41+
### Connecting to a Remote API
42+
43+
By default, CLI commands connect to the local daemon at `/ip4/127.0.0.1/tcp/5001`. There are two ways to connect to a different instance:
44+
45+
1. Use the `--api` flag:
46+
47+
```sh
48+
ipfs --api /ip4/192.168.1.100/tcp/5001 id
49+
```
50+
51+
2. Create an `api` file in your IPFS repository (`$IPFS_PATH/api`, usually `~/.ipfs/api`) containing the [multiaddr](../../concepts/glossary.md#multiaddr) of the API endpoint:
52+
53+
```sh
54+
echo /ip4/192.168.1.100/tcp/5001 > ~/.ipfs/api
55+
ipfs id
56+
```
57+
58+
Kubo creates this file automatically when `ipfs daemon` starts. Creating it manually lets you use a remote node without passing `--api` to every command.
59+
60+
For a step-by-step guide, see [Interact with a remote node](../../how-to/command-line-quick-start.md#interact-with-a-remote-node). For TLS-secured APIs with authentication (`--api-auth`), see [Securing Kubo RPC API](../../how-to/kubo-rpc-tls-auth.md).
4161

4262

4363
## ipfs

docs/reference/kubo/generate-cli-docs.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,26 @@ Every command usable from the CLI is also available through the [RPC API v0](/re
4646
}
4747
\`\`\`
4848
49+
### Connecting to a Remote API
50+
51+
By default, CLI commands connect to the local daemon at \`/ip4/127.0.0.1/tcp/5001\`. There are two ways to connect to a different instance:
52+
53+
1. Use the \`--api\` flag:
54+
55+
\`\`\`sh
56+
ipfs --api /ip4/192.168.1.100/tcp/5001 id
57+
\`\`\`
58+
59+
2. Create an \`api\` file in your IPFS repository (\`\$IPFS_PATH/api\`, usually \`~/.ipfs/api\`) containing the [multiaddr](../../concepts/glossary.md#multiaddr) of the API endpoint:
60+
61+
\`\`\`sh
62+
echo "/ip4/192.168.1.100/tcp/5001" > ~/.ipfs/api
63+
ipfs id
64+
\`\`\`
65+
66+
Kubo creates this file automatically when \`ipfs daemon\` starts. Creating it manually lets you use a remote node without passing \`--api\` to every command.
67+
68+
For a step-by-step guide, see [Interact with a remote node](../../how-to/command-line-quick-start.md#interact-with-a-remote-node). For TLS-secured APIs with authentication (\`--api-auth\`), see [Securing Kubo RPC API](../../how-to/kubo-rpc-tls-auth.md).
4969
"
5070
printf "\n"
5171
ipfs commands | while read line ; do

0 commit comments

Comments
 (0)