HTTP API

Generated on 2018-06-11, from go-ipfs v0.4.15.

When an IPFS node is running as a daemon, it exposes an HTTP API that allows you to control the node and run the same commands you can from the command line.

In many cases, using this API this is preferable to embedding IPFS directly in your program — it allows you to maintain peer connections that are longer lived than your app and you can keep a single IPFS node running instead of several if your app can be launched multiple times. In fact, the ipfs CLI commands use this API when operating in online mode.

This API is intended to be the same across different IPFS implementations. However, not all implementations are equally up-to-date. The most feature-complete (and the 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-docs repository on GitHub.

Getting started

Alignment with CLI Commands

Every command 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

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=size-262144&pin=true&raw-leaves=<value>&nocopy=<value>&fscache=<value>&cid-version=<value>&hash=sha2-256"


/api/v0/bitswap/ledger

Show the current ledger for a peer.

Arguments

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

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

Response

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

{
    "Keys": [
        { "/": "<cid-string>" }
    ]
}

cURL Example

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


/api/v0/block/get

Get a raw IPFS block.

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/block/get?arg=<key>"


/api/v0/block/put

Store input as an IPFS block.

Arguments

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=<value>&mhtype=sha2-256&mhlen=-1"


/api/v0/block/rm

Remove IPFS block(s).

Arguments

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=<value>&quiet=<value>"


/api/v0/block/stat

Print information of a raw IPFS block.

Arguments

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

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>&offset=<value>&length=<value>"


/api/v0/commands

List all available commands.

Arguments

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": [
                        ...
                    ]
                    "showOpts": "<bool>"
                }
            ]
            "Options": [
                {
                    "Names": [
                        ...
                    ]
                }
            ]
            "showOpts": "<bool>"
        }
    ]
    "Options": [
        {
            "Names": [
                "<string>"
            ]
        }
    ]
    "showOpts": "<bool>"
}

cURL Example

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


/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

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


/api/v0/config/replace

Replace the config with .

Arguments

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

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

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

cURL Example

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


/api/v0/dag/resolve

Resolve ipld block

Arguments

Response

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

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

Response

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

{
    "ID": "<string>"
    "Type": "<int>"
    "Responses": [
        {
            "ID": "<string>"
            "Addrs": [
                "<multiaddr-string>"
            ]
        }
    ]
    "Extra": "<string>"
}

cURL Example

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


/api/v0/dht/findprovs

Find peers in the DHT that can provide a specific value, given a key.

Arguments

Response

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

{
    "ID": "<string>"
    "Type": "<int>"
    "Responses": [
        {
            "ID": "<string>"
            "Addrs": [
                "<multiaddr-string>"
            ]
        }
    ]
    "Extra": "<string>"
}

cURL Example

curl "http://localhost:5001/api/v0/dht/findprovs?arg=<key>&verbose=<value>&num-providers=20"


/api/v0/dht/get

Given a key, query the DHT for its best value.

Arguments

Response

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

{
    "ID": "<string>"
    "Type": "<int>"
    "Responses": [
        {
            "ID": "<string>"
            "Addrs": [
                "<multiaddr-string>"
            ]
        }
    ]
    "Extra": "<string>"
}

cURL Example

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


/api/v0/dht/provide

Announce to the network that you are providing given values.

Arguments

Response

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

{
    "ID": "<string>"
    "Type": "<int>"
    "Responses": [
        {
            "ID": "<string>"
            "Addrs": [
                "<multiaddr-string>"
            ]
        }
    ]
    "Extra": "<string>"
}

cURL Example

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


/api/v0/dht/put

Write a key/value pair to the DHT.

Arguments

Response

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

{
    "ID": "<string>"
    "Type": "<int>"
    "Responses": [
        {
            "ID": "<string>"
            "Addrs": [
                "<multiaddr-string>"
            ]
        }
    ]
    "Extra": "<string>"
}

cURL Example

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


/api/v0/dht/query

Find the closest Peer IDs to a given Peer ID by querying the DHT.

Arguments

Response

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

{
    "ID": "<string>"
    "Type": "<int>"
    "Responses": [
        {
            "ID": "<string>"
            "Addrs": [
                "<multiaddr-string>"
            ]
        }
    ]
    "Extra": "<string>"
}

cURL Example

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


/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

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

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


/api/v0/file/ls

List directory contents for Unix filesystem objects.

Arguments

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

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

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


/api/v0/files/cp

Copy files into mfs.

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/files/cp?arg=<source>&arg=<dest>"


/api/v0/files/flush

