Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/tiagosiebler/bitget-api/llms.txt

Use this file to discover all available pages before exploring further.

The RestClientV3 exposes earn, crypto loan, P2P marketplace, and broker management capabilities alongside the core trading API. Earn Elite lets you subscribe to on-chain yield products directly from your unified account. Crypto Loans allow you to borrow assets against collateral with flexible or fixed durations. The P2P module enables you to create and manage peer-to-peer trading advertisements. Broker endpoints are restricted to ND Broker master accounts only. All endpoints on this page require authentication.
import { RestClientV3 } from 'bitget-api';

const client = new RestClientV3({
  apiKey: process.env.BITGET_API_KEY!,
  apiSecret: process.env.BITGET_API_SECRET!,
  apiPass: process.env.BITGET_API_PASS!,
});

Earn (Elite On-Chain Products)

getEarnEliteProducts()

Returns the list of currently available Elite Earn products, including product IDs, yield rates, lock durations, and minimum subscription amounts. Endpoint: GET /api/v3/earn/elite-product
const products = await client.getEarnEliteProducts();
products.data.forEach((p) =>
  console.log(p.productId, p.annualRate, p.minSubscribeAmount),
);

subscribeEarnElite(params)

Subscribes to an Elite Earn product. Returns a subscription result with a tracking order ID. Endpoint: POST /api/v3/earn/elite-subscribe
productSubId
string
required
The specific sub-product ID to subscribe to (obtained from getEarnEliteProducts()).
amount
string
required
Subscription amount as a decimal string.
coin
string
Coin to subscribe with, if required by the product.
paymentAccount
string
Source account for the subscription funds: spot or unified.
const result = await client.subscribeEarnElite({
  productSubId: 'some-product-sub-id',
  amount: '100',
  coin: 'USDT',
  paymentAccount: 'unified',
});
console.log('Subscribe order ID:', result.data.orderId);

getEarnEliteSubscribeInfo(params)

Returns detailed information about a specific Earn product’s subscription settings, constraints, and current rates. Endpoint: GET /api/v3/earn/elite-subscribe-info
productId
string
required
The product ID to query.
const info = await client.getEarnEliteSubscribeInfo({
  productId: 'some-product-id',
});

redeemEarnElite(params)

Initiates redemption of an active Earn Elite subscription. Endpoint: POST /api/v3/earn/elite-redeem
productId
string
required
Product ID of the subscription to redeem.
productSubId
string
required
The sub-product subscription ID.
redeemType
string
required
Redemption speed: fast (immediate, may incur penalty) or standard (normal settlement period).
amount
string
required
Amount to redeem.
receiveAccount
string
required
Account to receive redeemed funds: spot or unified.
advancedSettle
string
Whether to use advanced settlement: yes or no.
coin
string
Coin for redemption, if required.
const redeem = await client.redeemEarnElite({
  productId: 'some-product-id',
  productSubId: 'some-product-sub-id',
  redeemType: 'standard',
  amount: '100',
  receiveAccount: 'unified',
});

getEarnEliteRecords(params)

Returns a paginated history of Earn Elite events: subscriptions, redemptions, and interest credits. Endpoint: GET /api/v3/earn/elite-records
type
string
required
Record type to query: subscribe, redeem, or interest.
startTime
string
Start of the query window (Unix ms).
endTime
string
End of the query window (Unix ms).
limit
string
Max records per page.
cursor
string
Pagination cursor.
const earnHistory = await client.getEarnEliteRecords({
  type: 'interest',
  startTime: '1700000000000',
  endTime: '1710000000000',
  limit: '50',
});

getEarnEliteRedeemInfo(params)

Returns information about the redemption terms for a given product — settlement periods, applicable fees, and estimated payout. Endpoint: GET /api/v3/earn/elite-redeem-info
productId
string
required
Product ID to query redemption terms for.
const redeemInfo = await client.getEarnEliteRedeemInfo({
  productId: 'some-product-id',
});

Crypto Loans

