Account Endpoints
Account endpoints deliver current information about user token holdings and approvals for the CoW Protocol.Get Account Balances
Endpoint:GET /{chainId}/accounts/{userAddress}/balances
Retrieves token balances and approvals for a specified user address.
Parameters
Response Fields
- balance: Token quantity in base units (wei-like format)
- allowance: CoW Protocol vault relayer approval amount
- token: Object containing token metadata
- address: Contract address
- decimals: Decimal places (typically 18)
- symbol: Short identifier (e.g., “WETH”)
- name: Full token name
Example Success Response
Code Examples
cURL:Error Responses
Stream Account Balances (SSE)
Endpoint:GET /{chainId}/accounts/{userAddress}/balances/sse
Provides real-time streaming updates via Server-Sent Events for balance and allowance changes.
Parameters
Response Behavior
- Initial Event: Current balances sent immediately upon connection
- Update Events: Transmitted when balance or allowance changes
- Ping Events: Keep-alive messages every 20 seconds
Event Examples
Balance Update:Response Headers
Code Examples
cURL:Important Notes
Allowance Context
The allowance returned is specifically for the CoW Protocol vault relayer contract. This represents the approval amount verified during order placement. A typical maximum approval value is115792089237316195423570985008687907853269984665640564039457584007913129639935.
Balance Format Details
Balances use token base units:- 18-decimal tokens:
1000000000000000000equals 1 token - 6-decimal tokens (USDC):
1000000equals 1 token
SSE Connection Guidelines
- Keep-alive pings maintain connection every 20 seconds
- Server automatically stops tracking when all clients disconnect
- Multiple clients can monitor the same user; the server combines tracked tokens
- Be aware of concurrent connection limits
Local Testing
Test the SSE endpoint locally:Performance Tips
- Query multiple tokens in single requests for efficiency
- SSE connections only transmit when changes occur
- REST responses may cache for several seconds
- Batch requests where possible