Skill: vshamanov/zerion-api-skill-2 (version 0.1.0)

--- name: zerion-api description: > Query blockchain wallet data, token prices, and transaction history using the Zerion API via its MCP connector. Use this skill whenever the user asks about: crypto wallet balances, portfolio values, token holdings or positions, DeFi positions (staking, lending, LP), wallet PnL (profit and loss), transaction history, token/fungible asset prices or charts, NFT holdings or NFT portfolio value, or any web3 wallet analytics. Triggers on mentions of wallet addresses (0x...), ENS names, token names/symbols, "portfolio", "positions", "PnL", "transactions", "balance", "holdings", "NFTs", or any crypto/DeFi analytics queries. Also use when building artifacts or dashboards that display wallet or token data. --- # Zerion API Skill Query web3 wallet data, token prices, NFTs, and transaction history via the Zerion MCP connector. ## Authentication Zerion API requires a key for every request. The key is **not** stored in the MCP connector settings — the user must provide it each chat session. ### Workflow 1. **At the start of any Zerion-related task**, if no API key has been provided yet, ask: *"To query Zerion, I'll need your API key. You can find it at https://dashboard.zerion.io/. Please paste it here."* 2. **Store the key in memory** for the duration of the conversation. Never write it to files, display it in artifacts, or log it. 3. **Pass the key** to the MCP server or REST calls as described below. ### Auth Format Zerion uses HTTP Basic Auth: the API key is the username, password is empty. ``` Authorization: Basic <base64(API_KEY + ":")> ``` Example: key `zk_dev_abc123` → base64 of `zk_dev_abc123:` → `emtfZGV2X2FiYzEyMzo=` ## MCP Connection The Zerion API MCP server is at `https://developers.zerion.io/mcp`. When using MCP tools directly (outside artifacts), pass the API key as required by the tool parameters. When building artifacts that call the Anthropic API with MCP, include the key in the inner prompt so the inner Claude can authenticate: ```javascript mcp_servers: [ { type: "url", url: "https://developers.zerion.io/mcp", name: "zerion-mcp" } ] ``` **Important**: In artifacts, receive the API key as a prop or state variable — never hardcode it. Example pattern: ```jsx // User inputs key via a secure input field (type="password") const [apiKey, setApiKey] = useState(""); // Pass key to inner Claude prompt so MCP calls authenticate const prompt = `Using the Zerion API key: ${apiKey}, get portfolio for wallet 0x...`; ``` ## Quick Reference: Common Workflows ### 1. Wallet Portfolio Overview Prompt the inner Claude to call the Zerion API for the wallet's portfolio: ``` Get the portfolio for wallet {address} in USD. Include total value, daily changes, and distribution by chain and position type. ``` **Endpoint:** `GET /v1/wallets/{address}/portfolio` - `currency`: usd (default), eth, btc, eur, etc. - `filter[positions]`: `only_simple` (default), `only_complex` (DeFi), `no_filter` (all) ### 2. Wallet Token Positions ``` List all fungible positions for wallet {address}, sorted by value descending. ``` **Endpoint:** `GET /v1/wallets/{address}/positions/` - `filter[positions]`: `only_simple` | `only_complex` | `no_filter` - `filter[chain_ids]`: comma-separated chain IDs (e.g., `ethereum,polygon`) - `filter[position_types]`: `wallet`, `deposit`, `staked`, `loan`, `locked`, `reward`, `investment` - `sort`: `-value` (highest first) or `value` - `filter[trash]`: `only_non_trash` (default) ### 3. Transaction History ``` Get recent transactions for wallet {address}, filter for trades only. ``` **Endpoint:** `GET /v1/wallets/{address}/transactions/` - `filter[operation_types]`: `trade`, `send`, `receive`, `deposit`, `withdraw`, `mint`, `burn`, `claim`, `approve`, etc. - `filter[chain_ids]`: filter by chain - `filter[min_mined_at]` / `filter[max_mined_at]`: timestamp in milliseconds - `page[size]`: max 100 ### 4. Profit & Loss (PnL) ``` Get PnL for wallet {address}. Show realized gain, unrealized gain, fees, and net invested. ``` **Endpoint:** `GET /v1/wallets/{address}/pnl` - Returns: `realized_gain`, `unrealized_gain`, `total_fee`, `net_invested`, `received_external`, `sent_external` - Uses FIFO method - `filter[chain_ids]`, `filter[fungible_ids]`: narrow scope ### 5. Wallet Balance Chart ``` Get the balance chart for wallet {address} over the past month. ``` **Endpoint:** `GET /v1/wallets/{address}/charts/{chart_period}` - `chart_period`: `hour`, `day`, `week`, `month`, `3months`, `6months`, `year`, `5years`, `max` - Returns array of `[timestamp, balance]` points ### 6. Token Price & Search ``` Search for the fungible asset "ethereum" and return its price and market data. ``` **Endpoint:** `GET /v1/fungibles/` - `filter[search_query]`: text search (e.g., "ethereum", "USDC") - `sort`: `-market_data.market_cap`, `-market_data.price.last`, etc. - Returns: `name`, `symbol`, `price`, `market_cap`, `circulating_supply`, `changes` (1d/30d/90d/365d) ### 7. Token Price Chart ``` Get the price chart for fungible {fungible_id} over the past week. ``` **Endpoint:** `GET /v1/fungibles/{fungible_id}/charts/{chart_period}` - Same chart periods as wallet charts - Returns `[timestamp, price]` points ### 8. NFT Positions ``` List all NFT positions for wallet {address}, sorted by floor price descending. ``` **Endpoint:** `GET /v1/wallets/{address}/nft-positions/` - `sort`: `-floor_price`, `floor_price`, `created_at`, `-created_at` - `filter[chain_ids]`: filter by chain - `include`: `nfts`, `nft_collections`, `wallet_nft_collections` for richer data ### 9. NFT Portfolio Value **Endpoint:** `GET /v1/wallets/{address}/nft-portfolio` - Returns total NFT portfolio value ## Building Artifacts with Zerion Data When building React/HTML artifacts that display Zerion data: 1. **Collect the API key securely** via a `type="password"` input field 2. **Never display or log** the key in the UI 3. **Pass it through the MCP prompt** so the inner Claude can authenticate ```javascript // apiKey comes from a password input, never hardcoded const response = await fetch("https://api.anthropic.com/v1/messages", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ model: "claude-sonnet-4-20250514", max_tokens: 1000, messages: [ { role: "user", content: `Use the Zerion API with key "${apiKey}" to get the portfolio overview for wallet ${walletAddress} in USD. Return ONLY a JSON object with: totalValue, dailyChangePercent, dailyChangeAbsolute, topChains (array of {chain, value}), positionBreakdown (wallet, deposited, staked, borrowed, locked).` } ], mcp_servers: [ { type: "url", url: "https://developers.zerion.io/mcp", name: "zerion-mcp" } ] }) }); ``` ### Processing MCP Responses MCP responses contain multiple content blocks. Extract data by type: ```javascript const data = await response.json(); // Get tool results (actual Zerion data) const toolResults = data.content .filter(item => item.type === "mcp_tool_result") .map(item => item.content?.[0]?.text || "") .join("\n"); // Get Claude's text analysis const textResponses = data.content .filter(item => item.type === "text") .map(item => item.text) .join("\n"); ``` ## Key Notes - **Address formats**: Supports EVM addresses (0x...) and Solana addresses. ENS names may need resolution first. - **Solana limitations**: No protocol positions or NFT transactions for Solana addresses. - **Currency options**: `usd`, `eth`, `btc`, `eur`, `krw`, `rub`, `gbp`, `aud`, `cad`, `inr`, `jpy`, `nzd`, `try`, `zar`, `cny`, `chf` - **Pagination**: Use `links.next` from responses for pagination; never construct `page[after]` manually. - **Rate limits**: API returns 429 on throttling. Implement retry with backoff in artifacts. - **Treat IDs as opaque strings**: Never assume format of IDs; they may change. - **DeFi positions**: Use `filter[positions]=no_filter` to include protocol positions alongside wallet positions. - **LP grouping**: Liquidity pool positions share a `group_id` attribute — group by it to display pools correctly. ## Detailed Endpoint Reference For full parameter details, response schemas, and edge cases: - **Wallet endpoints**: See [references/wallet-endpoints.md](references/wallet-endpoints.md) - **Fungible & NFT endpoints**: See [references/fungible-nft-endpoints.md](references/fungible-nft-endpoints.md)

