API Documentation

Integrate with Codono exchange platform using our comprehensive REST API and WebSocket feeds. Built for developers, traders, and market data aggregators.

Overview

The Codono API provides programmatic access to exchange functionality including market data, order placement, account management, and more. The API consists of:

  • REST API: HTTP endpoints for trading, account management, and historical data
  • WebSocket API: Real-time streaming of market data, order updates, and trade execution
  • Rate Limits: 100 requests/minute for public endpoints, 60 requests/minute for authenticated endpoints
  • Base URLs: Production: https://api.yourdomain.com, Sandbox: https://sandbox-api.yourdomain.com

Authentication

API Key Generation

Generate API keys from your account settings. Each key consists of:

  • API Key: Public identifier (included in request headers)
  • Secret Key: Used to sign requests (never transmitted)

HMAC Signature Authentication

All authenticated requests must include HMAC-SHA256 signatures:

// JavaScript Example
const crypto = require('crypto');

const timestamp = Date.now();
const method = 'POST';
const path = '/api/v1/orders';
const body = JSON.stringify({  symbol: 'BTC/USDT',
  side: 'buy',
  type: 'limit',
  price: '45000',
  quantity: '0.1'
});

// Create signature string
const signatureString = timestamp + method + path + body;

// Generate HMAC signature
const signature = crypto
  .createHmac('sha256', SECRET_KEY)
  .update(signatureString)
  .digest('hex');

// Request headers
const headers = {
  'X-API-KEY': API_KEY,
  'X-TIMESTAMP': timestamp,
  'X-SIGNATURE': signature,
  'Content-Type': 'application/json'
};

Market Data Endpoints

GET /api/v1/markets

List all available trading pairs and their metadata.

Response Example:

{  "success": true,
  "data": {    "markets": [
      {        "symbol": "BTC/USDT",
        "base": "BTC",
        "quote": "USDT",
        "status": "trading",
        "price": "45000.00",
        "volume_24h": "1250000.00",
        "high_24h": "46000.00",
        "low_24h": "44000.00",
        "change_24h": "2.5",
        "price_precision": 2,
        "quantity_precision": 8
      }},
      {        "symbol": "ETH/USDT",
        "base": "ETH",
        "quote": "USDT",
        "status": "trading",
        "price": "2400.00",
        "volume_24h": "850000.00",
        "high_24h": "2450.00",
        "low_24h": "2380.00",
        "change_24h": "1.2",
        "price_precision": 2,
        "quantity_precision": 6
      }    ]
  }}
GET /api/v1/ticker/:symbol

Get 24-hour ticker data for a specific trading pair.

Parameters:

  • symbol (path): Trading pair symbol (e.g., BTC/USDT, ETH/USDT)

Response Example:

{  "success": true,
  "data": {    "symbol": "BTC/USDT",
    "timestamp": 1705320000000,
    "last": "45000.00",
    "bid": "44995.00",
    "ask": "45005.00",
    "high_24h": "46000.00",
    "low_24h": "44000.00",
    "volume_24h": "125.50",
    "quote_volume_24h": "5647500.00",
    "change_24h": "2.5",
    "change_percentage_24h": "0.056"
  }}
GET /api/v1/orderbook/:symbol

Get current order book depth for a trading pair.

Parameters:

  • symbol (path): Trading pair symbol
  • limit (query, optional): Number of price levels (default: 20, max: 100)

Response Example:

{  "success": true,
  "data": {    "symbol": "BTC/USDT",
    "timestamp": 1705320000000,
    "bids": [
      ["44995.00", "2.5"],
      ["44990.00", "1.8"],
      ["44985.00", "3.2"]
    ],
    "asks": [
      ["45005.00", "3.2"],
      ["45010.00", "2.1"],
      ["45015.00", "1.5"]
    ]
  }}
GET /api/v1/trades/:symbol

Get recent trades for a trading pair.

Parameters:

  • symbol (path): Trading pair symbol
  • limit (query, optional): Number of trades (default: 50, max: 500)

Response Example:

{  "success": true,
  "data": {    "trades": [
      {        "id": "1234567890",
        "price": "45000.00",
        "quantity": "0.5",
        "timestamp": 1705320000000,
        "side": "buy"
      }},
      {        "id": "1234567889",
        "price": "44998.00",
        "quantity": "0.3",
        "timestamp": 1705319998000,
        "side": "sell"
      }    ]
  }}

