You can verify the data stream items currently subscribed to through the WebSocket connection.
Method
Unlike data subscription request messages that include the "type" field, the request message for retrieving the list of subscribed streams includes the "method" field and functions as an operation message. Similar to data subscription request messages, the request is sent as a JSON array containing the Ticket field, Format field, and the "method" field.
Precautions When Specifying the Format FieldWhen requesting the list of subscribed streams, please specify the Format field in the same format as used during the actual data subscription request. Requesting in a different format will change the format of the currently subscribed data streams as well, so caution is advised. For example, if you have been receiving real-time streams in SIMPLE format but request this operation in DEFAULT format, the subscribed real-time streams will also be received in DEFAULT format.
WebSocket Endpoint
List Subscriptions can be used with both Public and Private WebSocket connections.
| Type | Endpoint |
|---|---|
| Public | wss://{region}-api.upbit.com/websocket/v1 |
| Private | wss://{region}-api.upbit.com/websocket/v1/private |
Use the endpoint for your region and the WebSocket connection whose subscriptions you want to retrieve.
| Region | Public Endpoint | Private Endpoint |
|---|---|---|
| Singapore | wss://sg-api.upbit.com/websocket/v1 | wss://sg-api.upbit.com/websocket/v1/private |
| Indonesia | wss://id-api.upbit.com/websocket/v1 | wss://id-api.upbit.com/websocket/v1/private |
| Thailand | wss://th-api.upbit.com/websocket/v1 | wss://th-api.upbit.com/websocket/v1/private |
Request Message Format
To retrieve the list of data streams currently subscribed to through an active WebSocket connection, create a JSON Object with the structure below and include it in the request message.
For the complete WebSocket request message specification, including the Ticket and Format Objects, refer to the WebSocket Usage and Error Guide.
| Field Name | Type | Description | Required | Default |
|---|---|---|---|---|
method | String | Request method. Set to LIST_SUBSCRIPTIONS to retrieve the currently subscribed data streams. | Required |
Precautions When Specifying the Format Field
When requesting the list of subscribed streams, specify the Format Object in the same format as the current subscription. Using a different format also changes the format of the currently subscribed data streams.
Response Specification
| Field Name | Abbreviation | Description | Type | Value |
|---|---|---|---|---|
| method | mthd | Request method | String | LIST_SUBSCRIPTIONS |
| result | rslt | List of currently subscribed data streams | List of Objects | |
| result.type | rslt.ty | Subscribed data type | String | |
| result.codes | rslt.cds | List of subscribed pair codes | List of String | |
| result.level | rslt.lv | Orderbook aggregation unit | Double | |
| ticket | tckt | Request ticket identifier | String |
Examples
Request Example
[
{
"ticket": "0e66c0ac-7e13-43ef-91fb-2a87c2956c49"
},
{
"method": "LIST_SUBSCRIPTIONS"
}
]Response Examples
Public WebSocket
{
"method": "LIST_SUBSCRIPTIONS",
"result": [
{
"type": "ticker",
"codes": ["BTC-ETH"]
},
{
"type": "orderbook",
"codes": ["BTC-ETH"]
}
],
"ticket": "unique uuid"
}Private WebSocket
{
"method": "LIST_SUBSCRIPTIONS",
"result": [
{
"type": "myAsset"
},
{
"type": "myOrder",
"codes": ["BTC-ETH"]
},
{
"type": "announcement"
}
],
"ticket": "unique uuid"
}Error Information
If an error occurs after establishing a WebSocket connection and sending a request, the response is returned in the following JSON format.
{
"error": {
"name": "ERROR_CODE",
"message": "ERROR_MESSAGE"
}
}The main error codes that may be returned are listed below.
error.name | Reason | Recommended Action |
|---|---|---|
INVALID_AUTH | Missing authentication information or authentication token verification failure | When using a Private WebSocket endpoint, make sure you are connected to the correct endpoint and that the Authorization header contains a valid authentication token. |
WRONG_FORMAT | Invalid request message format | Make sure the request message follows the WebSocket request format. Check the Object structure as well as the type and value of each field. |
NO_TICKET | Missing ticket field | Make sure the request message includes a Ticket Object and the ticket field. |
NO_TYPE | Missing type field | Make sure the Data Type Object includes the type field and specify the data type to subscribe to. |
NO_CODES | Missing codes field | Check whether the subscribed data type requires the codes field and specify the trading pair codes to receive. |
INVALID_PARAM | Missing required request field or unsupported value | Make sure all required fields are included and that each field contains a supported value. |
Too Many Requests | Request rate limit exceeded | Wait until another request can be made, then retry. Refer to the Rate Limits section for details. |
I'm a teapot | Requests are temporarily restricted due to repeated Too Many Requests errors | Check the restriction period included in the response and retry after the specified time has passed. |
Rate Limits
APIs are grouped into Rate Limit groups. APIs within the same group share the same per-second request limit.
The maximum number of requests allowed per Rate Limit group may change after prior notice according to service policy, and additional restrictions may be applied depending on service conditions. For details, refer to Rate Limits.
| Rate Limit Group | Policy | Applied By |
|---|---|---|
websocket-connect | Up to 5 connections per second | Public : IP Private: Account |
websocket-message | Up to 5 messages per second and 100 messages per minute | Connection |
Managing WebSocket Rate LimitsUnlike REST API responses, WebSocket does not provide the number of remaining requests. Clients should track the number of WebSocket connection attempts and data request messages they send to ensure compliance with the applicable rate limits. If a rate limit is reached, wait for an appropriate period before sending another request..
