Codex API (0.0.1)

Download OpenAPI specification:Download

List of endpoints and interfaces available to Codex API users

Marketplace

Marketplace information and operations

Returns active slots

Authorizations:
None

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Returns active slot with id {slotId} for the host

Authorizations:
None
path Parameters
slotId
required
string (Cid)
Example: QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N

File to be downloaded.

Responses

Response samples

Content type
application/json
{
  • "id": "268a781e0db3f7cf36b18e5f4fdb7f586ec9edd08e5500b17c0e518a769f114a",
  • "request": {
    },
  • "slotIndex": "string"
}

Returns storage that is for sale

Authorizations:
None

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Offers storage for sale

Authorizations:
None
Request Body schema: application/json
id
string (Id)

32bits identifier encoded in hex-decimal string.

totalSize
required
string

Total size of availability's storage in bytes as decimal string

duration
required
string (Duration)

The duration of the request in seconds as decimal string

minPrice
required
string

Minimum price to be paid (in amount of tokens) as decimal string

maxCollateral
required
string

Maximum collateral user is willing to pay per filled Slot (in amount of tokens) as decimal string

Responses

Request samples

Content type
application/json
{
  • "id": "0x...",
  • "totalSize": "string",
  • "duration": "string",
  • "minPrice": "string",
  • "maxCollateral": "string"
}

Response samples

Content type
application/json
{
  • "id": "0x...",
  • "totalSize": "string",
  • "duration": "string",
  • "minPrice": "string",
  • "maxCollateral": "string",
  • "freeSize": "string"
}

Updates availability

The new parameters will be only considered for new requests. Existing Requests linked to this Availability will continue as is.

Authorizations:
None
path Parameters
id
required
string

ID of Availability

Request Body schema: application/json
id
string (Id)

32bits identifier encoded in hex-decimal string.

totalSize
string

Total size of availability's storage in bytes as decimal string

duration
string (Duration)

The duration of the request in seconds as decimal string

minPrice
string

Minimum price to be paid (in amount of tokens) as decimal string

maxCollateral
string

Maximum collateral user is willing to pay per filled Slot (in amount of tokens) as decimal string

Responses

Request samples

Content type
application/json
{
  • "id": "0x...",
  • "totalSize": "string",
  • "duration": "string",
  • "minPrice": "string",
  • "maxCollateral": "string"
}

Get availability's reservations

Return's list of Reservations for ongoing Storage Requests that the node hosts.

Authorizations:
None
path Parameters
id
required
string

ID of Availability

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Creates a new Request for storage

Authorizations:
None
path Parameters
cid
required
string (Cid)
Example: QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N

CID of the uploaded data that should be stored

Request Body schema: application/json
duration
required
string (Duration)

The duration of the request in seconds as decimal string

reward
required
string (Reward)

The maximum amount of tokens paid per second per slot to hosts the client is willing to pay

proofProbability
required
string (ProofProbability)

How often storage proofs are required as decimal string

nodes
integer
Default: 1

Minimal number of nodes the content should be stored on

tolerance
integer
Default: 0

Additional number of nodes on top of the nodes property that can be lost before pronouncing the content lost

collateral
required
string

Number as decimal string that represents how much collateral is asked from hosts that wants to fill a slots

expiry
required
string

Number as decimal string that represents expiry threshold in seconds from when the Request is submitted. When the threshold is reached and the Request does not find requested amount of nodes to host the data, the Request is voided. The number of seconds can not be higher then the Request's duration itself.

Responses

Request samples

Content type
application/json
{
  • "duration": "string",
  • "reward": "string",
  • "proofProbability": "string",
  • "nodes": 1,
  • "tolerance": 0,
  • "collateral": "string",
  • "expiry": "string"
}

Returns list of purchase IDs

Authorizations:
None

Responses

Response samples

Content type
application/json
[
  • "string"
]

Returns purchase details

Authorizations:
None
path Parameters
id
required
string

Hexadecimal ID of a Purchase

Responses

Response samples

Content type
application/json
{
  • "state": "string",
  • "error": "string",
  • "request": {
    }
}

Data

Data operations

Lists manifest CIDs stored locally in node.

Authorizations:
None

Responses

Response samples

Content type
application/json
{
  • "content": [
    ]
}

Upload a file in a streaming manner. Once finished, the file is stored in the node and can be retrieved by any node in the network using the returned CID.

Authorizations:
None
Request Body schema: application/octet-stream
string <binary>

Responses

Download a file from the local node in a streaming manner. If the file is not available locally, a 404 is returned.

Authorizations:
None
path Parameters
cid
required
string (Cid)
Example: QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N

File to be downloaded.

Responses

Download a file from the network in a streaming manner. If the file is not available locally, it will be retrieved from other nodes in the network if able.

Authorizations:
None
path Parameters
cid
required
string (Cid)
Example: QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N

File to be downloaded.

Responses

Gets a summary of the storage space allocation of the node.

Authorizations:
None

Responses

Response samples

Content type
application/json
{
  • "totalBlocks": 0,
  • "quotaMaxBytes": 0,
  • "quotaUsedBytes": 0,
  • "quotaReservedBytes": 0
}

Node

Node management

Connect to a peer

If addrs param is supplied, it will be used to dial the peer, otherwise the peerId is used to invoke peer discovery, if it succeeds the returned addresses will be used to dial.

Authorizations:
None
path Parameters
peerId
required
string (PeerId)
Example: QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N

Peer that should be dialed.

query Parameters
addrs
Array of strings or null (MultiAddress)
Example: addrs=/ip4/127.0.0.1/tcp/8080

If supplied, it will be used to dial the peer. The address has to target the listening address of the peer, which is specified with the --listen-addrs CLI flag.

Responses

Get Node's SPR

Authorizations:
None

Responses

Response samples

Content type
No sample

Get Node's PeerID

Authorizations:
None

Responses

Response samples

Content type
No sample

Debug

Debugging configuration

Set log level at run time

Authorizations:
None
query Parameters
level
required
string (LogLevel)
Example: level=DEBUG

One of the log levels: TRACE, DEBUG, INFO, NOTICE, WARN, ERROR or FATAL

Responses

Gets node information

Authorizations:
None

Responses

Response samples

Content type
application/json
{
  • "id": "QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N",
  • "addrs": [
    ],
  • "repo": "string",
  • "spr": "string"
}