# Querying

## Creating API Keys

The first step in querying your data with Carpool (after Indexing your data), is to create an API key. The process is very straightforward. Head to the API Keys page in the app and click New API Key. From this page, you can view and manage your keys. To remove a key (if it’s been compromised, for example), simple click the trash icon next to it.

{% hint style="warning" %}

#### Deleting Keys

Deleting an API Key will make all future requests which use it fail. Make sure none of your systems are relying on an API Key that you’re deleting.
{% endhint %}

## Querying our API

View our API Reference for more information. Note that all of your queries **must** include your API key in the `x-api-key` header.

{% content-ref url="../api-reference/about-our-query-api" %}
[about-our-query-api](https://carpool.gitbook.io/carpool/api-reference/about-our-query-api)
{% endcontent-ref %}

## API Structure

Carpool's query API layer revolves around **one POST endpoint.** At a high level, there are two core components to the POST body that help specify your query.

1. **Type** - This is the type of query you'd like to make and is a **string.** ex) LIST\_INSTRUCTIONS
2. **Query** - Most other fields fall under here and is an **object**

The API is intent based and designed to be intuitive, removing the need for the user to understand any of the Elasticsearch DSL. It will be clear as you dive into the specifics of the API documentation here:

{% content-ref url="../api-reference" %}
[api-reference](https://carpool.gitbook.io/carpool/api-reference)
{% endcontent-ref %}

## Devnet Queries

We support all queries against Devnet data. Simply replace `mainnet` with `devnet` in the URL. In order to index data on Devnet, you must separately mark the program for indexing on Devnet on our UI. Furthermore, you will need to use Devnet-specific API keys.