The crypto loan API (/api/v3/loan/*) allows you to borrow assets by pledging collateral at flexible, 7-day, or 30-day terms.

getLoanCoins(params)

Returns the list of supported borrowable coins and their available collateral pairs, LTV ratios, and interest rates. Endpoint: GET /api/v3/loan/coins
coin
string
Optional coin filter to retrieve information for a specific borrowable asset.
const loanCoins = await client.getLoanCoins();
console.log('Borrowable coins:', loanCoins.data);

loanBorrow(params)

Initiates a new crypto loan by specifying the borrow coin, pledge coin, duration, and either a pledge amount or loan amount. Endpoint: POST /api/v3/loan/borrow
loanCoin
string
required
Coin to borrow, e.g. USDT.
pledgeCoin
string
required
Collateral coin, e.g. BTC.
daily
string
required
Loan duration: SEVEN (7-day), THIRTY (30-day), or FLEXIBLE.
pledgeAmount
string
Amount of collateral to pledge. Provide either pledgeAmount or loanAmount.
loanAmount
string
Amount to borrow. Provide either pledgeAmount or loanAmount.
const borrow = await client.loanBorrow({
  loanCoin: 'USDT',
  pledgeCoin: 'BTC',
  daily: 'FLEXIBLE',
  loanAmount: '1000',
});
console.log('Loan order ID:', borrow.data.orderId);

getLoanBorrowOngoing(params)

Returns your currently active loan orders, optionally filtered by order ID or coin. Endpoint: GET /api/v3/loan/borrow-ongoing
orderId
string
Filter by specific loan order ID.
loanCoin
string
Filter by borrowed coin.
pledgeCoin
string
Filter by collateral coin.
const activeLoans = await client.getLoanBorrowOngoing({ loanCoin: 'USDT' });
activeLoans.data.forEach((loan) =>
  console.log(loan.orderId, loan.loanAmount, loan.currentLTV),
);

loanRepay(params)

Repays an active loan, either partially or in full, using the borrowed coin or collateral. Endpoint: POST /api/v3/loan/repay
orderId
string
required
Loan order ID to repay.
method
string
required
Repayment method: borrowed_coin or collateral.
repayAll
string
required
Whether to repay the full outstanding amount: yes or no.
amount
string
Partial repayment amount. Required when repayAll is no.
repayUnlock
string
Whether to unlock collateral after repayment: yes or no.
// Full repayment
await client.loanRepay({
  orderId: 'loan-order-id',
  method: 'borrowed_coin',
  repayAll: 'yes',
  repayUnlock: 'yes',
});

// Partial repayment
await client.loanRepay({
  orderId: 'loan-order-id',
  method: 'borrowed_coin',
  repayAll: 'no',
  amount: '500',
});

getLoanBorrowHistory(params)

Returns a paginated history of all completed loan orders within a time range. Endpoint: GET /api/v3/loan/borrow-history
startTime
string
required
Start of the query window (Unix ms).
endTime
string
required
End of the query window (Unix ms).
orderId
string
Filter by a specific order ID.
loanCoin
string
Filter by loan coin.
status
string
Filter by termination status: ROLLBACK, FORCE, or REPAY.
const loanHistory = await client.getLoanBorrowHistory({
  startTime: '1700000000000',
  endTime: '1710000000000',
  loanCoin: 'USDT',
});

P2P Trading

The P2P module allows you to browse, create, and manage peer-to-peer trading advertisements directly through the API.

getP2pAdList(params) / getP2pAdList

Browse public P2P advertisements. Filter by token, fiat currency, and trade side. Endpoint: GET /api/v3/p2p/ad-list
token
string
required
Crypto token to trade, e.g. USDT.
fiat
string
required
Fiat currency, e.g. USD, EUR.
side
string
required
Trade direction: buy or sell.
pageNum
string
required
Page number for pagination.
limit
string
required
Number of results per page.
const ads = await client.getP2pAdList({
  token: 'USDT',
  fiat: 'USD',
  side: 'buy',
  pageNum: '1',
  limit: '20',
});
ads.data.forEach((ad) => console.log(ad.price, ad.quantity));

createP2pAd(params)

Creates a new P2P advertisement to buy or sell crypto with your configured payment methods. Endpoint: POST /api/v3/p2p/ad-create
token
string
required
Crypto token for the ad, e.g. USDT.
fiat
string
required
Fiat currency for the ad, e.g. USD.
side
string
required
buy or sell.
priceType
string
required
fixed (set a fixed price) or floating (use market premium/discount).
price
string
Fixed price. Required when priceType is fixed.
premium
string
Premium/discount percentage. Required when priceType is floating.
minAmount
string
required
Minimum fiat amount per trade.
maxAmount
string
required
Maximum fiat amount per trade.
quantity
string
required
Total crypto quantity to list in the ad.
payMethodIds
array
required
Array of payment method references: [{ payMethodId: string, userPayMethodId?: string }].
payTimeLimit
string
required
Payment time limit in minutes.
const newAd = await client.createP2pAd({
  token: 'USDT',
  fiat: 'USD',
  side: 'sell',
  priceType: 'fixed',
  price: '1.001',
  minAmount: '10',
  maxAmount: '500',
  quantity: '1000',
  payMethodIds: [{ payMethodId: 'your-pay-method-id' }],
  payTimeLimit: '15',
  remark: 'Fast release, 24/7 online',
});
console.log('Ad ID:', newAd.data.advId);

Broker Management

Broker endpoints are exclusively for master accounts with an ND Broker user type. All broker methods have a rate limit of 20 req/sec/UID.

createBrokerSubAccount(params)

Creates a new sub-account under the broker master account. Endpoint: POST /api/v3/broker/create-sub
subaccountName
string
required
Username for the new broker sub-account.
label
string
required
A display label for the sub-account.
const brokerSub = await client.createBrokerSubAccount({
  subaccountName: 'client-001',
  label: 'Client Account 1',
});
console.log('Broker sub UID:', brokerSub.data.subUid);

getBrokerSubAccountList(params)

Returns a paginated list of all broker-managed sub-accounts, optionally filtered by status. Endpoint: GET /api/v3/broker/sub-list
limit
string
Max results per page.
cursor
string
Pagination cursor.
status
string
Filter by account status: normal or freeze.
const brokerSubs = await client.getBrokerSubAccountList({
  limit: '50',
  status: 'normal',
});
console.log('Broker subs:', brokerSubs.data.subList?.length);

Complete Earn & Loan Example

import { RestClientV3 } from 'bitget-api';

const client = new RestClientV3({
  apiKey: process.env.BITGET_API_KEY!,
  apiSecret: process.env.BITGET_API_SECRET!,
  apiPass: process.env.BITGET_API_PASS!,
});

async function earnAndLoanExample() {
  // --- Earn ---
  // List available products
  const products = await client.getEarnEliteProducts();
  const product = products.data[0];
  console.log('Available product:', product.productId);

  // Subscribe to earn product
  const subscription = await client.subscribeEarnElite({
    productSubId: product.productId,
    amount: '100',
    paymentAccount: 'unified',
  });
  console.log('Subscribed, order ID:', subscription.data.orderId);

  // --- Loans ---
  // Check available loan coins
  const loanCoins = await client.getLoanCoins({ coin: 'USDT' });
  console.log('Loan coins:', loanCoins.data);

  // Borrow USDT against BTC collateral
  const loan = await client.loanBorrow({
    loanCoin: 'USDT',
    pledgeCoin: 'BTC',
    daily: 'FLEXIBLE',
    loanAmount: '500',
  });
  console.log('Loan order ID:', loan.data.orderId);

  // Check active loans
  const activeLoans = await client.getLoanBorrowOngoing({
    orderId: loan.data.orderId,
  });
  console.log('Active loan LTV:', activeLoans.data[0]?.currentLTV);

  // Repay the loan
  await client.loanRepay({
    orderId: loan.data.orderId,
    method: 'borrowed_coin',
    repayAll: 'yes',
  });
  console.log('Loan repaid');
}

earnAndLoanExample().catch(console.error);

Build docs developers (and LLMs) love