Recipe

Headless-render a CMS page

Pull published Credicorp copy into your own front end from one keyed read. GET /public/v1/cms/pages/{key} returns sanitised, ready-to-render HTML for a published page. Cache it by its updated field, treat a 404 as "not published", and you have a headless CMS feed with no login.

2 min read

publishedDrafts return 404
sanitisedServer-cleaned HTML
{key}Stable identifier

Step 1 — read a page by key

curl -sS https://hub.credicorp.co.uk/public/v1/cms/pages/responsible-lending

Step 2 — render the HTML

The html field is sanitised server-side, so you can inject it into your template. Apply your framework’s own escaping rules as defence in depth. Show the title as the heading.

Step 3 — cache by updated

Cache the response keyed on the page key plus its updated timestamp; refresh when updated moves. See Caching.

Handling a missing page

An unknown or unpublished key returns 404. Treat it as "no content here" — render a fallback, do not error. Drafts are indistinguishable from missing pages on the public ring, which is the point.

Frequently asked questions

Can I fetch a draft this way?

No. Only published pages are exposed. An unpublished key returns 404, exactly like a non-existent one, so drafts never leak.

Do I still need to escape the HTML?

The content is sanitised server-side, but apply your own framework’s injection rules at render time as belt-and-braces.

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.