# Query Language API V1

The [MegaBill ](/user-guide/inform/megabill.md)filter API allows users to query and retrieve metadata for building filters on a huge dataset. This API provides endpoints to fetch MegaBill keys, values, virtual tags, and specific metadata for individual keys. This API is used to understand the different building blocks of Finout’s MegaFilter, and the information needed to build [Virtual Tags ](/user-guide/inform/virtual-tags.md)and views.

## <mark style="color:green;">`GET`</mark>`/Keys`

Retrieves all MegaBill keys.&#x20;

{% hint style="success" %}
**Prerequisites**

* [Generate a Client ID and Secret Key](/api/finout-api/generate-an-api-token.md) from Finout to add in Headers.&#x20;
  {% endhint %}

**Request**\
`https://app.finout.io/v1/megabill/query-language/keys`

**Response**

{% tabs %}
{% tab title="200" %}
{% code lineNumbers="true" fullWidth="false" %}

```json
{

    "keys": [
        {
            "costCenter": "Kubernetes",
            "key": "deployment",
            "displayName": "deployment"
        },
        {
            "costCenter": "AWS",
            "key": "f_usage_type",
            "displayName": "Usage Type"
        },
        {
            "costCenter": "databricks",
            "key": "run_name",
            "displayName": "run_name"
        },
      
        {
            "costCenter": "Custom Cost",
            "key": "customCost_QmFtYmEbabababoi",
            "displayName": "Bamba"
        }
    ],
    "requestId": "d4e8c06b-9fd3-4a80-87bd-d13878fa9bd9",
    "accountId": "e6ad4c08-9ecd-4592-be61-7a13ad456259"
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

Returns a JSON object with the following properties:

| Name        | Type   | Description                                  |
| ----------- | ------ | -------------------------------------------- |
| *keys*      | array  | An array of key metadata objects.            |
| *requestId* | number | The ID of the request in the Finout system.  |
| *accountId* | number | The ID of the account that made the request. |

The key\_metadata array has the following fields:

<table><thead><tr><th width="147">Field</th><th>Type</th><th>Description</th><th>Examples</th></tr></thead><tbody><tr><td><em>costCenter</em></td><td>string</td><td>The cost center associated with the key (display name).</td><td>"databricks"</td></tr><tr><td><em>key</em></td><td>string</td><td>The unique identifier in Finout.</td><td>"a3ViZXJuZXRlczpsYWJlbF9zcGFya19zcGFya19leGVjX2lk"</td></tr><tr><td><em>displayName</em></td><td>string</td><td>The external name identifier in Finout, is only used in Finout’s app.</td><td>"job-id"</td></tr></tbody></table>

&#x20;

## <mark style="color:green;">`GET`</mark>`/KeyValues`

Retrieve all values associated with a specific key. A successful response allows you to construct a virtual tag condition based on the key values and operators.

{% hint style="warning" %}
**Important**: Telemetry-based and relational virtual tag allocations support up to 10,000 values each.
{% endhint %}

{% hint style="success" %}
**Prerequisites**

* [Generate a Client ID and Secret Key](/api/finout-api/generate-an-api-token.md) from Finout to add in Headers.&#x20;
* You must first GET the key you want to query and then find the "cost center and "key".
  {% endhint %}

**Request**\
\
`http://app.finout.io/v1/megabill/query-language/values/{costcenter}/{key}`

*Path Parameters*

| Name           | Type   | Description                |
| -------------- | ------ | -------------------------- |
| *cost\_center* | string | The ID of the cost center. |
| *key*          | string | The ID of the key.         |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "values": [
        "us-east-1",
        "global",
        "eu-central-1",
        "eu-west-2",
        "ap-southeast-2",
        "ca-central-1",
        "ap-northeast-1",
        "eu-west-1",
        "us-east-2",
        "ap-northeast-2",
        "sa-east-1",
        "us-west-2",
        "us-west-1",
        "ap-south-1",
        "eu-west-3",
        "ap-southeast-1",
        "eu-north-1",
        "ap-northeast-3",
        "me-south-1",
        "af-south-1"
    ],
    "request": {
        "costCenter": "AWS",
        "key": "Region"
    },
    "requestId": "2e473bda-b96e-40a6-929c-2f5c445bf393",
    "accountId": "e6ad4c08-9ecd-4592-be61-7a13ad456259"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.finout.io/api/finout-api/query-language-api-v1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
