API 예제
이 페이지는 CloudBank 핵심 백엔드 엔드포인트에 대한 복사 가능한 curl 예제를 제공합니다.
기본 URL
bash
export API_ORIGIN="https://docs-test.cloudbank.to"
export API_BASE="$API_ORIGIN/api/v1"POST /api/v1/auth/nonce
지갑 서명 로그인용 nonce challenge를 요청합니다.
요청
bash
curl -sS -X POST "$API_BASE/auth/nonce" \
-H "Content-Type: application/json" \
-d '{
"address": "0xYourWalletAddress"
}'예상 응답 형식
json
{
"nonce": "c7f7a4e0...",
"message": "CloudBank Authentication\n\nAddress: 0x...\nNonce: ...",
"expiresAt": "2026-03-05T00:00:00Z"
}POST /api/v1/auth/login
서명 + challenge message를 JWT로 교환합니다.
요청
bash
curl -sS -X POST "$API_BASE/auth/login" \
-H "Content-Type: application/json" \
-d '{
"address": "0xYourWalletAddress",
"signature": "0xYourPersonalSignSignature",
"message": "CloudBank Authentication\\n\\nAddress: 0x...\\nNonce: ..."
}'예상 응답 형식
json
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"custodialWalletAddress": "0xYourCustodialWallet",
"expiresAt": "2026-03-06T00:00:00Z"
}GET /api/v1/wallet/info
인증된 사용자 지갑 프로필을 조회합니다.
요청
bash
curl -sS "$API_BASE/wallet/info" \
-H "Authorization: Bearer $JWT"예상 응답 형식
json
{
"userAddress": "0xYourWalletAddress",
"custodialWalletAddress": "0xYourCustodialWallet",
"createdAt": "2026-03-05T00:00:00Z"
}POST /api/v1/wallet/sign
화이트리스트 컨트랙트 대상 트랜잭션을 커스터디얼 지갑으로 서명/브로드캐스트합니다.
요청
bash
curl -sS -X POST "$API_BASE/wallet/sign" \
-H "Authorization: Bearer $JWT" \
-H "Content-Type: application/json" \
-d '{
"to": "0xContractAddress",
"data": "0xabcdef12...",
"value": "0",
"product": "predict"
}'예상 응답 형식
json
{
"txHash": "0xSignedTxHash",
"gasMode": "user",
"status": "pending",
"createdAt": "2026-03-05T00:00:00Z"
}GET /api/v1/orderbook/book
오더북 깊이 데이터를 조회합니다.
요청
bash
curl -sS "$API_BASE/orderbook/book?marketId=0xYourMarketId&outcomeTokenId=12345&depth=20"예상 응답 형식
json
{
"marketId": "0xYourMarketId",
"outcomeTokenId": "12345",
"bids": [
{
"price": "0.55000000",
"makerAmount": "100",
"takerAmount": "55",
"orderCount": 1
}
],
"asks": [],
"updatedAt": "2026-03-05T00:00:00Z"
}POST /api/v1/orderbook/orders
서명된 주문을 제출합니다.
요청
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"
}'예상 응답 형식
json
{
"orderHash": "0xOrderHash",
"marketId": "0xYourMarketId",
"outcomeTokenId": "12345",
"maker": "0xYourWalletAddress",
"signer": "0xYourWalletAddress",
"side": "buy",
"timeInForce": "GTC",
"price": "0.55000000",
"makerAmount": "1000000",
"takerAmount": "550000",
"expiration": "1767225600",
"nonce": "1",
"status": "live",
"createdAt": "2026-03-05T00:00:00Z",
"updatedAt": "2026-03-05T00:00:00Z"
}GET /api/v1/health
/api/v1/health는 게이트웨이 라우팅으로 노출될 수 있으며, 백엔드 원본 경로는 /health입니다.
요청
bash
curl -sS "$API_ORIGIN/health"예상 응답 형식
json
{
"status": "healthy",
"version": "v1.0.0",
"uptimeSeconds": 12345,
"database": { "ok": true, "latencyMs": 2 },
"redis": { "ok": true, "latencyMs": 1 },
"bsc": { "ok": true, "latencyMs": 45 }
}