# Crypto Wallet API: Token Balances, NFTs, DeFi and Prices (`nabeelbaghoor/crypto-wallet-nft-defi-token-api`) Actor

Crypto wallet and Web3 data from the Moralis API on your own key: token balances with USD prices, decoded wallet history, net worth, NFTs, DeFi positions, PnL, token prices, metadata and holders. Ethereum, Base, BNB Chain, Polygon, Arbitrum and Solana. Bring your own key.

- **URL**: https://apify.com/nabeelbaghoor/crypto-wallet-nft-defi-token-api.md
- **Developed by:** [Nabeel Hassan](https://apify.com/nabeelbaghoor) (community)
- **Categories:** Developer tools, Business, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 token balance or holders

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Crypto Wallet API: Token Balances, NFTs, DeFi and Prices

Look up any crypto wallet's token balances with USD prices, decoded transaction history, net worth, NFTs, DeFi positions and profit and loss, plus token prices, metadata and holders, across Ethereum, Base, BNB Chain, Polygon, Arbitrum, other EVM chains and Solana, as clean dataset rows.

Works with the official Moralis Web3 Data API (EVM API v2.2 on deep-index.moralis.io and the Solana API on solana-gateway.moralis.io), using only endpoints documented in the published Moralis OpenAPI documents: Get token balances with prices by wallet, Get wallet history, Get wallet net worth, Get NFTs by wallet, Get DeFi positions of a wallet, Get detailed profit and loss by wallet, Get ERC20 token price, Get ERC20 token metadata, Get ERC20 token owners, Get NFT metadata, and the Solana portfolio, token balance, NFT, token price, token metadata and NFT metadata endpoints.

**Every mode only reads.** The actor never creates a stream, runs a contract function, resyncs metadata or writes anything.

BYOK, not live-tested: you bring your own Moralis API key. Every path, parameter and field comes from the OpenAPI documents, and a route probe with a forged key showed every route this actor calls is real (401) while invented paths are not (404), but the actor has not been run against a live Moralis account.

### What it does

- **Wallet token balances with prices**: every ERC20 and native token a wallet holds, with balance, USD price, USD value, 24 hour price change, share of the portfolio, logo, spam and verified flags. On Solana, SPL token balances.
- **Wallet transaction history**: decoded transactions with category (send, receive, token swap, NFT purchase, deposit, borrow, stake and more), a one-line summary, counterparty labels, fee, and the native, ERC20 and NFT transfers inside each one. Filter by date, include internal transactions.
- **Wallet net worth**: total USD value of a wallet, split per chain into native and token value, across the chains you pick.
- **NFTs by wallet**: NFTs with collection, name, image, attributes, contract type (ERC721 or ERC1155), rarity and optional floor and last sale price. Solana NFTs too.
- **Wallet DeFi positions**: liquidity, lending, borrowing and staking positions per protocol (Uniswap, Aave, Lido and others), with USD balance, unclaimed rewards and underlying tokens.
- **Wallet profit and loss**: realized PnL per traded token, average buy and sell price, amount invested and trade counts, all time or the last 7 to 90 days.
- **Solana wallet portfolio**: SOL balance, SPL tokens and NFTs in one call.
- **Token price**: USD and native price, 24 hour change and the DEX used for pricing, on EVM chains and Solana.
- **Token metadata**: name, symbol, decimals, logo, total and circulating supply, market cap, fully diluted valuation, categories and links.
- **Token holders**: the top holders of an ERC20 token with balance, USD value, exchange or entity label and share of supply.
- **NFT metadata**: single NFTs by contract and token ID, or by mint on Solana.
- **Pay only for results**: empty wallets, unknown tokens and requests the API refuses come back as a free row that says why.

### How to get an API key

Sign in at admin.moralis.com, open API Keys, and copy your key. Paste it into the API key field (or set the DATA_API_KEY secret). The key is sent only to the Moralis API in the X-API-Key header and is removed from every log line. Each call spends compute units from your Moralis plan.

### Input

| Field | Modes | Description |
| --- | --- | --- |
| `mode` | all | `walletTokens` (default), `walletHistory`, `walletNetWorth`, `walletNfts`, `walletDefiPositions`, `walletProfitability`, `solanaPortfolio`, `tokenPrice`, `tokenMetadata`, `tokenHolders` or `nftMetadata` |
| `chain` | all but net worth | `eth` (default), `base`, `polygon`, `bsc`, `arbitrum`, `optimism`, `avalanche`, `linea` and other EVM chains, or `solana` |
| `addresses` | all | Wallets, token contracts or NFTs (`contract:tokenId`, or the mint on Solana), one per line, up to 100 |
| `chains` | net worth | EVM chains to sum; empty for the API default |
| `fromDate`, `toDate` | history | YYYY-MM-DD |
| `includeInternal` | history | Add internal transactions |
| `order` | history, holders | `DESC` (default) or `ASC` |
| `profitDays` | profit and loss | `all` (default), `7`, `30`, `60` or `90` |
| `excludeSpam` | balances, net worth, NFTs, Solana portfolio | On by default |
| `excludeUnverified` | balances, net worth | Leave out unverified contracts |
| `includeNftPrices` | NFT modes | Add floor and last sale price |
| `maxResults` | all | Row cap per run (default 100) |
| `apiKey` | all | Your Moralis API key (secret) |

Example input:

```json
{
    "mode": "walletTokens",
    "chain": "base",
    "addresses": ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"],
    "excludeSpam": true,
    "maxResults": 50
}
```

### Example output

```json
{
    "mode": "walletTokens",
    "recordType": "tokenBalance",
    "found": true,
    "input": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
    "chain": "eth",
    "walletAddress": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
    "tokenAddress": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
    "name": "USD Coin",
    "symbol": "USDC",
    "balance": 1250.5,
    "usdPrice": 0.9998,
    "usdValue": 1250.25,
    "usdPrice24hChangePct": -0.01,
    "portfolioPct": 4.2,
    "possibleSpam": false,
    "verifiedContract": true,
    "imageUrl": "https://logo.moralis.io/0x1_0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.png",
    "note": null,
    "record": { "decimals": 6, "balanceRaw": "1250500000", "nativeToken": false }
}
```

A transaction row carries `txHash`, `blockTimestamp`, `category`, `summary`, `fromAddress` and `toAddress`, with the transfers in `record`. A DeFi row carries `protocol`, `positionLabel` and `usdValue`. A holder row carries `walletAddress`, `balance`, `holderLabel` and `supplyPct`. The full provider breakdown of every row sits in `record`.

### FAQ

#### What is the Moralis Web3 Data API?

Moralis is a blockchain data provider whose Data API returns enriched wallet, token, NFT, DeFi and price data for Ethereum, Base, BNB Smart Chain, Polygon, Arbitrum, Optimism, Avalanche and other EVM chains, plus Solana. This actor wraps its most used read endpoints as dataset rows.

#### Do I need my own Moralis API key?

Yes. This is a bring-your-own-key actor: it calls Moralis with your key, under your own Moralis plan and terms, and every call spends your plan's compute units. A missing or rejected key ends the run cleanly with a status message, and nothing is charged.

#### Which chains are supported?

Ethereum, Base, Polygon, BNB Smart Chain, Arbitrum, Optimism, Avalanche, Linea, Gnosis, Cronos, Chiliz, Ronin, PulseChain, Flow EVM, Sei, Monad, Robinhood Chain and the Sepolia testnet, as listed in the Moralis chain enum, plus Solana mainnet for balances, NFTs, the portfolio, token price and metadata.

#### Can I get a wallet's total value across chains?

Yes. Wallet net worth returns one row per wallet with the total USD value and a per-chain split of native and token value in `record.chains`.

#### Can I track several wallets at once?

Yes. Put up to 100 wallet addresses in Addresses, one per line. Every row names its wallet in `walletAddress`.

#### Does the transaction history show swaps and NFT trades?

Yes. Each transaction carries the category Moralis decodes (token swap, NFT purchase, NFT sale, deposit, withdraw, borrow, stake, airdrop and more), a plain-language summary and the transfers inside it.

#### What does it cost?

Pay per result: 0.005 USD per token balance, holder, NFT, token price or metadata row, 0.008 USD per decoded transaction or token PnL row, 0.01 USD per DeFi position and 0.02 USD per wallet net worth. Rows without data and refused requests are never charged. Moralis compute units are billed separately by Moralis on your own plan.

### Pricing

| Event | Price | Charged for |
| --- | --- | --- |
| `token-balance` | 0.005 USD | Each wallet token balance, Solana portfolio balance or token holder |
| `wallet-transaction` | 0.008 USD | Each decoded transaction |
| `wallet-net-worth` | 0.02 USD | Each wallet's net worth |
| `nft` | 0.005 USD | Each NFT |
| `defi-position` | 0.01 USD | Each DeFi position |
| `token-pnl` | 0.008 USD | Each traded token's profit and loss |
| `token-lookup` | 0.005 USD | Each token price or metadata lookup |

### Keyword map

crypto wallet API, wallet balance API, token balance API, Web3 data API, Moralis API, ERC20 token balances, wallet transaction history, wallet net worth, crypto portfolio tracker, NFT API, NFTs by wallet, NFT metadata, DeFi positions API, wallet PnL, token price API, token metadata, token holders, Solana wallet API, Solana portfolio, Ethereum wallet data, Base chain data, BNB Chain wallet, Polygon wallet, onchain data API.

### Terms and data use

Use of the Moralis API is governed by your own Moralis agreement and terms of service. This actor runs only under your key and does not resell or share Moralis data or access: each user calls the API under their own licence.

# Actor input Schema

## `mode` (type: `string`):

Wallet token balances lists every token a wallet holds with balance, USD price, USD value and 24 hour change. Wallet transaction history returns decoded transactions with category, summary and transfers. Wallet net worth sums a wallet's USD value across chains. NFTs by wallet lists NFTs with metadata. Wallet DeFi positions lists liquidity, lending and staking positions. Wallet profit and loss gives realized PnL per traded token. Solana wallet portfolio returns SOL, SPL tokens and NFTs in one call. Token price, Token metadata and Token holders read one token contract each. NFT metadata reads single NFTs. Every mode only reads.

## `chain` (type: `string`):

The blockchain to read. Solana works with Wallet token balances (no prices on Solana), NFTs by wallet, Solana wallet portfolio, Token price, Token metadata and NFT metadata; the other modes are EVM only. Wallet net worth uses the Net worth chains list instead.

## `addresses` (type: `array`):

One per line, up to 100. Wallet modes: wallet addresses (0x... on EVM, base58 on Solana). Token modes: token contract addresses (Solana: token mint). NFT metadata: contract:tokenId on EVM, for example 0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d:1, or the NFT mint on Solana. Explorer URLs are trimmed to the address.

## `chains` (type: `array`):

Wallet net worth only. The EVM chains to sum. Leave empty for the API's default set.

## `fromDate` (type: `string`):

Wallet transaction history only. First day to include, YYYY-MM-DD.

## `toDate` (type: `string`):

Wallet transaction history only. Last day to include, YYYY-MM-DD.

## `includeInternal` (type: `boolean`):

Wallet transaction history only. Also return internal (contract to contract) transactions inside each transaction.

## `order` (type: `string`):

Wallet transaction history and Token holders.

## `profitDays` (type: `string`):

Wallet profit and loss only.

## `excludeSpam` (type: `boolean`):

Wallet token balances, Wallet net worth, NFTs by wallet and Solana wallet portfolio. Leave out contracts the API flags as possible spam.

## `excludeUnverified` (type: `boolean`):

Wallet token balances and Wallet net worth on EVM chains. Leave out tokens whose contract is not verified.

## `includeNftPrices` (type: `boolean`):

NFTs by wallet and NFT metadata on EVM chains. Add last sale and floor price where the API has them.

## `maxResults` (type: `integer`):

The most rows this run returns and charges for. Paging stops here.

## `apiKey` (type: `string`):

Your Moralis API key, from the API Keys page of admin.moralis.com. Sent only to the Moralis API in the X-API-Key header, never logged. You can also set the DATA_API_KEY secret instead.

## Actor input object example

```json
{
  "mode": "walletTokens",
  "chain": "eth",
  "addresses": [
    "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
  ],
  "includeInternal": false,
  "order": "DESC",
  "profitDays": "all",
  "excludeSpam": true,
  "excludeUnverified": false,
  "includeNftPrices": false,
  "maxResults": 100
}
```

# Actor output Schema

## `records` (type: `string`):

One row per balance, transaction, NFT, position or lookup.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "addresses": [
        "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("nabeelbaghoor/crypto-wallet-nft-defi-token-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "addresses": ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"] }

# Run the Actor and wait for it to finish
run = client.actor("nabeelbaghoor/crypto-wallet-nft-defi-token-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "addresses": [
    "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
  ]
}' |
apify call nabeelbaghoor/crypto-wallet-nft-defi-token-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,nabeelbaghoor/crypto-wallet-nft-defi-token-api"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/sSxr9LmJRLvANRroB/builds/mwto4uXUyy1LFfQJP/openapi.json
