Skip to main content

Stash API quick start

tip

Request your Stash API key via Sprinter Stash Request or contacting support@sprinter.tech

As a Solver

Sprinter Stash enables solvers to borrow credit crosschain on-demand to execute user intents without needing pre-funded inventory.

This guide covers:

  1. Recap of the Stash Solver Fill Lifecycle
  2. Requesting a Credit Borrow Cost Estimate
  3. Requesting a Final Borrow Quote and Credit Authorization
  4. Check out the Fill Optimization Tips

1. Stash Solver Fill Lifecycle

2. Request a Credit Borrow Cost Estimate (Optional)

Call the Borrow Cost API to preview an estimated borrowing cost for a potential fill before requesting credit.

Fetch Borrow Cost Estimate
const protocol = "across"; // Example: "across", "uniswapx"
const type = "swap"; // Example: "swap", "bridge"

const response = await fetch(
`https://api.sprinter.tech/v1/liquidity/protocol/${protocol}/type/${type}/quote`,
{
method: "GET",
headers: {
"Content-Type": "application/json",
"X-API-Key": "<your_api_key>",
},
},
);

const costEstimate = await response.json();
console.log("Borrow Cost Estimate:", costEstimate);

3. Request a Final Borrow Quote

If the estimated cost is acceptable, call the Borrow Quote API to request a borrow quote to reserve credit and authorize the fill.

Request Final Borrow Quote
const protocol = "across";
const txHash = "0xabc123"; // Related transaction hash

const response = await fetch(
`https://api.sprinter.tech/v1/liquidity/protocol/${protocol}/deposit/${txHash}/request`,
{
method: "GET",
headers: {
"Content-Type": "application/json",
"X-API-Key": "<your_api_key>",
},
},
);

const borrowQuote = await response.json();
console.log("Borrow Quote:", borrowQuote);

4. Fill Optimization Tips

Here are some tips on getting the best performance and profit from your Sprinter Stash integration:

  1. Pre-fetch Borrow Cost - Call GET /type/{type}/quote as early as possible (when detecting intents) to evaluate solver profitability.

  2. Batch Gas Where Possible - Bundle execution and repayment transactions to reduce gas costs.

  3. Optimize for Slippage - Query quotes close to execution time to reduce stale pricing or slippage-induced fills.

  4. Handling Rate Limits - If you hit 429s, give it a moment and retry using retry_after value. You can request higher limits via support@sprinter.tech.

  5. Validate Transaction Hash Early - Ensure the user intent transaction is final and not reverted before calling /deposit/{txHash}/request.