Getting started overview

This guide provides a streamlined path for developers to begin using the Ethplorer Public API. It covers the necessary steps from account creation and API key generation to executing a successful first API call. Ethplorer offers access to detailed Ethereum blockchain data, including transaction histories, token information, and address balances, enabling integration into various applications and analytics tools. The process is designed to be straightforward, allowing developers to quickly retrieve data with minimal setup.

Before making any requests, developers need to secure an API key, which authenticates calls to the Ethplorer service. This key is included directly in the request URL for simplicity. The free tier provides sufficient access for initial exploration and development, while Ethplorer Pro API plans offer increased rate limits and additional features for production environments.

Here’s a quick reference table outlining the essential steps to get started:

Step What to Do Where
1. Create Account Register for a free Ethplorer account. Ethplorer registration page
2. Generate API Key Access your dashboard and create a new API key. Ethplorer API dashboard
3. Make First Request Use your API key to query an endpoint, e.g., token info. Terminal (curl), Python, JavaScript
4. Explore Documentation Review available endpoints and data structures. Ethplorer API reference

Create an account and get keys

To access the Ethplorer API, you must first register for an account. This account provides access to your personal dashboard, where API keys are managed. Follow these steps to obtain your API key:

  1. Navigate to the Ethplorer website: Open your web browser and go to the Ethplorer homepage.
  2. Register for a new account: Click on the "Sign Up" or "Register" link. You will typically need to provide an email address and create a password. Complete any necessary verification steps, such as email confirmation.
  3. Log in to your account: Once registered and verified, log in to your Ethplorer dashboard.
  4. Access the API section: Within your dashboard, locate the "API" or "API Keys" section. This area is specifically designed for managing your API credentials.
  5. Generate a new API key: Click on the option to generate a new API key. Ethplorer will provide a unique string that serves as your API key. It is crucial to treat this key with the same security as a password, as it grants access to the API on your behalf. Copy this key immediately and store it securely.

This API key is a required parameter for nearly all Ethplorer Public API requests. Without it, your requests will be rejected. Ethplorer's authentication method involves passing the API key as a query parameter in the request URL, typically named apiKey.

Your first request

With your API key in hand, you can now make your first request to the Ethplorer API. A common starting point is to fetch information about a specific Ethereum token. For this example, we'll retrieve data for the WETH (Wrapped Ether) token, which has a well-known contract address on the Ethereum mainnet. The Ethplorer API provides an endpoint for retrieving token information using its contract address.

The base URL for the Ethplorer Public API is https://api.ethplorer.io/.

Example: Get Token Information (WETH)

We will use the getTokenInfo endpoint. The contract address for WETH is 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2.

cURL Example

Open your terminal or command prompt and execute the following curl command. Replace YOUR_API_KEY with the actual API key you generated.


curl "https://api.ethplorer.io/getTokenInfo/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2?apiKey=YOUR_API_KEY"

A successful response will return a JSON object containing details such as the token's name, symbol, total supply, decimals, and various metrics. For instance, the JSON will contain fields like name (e.g., "Wrapped Ether"), symbol (e.g., "WETH"), and decimals (e.g., 18).

Python Example

For Python developers, you can use the requests library to make API calls:


import requests
import json

API_KEY = "YOUR_API_KEY"  # Replace with your actual API key
WETH_CONTRACT_ADDRESS = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"

url = f"https://api.ethplorer.io/getTokenInfo/{WETH_CONTRACT_ADDRESS}?apiKey={API_KEY}"

try:
    response = requests.get(url)
    response.raise_for_status()  # Raise an exception for HTTP errors
    data = response.json()
    print(json.dumps(data, indent=4))
except requests.exceptions.RequestException as e:
    print(f"An error occurred: {e}")

JavaScript (Node.js) Example

Using fetch in a Node.js environment:


const fetch = require('node-fetch'); // For Node.js, install with `npm install node-fetch@2` for older versions or use built-in fetch for Node.js 18+

const API_KEY = "YOUR_API_KEY"; // Replace with your actual API key
const WETH_CONTRACT_ADDRESS = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";

const url = `https://api.ethplorer.io/getTokenInfo/${WETH_CONTRACT_ADDRESS}?apiKey=${API_KEY}`;

async function getTokenInfo() {
  try {
    const response = await fetch(url);
    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }
    const data = await response.json();
    console.log(JSON.stringify(data, null, 2));
  } catch (error) {
    console.error(`Error fetching token info: ${error}`);
  }
}

tokenInfo();

This initial request confirms that your API key is valid and that you can successfully communicate with the Ethplorer API.

Common next steps

After successfully making your first API call, you can explore the broader capabilities of the Ethplorer API. Here are some common next steps for developers:

  • Explore other endpoints: Review the Ethplorer API reference documentation to discover other available endpoints. These include retrieving information about addresses (getAddressInfo), transaction details (getTxInfo), and token history.
  • Integrate into your application: Start integrating Ethplorer data into your application. This might involve displaying real-time transaction feeds, token prices, or building custom dashboards for Ethereum analytics.
  • Handle rate limits: The free tier of Ethplorer has specific rate limits. For production applications or higher usage requirements, consider upgrading to an Ethplorer Pro API plan to access increased request allowances and dedicated support.
  • Error handling: Implement robust error handling in your code to manage API responses that indicate issues such as invalid API keys, rate limit exceedances, or internal server errors. The API typically returns HTTP status codes and JSON error messages to help diagnose problems.
  • Secure your API key: Ensure your API key is never exposed on the client side in web applications or hardcoded directly into public repositories. Use environment variables or a secure configuration management system to protect your credentials. More general best practices for API key security are detailed by resources like Google Developers' API key best practices.
  • Explore WebSockets (Pro API): For real-time data streaming, the Ethplorer Pro API offers WebSocket functionality. This is suitable for applications requiring immediate updates on transactions or address activity, avoiding the latency of polling HTTP endpoints.

Troubleshooting the first call

Encountering issues during your first API call is common. Here are some troubleshooting tips for common problems:

  • Invalid API Key (HTTP 401 Unauthorized):
    • Symptom: The API returns an HTTP 401 Unauthorized status code or an error message indicating an invalid key.
    • Solution: Double-check that you have copied your API key correctly from your Ethplorer API dashboard. Ensure there are no leading or trailing spaces, and that the key is placed correctly in the apiKey query parameter of your URL.
  • Rate Limit Exceeded (HTTP 429 Too Many Requests):
    • Symptom: The API returns an HTTP 429 Too Many Requests status code.
    • Solution: If you are on the free tier, you might be making requests too frequently. Wait for a few seconds before retrying. For applications requiring higher throughput, consider upgrading to a Pro API plan to increase your rate limits.
  • Incorrect Endpoint or Parameters (HTTP 400 Bad Request / 404 Not Found):
    • Symptom: You receive an HTTP 400 Bad Request or 404 Not Found status code, or the response JSON indicates an error related to parameters.
    • Solution: Verify that the endpoint path and parameter names match those specified in the Ethplorer API documentation. Ensure the contract address or other identifiers are valid and correctly formatted (e.g., checksummed Ethereum addresses).
  • Network Issues:
    • Symptom: Connection timeouts or no response from the API.
    • Solution: Check your internet connection. Ensure there are no firewall rules or proxy settings blocking your outbound requests to api.ethplorer.io.
  • Malformed JSON Response:
    • Symptom: Your code fails to parse the JSON response.
    • Solution: This often indicates an upstream error that returned non-JSON content, or an incomplete response. Check the raw response content if possible, and ensure the request was successful (HTTP 200 OK) before attempting to parse.