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

Name
Location
Type
Required
Title
Description

body

body

object

no

none

» email

body

string

yes

email

» type

body

string

yes

1: login by secret

» secret

body

string

yes

secret key

Response Example

Responses

HTTP Status Code
Meaning
Description
Data schema

200

OK

Inline

Response Data Schema

Name
Type
Required
Description

» 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

HTTP Status Code
Meaning
Description
Data schema

200

OK

Inline

Response Data Schema

Name
Type
Required

» msg

string

true

» code

integer

true


GET Coin List

GET /api/v3/coins/list

Params

Name
Location
Type
Required
Description

orderByColumn

query

string

no

marketCap、gainers、losers、tradingVolume

isAsc

query

string

no

desc、asc

Response Example

Responses

HTTP Status Code
Meaning
Description
Data schema

200

OK

Inline

Response Data Schema

Name
Type
Required

» 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

Name
Location
Type
Required
Description

» 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

Name
Location
Type
Required
Description

» 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

Name
Location
Type
Required
Description

» 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

Name
Location
Type
Required
Description

symbol

query

string

no

Filter by symbol (optional)

Response Example


GET Position History

GET /api/v3/account/portfolio/position/history

Params

Name
Location
Type
Required
Description

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