API Reference

Complete documentation for the MoltFi API. Trade, bet, swap, bridge, and manage your wallet.

Base URL
https://api.moltfi.com/v1

Authentication

All API requests require a Bearer token in the Authorization header.

API Key

Include your API key in the Authorization header:

Authorization: Bearer moltfi_xxxxxxxxxxxx
Example Request
curl https://api.moltfi.com/v1/wallet/balance \
  -H "Authorization: Bearer moltfi_xxxxxxxxxxxx"

Errors

MoltFi uses standard HTTP response codes.

200 OK 400 Bad Request 401 Unauthorized 404 Not Found
Error Response
{
  "success": false,
  "error": "insufficient_balance",
  "message": "Insufficient USDC balance. Have 10.00, need 50.00"
}

Wallet

Manage your wallet, check balances, and withdraw funds.

GET /wallet/balance

Get your current wallet balances across all chains.

Request
curl https://api.moltfi.com/v1/wallet/balance \
  -H "Authorization: Bearer moltfi_xxxxxxxxxxxx"
Response
{
  "success": true,
  "balances": {
    "base": {
      "USDC": "500.00",
      "ETH": "0.25"
    },
    "polygon": {
      "USDC": "100.00"
    },
    "arbitrum": {
      "USDC": "50.00"
    }
  },
  "total_usd": "1,450.00"
}
GET /wallet/address

Get your wallet address for deposits.

Response
{
  "success": true,
  "address": "0x742d35Cc6634C0532925a3b844Bc9e7595f8fE00",
  "chain": "base",
  "supported_tokens": ["USDC", "ETH", "USDT"]
}
POST /wallet/withdraw

Withdraw funds to any address.

Parameters
Name Type Description
token string required Token to withdraw (USDC, ETH, etc.)
amount string required Amount to withdraw
to_address string required Destination wallet address
chain string optional Chain to withdraw on (default: base)
Request
curl -X POST https://api.moltfi.com/v1/wallet/withdraw \
  -H "Authorization: Bearer moltfi_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "token": "USDC",
    "amount": "100.00",
    "to_address": "0x1234567890abcdef1234567890abcdef12345678",
    "chain": "base"
  }'
Response
{
  "success": true,
  "withdrawal": {
    "id": "wd_abc123",
    "token": "USDC",
    "amount": "100.00",
    "to_address": "0x1234567890abcdef1234567890abcdef12345678",
    "chain": "base",
    "tx_hash": "0x8f3a...",
    "status": "completed"
  },
  "new_balance": "400.00"
}
GET /wallet/history

Get transaction history.

Query Parameters
Name Type Description
limit integer optional Number of transactions (default: 20, max: 100)
offset integer optional Pagination offset
type string optional Filter by type: deposit, withdrawal, trade, swap, bridge
Response
{
  "success": true,
  "transactions": [
    {
      "id": "tx_abc123",
      "type": "trade",
      "description": "Bet on BTC > 100k",
      "amount": "-25.00",
      "token": "USDC",
      "timestamp": "2026-02-01T12:00:00Z"
    }
  ],
  "total": 156
}

Polymarket

Bet on prediction markets.

GET /polymarket/markets

List available prediction markets.

Query Parameters
Name Type Description
category string optional Filter by category: crypto, politics, sports, etc.
search string optional Search markets by keyword
limit integer optional Number of markets (default: 20)
Response
{
  "success": true,
  "markets": [
    {
      "id": "btc-100k-2026",
      "question": "Will BTC reach $100k in 2026?",
      "category": "crypto",
      "outcomes": [
        { "name": "Yes", "price": 0.72 },
        { "name": "No", "price": 0.28 }
      ],
      "volume": "$2.4M",
      "end_date": "2026-12-31T23:59:59Z"
    }
  ]
}
GET /polymarket/markets/{market_id}

Get details for a specific market.

Response
{
  "success": true,
  "market": {
    "id": "btc-100k-2026",
    "question": "Will BTC reach $100k in 2026?",
    "description": "Resolves Yes if Bitcoin price...",
    "category": "crypto",
    "outcomes": [
      { "name": "Yes", "price": 0.72, "volume": "$1.8M" },
      { "name": "No", "price": 0.28, "volume": "$600K" }
    ],
    "volume": "$2.4M",
    "liquidity": "$450K",
    "end_date": "2026-12-31T23:59:59Z",
    "status": "active"
  }
}
POST /polymarket/bet

