Skip to content

Getting Started

This 5-minute tutorial is the one-stop entry for your first CloudBank trade flow:

  1. Configure environment
  2. Get nonce
  3. Sign challenge message
  4. Login
  5. Check wallet
  6. View market
  7. Place order

All API paths below use the custodial-wallet backend base path: /api/v1.

Prerequisites

  • EVM wallet (MetaMask or compatible)
  • BSC Testnet RPC configured in your wallet
  • Testnet BNB for gas and testnet USDC when needed
  • curl and jq installed

1) Configure environment

bash
export API_ORIGIN="https://docs-test.cloudbank.to"
export API_BASE="$API_ORIGIN/api/v1"
export ADDRESS="0xYourWalletAddress"

# Quick connectivity check
curl -sS "$API_ORIGIN/health" | jq

Expected response shape:

json
{
  "status": "healthy",
  "version": "v1.0.0",
  "uptimeSeconds": 12345
}

2) Get nonce

bash
curl -sS -X POST "$API_BASE/auth/nonce" \
  -H "Content-Type: application/json" \
  -d "{\"address\":\"$ADDRESS\"}" \
  | tee /tmp/cloudbank_nonce.json

Expected response shape:

json
{
  "nonce": "c7f7a4e0...",
  "message": "CloudBank Authentication\\n\\nAddress: 0x...\\nNonce: ...",
  "expiresAt": "2026-03-05T00:00:00Z"
}

3) Sign challenge message

Request a fresh challenge, then sign the returned message with your wallet using personal_sign.

bash
curl -sS -X POST "$API_BASE/auth/nonce" \
  -H "Content-Type: application/json" \
  -d "{\"address\":\"$ADDRESS\"}" \
  | tee /tmp/cloudbank_signing_nonce.json

export CHALLENGE_MESSAGE=$(jq -r '.message' /tmp/cloudbank_signing_nonce.json)
# Sign CHALLENGE_MESSAGE in wallet, then paste signature here:
export SIGNATURE="0xYourPersonalSignSignature"

Expected response shape from nonce call:

json
{
  "nonce": "c7f7a4e0...",
  "message": "CloudBank Authentication\\n\\nAddress: 0x...\\nNonce: ...",
  "expiresAt": "2026-03-05T00:00:00Z"
}

4) Login

bash
curl -sS -X POST "$API_BASE/auth/login" \
  -H "Content-Type: application/json" \
  -d "{\"address\":\"$ADDRESS\",\"signature\":\"$SIGNATURE\",\"message\":$(jq -Rs . <<< \"$CHALLENGE_MESSAGE\")}" \
  | tee /tmp/cloudbank_login.json

export JWT=$(jq -r '.token' /tmp/cloudbank_login.json)

Expected response shape:

json
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "custodialWalletAddress": "0xYourCustodialWallet",
  "expiresAt": "2026-03-06T00:00:00Z"
}

5) Check wallet

bash
curl -sS "$API_BASE/wallet/info" \
  -H "Authorization: Bearer $JWT" | jq

Expected response shape:

json
{
  "userAddress": "0xYourWalletAddress",
  "custodialWalletAddress": "0xYourCustodialWallet",
  "createdAt": "2026-03-05T00:00:00Z"
}

6) View market

bash
export MARKET_ID="0xYourMarketId"
export OUTCOME_TOKEN_ID="12345"

curl -sS "$API_BASE/orderbook/book?marketId=$MARKET_ID&outcomeTokenId=$OUTCOME_TOKEN_ID&depth=20" | jq

Expected response shape:

json
{
  "marketId": "0xYourMarketId",
  "outcomeTokenId": "12345",
  "bids": [],
  "asks": [],
  "updatedAt": "2026-03-05T00:00:00Z"
}

7) Place order

bash
curl -sS -X POST "$API_BASE/orderbook/orders" \
  -H "Authorization: Bearer $JWT" \
  -H "Content-Type: application/json" \
  -d '{
    "marketId": "0xYourMarketId",
    "timeInForce": "GTC",
    "domain": {
      "name": "Polymarket CTF Exchange",
      "version": "1",
      "chainId": 97,
      "verifyingContract": "0xExchangeContract"
    },
    "order": {
      "salt": "1700000000000000000",
      "maker": "0xYourWalletAddress",
      "signer": "0xYourWalletAddress",
      "taker": "0x0000000000000000000000000000000000000000",
      "tokenId": "12345",
      "makerAmount": "1000000",
      "takerAmount": "550000",
      "expiration": "1767225600",
      "nonce": "1",
      "feeRateBps": "0",
      "side": "buy",
      "signatureType": "0"
    },
    "signature": "0xYourEip712OrderSignature"
  }' | jq

Expected response shape:

json
{
  "orderHash": "0xOrderHash",
  "status": "live",
  "price": "0.55000000",
  "makerAmount": "1000000",
  "takerAmount": "550000",
  "createdAt": "2026-03-05T00:00:00Z"
}

Next