GET /api/positions
Retrieve all DeFi positions for a wallet across 115+ supported protocols on Solana and the major EVM chains.
Note: Get your API key to test this endpoint — sign up at the dashboard.
Request
GET https://api.nefariouslabs.dev/api/positions
| Parameter | Type | Required | Description |
|---|---|---|---|
| wallet | string | Yes | Wallet address — either a Solana base58 pubkey (32-44 chars) or an EVM 0x… address (42 chars). Cross-chain aggregation is automatic. |
| protocols | string | No | Comma-separated list of protocol IDs to filter results. If omitted, all 115+ supported protocols are queried. |
Response
| Field | Type | Description |
|---|---|---|
| wallet | string | The queried wallet address |
| fetchedAt | string | ISO 8601 timestamp of when the data was fetched |
| totalValueUsd | number | Net portfolio value in USD (deposits - borrows + positions) |
| totalDepositedUsd | number | Total deposited assets in USD |
| totalBorrowedUsd | number | Total borrowed assets in USD |
| totalRewardsUsd | number | Total unclaimed rewards in USD |
| protocols | array | Array of protocol position data (see below) |
Errors
| Field | Type | Description |
|---|---|---|
| 400 | Invalid wallet address format |
json
{"error": "Invalid wallet address"}
Examples
curl "https://api.nefariouslabs.dev/api/positions?wallet=7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU" \-H "X-API-Key: nf_your_api_key"
Example Response
json
{"wallet": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU","fetchedAt": "2024-01-15T10:30:00.000Z","totalValueUsd": 15420.50,"totalDepositedUsd": 12500.00,"totalBorrowedUsd": 2100.00,"totalRewardsUsd": 45.30,"protocols": [{"protocol": {"id": "marginfi","name": "MarginFi","url": "https://app.marginfi.com","category": "lending"},"totalValueUsd": 8400.00,"totalDepositedUsd": 10000.00,"totalBorrowedUsd": 1600.00,"totalRewardsUsd": 0,"positions": [{"id": "marginfi-deposit-abc123","type": "deposit","name": "USDC Deposit","valueUsd": 5000.00,"tokens": [{"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","symbol": "USDC","amount": "5000000000","amountUsd": 5000.00,"decimals": 6}],"metadata": { "apy": 0.085 }}]},{"protocol": {"id": "drift","name": "Drift","url": "https://app.drift.trade","category": "perps"},"totalValueUsd": 2500.00,"positions": [{"id": "drift-perp-btc","type": "perp","name": "BTC-PERP Long","valueUsd": 500.00,"tokens": [],"metadata": {"side": "long","leverage": 5.0,"entryPrice": 42000.00,"markPrice": 43500.00,"unrealizedPnl": 500.00,"liquidationPrice": 35000.00}}]}]}
Ready to start building?
Get your API key in seconds. Free tier included.
Get Started — freeNo credit card required