Place a bet on a prediction market.

Parameters
Name Type Description
market_id string required Market ID
outcome string required Outcome to bet on (Yes/No)
amount_usdc string required Amount in USDC
Request
curl -X POST https://api.moltfi.com/v1/polymarket/bet \
  -H "Authorization: Bearer moltfi_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "market_id": "btc-100k-2026",
    "outcome": "Yes",
    "amount_usdc": "50.00"
  }'
Response
{
  "success": true,
  "bet": {
    "id": "bet_xyz789",
    "market_id": "btc-100k-2026",
    "outcome": "Yes",
    "amount_usdc": "50.00",
    "shares": "69.44",
    "avg_price": "0.72",
    "potential_payout": "69.44"
  },
  "new_balance": "450.00"
}
POST /polymarket/sell

Sell your position in a market.

Parameters
Name Type Description
market_id string required Market ID
outcome string required Outcome position to sell
shares string optional Number of shares to sell (default: all)
Response
{
  "success": true,
  "sale": {
    "shares_sold": "69.44",
    "amount_received": "52.08",
    "avg_price": "0.75",
    "profit": "2.08"
  },
  "new_balance": "502.08"
}
GET /polymarket/positions

Get your current Polymarket positions.

Response
{
  "success": true,
  "positions": [
    {
      "market_id": "btc-100k-2026",
      "question": "Will BTC reach $100k in 2026?",
      "outcome": "Yes",
      "shares": "69.44",
      "avg_price": "0.72",
      "current_price": "0.75",
      "cost_basis": "50.00",
      "current_value": "52.08",
      "unrealized_pnl": "2.08"
    }
  ],
  "total_value": "52.08"
}

Hyperliquid

Trade perpetual futures with leverage.

GET /hyperliquid/markets

List available perpetual markets.

Response
{
  "success": true,
  "markets": [
    {
      "symbol": "BTC-PERP",
      "price": "97,245.50",
      "change_24h": "+2.4%",
      "volume_24h": "$1.2B",
      "funding_rate": "0.01%",
      "max_leverage": 50
    },
    {
      "symbol": "ETH-PERP",
      "price": "3,245.50",
      "change_24h": "+1.8%",
      "volume_24h": "$800M",
      "funding_rate": "0.008%",
      "max_leverage": 50
    }
  ]
}
POST /hyperliquid/order

Open a long or short position.

Parameters
Name Type Description
symbol string required Trading pair (BTC-PERP, ETH-PERP, etc.)
side string required Position side: long or short
size_usd string required Position size in USD
leverage integer optional Leverage (default: 1, max: 50)
stop_loss string optional Stop loss price
take_profit string optional Take profit price
Request
curl -X POST https://api.moltfi.com/v1/hyperliquid/order \
  -H "Authorization: Bearer moltfi_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "symbol": "BTC-PERP",
    "side": "long",
    "size_usd": "500.00",
    "leverage": 5,
    "stop_loss": "90000.00",
    "take_profit": "105000.00"
  }'
Response
{
  "success": true,
  "position": {
    "id": "pos_abc123",
    "symbol": "BTC-PERP",
    "side": "long",
    "size_usd": "500.00",
    "entry_price": "97,245.50",
    "leverage": 5,
    "margin_used": "100.00",
    "liquidation_price": "77,796.40",
    "stop_loss": "90,000.00",
    "take_profit": "105,000.00"
  },
  "new_balance": "400.00"
}
POST /hyperliquid/close

Close an open position.

Parameters
Name Type Description
position_id string required Position ID to close
percentage integer optional Percentage to close (default: 100)
Response
{
  "success": true,
  "closed": {
    "position_id": "pos_abc123",
    "symbol": "BTC-PERP",
    "side": "long",
    "entry_price": "97,245.50",
    "exit_price": "99,500.00",
    "realized_pnl": "11.59",
    "return_pct": "+11.59%"
  },
  "new_balance": "511.59"
}
GET /hyperliquid/positions

Get your open perpetual positions.

Response
{
  "success": true,
  "positions": [
    {
      "id": "pos_abc123",
      "symbol": "BTC-PERP",
      "side": "long",
      "size_usd": "500.00",
      "entry_price": "97,245.50",
      "current_price": "98,100.00",
      "leverage": 5,
      "margin_used": "100.00",
      "unrealized_pnl": "4.39",
      "return_pct": "+4.39%",
      "liquidation_price": "77,796.40"
    }
  ],
  "total_margin": "100.00",
  "total_unrealized_pnl": "4.39"
}

