2 min read
Debounce the quote call
let t;
slider.addEventListener('input', () => {
clearTimeout(t);
t = setTimeout(async () => {
const res = await fetch(`${BASE}/quote`, {
method: 'POST', headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ amount: Number(slider.value), term_months: 6 }),
});
const q = await res.json();
output.textContent = `\u00a3${q.repayment}/month`;
}, 300);
});A 300ms debounce means one call per pause, not one per pixel — smooth for the user and easy on the limit.
Prefer client-side maths where you can
If you fetch pricing config once, you can compute the illustration entirely in the browser and skip the per-drag call altogether. Reserve the quote endpoint for the final confirmed figure.
Frequently asked questions
Will a slider trip the rate limit?
Not if you debounce. One call per pause keeps you comfortably under the limit; without debouncing a drag could fire dozens of calls.
Client-side or API maths?
Fetch pricing config and compute in the browser for a smooth slider, then confirm with a real quote before the reader applies.
Related reading

Quickstart: get an indicative loan quote from the public API
POST /public/v1/quote turns an amount and term into an illustrative repayment. Send the requested amount and…
Read →
Quickstart: read public pricing configuration
GET /public/v1/config/pricing exposes the representative pricing parameters behind the public quote. Use it…
Read →
Quickstart: handle rate limits on the public API
The public ring is rate-limited, and a 429 tells you exactly when to try again. Read the RateLimit-Remaining…
Read →
Quickstart: embed a product picker with the public API
A product picker is the simplest high-value embed: fetch the catalogue, render options, link to apply…
Read →Funding for UK limited companies
Credicorp lends to your company, not to you personally — short-term working capital with no personal guarantee. See what your business could access.