API Reference

Generated on 2017-03-18, from go-ipfs v0.4.7.

This is the HTTP API specification for IPFS.

IPFS HTTP API is an RPC API which should work across different IPFS implementations. The most feature-complete of those implementations, and current reference for this specification is go-ipfs.

This document is autogenerated from go-ipfs. For issues and support, check out the ipfs-http-api-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>"
}

cURL Example

curl -F file=@myfile "http://localhost:5001/api/v0/add?recursive=false&quiet=<value>&quieter=<value>&silent=<value>&progress=<value>&trickle=<value>&only-hash=<value>&wrap-with-directory=<value>&hidden=<value>&chunker=<value>&pin=true&raw-leaves=<value>&nocopy=<value>&fscache=<value>"


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

Show some diagnostic information on the bitswap agent.

Arguments

This endpoint takes no arguments.

Response

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

{
    "ProvideBufLen": "<int>"
    "Wantlist": [
        "<string>"
    ]
    "Peers": [
        "<string>"
    ]
    "BlocksReceived": "<int>"
    "DataReceived": "<uint64>"
    "BlocksSent": "<int>"
    "DataSent": "<uint64>"
    "DupBlksReceived": "<int>"
    "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": [
        "<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=v0&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=false&quiet=false"


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


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

cURL Example

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


/api/v0/config/edit

Open the config file for editing in $EDITOR.

Arguments

This endpoint takes no arguments.

Response

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

This endpoint returns a `text/plain` response body.

cURL Example

curl "http://localhost:5001/api/v0/config/edit"


/api/v0/config/replace

Replace the config with .

Arguments

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

cURL Example

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


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

cURL Example

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


/api/v0/dht/findprovs

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

Arguments

Response

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

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

cURL Example

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


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

cURL Example

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


/api/v0/dht/provide

Announce to the network that you are providing given values.

Arguments

Response

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

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

cURL Example

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


/api/v0/dht/put

Write a key/value pair to the DHT.

Arguments

Response

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

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

cURL Example

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


/api/v0/dht/query

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

Arguments

Response

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

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

cURL Example

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


/api/v0/diag/cmds/clear

Clear inactive requests from the log.

Arguments

This endpoint takes no arguments.

Response

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

This endpoint returns a `text/plain` response body.

cURL Example

curl "http://localhost:5001/api/v0/diag/cmds/clear"


/api/v0/diag/cmds/set-time

Set how long to keep inactive requests in the log.

Arguments

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

Generate a network diagnostics report.

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/net?vis=text"


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


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


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

cURL Example

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


/api/v0/files/write

Write to a mutable file in a given filesystem.

Arguments

Request Body

Argument "data" is of file type. This endpoint expects a file in the body of the request as 'multipart/form-data'.

Response

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

This endpoint returns a `text/plain` response body.

cURL Example

curl -F file=@myfile "http://localhost:5001/api/v0/files/write?arg=<path>&offset=<value>&create=<value>&truncate=<value>&count=<value>"


/api/v0/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=false&compress=false&compression-level=-1"


/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/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=false&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 an object to IPNS.

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

Get the value currently published at an IPNS name.

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=false&nocache=false"


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

cURL Example

curl "http://localhost:5001/api/v0/object/diff?arg=<obj_a>&arg=<obj_b>&verbose=<value>"


/api/v0/object/get

Get and serialize the DAG node named by .

Arguments

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


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


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


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


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

cURL Example

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


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

cURL Example

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


/api/v0/repo/verify

Verify all blocks in repo are not corrupted.

Arguments

This endpoint takes no arguments.

Response

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

{
    "Message": "<string>"
    "Progress": "<int>"
}

cURL Example

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


/api/v0/repo/version

Show the repo version.

Arguments

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


/api/v0/stats/bitswap

Show some diagnostic information on the bitswap agent.

Arguments

This endpoint takes no arguments.

Response

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

{
    "ProvideBufLen": "<int>"
    "Wantlist": [
        "<string>"
    ]
    "Peers": [
        "<string>"
    ]
    "BlocksReceived": "<int>"
    "DataReceived": "<uint64>"
    "BlocksSent": "<int>"
    "DataSent": "<uint64>"
    "DupBlksReceived": "<int>"
    "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=false&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>"
}

cURL Example

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


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


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

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/tour/list

Show a list of IPFS Tour topics.

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/tour/list"


/api/v0/tour/next

Show the next IPFS Tour topic.

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/tour/next"


/api/v0/tour/restart

Restart the IPFS Tour.

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/tour/restart"


/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=false&commit=false&repo=false&all=false"