CoinMarketCap Integration

These endpoints are specifically designed for CoinMarketCap exchange data integration. Use them to submit your exchange data for listing on CoinMarketCap.

GET /api/v1/cmc/summary

Returns trading summary for all markets. This endpoint follows CoinMarketCap's exchange API specification.

Response Example:

{  "trading_pairs": "BTC_USDT,ETH_USDT,SOL_USDT",
  "data": {    "BTC_USDT": {      "base_id": "1",
      "base_name": "Bitcoin",
      "base_symbol": "BTC",
      "quote_id": "825",
      "quote_name": "Tether",
      "quote_symbol": "USDT",
      "last_price": "45000.00",
      "base_volume": "125.50",
      "quote_volume": "5647500.00",
      "price_change_percent_24h": "2.5",
      "highest_price_24h": "46000.00",
      "lowest_price_24h": "44000.00"
    }},
    "ETH_USDT": {      "base_id": "1027",
      "base_name": "Ethereum",
      "base_symbol": "ETH",
      "quote_id": "825",
      "quote_name": "Tether",
      "quote_symbol": "USDT",
      "last_price": "2400.00",
      "base_volume": "350.25",
      "quote_volume": "840600.00",
      "price_change_percent_24h": "1.2",
      "highest_price_24h": "2450.00",
      "lowest_price_24h": "2380.00"
    }  }}
GET /api/v1/cmc/ticker

Returns ticker information for all trading pairs in CoinMarketCap format.

Response Example:

{  "BTC_USDT": {    "base_id": "1",
    "quote_id": "825",
    "last_price": "45000.00",
    "base_volume": "125.50",
    "quote_volume": "5647500.00",
    "isFrozen": "0"
  }},
  "ETH_USDT": {    "base_id": "1027",
    "quote_id": "825",
    "last_price": "2400.00",
    "base_volume": "350.25",
    "quote_volume": "840600.00",
    "isFrozen": "0"
  }}
GET /api/v1/cmc/orderbook/:market_pair

Returns order book depth for CoinMarketCap verification.

Parameters:

  • market_pair (path): Trading pair in format BASE_QUOTE (e.g., BTC_USDT)
  • depth (query, optional): Order book depth (default: 50, max: 500)

Response Example:

{  "timestamp": 1705320000000,
  "bids": [
    ["44995.00", "2.5"],
    ["44990.00", "1.8"]
  ],
  "asks": [
    ["45005.00", "3.2"],
    ["45010.00", "2.1"]
  ]
}}

CoinGecko Integration

These endpoints follow CoinGecko's exchange API specification for listing your exchange on CoinGecko's platform.

GET /api/v1/coingecko/pairs

Returns all trading pairs in CoinGecko format.

Response Example:

[
  {    "ticker_id": "BTC_USDT",
    "base": "BTC",
    "target": "USDT",
    "pool_id": "btc_usdt_pool"
  }},
  {    "ticker_id": "ETH_USDT",
    "base": "ETH",
    "target": "USDT",
    "pool_id": "eth_usdt_pool"
  }},
  {    "ticker_id": "SOL_USDT",
    "base": "SOL",
    "target": "USDT",
    "pool_id": "sol_usdt_pool"
  }]
GET /api/v1/coingecko/tickers

Returns 24-hour pricing and volume data for all pairs.

Response Example:

{  "tickers": [
    {      "ticker_id": "BTC_USDT",
      "base_currency": "BTC",
      "target_currency": "USDT",
      "last_price": "45000.00",
      "base_volume": "125.50",
      "target_volume": "5647500.00",
      "bid": "44995.00",
      "ask": "45005.00",
      "high": "46000.00",
      "low": "44000.00",
      "pool_id": "btc_usdt_pool"
    }},
    {      "ticker_id": "ETH_USDT",
      "base_currency": "ETH",
      "target_currency": "USDT",
      "last_price": "2400.00",
      "base_volume": "350.25",
      "target_volume": "840600.00",
      "bid": "2398.00",
      "ask": "2402.00",
      "high": "2450.00",
      "low": "2380.00",
      "pool_id": "eth_usdt_pool"
    }  ]
}}
GET /api/v1/coingecko/orderbook

Returns order book snapshot for a specific trading pair.

