Latoken Public API (V1)

Download OpenAPI specification:Download

Welcome to official Public REST API of Latoken Exchange.

Basic information

  • The base address is https://api.latoken.com
  • All methods return JSON object
  • Error requests return 4XX status codes if the error is caused by client, else, internal errors will be returned with status code 5XX
  • For information about ApiKeys or any other questions, you can visit our F.A.Q section for more details.

Error format

Errors are returned in JSON format as follows:

  {
    "error": {
        "message": "error message",
        "errorType": "AuthorizationError"
        "statusCode": 401
        }
  }

Rate limit errors will return code 429 and they will be formatted in the following way:

  {
        "message": "Request limit reached",
        "details": "Request limit reached. Maximum allowed: 3 per 4s. Please try again in 2 second(s)."
  }

(To see rate limits use /api/v1/ExchangeInfo/limits endpoint. There you can find rate limits for public and signed endpoints)

Public and Private endpoints

Latoken API has two type of endpoints. Public and Signed endpoints. Public endpoints can be accessed by anyone and they mostly contain methods that return public market data (Order book, ticker, trades, exchange info etc...) Signed endpoints contain user related data and enable to create, cancel and see the state of user accounts, orders and balances.

Endpoint Endpoint type
/api/v1/Account/ SIGNED
/api/v1/ExchangeInfo/ PUBLIC
/api/v1/MarketData/ PUBLIC
/api/v1/Order/new SIGNED

Authorization

For signed endpoints, client should have ApiKey and ApiSecret. The request can be signed using HMAC-SHA256, HMAC-SHA384 or HMAC-SHA512. If the Hash header is not provided, the default algorithm will be HMAC-SHA256.

Request headers

Header key Value description Value example
X-LA-KEY Client key api-key-mysuperlatokenkey
X-LA-SIGNATURE Request signature 45dec0cf062d5f79f94fa34d0e7a6c58cafe8bb5a00b34175226e579a1812775
X-LA-HASHTYPE Hash function (optional) HMAC-SHA384

Signature

The signature of the request is created by using your ApiSecret to sign the api endpoint + query string of the request For example, if we want to make request to see our latest trades on LAETH pair, we would use https://api.latoken.comapi/v1/Order/trades?timestamp=1555515807369&symbol=LAETH request. In that case, we would need to sign /api/v1/Order/trades?timestamp=1555515807369&symbol=LAETH part of request, and the result of signing should be placed in X-LA-SIGNATURE heade

Example of signed request in JavaScript:


const request = require('request')
const crypto = require('crypto')

const apiKey = 'Your Latoken API key'
const apiSecret = 'Your Latoken API secret'
const baseUrl = 'https://api.latoken.com'
const endpoint = '/api/v1/Order/trades'

const params = {
    timestamp: Date.now(),
    symbol: "LAETH"
}

const query = `?${Object.entries(params).map(([key, val]) => `${key}=${val}`).join('&')}`
const signature = crypto.createHmac('sha256', apiSecret).update(endpoint+query).digest('hex')

const options = {
    url: baseUrl+endpoint+query,
    headers: {
            'X-LA-KEY': apiKey,
            'X-LA-SIGNATURE': signature
        }
}

return request.get(options,
        function(error, response, body) {
        console.log('response:', JSON.stringify(body, 0, 2))
        }
    )

Timing validation

  • Some endpoints require timestamp parameter.

  • timestamp parameter should be the time of request creation represented in UNIX milliseconds
  • In some methods, there is optional parameter timeAlive, that can be sent to specify the number of milliseconds the request is valid for. If timeAlive is not sent, it will default to 5000
  • The time validation logic is:
    if (timestamp < (serverTime + 1000) && (serverTime - timestamp) <= timeAlive) 
    {
                                                // valid request
    } 
    else
    {
                                                // invalid request
    }
    

F.A.Q

  • To receive your ApiKey and ApiSecret and for any other API related questions, please contact us at publicapi@latoken.com

Account

Get all balances

