> ## Documentation Index
> Fetch the complete documentation index at: https://ormilabs.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# How to query 0xAPI

> How to perform a query on a REST endpoint to retrieve onchain data

In this guide, we will walk you through the steps to perform a query on a REST endpoint to retrieve onchain data.

## Prerequisites

Before you begin, make sure you have:

* A registered [Ormi account](https://app.ormilabs.com)
* An [API key](/data-api/quickstart/generate-an-api-key)
* A REST client (e.g., curl, Postman, or any HTTP client)

## Performing a query to fetch ERC-20 transfers

Here is an example of a query to retrieve the token balance of a wallet address on the Ethereum mainnet.

### Step 1: Identify the endpoint URL

Check out the [API Reference](/data-api-v2/api-reference).

<Frame>
  <img src="https://mintcdn.com/ormilabs/QF_fmnEzWAEcNv02/images/0xAPI/erc20-transfers.png?fit=max&auto=format&n=QF_fmnEzWAEcNv02&q=85&s=9db5da0773febafdb17bbf8ba6c67e68" alt="Retrieve ERC20 transfers" width="2665" height="2255" data-path="images/0xAPI/erc20-transfers.png" />

  <figcaption>Retrieve ERC20 transfers</figcaption>
</Frame>

### Step 2: Get the required variables

Copy and paste the required endpoint path and query parameters into the editor, then click "Send" to make the request.

<Frame>
  <img src="https://mintcdn.com/ormilabs/QF_fmnEzWAEcNv02/images/0xAPI/perform-query.png?fit=max&auto=format&n=QF_fmnEzWAEcNv02&q=85&s=2d4a69182934e441a80bc9dda15aa18f" alt="Perform Query" width="2012" height="2118" data-path="images/0xAPI/perform-query.png" />

  <figcaption>Perform query</figcaption>
</Frame>

### Step 3: Query with a third-party tool

You may use any third-party tool such as curl or Postman to directly query the endpoint.

<Frame>
  <img src="https://mintcdn.com/ormilabs/QF_fmnEzWAEcNv02/images/0xAPI/curl.png?fit=max&auto=format&n=QF_fmnEzWAEcNv02&q=85&s=95c934286705686378f668f76729fb57" alt="Using Curl" width="1402" height="292" data-path="images/0xAPI/curl.png" />

  <figcaption>Using curl for query</figcaption>
</Frame>

### Step 4: Check out code snippets

The API Reference page also provides handy code snippets for various programming languages to help you get started.

<Frame>
  <img src="https://mintcdn.com/ormilabs/QF_fmnEzWAEcNv02/images/0xAPI/languages.png?fit=max&auto=format&n=QF_fmnEzWAEcNv02&q=85&s=bd78192435a35ae9f2f98c4a7f591d58" alt="Using Other Programming Languages" width="1408" height="1106" data-path="images/0xAPI/languages.png" />

  <figcaption>Using other programming languages</figcaption>
</Frame>
