LogoLogo
  • Authentication API
  • Chain API
    • Smart Account
    • API References
      • Net
      • ERC20 Token
      • ERC721 Token
      • ERC1155 Token
      • Smart Account
  • Chain Application API
    • ServerWallet API
    • Payment API
      • Payment (gRPC)
      • Points (REST)
    • IPFS API
      • API References
  • Chain API Errors
Powered by GitBook
On this page
  1. Chain Application API
  2. IPFS API

API References

Private IPFS for NFT

PreviousIPFS APINextChain API Errors

Add

Request Body

This endpoint expects one or several files (depending on the command) in the body of the request as 'multipart/form-data'.

The add command not only allows adding files, but also uploading directories and complex hierarchies.

This happens as follows: Every part in the multipart request is a directory or a file to be added to IPFS.

Directory parts have a special content type application/x-directory. These parts do not carry any data. The part headers look as follows:

Content-Disposition: form-data; name="file"; filename="folderName"
Content-Type: application/x-directory

File parts carry the file payload after the following headers:

Abspath: /absolute/path/to/file.txt
Content-Disposition: form-data; name="file"; filename="folderName%2Ffile.txt"
Content-Type: application/octet-stream

...contents...

The above file includes its path in the "folderName/file.txt" hierarchy and IPFS will therefore be able to add it inside "folderName". The parts declaring the directories are optional when they have files inside and will be inferred from the filenames. In any case, a depth-first traversal of the directory tree is recommended to order the different parts making the request.

The Abspath header is included for filestore/urlstore features that are enabled with the nocopy option and it can be set to the location of the file in the filesystem (within the IPFS root), or to its full web URL.

Example

curl -X 'POST' \
  '{endpoint}/ipfs/add' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o' \
  -H 'Content-Type: multipart/form-data' \
  -F 'file=@file.yaml'
{
  "cid": "QmVuLWZ1cmZiujoM9y6r6nd19x9kVEARYa9NABzf6GbxRN"
}

Cat

Example

curl -X 'GET' \
  '{endpoint}/ipfs/QmVuLWZ1cmZiujoM9y6r6nd19x9kVEARYa9NABzf6GbxRN' \
  -H 'accept: text/plain' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o'
File contents

Get

Example

curl -X 'GET' \
  '{endpoint}/ipfs/QmVuLWZ1cmZiujoM9y6r6nd19x9kVEARYa9NABzf6GbxRN/get?filename=temp' \
  -H 'accept: application/x-tar' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o'
Tar file

Id

Example

curl -X 'GET' \
  '{endpoint}/ipfs/id' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o'
{
  "id": "12D3KooWN4tTkHvjMttH77tMtcTBz5HJqEfNveJsnDo828JjHcjL"
}

Version

Example

curl -X 'GET' \
  '{endpoint}/ipfs/version' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o'
{
  "version": "0.10.0"
}

Show IPFS object data

get
Authorizations
Path parameters
cidstringRequired

The content ID to the IPFS object(s) to be outputted

Query parameters
sub_pathstringOptional

The sub path of the IPFS object(s)

Responses
200
Show IPFS object data
text/plain
Responsestring
get
GET /v1/ipfs/{cid} HTTP/1.1
Host: test1-api.vixco.net
Authorization: Bearer JWT
Accept: */*
200

Show IPFS object data

text

Save IPFS object data

get
Authorizations
Path parameters
cidstringRequired

The content ID to the IPFS object(s) to be outputted

Query parameters
filenamestringOptional

The filename to be saved. If omitted, CID is used

Responses
200
Save IPFS object data
application/x-tar
Responsestring · binary
get
GET /v1/ipfs/{cid}/get HTTP/1.1
Host: test1-api.vixco.net
Authorization: Bearer JWT
Accept: */*
200

Save IPFS object data

binary

Show IPFS node id info.

get
Authorizations
Responses
200
Show IPFS node id info
application/json
get
GET /v1/ipfs/id HTTP/1.1
Host: test1-api.vixco.net
Authorization: Bearer JWT
Accept: */*
200

Show IPFS node id info

{
  "id": "text"
}

Show IPFS version information

get
Authorizations
Responses
200
Show IPFS version information
application/json
get
GET /v1/ipfs/version HTTP/1.1
Host: test1-api.vixco.net
Authorization: Bearer JWT
Accept: */*
200

Show IPFS version information

{
  "version": "text"
}
  • Add
  • POSTAdd a file or directory to IPFS
  • Cat
  • GETShow IPFS object data
  • Get
  • GETSave IPFS object data
  • Id
  • GETShow IPFS node id info.
  • Version
  • GETShow IPFS version information

Add a file or directory to IPFS

post
Authorizations
Query parameters
wrapstringOptional

Make a directory for including the file

Body
filestring · binaryOptional
Responses
200
Add a file or directory to IPFS
application/json
post
POST /v1/ipfs/add HTTP/1.1
Host: test1-api.vixco.net
Authorization: Bearer JWT
Content-Type: multipart/form-data
Accept: */*
Content-Length: 17

{
  "file": "binary"
}
200

Add a file or directory to IPFS

{
  "cid": "text"
}