# Get Pool by Address

We can query Fluxbeam pool data and filter them by fields using GraphQl APIs. Filters can be applied on any field, and in this case, we filter the <mark style="color:yellow;">pubkey</mark> field.

You can directly copy paste this code on <mark style="color:yellow;">replit</mark> and see it in action.

#### Fetch parsed pool info

{% tabs %}
{% tab title="Code Snippet" %}
{% code overflow="wrap" %}

```javascript
async function getPoolByAddress(poolAddress) {
  const SHYFT_API_KEY = "YOUR_SHYFT_API_KEY";
  //get a fluxbeam Pool details using pool address
  const operationsDoc = `
      query MyQuery {
        Fluxbeam_TokenSwap(
          where: {pubkey: {_eq: ${JSON.stringify(poolAddress)}}}
        ) {
          tokenPool
          mintB
          mintA
          pubkey
          curveType
        }
      }
      `; //you can cherrypick the fields as per your requirement
  const result = await fetch(
    `https://programs.shyft.to/v0/graphql/accounts?api_key=${SHYFT_API_KEY}&network=mainnet-beta`, //SHYFT's GQL endpoint
    {
      method: "POST",
      body: JSON.stringify({
        query: operationsDoc,
        variables: {},
        operationName: "MyQuery",
      }),
    },
  );

  const { errors, data } = await result.json();

  console.dir(data, { depth: null });
}

getPoolByAddress("GNezyhAbtximo2T63NBa96pYAnsfCXxW2dwcvziKfd9r");
//pool address for which you want the details
```

{% endcode %}
{% endtab %}

{% tab title="Response" %}

```json
{
  "data": {
    "Fluxbeam_TokenSwap": [
      {
        "tokenPool": "DUKAtn92YNKE1xLxDuKWu6Gg4urER69SzfvGawpHTWqk",
        "mintB": "3idXKhNNswwg4bYgxMFsNbTcCmVHeJzhZ9oTjhiyAnbk",
        "mintA": "So11111111111111111111111111111111111111112",
        "pubkey": "GNezyhAbtximo2T63NBa96pYAnsfCXxW2dwcvziKfd9r",
        "curveType": 0
      }
    ]
  }
}
```

{% endtab %}
{% endtabs %}

The Response contains `mintA` and `mintB` which is the <mark style="color:yellow;">liquidity pool pair</mark>. Please note that more fields such as `feeAccount`, `TokenPool`, `curveType` can also be cherrypicked as per your requirement.


---

# 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.shyft.to/solana-indexers/case-studies/fluxbeam/get-pool-by-address.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.
