Welcome to the OKCoin API. Please note that v3 is the current version of this document. Please check this document periodically for latest updates.
OKCoin 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 and allows you to:
- place and cancel orders
- see 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 on OKCoin, you can create APIKeys with different permissions to allow you to separate privileges for your APIKeys where one APIKey can trade while another can withdraw.
To access the API, create an APIKey via this link. API instructions and settings are all included in this document.
OKCoin offers both REST and WebSocket APIs. Either can be used for viewing market data,trading, or withdrawals.
REST, or Representational State Transfer, is one of the most popular architectural methods for creating web services, as its framework 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 realized with client requesting server via four HTTP request method. We strongly recommend you to use Rest APIs to perform trades and make 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 only approximately 2 bytes;
- 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 obtain market data.
Please join the OKCoin API community on Telegram (https://t.me/OKCoinAPI), where we will help answer your questions and you can share your experiences with other users.