Chilkat Online Tools

autoit / Binance spot API / Generate a Listen Key (USER_STREAM)

Back to Collection Items

; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.

$oHttp = ObjCreate("Chilkat_9_5_0.Http")
Local $bSuccess

$oHttp.SetRequestHeader "Content-Type","application/json"
$oHttp.SetRequestHeader "X-MBX-APIKEY","{{binance-api-key}}"

Local $oResp = $oHttp.QuickRequest("POST","https://domain.com/sapi/v1/userDataStream/isolated?symbol=BTCUSDT")
If ($oHttp.LastMethodSuccess = False) Then
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

ConsoleWrite($oResp.StatusCode & @CRLF)
ConsoleWrite($oResp.BodyStr & @CRLF)

Curl Command

curl -X POST
	-H "Content-Type: application/json"
	-H "X-MBX-APIKEY: {{binance-api-key}}"
https://domain.com/sapi/v1/userDataStream/isolated?symbol=BTCUSDT

Postman Collection Item JSON

{
  "name": "Generate a Listen Key (USER_STREAM)",
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "Content-Type",
        "type": "text",
        "value": "application/json"
      },
      {
        "key": "X-MBX-APIKEY",
        "value": "{{binance-api-key}}",
        "type": "text"
      }
    ],
    "url": {
      "raw": "{{url}}/sapi/v1/userDataStream/isolated?symbol=BTCUSDT",
      "host": [
        "{{url}}"
      ],
      "path": [
        "sapi",
        "v1",
        "userDataStream",
        "isolated"
      ],
      "query": [
        {
          "key": "symbol",
          "value": "BTCUSDT"
        }
      ]
    },
    "description": "Start a new user data stream.\nThe stream will close after 60 minutes unless a keepalive is sent. If the account has an active `listenKey`, that `listenKey` will be returned and its validity will be extended for 60 minutes.\n\nWeight: 1"
  },
  "response": [
  ]
}