Skip to Content
TachyonAPI Reference/api/user/register-websocket

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-websocket

Request 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

FieldTypeDescription
wsUrlstringWebSocket server URL to connect to
apiKeystringPersistent 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

EventDescription
transaction.status_changedTransaction status has changed

Transaction Status Values

StatusDescription
NOT_PICKED_UPTransaction submitted but not yet picked up
PICKED_UPTransaction picked up by relayer
PENDINGTransaction being processed
EXECUTEDTransaction successfully executed
FAILEDTransaction execution failed
NEEDS_TO_BE_RETRIEDTransaction will be retried

Authentication

Connect to WebSocket using the API key as a query parameter:

wss://api.tachyon.rath.fi/ws?apiKey=ws_1234567890abcdef1234567890abcdef

The 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