1. 首页
  2. 文档
  3. IPFS
  4. 参考|Reference
  5. 命令和API
  6. HTTP API

HTTP API

生成于2018-06-11,来自go-ipfs v0.4.15。

当IPFS节点作为实例运行时,它会公开一个HTTP API,允许您控制节点并从命令行运行相同的命令。

在许多情况下,使用此API比在程序中直接嵌入IPFS更好 – 它允许您维护比您的应用程序更长的对等连接,并且如果您的应用程序可以启动,您可以保持单个IPFS节点运行而不是几个多次。实际上,ipfs客户端命令在联机模式下运行时使用此API 。

此API旨在不同的IPFS实现场合达到相同的效果。但是,并非所有实现都同样是最新的。目前功能最完整(以及此规范的当前参考)是go-ipfs

这份文档是由go-ipfs自动生成的。有关问题和支持,请查看 GitHub上的ipfs-http-api-docs存储库。

入门

与客户端命令对等

客户端中可用的每个命令也可通过HTTP API获得。例如:

> 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",
  ]
}

参数

通过特殊查询字符串键“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",
  ]
}

请注意,它可以多次使用来表示多个参数。

标志

通过查询字符串添加标志。例如,--encoding=json 标志是下面的&encoding=json查询参数:

> 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="
}

索引

端点

/api/v0/add

将文件或目录添加到IPFS。

参数

  • 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, size-[bytes] or rabin-[min]-[avg]-[max]. 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.

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": ""
    "Hash": ""
    "Bytes": ""
    "Size": ""
}

cURL Example

curl -F file=@myfile "http://localhost:5001/api/v0/add?recursive=false&quiet=&quieter=&silent=&progress=&trickle=&only-hash=&wrap-with-directory=&hidden=&chunker=size-262144&pin=true&raw-leaves=&nocopy=&fscache=&cid-version=&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": ""
    "Value": ""
    "Sent": ""
    "Recv": ""
    "Exchanged": ""
}

cURL Example

curl "http://localhost:5001/api/v0/bitswap/ledger?arg="


/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": ""
    "Wantlist": [
        { "/": "" }
    ]
    "Peers": [
        ""
    ]
    "BlocksReceived": ""
    "DataReceived": ""
    "BlocksSent": ""
    "DataSent": ""
    "DupBlksReceived": ""
    "DupDataReceived": ""
}

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="


/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": [
        { "/": "" }
    ]
}

cURL Example

curl "http://localhost:5001/api/v0/bitswap/wantlist?peer="


/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="


/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. 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": ""
    "Size": ""
}

cURL Example

curl -F file=@myfile "http://localhost:5001/api/v0/block/put?format=&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. Required: no.
  • quiet [bool]: Write minimal output. Required: no.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "Hash": ""
    "Error": ""
}

cURL Example

curl "http://localhost:5001/api/v0/block/rm?arg=&force=&quiet="


/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": ""
    "Size": ""
}

cURL Example

curl "http://localhost:5001/api/v0/block/stat?arg="


/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": [
        ""
    ]
}

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": [
        ""
    ]
}

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": [
        ""
    ]
}

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.
  • offset [int]: Byte offset to begin reading from. Required: no.
  • length [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/cat?arg=&offset=&length="


/api/v0/commands

List all available commands.

Arguments

  • flags [bool]: Show command flags. Required: no.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "Name": ""
    "Subcommands": [
        {
            "Name": ""
            "Subcommands": [
                {
                    "Name": ""
                    "Subcommands": [
                        ...
                    ]
                    "Options": [
                        ...
                    ]
                    "showOpts": ""
                }
            ]
            "Options": [
                {
                    "Names": [
                        ...
                    ]
                }
            ]
            "showOpts": ""
        }
    ]
    "Options": [
        {
            "Names": [
                ""
            ]
        }
    ]
    "showOpts": ""
}

cURL Example

curl "http://localhost:5001/api/v0/commands?flags="


/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/profile/apply

