Skip to content

На этой странице

Coins API

The coins API provides functionality for managing cryptocurrency coins and tokens across different blockchain networks.

Interactive Testing

On this page you can test the API in real time! Enter your API key in the field below and click the "Test" buttons to send requests to the server https://cp-merch-dev.wsdemo.online/api.

If you encounter CORS errors:

  • Use the "📋 Copy curl" buttons to get ready-to-use commands
  • Execute commands in terminal or use Postman
  • Install a browser extension to disable CORS (e.g., "CORS Unblock")

Overview

The coins API allows you to:

  • Create new coins and tokens
  • Precreate tokens from contract addresses
  • Edit coin settings and status
  • Retrieve coin information and configurations
POST

Create Coin

POST /v1/coins

Creates a new coin or token. Admin access only.

Параметры

ПараметрТипОбязательныйОписание
coinstringНетUnique coin identifier (auto-generated if not provided)
namestringНетCoin or token name (auto-detected from contract if not provided)
contractAddressstringНетToken contract address (for tokens only)
networkstringДаNetwork slug (e.g., ethereum, bitcoin, tron)
useUsdLimitsbooleanНетUse USD limits for settlements and transactions
collectThresholdnumberНетMinimum amount for transfer to service wallet
collectServiceToColdThresholdnumberНетMinimum amount for transfer from service to cold wallet
collectPercentageHotnumberНетPercentage of coins collected on hot wallet
approveThresholdnumberНетConfidence volume for transfers to service wallet
minValuenumberНетMinimum possible amount for one-time withdrawal
maxValuenumberНетMaximum possible amount for one-time withdrawal
maxValueDailynumberНетMaximum possible withdrawal in 24 hours
minDepositAmountnumberНетMinimum amount for deposit

Ответы

201 Created

Coin created successfully

400 Bad Request

Invalid parameters

PUT

Precreate Token

PUT /v1/coins/precreate-token

Precreates a token by analyzing its contract address. Admin access only.

Параметры

ПараметрТипОбязательныйОписание
contractAddressstringДаToken contract address
networkstringДаNetwork slug (e.g., ethereum, bsc, polygon)

Ответы

201 Created

Token precreated successfully

400 Bad Request

Invalid contract address or network

PUT

Edit Coin

PUT /v1/coins

Edits coin or token settings and status. Can be used to activate/deactivate coins. Admin access only.

Параметры

ПараметрТипОбязательныйОписание
coinstringДаUnique coin identifier
namestringНетCoin or token name
statusstringНетCoin status (ACTIVE, INACTIVE)
useUsdLimitsbooleanНетUse USD limits for settlements and transactions
collectThresholdnumberНетMinimum amount for transfer to service wallet
collectServiceToColdThresholdnumberНетMinimum amount for transfer from service to cold wallet
collectPercentageHotnumberНетPercentage of coins collected on hot wallet
approveThresholdnumberНетConfidence volume for transfers to service wallet
minValuenumberНетMinimum possible amount for one-time withdrawal
maxValuenumberНетMaximum possible amount for one-time withdrawal
maxValueDailynumberНетMaximum possible withdrawal in 24 hours
minDepositAmountnumberНетMinimum amount for deposit

Ответы

200 OK

Coin updated successfully

400 Bad Request

Invalid parameters

GET

Get Coins

GET /v1/coins

Returns list of all available coins and tokens.

Ответы

200 OK

Coins list retrieved

GET

Get Coin

GET /v1/coins/{coin}

Returns information about a specific coin or token.

Параметры

ПараметрТипОбязательныйОписание
coinstringДаCoin slug (e.g., btc, eth, usdt)

Ответы

200 OK

Coin information retrieved

400 Bad Request

Invalid coin slug

API Configuration

Create Coin

bash
curl -X POST "https://cp-merch-dev.wsdemo.online/api/v1/coins" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "network": "ethereum",
    "name": "My Token",
    "contractAddress": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
    "collectThreshold": 0.001,
    "minValue": 0.0001,
    "maxValue": 1000
  }'

Response:

json
{
  "message": "Coin created successfully"
}

Precreate Token

bash
curl -X PUT "https://cp-merch-dev.wsdemo.online/api/v1/coins/precreate-token" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contractAddress": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
    "network": "ethereum"
  }'

Response:

json
{
  "coin": "usdt_erc20",
  "symbol": "USDT",
  "name": "Tether USD",
  "decimals": 6
}

Get Coins

bash
curl -X GET "https://cp-merch-dev.wsdemo.online/api/v1/coins" \
  -H "X-Api-Key: YOUR_API_KEY"

