Binance API / SAPI / C2C
BINANCE SAPI · C2C

Retrieve Chat WSS URL, Listen Key and Token API

Obtain real-time WebSocket connection URLs, authentication tokens, and session listenKeys to establish bi-directional live chat streams for peer-to-peer (C2C) orders.

ENDPOINT
GET /sapi/v1/c2c/chat/retrieveChatCredential
Authentication USER_DATA / SIGNED
API Group C2C / Chat
Method GET
Response JSON

Overview

This 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

Request Parameters

Header parameters accepted by the endpoint.

HeaderTypeRequiredDescription
clientTypeSTRINGRequiredClient Device Type initiating the request (e.g., WEB, APP, WEB_MOBILE).
x-gray-envSTRINGOptionalEnvironment flag identifier used for internal gray/stage testing.
x-trace-idSTRINGOptionalCustom client trace ID for request lifecycle tracking and debugging.
x-user-idSTRINGOptionalTarget user identifier for context validation.
i

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

Request Example

Example GET request using cURL to fetch real-time chat credentials.

cURL BASH
curl -X GET \
'https://api.binance.com/sapi/v1/c2c/chat/retrieveChatCredential' \
-H 'clientType: WEB'

03

Response

Example response returned on successful credential retrieval.

RESPONSE 200 OK
{
    "code": "000000",
    "message": "success",
    "data": {
        "wssUrl": "wss://c2c-chat-ws.binance.com/ws",
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
        "listenKey": "d34db33f987654321abcdef123456789",
        "expireTime": 1786957200000
    },
    "success": true
}

Response Fields

FieldTypeDescription
codeSTRINGStandard Binance status code ("000000" indicates success).
messageSTRINGResponse execution feedback or status message.
data.wssUrlSTRINGTarget WebSocket host endpoint for initiating live real-time chat socket connections.
data.tokenSTRINGAuthentication bearer token passed in WebSocket connection handshake.
data.listenKeySTRINGUnique session listenKey representing the authenticated user stream.
data.expireTimeLONGCredential validity expiration timestamp in milliseconds.
successBOOLEANIndicates overall request execution result.

04

How It Works

Workflow for initializing real-time C2C Chat WebSocket streaming.

01 Query Credentials GET /retrieveChatCredential with clientType header.
 
02 Open WebSocket Initiate connection to returned wssUrl.
 
03 Handshake Auth Pass token/listenKey payload to authorize session stream.
 
04 Stream Messages Receive instant live chat updates and push outbound replies.

Common Use Cases

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.

💬
Telegram WhatsApp