Obtain real-time WebSocket connection URLs, authentication tokens, and session listenKeys to establish bi-directional live chat streams for peer-to-peer (C2C) orders.
/sapi/v1/c2c/chat/retrieveChatCredentialThis endpoint provisions dynamic connection credentials for Binance's real-time C2C (P2P) Chat WebSocket service. It returns the target WebSocket secure URI (wssUrl), temporary authentication credentials (token), and the user session stream key (listenKey).
Automated customer support bots, instant notification daemons, and live trading terminals invoke this endpoint prior to establishing WebSocket sockets to transmit and receive live buyer/seller chat messages with sub-second latency.
01
Header parameters accepted by the endpoint.
| Header | Type | Required | Description |
|---|---|---|---|
clientType | STRING | Required | Client Device Type initiating the request (e.g., WEB, APP, WEB_MOBILE). |
x-gray-env | STRING | Optional | Environment flag identifier used for internal gray/stage testing. |
x-trace-id | STRING | Optional | Custom client trace ID for request lifecycle tracking and debugging. |
x-user-id | STRING | Optional | Target user identifier for context validation. |
WebSocket Connection Setup
Use the returned wssUrl along with the authorized token / listenKey to open persistent WebSocket streams. Reconnect and refresh credentials periodically or upon receiving connection termination frames.
02
Example GET request using cURL to fetch real-time chat credentials.
curl -X GET \
'https://api.binance.com/sapi/v1/c2c/chat/retrieveChatCredential' \
-H 'clientType: WEB'03
Example response returned on successful credential retrieval.
{
"code": "000000",
"message": "success",
"data": {
"wssUrl": "wss://c2c-chat-ws.binance.com/ws",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"listenKey": "d34db33f987654321abcdef123456789",
"expireTime": 1786957200000
},
"success": true
}| Field | Type | Description |
|---|---|---|
code | STRING | Standard Binance status code ("000000" indicates success). |
message | STRING | Response execution feedback or status message. |
data.wssUrl | STRING | Target WebSocket host endpoint for initiating live real-time chat socket connections. |
data.token | STRING | Authentication bearer token passed in WebSocket connection handshake. |
data.listenKey | STRING | Unique session listenKey representing the authenticated user stream. |
data.expireTime | LONG | Credential validity expiration timestamp in milliseconds. |
success | BOOLEAN | Indicates overall request execution result. |
04
Workflow for initializing real-time C2C Chat WebSocket streaming.
wssUrl.Real-Time Chatbots
Connect automated conversational agents to process incoming buyer payment questions instantly with zero polling lag.
Instant Push Notifications
Listen to live trade chat streams to trigger immediate desktop, Telegram, or SMS alerts when counterparty replies.
Custom Merchant Terminal Chat
Embed high-performance bi-directional order chat widgets directly inside custom web or desktop merchant apps.