Welcome to the OKEx API. Please note that v3 is the current version of this document. Please check this document periodically for latest updates.
OKEx offers powerful APIs for you to integrate into your applications. They are divided into three categories: account, trading, and market trends.
The account and trading APIs require authentication with an APIKey which allows you to:
- place and cancel orders
- enquire order status and account info
The market data API is publicly accessible and provides market data such as:
- historical price of trading pairs
After registering an account with OKEx, you can create APIKeys with different permissions to segregate privileges, for example one APIKey can trade while another can withdraw.
To access the API, create an APIKey via this link. Follow the instructions in setting up access.
OKEx offers REST and WebSocket APIs. REST support market data, trading, and withdrawals and WebSocket support market data.
Please use the IP address outside mainland China to access the API of OKEx. It is strongly recommended to use ali-cloud server in Hong Kong.
REST, or Representational State Transfer, is one of the most popular architectural styles for exposing web services, the definition is clear, standardized, user-friendly, and scalable. It also has the following advantages:
- Under the RESTful framework, each URL represents a type of resource
- The representational state of this resource is transferred between the client and server
- Representational State Transfer (REST) is done by client requesting server via four HTTP request methods. We strongly recommend you to use Rest APIs in performing trading activities and making withdrawals.
Support of HTTP/2
HTTP/2 is the latest version of the HTTP protocol, which is upgraded from HTTP/1.1 based on multiplexing. The updates involved are as follows:
- Our website and API will support both HTTP/1.1 and HTTP/2.
- HTTP/2 will be automatically enabled on compatible clients by default.
- Compatibility for browsers or program libraries of older versions will be maintained by supporting HTTP/1.1.
WebSocket is a new HTML5 protocol. It achieves full-duplex data transmission between the client and the server, allowing data to transmit effectively in both directions. With one simple handshake, the connection between the client and the server is established, and the server can push information to the client according to business rules. WebSocket has the following advantages:
- The WebSocket request header for data transmission between client and server is approximately 2 bytes only;
- Either the client or server can initiate a data transmission;
- Significant network and server resources are saved without needing to create and delete connections repeatedly. We strongly recommend you to use WebSocket API to access live market data.
Please feel free to join our API community on Telegram (https://t.me/OKExAPI), where we will help answer your questions and you can share your experiences with other users.
For WeChat, please remark: API + Name + OKEx Account ID, to the API support group.
Market Maker Program
High-caliber trading teams are welcomed to work with OKEx as market makers in providing a liquid, fair, and orderly platform to all users. OKEx market makers could enjoy favourable fees in return for meeting the market making obligations.
VIP 1 or above on fee schedule
Account balance >= 200,000 USD
Interested parties could drop us an email at email@example.com with the below details:
Your account email
Contact details (additional to your account email)
A screenshot of your maker trading volume (such as 30days trading volume or VIP status)
Specify the product line you would like to provide liquidity for (you may choose more than one)
• Perpetual Swap
Market making obligations and trading fees will be shared to successful parties only.
In fairness to all users, market makers will be ineligible for other VIP-related and volume-related promotions or rebates.
OKEx reserves the right of final decision and interpretation for the content hereinabove.