Apply profile to config.

Arguments

  • arg [string]: The profile to apply to the config. 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/config/profile/apply?arg="


/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="


/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. 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": { "/": "" }
}

cURL Example

curl -F file=@myfile "http://localhost:5001/api/v0/dag/put?format=cbor&input-enc=json&pin=&hash="


/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": { "/": "" }
    "RemPath": ""
}

cURL Example

curl "http://localhost:5001/api/v0/dag/resolve?arg="


/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. Required: no.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "ID": ""
    "Type": ""
    "Responses": [
        {
            "ID": ""
            "Addrs": [
                ""
            ]
        }
    ]
    "Extra": ""
}

cURL Example

curl "http://localhost:5001/api/v0/dht/findpeer?arg=&verbose="


/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. 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": ""
    "Type": ""
    "Responses": [
        {
            "ID": ""
            "Addrs": [
                ""
            ]
        }
    ]
    "Extra": ""
}

cURL Example

curl "http://localhost:5001/api/v0/dht/findprovs?arg=&verbose=&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. Required: no.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "ID": ""
    "Type": ""
    "Responses": [
        {
            "ID": ""
            "Addrs": [
                ""
            ]
        }
    ]
    "Extra": ""
}

cURL Example

curl "http://localhost:5001/api/v0/dht/get?arg=&verbose="


/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. Required: no.
  • recursive [bool]: Recursively provide entire graph. Required: no.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "ID": ""
    "Type": ""
    "Responses": [
        {
            "ID": ""
            "Addrs": [
                ""
            ]
        }
    ]
    "Extra": ""
}

cURL Example

curl "http://localhost:5001/api/v0/dht/provide?arg=&verbose=&recursive="


/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. Required: no.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "ID": ""
    "Type": ""
    "Responses": [
        {
            "ID": ""
            "Addrs": [
                ""
            ]
        }
    ]
    "Extra": ""
}

cURL Example

curl "http://localhost:5001/api/v0/dht/put?arg=&arg=&verbose="


/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. Required: no.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "ID": ""
    "Type": ""
    "Responses": [
        {
            "ID": ""
            "Addrs": [
                ""
            ]
        }
    ]
    "Extra": ""
}

cURL Example

curl "http://localhost:5001/api/v0/dht/query?arg=&verbose="


/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=


/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. Required: no.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "Path": ""
}

cURL Example

curl "http://localhost:5001/api/v0/dns?arg=&recursive="


/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": {
        "": ""
    }
    "Objects": {
        "": {
            "Hash": ""
            "Size": ""
            "Type": ""
            "Links": [
                {
                    "Name": ""
                    "Hash": ""
                    "Size": ""
                    "Type": ""
                }
            ]
        }
    }
}

cURL Example

curl "http://localhost:5001/api/v0/file/ls?arg="


/api/v0/files/chcid

Change the cid version or hash function of the root node of a given path.

Arguments

  • 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.

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/chcid?arg=&cid-version=&hash="


/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=&arg="


/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="


/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": ""
            "Type": ""
            "Size": ""
            "Hash": ""
        }
    ]
}

cURL Example

curl "http://localhost:5001/api/v0/files/ls?arg=&l="


/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.
  • 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.

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=&parents=&cid-version=&hash="


/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=&arg="


/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=&offset=&count="


/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=&recursive="


/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. 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.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "Hash": ""
    "Size": ""
    "CumulativeSize": ""
    "Blocks": ""
    "Type": ""
    "WithLocality": ""
    "Local": ""
    "SizeLocal": ""
}

cURL Example

curl "http://localhost:5001/api/v0/files/stat?arg=&format= Size: CumulativeSize: ChildBlocks: Type: &hash=&size=&with-local="


/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.
  • 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.

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=&offset=&create=&truncate=&count=&raw-leaves=&cid-version=&hash="


/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": ""
    "Err": ""
}

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": ""
    "ErrorMsg": ""
    "Key": { "/": "" }
    "FilePath": ""
    "Offset": ""
    "Size": ""
}

