Quick start
Access detailed position and transaction data using Merkl States Analytics API
The Merkl States Analytics API provides detailed position and transaction data for users across different DeFi protocols. This service is particularly useful for building analytics dashboards, tracking position history, and computing PnL (Profit and Loss) for user positions.
Base URL and Documentation
Base URL: https://analytics.merkl.xyz
Full API Documentation: Analytics Reference
Authentication
This API uses the same API keys as the Merkl API. You can generate one from the API Keys page in the UI.
Include your API key in the X-API-Key header for all requests:
curl 'https://analytics.merkl.xyz/v1/positions/{userAddress}/{chainId}' \
--header 'X-API-Key: your-api-key-here'
Use Cases
- Position Tracking: Monitor user positions across multiple protocols and chains
- PnL Analytics: Calculate profit and loss using historical position data with
includeHistory=trueandhistoryStep=daily - Portfolio Visualization: Display user holdings with enriched token amounts using
enrichPositions=true - Protocol Analytics: Aggregate data by protocol using the
protocolfilter - Transaction Analysis: Look up position state changes by transaction hash