Parameters:

  • ticker_id (query): Trading pair identifier (e.g., BTC_USDT)
  • depth (query, optional): Order book depth (default: 100)

Response Example:

{  "ticker_id": "BTC_USDT",
  "timestamp": 1705320000000,
  "bids": [
    ["44995.00", "2.5"],
    ["44990.00", "1.8"],
    ["44985.00", "3.2"]
  ],
  "asks": [
    ["45005.00", "3.2"],
    ["45010.00", "2.1"],
    ["45015.00", "1.5"]
  ]
}}

WebSocket API

Real-time streaming API for market data updates. Connect to: wss://ws.yourdomain.com

Connection Example

// JavaScript WebSocket connection
const ws = new WebSocket('wss://ws.yourdomain.com');

ws.onopen = () => {
  console.log('WebSocket connected');

  // Subscribe to ticker updates
  ws.send(JSON.stringify({
    event: 'subscribe',
    channel: 'ticker',
    symbol: 'BTC/USDT'
  }));
};

ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  console.log('Received:', data);
};

ws.onerror = (error) => {
  console.error('WebSocket error:', error);
};

ws.onclose = () => {
  console.log('WebSocket disconnected');
};

Ticker Channel

Subscribe to real-time ticker updates:

// Subscribe
{  "event": "subscribe",
  "channel": "ticker",
  "symbol": "BTC/USDT"
}
// Ticker update message
{  "channel": "ticker",
  "symbol": "BTC/USDT",
  "timestamp": 1705320000000,
  "last": "45000.00",
  "bid": "44995.00",
  "ask": "45005.00",
  "volume_24h": "125.50",
  "high_24h": "46000.00",
  "low_24h": "44000.00",
  "change_24h": "2.5"
}}

Order Book Channel

Subscribe to real-time order book updates:

// Subscribe
{  "event": "subscribe",
  "channel": "orderbook",
  "symbol": "BTC/USDT",
  "depth": 20
}
// Order book update
{  "channel": "orderbook",
  "symbol": "BTC/USDT",
  "timestamp": 1705320000000,
  "bids": [
    ["44995.00", "2.5"],
    ["44990.00", "1.8"]
  ],
  "asks": [
    ["45005.00", "3.2"],
    ["45010.00", "2.1"]
  ]
}}

Trades Channel

Subscribe to real-time trade execution updates:

// Subscribe
{  "event": "subscribe",
  "channel": "trades",
  "symbol": "BTC/USDT"
}
// Trade execution message
{  "channel": "trades",
  "symbol": "BTC/USDT",
  "trades": [
    {      "id": "1234567890",
      "price": "45000.00",
      "quantity": "0.5",
      "timestamp": 1705320000000,
      "side": "buy"
    }  ]
}}

SDK Code Examples

JavaScript / Node.js

const axios = require('axios');
const crypto = require('crypto');

class CodonoAPI {
  constructor(apiKey, secretKey) {
    this.apiKey = apiKey;
    this.secretKey = secretKey;
    this.baseURL = 'https://api.yourdomain.com';
  }

  sign(method, path, body = '') {
    const timestamp = Date.now();
    const signatureString = timestamp + method + path + body;
    const signature = crypto
      .createHmac('sha256', this.secretKey)
      .update(signatureString)
      .digest('hex');

    return {
      'X-API-KEY': this.apiKey,
      'X-TIMESTAMP': timestamp,
      'X-SIGNATURE': signature
    };
  }

  async getMarkets() {
    const response = await axios.get(`${this.baseURL}/api/v1/markets`);
    return response.data;
  }

  async getTicker(symbol) {
    const path = `/api/v1/ticker/${symbol}`;
    const response = await axios.get(`${this.baseURL}${path}`);
    return response.data;
  }

  async placeOrder(symbol, side, type, price, quantity) {
    const path = '/api/v1/orders';
    const body = JSON.stringify({
      symbol, side, type, price, quantity
    });

    const headers = this.sign('POST', path, body);

    const response = await axios.post(
      `${this.baseURL}${path}`,
      body,
      {
        headers: {
          ...headers,
          'Content-Type': 'application/json'
        }
      }
    );

    return response.data;
  }
}

// Usage
const api = new CodonoAPI('your_api_key', 'your_secret_key');
const ticker = await api.getTicker('BTC/USDT');
console.log(ticker);

Python

import requests
import hmac
import hashlib
import time
import json