path: references/fungible-nft-endpoints.md
content: # Fungible & NFT Endpoints Reference

## Table of Contents
- [GET /v1/fungibles/](#list-fungibles)
- [GET /v1/fungibles/{fungible_id}](#get-fungible-by-id)
- [GET /v1/fungibles/{fungible_id}/charts/{chart_period}](#fungible-chart)
- [GET /v1/fungibles/by-implementation](#fungible-by-implementation)
- [GET /v1/nfts/](#list-nfts)
- [GET /v1/nfts/{nft_id}](#get-nft-by-id)
- [GET /v1/chains/](#list-chains)

---

## List Fungibles

`GET /v1/fungibles/`

Search and list fungible assets with market data.

### Parameters

| Parameter | Required | Default | Description |
|-----------|----------|---------|-------------|
| `currency` | No | `usd` | Price currency |
| `filter[search_query]` | No | — | Text search (1-66 chars), e.g., "ethereum", "USDC" |
| `filter[implementation_chain_id]` | No | — | Keep only fungibles on this chain |
| `filter[implementation_address]` | No | — | Keep only fungibles at this address |
| `filter[fungible_ids]` | No | — | Comma-separated IDs (max 25) |
| `filter[fungible_implementations]` | No | — | chain:address pairs (max 25) |
| `sort` | No | — | Options: `-market_data.market_cap`, `market_data.market_cap`, `-market_data.price.last`, `market_data.price.last`, `-market_data.price.percent_change_1d`, etc. (also 30d, 90d, 365d) |
| `page[size]` | No | 100 | Max items (1-100) |

**Note**: `filter[implementation_address]` ignores `filter[search_query]`.

### Response Shape (per item)

```json
{
  "type": "fungibles",
  "id": "0x2af...",
  "attributes": {
    "name": "Bankless BED Index",
    "symbol": "BED",
    "description": "...",
    "icon": { "url": "https://..." },
    "flags": { "verified": true },
    "external_links": [{ "type": "website", "name": "Website", "url": "https://..." }],
    "implementations": [
      { "chain_id": "ethereum", "address": "0x...", "decimals": 18 }
    ],
    "market_data": {
      "price": 106.88,
      "market_cap": 3196313.74,
      "fully_diluted_valuation": 3196313.74,
      "total_supply": 29905.76,
      "circulating_supply": 29905.76,
      "changes": {
        "percent_1d": -0.74,
        "percent_30d": -2.50,
        "percent_90d": 11.32,
        "percent_365d": null
      }
    }
  },
  "relationships": {
    "chart_hour": { "links": { "related": "https://api.zerion.io/v1/fungibles/.../charts/hour" } },
    "chart_day": { "links": { "related": "..." } },
    "chart_week": { "links": { "related": "..." } },
    "chart_month": { "links": { "related": "..." } },
    "chart_year": { "links": { "related": "..." } },
    "chart_max": { "links": { "related": "..." } }
  }
}
```

---

## Get Fungible by ID

`GET /v1/fungibles/{fungible_id}`

Get detailed info for a specific fungible asset by its Zerion ID.

### Parameters

| Parameter | Required | Description |
|-----------|----------|-------------|
| `fungible_id` (path) | Yes | Zerion fungible ID |
| `currency` | No | Price currency (default: `usd`) |

---

## Fungible Chart

`GET /v1/fungibles/{fungible_id}/charts/{chart_period}`

Price chart for a fungible asset.

### Parameters

| Parameter | Required | Description |
|-----------|----------|-------------|
| `fungible_id` (path) | Yes | Zerion fungible ID |
| `chart_period` (path) | Yes | `hour`, `day`, `week`, `month`, `3months`, `6months`, `year`, `5years`, `max` |
| `currency` | No | Price currency (default: `usd`) |

### Response Shape

```json
{
  "data": {
    "type": "fungible_charts",
    "attributes": {
      "begin_at": "2023-01-18T11:00:00Z",
      "end_at": "2023-01-25T10:30:00Z",
      "points": [[1674039600, 1567.23], [1674041400, 1572.45]]
    }
  }
}
```

Points are `[unix_timestamp, price_in_currency]`.

---

## Fungible by Implementation

`GET /v1/fungibles/by-implementation`

Look up a fungible by its on-chain address. Useful when you have a contract address and need the Zerion fungible ID.

### Parameters

| Parameter | Required | Description |
|-----------|----------|-------------|
| `implementation_chain_id` | Yes | Chain ID (e.g., `ethereum`) |
| `implementation_address` | Yes | Contract address |
| `currency` | No | Price currency |

---

## List NFTs

`GET /v1/nfts/`

Search and list NFTs across all chains.

### Parameters

| Parameter | Required | Default | Description |
|-----------|----------|---------|-------------|
| `filter[search_query]` | No | — | Text search |
| `filter[chain_ids]` | No | — | Filter by chains |
| `filter[collection_ids]` | No | — | Filter by collection IDs |
| `currency` | No | `usd` | Price currency |
| `page[size]` | No | 100 | Max items (1-100) |

---

## Get NFT by ID

`GET /v1/nfts/{nft_id}`

Get detailed info for a specific NFT including metadata, content URLs, market data, and attributes.

### Parameters

| Parameter | Required | Description |
|-----------|----------|-------------|
| `nft_id` (path) | Yes | NFT unique ID |
| `currency` | No | Price currency |

---

## List Chains

`GET /v1/chains/`

Returns all supported blockchain networks. Use chain IDs from this endpoint in `filter[chain_ids]` parameters.

Common chain IDs: `ethereum`, `polygon`, `arbitrum`, `optimism`, `base`, `avalanche`, `binance-smart-chain`, `fantom`, `zksync-era`, `linea`, `xdai` (Gnosis), `aurora`, `celo`, `solana`.


path: references/wallet-endpoints.md
content: # Wallet Endpoints Reference

## Table of Contents
- [GET /v1/wallets/{address}/portfolio](#portfolio)
- [GET /v1/wallets/{address}/positions/](#positions)
- [GET /v1/wallets/{address}/transactions/](#transactions)
- [GET /v1/wallets/{address}/pnl](#pnl)
- [GET /v1/wallets/{address}/charts/{chart_period}](#balance-chart)
- [GET /v1/wallets/{address}/nft-positions/](#nft-positions)
- [GET /v1/wallets/{address}/nft-collections/](#nft-collections)
- [GET /v1/wallets/{address}/nft-portfolio](#nft-portfolio)

---

## Portfolio

`GET /v1/wallets/{address}/portfolio`

Returns portfolio overview: total value, daily changes, distribution by chain and position type.

### Parameters

| Parameter | Required | Default | Description |
|-----------|----------|---------|-------------|
| `address` (path) | Yes | — | Wallet address (0x... or Solana) |
| `currency` | No | `usd` | Price currency: usd, eth, btc, eur, krw, rub, gbp, aud, cad, inr, jpy, nzd, try, zar, cny, chf |
| `filter[positions]` | No | `only_simple` | `only_simple` (wallet only), `only_complex` (DeFi only), `no_filter` (all) |
| `sync` | No | `false` | `true` waits up to 30s for fresh data from blockchain |

### Response Shape

```json
{
  "data": {
    "type": "portfolio",
    "id": "0x...",
    "attributes": {
      "total": { "positions": 2017.49 },
      "changes": { "absolute_1d": 102.03, "percent_1d": 5.33 },
      "positions_distribution_by_type": {
        "wallet": 1864.77, "deposited": 78.04, "borrowed": 0.98,
        "locked": 5.78, "staked": 66.13
      },
      "positions_distribution_by_chain": {
        "ethereum": 1214.01, "optimism": 573.03, "arbitrum": 458.36
      }
    }
  }
}
```

---

## Positions

`GET /v1/wallets/{address}/positions/`

Returns list of individual fungible token positions with value, price, quantity, and DeFi metadata.

### Parameters

| Parameter | Required | Default | Description |
|-----------|----------|---------|-------------|
| `address` (path) | Yes | — | Wallet address |
| `currency` | No | `usd` | Price currency |
| `filter[positions]` | No | `only_simple` | `only_simple`, `only_complex`, `no_filter` |
| `filter[position_types]` | No | — | Comma-separated: `deposit`, `loan`, `locked`, `staked`, `reward`, `wallet`, `investment` |
| `filter[chain_ids]` | No | — | Comma-separated chain IDs (e.g., `ethereum,polygon`) |
| `filter[fungible_ids]` | No | — | Comma-separated fungible IDs |
| `filter[dapp_ids]` | No | — | Comma-separated DApp IDs |
| `filter[trash]` | No | `only_non_trash` | `only_trash`, `only_non_trash`, `no_filter` |
| `sort` | No | `value` | `-value` (desc) or `value` (asc) |
| `sync` | No | `false` | Wait for fresh data |
| `X-Env` header | No | — | Set to `testnet` for testnet data |

### Response Shape (per item)

```json
{
  "type": "positions",
  "id": "...",
  "attributes": {
    "name": "Asset",
    "position_type": "wallet",
    "quantity": { "float": 123.46, "numeric": "123.45678" },
    "value": 5.38,
    "price": 0.0436,
    "changes": { "absolute_1d": 0.27, "percent_1d": 5.33 },
    "fungible_info": {
      "name": "Bankless BED Index", "symbol": "BED",
      "icon": { "url": "..." },
      "flags": { "verified": true },
      "implementations": [{ "chain_id": "ethereum", "address": "0x...", "decimals": 18 }]
    },
    "protocol": "aave-v3",
    "protocol_module": "lending",
    "group_id": "...",
    "application_metadata": { "name": "AAVE", "url": "https://app.aave.com/" }
  },
  "relationships": {
    "chain": { "data": { "type": "chains", "id": "polygon" } },
    "fungible": { "data": { "type": "fungibles", "id": "0x..." } },
    "dapp": { "data": { "type": "dapps", "id": "aave-v3" } }
  }
}
```

**LP positions**: Positions in the same liquidity pool share a `group_id`. Group by it to display pool tokens together.

---

## Transactions

`GET /v1/wallets/{address}/transactions/`

Returns paginated transaction history with transfers, approvals, and DApp metadata.

### Parameters

| Parameter | Required | Default | Description |
|-----------|----------|---------|-------------|
| `address` (path) | Yes | — | Wallet address |
| `currency` | No | `usd` | Price currency |
| `filter[operation_types]` | No | — | Comma-separated: `approve`, `burn`, `claim`, `delegate`, `deploy`, `deposit`, `execute`, `mint`, `receive`, `revoke`, `revoke_delegation`, `send`, `trade`, `withdraw` |
| `filter[asset_types]` | No | — | `fungible`, `nft` |
| `filter[chain_ids]` | No | — | Comma-separated chain IDs |
| `filter[fungible_ids]` | No | — | Filter by specific tokens |
| `filter[min_mined_at]` | No | — | Start timestamp (ms), e.g., `1688842525735` |
| `filter[max_mined_at]` | No | — | End timestamp (ms) |
| `filter[search_query]` | No | — | Full-text search (2-64 chars) |
| `filter[trash]` | No | `no_filter` | Spam filtering |
| `page[size]` | No | 100 | Max items per page (1-100) |
| `X-Env` header | No | — | `testnet` for testnet data |

### Pagination

Use `links.next` from the response to get the next page. Do not construct `page[after]` manually.

### Response Shape (per item)

```json
{
  "type": "transactions",
  "id": "...",
  "attributes": {
    "operation_type": "trade",
    "hash": "0x...",
    "mined_at": "2022-08-15T11:26:31+00:00",
    "mined_at_block": 15345739,
    "sent_from": "0x...",
    "sent_to": "0x...",
    "status": "confirmed",
    "nonce": 3757,
    "fee": {
      "fungible_info": { "name": "Ether", "symbol": "ETH" },
      "quantity": { "float": 0.015 },
      "price": 2542.23,
      "value": 39.97
    },
    "transfers": [
      {
        "fungible_info": { "name": "USDC", "symbol": "USDC" },
        "direction": "out",
        "quantity": { "float": 1000.0 },
        "value": 1000.0,
        "price": 1.0,
        "sender": "0x...",
        "recipient": "0x..."
      }
    ],
    "approvals": [],
    "application_metadata": {
      "name": "Uniswap",
      "method": { "name": "Swap" }
    }
  }
}
```

---

## PnL

`GET /v1/wallets/{address}/pnl`

Returns profit/loss analysis using FIFO accounting.

### Parameters

| Parameter | Required | Default | Description |
|-----------|----------|---------|-------------|
| `address` (path) | Yes | — | Wallet address |
| `currency` | No | `usd` | Price currency |
| `filter[chain_ids]` | No | — | Limit to specific chains |
| `filter[fungible_ids]` | No | — | Limit to specific tokens (max 100) |
| `filter[fungible_implementations]` | No | — | chain:address pairs (max 100) |

### Response Shape

```json
{
  "data": {
    "type": "pnl",
    "attributes": {
      "realized_gain": -655.36,
      "unrealized_gain": 17.54,
      "total_fee": 281.91,
      "net_invested": 45.84,
      "received_external": 133971.29,
      "sent_external": 133270.09,
      "sent_for_nfts": 133971.29,
      "received_for_nfts": 133971.29
    }
  }
}
```

**Note**: When filtering by `fungible_ids` or `fungible_implementations`, assets without prices are auto-excluded. Check `meta.excluded_fungible_ids` in response.

---

## Balance Chart

`GET /v1/wallets/{address}/charts/{chart_period}`

Returns time-series balance data for charting.

### Parameters

| Parameter | Required | Default | Description |
|-----------|----------|---------|-------------|
| `address` (path) | Yes | — | Wallet address |
| `chart_period` (path) | Yes | — | `hour`, `day`, `week`, `month`, `3months`, `6months`, `year`, `5years`, `max` |
| `currency` | No | `usd` | Price currency |
| `filter[chain_ids]` | No | — | Limit to specific chains |
| `filter[fungible_ids]` | No | — | Limit to specific tokens |

### Response Shape

```json
{
  "data": {
    "type": "wallet_charts",
    "attributes": {
      "begin_at": "2023-01-18T11:00:00Z",
      "end_at": "2023-01-25T10:30:00Z",
      "points": [[1674039600, 1145.01], [1674041400, 1148.23]]
    }
  }
}
```

Each point is `[unix_timestamp, balance_in_currency]`.

---

## NFT Positions

`GET /v1/wallets/{address}/nft-positions/`

Returns individual NFT positions with floor prices and collection info.

### Parameters

| Parameter | Required | Default | Description |
|-----------|----------|---------|-------------|
| `address` (path) | Yes | — | Wallet address |
| `currency` | No | `usd` | Price currency |
| `filter[chain_ids]` | No | — | Filter by chains |
| `filter[collections_ids]` | No | — | Filter by collection IDs |
| `sort` | No | — | `created_at`, `-created_at`, `floor_price`, `-floor_price` |
| `include` | No | — | `nfts`, `nft_collections`, `wallet_nft_collections` |
| `page[size]` | No | 100 | Max items (1-100) |

**Note**: May return 202 if positions are still being aggregated. Retry until 200.

---

## NFT Collections

`GET /v1/wallets/{address}/nft-collections/`

Returns NFT collections held by the wallet with aggregate data.

---

## NFT Portfolio

`GET /v1/wallets/{address}/nft-portfolio`

Returns total NFT portfolio value for the wallet.


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: clean (LOW)