2 min read
fetchBuilt-in, no deps
read+writeBoth shown
429Handled
Read the loyalty tiers
const res = await fetch('https://hub.credicorp.co.uk/public/v1/loyalty/tiers');
if (res.status === 429) {
const wait = Number(res.headers.get('retry-after') || 1);
await new Promise(r => setTimeout(r, wait * 1000));
}
const { tiers } = await res.json();
console.log(tiers.map(t => `${t.name}: ${t.benefit.arrangement_fee_discount_pct}%`));
Submit an enquiry
const res = await fetch('https://hub.credicorp.co.uk/public/v1/enquiries', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
form: 'contact-us', dept: 'support',
fields: { name: 'Jordan', email: '[email protected]', consent: 'yes' }
})
});
const body = await res.json();
if (res.status === 201) console.log('enquiry', body.id);
else console.error(body.error.code);
Notes
Remember the discount is in percent units (0.5 = 0.5%), consent must be "yes", and you should honour Retry-After on a 429. See the loyalty and enquiries references.
Frequently asked questions
Do I need a package to call the API from Node?
No. Node’s built-in fetch is enough — no dependency and no key. Add your own retry/jitter helper for production.
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.