Skip to content

Repository files navigation

Etherscan.io API Specification in OpenAPI 3.1 Format

What is it?

The specification is a YAML file in OpenAPI 3.1 format, based on the Etherscan APIs documentation.

What is it for?

There are a number of Etherscan API HTTP-clients available in different languages, each varying in completeness and update frequency. With the API specification, you can generate an API HTTP-client in a supported language using various generators. Here are a few examples of such generators:

Is the Etherscan API completely described in the specification?

Almost. All requests are fully described, including PRO endpoints. However, some responses are only partially described:

Accounts

Module.ActionIs response described?
account.balance+
account.balancemulti+
account.txlistpartially
account.txlistinternalpartially
account.tokentxpartially
account.tokennfttxpartially
account.token1155txpartially
account.getminedblockspartially
account.txsBeaconWithdrawalpartially
account.balancehistory+

Contracts

Module.ActionResponse described
contract.getabi+
contract.getsourcecodepartially
contract.getcontractcreation+
contract.verifysourcecode+
contract.checkverifystatus+

Transactions

Module.ActionResponse described
transaction.getstatuspartially
transaction.gettxreceiptstatuspartially

Blocks

Module.ActionResponse described
block.getblockrewardpartially
block.getblockcountdown+
block.getblocknobytime+
stats.dailyavgblocksize+
stats.dailyblkcount+
stats.dailyblockrewards+
stats.dailyavgblocktime+
stats.dailyuncleblkcount+

Logs

Module.ActionResponse described
logs.getLogspartially

Geth/Parity Proxy

Module.ActionResponse described
proxy.eth_blockNumber+
proxy.eth_getBlockByNumberpartially
proxy.eth_getUncleByBlockNumberAndIndexpartially
proxy.eth_getBlockTransactionCountByNumber+
proxy.eth_getTransactionByHashpartially
proxy.eth_getTransactionByBlockNumberAndIndexpartially
proxy.eth_getTransactionCount+
proxy.eth_sendRawTransaction+
proxy.eth_getTransactionReceipt+
proxy.eth_call+
proxy.eth_getCode+
proxy.eth_getStorageAt+
proxy.eth_estimateGas+

Tokens

Module.ActionResponse described
stats.tokensupply+
account.tokenbalance+
stats.tokensupplyhistory+
account.tokenbalancehistory+
token.tokenholderlist+
token.tokeninfo+
account.addresstokenbalance+
account.addresstokennftbalance+
account.addresstokennftinventory+

Gas Tracker

Module.ActionResponse described
gastracker.gasestimate+
gastracker.gasoracle+
stats.dailyavggaslimit+
stats.dailygasused+
stats.dailyavggasprice+

Stats

Module.ActionResponse described
stats.ethsupply+
stats.ethsupply2+
stats.ethprice+
stats.chainsize+
stats.nodecount+
stats.dailytxnfee+
stats.dailynewaddress+
stats.dailynetutilization+
stats.dailyavghashrate+
stats.dailytx+
stats.dailyavgnetdifficulty+
stats.ethdailymarketcap+
stats.ethdailyprice+

Drawbacks

Paths contain query elements

All Etherscan API endpoint URLs follow the pattern ...etherscan.io/api?module=ModuleName&action=ActionName&....

However, in terms of OpenAPI 3.1, endpoint paths must be unique. To meet this requirement while still distinguishing path items, I have described paths in the specification like this:

paths:
/?account.balance:
get:
...
/?account.balancemulti:
get:
...

To make the linter ignore it, I have to disable path-not-include-query rule.

There are no 4xx responses described

This is because Etherscan API does not return such responses. All responses have a 200-OK code. To make the linter ignore this, I have to disable operation-4xx-response rule.

The tag-description linter rule is disabled.

According to the OA3.1 specification, tags are allowed to have no description. However, the Redoc linter activates this rule by default, so I need to disable it.

For developers

pnpm install
pnpm client
pnpm test

Issues and pull requests are welcome.

Use this at your own risk and responsibility. Please respect the Terms of Service of Etherscan.io.

About

Etherscan.io API Specification in OpenAPI 3.1 Format.

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages