πŸ”₯ Top 24h Volume

Gatevia Private API Documentation

The Gatevia API allows programmatic trading and balance management. All private requests require an API Key and Secret.

Base URL: https://api.gatevia.io/private

Authentication Details

Method: POST
Content-Type: application/x-www-form-urlencoded

Required Headers

HeaderDescription
X-GATEVIA-KEYYour API Key string.
X-GATEVIA-SIGNATUREHMAC-SHA256 of nonce + payload.
X-GATEVIA-NONCEMillisecond timestamp (strictly increasing).

Signature Calculation

The signature is calculated using HMAC-SHA256 with your API Secret. The data to sign is the concatenation of the nonce and the raw query string of the parameters.

$signature = hash_hmac('sha256', $nonce . $payload, $apiSecret);

Important: Data Types & Precision

Precision & Format: All numerical values (prices, amounts, balances) are returned as Strings formatted to 8 decimal places. This ensures high precision and prevents scientific notation errors (e.g., 1.0E-5).

1. Place Order

Submit a new limit order to the matching engine.

POST /place_order

Parameters

ParamTypeDescription
sidestring"buy" or "sell".
pairstringPair format: BASE_QUOTE (e.g. BTC_USDT).
pricestringLimit price as string (max 8 decimals).
amountstringQuantity as string (max 8 decimals).

Example Success Response

{ "success": true, "order_id": 178000, "status": "open" }

Full PHP Implementation

<?php
$apiKey    = "YOUR_GATEVIA_KEY";
$apiSecret = "YOUR_SECRET_API";
$apiUrl    = "https://api.gatevia.io/private/place_order";

$params = [
    'side'   => 'buy',
    'pair'   => 'GVIAT_USDTT',
    'price'  => '0.00000100',
    'amount' => '10.00000000'
];

$payload   = http_build_query($params);
$nonce     = (int)(microtime(true) * 1000);
$signature = hash_hmac('sha256', $nonce . $payload, $apiSecret);

$ch = curl_init($apiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "X-GATEVIA-KEY: $apiKey",
    "X-GATEVIA-SIGNATURE: $signature",
    "X-GATEVIA-NONCE: $nonce",
    "Content-Type: application/x-www-form-urlencoded"
]);

$response = curl_exec($ch);
print_r(json_decode($response, true));
curl_close($ch);
?>

2. Cancel Order

Cancel an open order and unlock funds.

POST /cancel_order

Full PHP Implementation

<?php
$apiKey    = "YOUR_GATEVIA_KEY";
$apiSecret = "YOUR_SECRET_API";
$apiUrl    = "https://api.gatevia.io/private/cancel_order";

$params    = ['id' => 177913]; 
$payload   = http_build_query($params);
$nonce     = (int)(microtime(true) * 1000);
$signature = hash_hmac('sha256', $nonce . $payload, $apiSecret);

$ch = curl_init($apiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "X-GATEVIA-KEY: $apiKey",
    "X-GATEVIA-SIGNATURE: $signature",
    "X-GATEVIA-NONCE: $nonce",
    "Content-Type: application/x-www-form-urlencoded"
]);

$response = curl_exec($ch);
print_r(json_decode($response, true));
curl_close($ch);
?>

3. Open Orders

Retrieve active orders for the authenticated user.

POST /open_orders

Example Response

[
  {
    "id": 177917,
    "pair": "GVIAT_USDTT",
    "side": "buy",
    "price": "0.00000100",
    "amount": "10.00000000",
    "filled": "0.00000000",
    "pct": 0
  }
]

Full PHP Implementation

<?php
$apiKey    = "YOUR_GATEVIA_KEY";
$apiSecret = "YOUR_SECRET_API";
$apiUrl    = "https://api.gatevia.io/private/open_orders";

$params    = ['pair' => 'GVIAT_USDTT']; 
$payload   = http_build_query($params);
$nonce     = (int)(microtime(true) * 1000);
$signature = hash_hmac('sha256', $nonce . $payload, $apiSecret);

$ch = curl_init($apiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "X-GATEVIA-KEY: $apiKey",
    "X-GATEVIA-SIGNATURE: $signature",
    "X-GATEVIA-NONCE: $nonce",
    "Content-Type: application/x-www-form-urlencoded"
]);

$response = curl_exec($ch);
print_r(json_decode($response, true));
curl_close($ch);
?>

4. Get Balances

Get current asset availability and locked quantities.

POST /get_balances

Example Response

[
  {
    "coin": "GVIA",
    "available": "150.75000000",
    "locked": "10.00000000"
  }
]

Full PHP Implementation

<?php
$apiKey    = "YOUR_GATEVIA_KEY";
$apiSecret = "YOUR_SECRET_API";
$apiUrl    = "https://api.gatevia.io/private/get_balances";

$params    = ['coin' => 'BTC']; 
$payload   = http_build_query($params);
$nonce     = (int)(microtime(true) * 1000);
$signature = hash_hmac('sha256', $nonce . $payload, $apiSecret);

$ch = curl_init($apiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "X-GATEVIA-KEY: $apiKey",
    "X-GATEVIA-SIGNATURE: $signature",
    "X-GATEVIA-NONCE: $nonce",
    "Content-Type: application/x-www-form-urlencoded"
]);

$response = curl_exec($ch);
print_r(json_decode($response, true));
curl_close($ch);
?>

Server Error Responses

If a request fails, the server will return a success: false status along with an error code.

Error CodeDescription
not_authenticatedAPI Key or Signature is invalid or missing.
rate_limit_exceededToo many requests. Limit: 10 requests per second per user.
insufficient_fundsUser does not have enough balance to cover the order + fee.
invalid_paramsMissing or malformed parameters (e.g., negative price).
market_not_foundThe requested trading pair does not exist.
order_not_foundAttempting to cancel an ID that does not exist or belongs to another user.
already_closedOrder is already filled or cancelled and cannot be modified.
below_min_amountOrder amount is lower than the market's minimum trade amount.

Example Error Response

{
  "success": false,
  "error": "insufficient_funds",
  "need": "10.00000000",
  "have": "2.50000000",
  "coin": "USDT"
}