# Get Pool by Address

Pump.fun has now launched its own decentralized exchange called <mark style="color:yellow;">PumpSwap</mark>, to which pump tokens migrate to after completing their bonding curve. Using Pump AMM's GraphQL API, we can query and filter pool data based on any available field. Here, we filter by the `pubkey` field to fetch pool details for the corresponding pool.

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

#### Fetch parsed pump swap pool info

{% tabs %}
{% tab title="Code Snippet" %}

<pre class="language-javascript" data-overflow="wrap"><code class="lang-javascript">async function getPoolDetailsByPoolAddress(address) {
  const SHYFT_API_KEY = "YOUR_SHYFT_API_KEY";
  //query to get pool details on PumpSwap by pool address
  const operationsDoc = `
    query MyQuery {
      pump_fun_amm_Pool(
          where: {pubkey: {_eq: ${JSON.stringify(address)}}}
      ) {
          base_mint
          creator
          index
          lp_mint
          lp_supply
          pool_base_token_account
          pool_bump
          pool_quote_token_account
          quote_mint
          pubkey
      }
  }
`; //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}&#x26;network=mainnet-beta`, //SHYFT's GQL endpoint
    {
      method: "POST",
      body: JSON.stringify({
        query: operationsDoc,
        variables: {},
        operationName: "MyQuery",
      }),
    }
  );

<strong>    const { errors, data } = await result.json();
</strong>
    console.dir(data, { depth: null });
 }

getPoolDetailsByPoolAddress("DCQWy2Jx8vodKaznKdYWv5BXnXDgFgjHqFgKHypzr3x");
//pool address for which we are fetching data
</code></pre>

{% endtab %}

{% tab title="Response" %}

```json
{
    "pump_fun_amm_Pool": [
      {
        "base_mint": "3LPPX5giSRgVBkf9DXbdRi9GxZPCuY9yqxzMDFMcXGhi",
        "creator": "83Cas69WaTJ15k2NtSRodLJh7p6cqt3WC2XEMJJMiECa",
        "index": 0,
        "lp_mint": "EjwSxbdpCmm1ofzEkbhj9SnNTR9xd7MNFyak2qAiU9t7",
        "lp_supply": 100,
        "pool_base_token_account": "AtSusre5nBcwbXP4epKAvULMAVTzzBFiabMkMvmNLAEY",
        "pool_bump": 253,
        "pool_quote_token_account": "9Pnb3uEWtssrec9hLZ1Ftb7YYWk3GDDQNHtY6Yhux3DH",
        "quote_mint": "So11111111111111111111111111111111111111112",
        "pubkey": "DCQWy2Jx8vodKaznKdYWv5BXnXDgFgjHqFgKHypzr3x"
      }
    ]
  }
```

{% endtab %}
{% endtabs %}

The response contains `base_mint` and `quote_mint` which is the <mark style="color:yellow;">liquidity pool pair</mark>. The `lp_mint` field is the liquidity pool token address. Please note that more fields such as `pool_base_token_account`, `pool_quote_token_account`, `lp_supply`can also be cherrypicked, or omitted as per your requirement.
