Quickstart
This guide walks through the first end-to-end CloudBank API flow:
- Set up prerequisites
- Authenticate with wallet signature
- Check service health and wallet info
- Place an orderbook trade
- Withdraw funds
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
curlandjqinstalled
1) Configure environment
bash
export API_ORIGIN="https://docs-test.cloudbank.to"
export API_BASE="$API_ORIGIN/api/v1"
# Your EOA wallet address (used for login)
export ADDRESS="0xYourWalletAddress"2) Authenticate (nonce -> sign -> JWT)
2.1 Request nonce challenge
bash
curl -sS -X POST "$API_BASE/auth/nonce" \
-H "Content-Type: application/json" \
-d "{\"address\":\"$ADDRESS\"}" | tee /tmp/cloudbank_nonce.jsonExpected fields:
noncemessageexpiresAt
2.2 Sign challenge message with wallet
Use personal_sign in your wallet with the exact message returned by /auth/nonce.
bash
MESSAGE=$(jq -r '.message' /tmp/cloudbank_nonce.json)
# Replace with signature produced by your wallet (0x...)
export SIGNATURE="0xYourPersonalSignSignature"2.3 Exchange signature for JWT
bash
curl -sS -X POST "$API_BASE/auth/login" \
-H "Content-Type: application/json" \
-d "{\"address\":\"$ADDRESS\",\"signature\":\"$SIGNATURE\",\"message\":$(jq -Rs . <<< "$MESSAGE")}" \
| tee /tmp/cloudbank_login.json
export JWT=$(jq -r '.token' /tmp/cloudbank_login.json)3) First API calls: health + wallet info
3.1 Health check
Backend health route is /health.
bash
curl -sS "$API_ORIGIN/health" | jq3.2 Get custodial wallet info
bash
curl -sS "$API_BASE/wallet/info" \
-H "Authorization: Bearer $JWT" | jqExpected fields:
userAddresscustodialWalletAddresscreatedAt
4) Place a trade via orderbook
4.1 Read orderbook depth
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" | jq4.2 Submit signed order
POST /api/v1/orderbook/orders requires an EIP-712 signed order payload.
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"
}' | jqExpected fields include:
orderHashstatuspricemakerAmount/takerAmount
5) Withdraw funds
Withdraw supports asset values like USDC or BNB.
bash
curl -sS -X POST "$API_BASE/wallet/withdraw" \
-H "Authorization: Bearer $JWT" \
-H "Content-Type: application/json" \
-d '{
"asset": "USDC",
"toAddress": "0xYourDestinationAddress",
"amount": "10.5"
}' | jqExpected fields:
txHashassetamountfeegasModestatuscreatedAt
Next
- Full endpoint examples: /guide/api-examples
- Full API reference: /tech/architecture/api-reference