Sync All Balances
Synchronize all wallet and custody account balances with their respective blockchain networks and custody providers.
Endpoint
POST /manage/users/balances/sync
Authentication
This endpoint requires an OAuth 2.0 access token with tenant administrator or global administrator role:
Authorization: Bearer {access_token}
Request
This endpoint does not require a request body.
Response
200 OK
A successful response will include detailed information about the synchronization results:
{
"wallets_updated": 5,
"wallet_errors": [],
"custody_accounts_updated": 2,
"custody_errors": [],
"sync_time": "2025-04-19T12:34:56.789Z"
}
Response Fields
| Field | Type | Description |
|---|---|---|
wallets_updated | number | Number of wallets successfully updated |
wallet_errors | array | Array of errors encountered during wallet updates |
custody_accounts_updated | number | Number of custody accounts successfully updated |
custody_errors | array | Array of errors encountered during custody account updates |
sync_time | string | Timestamp of when the sync was performed |
Error Objects
If errors occur during synchronization, they will be included in the wallet_errors or custody_errors arrays:
{
"wallet_id": "wallet-123",
"blockchain": "ETH",
"error": "Failed to connect to blockchain network"
}
{
"account_id": "account-123",
"error": "API rate limit exceeded"
}
401 Unauthorized
Occurs when the OAuth 2.0 access token is missing or invalid:
{
"detail": "Not authenticated"
}
403 Forbidden
Occurs when the authenticated user doesn't have tenant administrator role:
{
"detail": "Only tenant administrators can access this endpoint"
}
Example Request
curl -X POST "https://api.cryptofuse.io/manage/users/balances/sync" \
-H "Authorization: Bearer eyJ0eXAiOiJPQXV0aFRva2VuIiwiYWxnIjoiUlMyNTYifQ..."
Example Response
{
"wallets_updated": 5,
"wallet_errors": [
{
"wallet_id": "wallet-789",
"blockchain": "SOL",
"error": "Failed to connect to Solana RPC node"
}
],
"custody_accounts_updated": 2,
"custody_errors": [],
"sync_time": "2025-04-19T12:34:56.789Z"
}
Usage Notes
-
This endpoint initiates a synchronization of all wallet and custody account balances in the tenant, which may take some time to complete for tenants with many wallets.
-
The synchronization process involves:
- Querying the respective blockchain networks for wallet balances
- Contacting custody providers for custody account balances
- Updating the stored balances in the database
-
The response includes information about any errors that occurred during synchronization, which can be useful for troubleshooting.
-
Regular synchronization is recommended to ensure that the system's records match the actual blockchain and custody provider balances.
-
After synchronization, you can use the
/manage/users/balancesendpoint to view the updated balances. -
It's a good practice to synchronize balances before processing large withdrawals to ensure you have accurate balance information.
-
This operation may have performance implications and should not be called excessively. A reasonable frequency would be once per hour or when specific balance checks are needed before large operations.