cURL Example

curl "http://localhost:5001/api/v0/filestore/ls?arg=&file-order="


/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": ""
    "ErrorMsg": ""
    "Key": { "/": "" }
    "FilePath": ""
    "Offset": ""
    "Size": ""
}

cURL Example

curl "http://localhost:5001/api/v0/filestore/verify?arg=&file-order="


/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. Required: no.
  • compress [bool]: Compress the output with GZIP compression. Required: no.
  • compression-level [int]: The level of compression (1-9). 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=&output=&archive=&compress=&compression-level="


/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": ""
    "PublicKey": ""
    "Addresses": [
        ""
    ]
    "AgentVersion": ""
    "ProtocolVersion": ""
}

cURL Example

curl "http://localhost:5001/api/v0/id?arg=&format="


/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": ""
    "Id": ""
}

cURL Example

curl "http://localhost:5001/api/v0/key/gen?arg=&type=&size="


/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": ""
            "Id": ""
        }
    ]
}

cURL Example

curl "http://localhost:5001/api/v0/key/list?l="


/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": ""
    "Now": ""
    "Id": ""
    "Overwrite": ""
}

cURL Example

curl "http://localhost:5001/api/v0/key/rename?arg=&arg=&force="


/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": ""
            "Id": ""
        }
    ]
}

cURL Example

curl "http://localhost:5001/api/v0/key/rm?arg=&l="


/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": ""
}

cURL Example

curl "http://localhost:5001/api/v0/log/level?arg=&arg="


/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": [
        ""
    ]
}

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). 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": ""
            "Links": [
                {
                    "Name": ""
                    "Hash": ""
                    "Size": ""
                    "Type": ""
                }
            ]
        }
    ]
}

cURL Example

curl "http://localhost:5001/api/v0/ls?arg=&headers=&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": ""
    "IPNS": ""
    "FuseAllowOther": ""
}

cURL Example

curl "http://localhost:5001/api/v0/mount?ipfs-path=&ipns-path="


/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": ""
    "Value": ""
}

cURL Example

curl "http://localhost:5001/api/v0/name/publish?arg=&resolve=true&lifetime=24h&ttl=&key=self"


/api/v0/name/pubsub/cancel

Cancel a name subscription

Arguments

  • arg [string]: Name to cancel the subscription for. Required: yes.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "Canceled": ""
}

cURL Example

curl "http://localhost:5001/api/v0/name/pubsub/cancel?arg="


/api/v0/name/pubsub/state

Query the state of IPNS pubsub

Arguments

This endpoint takes no arguments.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "Enabled": ""
}

cURL Example

curl "http://localhost:5001/api/v0/name/pubsub/state"


/api/v0/name/pubsub/subs

Show current name subscriptions

Arguments

This endpoint takes no arguments.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "Strings": [
        ""
    ]
}

cURL Example

curl "http://localhost:5001/api/v0/name/pubsub/subs"


/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. 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.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "Path": ""
}

cURL Example

curl "http://localhost:5001/api/v0/name/resolve?arg=&recursive=&nocache=&dht-record-count=&dht-timeout="


/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="


/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": ""
            "Path": ""
            "Before": { "/": "" }
            "After": { "/": "" }
        }
    ]
}

cURL Example

curl "http://localhost:5001/api/v0/object/diff?arg=&arg=&verbose="


/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": ""
            "Hash": ""
            "Size": ""
        }
    ]
    "Data": ""
}

cURL Example

curl "http://localhost:5001/api/v0/object/get?arg="


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). Required: no.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "Hash": ""
    "Links": [
        {
            "Name": ""
            "Hash": ""
            "Size": ""
        }
    ]
}

cURL Example

curl "http://localhost:5001/api/v0/object/links?arg=&headers="


/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": ""
    "Links": [
        {
            "Name": ""
            "Hash": ""
            "Size": ""
        }
    ]
}

cURL Example

