Quickstart

Quickstart: call the Credit Corp public API from Kotlin

Here is the idiomatic Kotlin way to make your first Credit Corp 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

KotlinFirst call
timeoutBound every request
data[]Unwrap the envelope

List products

val client = OkHttpClient.Builder()
    .callTimeout(10, TimeUnit.SECONDS)
    .build()
val req = Request.Builder()
    .url("https://api.credicorp.co.uk/public/v1/products")
    .header("Accept", "application/json")
    .build()
client.newCall(req).execute().use { res ->
    if (!res.isSuccessful) error(res.code)
    println(res.body?.string())
}

On the JVM, OkHttp is the idiomatic choice; on Android it is already common. Reuse one OkHttpClient, set a call timeout, and parse with kotlinx.serialization or Moshi.

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

Can I use this on Android?

Yes. OkHttp is standard on Android. Do the call off the main thread (a coroutine on Dispatchers.IO) and never block the UI thread.

How do I handle errors in Kotlin?

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

Credit Corp lends to your company, not to you personally — short-term working capital with no personal guarantee. See what your business could access.