add

/api/v0/add

Add a file or directory to IPFS.

REQUEST

POST https://ipfs.infura.io:5001/api/v0/add?recursive=false&quiet=<value>&quieter=<value>&silent=<value>&progress=<value>&trickle=<value>&only-hash=<value>&wrap-with-directory=<value>&hidden=<value>&chunker=<value>&pin=true&raw-leaves=<value>&nocopy=<value>&fscache=<value>&cid-version=0&hash=sha2-256

REQUEST PARAMS

  • file [Required] - The path to a file to be added to IPFS.
  • recursive [Optional] - Add directory paths recursively. Default: “false”.
  • quiet [Optional] - Write minimal output.
  • quieter [Optional] - Write only final hash.
  • silent [Optional] - Write no output.
  • progress [Optional] - Stream progress data.
  • trickle [Optional] - Use trickle-dag format for dag generation.
  • only-hash [Optional] - Only chunk and hash - do not write to disk.
  • wrap-with-directory [Optional] - Wrap files with a directory object.
  • hidden [Optional] - Include files that are hidden. Only takes effect on recursive add. chunker [string]: Chunking algorithm to use.
  • pin [Optional] - Pin this object when adding. Default: “true”.
  • raw-leaves [Optional] - Use raw blocks for leaf nodes. (experimental).
  • nocopy [Optional] - Add the file using filestore. (experimental).
  • fscache [Optional] - Check the filestore for pre-existing blocks. (experimental).
  • cid-version [int]: Cid version. Non-zero value will change default of ‘raw-leaves’ to true. (experimental). Default: “0”.
  • hash [string]: Hash function to use. Will set Cid version to 1 if used. (experimental). Default: “sha2-256”.

EXAMPLE

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

// POST
curl "https://ipfs.infura.io:5001/api/v0/add?pin=false" \
    -X POST \
    -H "Content-Type: multipart/form-data" \
    -F file=@"/sample-result.json" 

RESPONSE

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

RESULT FIELDS

  • Name - Name of the object
  • Hash - Hash of the uploaded object
  • Size - integer indication size in bytes

BODY

{
    "Name": "sample-result.json",
    "Hash": "QmSTkR1kkqMuGEeBS49dxVJjgHRMH6cUYa7D3tcHDQ3ea3",
    "Size": "2120"
}

block_get

/api/v0/block/get

Get a raw IPFS block.

REQUEST

POST https://ipfs.infura.io:5001/api/v0/block/get?arg=<key>

REQUEST PARAMS

  • arg [required] - The base58 multihash of an existing block to get.

EXAMPLE

// POST
curl -X POST "https://ipfs.infura.io:5001/api/v0/block/get?arg=QmaYL7E4gDTPNfLxrCEEEcNJgcHBJ55NxxTnxpDKWqMtJ3"

RESPONSE

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

BODY

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

block_put

/api/v0/block/put

Store input as an IPFS block.

REQUEST

POST https://ipfs.infura.io::5001/api/v0/block/put?format=v0&mhtype=sha2-256&mhlen=-1

REQUEST PARAMS

  • file [Required] - The path to a file to be added to IPFS.
  • format [Optional] - cid format for blocks to be created with. Default: “v0”.
  • mhtype [Optional] - multihash hash function. Default: “sha2-256”.
  • mhlen [Optional] - multihash hash length. Default: “-1”.

EXAMPLE

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

// POST
curl "https://ipfs.infura.io:5001/api/v0/block/put" \
    -X POST \
    -H "Content-Type: multipart/form-data" \
    -F file=@"/purpink.jpeg" 

RESPONSE

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

RESULT FIELDS

  • Key - Key of the block
  • Size - integer indication size in bytes

BODY

{
    "Key": "QmaYL7E4gDTPNfLxrCEEEcNJgcHBJ55NxxTnxpDKWqMtJ3",
    "Size": 2392
}

block_stat

/api/v0/block/stat

Print information of a raw IPFS block.

REQUEST

POST https://ipfs.infura.io:5001/api/v0/block/stat?arg=<key>

REQUEST PARAMS

  • arg [required] - The base58 multihash of an existing block to stat.

EXAMPLE

// POST
curl -X POST "https://ipfs.infura.io:5001/api/v0/block/stat?arg=QmfQ5QAjvg4GtA3wg3adpnDJug8ktA1BxurVqBD8rtgVjM"