class CodonoAPI:
    def __init__(self, api_key, secret_key):
        self.api_key = api_key
        self.secret_key = secret_key
        self.base_url = 'https://api.yourdomain.com'

    def sign(self, method, path, body=''):
        timestamp = str(int(time.time() * 1000))
        signature_string = timestamp + method + path + body
        signature = hmac.new(
            self.secret_key.encode('utf-8'),
            signature_string.encode('utf-8'),
            hashlib.sha256
        ).hexdigest()

        return {
            'X-API-KEY': self.api_key,
            'X-TIMESTAMP': timestamp,
            'X-SIGNATURE': signature
        }

    def get_markets(self):
        response = requests.get(f'{self.base_url}/api/v1/markets')
        return response.json()

    def get_ticker(self, symbol):
        path = f'/api/v1/ticker/{symbol}'
        response = requests.get(f'{self.base_url}{path}')
        return response.json()

    def place_order(self, symbol, side, order_type, price, quantity):
        path = '/api/v1/orders'
        body = json.dumps({
            'symbol': symbol,
            'side': side,
            'type': order_type,
            'price': price,
            'quantity': quantity
        })

        headers = self.sign('POST', path, body)
        headers['Content-Type'] = 'application/json'

        response = requests.post(
            f'{self.base_url}{path}',
            data=body,
            headers=headers
        )

        return response.json()

# Usage
api = CodonoAPI('your_api_key', 'your_secret_key')
ticker = api.get_ticker('BTC/USDT')
print(ticker)

PHP

<?php
class CodonoAPI {
    private $apiKey;
    private $secretKey;
    private $baseURL = 'https://api.yourdomain.com';

    public function __construct($apiKey, $secretKey) {
        $this->apiKey = $apiKey;
        $this->secretKey = $secretKey;
    }

    private function sign($method, $path, $body = '') {
        $timestamp = round(microtime(true) * 1000);
        $signatureString = $timestamp . $method . $path . $body;
        $signature = hash_hmac('sha256', $signatureString, $this->secretKey);

        return [
            'X-API-KEY: ' . $this->apiKey,
            'X-TIMESTAMP: ' . $timestamp,
            'X-SIGNATURE: ' . $signature
        ];
    }

    public function getMarkets() {
        $ch = curl_init($this->baseURL . '/api/v1/markets');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $response = curl_exec($ch);
        curl_close($ch);

        return json_decode($response, true);
    }

    public function getTicker($symbol) {
        $path = '/api/v1/ticker/' . $symbol;
        $ch = curl_init($this->baseURL . $path);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $response = curl_exec($ch);
        curl_close($ch);

        return json_decode($response, true);
    }

    public function placeOrder($symbol, $side, $type, $price, $quantity) {
        $path = '/api/v1/orders';
        $body = json_encode([
            'symbol' => $symbol,
            'side' => $side,
            'type' => $type,
            'price' => $price,
            'quantity' => $quantity
        ]);

        $headers = $this->sign('POST', $path, $body);
        $headers[] = 'Content-Type: application/json';

        $ch = curl_init($this->baseURL . $path);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

        $response = curl_exec($ch);
        curl_close($ch);

        return json_decode($response, true);
    }
}

// Usage
$api = new CodonoAPI('your_api_key', 'your_secret_key');
$ticker = $api->getTicker('BTC/USDT');
print_r($ticker);
?>

Rate Limits & Best Practices

Rate Limiting

  • Public endpoints: 100 requests per minute per IP address
  • Authenticated endpoints: 60 requests per minute per API key
  • WebSocket connections: Maximum 50 subscriptions per connection
  • Rate limit headers: Response includes X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset

Best Practices

  • Use WebSocket API for real-time data instead of polling REST endpoints
  • Implement exponential backoff for retry logic on failed requests
  • Cache market data responses when possible to reduce API calls
  • Use bulk endpoints (like /api/v1/markets) instead of individual symbol requests
  • Monitor rate limit headers and throttle requests proactively
  • Keep WebSocket connections alive with periodic ping messages

Support & Resources

Need help integrating our API? We're here to assist:

  • Technical Documentation: Full API reference with detailed specifications
  • Developer Support: Email api@codono.com for technical assistance
  • Status Page: Monitor API uptime and performance at status.codono.com
  • Changelog: Stay updated with API changes and new features