Quickstart

Quickstart: call the Credicorp public API from Perl

Here is the idiomatic Perl way to make your first Credicorp public API call. List the live products from GET /public/v1/products, set a timeout, and turn the documented error envelope into an error you can handle — the pattern every other public-ring call reuses.

2 min read

PerlFirst call
timeoutBound every request
data[]Unwrap the envelope

List products

use HTTP::Tiny;
use JSON::PP;
my $res = HTTP::Tiny->new(timeout => 10)->get(
  'https://api.credicorp.co.uk/public/v1/products',
  { headers => { 'Accept' => 'application/json' } });
die $res->{status} unless $res->{success};
my $data = decode_json($res->{content})->{data};

HTTP::Tiny ships with modern Perl and needs no CPAN install for a simple GET. Decode with JSON::PP (also core) and check the success flag before using the body.

Use the sandbox in development

Point the base host at https://sandbox.credicorp.co.uk/public/v1 in development and CI, and at https://api.credicorp.co.uk/public/v1 in production, driven by one environment variable. See choosing a base URL.

Next steps

From here, request a quote, submit an enquiry, and send applicants to apply. Handle errors with the shared error envelope.

Frequently asked questions

Do I need LWP?

Not for a simple public GET — core HTTP::Tiny and JSON::PP are enough. Use LWP::UserAgent for more complex needs like cookies or proxies.

How do I handle errors in Perl?

Check the status code and read the error object from the body — error.code is the stable machine string to branch on. The pattern is identical across every endpoint.

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.