Alchemy API

Enterprise Grade API for Ethereum

Jumpstart your Ethereum development with Alchemy!
Instead of running your own nodes and building your own architecture,
just plug into our API and get back to focusing on developing
your application.

Get Started

Enhanced APIs

Alchemy offers a growing list of higher level methods as a convenience to developers.
View more details in dashboard →

Hexadecimal conversion

Unless otherwise specified, Alchemy methods will return decoded values in their responses (e.g., for token decimals, 18 will be returned instead of "0x12"). We plan to eventually normalize all methods in our enhanced API to return decoded values.

alchemy_getTokenAllowance

# Request
curl https://eth-mainnet.alchemyapi.io/jsonrpc/your-api-key \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"alchemy_getTokenAllowance","params":[{"contract":"0xE41d2489571d322189246DaFA5ebDe1F4699F498", "owner":"0xe8095A54C83b069316521835408736269bfb389C", "spender":"0x3Bcc5bD4abBc853395eBE5103b7DbA20411E38db"}],"id": 1}'
// Result
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "10963536149943846000",
}

Returns the amount which the spender is allowed to withdraw from the owner.

Parameters

  1. Object - An object with the following fields:
    • contract: DATA, 20 Bytes - The address of the token contract.
    • owner: DATA, 20 Bytes - The address of the token owner.
    • spender: DATA, 20 Bytes - The address of the token spender.

Returns

String - The allowance amount.

alchemy_getTokenBalances

This method returns hex encoded values in the tokenBalance fields.

# Request
curl https://eth-mainnet.alchemyapi.io/jsonrpc/your-api-key \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"alchemy_getTokenBalances","params": ["0x3f5ce5fbfe3e9af3971dd833d26ba9b5c936f0be", ["0x607f4c5bb672230e8672085532f7e901544a7375", "0x618e75ac90b12c6049ba3b27f5d5f8651b0037f6", "0x63b992e6246d88f07fc35a056d2c365e6d441a3d", "0x6467882316dc6e206feef05fba6deaa69277f155", "0x647f274b3a7248d6cf51b35f08e7e7fd6edfb271"]],"id":"42"}'
// Result
{
  "jsonrpc":"2.0",
  "id":1,
  "result": {
    "address": "0x3f5ce5fbfe3e9af3971dd833d26ba9b5c936f0be"},
    "tokenBalances": [{"contractAddress": "0x607f4c5bb672230e8672085532f7e901544a7375", "tokenBalance": "0x00000000000000000000000000000000000000000000000000044d06e87e858e", "error": null}, {"contractAddress": "0x618e75ac90b12c6049ba3b27f5d5f8651b0037f6", "tokenBalance": "0x0000000000000000000000000000000000000000000000000000000000000000", "error": null}, {"contractAddress": "0x63b992e6246d88f07fc35a056d2c365e6d441a3d", "tokenBalance": "0x0000000000000000000000000000000000000000000000000000000000000000", "error": null}, {"contractAddress": "0x6467882316dc6e206feef05fba6deaa69277f155", "tokenBalance": "0x0000000000000000000000000000000000000000000000000000000000000000", "error": null}, {"contractAddress": "0x647f274b3a7248d6cf51b35f08e7e7fd6edfb271", "tokenBalance": "0x0000000000000000000000000000000000000000000000000000000000000000", "error": null}]
}

Returns token balances for a specific address given a list of contracts.

Parameters

  1. DATA, 20 Bytes - The address for which token balances will be checked
  2. Array - A list of contract addresses

Returns

Object - An object with the following fields:

  • address: DATA, 20 Bytes - The address for which token balances were checked
  • tokenBalances: Array - returns an array of token balance objects. Each object contains the contract address, a tokenBalance field, and an error field. One of tokenBalance or error will be null.

alchemy_getTokenMetadata

# Request
curl https://eth-mainnet.alchemyapi.io/jsonrpc/your-api-key \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"alchemy_getTokenMetadata","params": ["0x1985365e9f78359a9B6AD760e32412f4a445E862"], "id": 1}'
// Result
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "logo": "https://static.alchemyapi.io/images/assets/1104.png",
    "symbol": "REP",
    "decimals": 18,
    "name": "Augur"
  }
}

Returns metadata (name, symbol, decimals, logo) for a given token contract address.

Parameters

  1. DATA, 20 Bytes - The address of the token contract.

Returns

Object - An object with the following fields:

  • name: String - The token's name. null if not defined in the contract and not available from other sources.
  • symbol: String - The token's symbol. null if not defined in the contract and not available from other sources.
  • decimals: Number - The number of decimals of the token. null if not defined in the contract and not available from other sources.
  • logo: String - URL of the token's logo image. null if not available.

Libraries

Parity Tracing APIs

Parity Tracing APIs give Alchemy users access to the most detailed information about on-chain activity. For more information about use, see the Parity Trace API Documentation. Trace APIs are currently available to Alchemy users in private beta. Just get in touch with us so we can learn more about your use case and we'd be more than happy to turn these on for your apps.

Updated 8 months ago

Enhanced APIs


Alchemy offers a growing list of higher level methods as a convenience to developers.
View more details in dashboard →

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.