Response:

json
[
  {
    "coin": "btc",
    "name": "Bitcoin",
    "type": "NATIVE",
    "decimals": 8,
    "contractAddress": null,
    "status": "ACTIVE",
    "settings": {
      "useUsdLimits": true,
      "collectThreshold": 0.001,
      "collectServiceToColdThreshold": 1,
      "collectPercentageHot": 10,
      "approveThreshold": 1000000,
      "minValue": 0.0001,
      "maxValue": 10,
      "maxValueDaily": 100,
      "minDepositAmount": 0.0001
    },
    "network": {
      "network": "bitcoin"
    }
  },
  {
    "coin": "eth",
    "name": "Ethereum",
    "type": "NATIVE",
    "decimals": 18,
    "contractAddress": null,
    "status": "ACTIVE",
    "settings": {
      "useUsdLimits": false,
      "collectThreshold": 0.01,
      "collectServiceToColdThreshold": 10,
      "collectPercentageHot": 15,
      "approveThreshold": 1000000,
      "minValue": 0.001,
      "maxValue": 100,
      "maxValueDaily": 1000,
      "minDepositAmount": 0.001
    },
    "network": {
      "network": "ethereum"
    }
  }
]

Get Specific Coin

bash
curl -X GET "https://cp-merch-dev.wsdemo.online/api/v1/coins/btc" \
  -H "X-Api-Key: YOUR_API_KEY"

Response:

json
{
  "coin": "btc",
  "name": "Bitcoin",
  "type": "NATIVE",
  "decimals": 8,
  "contractAddress": null,
  "status": "ACTIVE",
  "settings": {
    "useUsdLimits": true,
    "collectThreshold": 0.001,
    "collectServiceToColdThreshold": 1,
    "collectPercentageHot": 10,
    "approveThreshold": 1000000,
    "minValue": 0.0001,
    "maxValue": 10,
    "maxValueDaily": 100,
    "minDepositAmount": 0.0001,
    "collectThresholdUSD": 50,
    "collectServiceToColdThresholdUSD": 50000,
    "approveThresholdUSD": 1000000,
    "minValueUSD": 5,
    "maxValueUSD": 500000,
    "maxValueDailyUSD": 5000000,
    "minDepositAmountUSD": 5
  },
  "network": {
    "network": "bitcoin"
  }
}

Edit Coin

bash
curl -X PUT "https://cp-merch-dev.wsdemo.online/api/v1/coins" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "coin": "btc",
    "status": "ACTIVE",
    "minValue": 0.0001,
    "maxValue": 10,
    "collectThreshold": 0.001
  }'

Response:

json
{
  "message": "Coin updated successfully"
}

Go HTTP Client

go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "net/http"
)

func main() {
    // Create coin
    payload := map[string]interface{}{
        "network":         "ethereum",
        "name":           "My Token",
        "contractAddress": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
        "collectThreshold": 0.001,
        "minValue":       0.0001,
        "maxValue":       1000,
    }
    
    jsonData, _ := json.Marshal(payload)
    
    req, _ := http.NewRequest("POST", "https://cp-merch-dev.wsdemo.online/api/v1/coins", bytes.NewBuffer(jsonData))
    req.Header.Set("X-Api-Key", "YOUR_API_KEY")
    req.Header.Set("Content-Type", "application/json")
    
    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()
    
    body, _ := io.ReadAll(resp.Body)
    fmt.Printf("Response: %s\n", body)
    
    // Get coins list
    req2, _ := http.NewRequest("GET", "https://cp-merch-dev.wsdemo.online/api/v1/coins", nil)
    req2.Header.Set("X-Api-Key", "YOUR_API_KEY")
    
    resp2, err := client.Do(req2)
    if err != nil {
        panic(err)
    }
    defer resp2.Body.Close()
    
    body2, _ := io.ReadAll(resp2.Body)
    fmt.Printf("Coins list: %s\n", body2)
}

JavaScript Fetch

