CIDgravity Gateway Endpoints

The File Information API provides essential details about files onboarded to the Filecoin network via the CIDgravity Gateway. This API is intended exclusively for clients using the CIDgravity Gateway to store files on Filecoin.

Note: These API endpoints require access to the CIDgravity Gateway for communication. Without this access, the API cannot be used.

Endpoints description

POST /file-info (Get element metadata)

This endpoint allows you to retrieve the current status and details of files or folders that have been uploaded to the CIDgravity Gateway for onboarding to Filecoin. This API supports both individual files and folders, providing relevant information about their storage state and retrievability.

File vs. Folder Handling

  • Files: When querying a file, the returned state and details apply only to that specific file.

  • Folders: When querying a folder, the API returns a state representing the folder as a whole, which is an aggregated view of the states of all its sub-elements (i.e., files and subfolders within it).

This distinction is important because a folder can contain multiple files, each with its own storage state and deal status. The folder’s overall state is a combined representation of the status of its contents, providing a single, comprehensive view of the entire folder’s state on Filecoin.

Parameters

NameTypeDescription
filePathrequired stringThe path to the file or folder to be queried.
verboseoptional booleanSpecifies the level of detail in the response. Defaults to false.
- False: Returns basic information such as the CID of the element.
- True: Returns detailed information including the file’s state, retrievable copies, and deal data.

Responses

FieldTypeDescription
successbooleanIndicates whether the request was successful (true or false).
errorstringError message provided if success is false.
resultobjectContains details of the file or folder if success is true.
result.fileobjectContains the file’s basic or detailed information.
result.file.cidstringThe file’s unique CID (Content Identifier) for retrieval on IPFS.
result.file.detailsobject(Optional) Additional file details, returned if verbose: true.
result.file.details.statestringCurrent state of the file (See File States below).
result.file.details.retrievableCopiesintMinimum number of retrievable copies across all groups.
result.file.details.groups[]arrayInformation about the groups associated with the file or folder.
result.file.details.groups[].statestringThe state of the group (See Group States below).
result.file.details.groups[].pieceCidstringBlock Piece CID if available.
result.file.details.groups[].retrievableCopiesintNumber of retrievable copies available within the group.
result.file.details.groups[].deals[]array(Optional) List of active deals, returned only if the group is in a sufficient state to have deals.
result.file.details.groups[].deals[].providerstringThe provider offering the deal.
result.file.details.groups[].deals[].statestringThe state of the deal (See Deal States below).
result.file.details.groups[].deals[].dealIdintThe unique ID of the deal.
result.file.details.groups[].deals[].endEpochintThe epoch at which the deal ends.
result.file.details.groups[].deals[].isRetrievablebooleanIndicates whether the file is retrievable through this deal.

States

File States

StateDescription
stagingAt least one group is not yet fully ready (either writable, full, or VRCARDone).
offloadingAll groups are ready, and the file is being offloaded to Filecoin.
partially_offloadedAll groups have at least one active deal.
offloadedAll groups are offloaded, and the file is fully stored.

Group States

StateDescription
writableThe group is writable and accepting data.
fullThe group is full and ready for further processing.
VRCARDoneThe CAR file for the group is generated.
ready_for_dealsThe group is ready to engage in storage deals on Filecoin.
offloadedThe group has been offloaded to Filecoin and removed from the CIDgravity Gateway.
reloadThe group is in the process of being reloaded onto the system.

Deal States

StateDescription
proposedThe deal has been proposed, awaiting further steps.
publishedThe deal has been published and is visible on the Filecoin network.
activeThe deal is active and the file is being stored as per the terms of the deal.

Example

Request (cURL)

$ curl -s -X POST http://localhost:9011/file-info -d '{"filePath": "/myfile"}' | jq .

Response (Success):

{
  "success": true,
  "result": {
    "file": {
      "cid": "QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn"
    }
  }
}

Response (Error):

{
  "success": false,
  "error": "File not found"
}