Data Streams WebSocket
Domains
| Description | Testnet URL | Mainnet URL |
|---|---|---|
| WebSocket endpoint | wss://ws.testnet-dataengine.chain.link | wss://ws.dataengine.chain.link |
Authentication
All connections to the Data Streams WebSocket API require authentication. For comprehensive documentation on generating authentication headers and implementing the HMAC authentication process, please refer to the Data Streams Authentication page.
Note: If you're using a Data Streams SDK, you don't need to manually generate authentication headers.
Headers
All routes require the following three headers for user authentication:
| Header | Description |
|---|---|
Authorization | The user's unique identifier, provided as a UUID (Universally Unique IDentifier). |
X-Authorization-Timestamp | The current timestamp, with precision up to milliseconds. The timestamp must closely synchronize with the server time, allowing a maximum discrepancy of 5 seconds (by default). |
X-Authorization-Signature-SHA256 | The HMAC (Hash-based Message Authentication Code) signature, generated by hashing parts of the request and its metadata using SHA-256 with a shared secret key. |
WebSocket Connection
Establish a streaming WebSocket connection that sends reports for the given stream ID(s) after they are verified.
Endpoint
/api/v1/ws
| Type | Parameter(s) |
|---|---|
| WebSocket | feedIDs: A comma-separated list of Data Streams stream IDs. |
Sample request
GET /api/v1/ws?feedIDs=<feedID1>,<feedID2>,...
Sample response
{
"report": {
"feedID": "hex encoded feedId",
"fullReport": "a blob containing the report context + body, can be passed unmodified to the contract for verification"
}
}
Connection closures
The server can close a WebSocket connection at any time as part of normal operation. This is expected behavior, not a problem with your request, credentials, or client.
We maintain a connection age limit and close connections when that limit is reached to ensure even load across the system. Clients should reconnect automatically.
The server sends close code 1000 for all server-initiated closures, so the code alone does not indicate the cause. Repeated 1000 closes are not, by themselves, a sign of a problem. If reconnects fail, see Error response codes.
Error response codes
| Status Code | Description |
|---|---|
| 400 Bad Request | This error is triggered when:
|
| 401 Unauthorized User | This error is triggered when:
|
| 429 Too Many Requests | Indicates the request exceeded your account's rate limit. See the Rate Limits and Fair Use Policy page for applicable limits and how to request higher limits. |
| 500 Internal Server | Indicates an unexpected condition encountered by the server, preventing it from fulfilling the request. This error typically points to issues on the server side. |