GET
/
getTokens
import { setOnchainKitConfig } from '@coinbase/onchainkit';
import { getTokens } from '@coinbase/onchainkit/api';

setOnchainKitConfig({ apiKey: 'YOUR_API_KEY' });

const tokens = await getTokens({ limit: '1', search: 'degen' });
[
{
"address": "0x4ed4e862860bed51a9570b96d89af5e1b0efefed",
"chainId": 8453,
"decimals": 18,
"image": "https://d3r81g40ycuhqg.cloudfront.net/wallet/wais/3b/bf/3bbf118b5e6dc2f9e7fc607a6e7526647b4ba8f0bea87125f971446d57b296d2-MDNmNjY0MmEtNGFiZi00N2I0LWIwMTItMDUyMzg2ZDZhMWNm",
"name": "DEGEN",
"symbol": "DEGEN"
}
]

The getTokens function retrieves a list of tokens on Base by searching for the name, symbol, or address of a token.

Before using them, make sure to obtain a Client API Key from Coinbase Developer Platform.

Returns

Promise<GetTokensResponse>

Parameters

GetTokensOptions

Types

Query Parameters

limit
string

Maximum number of tokens to return

Substring to filter token names or symbols

Response

200 - application/json

Successful response – Array of token objects

The response is of type object[].