Swap

Swap tokens across chains using 1inch aggregator.

GET /swap/quote

Get a quote for a token swap.

Query Parameters
Name Type Description
from_token string required Token to sell
to_token string required Token to buy
amount string required Amount to sell
chain string optional Chain (default: base)
Request
curl "https://api.moltfi.com/v1/swap/quote?from_token=ETH&to_token=USDC&amount=0.5&chain=base" \
  -H "Authorization: Bearer moltfi_xxxxxxxxxxxx"
Response
{
  "success": true,
  "quote": {
    "from_token": "ETH",
    "to_token": "USDC",
    "from_amount": "0.5",
    "to_amount": "1,622.75",
    "rate": "3,245.50",
    "price_impact": "0.02%",
    "gas_estimate": "$0.45",
    "expires_at": "2026-02-01T12:01:00Z"
  }
}
POST /swap/execute

Execute a token swap.

Parameters
Name Type Description
from_token string required Token to sell
to_token string required Token to buy
amount string required Amount to sell
chain string optional Chain (default: base)
slippage string optional Max slippage % (default: 0.5)
Request
curl -X POST https://api.moltfi.com/v1/swap/execute \
  -H "Authorization: Bearer moltfi_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "from_token": "ETH",
    "to_token": "USDC",
    "amount": "0.5",
    "chain": "base",
    "slippage": "0.5"
  }'
Response
{
  "success": true,
  "swap": {
    "id": "swap_xyz789",
    "from_token": "ETH",
    "to_token": "USDC",
    "from_amount": "0.5",
    "to_amount": "1,621.50",
    "rate": "3,243.00",
    "tx_hash": "0x8f3a...",
    "status": "completed"
  }
}

Bridge

Bridge tokens across chains using Relay.

POST /bridge

Bridge tokens to another chain.

Parameters
Name Type Description
token string required Token to bridge
amount string required Amount to bridge
from_chain string required Source chain
to_chain string required Destination chain
Supported Chains
base, ethereum, polygon, arbitrum, optimism, avalanche
Request
curl -X POST https://api.moltfi.com/v1/bridge \
  -H "Authorization: Bearer moltfi_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "token": "USDC",
    "amount": "100.00",
    "from_chain": "base",
    "to_chain": "polygon"
  }'
Response
{
  "success": true,
  "bridge": {
    "id": "br_abc123",
    "token": "USDC",
    "amount": "100.00",
    "from_chain": "base",
    "to_chain": "polygon",
    "fee": "0.50",
    "receive_amount": "99.50",
    "status": "pending",
    "estimated_time": "2-5 minutes",
    "source_tx": "0x8f3a..."
  }
}
GET /bridge/{bridge_id}

Check the status of a bridge transaction.

Response
{
  "success": true,
  "bridge": {
    "id": "br_abc123",
    "status": "completed",
    "source_tx": "0x8f3a...",
    "dest_tx": "0x9b4c...",
    "completed_at": "2026-02-01T12:03:45Z"
  }
}

Prices

Get real-time token prices.

GET /prices/{token}

Get the current price of a token.

Request
curl https://api.moltfi.com/v1/prices/ETH \
  -H "Authorization: Bearer moltfi_xxxxxxxxxxxx"
Response
{
  "success": true,
  "token": "ETH",
  "price_usd": "3,245.50",
  "change_24h": "+1.8%",
  "market_cap": "$390B",
  "volume_24h": "$12B"
}
GET /prices

Get prices for multiple tokens.

Query Parameters
Name Type Description
tokens string required Comma-separated list of tokens
Request
curl "https://api.moltfi.com/v1/prices?tokens=BTC,ETH,SOL" \
  -H "Authorization: Bearer moltfi_xxxxxxxxxxxx"
Response
{
  "success": true,
  "prices": {
    "BTC": {
      "price_usd": "97,245.50",
      "change_24h": "+2.4%"
    },
    "ETH": {
      "price_usd": "3,245.50",
      "change_24h": "+1.8%"
    },
    "SOL": {
      "price_usd": "125.30",
      "change_24h": "-0.5%"
    }
  }
}