Hercle
WebSocket

Create Withdraw with Address Params

Sends a withdrawal request with additional parameters for the destination address.

Auth:API Key
Tags:
Funding
Withdrawals
Command Name
WithdrawFundsWithAddressParams

Command Arguments

ClientId
Required
Type:
string
Description:

Custom client ID for tracking (max 36 characters)

Example: "my-client-123"
Asset
Required
Type:
string
Description:

Asset of the address (e.g.: "BTC")

Example: "USDT"
Amount
Required
Type:
number
Description:

Quantity of asset to be withdrawn

Example: 100
DestinationAddress
Required
Type:
string
Description:

Destination address, must be whitelisted

Example: "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb"
DestinationAddressParams
Required
Type:
object
Description:

Destination address parameters (e.g. tag)

Example: {"tag":"payment-001"}
Network
Required
Type:
string
Description:

Network of the address

Example: "Ethereum"
IsInstant
Required
Type:
boolean
Description:

Option for instant withdraw

Example: true

Command Invocation

Command Arguments Example:
[
  "my-client-123",
  "USDT",
  100,
  "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
  {
    "tag": "payment-001"
  },
  "Ethereum",
  true
]
Invocation Example:
connection.invoke('WithdrawFundsWithAddressParams', 'my-client-123', 'USDT', 100.0, '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb', { tag: 'payment-001' }, 'Ethereum', true)

Response Event

Event Name
executionEvents
Subject
account.withdraw.created
FieldTypeDescription
idstringWithdraw ID
clientIdstringClient ID
userIdstringUser ID
namestringUser first name
surnamestringUser last name
companystringUser company
descriptionstring | nullDescription
destinationstringDestination address
destinationParamsobjectDestination parameters, as key-value strings; {} when there are none. Keys depend on the asset and network, e.g. tag (XRP destination tag) or sortcode (GBP Faster Payments).
networkstringNetwork name
amountnumberWithdraw amount
assetstringAsset name
feenumberFee
statusstring
Withdrawal status
CREATED→ Created
CONFIRMING→ Confirming
CONFIRMED→ Confirmed
refIdstringCro or Trx Id added after network submission
isInstantbooleanOption for instant withdraw
timestampstringTimestamp of the withdraw

Example Response

{
  "data": {
    "id": "123abcde-4567-89ab-cdef-1234567890ab",
    "clientId": "68925acb-4f03-48ab-98a9-16b845f21017",
    "userId": "user-123",
    "name": "Mario",
    "surname": "Rossi",
    "company": "",
    "description": "xyz",
    "destination": "xyzwallet",
    "destinationParams": {
      "memo": "payment-001"
    },
    "network": "ethereum",
    "amount": 1,
    "asset": "USDT",
    "fee": 5,
    "status": "CONFIRMING",
    "refId": "ab1234",
    "isInstant": false,
    "timestamp": "2024-03-27T16:03:12.456Z"
  }
}

Error Responses

execution.error
Asset isn't available
Sent when the hub rejects the request before it is processed: an empty ClientId or one longer than 36 characters ("ClientId cant'be null and max length is 36"), an unknown Asset ("Asset isn't available"), a Network not offered for the asset ("Network isn't available"), or an Amount that does not exceed the withdrawal fee ("Withdrawal net amount (amount - fee) is too small"). Nothing is created. data is a JSON string with httpStatusCode 400 and message, without requestKey.
{
  "httpStatusCode": 400,
  "message": "Asset isn't available"
}

Code Examples

const signalR = require('@microsoft/signalr');

const apiKey = 'YOUR_API_KEY_HERE';
const connection = new signalR.HubConnectionBuilder()
  .withUrl('https://publicapi.sandbox.hercle.financial/ExecutionLiveServer/v1', {
    accessTokenFactory: () => apiKey,
  })
  .build();

connection.start()
  .then(() => {
    console.log('Connected to WebSocket');
    
    // Invoke command
    connection.invoke('WithdrawFundsWithAddressParams', "my-client-123", "USDT", 100, "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb", {"tag":"payment-001"}, "Ethereum", false)
      .then(() => {
        console.log('Command sent successfully');
      })
      .catch(err => {
        console.error('Command failed:', err);
      });
  })
  .catch(err => {
    console.error('Connection failed:', err);
  });

// Listen for events
connection.on('executionEvents', (data) => {
  console.log('Received event:', data);
});

SignalR API Tester

Test this command in the sandbox environment

Disconnected

Your API key is only used locally and never stored

Event Log

No events yet. Connect and invoke a command to see events.