RESPONSE

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

RESULT FIELDS

  • Key - The base58 multihash string of the block
  • Size - An integer representing the size in bytes

BODY

{
    Key: "QmfQ5QAjvg4GtA3wg3adpnDJug8ktA1BxurVqBD8rtgVjM",
    Size: 18
}

cat

/api/v0/cat

Show IPFS object data.

REQUEST

POST https://ipfs.infura.io:5001/api/v0/cat?arg=<key>

REQUEST PARAMS

  • arg [required] - The IPFS object hash

EXAMPLE

// POST
curl -X POST "https://ipfs.infura.io:5001/api/v0/cat?arg=QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy"

RESPONSE

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

BODY

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

dag_get

/api/v0/dag/get

Get a dag node from IPFS.

REQUEST

POST https://ipfs.infura.io:5001/api/v0/dat/get?arg=<key>

REQUEST PARAMS

  • arg [required] - The IPFS object hash

EXAMPLE

// POST
curl -X POST "https://ipfs.infura.io:5001/api/v0/dag/get?arg=QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy"

RESPONSE

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

RESULT FIELDS

  • data
  • links - An array of associated link objects

BODY

{
    data: "CAISFXZlcnNpb24gMSBvZiBteSB0ZXh0ChgV",
    links: [ ]
}

dag_put

/api/v0/dag/put

Add a dag node to IPFS.

REQUEST

POST https://ipfs.infura.io:5001/api/v0/dag/put?format=cbor&input-enc=json&pin=false&hash=<value>

REQUEST PARAMS

  • file [Required] - The path to a file to be added to IPFS.
  • format [Optional] - cid format for blocks to be created
  • pin [Optional] - Pin this object when adding. Default: “true”.
  • input-enc [Optional] - Format that the input object will be. Default: “json”.
  • hash [Optional] - Hash function to use.

EXAMPLE

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

// POST
curl "https://ipfs.infura.io:5001/api/v0/dag/put?format=cbor&input-enc=json&pin=false" \
    -X POST \
    -H "Content-Type: multipart/form-data" \
    -F file=@"/sample-result.json" 

RESPONSE

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

RESULT FIELDS

  • Cid - Content ID (see more here)

BODY

{
    "Cid": {
        "/": "zdpuAzaZNBehCV84L76P6Zr5APxN8bbGdqvrqPfvX6XKMBYpK"
    }
}

dag_resolve

/api/v0/dag/resolve

Resolve IPLD block

REQUEST

POST https://ipfs.infura.io:5001/api/v0/dat/resolve?arg=<key>

REQUEST PARAMS

  • arg [required] - The IPFS object hash; the path to resolve

EXAMPLE

// POST
curl -X POST "https://ipfs.infura.io:5001/api/v0/dag/resolve?arg=QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy"

RESPONSE

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

RESULT FIELDS

  • Cid - Content ID (see more here)
  • RemPath

BODY

{
    Cid: {
        /: "QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy"
    },
    RemPath: ""
}

get

/api/v0/get

Download IPFS objects.

REQUEST

POST https://ipfs.infura.io:5001/api/v0/get?arg=<ipfs-path>&output=<value>&archive=false&compress=false&compression-level=-1

REQUEST PARAMS

  • arg [required] - The IPFS object hash
  • output [optional] - The path where the output should be stored.
  • archive [optional] - Output a TAR archive. Default: “false”.
  • compress [optional] - Compress the output with GZIP compression. Default is “false”.
  • compression-level [optional] - The level of compression (1-9). Default: “-1”.

EXAMPLE

// POST
curl -X POST "https://ipfs.infura.io:5001/api/v0/get?arg=QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy&archive=true"

RESPONSE

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

BODY

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

object_data

/api/v0/object/data

Output the raw bytes of an IPFS object.

REQUEST

POST https://ipfs.infura.io:5001/api/v0/object/data?arg=<key>

REQUEST PARAMS

  • arg [required] - Key of the object to retrieve, in base58-encoded multihash format.

EXAMPLE

// POST
curl -X POST "https://ipfs.infura.io:5001/api/v0/object/data?arg=QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy"

RESPONSE

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

BODY

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

object_get

/api/v0/object/get

Get and serialize the DAG node named by key.

REQUEST

POST https://ipfs.infura.io:5001/api/v0/object/get?arg=<key>

