Skip to main content
The DFlow Trade API is available at https://quote-api.dflow.net for public use, but this endpoint has rate limits that make it insufficient for production applications.
For production use, integrators should contact [email protected] to receive an API key with higher rate limits.

Using Your API Key

Once you receive your API key, include it in all requests to the Trade API by setting the x-api-key header. Requests that include a valid API key are authenticated and benefit from higher rate limits suitable for production use.

GET Requests

For GET requests, include the API key in the request headers:
const API_KEY = process.env.DFLOW_API_KEY; // or your API key
const API_BASE_URL = "https://quote-api.dflow.net";

const queryParams = new URLSearchParams();
queryParams.append("inputMint", SOL);
queryParams.append("outputMint", USDC);
queryParams.append("amount", amount.toString());
queryParams.append("slippageBps", slippageBps.toString());
queryParams.append("userPublicKey", keypair.publicKey.toBase58());

const response = await fetch(
  `${API_BASE_URL}/order?${queryParams.toString()}`,
  {
    headers: {
      "x-api-key": API_KEY,
    },
  }
).then((x) => x.json());

POST Requests

For POST requests, include the API key alongside other headers:
const API_KEY = process.env.DFLOW_API_KEY; // or your API key
const API_BASE_URL = "https://quote-api.dflow.net";

const response = await fetch(`${API_BASE_URL}/submit-intent`, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-api-key": API_KEY,
  },
  body: JSON.stringify({
    quoteResponse: intentData,
    signedOpenTransaction: Buffer.from(openTransaction.serialize()).toString(
      "base64"
    ),
  }),
});
const submitIntentData = await response.json();

Security Best Practices

  • Store your API key securely using environment variables
  • Never commit API keys to version control
  • Rotate your API key if it’s ever exposed

Getting Help

If you need an API key or have questions about rate limits, please contact us at [email protected].