Bitkub API Documentation

    Build powerful trading applications with our comprehensive REST API

    Secure
    HMAC-SHA256 authentication
    Real-time
    Live market data & WebSocket
    Fast
    Low latency trading

    Quick Start Guide

    1. Get Your API Credentials

    1
    Log in to your Bitkub account
    2
    Navigate to API Management
    3
    Create API key with trading permissions

    2. Base URL & Environment

    https://api.bitkub.com

    Your First API Request

    Public Endpoint (No Auth Required)

    Start by fetching server time - no authentication needed:

    curl -X GET "https://api.bitkub.com/api/servertime" \
      -H "Accept: application/json"

    Expected Response:

    {
      "error": 0,
      "result": 1640995200
    }

    Market Data Example

    Get ticker information for all trading pairs:

    curl -X GET "https://api.bitkub.com/api/market/ticker" \
      -H "Accept: application/json"

    Response includes:

    • • Last price
    • • 24h volume
    • • High/low prices
    • • Price change %

    Private Endpoints (Authentication Required)

    Get Account Balance

    const crypto = require('crypto');
    
    // Configuration
    const apiKey = 'your-api-key';
    const apiSecret = 'your-api-secret';
    const timestamp = Date.now().toString();
    const method = 'POST';
    const requestPath = '/api/market/wallet';
    const body = '';
    
    // Generate signature
    const payload = timestamp + method + requestPath + body;
    const signature = crypto
      .createHmac('sha256', apiSecret)
      .update(payload, 'utf8')
      .digest('hex');
    
    // Make request
    fetch('https://api.bitkub.com/api/market/wallet', {
      method: 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
        'X-BTK-APIKEY': apiKey,
        'X-BTK-TIMESTAMP': timestamp,
        'X-BTK-SIGN': signature
      },
      body: body
    })
    .then(response => response.json())
    .then(data => console.log(data));

    Place a Buy Order

    const orderData = {
      sym: 'THB_BTC',     // Trading pair
      amt: 1000,          // Amount in THB
      rat: 2000000,       // Rate (price per BTC)
      typ: 'limit'        // Order type
    };
    
    const body = JSON.stringify(orderData);
    const timestamp = Date.now().toString();
    const method = 'POST';
    const requestPath = '/api/market/place-bid';
    
    // Generate signature with body
    const payload = timestamp + method + requestPath + body;
    const signature = crypto
      .createHmac('sha256', apiSecret)
      .update(payload, 'utf8')
      .digest('hex');
    
    fetch('https://api.bitkub.com/api/market/place-bid', {
      method: 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
        'X-BTK-APIKEY': apiKey,
        'X-BTK-TIMESTAMP': timestamp,
        'X-BTK-SIGN': signature
      },
      body: body
    });

    Next Steps

    Learn Authentication

    Master API key management and request signing

    Understand Rate Limits

    Optimize your requests to stay within limits

    Handle Errors

    Implement proper error handling and recovery