curl "http://localhost:5001/api/v0/object/new?arg="


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. Required: no.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "Hash": ""
    "Links": [
        {
            "Name": ""
            "Hash": ""
            "Size": ""
        }
    ]
}

cURL Example

curl "http://localhost:5001/api/v0/object/patch/add-link?arg=&arg=&arg=&create="


/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": ""
    "Links": [
        {
            "Name": ""
            "Hash": ""
            "Size": ""
        }
    ]
}

cURL Example

curl -F file=@myfile "http://localhost:5001/api/v0/object/patch/append-data?arg="


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": ""
    "Links": [
        {
            "Name": ""
            "Hash": ""
            "Size": ""
        }
    ]
}

cURL Example

curl "http://localhost:5001/api/v0/object/patch/rm-link?arg=&arg="


/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": ""
    "Links": [
        {
            "Name": ""
            "Hash": ""
            "Size": ""
        }
    ]
}

cURL Example

curl -F file=@myfile "http://localhost:5001/api/v0/object/patch/set-data?arg="


/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. Required: no.
  • quiet [bool]: Write minimal output. 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": ""
    "Links": [
        {
            "Name": ""
            "Hash": ""
            "Size": ""
        }
    ]
}

cURL Example

curl -F file=@myfile "http://localhost:5001/api/v0/object/put?inputenc=json&datafieldenc=text&pin=&quiet="


/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": ""
    "NumLinks": ""
    "BlockSize": ""
    "LinksSize": ""
    "DataSize": ""
    "CumulativeSize": ""
}

cURL Example

curl "http://localhost:5001/api/v0/object/stat?arg="


/api/v0/p2p/listener/close

Close active p2p listener.

Arguments

  • arg [string]: P2P listener protocol Required: no.
  • all [bool]: Close all listeners. 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=&all="


/api/v0/p2p/listener/ls

List active p2p listeners.

Arguments

  • headers [bool]: Print table headers (HandlerID, Protocol, Local, Remote). Required: no.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "Listeners": [
        {
            "Protocol": ""
            "Address": ""
        }
    ]
}

cURL Example

curl "http://localhost:5001/api/v0/p2p/listener/ls?headers="


/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=&arg=


/api/v0/p2p/stream/close

Close active p2p stream.

Arguments

  • arg [string]: Stream HandlerID Required: no.
  • all [bool]: Close all streams. 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=&all="


/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=&arg=&arg="


/api/v0/p2p/stream/ls

List active p2p streams.

Arguments

  • headers [bool]: Print table headers (HagndlerID, Protocol, Local, Remote). Required: no.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "Streams": [
        {
            "HandlerID": ""
            "Protocol": ""
            "LocalPeer": ""
            "LocalAddress": ""
            "RemotePeer": ""
            "RemoteAddress": ""
        }
    ]
}

cURL Example

curl "http://localhost:5001/api/v0/p2p/stream/ls?headers="


/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": [
        ""
    ]
    "Progress": ""
}

cURL Example

curl "http://localhost:5001/api/v0/pin/add?arg=&recursive=true&progress="


/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. Required: no.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "Keys": {
        "": {
            "Type": ""
        }
    }
}

cURL Example

curl "http://localhost:5001/api/v0/pin/ls?arg=&type=all&quiet="


/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": [
        ""
    ]
}

cURL Example

curl "http://localhost:5001/api/v0/pin/rm?arg=&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": [
        ""
    ]
}

cURL Example

curl "http://localhost:5001/api/v0/pin/update?arg=&arg=&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": ""
    "PinStatus": {
        "Ok": ""
        "BadNodes": [
            {
                "Cid": ""
                "Err": ""
            }
        ]
    }
}

cURL Example

curl "http://localhost:5001/api/v0/pin/verify?verbose=&quiet="


/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": ""
    "Time": ""
    "Text": ""
}

cURL Example

curl "http://localhost:5001/api/v0/ping?arg=&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": [
        ""
    ]
}

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": [
        ""
    ]
}