REQUEST PARAMS

  • arg [required] - Key of the object to retrieve, in base58-encoded multihash format.

EXAMPLE

// POST
curl -X POST "https://ipfs.infura.io:5001/api/v0/object/get?arg=QmfQ5QAjvg4GtA3wg3adpnDJug8ktA1BxurVqBD8rtgVjM"

RESPONSE

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

RESULT FIELDS

  • links - An array of associated link objects
  • data

BODY

{
    Links: [ ],
    Data: "version 1 of my text "
}

object_put

/api/v0/object/put

Store input as a DAG object, print its key.

REQUEST

POST http://ipfs.infura:5001/api/v0/object/put?inputenc=json&datafieldenc=text&pin=false

REQUEST PARAMS

  • file [Required] - the file to be stored as a DAG object.
  • inputenc [Optional] - Encoding type of input data. One of: {“protobuf”, “json”}. Default: “json”.
  • datafieldenc [Optional] - Encoding type of the data field, either “text” or “base64”. Default: “text”.
  • pin [Optional] - Pin this object when adding. Default: “false”.

EXAMPLE

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

// POST
curl "https://ipfs.infura.io:5001/api/v0/object/put?inputenc=json&datafieldenc=text&pin=false" \
    -X POST \
    -H "Content-Type: multipart/form-data" \
    -F file=@"node.json" 

RESPONSE

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

RESULT FIELDS

  • Hash - Hash of the object

BODY

{
    "Hash": "QmZZmY4KCu9r3e7M2Pcn46Fc5qbn6NpzaAGaYb22kbfTqm"
}

object_stat

/api/v0/object/stat

Get stats for the DAG node named by key.

REQUEST

POST https://ipfs.infura.io:5001/api/v0/object/stat?arg=<key>

REQUEST PARAMS

  • arg [required] - Key of the object to retrieve, in base58-encoded multihash format.

EXAMPLE

// POST
curl -X POST "https://ipfs.infura.io:5001/api/v0/object/stat?arg=QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy"

RESPONSE

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

RESULT FIELDS

  • Hash - Hash of the object
  • NumLinks - number of links the node contains
  • BlockSize - size of the raw serialized node
  • LinksSize - size of the links block section
  • DataSize - size of data block section
  • CumulativeSize - size of the tree (BlockSize + link sizes)

BODY

{
    Hash: "QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy",
    NumLinks: 0,
    BlockSize: 29,
    LinksSize: 2,
    DataSize: 27,
    CumulativeSize: 29
}

pin_add

/api/v0/pin/add

Pin objects to local storage.

REQUEST

POST https://ipfs.infura.io:5001/api/v0/pin/add?arg=<ipfs-path>&recursive=true&progress=<value>

REQUEST PARAMS

  • arg [Required] - Path to object(s) to be pinned.
  • recursive [Optional] - Recursively pin the object linked to by the specified object(s). Default: “true”
  • progress [Optional] - Show progress.

EXAMPLE

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

// POST
curl -X POST "https://ipfs.infura.io:5001/api/v0/pin/add?arg=/ipfs/QmSTkR1kkqMuGEeBS49dxVJjgHRMH6cUYa7D3tcHDQ3ea3" 

RESPONSE

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

RESULT FIELDS

  • Pins - An array of Pin hashes

BODY

{
    "Pins": [
        "QmSTkR1kkqMuGEeBS49dxVJjgHRMH6cUYa7D3tcHDQ3ea3"
    ],
}

version

/api/v0/version

Show IPFS version information.

REQUEST

POST https://ipfs.infura.io:5001/api/v0/version?number=false&commit=false&repo=false&all=false

REQUEST PARAMS

  • number [optional] - Only show the version number. Default is false
  • commit [optional] - Show the commit hash. Default is false
  • repo [optional] - Show repo version. Default is false
  • all [optional] - Show all version information. Default is false

EXAMPLE

// POST
curl -X POST "https://ipfs.infura.io:5001/api/v0/version"

RESPONSE

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

RESULT FIELDS

  • Version - Current version number
  • Commit - Current commit id
  • Repo - Version number of the repo
  • System - System information
  • Golang - GoLang runtime version

BODY

{
    Version: "0.4.14",
    Commit: "",
    Repo: "6",
    System: "amd64/linux",
    Golang: "go1.10"
}

Other Resources