query Parameters
timestamp
integer <int64>

Request timestamp (in unix milliseconds)

Responses

200

Success

400

BadRequest

401

Forbidden

428

RequestLimit

get api/v1/Account/balances
api/v1/Account/balances

Response samples

application/json
Copy
Expand all Collapse all
[
  • [
    ]
]

Get balance for desired currency

path Parameters
currency
required
string

Symbol of currency ( e.g. LA)

query Parameters
timestamp
required
integer <int64>

Request timestamp (in unix milliseconds)

Responses

200

Success

400

BadRequest

401

Forbidden

428

RequestLimit

get api/v1/Account/balances/{currency}
api/v1/Account/balances/{currency}

Response samples

application/json
Copy
Expand all Collapse all
{
  • "currencyId": 102,
  • "symbol": "LA",
  • "name": "Latoken",
  • "amount": 1054.66,
  • "available": 900.66,
  • "frozen": 154,
  • "pending": 0
}

ExchangeInfo

Returns current exchange time

Responses

200

Success

400

BadRequest

401

Forbidden

428

RequestLimit

get api/v1/ExchangeInfo/time
api/v1/ExchangeInfo/time

Response samples

application/json
Copy
Expand all Collapse all
{
  • "time": "2019-04-18T9:00:00.0Z",
  • "unixTimeSeconds": 1555578000,
  • "unixTimeMiliseconds": 1555578000000
}

Information about request rate limits of API

Responses

200

Success

400

BadRequest

401

Forbidden

428

RequestLimit

get api/v1/ExchangeInfo/limits
api/v1/ExchangeInfo/limits

Response samples

application/json
Copy
Expand all Collapse all
{
  • "publicEndpoints":
    [
    ],
  • "signedEndpoints":
    [
    ]
}

Returns all trading pairs of Latoken exchange

Responses

200

Success

400

BadRequest

401

Forbidden

428

RequestLimit

get api/v1/ExchangeInfo/pairs
api/v1/ExchangeInfo/pairs

Response samples

application/json
Copy
Expand all Collapse all
[
  • {
    }
]

Returns all trading pairs that contain desired currency

path Parameters
currency
required
string

Currency target (e.g. LA)

Responses

200

Success

400

BadRequest

401

Forbidden

428

RequestLimit

get api/v1/ExchangeInfo/pairs/{currency}
api/v1/ExchangeInfo/pairs/{currency}

Response samples

application/json
Copy
Expand all Collapse all
[
  • {
    }
]

Gets info about desired trading pair

query Parameters
symbol
string

Symbol of traded pair (e.g. LAETH)

Responses

200

Success

400

BadRequest

401

Forbidden

428

RequestLimit

get api/v1/ExchangeInfo/pair
api/v1/ExchangeInfo/pair

Response samples

application/json
Copy
Expand all Collapse all
{
  • "pairId": 502,
  • "symbol": "LAETH",
  • "baseCurrency": "LA",
  • "quotedCurrency": "ETH",
  • "makerFee": 0.01,
  • "takerFee": 0.01,
  • "pricePrecision": 8,
  • "amountPrecision": 8,
  • "minQty": 0.1
}

Get all currencies available on Latoken exchange

Responses

200

Success

400

BadRequest

401

Forbidden

428

RequestLimit

get api/v1/ExchangeInfo/currencies
api/v1/ExchangeInfo/currencies

Response samples

application/json
Copy
Expand all Collapse all
[
  • {
    }
]

Get currency info by symbol or name

path Parameters
symbol
required
string

Symbol or name of desired currency (e.g LA or Latoken)

Responses

200

Success

400

BadRequest

401

Forbidden

428

RequestLimit

get api/v1/ExchangeInfo/currencies/{symbol}
api/v1/ExchangeInfo/currencies/{symbol}

Response samples

application/json
Copy
Expand all Collapse all
{
  • "currencyId": 102,
  • "symbol": "LA",
  • "name": "Latoken",
  • "precission": 8,
  • "type": "ERC20",
  • "fee": 0.1
}

