API documentation
This documentation provides a complete reference for interacting with the durian trading API.
Overview
The durian API is a RESTful interface designed for programmatic access to core trading functions on the durian platform. It enables developers to automate account management, position handling, and market data retrieval in a secure and efficient manner.
Purpose
This guide is intended for developers, traders, and integration partners who wish to build on top of durian's infrastructure. It covers authentication, available endpoints, request/response schemas, and usage examples for both real-time trading operations and portfolio tracking.
Base URLs: https://api.durian.win
Authentication
HTTP Authentication, scheme: bearer
Open API
POST Login
POST /api/v3/register
Body Parameters
{
"email": "string",
"type": "string",
"secret": "string"
}Params
body
body
object
no
none
body
string
yes
» type
body
string
yes
1: login by secret
» secret
body
string
yes
secret key
Response Example
Responses
200
OK
Inline
Response Data Schema
» msg
string
true
» code
integer
true
» data
object
true
»» isInvite
boolean
true
»» userId
integer
true
»» token
string
true
»» isFirst
boolean
true
true is the first time to login
POST Logout
POST /api/v3/logout
Response Example
Responses
200
OK
Inline
Response Data Schema
» msg
string
true
» code
integer
true
GET Coin List
GET /api/v3/coins/list
Params
orderByColumn
query
string
no
marketCap、gainers、losers、tradingVolume
isAsc
query
string
no
desc、asc
Response Example
Responses
200
OK
Inline
Response Data Schema
» msg
string
true
» code
integer
true
» data
array of objects
true
Here’s Part 2 of the Durian API documentation in copyable markdown text, covering Open/Close Position, Set Leverage, and Get Open Positions:
POST Open Position
POST /api/v3/account/open/position
Body Parameters
Params
» side
body
string
yes
BUY, SELL
» orderQty
body
string
yes
order quantity, max 4 decimals
» leverage
body
integer
yes
leverage
» positionSide
body
string
yes
LONG, SHORT
» symbol
body
string
yes
e.g. BT_PERP_DOGE_USD
Response Example
POST Close A Position
POST /api/v3/account/close/position
Body Parameters
Params
» orderQty
body
string
yes
order quantity
» positionId
body
string
yes
position ID
Response Example
POST Close All Positions
POST /api/v3/account/close/all/position
Response Example
POST Set Leverage
POST /api/v3/account/set/leverage
Body Parameters
Params
» symbol
body
string
yes
e.g. BT_PERP_DOGE_USD
» leverage
body
string
yes
leverage value
Response Example
GET Opening Positions
GET /api/v3/account/portfolio/position
Params
symbol
query
string
no
Filter by symbol (optional)
Response Example
GET Position History
GET /api/v3/account/portfolio/position/history
Params
symbol
query
string
no
e.g. BT_PERP_DOGE_USD
pageNum
query
integer
no
Page number
pageSize
query
integer
no
Page size
isClose
query
integer
no
0 = only closed positions (COMPLETE_CLOSED, LIQUIDATION, PARTIAL_CLOSED)
startTime
query
string
yes
Start time in ms or ISO8601
endTime
query
string
yes
End time in ms or ISO8601
Response Example
Last updated