2 min read
Cache status, gate features
let apiHealthy = true;
setInterval(async () => {
try {
const { status } = await (await fetch(`${BASE}/status`)).json();
apiHealthy = status === 'operational';
} catch { apiHealthy = false; }
}, 60_000);
function renderQuoteWidget() {
return apiHealthy ? liveQuoteWidget() : cachedProductLinks();
}
Fail soft, not loud
When the API is impaired, show cached products and a link to business loans instead of a broken widget. The reader may never notice.
Choose what to gate
Not every feature needs gating. Static reference data you have already cached keeps working through an outage, so leave it alone. Reserve the gate for anything that makes a live call at the moment the user acts — a real-time quote or an enquiry submission — because those are what actually break when a component is impaired.
A good pattern is three states rather than two: fully operational (show everything), degraded (show cached data and hide live widgets), and unknown (the status call itself failed — treat as degraded and fail soft). Never let a failure to read status take your own page down with it.
Frequently asked questions
How often should I poll status?
Once a minute is plenty. Cache the result and gate off the cached value so status never sits in your hot path.
Status or healthz?
Use status for feature gating (it is per-component); use healthz for a bare deploy-time liveness check.
Related reading

Quickstart: read live API status programmatically
GET /public/v1/status gives your integration a machine-readable view of API health. Read it to gracefully…
Read →
Quickstart: verify connectivity with the healthz endpoint
Before you debug an integration, prove you can reach the API at all with GET /public/v1/healthz. It is a…
Read →
Quickstart: handle Credicorp API error responses
Every Credicorp API error uses the same envelope: { error: { type, code, message, request_id } }. Branch on…
Read →
Quickstart: Cache the product catalogue correctly
The catalogue changes rarely, so caching it removes the API from your hot path and keeps you well under the…
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.