Quickstart

Quickstart: Generate a client from the OpenAPI description

Generating your client from the OpenAPI spec means your types can never drift from the API — regenerate on every contract change. This recipe gives you the exact code, uses only the unauthenticated public ring, and links to the endpoints and the application flow so the reader always has a next step.

2 min read

OpenAPIMachine-readable contract
codegenTypes + client
CI regenNever drift

Generate the client

# TypeScript, using openapi-typescript
npx openapi-typescript \
  https://dev.credicorp.co.uk/openapi.json \
  --output src/credicorp.d.ts

Point your generator (openapi-typescript, openapi-generator, oapi-codegen for Go, and so on) at the published description to produce models and a client that match the API exactly.

Keep it fresh in CI

Regenerate on a schedule or on a contract-changed signal and fail the build if the generated output changes unexpectedly — that diff is your early warning that the API contract moved.

Frequently asked questions

Where is the OpenAPI description?

Published on the developer portal alongside the reference. Point your codegen tool at it to produce a typed client.

Hand-write or generate?

Generate once you consume several endpoints — it removes an entire class of drift bugs. Hand-writing is fine for one or two calls.

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.