description:The duration of the request in seconds
ProofProbability:
type:string
description:How often storage proofs are required as decimal string
Expiry:
type:integer
format:int64
description:A timestamp as seconds since unix epoch at which this request expires if the Request does not find requested amount of nodes to host the data.
description:Number 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.
StorageAsk:
type:object
required:
- slots
- slotSize
- duration
- proofProbability
- pricePerBytePerSecond
- collateralPerByte
- maxSlotLoss
properties:
slots:
description:Number of slots (eq. hosts) that the Request want to have the content spread over
description:If Request failed, then here is presented the error message
request:
$ref:"#/components/schemas/StorageRequest"
requestId:
$ref:"#/components/schemas/Id"
DataList:
type:object
required:
- content
properties:
content:
type:array
items:
$ref:"#/components/schemas/DataItem"
DataItem:
type:object
required:
- cid
- manifest
properties:
cid:
$ref:"#/components/schemas/Cid"
manifest:
$ref:"#/components/schemas/ManifestItem"
ManifestItem:
type:object
required:
- treeCid
- datasetSize
- blockSize
- protected
properties:
treeCid:
$ref:"#/components/schemas/Cid"
description:"Unique data identifier"
datasetSize:
type:integer
format:int64
description:"Length of original content in bytes"
blockSize:
type:integer
description:"Size of blocks"
protected:
type:boolean
description:"Indicates if content is protected by erasure-coding"
filename:
type:string
nullable:true
description:"The original name of the uploaded content (optional)"
example:codex.png
mimetype:
type:string
nullable:true
description:"The original mimetype of the uploaded content (optional)"
example:image/png
Space:
type:object
required:
- totalBlocks
- quotaMaxBytes
- quotaUsedBytes
- quotaReservedBytes
properties:
totalBlocks:
description:"Number of blocks stored by the node"
type:integer
format:int64
quotaMaxBytes:
type:integer
format:int64
description:"Maximum storage space (in bytes) available for the node in Codex's local repository."
quotaUsedBytes:
type:integer
format:int64
description:"Amount of storage space (in bytes) currently used for storing files in Codex's local repository."
quotaReservedBytes:
type:integer
format:int64
description:"Amount of storage reserved (in bytes) in the Codex's local repository for future use when storage requests will be picked up and hosted by the node using node's availabilities. This does not include the storage currently in use."
servers:
- url:"http://localhost:8080/api/codex/v1"
tags:
- name:Marketplace
description:Marketplace information and operations
- name:Data
description:Data operations
- name:Node
description:Node management
- name:Debug
description:Debugging configuration
paths:
"/connect/{peerId}":
get:
summary:"Connect to a peer"
description:|
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.
tags:[Node]
operationId:connectPeer
parameters:
- in:path
name:peerId
required:true
schema:
$ref:"#/components/schemas/PeerId"
description:Peer that should be dialed.
- in:query
name:addrs
schema:
type:array
nullable:true
items:
$ref:"#/components/schemas/MultiAddress"
description:|
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:
"200":
description:Successfully connected to peer
"400":
description:Peer either not found or was not possible to dial
"/data":
get:
summary:"Lists manifest CIDs stored locally in node."
tags:[Data]
operationId:listData
responses:
"200":
description:Retrieved list of content CIDs
content:
application/json:
schema:
$ref:"#/components/schemas/DataList"
"400":
description:Invalid CID is specified
"404":
description:Content specified by the CID is not found
"422":
description:The content type is not a valid content type or the filename is not valid
"500":
description:Well it was bad-bad
post:
summary:"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."
tags:[Data]
operationId:upload
parameters:
- name:content-type
in:header
required:false
description:The content type of the file. Must be valid.
schema:
type:string
example:"image/png"
- name:content-disposition
in:header
required:false
description:The content disposition used to send the filename.
summary:"Download a file from the network to the local node if it's not available locally. Note: Download is performed async. Call can return before download is completed."
tags:[Data]
operationId:downloadNetwork
parameters:
- in:path
name:cid
required:true
schema:
$ref:"#/components/schemas/Cid"
description:"File to be downloaded."
responses:
"200":
description:Manifest information for download that has been started.
content:
application/json:
schema:
$ref:"#/components/schemas/DataItem"
"400":
description:Invalid CID is specified
"404":
description:Failed to download dataset manifest
"500":
description:Well it was bad-bad
"/data/{cid}/network/stream":
get:
summary:"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."
tags:[Data]
operationId:downloadNetworkStream
parameters:
- in:path
name:cid
required:true
schema:
$ref:"#/components/schemas/Cid"
description:"File to be downloaded."
responses:
"200":
description:Retrieved content specified by CID
content:
application/octet-stream:
schema:
type:string
format:binary
"400":
description:Invalid CID is specified
"404":
description:Content specified by the CID is not found
"500":
description:Well it was bad-bad
"/data/{cid}/network/manifest":
get:
summary:"Download only the dataset manifest from the network to the local node if it's not available locally."
tags:[Data]
operationId:downloadNetworkManifest
parameters:
- in:path
name:cid
required:true
schema:
$ref:"#/components/schemas/Cid"
description:"File for which the manifest is to be downloaded."
responses:
"200":
description:Manifest information.
content:
application/json:
schema:
$ref:"#/components/schemas/DataItem"
"400":
description:Invalid CID is specified
"404":
description:Failed to download dataset manifest
"500":
description:Well it was bad-bad
"/space":
get:
summary:"Gets a summary of the storage space allocation of the node."
tags:[Data]
operationId:space
responses:
"200":
description:"Summary of storage allocation"
content:
application/json:
schema:
$ref:"#/components/schemas/Space"
"500":
description:"It's not working as planned"
"/sales/slots":
get:
summary:"Returns active slots"
tags:[Marketplace]
operationId:getActiveSlots
responses:
"200":
description:Retrieved active slots
content:
application/json:
schema:
type:array
items:
$ref:"#/components/schemas/Slot"
"503":
description:Persistence is not enabled
"/sales/slots/{slotId}":
get:
summary:"Returns active slot with id {slotId} for the host"
tags:[Marketplace]
operationId:getActiveSlotById
parameters:
- in:path
name:slotId
required:true
schema:
$ref:"#/components/schemas/Cid"
description:File to be downloaded.
responses:
"200":
description:Retrieved active slot
content:
application/json:
schema:
$ref:"#/components/schemas/SlotAgent"
"400":
description:Invalid or missing SlotId
"404":
description:Host is not in an active sale for the slot
"503":
description:Persistence is not enabled
"/sales/availability":
get:
summary:"Returns storage that is for sale"
tags:[Marketplace]
operationId:getAvailabilities
responses:
"200":
description:Retrieved storage availabilities of the node
content:
application/json:
schema:
type:array
items:
$ref:"#/components/schemas/SalesAvailabilityREAD"
"500":
description:Error getting unused availabilities
"503":
description:Persistence is not enabled
post:
summary:"Offers storage for sale"
operationId:offerStorage
tags:[Marketplace]
requestBody:
content:
application/json:
schema:
$ref:"#/components/schemas/SalesAvailability"
responses:
"201":
description:Created storage availability
content:
application/json:
schema:
$ref:"#/components/schemas/SalesAvailabilityREAD"
"400":
description:Invalid data input
"422":
description:Not enough node's storage quota available or the provided parameters did not pass validation
"500":
description:Error reserving availability
"503":
description:Persistence is not enabled
"/sales/availability/{id}":
patch:
summary:"Updates availability"
description:|
The new parameters will be only considered for new requests.
Existing Requests linked to this Availability will continue as is.
operationId:updateOfferedStorage
tags:[Marketplace]
parameters:
- in:path
name:id
required:true
schema:
type:string
description:ID of Availability
requestBody:
content:
application/json:
schema:
$ref:"#/components/schemas/SalesAvailability"
responses:
"204":
description:Availability successfully updated
"400":
description:Invalid data input
"404":
description:Availability not found
"422":
description:The provided parameters did not pass validation
"500":
description:Error reserving availability
"503":
description:Persistence is not enabled
"/sales/availability/{id}/reservations":
get:
summary:"Get availability's reservations"
description:Return's list of Reservations for ongoing Storage Requests that the node hosts.
operationId:getReservations
tags:[Marketplace]
parameters:
- in:path
name:id
required:true
schema:
type:string
description:ID of Availability
responses:
"200":
description:Retrieved storage availabilities of the node
content:
application/json:
schema:
type:array
items:
$ref:"#/components/schemas/Reservation"
"400":
description:Invalid Availability ID
"404":
description:Availability not found
"500":
description:Error getting reservations
"503":
description:Persistence is not enabled
"/storage/request/{cid}":
post:
summary:"Creates a new Request for storage"
tags:[Marketplace]
operationId:createStorageRequest
parameters:
- in:path
name:cid
required:true
schema:
$ref:"#/components/schemas/Cid"
description:CID of the uploaded data that should be stored