# Pool API

The FluxBeam Pool API allows developers to quickly and easily integrate the creation of pools within their platform.&#x20;

## Create Pool

{% openapi src="/files/BTXW41fbdTNJwtnc3yie" path="/v1/token\_pools" method="post" fullWidth="false" %}
[swagger.json](https://1346299214-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FT2Aiu5M1GjdMOI04TEPX%2Fuploads%2FtJlI9ZjUrfH7QfZeH8wj%2Fswagger.json?alt=media\&token=5f2a6e1a-245d-4019-ae4b-3cc068913b76)
{% endopenapi %}

### Example

{% code fullWidth="false" %}

```javascript
import { Connection, Keypair, VersionedTransaction } from '@solana/web3.js';

const form = {
	payer: "", 	  // Wallet address of the payer
	tokenA: "", 	  // Token A Mint
	tokenB: "", 	  // Token B Mint
	tokenAAmount: "", // Token A Liquidity Amount
	tokenBAmount: ""  // Token B Liquidity Amount
}

const resp = await (
	await fetch(`https://api.fluxbeam.xyz/v1/token_pools`, {
		method: 'POST',
		headers: {'Content-Type': 'application/json'},
		body: JSON.stringify({
			"payer": form.payer,
			"token_a": form.tokenA,
			"token_b": .form.tokenB,
			"token_a_amount": form.tokenAAmount,
			"token_b_amount": form.tokenBAmount
		})
	})).json()

console.log("Pool Address:", resp.pool)

//Decode the transaction from base64
const swapTransactionBuf = Buffer.from(resp.transaction, 'base64');
const transaction = VersionedTransaction.deserialize(swapTransactionBuf);

console.log("Transaction",transaction);

//Sign the transaction with the payer wallet
transaction.sign([wallet.payer]);

//Execute the transaction
const client= new Connection('{RPC_URL}');
const sig = client.sendRawTransaction(transaction.serialize(), {maxRetries: 3, skipPreflight: true})

console.log("Transaction Signature:", sig)
```

{% endcode %}


---

# 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.fluxbeam.xyz/developers/pool-api.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.
