访问IPFS官网太麻烦了,经常访问不到,备份一下,便于学习。
这里是我学习以后并整理层的(持续更新中)-Android版
下面是文章接口原文:
Generated on 2017-08-23, from go-ipfs v0.4.11-dev.
This is the HTTP API specification for IPFS.
IPFS HTTP API is an RPC API which should work across different IPFS implementations. The most feature-complete of those implementations, and current reference for this specification is go-ipfs.
This document is autogenerated from go-ipfs. For issues and support, check out the ipfs-http-api-docsrepository on GitHub.
Getting started
Alignment with CLI Commands
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
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
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=" }
Index
Endpoints
/api/v0/add
Add a file or directory to ipfs.
Arguments
arg
[file]: The path to a file to be added to ipfs. Required: yes.recursive
[bool]: Add directory paths recursively. Default: “false”. 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.hidden
[bool]: Include files that are hidden. Only takes effect on recursive add. Required: no.chunker
[string]: Chunking algorithm to use. 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. (experimental). Required: no.fscache
[bool]: Check the filestore for pre-existing blocks. (experimental). Required: no.cid-version
[int]: Cid version. Non-zero value will change default of ‘raw-leaves’ to true. (experimental). Default: “0”. Required: no.hash
[string]: Hash function to use. Will set Cid version to 1 if used. (experimental). Default: “sha2-256”. Required: no.
Request Body
Argument “path” is of file type. This endpoint expects a file in the body of the request as ‘multipart/form-data’.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Name": "<string>" "Hash": "<string>" "Bytes": "<int64>" "Size": "<string>" }
cURL Example
curl -F file=@myfile "http://localhost:5001/api/v0/add?recursive=false&quiet=<value>&quieter=<value>&silent=<value>&progress=<value>&trickle=<value>&only-hash=<value>&wrap-with-directory=<value>&hidden=<value>&chunker=<value>&pin=true&raw-leaves=<value>&nocopy=<value>&fscache=<value>&cid-version=0&hash=sha2-256"
/api/v0/bitswap/ledger
Show the current ledger for a peer.
Arguments
arg
[string]: The PeerID (B58) of the ledger to inspect. Required: yes.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Peer": "<string>" "Value": "<float64>" "Sent": "<uint64>" "Recv": "<uint64>" "Exchanged": "<uint64>" }
cURL Example
curl "http://localhost:5001/api/v0/bitswap/ledger?arg=<peer>"
/api/v0/bitswap/reprovide
Trigger reprovider.
Arguments
This endpoint takes no arguments.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/bitswap/reprovide"
/api/v0/bitswap/stat
Show some diagnostic information on the bitswap agent.
Arguments
This endpoint takes no arguments.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "ProvideBufLen": "<int>" "Wantlist": [ "<string>" ] "Peers": [ "<string>" ] "BlocksReceived": "<uint64>" "DataReceived": "<uint64>" "BlocksSent": "<uint64>" "DataSent": "<uint64>" "DupBlksReceived": "<uint64>" "DupDataReceived": "<uint64>" }
cURL Example
curl "http://localhost:5001/api/v0/bitswap/stat"
/api/v0/bitswap/unwant
Remove a given block from your wantlist.
Arguments
arg
[string]: Key(s) to remove from your wantlist. Required: yes.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/bitswap/unwant?arg=<key>"
/api/v0/bitswap/wantlist
Show blocks currently on the wantlist.
Arguments
peer
[string]: Specify which peer to show wantlist for. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Keys": [ "<string>" ] }
cURL Example
curl "http://localhost:5001/api/v0/bitswap/wantlist?peer=<value>"
/api/v0/block/get
Get a raw IPFS block.
Arguments
arg
[string]: The base58 multihash of an existing block to get. Required: yes.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/block/get?arg=<key>"
/api/v0/block/put
Store input as an IPFS block.
Arguments
arg
[file]: The data to be stored as an IPFS block. Required: yes.format
[string]: cid format for blocks to be created with. Default: “v0”. Required: no.mhtype
[string]: multihash hash function. Default: “sha2-256”. Required: no.mhlen
[int]: multihash hash length. Default: “-1”. Required: no.
Request Body
Argument “data” is of file type. This endpoint expects a file in the body of the request as ‘multipart/form-data’.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Key": "<string>" "Size": "<int>" }
cURL Example
curl -F file=@myfile "http://localhost:5001/api/v0/block/put?format=v0&mhtype=sha2-256&mhlen=-1"
/api/v0/block/rm
Remove IPFS block(s).
Arguments
arg
[string]: Bash58 encoded multihash of block(s) to remove. Required: yes.force
[bool]: Ignore nonexistent blocks. Default: “false”. Required: no.quiet
[bool]: Write minimal output. Default: “false”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Hash": "<string>" "Error": "<string>" }
cURL Example
curl "http://localhost:5001/api/v0/block/rm?arg=<hash>&force=false&quiet=false"
/api/v0/block/stat
Print information of a raw IPFS block.
Arguments
arg
[string]: The base58 multihash of an existing block to stat. Required: yes.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Key": "<string>" "Size": "<int>" }
cURL Example
curl "http://localhost:5001/api/v0/block/stat?arg=<key>"
/api/v0/bootstrap/add/default
Add default peers to the bootstrap list.
Arguments
This endpoint takes no arguments.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Peers": [ "<string>" ] }
cURL Example
curl "http://localhost:5001/api/v0/bootstrap/add/default"
/api/v0/bootstrap/list
Show peers in the bootstrap list.
Arguments
This endpoint takes no arguments.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Peers": [ "<string>" ] }
cURL Example
curl "http://localhost:5001/api/v0/bootstrap/list"
/api/v0/bootstrap/rm/all
Remove all peers from the bootstrap list.
Arguments
This endpoint takes no arguments.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Peers": [ "<string>" ] }
cURL Example
curl "http://localhost:5001/api/v0/bootstrap/rm/all"
/api/v0/cat
Show IPFS object data.
Arguments
arg
[string]: The path to the IPFS object(s) to be outputted. Required: yes.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/cat?arg=<ipfs-path>"
/api/v0/commands
List all available commands.
Arguments
flags
[bool]: Show command flags. Default: “false”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Name": "<string>" "Subcommands": [ { "Name": "<string>" "Subcommands": [ { "Name": "<string>" "Subcommands": [ ... ] "Options": [ ... ] } ] "Options": [ { "Names": [ ... ] } ] } ] "Options": [ { "Names": [ "<string>" ] } ] }
cURL Example
curl "http://localhost:5001/api/v0/commands?flags=false"
/api/v0/config/edit
Open the config file for editing in $EDITOR.
Arguments
This endpoint takes no arguments.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/config/edit"
/api/v0/config/replace
Replace the config with .
Arguments
arg
[file]: The file to use as the new config. Required: yes.
Request Body
Argument “file” is of file type. This endpoint expects a file in the body of the request as ‘multipart/form-data’.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl -F file=@myfile "http://localhost:5001/api/v0/config/replace"
/api/v0/config/show
Output config file contents.
Arguments
This endpoint takes no arguments.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/config/show"
/api/v0/dag/get
Get a dag node from ipfs.
Arguments
arg
[string]: The object to get Required: yes.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/dag/get?arg=<ref>"
/api/v0/dag/put
Add a dag node to ipfs.
Arguments
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. Default: “false”. Required: no.hash
[string]: Hash function to use. Default: . Required: no.
Request Body
Argument “object data” is of file type. This endpoint expects a file in the body of the request as ‘multipart/form-data’.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Cid": "<string>" }
cURL Example
curl -F file=@myfile "http://localhost:5001/api/v0/dag/put?format=cbor&input-enc=json&pin=false&hash=<value>"
/api/v0/dag/resolve
Resolve ipld block
Arguments
arg
[string]: The path to resolve Required: yes.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Cid": "<string>" "RemPath": "<string>" }
cURL Example
curl "http://localhost:5001/api/v0/dag/resolve?arg=<ref>"
/api/v0/dht/findpeer
Query the DHT for all of the multiaddresses associated with a Peer ID.
Arguments
arg
[string]: The ID of the peer to search for. Required: yes.verbose
[bool]: Print extra information. Default: “false”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "ID": "<string>" "Type": "<int>" "Responses": [ { "ID": "<string>" "Addrs": [ "<object>" ] } ] "Extra": "<string>" }
cURL Example
curl "http://localhost:5001/api/v0/dht/findpeer?arg=<peerID>&verbose=false"
/api/v0/dht/findprovs
Find peers in the DHT that can provide a specific value, given a key.
Arguments
arg
[string]: The key to find providers for. Required: yes.verbose
[bool]: Print extra information. Default: “false”. Required: no.num-providers
[int]: The number of providers to find. Default: “20”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "ID": "<string>" "Type": "<int>" "Responses": [ { "ID": "<string>" "Addrs": [ "<object>" ] } ] "Extra": "<string>" }
cURL Example
curl "http://localhost:5001/api/v0/dht/findprovs?arg=<key>&verbose=false&num-providers=20"
/api/v0/dht/get
Given a key, query the DHT for its best value.
Arguments
arg
[string]: The key to find a value for. Required: yes.verbose
[bool]: Print extra information. Default: “false”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "ID": "<string>" "Type": "<int>" "Responses": [ { "ID": "<string>" "Addrs": [ "<object>" ] } ] "Extra": "<string>" }
cURL Example
curl "http://localhost:5001/api/v0/dht/get?arg=<key>&verbose=false"
/api/v0/dht/provide
Announce to the network that you are providing given values.
Arguments
arg
[string]: The key[s] to send provide records for. Required: yes.verbose
[bool]: Print extra information. Default: “false”. Required: no.recursive
[bool]: Recursively provide entire graph. Default: “false”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "ID": "<string>" "Type": "<int>" "Responses": [ { "ID": "<string>" "Addrs": [ "<object>" ] } ] "Extra": "<string>" }
cURL Example
curl "http://localhost:5001/api/v0/dht/provide?arg=<key>&verbose=false&recursive=false"
/api/v0/dht/put
Write a key/value pair to the DHT.
Arguments
arg
[string]: The key to store the value at. Required: yes.arg
[string]: The value to store. Required: yes.verbose
[bool]: Print extra information. Default: “false”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "ID": "<string>" "Type": "<int>" "Responses": [ { "ID": "<string>" "Addrs": [ "<object>" ] } ] "Extra": "<string>" }
cURL Example
curl "http://localhost:5001/api/v0/dht/put?arg=<key>&arg=<value>&verbose=false"
/api/v0/dht/query
Find the closest Peer IDs to a given Peer ID by querying the DHT.
Arguments
arg
[string]: The peerID to run the query against. Required: yes.verbose
[bool]: Print extra information. Default: “false”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "ID": "<string>" "Type": "<int>" "Responses": [ { "ID": "<string>" "Addrs": [ "<object>" ] } ] "Extra": "<string>" }
cURL Example
curl "http://localhost:5001/api/v0/dht/query?arg=<peerID>&verbose=false"
/api/v0/diag/cmds/clear
Clear inactive requests from the log.
Arguments
This endpoint takes no arguments.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/diag/cmds/clear"
/api/v0/diag/cmds/set-time
Set how long to keep inactive requests in the log.
Arguments
arg
[string]: Time to keep inactive requests in log. Required: yes.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/diag/cmds/set-time?arg=<time>"
/api/v0/diag/sys
Print system diagnostic information.
Arguments
This endpoint takes no arguments.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/diag/sys"
/api/v0/dns
Resolve DNS links.
Arguments
arg
[string]: The domain-name name to resolve. Required: yes.recursive
[bool]: Resolve until the result is not a DNS link. Default: “false”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Path": "<string>" }
cURL Example
curl "http://localhost:5001/api/v0/dns?arg=<domain-name>&recursive=false"
/api/v0/file/ls
List directory contents for Unix filesystem objects.
Arguments
arg
[string]: The path to the IPFS object(s) to list links from. Required: yes.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Arguments": { "<string>": "<string>" } "Objects": { "<string>": { "Hash": "<string>" "Size": "<uint64>" "Type": "<string>" "Links": [ { "Name": "<string>" "Hash": "<string>" "Size": "<uint64>" "Type": "<string>" } ] } } }
cURL Example
curl "http://localhost:5001/api/v0/file/ls?arg=<ipfs-path>"
/api/v0/files/cp
Copy files into mfs.
Arguments
arg
[string]: Source object to copy. Required: yes.arg
[string]: Destination to copy object to. Required: yes.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/files/cp?arg=<source>&arg=<dest>"
/api/v0/files/flush
Flush a given path’s data to disk.
Arguments
arg
[string]: Path to flush. Default: ‘/’. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/files/flush?arg=<path>"
/api/v0/files/ls
List directories in the local mutable namespace.
Arguments
arg
[string]: Path to show listing for. Defaults to ‘/’. Required: no.l
[bool]: Use long listing format. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Entries": [ { "Name": "<string>" "Type": "<int>" "Size": "<int64>" "Hash": "<string>" } ] }
cURL Example
curl "http://localhost:5001/api/v0/files/ls?arg=<path>&l=<value>"
/api/v0/files/mkdir
Make directories.
Arguments
arg
[string]: Path to dir to make. Required: yes.parents
[bool]: No error if existing, make parent directories as needed. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/files/mkdir?arg=<path>&parents=<value>"
/api/v0/files/mv
Move files.
Arguments
arg
[string]: Source file to move. Required: yes.arg
[string]: Destination path for file to be moved to. Required: yes.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/files/mv?arg=<source>&arg=<dest>"
/api/v0/files/read
Read a file in a given mfs.
Arguments
arg
[string]: Path to file to be read. Required: yes.offset
[int]: Byte offset to begin reading from. Required: no.count
[int]: Maximum number of bytes to read. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/files/read?arg=<path>&offset=<value>&count=<value>"
/api/v0/files/rm
Remove a file.
Arguments
arg
[string]: File to remove. Required: yes.recursive
[bool]: Recursively remove directories. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/files/rm?arg=<path>&recursive=<value>"
/api/v0/files/stat
Display file status.
Arguments
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. Default: “false”. Required: no.size
[bool]: Print only size. Implies ‘–format=’. Conflicts with other format options. Default: “false”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Hash": "<string>" "Size": "<uint64>" "CumulativeSize": "<uint64>" "Blocks": "<int>" "Type": "<string>" }
cURL Example
curl "http://localhost:5001/api/v0/files/stat?arg=<path>&format=<hash> Size: <size> CumulativeSize: <cumulsize> ChildBlocks: <childs> Type: <type>&hash=false&size=false"
/api/v0/files/write
Write to a mutable file in a given filesystem.
Arguments
arg
[string]: Path to write to. Required: yes.arg
[file]: Data to write. Required: yes.offset
[int]: Byte offset to begin writing at. Required: no.create
[bool]: Create the file if it does not exist. Required: no.truncate
[bool]: Truncate the file to size zero before writing. Required: no.count
[int]: Maximum number of bytes to read. Required: no.
Request Body
Argument “data” is of file type. This endpoint expects a file in the body of the request as ‘multipart/form-data’.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl -F file=@myfile "http://localhost:5001/api/v0/files/write?arg=<path>&offset=<value>&create=<value>&truncate=<value>&count=<value>"
/api/v0/filestore/dups
List blocks that are both in the filestore and standard block storage.
Arguments
This endpoint takes no arguments.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Ref": "<string>" "Err": "<string>" }
cURL Example
curl "http://localhost:5001/api/v0/filestore/dups"
/api/v0/filestore/ls
List objects in filestore.
Arguments
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.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Status": "<int32>" "ErrorMsg": "<string>" "Key": "<string>" "FilePath": "<string>" "Offset": "<uint64>" "Size": "<uint64>" }
cURL Example
curl "http://localhost:5001/api/v0/filestore/ls?arg=<obj>&file-order=<value>"
/api/v0/filestore/verify
Verify objects in filestore.
Arguments
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.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Status": "<int32>" "ErrorMsg": "<string>" "Key": "<string>" "FilePath": "<string>" "Offset": "<uint64>" "Size": "<uint64>" }
cURL Example
curl "http://localhost:5001/api/v0/filestore/verify?arg=<obj>&file-order=<value>"
/api/v0/get
Download IPFS objects.
Arguments
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. Default: “false”. Required: no.compress
[bool]: Compress the output with GZIP compression. Default: “false”. Required: no.compression-level
[int]: The level of compression (1-9). Default: “-1”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/get?arg=<ipfs-path>&output=<value>&archive=false&compress=false&compression-level=-1"
/api/v0/id
Show ipfs node id info.
Arguments
arg
[string]: Peer.ID of node to look up. Required: no.format
[string]: Optional output format. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "ID": "<string>" "PublicKey": "<string>" "Addresses": [ "<string>" ] "AgentVersion": "<string>" "ProtocolVersion": "<string>" }
cURL Example
curl "http://localhost:5001/api/v0/id?arg=<peerid>&format=<value>"
/api/v0/key/gen
Create a new keypair
Arguments
arg
[string]: name of key to create Required: yes.type
[string]: type of the key to create [rsa, ed25519]. Required: no.size
[int]: size of the key to generate. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Name": "<string>" "Id": "<string>" }
cURL Example
curl "http://localhost:5001/api/v0/key/gen?arg=<name>&type=<value>&size=<value>"
/api/v0/key/list
List all local keypairs
Arguments
l
[bool]: Show extra information about keys. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Keys": [ { "Name": "<string>" "Id": "<string>" } ] }
cURL Example
curl "http://localhost:5001/api/v0/key/list?l=<value>"
/api/v0/key/rename
Rename a keypair
Arguments
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.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Was": "<string>" "Now": "<string>" "Id": "<string>" "Overwrite": "<bool>" }
cURL Example
curl "http://localhost:5001/api/v0/key/rename?arg=<name>&arg=<newName>&force=<value>"
/api/v0/key/rm
Remove a keypair
Arguments
arg
[string]: names of keys to remove Required: yes.l
[bool]: Show extra information about keys. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Keys": [ { "Name": "<string>" "Id": "<string>" } ] }
cURL Example
curl "http://localhost:5001/api/v0/key/rm?arg=<name>&l=<value>"
/api/v0/log/level
Change the logging level.
Arguments
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.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Message": "<string>" }
cURL Example
curl "http://localhost:5001/api/v0/log/level?arg=<subsystem>&arg=<level>"
/api/v0/log/ls
List the logging subsystems.
Arguments
This endpoint takes no arguments.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Strings": [ "<string>" ] }
cURL Example
curl "http://localhost:5001/api/v0/log/ls"
/api/v0/log/tail
Read the event log.
Arguments
This endpoint takes no arguments.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/log/tail"
/api/v0/ls
List directory contents for Unix filesystem objects.
Arguments
arg
[string]: The path to the IPFS object(s) to list links from. Required: yes.headers
[bool]: Print table headers (Hash, Size, Name). Default: “false”. Required: no.resolve-type
[bool]: Resolve linked objects to find out their types. Default: “true”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Objects": [ { "Hash": "<string>" "Links": [ { "Name": "<string>" "Hash": "<string>" "Size": "<uint64>" "Type": "<int32>" } ] } ] }
cURL Example
curl "http://localhost:5001/api/v0/ls?arg=<ipfs-path>&headers=false&resolve-type=true"
/api/v0/mount
Mounts IPFS to the filesystem (read-only).
Arguments
ipfs-path
[string]: The path where IPFS should be mounted. Required: no.ipns-path
[string]: The path where IPNS should be mounted. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "IPFS": "<string>" "IPNS": "<string>" "FuseAllowOther": "<bool>" }
cURL Example
curl "http://localhost:5001/api/v0/mount?ipfs-path=<value>&ipns-path=<value>"
/api/v0/name/publish
Publish IPNS names.
Arguments
arg
[string]: ipfs path of the object to be published. Required: yes.resolve
[bool]: Resolve given path 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.ttl
[string]: Time duration this record should be cached for (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:. Default: “self”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Name": "<string>" "Value": "<string>" }
cURL Example
curl "http://localhost:5001/api/v0/name/publish?arg=<ipfs-path>&resolve=true&lifetime=24h&ttl=<value>&key=self"
/api/v0/name/resolve
Resolve IPNS names.
Arguments
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: “false”. Required: no.nocache
[bool]: Do not use cached entries. Default: “false”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Path": "<string>" }
cURL Example
curl "http://localhost:5001/api/v0/name/resolve?arg=<name>&recursive=false&nocache=false"
/api/v0/object/data
Output the raw bytes of an IPFS object.
Arguments
arg
[string]: Key of the object to retrieve, in base58-encoded multihash format. Required: yes.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/object/data?arg=<key>"
/api/v0/object/diff
Display the diff between two ipfs objects.
Arguments
arg
[string]: Object to diff against. Required: yes.arg
[string]: Object to diff. Required: yes.verbose
[bool]: Print extra information. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Changes": [ { "Type": "<int>" "Path": "<string>" "Before": "<string>" "After": "<string>" } ] }
cURL Example
curl "http://localhost:5001/api/v0/object/diff?arg=<obj_a>&arg=<obj_b>&verbose=<value>"
/api/v0/object/get
Get and serialize the DAG node named by .
Arguments
arg
[string]: Key of the object to retrieve, in base58-encoded multihash format. Required: yes.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Links": [ { "Name": "<string>" "Hash": "<string>" "Size": "<uint64>" } ] "Data": "<string>" }
cURL Example
curl "http://localhost:5001/api/v0/object/get?arg=<key>"
/api/v0/object/links
Output the links pointed to by the specified object.
Arguments
arg
[string]: Key of the object to retrieve, in base58-encoded multihash format. Required: yes.headers
[bool]: Print table headers (Hash, Size, Name). Default: “false”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Hash": "<string>" "Links": [ { "Name": "<string>" "Hash": "<string>" "Size": "<uint64>" } ] }
cURL Example
curl "http://localhost:5001/api/v0/object/links?arg=<key>&headers=false"
/api/v0/object/new
Create a new object from an ipfs template.
Arguments
arg
[string]: Template to use. Optional. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Hash": "<string>" "Links": [ { "Name": "<string>" "Hash": "<string>" "Size": "<uint64>" } ] }
cURL Example
curl "http://localhost:5001/api/v0/object/new?arg=<template>"
/api/v0/object/patch/add-link
Add a link to a given object.
Arguments
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. Default: “false”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Hash": "<string>" "Links": [ { "Name": "<string>" "Hash": "<string>" "Size": "<uint64>" } ] }
cURL Example
curl "http://localhost:5001/api/v0/object/patch/add-link?arg=<root>&arg=<name>&arg=<ref>&create=false"
/api/v0/object/patch/append-data
Append data to the data segment of a dag node.
Arguments
arg
[string]: The hash of the node to modify. Required: yes.arg
[file]: Data to append. Required: yes.
Request Body
Argument “data” is of file type. This endpoint expects a file in the body of the request as ‘multipart/form-data’.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Hash": "<string>" "Links": [ { "Name": "<string>" "Hash": "<string>" "Size": "<uint64>" } ] }
cURL Example
curl -F file=@myfile "http://localhost:5001/api/v0/object/patch/append-data?arg=<root>"
/api/v0/object/patch/rm-link
Remove a link from an object.
Arguments
arg
[string]: The hash of the node to modify. Required: yes.arg
[string]: Name of the link to remove. Required: yes.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Hash": "<string>" "Links": [ { "Name": "<string>" "Hash": "<string>" "Size": "<uint64>" } ] }
cURL Example
curl "http://localhost:5001/api/v0/object/patch/rm-link?arg=<root>&arg=<link>"
/api/v0/object/patch/set-data
Set the data field of an IPFS object.
Arguments
arg
[string]: The hash of the node to modify. Required: yes.arg
[file]: The data to set the object to. Required: yes.
Request Body
Argument “data” is of file type. This endpoint expects a file in the body of the request as ‘multipart/form-data’.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Hash": "<string>" "Links": [ { "Name": "<string>" "Hash": "<string>" "Size": "<uint64>" } ] }
cURL Example
curl -F file=@myfile "http://localhost:5001/api/v0/object/patch/set-data?arg=<root>"
/api/v0/object/put
Store input as a DAG object, print its key.
Arguments
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. Default: “false”. Required: no.
Request Body
Argument “data” is of file type. This endpoint expects a file in the body of the request as ‘multipart/form-data’.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Hash": "<string>" "Links": [ { "Name": "<string>" "Hash": "<string>" "Size": "<uint64>" } ] }
cURL Example
curl -F file=@myfile "http://localhost:5001/api/v0/object/put?inputenc=json&datafieldenc=text&pin=false"
/api/v0/object/stat
Get stats for the DAG node named by .
Arguments
arg
[string]: Key of the object to retrieve, in base58-encoded multihash format. Required: yes.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Hash": "<string>" "NumLinks": "<int>" "BlockSize": "<int>" "LinksSize": "<int>" "DataSize": "<int>" "CumulativeSize": "<int>" }
cURL Example
curl "http://localhost:5001/api/v0/object/stat?arg=<key>"
/api/v0/p2p/listener/close
Close active p2p listener.
Arguments
arg
[string]: P2P listener protocol Required: no.all
[bool]: Close all listeners. Default: “false”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/p2p/listener/close?arg=<Protocol>&all=false"
/api/v0/p2p/listener/ls
List active p2p listeners.
Arguments
headers
[bool]: Print table headers (HandlerID, Protocol, Local, Remote). Default: “false”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Listeners": [ { "Protocol": "<string>" "Address": "<string>" } ] }
cURL Example
curl "http://localhost:5001/api/v0/p2p/listener/ls?headers=false"
/api/v0/p2p/listener/open
Forward p2p connections to a network multiaddr.
Arguments
arg
[string]: Protocol identifier. Required: yes.arg
[string]: Request handling application address. Required: yes.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/p2p/listener/open?arg=<Protocol>&arg=<Address>"
/api/v0/p2p/stream/close
Close active p2p stream.
Arguments
arg
[string]: Stream HandlerID Required: no.all
[bool]: Close all streams. Default: “false”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/p2p/stream/close?arg=<HandlerID>&all=false"
/api/v0/p2p/stream/dial
Dial to a p2p listener.
Arguments
arg
[string]: Remote peer to connect to Required: yes.arg
[string]: Protocol identifier. Required: yes.arg
[string]: Address to listen for connection/s (default: /ip4/127.0.0.1/tcp/0). Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/p2p/stream/dial?arg=<Peer>&arg=<Protocol>&arg=<BindAddress>"
/api/v0/p2p/stream/ls
List active p2p streams.
Arguments
headers
[bool]: Print table headers (HagndlerID, Protocol, Local, Remote). Default: “false”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Streams": [ { "HandlerID": "<string>" "Protocol": "<string>" "LocalPeer": "<string>" "LocalAddress": "<string>" "RemotePeer": "<string>" "RemoteAddress": "<string>" } ] }
cURL Example
curl "http://localhost:5001/api/v0/p2p/stream/ls?headers=false"
/api/v0/pin/add
Pin objects to local storage.
Arguments
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.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Pins": [ "<string>" ] "Progress": "<int>" }
cURL Example
curl "http://localhost:5001/api/v0/pin/add?arg=<ipfs-path>&recursive=true&progress=<value>"
/api/v0/pin/ls
List objects pinned to local storage.
Arguments
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. Default: “false”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Keys": { "<string>": { "Type": "<string>" } } }
cURL Example
curl "http://localhost:5001/api/v0/pin/ls?arg=<ipfs-path>&type=all&quiet=false"
/api/v0/pin/rm
Remove pinned objects from local storage.
Arguments
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.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Pins": [ "<string>" ] }
cURL Example
curl "http://localhost:5001/api/v0/pin/rm?arg=<ipfs-path>&recursive=true"
/api/v0/pin/update
Update a recursive pin
Arguments
arg
[string]: Path to old object. Required: yes.arg
[string]: Path to new object to be pinned. Required: yes.unpin
[bool]: Remove the old pin. Default: “true”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Pins": [ "<string>" ] }
cURL Example
curl "http://localhost:5001/api/v0/pin/update?arg=<from-path>&arg=<to-path>&unpin=true"
/api/v0/pin/verify
Verify that recursive pins are complete.
Arguments
verbose
[bool]: Also write the hashes of non-broken pins. Required: no.quiet
[bool]: Write just hashes of broken pins. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Cid": "<string>" "PinStatus": { "Ok": "<bool>" "BadNodes": [ { "Cid": "<string>" "Err": "<string>" } ] } }
cURL Example
curl "http://localhost:5001/api/v0/pin/verify?verbose=<value>&quiet=<value>"
/api/v0/ping
Send echo request packets to IPFS hosts.
Arguments
arg
[string]: ID of peer to be pinged. Required: yes.count
[int]: Number of ping messages to send. Default: “10”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Success": "<bool>" "Time": "<int64>" "Text": "<string>" }
cURL Example
curl "http://localhost:5001/api/v0/ping?arg=<peer ID>&count=10"
/api/v0/pubsub/ls
List subscribed topics by name.
Arguments
This endpoint takes no arguments.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Strings": [ "<string>" ] }
cURL Example
curl "http://localhost:5001/api/v0/pubsub/ls"
/api/v0/pubsub/peers
List peers we are currently pubsubbing with.
Arguments
arg
[string]: topic to list connected peers of Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Strings": [ "<string>" ] }
cURL Example
curl "http://localhost:5001/api/v0/pubsub/peers?arg=<topic>"
/api/v0/pubsub/pub
Publish a message to a given pubsub topic.
Arguments
arg
[string]: Topic to publish to. Required: yes.arg
[string]: Payload of message to publish. Required: yes.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/pubsub/pub?arg=<topic>&arg=<data>"
/api/v0/pubsub/sub
Subscribe to messages on a given topic.
Arguments
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.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Message": { "From": [ "<uint8>" ] "Data": [ "<uint8>" ] "Seqno": [ "<uint8>" ] "TopicIDs": [ "<string>" ] "XXX_unrecognized": [ "<uint8>" ] } }
cURL Example
curl "http://localhost:5001/api/v0/pubsub/sub?arg=<topic>&discover=<value>"
/api/v0/refs/local
List all local references.
Arguments
This endpoint takes no arguments.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Ref": "<string>" "Err": "<string>" }
cURL Example
curl "http://localhost:5001/api/v0/refs/local"
/api/v0/repo/fsck
Remove repo lockfiles.
Arguments
This endpoint takes no arguments.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Message": "<string>" }
cURL Example
curl "http://localhost:5001/api/v0/repo/fsck"
/api/v0/repo/gc
Perform a garbage collection sweep on the repo.
Arguments
quiet
[bool]: Write minimal output. Default: “false”. Required: no.stream-errors
[bool]: Stream errors. Default: “false”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Key": "<string>" "Error": "<string>" }
cURL Example
curl "http://localhost:5001/api/v0/repo/gc?quiet=false&stream-errors=false"
/api/v0/repo/stat
Get stats for the currently used repo.
Arguments
human
[bool]: Output RepoSize in MiB. Default: “false”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "NumObjects": "<uint64>" "RepoSize": "<uint64>" "RepoPath": "<string>" "Version": "<string>" "StorageMax": "<uint64>" }
cURL Example
curl "http://localhost:5001/api/v0/repo/stat?human=false"
/api/v0/repo/verify
Verify all blocks in repo are not corrupted.
Arguments
This endpoint takes no arguments.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Message": "<string>" "Progress": "<int>" }
cURL Example
curl "http://localhost:5001/api/v0/repo/verify"
/api/v0/repo/version
Show the repo version.
Arguments
quiet
[bool]: Write minimal output. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Version": "<string>" }
cURL Example
curl "http://localhost:5001/api/v0/repo/version?quiet=<value>"
/api/v0/resolve
Resolve the value of names to IPFS.
Arguments
arg
[string]: The name to resolve. Required: yes.recursive
[bool]: Resolve until the result is an IPFS name. Default: “false”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Path": "<string>" }
cURL Example
curl "http://localhost:5001/api/v0/resolve?arg=<name>&recursive=false"
/api/v0/shutdown
Shut down the ipfs daemon
Arguments
This endpoint takes no arguments.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/shutdown"
/api/v0/stats/bitswap
Show some diagnostic information on the bitswap agent.
Arguments
This endpoint takes no arguments.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "ProvideBufLen": "<int>" "Wantlist": [ "<string>" ] "Peers": [ "<string>" ] "BlocksReceived": "<uint64>" "DataReceived": "<uint64>" "BlocksSent": "<uint64>" "DataSent": "<uint64>" "DupBlksReceived": "<uint64>" "DupDataReceived": "<uint64>" }
cURL Example
curl "http://localhost:5001/api/v0/stats/bitswap"
/api/v0/stats/bw
Print ipfs bandwidth information.
Arguments
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. Default: “false”. 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.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "TotalIn": "<int64>" "TotalOut": "<int64>" "RateIn": "<float64>" "RateOut": "<float64>" }
cURL Example
curl "http://localhost:5001/api/v0/stats/bw?peer=<value>&proto=<value>&poll=false&interval=1s"
/api/v0/stats/repo
Get stats for the currently used repo.
Arguments
human
[bool]: Output RepoSize in MiB. Default: “false”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "NumObjects": "<uint64>" "RepoSize": "<uint64>" "RepoPath": "<string>" "Version": "<string>" "StorageMax": "<uint64>" }
cURL Example
curl "http://localhost:5001/api/v0/stats/repo?human=false"
/api/v0/swarm/addrs/listen
List interface listening addresses.
Arguments
This endpoint takes no arguments.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Strings": [ "<string>" ] }
cURL Example
curl "http://localhost:5001/api/v0/swarm/addrs/listen"
/api/v0/swarm/addrs/local
List local addresses.
Arguments
id
[bool]: Show peer ID in addresses. Default: “false”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Strings": [ "<string>" ] }
cURL Example
curl "http://localhost:5001/api/v0/swarm/addrs/local?id=false"
/api/v0/swarm/connect
Open connection to a given address.
Arguments
arg
[string]: Address of peer to connect to. Required: yes.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Strings": [ "<string>" ] }
cURL Example
curl "http://localhost:5001/api/v0/swarm/connect?arg=<address>"
/api/v0/swarm/disconnect
Close connection to a given address.
Arguments
arg
[string]: Address of peer to disconnect from. Required: yes.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Strings": [ "<string>" ] }
cURL Example
curl "http://localhost:5001/api/v0/swarm/disconnect?arg=<address>"
/api/v0/swarm/filters/add
Add an address filter.
Arguments
arg
[string]: Multiaddr to filter. Required: yes.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Strings": [ "<string>" ] }
cURL Example
curl "http://localhost:5001/api/v0/swarm/filters/add?arg=<address>"
/api/v0/swarm/filters/rm
Remove an address filter.
Arguments
arg
[string]: Multiaddr filter to remove. Required: yes.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Strings": [ "<string>" ] }
cURL Example
curl "http://localhost:5001/api/v0/swarm/filters/rm?arg=<address>"
/api/v0/swarm/peers
List peers with open connections.
Arguments
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.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Peers": [ { "Addr": "<string>" "Peer": "<string>" "Latency": "<string>" "Muxer": "<string>" "Streams": [ { "Protocol": "<string>" } ] } ] }
cURL Example
curl "http://localhost:5001/api/v0/swarm/peers?verbose=<value>&streams=<value>&latency=<value>"
/api/v0/tar/add
Import a tar file into ipfs.
Arguments
arg
[file]: Tar file to add. Required: yes.
Request Body
Argument “file” is of file type. This endpoint expects a file in the body of the request as ‘multipart/form-data’.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Name": "<string>" "Hash": "<string>" "Bytes": "<int64>" "Size": "<string>" }
cURL Example
curl -F file=@myfile "http://localhost:5001/api/v0/tar/add"
/api/v0/tar/cat
Export a tar file from IPFS.
Arguments
arg
[string]: ipfs path of archive to export. Required: yes.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/tar/cat?arg=<path>"
/api/v0/update
Arguments
arg
[string]: Arguments for subcommand. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
This endpoint returns a `text/plain` response body.
cURL Example
curl "http://localhost:5001/api/v0/update?arg=<args>"
/api/v0/version
Show ipfs version information.
Arguments
number
[bool]: Only show the version number. Default: “false”. Required: no.commit
[bool]: Show the commit hash. Default: “false”. Required: no.repo
[bool]: Show repo version. Default: “false”. Required: no.all
[bool]: Show all version information. Default: “false”. Required: no.
Response
On success, the call to this endpoint will return with 200 and the following body:
{ "Version": "<string>" "Commit": "<string>" "Repo": "<string>" "System": "<string>" "Golang": "<string>" }
cURL Example