title | weight | menu | ||||
---|---|---|---|---|---|---|
HTTP API |
20 |
|
Generated on 2020-03-06, from go-ipfs v0.5.0-dev.
When an IPFS node is running as a daemon, it exposes an HTTP API that allows you to control the node and run the same commands you can from the command line.
In many cases, using this API this is preferable to embedding IPFS directly in
your program — it allows you to maintain peer connections that are longer
lived than your app and you can keep a single IPFS node running instead of
several if your app can be launched multiple times. In fact, the ipfs
CLI commands use this API when operating in [online mode]({{< relref
"usage.md#taking-your-node-online" >}}).
For issues and support, check out the ipfs-http-api-docs repository on GitHub.
The HTTP API under /api/v0/
is an RPC-style API over HTTP, not a REST API.
[Every command]({{< relref "cli.md" >}}) usable from the CLI is also available through the HTTP API. For example:
> ipfs swarm peers
/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
/ip4/104.236.151.122/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx
/ip4/104.236.176.52/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z
> curl http://127.0.0.1:5001/api/v0/swarm/peers
{
"Strings": [
"/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
"/ip4/104.236.151.122/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx",
"/ip4/104.236.176.52/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z",
]
}
Arguments are added through the special query string key "arg":
> curl "http://127.0.0.1:5001/api/v0/swarm/disconnect?arg=/ip4/54.93.113.247/tcp/48131/ipfs/QmUDS3nsBD1X4XK5Jo836fed7SErTyTuQzRqWaiQAyBYMP"
{
"Strings": [
"disconnect QmUDS3nsBD1X4XK5Jo836fed7SErTyTuQzRqWaiQAyBYMP success",
]
}
Note that it can be used multiple times to signify multiple arguments.
Flags are added through the query string. For example, the --encoding=json
flag is the &encoding=json
query parameter below:
> curl "http://127.0.0.1:5001/api/v0/object/get?arg=QmaaqrHyAQm7gALkRW8DcfGX3u8q9rWKnxEMmf7m9z515w&encoding=json"
{
"Links": [
{
"Name": "index.html",
"Hash": "QmYftndCvcEiuSZRX7njywX2AGSeHY2ASa7VryCq1mKwEw",
"Size": 1700
},
{
"Name": "static",
"Hash": "QmdtWFiasJeh2ymW3TD2cLHYxn1ryTuWoNpwieFyJriGTS",
"Size": 2428803
}
],
"Data": "CAE="
}
Status codes used at the RPC layer are simple:
500
- RPC endpoint returned an error404
- RPC endpoint doesn't exist400
- Malformed RPC, argument type error, etc403
- RPC call forbidden
In other words, 500
means that the function does exist, it just failed internally for some reason. To know that reason, you have to look at the "application layer" error (commands lib error).
Add a file or directory to ipfs.
arg
[file]: The path to a file to be added to ipfs. Required: yes.recursive
[bool]: Add directory paths recursively. Required: no.dereference-args
[bool]: Symlinks supplied in arguments are dereferenced. Required: no.stdin-name
[string]: Assign a name if the file source is stdin. Required: no.hidden
[bool]: Include files that are hidden. Only takes effect on recursive add. Required: no.quiet
[bool]: Write minimal output. Required: no.quieter
[bool]: Write only final hash. Required: no.silent
[bool]: Write no output. Required: no.progress
[bool]: Stream progress data. Required: no.trickle
[bool]: Use trickle-dag format for dag generation. Required: no.only-hash
[bool]: Only chunk and hash - do not write to disk. Required: no.wrap-with-directory
[bool]: Wrap files with a directory object. Required: no.chunker
[string]: Chunking algorithm, size-[bytes], rabin-[min]-[avg]-[max] or buzhash. Default: "size-262144". Required: no.pin
[bool]: Pin this object when adding. Default: "true". Required: no.raw-leaves
[bool]: Use raw blocks for leaf nodes. (experimental). Required: no.nocopy
[bool]: Add the file using filestore. Implies raw-leaves. (experimental). Required: no.fscache
[bool]: Check the filestore for pre-existing blocks. (experimental). Required: no.cid-version
[int]: CID version. Defaults to 0 unless an option that depends on CIDv1 is passed. (experimental). Required: no.hash
[string]: Hash function to use. Implies CIDv1 if not sha2-256. (experimental). Default: "sha2-256". Required: no.inline
[bool]: Inline small blocks into CIDs. (experimental). Required: no.inline-limit
[int]: Maximum block size to inline. (experimental). Default: "32". Required: no.
Argument "path" is of file type. This endpoint expects a file in the body of the request as 'multipart/form-data'.
On success, the call to this endpoint will return with 200 and the following body:
{
"Bytes": "<int64>",
"Hash": "<string>",
"Name": "<string>",
"Size": "<string>"
}
curl -F file=@myfile "http://localhost:5001/api/v0/add?recursive=<value>&dereference-args=<value>&stdin-name=<value>&hidden=<value>&quiet=<value>&quieter=<value>&silent=<value>&progress=<value>&trickle=<value>&only-hash=<value>&wrap-with-directory=<value>&chunker=size-262144&pin=true&raw-leaves=<value>&nocopy=<value>&fscache=<value>&cid-version=<value>&hash=sha2-256&inline=<value>&inline-limit=32"
Show the current ledger for a peer.
arg
[string]: The PeerID (B58) of the ledger to inspect. Required: yes.
On success, the call to this endpoint will return with 200 and the following body:
{
"Exchanged": "<uint64>",
"Peer": "<string>",
"Recv": "<uint64>",
"Sent": "<uint64>",
"Value": "<float64>"
}
curl "http://localhost:5001/api/v0/bitswap/ledger?arg=<peer>"
Trigger reprovider.
This endpoint takes no arguments.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/bitswap/reprovide"
Show some diagnostic information on the bitswap agent.
verbose
[bool]: Print extra information. Required: no.human
[bool]: Print sizes in human readable format (e.g., 1K 234M 2G). Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"BlocksReceived": "<uint64>",
"BlocksSent": "<uint64>",
"DataReceived": "<uint64>",
"DataSent": "<uint64>",
"DupBlksReceived": "<uint64>",
"DupDataReceived": "<uint64>",
"MessagesReceived": "<uint64>",
"Peers": [
"<string>"
],
"ProvideBufLen": "<int>",
"Wantlist": [
{
"/": "<cid-string>"
}
]
}
curl "http://localhost:5001/api/v0/bitswap/stat?verbose=<value>&human=<value>"
Show blocks currently on the wantlist.
peer
[string]: Specify which peer to show wantlist for. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Keys": [
{
"/": "<cid-string>"
}
]
}
curl "http://localhost:5001/api/v0/bitswap/wantlist?peer=<value>"
Get a raw IPFS block.
arg
[string]: The base58 multihash of an existing block to get. Required: yes.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/block/get?arg=<key>"
Store input as an IPFS block.
arg
[file]: The data to be stored as an IPFS block. Required: yes.format
[string]: cid format for blocks to be created with. Required: no.mhtype
[string]: multihash hash function. Default: "sha2-256". Required: no.mhlen
[int]: multihash hash length. Default: "-1". Required: no.pin
[bool]: pin added blocks recursively. Default: "false". Required: no.
Argument "data" is of file type. This endpoint expects a file in the body of the request as 'multipart/form-data'.
On success, the call to this endpoint will return with 200 and the following body:
{
"Key": "<string>",
"Size": "<int>"
}
curl -F file=@myfile "http://localhost:5001/api/v0/block/put?format=<value>&mhtype=sha2-256&mhlen=-1&pin=false"
Remove IPFS block(s).
arg
[string]: Bash58 encoded multihash of block(s) to remove. Required: yes.force
[bool]: Ignore nonexistent blocks. Required: no.quiet
[bool]: Write minimal output. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Error": "<string>",
"Hash": "<string>"
}
curl "http://localhost:5001/api/v0/block/rm?arg=<hash>&force=<value>&quiet=<value>"
Print information of a raw IPFS block.
arg
[string]: The base58 multihash of an existing block to stat. Required: yes.
On success, the call to this endpoint will return with 200 and the following body:
{
"Key": "<string>",
"Size": "<int>"
}
curl "http://localhost:5001/api/v0/block/stat?arg=<key>"
Show or edit the list of bootstrap peers.
This endpoint takes no arguments.
On success, the call to this endpoint will return with 200 and the following body:
{
"Peers": [
"<string>"
]
}
curl "http://localhost:5001/api/v0/bootstrap"
Add peers to the bootstrap list.
arg
[string]: A peer to add to the bootstrap list (in the format '/') Required: no.default
[bool]: Add default bootstrap nodes. (Deprecated, use 'default' subcommand instead). Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Peers": [
"<string>"
]
}
curl "http://localhost:5001/api/v0/bootstrap/add?arg=<peer>&default=<value>"
Add default peers to the bootstrap list.
This endpoint takes no arguments.
On success, the call to this endpoint will return with 200 and the following body:
{
"Peers": [
"<string>"
]
}
curl "http://localhost:5001/api/v0/bootstrap/add/default"
Show peers in the bootstrap list.
This endpoint takes no arguments.
On success, the call to this endpoint will return with 200 and the following body:
{
"Peers": [
"<string>"
]
}
curl "http://localhost:5001/api/v0/bootstrap/list"
Remove peers from the bootstrap list.
arg
[string]: A peer to add to the bootstrap list (in the format '/') Required: no.all
[bool]: Remove all bootstrap peers. (Deprecated, use 'all' subcommand). Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Peers": [
"<string>"
]
}
curl "http://localhost:5001/api/v0/bootstrap/rm?arg=<peer>&all=<value>"
Remove all peers from the bootstrap list.
This endpoint takes no arguments.
On success, the call to this endpoint will return with 200 and the following body:
{
"Peers": [
"<string>"
]
}
curl "http://localhost:5001/api/v0/bootstrap/rm/all"
Show IPFS object data.
arg
[string]: The path to the IPFS object(s) to be outputted. Required: yes.offset
[int64]: Byte offset to begin reading from. Required: no.length
[int64]: Maximum number of bytes to read. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/cat?arg=<ipfs-path>&offset=<value>&length=<value>"
Convert CIDs to Base32 CID version 1.
arg
[string]: Cids to convert. Required: yes.
On success, the call to this endpoint will return with 200 and the following body:
{
"CidStr": "<string>",
"ErrorMsg": "<string>",
"Formatted": "<string>"
}
curl "http://localhost:5001/api/v0/cid/base32?arg=<cid>"
List available multibase encodings.
prefix
[bool]: also include the single leter prefixes in addition to the code. Required: no.numeric
[bool]: also include numeric codes. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
[
{
"Code": "<int>",
"Name": "<string>"
}
]
curl "http://localhost:5001/api/v0/cid/bases?prefix=<value>&numeric=<value>"
List available CID codecs.
numeric
[bool]: also include numeric codes. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
[
{
"Code": "<int>",
"Name": "<string>"
}
]
curl "http://localhost:5001/api/v0/cid/codecs?numeric=<value>"
Format and convert a CID in various useful ways.
arg
[string]: Cids to format. Required: yes.f
[string]: Printf style format string. Default: %!s(MISSING). Default: "%!s(MISSING)". Required: no.v
[string]: CID version to convert to. Required: no.codec
[string]: CID codec to convert to. Required: no.b
[string]: Multibase to display CID in. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"CidStr": "<string>",
"ErrorMsg": "<string>",
"Formatted": "<string>"
}
curl "http://localhost:5001/api/v0/cid/format?arg=<cid>&f=%s&v=<value>&codec=<value>&b=<value>"
List available multihashes.
numeric
[bool]: also include numeric codes. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
[
{
"Code": "<int>",
"Name": "<string>"
}
]
curl "http://localhost:5001/api/v0/cid/hashes?numeric=<value>"
List all available commands.
flags
[bool]: Show command flags. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Name": "<string>",
"Options": [
{
"Names": [
"<string>"
]
}
],
"Subcommands": [
{
"Name": "<string>",
"Options": [
{
"Names": [
"<string>"
]
}
],
"Subcommands": [
"..."
]
}
]
}
curl "http://localhost:5001/api/v0/commands?flags=<value>"
Get and set ipfs config values.
arg
[string]: The key of the config entry (e.g. "Addresses.API"). Required: yes.arg
[string]: The value to set the config entry to. Required: no.bool
[bool]: Set a boolean value. Required: no.json
[bool]: Parse stringified JSON. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Key": "<string>",
"Value": "<object>"
}
curl "http://localhost:5001/api/v0/config?arg=<key>&arg=<value>&bool=<value>&json=<value>"
Open the config file for editing in $EDITOR.
This endpoint takes no arguments.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/config/edit"
Apply profile to config.
arg
[string]: The profile to apply to the config. Required: yes.dry-run
[bool]: print difference between the current config and the config that would be generated. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"NewCfg": {
"<string>": "<object>"
},
"OldCfg": {
"<string>": "<object>"
}
}
curl "http://localhost:5001/api/v0/config/profile/apply?arg=<profile>&dry-run=<value>"
Replace the config with .
arg
[file]: The file to use as the new config. Required: yes.
Argument "file" is of file type. This endpoint expects a file in the body of the request as 'multipart/form-data'.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl -F file=@myfile "http://localhost:5001/api/v0/config/replace"
Output config file contents.
This endpoint takes no arguments.
On success, the call to this endpoint will return with 200 and the following body:
{
"<string>": "<object>"
}
curl "http://localhost:5001/api/v0/config/show"
Get a dag node from ipfs.
arg
[string]: The object to get Required: yes.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/dag/get?arg=<ref>"
Add a dag node to ipfs.
arg
[file]: The object to put Required: yes.format
[string]: Format that the object will be added as. Default: "cbor". Required: no.input-enc
[string]: Format that the input object will be. Default: "json". Required: no.pin
[bool]: Pin this object when adding. Required: no.hash
[string]: Hash function to use. Default: . Required: no.
Argument "object data" is of file type. This endpoint expects a file in the body of the request as 'multipart/form-data'.
On success, the call to this endpoint will return with 200 and the following body:
{
"Cid": {
"/": "<cid-string>"
}
}
curl -F file=@myfile "http://localhost:5001/api/v0/dag/put?format=cbor&input-enc=json&pin=<value>&hash=<value>"
Resolve ipld block
arg
[string]: The path to resolve Required: yes.
On success, the call to this endpoint will return with 200 and the following body:
{
"Cid": {
"/": "<cid-string>"
},
"RemPath": "<string>"
}
curl "http://localhost:5001/api/v0/dag/resolve?arg=<ref>"
Find the multiaddresses associated with a Peer ID.
arg
[string]: The ID of the peer to search for. Required: yes.verbose
[bool]: Print extra information. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Extra": "<string>",
"ID": "<peer-id>",
"Responses": [
{
"Addrs": [
"<multiaddr-string>"
],
"ID": "peer-id"
}
],
"Type": "<int>"
}
curl "http://localhost:5001/api/v0/dht/findpeer?arg=<peerID>&verbose=<value>"
Find peers that can provide a specific value, given a key.
arg
[string]: The key to find providers for. Required: yes.verbose
[bool]: Print extra information. Required: no.num-providers
[int]: The number of providers to find. Default: "20". Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Extra": "<string>",
"ID": "<peer-id>",
"Responses": [
{
"Addrs": [
"<multiaddr-string>"
],
"ID": "peer-id"
}
],
"Type": "<int>"
}
curl "http://localhost:5001/api/v0/dht/findprovs?arg=<key>&verbose=<value>&num-providers=20"
Given a key, query the routing system for its best value.
arg
[string]: The key to find a value for. Required: yes.verbose
[bool]: Print extra information. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Extra": "<string>",
"ID": "<peer-id>",
"Responses": [
{
"Addrs": [
"<multiaddr-string>"
],
"ID": "peer-id"
}
],
"Type": "<int>"
}
curl "http://localhost:5001/api/v0/dht/get?arg=<key>&verbose=<value>"
Announce to the network that you are providing given values.
arg
[string]: The key[s] to send provide records for. Required: yes.verbose
[bool]: Print extra information. Required: no.recursive
[bool]: Recursively provide entire graph. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Extra": "<string>",
"ID": "<peer-id>",
"Responses": [
{
"Addrs": [
"<multiaddr-string>"
],
"ID": "peer-id"
}
],
"Type": "<int>"
}
curl "http://localhost:5001/api/v0/dht/provide?arg=<key>&verbose=<value>&recursive=<value>"
Write a key/value pair to the routing system.
arg
[string]: The key to store the value at. Required: yes.arg
[file]: The value to store. Required: yes.verbose
[bool]: Print extra information. Required: no.
Argument "value" is of file type. This endpoint expects a file in the body of the request as 'multipart/form-data'.
On success, the call to this endpoint will return with 200 and the following body:
{
"Extra": "<string>",
"ID": "<peer-id>",
"Responses": [
{
"Addrs": [
"<multiaddr-string>"
],
"ID": "peer-id"
}
],
"Type": "<int>"
}
curl -F file=@myfile "http://localhost:5001/api/v0/dht/put?arg=<key>&verbose=<value>"
Find the closest Peer IDs to a given Peer ID by querying the DHT.
arg
[string]: The peerID to run the query against. Required: yes.verbose
[bool]: Print extra information. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Extra": "<string>",
"ID": "<peer-id>",
"Responses": [
{
"Addrs": [
"<multiaddr-string>"
],
"ID": "peer-id"
}
],
"Type": "<int>"
}
curl "http://localhost:5001/api/v0/dht/query?arg=<peerID>&verbose=<value>"
List commands run on this IPFS node.
verbose
[bool]: Print extra information. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
[
{
"Active": "<bool>",
"Args": [
"<string>"
],
"Command": "<string>",
"EndTime": "<timestamp>",
"ID": "<int>",
"Options": {
"<string>": "<object>"
},
"StartTime": "<timestamp>"
}
]
curl "http://localhost:5001/api/v0/diag/cmds?verbose=<value>"
Clear inactive requests from the log.
This endpoint takes no arguments.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/diag/cmds/clear"
Set how long to keep inactive requests in the log.
arg
[string]: Time to keep inactive requests in log. Required: yes.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/diag/cmds/set-time?arg=<time>"
Print system diagnostic information.
This endpoint takes no arguments.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/diag/sys"
Resolve DNS links.
arg
[string]: The domain-name name to resolve. Required: yes.recursive
[bool]: Resolve until the result is not a DNS link. Default: "true". Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Path": "<string>"
}
curl "http://localhost:5001/api/v0/dns?arg=<domain-name>&recursive=true"
List directory contents for Unix filesystem objects.
arg
[string]: The path to the IPFS object(s) to list links from. Required: yes.
On success, the call to this endpoint will return with 200 and the following body:
{
"Arguments": {
"<string>": "<string>"
},
"Objects": {
"<string>": {
"Hash": "<string>",
"Links": [
{
"Hash": "<string>",
"Name": "<string>",
"Size": "<uint64>",
"Type": "<string>"
}
],
"Size": "<uint64>",
"Type": "<string>"
}
}
}
curl "http://localhost:5001/api/v0/file/ls?arg=<ipfs-path>"
Change the cid version or hash function of the root node of a given path.
arg
[string]: Path to change. Default: '/'. Required: no.cid-version
[int]: Cid version to use. (experimental). Required: no.hash
[string]: Hash function to use. Will set Cid version to 1 if used. (experimental). Required: no.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/files/chcid?arg=<path>&cid-version=<value>&hash=<value>"
Copy files into mfs.
arg
[string]: Source object to copy. Required: yes.arg
[string]: Destination to copy object to. Required: yes.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/files/cp?arg=<source>&arg=<dest>"
Flush a given path's data to disk.
arg
[string]: Path to flush. Default: '/'. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Cid": "<string>"
}
curl "http://localhost:5001/api/v0/files/flush?arg=<path>"
List directories in the local mutable namespace.
arg
[string]: Path to show listing for. Defaults to '/'. Required: no.long
[bool]: Use long listing format. Required: no.U
[bool]: Do not sort; list entries in directory order. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Entries": [
{
"Hash": "<string>",
"Name": "<string>",
"Size": "<int64>",
"Type": "<int>"
}
]
}
curl "http://localhost:5001/api/v0/files/ls?arg=<path>&long=<value>&U=<value>"
Make directories.
arg
[string]: Path to dir to make. Required: yes.parents
[bool]: No error if existing, make parent directories as needed. Required: no.cid-version
[int]: Cid version to use. (experimental). Required: no.hash
[string]: Hash function to use. Will set Cid version to 1 if used. (experimental). Required: no.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/files/mkdir?arg=<path>&parents=<value>&cid-version=<value>&hash=<value>"
Move files.
arg
[string]: Source file to move. Required: yes.arg
[string]: Destination path for file to be moved to. Required: yes.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/files/mv?arg=<source>&arg=<dest>"
Read a file in a given mfs.
arg
[string]: Path to file to be read. Required: yes.offset
[int64]: Byte offset to begin reading from. Required: no.count
[int64]: Maximum number of bytes to read. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/files/read?arg=<path>&offset=<value>&count=<value>"
Remove a file.
arg
[string]: File to remove. Required: yes.recursive
[bool]: Recursively remove directories. Required: no.force
[bool]: Forcibly remove target at path; implies -r for directories. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/files/rm?arg=<path>&recursive=<value>&force=<value>"
Display file status.
arg
[string]: Path to node to stat. Required: yes.format
[string]: Print statistics in given format. Allowed tokens: . Conflicts with other format options. Default: Size: CumulativeSize: ChildBlocks: Type: . Default: " Size: CumulativeSize: ChildBlocks: Type: ". Required: no.hash
[bool]: Print only hash. Implies '--format='. Conflicts with other format options. Required: no.size
[bool]: Print only size. Implies '--format='. Conflicts with other format options. Required: no.with-local
[bool]: Compute the amount of the dag that is local, and if possible the total size. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Blocks": "<int>",
"CumulativeSize": "<uint64>",
"Hash": "<string>",
"Local": "<bool>",
"Size": "<uint64>",
"SizeLocal": "<uint64>",
"Type": "<string>",
"WithLocality": "<bool>"
}
curl "http://localhost:5001/api/v0/files/stat?arg=<path>&format=<hash> Size: <size> CumulativeSize: <cumulsize> ChildBlocks: <childs> Type: <type>&hash=<value>&size=<value>&with-local=<value>"
Write to a mutable file in a given filesystem.
arg
[string]: Path to write to. Required: yes.arg
[file]: Data to write. Required: yes.offset
[int64]: Byte offset to begin writing at. Required: no.create
[bool]: Create the file if it does not exist. Required: no.parents
[bool]: Make parent directories as needed. Required: no.truncate
[bool]: Truncate the file to size zero before writing. Required: no.count
[int64]: Maximum number of bytes to read. Required: no.raw-leaves
[bool]: Use raw blocks for newly created leaf nodes. (experimental). Required: no.cid-version
[int]: Cid version to use. (experimental). Required: no.hash
[string]: Hash function to use. Will set Cid version to 1 if used. (experimental). Required: no.
Argument "data" is of file type. This endpoint expects a file in the body of the request as 'multipart/form-data'.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl -F file=@myfile "http://localhost:5001/api/v0/files/write?arg=<path>&offset=<value>&create=<value>&parents=<value>&truncate=<value>&count=<value>&raw-leaves=<value>&cid-version=<value>&hash=<value>"
List blocks that are both in the filestore and standard block storage.
This endpoint takes no arguments.
On success, the call to this endpoint will return with 200 and the following body:
{
"Err": "<string>",
"Ref": "<string>"
}
curl "http://localhost:5001/api/v0/filestore/dups"
List objects in filestore.
arg
[string]: Cid of objects to list. Required: no.file-order
[bool]: sort the results based on the path of the backing file. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"ErrorMsg": "<string>",
"FilePath": "<string>",
"Key": {
"/": "<cid-string>"
},
"Offset": "<uint64>",
"Size": "<uint64>",
"Status": "<int32>"
}
curl "http://localhost:5001/api/v0/filestore/ls?arg=<obj>&file-order=<value>"
Verify objects in filestore.
arg
[string]: Cid of objects to verify. Required: no.file-order
[bool]: verify the objects based on the order of the backing file. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"ErrorMsg": "<string>",
"FilePath": "<string>",
"Key": {
"/": "<cid-string>"
},
"Offset": "<uint64>",
"Size": "<uint64>",
"Status": "<int32>"
}
curl "http://localhost:5001/api/v0/filestore/verify?arg=<obj>&file-order=<value>"
Download IPFS objects.
arg
[string]: The path to the IPFS object(s) to be outputted. Required: yes.output
[string]: The path where the output should be stored. Required: no.archive
[bool]: Output a TAR archive. Required: no.compress
[bool]: Compress the output with GZIP compression. Required: no.compression-level
[int]: The level of compression (1-9). Required: no.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/get?arg=<ipfs-path>&output=<value>&archive=<value>&compress=<value>&compression-level=<value>"
Show ipfs node id info.
arg
[string]: Peer.ID of node to look up. Required: no.format
[string]: Optional output format. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Addresses": [
"<string>"
],
"AgentVersion": "<string>",
"ID": "<string>",
"ProtocolVersion": "<string>",
"PublicKey": "<string>"
}
curl "http://localhost:5001/api/v0/id?arg=<peerid>&format=<value>"
Create a new keypair
arg
[string]: name of key to create Required: yes.type
[string]: type of the key to create: rsa, ed25519. Default: "rsa". Required: no.size
[int]: size of the key to generate. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Id": "<string>",
"Name": "<string>"
}
curl "http://localhost:5001/api/v0/key/gen?arg=<name>&type=rsa&size=<value>"
List all local keypairs
l
[bool]: Show extra information about keys. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Keys": [
{
"Id": "<string>",
"Name": "<string>"
}
]
}
curl "http://localhost:5001/api/v0/key/list?l=<value>"
Rename a keypair
arg
[string]: name of key to rename Required: yes.arg
[string]: new name of the key Required: yes.force
[bool]: Allow to overwrite an existing key. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Id": "<string>",
"Now": "<string>",
"Overwrite": "<bool>",
"Was": "<string>"
}
curl "http://localhost:5001/api/v0/key/rename?arg=<name>&arg=<newName>&force=<value>"
Remove a keypair
arg
[string]: names of keys to remove Required: yes.l
[bool]: Show extra information about keys. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Keys": [
{
"Id": "<string>",
"Name": "<string>"
}
]
}
curl "http://localhost:5001/api/v0/key/rm?arg=<name>&l=<value>"
Change the logging level.
arg
[string]: The subsystem logging identifier. Use 'all' for all subsystems. Required: yes.arg
[string]: The log level, with 'debug' the most verbose and 'critical' the least verbose. One of: debug, info, warning, error, critical. Required: yes.
On success, the call to this endpoint will return with 200 and the following body:
{
"Message": "<string>"
}
curl "http://localhost:5001/api/v0/log/level?arg=<subsystem>&arg=<level>"
List the logging subsystems.
This endpoint takes no arguments.
On success, the call to this endpoint will return with 200 and the following body:
{
"Strings": [
"<string>"
]
}
curl "http://localhost:5001/api/v0/log/ls"
Read the event log.
This endpoint takes no arguments.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/log/tail"
List directory contents for Unix filesystem objects.
arg
[string]: The path to the IPFS object(s) to list links from. Required: yes.headers
[bool]: Print table headers (Hash, Size, Name). Required: no.resolve-type
[bool]: Resolve linked objects to find out their types. Default: "true". Required: no.size
[bool]: Resolve linked objects to find out their file size. Default: "true". Required: no.stream
[bool]: Enable experimental streaming of directory entries as they are traversed. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Objects": [
{
"Hash": "<string>",
"Links": [
{
"Hash": "<string>",
"Name": "<string>",
"Size": "<uint64>",
"Target": "<string>",
"Type": "<int32>"
}
]
}
]
}
curl "http://localhost:5001/api/v0/ls?arg=<ipfs-path>&headers=<value>&resolve-type=true&size=true&stream=<value>"
Mounts IPFS to the filesystem (read-only).
ipfs-path
[string]: The path where IPFS should be mounted. Required: no.ipns-path
[string]: The path where IPNS should be mounted. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"FuseAllowOther": "<bool>",
"IPFS": "<string>",
"IPNS": "<string>"
}
curl "http://localhost:5001/api/v0/mount?ipfs-path=<value>&ipns-path=<value>"
Publish IPNS names.
arg
[string]: ipfs path of the object to be published. Required: yes.resolve
[bool]: Check if the given path can be resolved before publishing. Default: "true". Required: no.lifetime
[string]: Time duration that the record will be valid for. This accepts durations such as "300s", "1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". Default: "24h". Required: no.allow-offline
[bool]: When offline, save the IPNS record to the the local datastore without broadcasting to the network instead of simply failing. Required: no.ttl
[string]: Time duration this record should be cached for. Uses the same syntax as the lifetime option. (caution: experimental). Required: no.key
[string]: Name of the key to be used or a valid PeerID, as listed by 'ipfs key list -l'. Default: "self". Required: no.quieter
[bool]: Write only final hash. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Name": "<string>",
"Value": "<string>"
}
curl "http://localhost:5001/api/v0/name/publish?arg=<ipfs-path>&resolve=true&lifetime=24h&allow-offline=<value>&ttl=<value>&key=self&quieter=<value>"
Cancel a name subscription
arg
[string]: Name to cancel the subscription for. Required: yes.
On success, the call to this endpoint will return with 200 and the following body:
{
"Canceled": "<bool>"
}
curl "http://localhost:5001/api/v0/name/pubsub/cancel?arg=<name>"
Query the state of IPNS pubsub
This endpoint takes no arguments.
On success, the call to this endpoint will return with 200 and the following body:
{
"Enabled": "<bool>"
}
curl "http://localhost:5001/api/v0/name/pubsub/state"
Show current name subscriptions
This endpoint takes no arguments.
On success, the call to this endpoint will return with 200 and the following body:
{
"Strings": [
"<string>"
]
}
curl "http://localhost:5001/api/v0/name/pubsub/subs"
Resolve IPNS names.
arg
[string]: The IPNS name to resolve. Defaults to your node's peerID. Required: no.recursive
[bool]: Resolve until the result is not an IPNS name. Default: "true". Required: no.nocache
[bool]: Do not use cached entries. Required: no.dht-record-count
[uint]: Number of records to request for DHT resolution. Required: no.dht-timeout
[string]: Max time to collect values during DHT resolution eg "30s". Pass 0 for no timeout. Required: no.stream
[bool]: Stream entries as they are found. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Path": "<string>"
}
curl "http://localhost:5001/api/v0/name/resolve?arg=<name>&recursive=true&nocache=<value>&dht-record-count=<value>&dht-timeout=<value>&stream=<value>"
Output the raw bytes of an IPFS object.
arg
[string]: Key of the object to retrieve, in base58-encoded multihash format. Required: yes.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/object/data?arg=<key>"
Display the diff between two ipfs objects.
arg
[string]: Object to diff against. Required: yes.arg
[string]: Object to diff. Required: yes.verbose
[bool]: Print extra information. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Changes": [
{
"After": {
"/": "<cid-string>"
},
"Before": {
"/": "<cid-string>"
},
"Path": "<string>",
"Type": "<int>"
}
]
}
curl "http://localhost:5001/api/v0/object/diff?arg=<obj_a>&arg=<obj_b>&verbose=<value>"
Get and serialize the DAG node named by .
arg
[string]: Key of the object to retrieve, in base58-encoded multihash format. Required: yes.data-encoding
[string]: Encoding type of the data field, either "text" or "base64". Default: "text". Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Data": "<string>",
"Links": [
{
"Hash": "<string>",
"Name": "<string>",
"Size": "<uint64>"
}
]
}
curl "http://localhost:5001/api/v0/object/get?arg=<key>&data-encoding=text"
Output the links pointed to by the specified object.
arg
[string]: Key of the object to retrieve, in base58-encoded multihash format. Required: yes.headers
[bool]: Print table headers (Hash, Size, Name). Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Hash": "<string>",
"Links": [
{
"Hash": "<string>",
"Name": "<string>",
"Size": "<uint64>"
}
]
}
curl "http://localhost:5001/api/v0/object/links?arg=<key>&headers=<value>"
Create a new object from an ipfs template.
arg
[string]: Template to use. Optional. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Hash": "<string>",
"Links": [
{
"Hash": "<string>",
"Name": "<string>",
"Size": "<uint64>"
}
]
}
curl "http://localhost:5001/api/v0/object/new?arg=<template>"
Add a link to a given object.
arg
[string]: The hash of the node to modify. Required: yes.arg
[string]: Name of link to create. Required: yes.arg
[string]: IPFS object to add link to. Required: yes.create
[bool]: Create intermediary nodes. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Hash": "<string>",
"Links": [
{
"Hash": "<string>",
"Name": "<string>",
"Size": "<uint64>"
}
]
}
curl "http://localhost:5001/api/v0/object/patch/add-link?arg=<root>&arg=<name>&arg=<ref>&create=<value>"
Append data to the data segment of a dag node.
arg
[string]: The hash of the node to modify. Required: yes.arg
[file]: Data to append. Required: yes.
Argument "data" is of file type. This endpoint expects a file in the body of the request as 'multipart/form-data'.
On success, the call to this endpoint will return with 200 and the following body:
{
"Hash": "<string>",
"Links": [
{
"Hash": "<string>",
"Name": "<string>",
"Size": "<uint64>"
}
]
}
curl -F file=@myfile "http://localhost:5001/api/v0/object/patch/append-data?arg=<root>"
Remove a link from a given object.
arg
[string]: The hash of the node to modify. Required: yes.arg
[string]: Name of the link to remove. Required: yes.
On success, the call to this endpoint will return with 200 and the following body:
{
"Hash": "<string>",
"Links": [
{
"Hash": "<string>",
"Name": "<string>",
"Size": "<uint64>"
}
]
}
curl "http://localhost:5001/api/v0/object/patch/rm-link?arg=<root>&arg=<name>"
Set the data field of an IPFS object.
arg
[string]: The hash of the node to modify. Required: yes.arg
[file]: The data to set the object to. Required: yes.
Argument "data" is of file type. This endpoint expects a file in the body of the request as 'multipart/form-data'.
On success, the call to this endpoint will return with 200 and the following body:
{
"Hash": "<string>",
"Links": [
{
"Hash": "<string>",
"Name": "<string>",
"Size": "<uint64>"
}
]
}
curl -F file=@myfile "http://localhost:5001/api/v0/object/patch/set-data?arg=<root>"
Store input as a DAG object, print its key.
arg
[file]: Data to be stored as a DAG object. Required: yes.inputenc
[string]: Encoding type of input data. One of: {"protobuf", "json"}. Default: "json". Required: no.datafieldenc
[string]: Encoding type of the data field, either "text" or "base64". Default: "text". Required: no.pin
[bool]: Pin this object when adding. Required: no.quiet
[bool]: Write minimal output. Required: no.
Argument "data" is of file type. This endpoint expects a file in the body of the request as 'multipart/form-data'.
On success, the call to this endpoint will return with 200 and the following body:
{
"Hash": "<string>",
"Links": [
{
"Hash": "<string>",
"Name": "<string>",
"Size": "<uint64>"
}
]
}
curl -F file=@myfile "http://localhost:5001/api/v0/object/put?inputenc=json&datafieldenc=text&pin=<value>&quiet=<value>"
Get stats for the DAG node named by .
arg
[string]: Key of the object to retrieve, in base58-encoded multihash format. Required: yes.human
[bool]: Print sizes in human readable format (e.g., 1K 234M 2G). Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"BlockSize": "<int>",
"CumulativeSize": "<int>",
"DataSize": "<int>",
"Hash": "<string>",
"LinksSize": "<int>",
"NumLinks": "<int>"
}
curl "http://localhost:5001/api/v0/object/stat?arg=<key>&human=<value>"
Stop listening for new connections to forward.
all
[bool]: Close all listeners. Required: no.protocol
[string]: Match protocol name. Required: no.listen-address
[string]: Match listen address. Required: no.target-address
[string]: Match target address. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
"<int>"
curl "http://localhost:5001/api/v0/p2p/close?all=<value>&protocol=<value>&listen-address=<value>&target-address=<value>"
Forward connections to libp2p service
arg
[string]: Protocol name. Required: yes.arg
[string]: Listening endpoint. Required: yes.arg
[string]: Target endpoint. Required: yes.allow-custom-protocol
[bool]: Don't require /x/ prefix. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/p2p/forward?arg=<protocol>&arg=<listen-address>&arg=<target-address>&allow-custom-protocol=<value>"
Create libp2p service
arg
[string]: Protocol name. Required: yes.arg
[string]: Target endpoint. Required: yes.allow-custom-protocol
[bool]: Don't require /x/ prefix. Required: no.report-peer-id
[bool]: Send remote base58 peerid to target when a new connection is established. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/p2p/listen?arg=<protocol>&arg=<target-address>&allow-custom-protocol=<value>&report-peer-id=<value>"
List active p2p listeners.
headers
[bool]: Print table headers (Protocol, Listen, Target). Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Listeners": [
{
"ListenAddress": "<string>",
"Protocol": "<string>",
"TargetAddress": "<string>"
}
]
}
curl "http://localhost:5001/api/v0/p2p/ls?headers=<value>"
Close active p2p stream.
arg
[string]: Stream identifier Required: no.all
[bool]: Close all streams. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/p2p/stream/close?arg=<id>&all=<value>"
List active p2p streams.
headers
[bool]: Print table headers (ID, Protocol, Local, Remote). Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Streams": [
{
"HandlerID": "<string>",
"OriginAddress": "<string>",
"Protocol": "<string>",
"TargetAddress": "<string>"
}
]
}
curl "http://localhost:5001/api/v0/p2p/stream/ls?headers=<value>"
Pin objects to local storage.
arg
[string]: Path to object(s) to be pinned. Required: yes.recursive
[bool]: Recursively pin the object linked to by the specified object(s). Default: "true". Required: no.progress
[bool]: Show progress. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Pins": [
"<string>"
],
"Progress": "<int>"
}
curl "http://localhost:5001/api/v0/pin/add?arg=<ipfs-path>&recursive=true&progress=<value>"
List objects pinned to local storage.
arg
[string]: Path to object(s) to be listed. Required: no.type
[string]: The type of pinned keys to list. Can be "direct", "indirect", "recursive", or "all". Default: "all". Required: no.quiet
[bool]: Write just hashes of objects. Required: no.stream
[bool]: Enable streaming of pins as they are discovered. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"PinLsList": {
"Keys": {
"<string>": {
"Type": "<string>"
}
}
},
"PinLsObject": {
"Cid": "<string>",
"Type": "<string>"
}
}
curl "http://localhost:5001/api/v0/pin/ls?arg=<ipfs-path>&type=all&quiet=<value>&stream=<value>"
Remove pinned objects from local storage.
arg
[string]: Path to object(s) to be unpinned. Required: yes.recursive
[bool]: Recursively unpin the object linked to by the specified object(s). Default: "true". Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Pins": [
"<string>"
]
}
curl "http://localhost:5001/api/v0/pin/rm?arg=<ipfs-path>&recursive=true"
Update a recursive pin
arg
[string]: Path to old object. Required: yes.arg
[string]: Path to a new object to be pinned. Required: yes.unpin
[bool]: Remove the old pin. Default: "true". Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Pins": [
"<string>"
]
}
curl "http://localhost:5001/api/v0/pin/update?arg=<from-path>&arg=<to-path>&unpin=true"
Verify that recursive pins are complete.
verbose
[bool]: Also write the hashes of non-broken pins. Required: no.quiet
[bool]: Write just hashes of broken pins. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Cid": "<string>",
"PinStatus": {
"BadNodes": [
{
"Cid": "<string>",
"Err": "<string>"
}
],
"Ok": "<bool>"
}
}
curl "http://localhost:5001/api/v0/pin/verify?verbose=<value>&quiet=<value>"
Send echo request packets to IPFS hosts.
arg
[string]: ID of peer to be pinged. Required: yes.count
[int]: Number of ping messages to send. Default: "10". Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Success": "<bool>",
"Text": "<string>",
"Time": "<duration-ns>"
}
curl "http://localhost:5001/api/v0/ping?arg=<peer ID>&count=10"
List subscribed topics by name.
This endpoint takes no arguments.
On success, the call to this endpoint will return with 200 and the following body:
{
"Strings": [
"<string>"
]
}
curl "http://localhost:5001/api/v0/pubsub/ls"
List peers we are currently pubsubbing with.
arg
[string]: topic to list connected peers of Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Strings": [
"<string>"
]
}
curl "http://localhost:5001/api/v0/pubsub/peers?arg=<topic>"
Publish a message to a given pubsub topic.
arg
[string]: Topic to publish to. Required: yes.arg
[string]: Payload of message to publish. Required: yes.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/pubsub/pub?arg=<topic>&arg=<data>"
Subscribe to messages on a given topic.
arg
[string]: String name of topic to subscribe to. Required: yes.discover
[bool]: try to discover other peers subscribed to the same topic. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"data": "<base64-string>",
"from": "<base64-string>",
"seqno": "<base64-string>",
"topicIDs": [
"<string>"
]
}
curl "http://localhost:5001/api/v0/pubsub/sub?arg=<topic>&discover=<value>"
List links (references) from an object.
arg
[string]: Path to the object(s) to list refs from. Required: yes.format
[string]: Emit edges with given format. Available tokens: . Default: . Default: "". Required: no.edges
[bool]: Emit edge format:<from> -> <to>
. Required: no.unique
[bool]: Omit duplicate refs from output. Required: no.recursive
[bool]: Recursively list links of child nodes. Required: no.max-depth
[int]: Only for recursive refs, limits fetch and listing to the given depth. Default: "-1". Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Err": "<string>",
"Ref": "<string>"
}
curl "http://localhost:5001/api/v0/refs?arg=<ipfs-path>&format=<dst>&edges=<value>&unique=<value>&recursive=<value>&max-depth=-1"
List all local references.
This endpoint takes no arguments.
On success, the call to this endpoint will return with 200 and the following body:
{
"Err": "<string>",
"Ref": "<string>"
}
curl "http://localhost:5001/api/v0/refs/local"
Remove repo lockfiles.
This endpoint takes no arguments.
On success, the call to this endpoint will return with 200 and the following body:
{
"Message": "<string>"
}
curl "http://localhost:5001/api/v0/repo/fsck"
Perform a garbage collection sweep on the repo.
stream-errors
[bool]: Stream errors. Required: no.quiet
[bool]: Write minimal output. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Error": "<string>",
"Key": {
"/": "<cid-string>"
}
}
curl "http://localhost:5001/api/v0/repo/gc?stream-errors=<value>&quiet=<value>"
Get stats for the currently used repo.
size-only
[bool]: Only report RepoSize and StorageMax. Required: no.human
[bool]: Print sizes in human readable format (e.g., 1K 234M 2G). Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"NumObjects": "<uint64>",
"RepoPath": "<string>",
"SizeStat": {
"RepoSize": "<uint64>",
"StorageMax": "<uint64>"
},
"Version": "<string>"
}
curl "http://localhost:5001/api/v0/repo/stat?size-only=<value>&human=<value>"
Verify all blocks in repo are not corrupted.
This endpoint takes no arguments.
On success, the call to this endpoint will return with 200 and the following body:
{
"Msg": "<string>",
"Progress": "<int>"
}
curl "http://localhost:5001/api/v0/repo/verify"
Show the repo version.
quiet
[bool]: Write minimal output. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Version": "<string>"
}
curl "http://localhost:5001/api/v0/repo/version?quiet=<value>"
Resolve the value of names to IPFS.
arg
[string]: The name to resolve. Required: yes.recursive
[bool]: Resolve until the result is an IPFS name. Default: "true". Required: no.dht-record-count
[int]: Number of records to request for DHT resolution. Required: no.dht-timeout
[string]: Max time to collect values during DHT resolution eg "30s". Pass 0 for no timeout. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Path": "<string>"
}
curl "http://localhost:5001/api/v0/resolve?arg=<name>&recursive=true&dht-record-count=<value>&dht-timeout=<value>"
Shut down the ipfs daemon
This endpoint takes no arguments.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/shutdown"
Show some diagnostic information on the bitswap agent.
verbose
[bool]: Print extra information. Required: no.human
[bool]: Print sizes in human readable format (e.g., 1K 234M 2G). Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"BlocksReceived": "<uint64>",
"BlocksSent": "<uint64>",
"DataReceived": "<uint64>",
"DataSent": "<uint64>",
"DupBlksReceived": "<uint64>",
"DupDataReceived": "<uint64>",
"MessagesReceived": "<uint64>",
"Peers": [
"<string>"
],
"ProvideBufLen": "<int>",
"Wantlist": [
{
"/": "<cid-string>"
}
]
}
curl "http://localhost:5001/api/v0/stats/bitswap?verbose=<value>&human=<value>"
Print ipfs bandwidth information.
-
peer
[string]: Specify a peer to print bandwidth for. Required: no. -
proto
[string]: Specify a protocol to print bandwidth for. Required: no. -
poll
[bool]: Print bandwidth at an interval. Required: no. -
interval
[string]: Time interval to wait between updating output, if 'poll' is true.This accepts durations such as "300s", "1.5h" or "2h45m". Valid time units are: "ns", "us" (or "µs"), "ms", "s", "m", "h". Default: "1s". Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"RateIn": "<float64>",
"RateOut": "<float64>",
"TotalIn": "<int64>",
"TotalOut": "<int64>"
}
curl "http://localhost:5001/api/v0/stats/bw?peer=<value>&proto=<value>&poll=<value>&interval=1s"
Get stats for the currently used repo.
size-only
[bool]: Only report RepoSize and StorageMax. Required: no.human
[bool]: Print sizes in human readable format (e.g., 1K 234M 2G). Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"NumObjects": "<uint64>",
"RepoPath": "<string>",
"SizeStat": {
"RepoSize": "<uint64>",
"StorageMax": "<uint64>"
},
"Version": "<string>"
}
curl "http://localhost:5001/api/v0/stats/repo?size-only=<value>&human=<value>"
List known addresses. Useful for debugging.
This endpoint takes no arguments.
On success, the call to this endpoint will return with 200 and the following body:
{
"Addrs": {
"<string>": [
"<string>"
]
}
}
curl "http://localhost:5001/api/v0/swarm/addrs"
List interface listening addresses.
This endpoint takes no arguments.
On success, the call to this endpoint will return with 200 and the following body:
{
"Strings": [
"<string>"
]
}
curl "http://localhost:5001/api/v0/swarm/addrs/listen"
List local addresses.
id
[bool]: Show peer ID in addresses. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Strings": [
"<string>"
]
}
curl "http://localhost:5001/api/v0/swarm/addrs/local?id=<value>"
Open connection to a given address.
arg
[string]: Address of peer to connect to. Required: yes.
On success, the call to this endpoint will return with 200 and the following body:
{
"Strings": [
"<string>"
]
}
curl "http://localhost:5001/api/v0/swarm/connect?arg=<address>"
Close connection to a given address.
arg
[string]: Address of peer to disconnect from. Required: yes.
On success, the call to this endpoint will return with 200 and the following body:
{
"Strings": [
"<string>"
]
}
curl "http://localhost:5001/api/v0/swarm/disconnect?arg=<address>"
Manipulate address filters.
This endpoint takes no arguments.
On success, the call to this endpoint will return with 200 and the following body:
{
"Strings": [
"<string>"
]
}
curl "http://localhost:5001/api/v0/swarm/filters"
Add an address filter.
arg
[string]: Multiaddr to filter. Required: yes.
On success, the call to this endpoint will return with 200 and the following body:
{
"Strings": [
"<string>"
]
}
curl "http://localhost:5001/api/v0/swarm/filters/add?arg=<address>"
Remove an address filter.
arg
[string]: Multiaddr filter to remove. Required: yes.
On success, the call to this endpoint will return with 200 and the following body:
{
"Strings": [
"<string>"
]
}
curl "http://localhost:5001/api/v0/swarm/filters/rm?arg=<address>"
List peers with open connections.
verbose
[bool]: display all extra information. Required: no.streams
[bool]: Also list information about open streams for each peer. Required: no.latency
[bool]: Also list information about latency to each peer. Required: no.direction
[bool]: Also list information about the direction of connection. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Peers": [
{
"Addr": "<string>",
"Direction": "<int>",
"Latency": "<string>",
"Muxer": "<string>",
"Peer": "<string>",
"Streams": [
{
"Protocol": "<string>"
}
]
}
]
}
curl "http://localhost:5001/api/v0/swarm/peers?verbose=<value>&streams=<value>&latency=<value>&direction=<value>"
Import a tar file into ipfs.
arg
[file]: Tar file to add. Required: yes.
Argument "file" is of file type. This endpoint expects a file in the body of the request as 'multipart/form-data'.
On success, the call to this endpoint will return with 200 and the following body:
{
"Bytes": "<int64>",
"Hash": "<string>",
"Name": "<string>",
"Size": "<string>"
}
curl -F file=@myfile "http://localhost:5001/api/v0/tar/add"
Export a tar file from IPFS.
arg
[string]: ipfs path of archive to export. Required: yes.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/tar/cat?arg=<path>"
arg
[string]: Arguments for subcommand. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
curl "http://localhost:5001/api/v0/update?arg=<args>"
Add URL via urlstore.
arg
[string]: URL to add to IPFS Required: yes.trickle
[bool]: Use trickle-dag format for dag generation. Required: no.pin
[bool]: Pin this object when adding. Default: "true". Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Key": "<string>",
"Size": "<int>"
}
curl "http://localhost:5001/api/v0/urlstore/add?arg=<url>&trickle=<value>&pin=true"
Show ipfs version information.
number
[bool]: Only show the version number. Required: no.commit
[bool]: Show the commit hash. Required: no.repo
[bool]: Show repo version. Required: no.all
[bool]: Show all version information. Required: no.
On success, the call to this endpoint will return with 200 and the following body:
{
"Commit": "<string>",
"Golang": "<string>",
"Repo": "<string>",
"System": "<string>",
"Version": "<string>"
}
curl "http://localhost:5001/api/v0/version?number=<value>&commit=<value>&repo=<value>&all=<value>"
Shows information about dependencies used for build
This endpoint takes no arguments.
On success, the call to this endpoint will return with 200 and the following body:
{
"Path": "<string>",
"ReplacedBy": "<string>",
"Sum": "<string>",
"Version": "<string>"
}
curl "http://localhost:5001/api/v0/version/deps"