MarketData

Get 24h ticker for all pairs

Responses

200

Success

400

BadRequest

401

Forbidden

428

RequestLimit

get api/v1/MarketData/tickers
api/v1/MarketData/tickers

Response samples

application/json
Copy
Expand all Collapse all
[
  • {
    }
]

Get 24h ticker for desired pair

path Parameters
symbol
required
string

Symbol of traded pair (example: LAETH)

Responses

200

Success

400

BadRequest

401

Forbidden

428

RequestLimit

get api/v1/MarketData/ticker/{symbol}
api/v1/MarketData/ticker/{symbol}

Response samples

application/json
Copy
Expand all Collapse all
{
  • "pairId": 502,
  • "symbol": "LAETH",
  • "volume": 1023314.3202,
  • "open": 134.82,
  • "low": 133.95,
  • "high": 136.22,
  • "close": 135.12,
  • "priceChange": 0.22
}

Get trades history for desired pair

query Parameters
symbol
string

Symbol of traded pair (example: LAETH)

limit
integer <int32>
Default: 10

Number of price levels to fetch (Max value 100, Default value 10)

Responses

200

Success

400

BadRequest

401

Forbidden

428

RequestLimit

get api/v1/MarketData/orderBook/{symbol}/{limit}
api/v1/MarketData/orderBook/{symbol}/{limit}

Response samples

application/json
Copy
Expand all Collapse all
{
  • "pairId": 502,
  • "symbol": "LAETH",
  • "spread": 0.07,
  • "asks":
    [
    ],
  • "bids":
    [
    ]
}

Get trades history for desired pair

query Parameters
symbol
string

Symbol of traded pair (example: LAETH)

limit
integer <int32>
Default: 50

Number of trades to fetch (Max value 100, Default value 50)

Responses

200

Success

400

BadRequest

401

Forbidden

428

RequestLimit

get api/v1/MarketData/trades/{symbol}/{limit}
api/v1/MarketData/trades/{symbol}/{limit}

Response samples

application/json
Copy
Expand all Collapse all
{
  • "pairId": 502,
  • "symbol": "LAETH",
  • "tradeCount": 1,
  • "trades":
    [
    ]
}

Order

Placing a new order

query Parameters
Symbol
required
string

Symbol of traded pair (example: LAETH)

CliOrdId
string

ID of order set by client (example: myNewOrder)

Side
required
string

Order side (buy or sell)

Price
number <double>

Price of order

Amount
required
number <double>

Amount of order

OrderType
string

Order type (limit)

Timestamp
required
integer <int64>

Time of request in millisecods (example: 1555515807369)

TimeAlive
integer <int64>

Indicator how long request is valid in millisecods (example: 3000)

Responses

200

Success

400

BadRequest

401

Forbidden

428

RequestLimit

post api/v1/Order/new
api/v1/Order/new

Response samples

application/json
Copy
Expand all Collapse all
{
  • "orderId": "1555492358.126073.126767@0502:2",
  • "cliOrdId": "myNewOrder",
  • "pairId": 502,
  • "symbol": "LAETH",
  • "side": "buy",
  • "orderType": "limit",
  • "price": 136.2,
  • "amount": 0.57
}

Test order placement

query Parameters
Symbol
required
string

Symbol of traded pair (example: LAETH)

CliOrdId
string

ID of order set by client (example: myNewOrder)

Side
required
string

Order side (buy or sell)

Price
number <double>

Price of order

Amount
required
number <double>

Amount of order

OrderType
string

Order type (limit)

Timestamp
required
integer <int64>

Time of request in millisecods (example: 1555515807369)

TimeAlive
integer <int64>

Indicator how long request is valid in millisecods (example: 3000)

Responses

200

Success

400

BadRequest

401

Forbidden

428

RequestLimit

post api/v1/Order/test-order
api/v1/Order/test-order

Response samples

application/json
Copy
Expand all Collapse all
{
  • "success": true,
  • "message": "All good!"
}

Cancel desired order by ID

query