Authentication

You must authenticate yourself when subscribing to any of the sFOX WebSocket feeds.

All WebSocket feeds require authentication.

Authentication commands should be JSON with the following properties:

Property
Type
Command

type

string

"authenticate"

apiKey

string

"<YOUR-API-KEY>"

Authentication Message

To authenticate yourself to the WebSocket API, you must send an authenticate message to the server with an API key for your account. This message is mandatory as all WebSocket feeds require authentication.

Authenticate Message

// Request -> Authenticate
{
    "type": "authenticate", 
    "apiKey": "<REPLACE WITH YOUR API KEY>"
}

Once a authenticate message is received the server responds with an authenticate message that specifies whether authentication succeeded or failed.

// Response -> Authenticate
{
    "type": "success",
    "sequence": 1,
    "timestamp": 1727391983733911769,
    "payload": {
        "action": "authenticate"
    },
    "action": "authenticate"
}

Example Code

const authMessage = {
   type: 'authenticate',
   apiKey: '<API_KEY>',
}
ws.send(JSON.stringify(authMessage))

Last updated