Register WebSocket
Register a WebSocket connection to receive real-time transaction status updates via persistent connection.
Endpoint
POST https://api.tachyon.rath.fi/api/user/register-websocketRequest Body
websocket-response.json
{}Response
Success Response
websocket-response.json
{
"success": true,
"data": {
"wsUrl": "wss://api.tachyon.rath.fi/ws",
"apiKey": "ws_1234567890abcdef1234567890abcdef"
},
"timestamp": "2025-10-24T12:34:56.789Z"
}Response Fields
| Field | Type | Description |
|---|---|---|
wsUrl | string | WebSocket server URL to connect to |
apiKey | string | Persistent user-specific API key for WebSocket authentication |
Error Response
websocket-response.json
{
"success": false,
"error": {
"code": "WEBSOCKET_REGISTRATION_FAILED",
"message": "Failed to register websocket",
"category": "SERVER_ERROR",
"traceId": "trace_abc123xyz789"
},
"timestamp": "2025-10-24T12:34:56.789Z"
}Example Request
api-request.sh
curl -X POST "https://api.tachyon.rath.fi/api/user/register-websocket" \
-H "Content-Type: application/json" \
-H "apikey: YOUR_API_KEY" \
-d '{}'Connecting to WebSocket
After registration, use the returned credentials to connect:
api-request.sh
# Register and extract credentials
response=$(curl -s -X POST "https://api.tachyon.rath.fi/api/user/register-websocket" \
-H "Content-Type: application/json" \
-H "apikey: YOUR_API_KEY" \
-d '{}')
WS_URL=$(echo $response | jq -r '.data.wsUrl')
WS_API_KEY=$(echo $response | jq -r '.data.apiKey')
# Connect using websocat
websocat "$WS_URL?apiKey=$WS_API_KEY"WebSocket Message Format
Incoming Messages
status-response.json
{
"event": "transaction.status_changed",
"timestamp": "2025-10-24T12:34:56.789Z",
"data": {
"id": "68fa3450539a3c9d28bbca33",
"userId": "68c275846a6ba1c9a2198a8c",
"to": "0x3dbE34f2C21b3B2980d4dc53f3c7E51e39663F49",
"callData": "0x",
"value": "1",
"chainId": 8453,
"status": "EXECUTED",
"executionTxHash": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
"timestamp": "2025-10-23T13:57:36.672Z",
"latency": 2500,
"costUSD": 0.8400561743999754,
"error": null
}
}Event Types
| Event | Description |
|---|---|
transaction.status_changed | Transaction status has changed |
Transaction Status Values
| Status | Description |
|---|---|
NOT_PICKED_UP | Transaction submitted but not yet picked up |
PICKED_UP | Transaction picked up by relayer |
PENDING | Transaction being processed |
EXECUTED | Transaction successfully executed |
FAILED | Transaction execution failed |
NEEDS_TO_BE_RETRIED | Transaction will be retried |
Authentication
Connect to WebSocket using the API key as a query parameter:
wss://api.tachyon.rath.fi/ws?apiKey=ws_1234567890abcdef1234567890abcdefThe apiKey is:
- Persistent: Can be reused for multiple connections
- User-specific: Tied to your account
- Long-lived: Does not expire unless regenerated
Complete Example
terminal
#!/bin/bash
API_KEY="YOUR_API_KEY"
# Register WebSocket
echo "Registering WebSocket..."
ws_response=$(curl -s -X POST "https://api.tachyon.rath.fi/api/user/register-websocket" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d '{}')
# Extract credentials
WS_URL=$(echo $ws_response | jq -r '.data.wsUrl')
WS_API_KEY=$(echo $ws_response | jq -r '.data.apiKey')
echo "WebSocket URL: $WS_URL"
echo "WebSocket API Key: $WS_API_KEY"
# Connect to WebSocket
echo "Connecting to WebSocket..."
websocat "$WS_URL?apiKey=$WS_API_KEY"Last updated on