javascript
// Create coin
const createCoin = async () => {
  const response = await fetch('https://cp-merch-dev.wsdemo.online/api/v1/coins', {
    method: 'POST',
    headers: {
      'X-Api-Key': 'YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      network: 'ethereum',
      name: 'My Token',
      contractAddress: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
      collectThreshold: 0.001,
      minValue: 0.0001,
      maxValue: 1000
    })
  });
  
  const result = await response.json();
  console.log('Created coin:', result);
  
  // Get coins list
  const coinsResponse = await fetch('https://cp-merch-dev.wsdemo.online/api/v1/coins', {
    headers: {
      'X-Api-Key': 'YOUR_API_KEY'
    }
  });
  
  const coins = await coinsResponse.json();
  console.log('Coins list:', coins);
  
  // Get specific coin
  const coinResponse = await fetch('https://cp-merch-dev.wsdemo.online/api/v1/coins/btc', {
    headers: {
      'X-Api-Key': 'YOUR_API_KEY'
    }
  });
  
  const coin = await coinResponse.json();
  console.log('Bitcoin info:', coin);
  
  // Edit coin
  const editResponse = await fetch('https://cp-merch-dev.wsdemo.online/api/v1/coins', {
    method: 'PUT',
    headers: {
      'X-Api-Key': 'YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      coin: 'btc',
      status: 'ACTIVE',
      minValue: 0.0001
    })
  });
  
  const editResult = await editResponse.json();
  console.log('Edit result:', editResult);
};

createCoin();

Python Requests

python
import requests
import json

# API configuration
API_BASE = 'https://cp-merch-dev.wsdemo.online/api/v1'
headers = {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json'
}

# Create coin
payload = {
    'network': 'ethereum',
    'name': 'My Token',
    'contractAddress': '0xdAC17F958D2ee523a2206206994597C13D831ec7',
    'collectThreshold': 0.001,
    'minValue': 0.0001,
    'maxValue': 1000
}

response = requests.post(f'{API_BASE}/coins', 
                        headers=headers, 
                        json=payload)

if response.status_code == 201:
    result = response.json()
    print(f"Created coin: {result['message']}")
    
    # Get coins list
    coins_response = requests.get(f'{API_BASE}/coins', headers=headers)
    
    if coins_response.status_code == 200:
        coins = coins_response.json()
        print(f"Found {len(coins)} coins")
        
        # Get specific coin
        coin_response = requests.get(f'{API_BASE}/coins/btc', headers=headers)
        
        if coin_response.status_code == 200:
            coin = coin_response.json()
            print(f"Bitcoin: {coin['name']}, Status: {coin['status']}")
            
            # Edit coin
            edit_payload = {
                'coin': 'btc',
                'status': 'ACTIVE',
                'minValue': 0.0001
            }
            
            edit_response = requests.put(f'{API_BASE}/coins', 
                                       headers=headers, 
                                       json=edit_payload)
            
            if edit_response.status_code == 200:
                edit_result = edit_response.json()
                print(f"Edit result: {edit_result['message']}")
else:
    print(f"Error: {response.status_code}")

PHP cURL

php
<?php
$apiKey = 'YOUR_API_KEY';
$baseUrl = 'https://cp-merch-dev.wsdemo.online/api/v1';

// Create coin
$payload = json_encode([
    'network' => 'ethereum',
    'name' => 'My Token',
    'contractAddress' => '0xdAC17F958D2ee523a2206206994597C13D831ec7',
    'collectThreshold' => 0.001,
    'minValue' => 0.0001,
    'maxValue' => 1000
]);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $baseUrl . '/coins');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'X-Api-Key: ' . $apiKey,
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpCode === 201) {
    $result = json_decode($response, true);
    echo "Created coin: " . $result['message'] . "\n";
    
    // Get coins list
    $ch2 = curl_init();
    curl_setopt($ch2, CURLOPT_URL, $baseUrl . '/coins');
    curl_setopt($ch2, CURLOPT_HTTPHEADER, [
        'X-Api-Key: ' . $apiKey
    ]);
    curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
    
    $coinsResponse = curl_exec($ch2);
    $coinsHttpCode = curl_getinfo($ch2, CURLINFO_HTTP_CODE);
    curl_close($ch2);
    
    if ($coinsHttpCode === 200) {
        $coins = json_decode($coinsResponse, true);
        echo "Found " . count($coins) . " coins\n";
        
        // Get specific coin
        $ch3 = curl_init();
        curl_setopt($ch3, CURLOPT_URL, $baseUrl . '/coins/btc');
        curl_setopt($ch3, CURLOPT_HTTPHEADER, [
            'X-Api-Key: ' . $apiKey
        ]);
        curl_setopt($ch3, CURLOPT_RETURNTRANSFER, true);
        
        $coinResponse = curl_exec($ch3);
        $coinHttpCode = curl_getinfo($ch3, CURLINFO_HTTP_CODE);
        curl_close($ch3);
        
        if ($coinHttpCode === 200) {
            $coin = json_decode($coinResponse, true);
            echo "Bitcoin: " . $coin['name'] . ", Status: " . $coin['status'] . "\n";
        }
    }
} else {
    echo "Error: " . $httpCode . "\n";
}
?>

Released under the MIT License.