Skip to main content

Sample Requests

getBalances

USDC & DAI (ERC-20)

Retrieve balances for USDC and DAI. Note that this example shows how Advanced APIs normalize input and accept long, mixed-case address.

curl https://mainnet.ethereum.coinbasecloud.net \
-u username:password \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "coinbaseCloud_getBalances",
"params": {
"addressAndContractList": [
{
"address": "0x00000000DF0635793e91d4f8e7426dbd9ed08471186f428D",
"contract": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
},
{
"address": "0xdf0635793e91d4f8e7426dbd9ed08471186f428d",
"contract": "0x6b175474e89094c44da98b954eedeac495271d0f"
}
]
}
}'

NFT (ERC-721)

Retrieve NFT tokens.

curl https://mainnet.ethereum.coinbasecloud.net \
-u username:password \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "coinbaseCloud_getBalances",
"params": {
"addressAndContractList": [
{
"address": "0xa3e90da6c1d5ea0b1b4e881d1eaaaaaaf3c25cc2",
"contract": "0x5180db8F5c931aaE63c74266b211F580155ecac8"
}
]
}
}'

getSingleBalance

USDC (ERC-20)

Retrieve balances for USDC. Note that this example shows how Advanced APIs normalize input and accept a long, mixed-case address.

curl https://mainnet.ethereum.coinbasecloud.net \
-u username:password \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "coinbaseCloud_getSingleBalance",
"params": {
"address": "0x00000000DF0635793e91d4f8e7426dbd9ed08471186f428D",
"contract": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
}
}'

NFT (ERC-721)

Retrieve NFT tokens.

curl https://mainnet.ethereum.coinbasecloud.net \
-u username:password \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "coinbaseCloud_getSingleBalance",
"params": {
"address": "0xa3e90da6c1d5ea0b1b4e881d1eaaaaaaf3c25cc2",
"contract": "0x5180db8F5c931aaE63c74266b211F580155ecac8"
}
}'

getTokenAllowances

USDT (ERC-20)

Retrieve token allowances for USDT.

curl https://mainnet.ethereum.coinbasecloud.net \
-u username:password \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "coinbaseCloud_getTokenAllowances",
"params": {
"allowances": [
{
"owner": "0xa646147bda82a866eba03568f363fc9c90185c6e",
"spender": "0xadd0e097b961572b2a1f5de572c622eef97e3d82",
"contracts": [
"0xdac17f958d2ee523a2206206994597c13d831ec7"
]
}
]
}
}'

getTransactionsByAddress

ERC-20

Retrieve transactions for ERC-20 tokens between block 0x40f400 and block 0xdc3501.

curl https://mainnet.ethereum.coinbasecloud.net \
-u username:password \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "coinbaseCloud_getTransactionsByAddress",
"params": {
"address": "0xcAfB10eE663f465f9d10588AC44eD20eD608C11e",
"blockStart": "0x40f400",
"blockEnd": "0xdc3501",
"addressFilter": "SENDER_OR_RECEIVER"
}
}'

ERC-20 with pagination

Retrieve the second page of transactions in ascending order for an address with a page size of 5.

curl https://mainnet.ethereum.coinbasecloud.net \
-u username:password \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "coinbaseCloud_getTransactionsByAddress",
"params": {
"address": "0x3cd751e6b0078be393132286c442345e5dc49699",
"blockStart": "0x1",
"addressFilter": "SENDER_OR_RECEIVER",
"sort": "asc",
"pageSize": 5,
"pageNumber": 2
}
}'

getTokenTransfersByAddress

ERC-20 and ERC-721 token transfers

Return all ERC-20 and ERC-721 token transfers to the burn wallet up to block 0x16bc50.

curl https://mainnet.ethereum.coinbasecloud.net \
-u username:password \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "coinbaseCloud_getTokenTransfersByAddress",
"params": {
"address": "0x0000000000000000000000000000000000000000",
"blockStart": "0x1",
"blockEnd": "0x16bc50",
"addressFilter": "RECEIVER_ONLY"
}
}'

