### Example Balances API JSON Response Source: https://docs.hifibridge.com/docs/wallets/balances An example of the JSON response format from the Balances API. It includes the raw balance, a display-formatted balance, and detailed information about the token. ```json { "balance": "10000", "displayBalance": "0.01", "tokenInfo": { "chain": "POLYGON_MAINNET", "contractAddress": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359", "assetType": "ERC20", "quantity": "10000", "symbol": "USDC", "decimals": 6 } } ``` -------------------------------- ### Batch Transfer Destination Array Example Source: https://docs.hifibridge.com/docs/transfers/features/batch-transfers An example of the `batch` array within the destination object, showing multiple recipients, each with their `userId` and the `amount` to be transferred. ```json { "batch": [ { "amount": "0.04", "userId": "6a13bd30-b3a3-4d44-af33-0b32e58261be" }, { "amount": "0.05", "userId": "6a13bd30-b3a3-4d44-af33-0b32e58261be" }, { "amount": "0.06", "userId": "6a13bd30-b3a3-4d44-af33-0b32e58261be" }, { "amount": "0.03", "userId": "6a13bd30-b3a3-4d44-af33-0b32e58261be" }, { "amount": "0.03", "userId": "6a13bd30-b3a3-4d44-af33-0b32e58261be" } ] } ``` -------------------------------- ### Batch Wallet Transfer Source Details JSON Example Source: https://docs.hifibridge.com/docs/transfers/wallets This JSON object details the source wallet information for a batch transfer. It includes the user ID, the wallet address, and the type of wallet (e.g., INDIVIDUAL). ```json { "userId": "6a13bd30-b3a3-4d44-af33-0b32e58261be", "walletAddress": "0x99a8c5ED386d217BC6ff0AA1b3585606D475432B", "walletType": "INDIVIDUAL" } ``` -------------------------------- ### Get Wallet Balance with cURL Source: https://docs.hifibridge.com/docs/wallets/balances Demonstrates how to use cURL to call the Balances API to retrieve a wallet's balance for a specific currency and chain. Requires an API key for authorization. ```bash curl -X GET "https://sandbox.hifibridge.com/v2/users/{userId}/wallets/balance?chain=POLYGON¤cy=usdc" \ -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### Batch Wallet Transfer Receipt Details JSON Example Source: https://docs.hifibridge.com/docs/transfers/wallets This JSON object provides the receipt details for a batch wallet transfer, including the transaction hash on the blockchain and the user operation hash (userOpHash) if applicable, confirming the on-chain execution. ```json { "transactionHash": "0x57f0cd3429ea425d982882243428ef4a1eda5f1be2157c1b34ea48b49b24fe7f", "userOpHash": "0xef7bdb071b1fcfb5df629bd4d27ffa6dc32d0a5df676f26fb8c25311df1185ac" } ``` -------------------------------- ### Batch Wallet Transfer Structure JSON Example Source: https://docs.hifibridge.com/docs/transfers/wallets This JSON structure represents the details of a completed batch wallet transfer. It includes transfer type, unique identifiers, timestamps, chain, currency, contract address, status, and nested objects for source, destination, and receipt information. ```json { "transferType": "WALLET.TRANSFER.BATCH", "transferDetails": { "id": "879af7af-67bf-469f-b718-d262a39d4857", "requestId": "14a84906-b72e-4847-b34d-51b9048fa6a5", "createdAt": "2025-04-05T00:55:50.609Z", "updatedAt": "2025-04-05T00:56:33.236Z", "chain": "POLYGON", "currency": "usdc", "contractAddress": "0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582", "status": "COMPLETED", "source": { /* Source */ }, "destination": { /* Destination */ }, "receipt": { /* Receipt */ } } } ``` -------------------------------- ### Batch Wallet Transfer Destination Details JSON Example Source: https://docs.hifibridge.com/docs/transfers/wallets This JSON object outlines the destination details for a batch transfer, specifying an array of recipients, each with an amount, user ID, and wallet address. This enables sending funds to multiple addresses in one transaction. ```json { "batch": [ { "amount": "0.04", "userId": "6a13bd30-b3a3-4d44-af33-0b32e58261be", "walletAddress": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e" }, { "amount": "0.05", "userId": "a1f70737-3844-4782-a321-ad481108a8ec", "walletAddress": "0x848732f6c834E05b17C56fa01E83EE095f72C3c3" } ] } ``` -------------------------------- ### Batch Transfer Approval Details JSON Example Source: https://docs.hifibridge.com/docs/transfers/wallets This JSON structure shows the approval details for a batch transfer that requires multi-party authorization. It includes the approval ID, status, timestamps, associated transfer information, and a list of votes from designated approvers. ```json { "receipt": { "approval": { "id": "006737ca-42d5-4780-b3c2-aeb63279c591", "status": "PENDING", "createdAt": "2025-02-03T16:11:36.654998+00:00", "updatedAt": "2025-02-03T16:12:41.503+00:00", "transferId": "006737ca-42d5-4780-b3c2-aeb63279c591", "transferType": "WALLET.TRANSFER.BATCH", "fromDashboard": true, "initiatorProfileId": "aec66b02-4f3f-471c-839a-94820b36abb2", "votes": [ { "approverId": "aec66b02-4f3f-471c-839a-94820b36abb2", "vote": "APPROVE", "comment": "Approved for processing", "createdAt": "2025-02-03T16:12:41.503+00:00" } ] } } } ``` -------------------------------- ### Get Wallet Deposits - Bash Source: https://docs.hifibridge.com/docs/wallets/deposits Retrieves a paginated list of deposit records for a user's wallet. This API call requires an API key for authorization and can be filtered using query parameters such as chain, currency, and status. ```bash curl -X GET "https://sandbox.hifibridge.com/v2/users/{userId}/wallets/deposits" \ -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### GET /v2/users/{userId}/wallets/deposits Source: https://docs.hifibridge.com/docs/wallets/deposits Retrieves a paginated list of deposit records for incoming blockchain transfers to a user's wallet. Supports filtering by chain, currency, status, date range, and amount. ```APIDOC ## GET /v2/users/{userId}/wallets/deposits ### Description Retrieves a list of incoming blockchain transfer deposits to a user's wallet. This endpoint allows for filtering and pagination of deposit records. ### Method GET ### Endpoint `/v2/users/{userId}/wallets/deposits` ### Parameters #### Path Parameters - **userId** (string) - Required - The unique identifier of the user. #### Query Parameters - **chain** (string) - Required - The blockchain network (e.g., `POLYGON`, `ETHEREUM`, `SOLANA`, `BASE`). - **currency** (string) - Required - The type of currency (e.g., `usdc`, `usdt`, `usdHifi`). - **status** (string) - Optional - The status of the deposit (e.g., `CONFIRMED`, `COMPLETED`). - **createdAfter** (date) - Optional - Filter deposits created after a specific date (YYYY-MM-DD). - **createdBefore** (date) - Optional - Filter deposits created before a specific date (YYYY-MM-DD). - **limit** (string) - Optional - The number of results to return per page (1-100). Defaults to 10. - **minAmount** (number) - Optional - The minimum deposit amount to filter by. ### Request Example ```bash curl -X GET "https://sandbox.hifibridge.com/v2/users/{userId}/wallets/deposits?chain=POLYGON¤cy=usdc&limit=50" -H "Authorization: Bearer YOUR_API_KEY" ``` ### Response #### Success Response (200) - **count** (integer) - The total number of deposit records. - **records** (array) - An array of deposit record objects. - **userId** (string) - ID of the user who owns the wallet. - **id** (string) - Unique identifier for this deposit record. - **createdAt** (string) - Timestamp when the deposit was first detected. - **updatedAt** (string) - Timestamp when the deposit record was last updated. - **wallet** (object) - Information about the wallet receiving the deposit. - **id** (string) - Unique identifier for the wallet. - **address** (string) - Blockchain address of the wallet. - **chain** (string) - Blockchain network (e.g., `POLYGON`, `ETHEREUM`). - **walletType** (string) - Type of wallet (e.g., `INDIVIDUAL`, `BUSINESS`). - **transaction** (object) - Details of the blockchain transaction. - **transactionHash** (string) - Blockchain transaction hash. - **chain** (string) - Blockchain network where the transaction occurred. - **currency** (string) - Token symbol (e.g., `usdc`, `usdt`). - **status** (string) - Transaction status (e.g., `COMPLETED`, `PENDING`, `FAILED`). - **sourceAddress** (string) - Address that sent the funds. - **destinationAddress** (string) - Address that received the funds. - **contractAddress** (string) - Smart contract address of the token. - **amount** (string) - Human-readable amount (e.g., "19"). - **unitAmount** (string) - Raw amount in smallest token unit (e.g., "19000000"). - **nextCursor** (string) - A cursor for fetching the next page of results. #### Response Example ```json { "count": 1, "records": [ { "userId": "f4c99c2f-ce05-4f61-8ed6-9064a5689197", "id": "2e084846-00d6-5e4c-806f-eac45e197108", "createdAt": "2025-06-25T15:47:16.983978+00:00", "updatedAt": "2025-06-25T15:47:16.983978+00:00", "wallet": { "id": "24b4917d-694e-4d81-ace8-9ba5261b6f4e", "address": "0x0B95D270400BE4319EAFbfDD82F6C38B59ab54Ef", "chain": "POLYGON", "walletType": "INDIVIDUAL" }, "transaction": { "transactionHash": "0xe5284c4cb35ae9b5eb0ae23b840032f320b87b63f8967ee9b67ee09dfe6a194a", "chain": "POLYGON", "currency": "usdc", "status": "COMPLETED", "sourceAddress": "0x0B95D270400BE4319EAFbfDD82F6C38B59ab54Ef", "destinationAddress": "0x0B95D270400BE4319EAFbfDD82F6C38B59ab54Ef", "contractAddress": "0x41E94Eb019C0762f9Bfcf9Fb1E58725BfB0e7582", "amount": "19", "unitAmount": "19000000" } } ], "nextCursor": "2025-06-25T15:47:16.983978+00:00" } ``` ``` -------------------------------- ### Onramp Deposit Instructions (JSON) Source: https://docs.hifibridge.com/docs/transfers/onramps Contains the necessary information for the user to deposit fiat currency to complete the onramp. It includes bank details, beneficiary information, the exact amount and currency to send, and a crucial reference ID. This JSON object guides the user on how to fund the transaction. ```json { "bankName": "Bank of Nowhere", "bankAddress": "1800 North Pole St., Orlando, FL 32801", "accountNumber": "11223344556677", "routingNumber": "123456789", "iban": "", "bic": "", "beneficiary": { "name": "HiFi Bridge", "address": "1234 Elm St, Springfield, IL 12345" }, "referenceId": "BRGWX4J5BB7MP693BT8Z", "amount": "10.0", "currency": "usd", "instruction": "Please deposit the exact amount of currency to the bank account provided. Use the reference ID as the deposit reference." } ``` -------------------------------- ### Create and Accept Swap Source: https://docs.hifibridge.com/docs/transfers/swaps Initiate a swap request, review the quote including exchange rates and fees, and then accept the transaction to complete the stablecoin exchange. ```APIDOC ## POST /websites/hifibridge/swaps ### Description Initiates a swap request to exchange one stablecoin for another within the same blockchain network. ### Method POST ### Endpoint /websites/hifibridge/swaps ### Parameters #### Request Body - **source** (object) - Required - Details of the source currency. - **currency** (string) - Required - The currency to be swapped (e.g., "usdc"). - **amount** (number) - Required - The amount of currency to swap. - **chain** (string) - Required - The blockchain network (e.g., "POLYGON"). - **userId** (string) - Required - The user's unique identifier. - **destination** (object) - Required - Details of the destination currency. - **currency** (string) - Required - The target currency (e.g., "usdt"). - **userId** (string) - Required - The user's unique identifier. - **chain** (string) - Required - The blockchain network (e.g., "POLYGON"). - **walletAddress** (string) - Required - The recipient's wallet address. - **externalWalletId** (string) - Optional - External wallet identifier. - **amount** (number) - Optional - The amount to receive (if specified, otherwise calculated). ### Request Example ```json { "source": { "currency": "usdc", "amount": 10, "chain": "POLYGON", "userId": "05179f69-1988-4b46-a847-dd4eea0984d6" }, "destination": { "currency": "usdt", "userId": "05179f69-1988-4b46-a847-dd4eea0984d6", "chain": "POLYGON", "walletAddress": "0xe5727a4B1d93A26D6A7Adfaae145EFa41ED7f204" } } ``` ### Response #### Success Response (200) - **transferType** (string) - Type of transfer, e.g., "WALLET.SWAP". - **transferDetails** (object) - Contains details about the swap transaction. - **id** (string) - Unique identifier for the swap. - **requestId** (string) - Identifier for the swap request. - **status** (string) - Current status of the swap (e.g., "COMPLETED", "PROCESSING"). - **createdAt** (string) - Timestamp when the swap was created. - **updatedAt** (string) - Timestamp when the swap was last updated. - **source** (object) - Details of the source currency. - **destination** (object) - Details of the destination currency. - **error** (string) - Error message if the swap failed, otherwise null. - **errorDetails** (string) - Detailed error information if applicable. - **quoteInformation** (object) - Information about the exchange rate and quote validity. - **sendGross** (object) - Total amount being sent (including fees). - **amount** (string) - The gross amount to send. - **currency** (string) - The currency being sent. - **sendNet** (object) - Net amount being sent after fees. - **amount** (string) - The net amount to send. - **currency** (string) - The currency being sent. - **receiveGross** (object) - Total amount expected to receive. - **amount** (string) - The gross amount to receive. - **currency** (string) - The currency to receive. - **receiveNet** (object) - Net amount expected to receive after fees. - **amount** (string) - The net amount to receive. - **currency** (string) - The currency to receive. - **rate** (string) - The exchange rate. - **expiresAt** (string) - Timestamp when the quote expires. - **billingInformation** (object) - Information about fees applied to the swap. - **fees** (array) - List of fees applied. - **id** (string) - Unique identifier for the fee. - **amount** (number) - The amount of the fee. - **currency** (string) - The currency of the fee. - **type** (string) - The type of fee (e.g., "EXCHANGE_FEE"). - **timing** (string) - When the fee is applied (e.g., "ON_INVOICE"). #### Response Example ```json { "transferType": "WALLET.SWAP", "transferDetails": { "id": "dc923cc1-d74b-58f6-9fe4-9e9c6eb8dc37", "requestId": "1ab3e6e0-4839-4dbe-89c3-b06d9645ae86", "status": "COMPLETED", "createdAt": "2025-08-20T03:55:29.437108+00:00", "updatedAt": "2025-08-20T04:08:10.837+00:00", "source": { "currency": "usdc", "amount": 10, "chain": "POLYGON", "userId": "05179f69-1988-4b46-a847-dd4eea0984d6" }, "destination": { "currency": "usdt", "userId": "05179f69-1988-4b46-a847-dd4eea0984d6", "externalWalletId": null, "amount": null, "chain": "POLYGON", "walletAddress": "0xe5727a4B1d93A26D6A7Adfaae145EFa41ED7f204" }, "error": null, "errorDetails": null, "quoteInformation": { "sendGross": { "amount": "10", "currency": "usdc" }, "sendNet": { "amount": "10", "currency": "usdc" }, "receiveGross": { "amount": "10", "currency": "usdc" }, "receiveNet": { "amount": "10", "currency": "usdc" }, "rate": "1", "expiresAt": "2025-08-20T03:55:59.539+00:00" }, "billingInformation": { "fees": [ { "id": "2ca381ec-9498-52f5-9a27-d0e392b2626b", "amount": 0.01, "currency": "USD", "type": "EXCHANGE_FEE", "timing": "ON_INVOICE" } ] } } } ``` ``` -------------------------------- ### Create Batch Transfer Request (cURL) Source: https://docs.hifibridge.com/docs/transfers/features/batch-transfers This snippet demonstrates how to initiate a batch transfer using cURL. It includes the endpoint, headers, and a JSON payload specifying the currency, chain, source, and a list of destinations with amounts. The `requireApproval` flag controls whether an explicit approval is needed. ```bash curl --request POST \ --url https://production.hifibridge.com/v2/wallets/transfers/batches \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --data '{ \ "requestId": "123e4567-e89b-12d3-a456-426614174000", \ "currency": "usdc", \ "chain": "POLYGON", \ "source": { \ "userId": "a1f70737-3844-4782-a321-ad481108a8ec" \ }, \ "destination": { \ "batch": [ \ /* Batch */ \ ] \ }, \ "requireApproval": false \ }' ``` -------------------------------- ### GET /v2/users/{userId}/wallets/balance Source: https://docs.hifibridge.com/docs/wallets/balances Retrieves the real-time balance of funds for a specific user's wallet, filtered by currency and blockchain network. ```APIDOC ## GET /v2/users/{userId}/wallets/balance ### Description Retrieves the real-time balance of funds for a specific user's wallet, filtered by currency and blockchain network. ### Method GET ### Endpoint `/v2/users/{userId}/wallets/balance` ### Parameters #### Path Parameters - **userId** (string) - Required - The unique identifier of the user. #### Query Parameters - **chain** (string) - Required - The blockchain network to query. Allowed Values: `POLYGON`, `ETHEREUM`, `SOLANA`, `BASE` - **currency** (string) - Required - The type of currency to query. Allowed Values: `usdc`, `usdt`, `usdHifi` ### Request Example ```bash curl -X GET "https://sandbox.hifibridge.com/v2/users/{userId}/wallets/balance?chain=POLYGON¤cy=usdc" \ -H "Authorization: Bearer YOUR_API_KEY" ``` ### Response #### Success Response (200) - **balance** (string) - Raw balance amount in the token's smallest unit. - **displayBalance** (string) - Human-readable balance amount formatted for display. - **tokenInfo** (object) - Metadata about the token. - **chain** (string) - Blockchain network where the token is held. - **contractAddress** (string) - Smart contract address of the token. - **assetType** (string) - Token standard (e.g., `ERC20`). - **quantity** (string) - Total token supply (not the user's balance). - **symbol** (string) - Token symbol (e.g., `USDC`). - **decimals** (integer) - Number of decimal places used by the token. #### Response Example ```json { "balance": "10000", "displayBalance": "0.01", "tokenInfo": { "chain": "POLYGON_MAINNET", "contractAddress": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359", "assetType": "ERC20", "quantity": "10000", "symbol": "USDC", "decimals": 6 } } ``` ``` -------------------------------- ### POST /v2/kyc-link Source: https://docs.hifibridge.com/docs/users/features/kyc-link Generates a secure KYC link for user onboarding and verification. It can create a new user or submit KYC for an existing one. Supports configuration of redirect behavior and branding with a template. ```APIDOC ## POST /v2/kyc-link ### Description Generates a secure KYC link for user onboarding and verification. This endpoint allows for the creation of new users or the submission of KYC information for existing users. It also supports configuring redirect URLs and customizing the user experience with templates. ### Method POST ### Endpoint /v2/kyc-link ### Parameters #### Query Parameters None #### Request Body - **userType** (string) - Required - Specifies the type of user (e.g., "INDIVIDUAL"). - **rails** (array of strings) - Required - Specifies the rails for verification (e.g., ["USD"]). - **redirectUrl** (string) - Optional - The URL to redirect the user to after KYC completion. The User ID will be appended as a query parameter. - **recipientEmail** (string) - Optional - The email address to send the KYC link to. Only available in production. - **templateId** (string) - Optional - An identifier for a template to customize the user interface with a company logo. ### Request Example ```json { "userType": "INDIVIDUAL", "rails": [ "USD" ], "redirectUrl": "https://yourapp.com/kyc-complete", "recipientEmail": "user@example.com", "templateId": "xyz" } ``` ### Response #### Success Response (200) - **kycLink** (string) - The generated secure KYC link. - **userId** (string) - The ID of the user, either newly created or existing. #### Response Example ```json { "kycLink": "https://hifibridge.com/kyc/start?token=some_token_here", "userId": "user_123456789" } ``` ``` -------------------------------- ### Create Offramp Transaction with Developer Fees (Bash) Source: https://docs.hifibridge.com/docs/transfers/features/developer-fees This code snippet demonstrates how to create an offramp transaction using a cURL command, including the configuration of developer fees. It supports both percentage and flat fee types, specifying the value and beneficiary wallet address for each. The fees are added on top of the offramp amount and credited in stablecoin. ```bash curl --request POST \ --url https://production.hifibridge.com/v2/offramps \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --data '{ \ "requestId": "{{uuid}}", \ "source": { \ "userId": "{{user_id}}" \ "amount": "100", \ "currency": "usdc", \ "chain": "SOLANA" \ }, \ "destination": { \ "currency": "usd", \ "userId": "{{user_id}}", \ "accountId": "{{offramp_account_id}}" \ }, \ "developerFee": { \ "fees": [ \ { \ "type": "PERCENTAGE", \ "value": "0.002", \ "walletAddress": "9eyUwauqs8YgU9Hg9cdGW3WmuG2Uud2y9TruZbokeVD8" \ }, \ { \ "type": "FLAT", \ "value": "5", \ "walletAddress": "pumpCmXqMfrsAkQ5r49WcJnRayYRqmXz6ae8H7H9Dfn" \ } \ ] \ } \ }' ``` -------------------------------- ### Create Transfer with Approval (API) Source: https://docs.hifibridge.com/docs/transfers/features/transfer-approvals Demonstrates how to create a stablecoin transfer that requires explicit approval before execution using the HifiBridge API. This utilizes the `requireApproval: true` parameter for initiating the maker-checker workflow. The request specifies currency, amount, chain, source, and destination user IDs. ```bash curl --request POST \ --url https://production.hifibridge.com/v2/wallets/transfers \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --data '{ "currency": "usdc", "amount": 100, "chain": "POLYGON", "source": { "userId": "user-id" }, "destination": { "userId": "user-id" }, "requireApproval": true }' ``` -------------------------------- ### POST /wallets/transfers/batches Source: https://docs.hifibridge.com/docs/transfers/features/transfer-approvals Initiates a batch stablecoin transfer, which can also be configured to require approval. ```APIDOC ## POST /wallets/transfers/batches ### Description Creates a batch stablecoin transfer. Similar to single transfers, this endpoint supports the `requireApproval` parameter to enforce a maker-checker workflow. ### Method POST ### Endpoint /v2/wallets/transfers/batches ### Parameters #### Request Body - **transfers** (array) - Required - A list of individual transfer objects. - Each object should have `currency`, `amount`, `source`, and `destination` fields. - **requireApproval** (boolean) - Optional - If `true`, the batch transfer requires explicit approval. Defaults to `false`. ### Request Example ```json { "transfers": [ { "currency": "usdc", "amount": 50, "source": {"userId": "user-id-1"}, "destination": {"userId": "user-id-2"} }, { "currency": "usdc", "amount": 75, "source": {"userId": "user-id-1"}, "destination": {"userId": "user-id-3"} } ], "requireApproval": true } ``` ### Response #### Success Response (200) - **batchId** (string) - The unique identifier for the created batch transfer. - **status** (string) - The status of the batch transfer. #### Response Example ```json { "batchId": "batch_abcde", "status": "PENDING_APPROVAL" } ``` ``` -------------------------------- ### Create Virtual Account using cURL Source: https://docs.hifibridge.com/docs/transfers/features/virtual-accounts This snippet demonstrates how to create a virtual account using a cURL command. It specifies the source and destination currencies, the destination blockchain network, and optionally an external wallet ID. The API supports multiple payment rails for receiving deposits and automatic conversion to stablecoins. ```bash curl --request POST \ --url https://production.hifibridge.com/v2/users/userId/virtual-accounts \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --data '{ "sourceCurrency": "usd", "destinationCurrency": "usdc", "destinationChain": "POLYGON", "externalWalletId": "string" }' ``` -------------------------------- ### Create Virtual Account Source: https://docs.hifibridge.com/docs/transfers/features/virtual-accounts Creates a dedicated bank account for fiat-to-stablecoin conversions. Deposits are automatically converted to stablecoins and sent to a specified wallet. ```APIDOC ## POST /v2/users/{userId}/virtual-accounts ### Description Creates a dedicated bank account for fiat-to-stablecoin conversions. Deposits are automatically converted to stablecoins and sent to a specified wallet. ### Method POST ### Endpoint `/v2/users/{userId}/virtual-accounts` ### Parameters #### Path Parameters - **userId** (string) - Required - The ID of the user for whom to create the virtual account. #### Query Parameters None #### Request Body - **sourceCurrency** (string) - Required - The fiat currency to be deposited (e.g., "usd"). - **destinationCurrency** (string) - Required - The stablecoin currency to be received (e.g., "usdc"). - **destinationChain** (string) - Optional - The blockchain network for the destination currency (e.g., "POLYGON"). Either `destinationChain` or `externalWalletId` must be provided. - **externalWalletId** (string) - Optional - The ID of an external wallet. If specified, the system will use the associated wallet's chain and address. Either `destinationChain` or `externalWalletId` must be provided. ### Request Example ```json { "sourceCurrency": "usd", "destinationCurrency": "usdc", "destinationChain": "POLYGON", "externalWalletId": "string" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message of successful account creation. - **accountInfo** (object) - Detailed information about the created virtual account. - **id** (string) - The unique identifier of the virtual account. - **userId** (string) - The ID of the user associated with the account. - **source** (object) - Configuration for incoming fiat deposits. - **paymentRail** (array) - List of supported payment methods (e.g., ["ach", "wire", "rtp", "swift"]). - **currency** (string) - The source fiat currency. - **destination** (object) - Configuration for outgoing stablecoin transfers. - **chain** (string) - The blockchain network for the stablecoin. - **currency** (string) - The destination stablecoin currency. - **walletAddress** (string) - The wallet address where stablecoins will be sent. - **externalWalletId** (string | null) - The ID of the external wallet, if provided. - **status** (string) - The current status of the account (e.g., "activated"). - **depositInstructions** (object) - Instructions for making deposits to the virtual account. - **bankName** (string) - The name of the bank associated with the account. - **bankAddress** (string) - The address of the bank. - **swiftCode** (string) - The SWIFT code for international transfers. - **beneficiary** (object) - Beneficiary details. - **name** (string) - The name of the beneficiary. - **address** (string) - The address of the beneficiary. - **ach** (object) - ACH specific details. - **routingNumber** (string) - The routing number for ACH transfers. - **accountNumber** (string) - The account number for ACH transfers. - **wire** (object) - Wire transfer specific details. - **routingNumber** (string) - The routing number for wire transfers. - **accountNumber** (string) - The account number for wire transfers. - **rtp** (object) - RTP specific details. - **routingNumber** (string) - The routing number for RTP transfers. - **accountNumber** (string) - The account number for RTP transfers. #### Response Example ```json { "message": "Virtual account created successfully", "accountInfo": { "id": "cfbc005d-8640-57a4-89e1-539c974fa780", "userId": "840c28f2-ea7d-5c3a-9271-b10fd8b6ae6d", "source": { "paymentRail": ["ach", "wire", "rtp", "swift"], "currency": "usd" }, "destination": { "chain": "POLYGON", "currency": "usdc", "walletAddress": "0xd102C4130985B7fcB95697616eaf5542c4f98d49", "externalWalletId": null }, "status": "activated", "depositInstructions": { "bankName": "Bank of NoWhere", "bankAddress": "123 Main St, New York, NY 10001, USA", "swiftCode": "XXXXXXXX", "beneficiary": { "name": "Henry Wu", "address": ", " }, "ach": { "routingNumber": "028000024", "accountNumber": "123456789" }, "wire": { "routingNumber": "021000021", "accountNumber": "123456789" }, "rtp": { "routingNumber": "021000021", "accountNumber": "123456789" } } } } ``` ``` -------------------------------- ### POST /wallets/transfers Source: https://docs.hifibridge.com/docs/transfers/features/transfer-approvals Creates a stablecoin to stablecoin transfer that may require approval. The `requireApproval` parameter, when set to `true`, initiates the maker-checker workflow. ```APIDOC ## POST /wallets/transfers ### Description Creates a stablecoin to stablecoin transfer. If `requireApproval` is set to `true`, the transfer will enter an approval workflow. ### Method POST ### Endpoint /v2/wallets/transfers ### Parameters #### Request Body - **currency** (string) - Required - The currency of the transfer (e.g., "usdc"). - **amount** (number) - Required - The amount to transfer. - **chain** (string) - Required - The blockchain network (e.g., "POLYGON"). - **source** (object) - Required - Details about the source of the funds. - **userId** (string) - Required - The ID of the user initiating the transfer. - **destination** (object) - Required - Details about the destination of the funds. - **userId** (string) - Required - The ID of the user receiving the funds. - **requireApproval** (boolean) - Optional - If `true`, the transfer requires explicit approval. Defaults to `false`. ### Request Example ```json { "currency": "usdc", "amount": 100, "chain": "POLYGON", "source": { "userId": "user-id" }, "destination": { "userId": "user-id" }, "requireApproval": true } ``` ### Response #### Success Response (200) - **transferId** (string) - The unique identifier for the created transfer. - **status** (string) - The status of the transfer (e.g., "PENDING_APPROVAL", "COMPLETED"). #### Response Example ```json { "transferId": "txn_12345", "status": "PENDING_APPROVAL" } ``` ``` -------------------------------- ### Create Settlement Rule - Bash Source: https://docs.hifibridge.com/docs/transfers/features/settlement-rules This bash script uses curl to send a POST request to the HifiBridge API to create a settlement rule. It defines rules for both fixed and percentage-based fee calculations, specifying the destination wallet address for the fees. ```bash curl --request POST \ --url https://production.hifibridge.com/v2/virtual-accounts/settlement-rules \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --data '{ "chain": "BASE", "includeHIFIFee": true, "rules": [ { "type": "PERCENTAGE", "calculationModel": "FIXED", "value": 0.001, "walletAddress": "0x15FB50680fEB2f726413416665c25f9B397b047b" }, { "type": "FIXED", "calculationModel": "FIXED", "value": 0.5, "walletAddress": "0x15FB50680fEB2f726413416665c25f9B397b047b" } ] }' ``` -------------------------------- ### Create Settlement Rule Source: https://docs.hifibridge.com/docs/transfers/features/settlement-rules Create a new settlement rule to define fee calculation methods and destination wallets. Multiple rules can be applied and are processed in order. ```APIDOC ## POST /v2/virtual-accounts/settlement-rules ### Description Creates a new settlement rule for virtual account transactions, defining how fees are calculated and distributed. ### Method POST ### Endpoint `/v2/virtual-accounts/settlement-rules` ### Parameters #### Query Parameters None #### Request Body - **chain** (string) - Required - The blockchain network for the settlement rule (e.g., "BASE", "POLYGON"). - **includeHIFIFee** (boolean) - Required - Whether to include the HIFI platform fee in the calculation. - **rules** (array) - Required - An array of rule configurations. - **type** (string) - Required - The type of fee calculation ('FIXED' or 'PERCENTAGE'). - **calculationModel** (string) - Required - The model for calculation ('FIXED' or 'TIERED'). - **value** (number) - Required - The fee value (flat amount for FIXED type, percentage for PERCENTAGE type). - **tiers** (array) - Optional - Used for 'TIERED' calculation model. Contains objects with 'min', 'max', and 'value' for different transaction amount ranges. - **walletAddress** (string) - Required - The wallet address where the calculated fee will be sent. ### Request Example ```json { "chain": "BASE", "includeHIFIFee": true, "rules": [ { "type": "PERCENTAGE", "calculationModel": "FIXED", "value": 0.001, "walletAddress": "0x15FB50680fEB2f726413416665c25f9B397b047b" }, { "type": "FIXED", "calculationModel": "FIXED", "value": 0.5, "walletAddress": "0x15FB50680fEB2f726413416665c25f9B397b047b" } ] } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the created settlement rule. - **chain** (string) - The blockchain network of the rule. - **includeHIFIFee** (boolean) - Indicates if HIFI platform fee is included. - **rules** (array) - The configured rules for fee calculation and distribution. #### Response Example ```json { "id": "15c786fb-de7a-520c-a4b3-f312d4a122d2", "chain": "BASE", "includeHIFIFee": false, "rules": [ { "type": "PERCENTAGE", "calculationModel": "FIXED", "value": 0.001, "tiers": null, "walletAddress": "0x15FB50680fEB2f726413416665c25f9B397b047b" }, { "type": "FIXED", "calculationModel": "FIXED", "value": 0.5, "tiers": null, "walletAddress": "0x15FB50680fEB2f726413416665c25f9B397b047b" } ] } ``` ``` -------------------------------- ### Generate KYC Link using cURL Source: https://docs.hifibridge.com/docs/users/features/kyc-link This snippet demonstrates how to generate a KYC link using a cURL command. It sends a POST request to the HifiBridge production API, including authorization headers and a JSON payload with user details, desired rails, a redirect URL, recipient email, and an optional template ID. The API then returns a secure link for user onboarding. ```bash curl -X POST "https://production.hifibridge.com/v2/kyc-link" \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "userType": "INDIVIDUAL", "rails": [ "USD" ], "redirectUrl": "https://yourapp.com/kyc-complete", "recipientEmail": "user@example.com", "templateId": "xyz" }' ```