Flush a given path’s data to disk.

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/files/flush?arg=<path>"


/api/v0/files/ls

List directories in the local mutable namespace.

Arguments

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

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


/api/v0/files/mv

Move files.

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/files/mv?arg=<source>&arg=<dest>"


/api/v0/files/read

Read a file in a given mfs.

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/files/read?arg=<path>&offset=<value>&count=<value>"


/api/v0/files/rm

Remove a file.

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/files/rm?arg=<path>&recursive=<value>"


/api/v0/files/stat

Display file status.

Arguments

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>"
    "WithLocality": "<bool>"
    "Local": "<bool>"
    "SizeLocal": "<uint64>"
}

cURL Example

curl "http://localhost:5001/api/v0/files/stat?arg=<path>&format=<hash> Size: <size> CumulativeSize: <cumulsize> ChildBlocks: <childs> Type: <type>&hash=<value>&size=<value>&with-local=<value>"


/api/v0/files/write

Write to a mutable file in a given filesystem.

Arguments

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>&raw-leaves=<value>&cid-version=<value>&hash=<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

Response

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

{
    "Status": "<int32>"
    "ErrorMsg": "<string>"
    "Key": { "/": "<cid-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

Response

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

{
    "Status": "<int32>"
    "ErrorMsg": "<string>"
    "Key": { "/": "<cid-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

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=<value>&compress=<value>&compression-level=<value>"


/api/v0/id

Show ipfs node id info.

Arguments

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

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

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

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

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

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

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=<value>&resolve-type=true"


/api/v0/mount

Mounts IPFS to the filesystem (read-only).

Arguments

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

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/pubsub/cancel

Cancel a name subscription

Arguments

Response

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

{
    "Canceled": "<bool>"
}

cURL Example

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


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

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

cURL Example

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


/api/v0/name/resolve

Resolve IPNS names.

Arguments

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=<value>&nocache=<value>&dht-record-count=<value>&dht-timeout=<value>"


/api/v0/object/data

Output the raw bytes of an IPFS object.

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/object/data?arg=<key>"


/api/v0/object/diff

Display the diff between two ipfs objects.

Arguments

Response

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

{
    "Changes": [
        {
            "Type": "<int>"
            "Path": "<string>"
            "Before": { "/": "<cid-string>" }
            "After": { "/": "<cid-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

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


Output the links pointed to by the specified object.

Arguments

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


/api/v0/object/new

Create a new object from an ipfs template.

Arguments

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


Add a link to a given object.

Arguments

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


/api/v0/object/patch/append-data

Append data to the data segment of a dag node.

Arguments

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


Remove a link from an object.

Arguments

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

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

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=<value>&quiet=<value>"


/api/v0/object/stat

Get stats for the DAG node named by .

Arguments

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

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


/api/v0/p2p/listener/ls

List active p2p listeners.

Arguments

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


/api/v0/p2p/listener/open

Forward p2p connections to a network multiaddr.

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/p2p/listener/open?arg=<Protocol>&arg=<Address>"


/api/v0/p2p/stream/close

Close active p2p stream.

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/p2p/stream/close?arg=<HandlerID>&all=<value>"


/api/v0/p2p/stream/dial

Dial to a p2p listener.

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/p2p/stream/dial?arg=<Peer>&arg=<Protocol>&arg=<BindAddress>"


/api/v0/p2p/stream/ls

List active p2p streams.

Arguments

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


/api/v0/pin/add

Pin objects to local storage.

Arguments

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

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


/api/v0/pin/rm

Remove pinned objects from local storage.

Arguments

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

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

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

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

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

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

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

Response

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

{
    "Key": { "/": "<cid-string>" }
    "Error": "<string>"
}

cURL Example

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


/api/v0/repo/stat

Get stats for the currently used repo.

Arguments

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


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

cURL Example

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


/api/v0/repo/version

Show the repo version.

Arguments

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

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=<value>&dht-record-count=<value>&dht-timeout=<value>"


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

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=<value>&interval=1s"


/api/v0/stats/repo

Get stats for the currently used repo.

Arguments

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


/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

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


/api/v0/swarm/connect

Open connection to a given address.

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/connect?arg=<address>"


/api/v0/swarm/disconnect

Close connection to a given address.

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/disconnect?arg=<address>"


/api/v0/swarm/filters/add

Add an address filter.

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/filters/add?arg=<address>"


/api/v0/swarm/filters/rm

Remove an address filter.

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/filters/rm?arg=<address>"


/api/v0/swarm/peers

List peers with open connections.

Arguments

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

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

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

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

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

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