Quickstart

Quickstart: call the Credicorp public API from C# / .NET

Here is the idiomatic C# / .NET 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

C# / .NETFirst call
timeoutBound every request
data[]Unwrap the envelope

List products

using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(10) };
http.DefaultRequestHeaders.Accept.Add(new("application/json"));
var res = await http.GetAsync("https://api.credicorp.co.uk/public/v1/products");
res.EnsureSuccessStatusCode();
var json = await res.Content.ReadFromJsonAsync<ProductList>();

Use a single shared HttpClient (never one per call) and ReadFromJsonAsync with a typed record. Register it via IHttpClientFactory in ASP.NET Core for pooling and resilience policies.

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

Should I new up HttpClient per request?

No — that exhausts sockets. Use one shared instance or IHttpClientFactory, which manages the lifetime and connection pool for you.

How do I handle errors in C# / .NET?

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.