Quickstart

Quickstart: call the Credit Corp public API from Rust

Here is the idiomatic Rust 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

RustFirst call
timeoutBound every request
data[]Unwrap the envelope

List products

use reqwest::Client;

let client = Client::builder()
    .timeout(std::time::Duration::from_secs(10))
    .build()?;
let res = client
    .get("https://api.credicorp.co.uk/public/v1/products")
    .header("Accept", "application/json")
    .send().await?
    .error_for_status()?;
let body: serde_json::Value = res.json().await?;

Use reqwest with tokio, build one Client and reuse it, and let error_for_status() turn a non-2xx into an error. Model the response with serde structs for full type safety.

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

reqwest or hyper?

reqwest for almost everything — it is ergonomic and handles TLS and pooling. Drop to hyper only if you need low-level control.

How do I handle errors in Rust?

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.