ERC-721 token transfers

Return all ERC-721 token transfers to or from a given address up to block 0xdb0db3.

curl https://mainnet.ethereum.coinbasecloud.net \
-u username:password \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "coinbaseCloud_getTokenTransfersByAddress",
"params": {
"address": "0x7be8076f4ea4a4ad08075c2508e481d6c946d12b",
"blockStart": "0x1",
"blockEnd": "0xdb0db3",
"addressFilter": "SENDER_OR_RECEIVER"
}
}'

Token transfers with pagination

Return the second page of token transfers to an address in descending order with a page size of 10.

curl https://mainnet.ethereum.coinbasecloud.net \
-u username:password \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "coinbaseCloud_getTokenTransfersByAddress",
"params": {
"address": "0x5b76f5B8fc9D700624F78208132f91AD4e61a1f0",
"blockStart": "0x1",
"addressFilter": "RECEIVER_ONLY",
"sort": "desc",
"pageSize": 10,
"pageNumber": 2
}
}'

getTransactionByHash

ETH transfer

Return transactions resulting from an ETH transfer.

curl https://mainnet.ethereum.coinbasecloud.net \
-u username:password \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "coinbaseCloud_getTransactionByHash",
"params": {
"transactionHash": "0x2be70b2bcff662ba941c3f3c7706ef2c674d0d0ea4a13a91543cbe18862063d4"
}
}'

ERC-721 transfer

Return transactions resulting from an ERC-721 transfer.

curl https://mainnet.ethereum.coinbasecloud.net \
-u username:password \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "coinbaseCloud_getTransactionByHash",
"params": {
"transactionHash": "0x30eda1f9a9d1ec16be8802d2332c7696bd25897eab15ad0269f8e73ed9a9e2b9"
}
}'

ERC-20 swap

Return transactions resulting from an ERC-20 swap.

curl https://mainnet.ethereum.coinbasecloud.net \
-u username:password \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "coinbaseCloud_getTransactionByHash",
"params": {
"transactionHash": "0xf21640da131e6cabb14fa291d0d95ca08a8c5aadb6548c5234f11dd8361b3693"
}
}'

ERC-721 sale

Return transactions resulting from an ERC-721 sale.

curl https://mainnet.ethereum.coinbasecloud.net \
-u username:password \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "coinbaseCloud_getTransactionByHash",
"params": {
"transactionHash": "0x48db4231fb7de49b624f0860fed5f459ca7231ff1f22ef58f00c1cefd6e454ef"
}
}'

getTokenStandardEvents

ERC 721

Retrieve events triggered by the token contract address up to block 0xf19ddf.

curl https://mainnet.ethereum.coinbasecloud.net \
-u username:password \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "coinbaseCloud_getTokenStandardEvents",
"params": {
"contract": "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d",
"blockStart": "0x1",
"blockEnd": "0xf19ddf",
"eventSignatureHashes": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
]
}
}'

ERC 721 with pagination

Retrieve the second page of events triggered by the token contract address in descending order with a page size of 5.

curl https://mainnet.ethereum.coinbasecloud.net \
-u username:password \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "coinbaseCloud_getTokenStandardEvents",
"params": {
"contract": "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d",
"blockStart": "0x1",
"eventSignatureHashes": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
],
"sort": "desc",
"pageSize": 5,
"pageNumber": 2
}
}'

getTokenMetadata

USDC (ERC-20)

Retrieve token metadata for USDC.

curl https://mainnet.ethereum.coinbasecloud.net \
-u username:password \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "coinbaseCloud_getTokenMetadata",
"params": {
"contract": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
}
}'

NFT (ERC-721)

Retrieve token metadata for an NFT.

curl https://mainnet.ethereum.coinbasecloud.net \
-u username:password \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "coinbaseCloud_getTokenMetadata",
"params": {
"contract": "0x1A92f7381B9F03921564a437210bB9396471050C"
}
}'

Was this helpful?