ThatBen 4edfe2abb6
Testnet update (#90)
* Updates learn and network docs

* Removes codex networks, removes "join the testnet" on main page

* updates es and ko run files to match english one

* Removes networks panel from main page
2025-09-19 20:57:13 +10:00

4.4 KiB

outline
2
3

Using Codex

We can interact with Codex using REST API. This document will show you several useful examples.

Also, we can check Codex App UI.

Command line interpreter on Linux/macOS and Windows works slightly different, so please use steps for your OS.

Linux/macOS

Overview

  1. Debug
  2. Upload a file
  3. Download a file
  4. Local data

Debug

An easy way to check that your node is up and running is:

curl http://localhost:8080/api/codex/v1/debug/info \
  -w '\n'

This will return a JSON structure with plenty of information about your local node. It contains peer information that may be useful when troubleshooting connection issues.

Upload a file

Warning

Once you upload a file to Codex, other nodes in the network can download it. Please do not upload anything you don't want others to access, or, properly encrypt your data first.

curl -X POST \
  http://localhost:8080/api/codex/v1/data \
  -H 'Content-Type: application/octet-stream' \
  -w '\n' \
  -T <FILE>

On successful upload, you'll receive a CID. This can be used to download the file from any node in the network.

Tip

Are you on the Codex Discord server? Post your CID in the # 🛜 | share-cids channel, see if others are able to download it. Codex does not (yet?) provide file metadata, so if you want others to be able to open your file, tell them which extension to give it.

Download a file

When you have a CID of data you want to download, you can use the following commands:

# paste your CID from the previous step here between the quotes
CID="..."
curl "http://localhost:8080/api/codex/v1/data/${CID}/network/stream" \
  -o "${CID}.png"

Please use the correct extension for the downloaded file, because Codex does not store yet content-type or extension information.

Local data

You can view which datasets are currently being stored by your node:

curl http://localhost:8080/api/codex/v1/data \
  -w '\n'

Windows

Overview

  1. Debug
  2. Upload a file
  3. Download a file
  4. Local data

Debug

An easy way to check that your node is up and running is:

curl http://localhost:8080/api/codex/v1/debug/info

This will return a JSON structure with plenty of information about your local node. It contains peer information that may be useful when troubleshooting connection issues.

Upload a file

Warning

Once you upload a file to Codex, other nodes in the network can download it. Please do not upload anything you don't want others to access, or, properly encrypt your data first.

curl -X POST ^
  http://localhost:8080/api/codex/v1/data ^
  -H "Content-Type: application/octet-stream" ^
  -T <FILE>

On successful upload, you'll receive a CID. This can be used to download the file from any node in the network.

Tip

Are you on the Codex Discord server? Post your CID in the # 🛜 | share-cids channel, see if others are able to download it. Codex does not (yet?) provide file metadata, so if you want others to be able to open your file, tell them which extension to give it.

Download a file

When you have a CID of data you want to download, you can use the following commands:

:: paste your CID from the previous step here between the quotes
set CID="..."
curl "http://localhost:8080/api/codex/v1/data/%CID%/network/stream" ^
  -o "%CID%.png"

Please use the correct extension for the downloaded file, because Codex does not store yet content-type or extension information.

Local data

You can view which datasets are currently being stored by your node:

curl http://localhost:8080/api/codex/v1/data

Known issues

  1. We add a new line to the API calls to get more readable output, please check [rest] Add line ending on responses #771 for more details.