cURL Example

curl "http://localhost:5001/api/v0/pubsub/peers?arg="


/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=&arg="


/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": [
            ""
        ]
        "Data": [
            ""
        ]
        "Seqno": [
            ""
        ]
        "TopicIDs": [
            ""
        ]
        "XXX_unrecognized": [
            ""
        ]
    }
}

cURL Example

curl "http://localhost:5001/api/v0/pubsub/sub?arg=&discover="


/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": ""
    "Err": ""
}

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": ""
}

cURL Example

curl "http://localhost:5001/api/v0/repo/fsck"


/api/v0/repo/gc

Perform a garbage collection sweep on the repo.

Arguments

  • stream-errors [bool]: Stream errors. Required: no.
  • quiet [bool]: Write minimal output. Required: no.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "Key": { "/": "" }
    "Error": ""
}

cURL Example

curl "http://localhost:5001/api/v0/repo/gc?stream-errors=&quiet="


/api/v0/repo/stat

Get stats for the currently used repo.

Arguments

  • human [bool]: Output RepoSize in MiB. Required: no.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "NumObjects": ""
    "RepoSize": ""
    "RepoPath": ""
    "Version": ""
    "StorageMax": ""
}

cURL Example

curl "http://localhost:5001/api/v0/repo/stat?human="


/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:

{
    "Msg": ""
    "Progress": ""
}

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": ""
}

cURL Example

curl "http://localhost:5001/api/v0/repo/version?quiet="


/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. 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.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "Path": ""
}

cURL Example

curl "http://localhost:5001/api/v0/resolve?arg=&recursive=&dht-record-count=&dht-timeout="


/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": ""
    "Wantlist": [
        { "/": "" }
    ]
    "Peers": [
        ""
    ]
    "BlocksReceived": ""
    "DataReceived": ""
    "BlocksSent": ""
    "DataSent": ""
    "DupBlksReceived": ""
    "DupDataReceived": ""
}

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. 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": ""
    "TotalOut": ""
    "RateIn": ""
    "RateOut": ""
}

cURL Example

curl "http://localhost:5001/api/v0/stats/bw?peer=&proto=&poll=&interval=1s"


/api/v0/stats/repo

Get stats for the currently used repo.

Arguments

  • human [bool]: Output RepoSize in MiB. Required: no.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "NumObjects": ""
    "RepoSize": ""
    "RepoPath": ""
    "Version": ""
    "StorageMax": ""
}

cURL Example

curl "http://localhost:5001/api/v0/stats/repo?human="


/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": [
        ""
    ]
}

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. Required: no.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "Strings": [
        ""
    ]
}

cURL Example

curl "http://localhost:5001/api/v0/swarm/addrs/local?id="


/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": [
        ""
    ]
}

cURL Example

curl "http://localhost:5001/api/v0/swarm/connect?arg=


/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": [
        ""
    ]
}

cURL Example

curl "http://localhost:5001/api/v0/swarm/disconnect?arg=


/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": [
        ""
    ]
}

cURL Example

curl "http://localhost:5001/api/v0/swarm/filters/add?arg=


/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": [
        ""
    ]
}

cURL Example

curl "http://localhost:5001/api/v0/swarm/filters/rm?arg=


/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": ""
            "Peer": ""
            "Latency": ""
            "Muxer": ""
            "Streams": [
                {
                    "Protocol": ""
                }
            ]
        }
    ]
}

cURL Example

curl "http://localhost:5001/api/v0/swarm/peers?verbose=&streams=&latency="


/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": ""
    "Hash": ""
    "Bytes": ""
    "Size": ""
}

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="


/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="


/api/v0/version

Show ipfs version information.

Arguments

  • 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.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
    "Version": ""
    "Commit": ""
    "Repo": ""
    "System": ""
    "Golang": ""
}

cURL Example

curl "http://localhost:5001/api/v0/version?number=&commit=&repo=&all="

   这篇文档对你有帮助吗?

How can we help?