POST /virtual/virtual-account - Create Batch Virtual Accounts
Description: Creates multiple virtual accounts with provided labels. Each label must be unique and not exceed the maximum number of accounts allowed per user.
PUT /virtual/virtual-account/disable - Disables Virtual Account
Description:
Disables an existing virtual account. Main accounts cannot be disabled.
Parameters:
Response:
{"error": [],"result":"Disabled"}
Error Handling:
Example Code:
constfetch=require('node-fetch');constBASE_URL='https://api.whirlprivacy.io/';constAPI_KEY='your_api_token';constdisableVirtualAccount=async (uuid) => {try {constresponse=awaitfetch(`${BASE_URL}virtual/virtual-account/disable`, { method:'PUT', headers: {'X-API-Key':API_KEY,'Content-Type':'application/json' }, body:JSON.stringify({ uuid: uuid }) });constdata=awaitresponse.json();console.log(data.result); } catch (error) {console.error('Error disabling virtual account:', error); }};// Replace 'uuid_here' with the actual UUID of the virtual accountdisableVirtualAccount('uuid_here');
Here's a detailed Markdown documentation based on the provided code, suitable for copying and pasting into a GitBook. Each function's description aligns with the corresponding HTTP request, detailing expected parameters, behaviors, responses, error management, and sample code for execution.
## GET /virtual/virtual-accounts - List All User Virtual AccountsThis endpoint retrieves all virtual accounts associated with a logged-in user. It can filter accounts based on whether they are active and whether account balances should be included in the response.
### Parameters| Parameter | Type | Description ||-----------|-----------|------------------------------------------------|| `active` | `boolean` | Optional. Filter accounts that are currently active. Defaults to `true`. || `balances`| `boolean` | Optional. Include account balances in the response if `true`. |### Successful Response```json{"error": [],"result": [ {"id":"uuid","label":"Account Label","active":true,"balance":100 } ]}
constfetch=require('node-fetch');constBASE_URL='https://api.whirlprivacy.io/';constAPI_KEY='your_api_token';constgetSpecificVirtualAccount=async (labelOrUuid) => {try {constresponse=awaitfetch(`${BASE_URL}virtual/virtual-account?label=${encodeURIComponent(labelOrUuid)}`, { headers: {'X-API-Key':API_KEY } });constdata=awaitresponse.json();console.log(data.result); } catch (error) {console.error('Error retrieving specific virtual account:', error); }};// Replace 'Account Label' or 'uuid' with the actual label or uuid of the accountgetSpecificVirtualAccount('Account Label');
GET /virtual/virtual-account/search - Search User Virtual Accounts
Description: This endpoint searches for virtual accounts based on a label for a logged-in user.
constfetch=require('node-fetch');constBASE_URL='https://api.whirlprivacy.io/';constAPI_KEY='your_api_token';constsearchUserVirtualAccounts=async (searchLabel) => {try { const response = await fetch(`${BASE_URL}virtual/virtual-account/search?label=${encodeURIComponent(searchLabel)}`, {
headers: {'X-API-Key': API_KEY } });constdata=awaitresponse.json();console.log(data.result); } catch (error) { console.error('Error searching virtual accounts:', error); }};// Replace 'Search Label' with the actual label to searchsearchUserVirtualAccounts('Search Label');
GET /virtual/virtual-accounts - List User Virtual Accounts
Description: Retrieves a list of all virtual accounts associated with the logged-in user. This includes the ability to filter accounts based on their active status and whether to include balance information.
Below is a markdown documentation for the API request described in the code you provided, specifically for retrieving the asset balance of a virtual account. This description is tailored to be integrated into a GitBook for project documentation.
GET /virtual/virtual-account/balance - Retrieve Asset Balance of a Virtual Account
Description: Retrieves the balance of the specified asset in a virtual account identified by either UUID or label. If the account is the user's main account or matches the given UUID or label, the balance of the asset is fetched. This endpoint is useful for financial tracking and management within the virtual account ecosystem.