Functional, modular and testable API Clients

http4k Connect is a lightweight API Client toolkit which includes libraries for connecting to popular third-party cloud services and AI backends

See the docs

More than 35 integrations

http4k Connect integrates with many popular Cloud and AI HTTP APIs.

Highlights

icon

Tiny
footprint

In true http4k-style, Connect clients rely on minimal dependencies and zero reflection, perfect for lightweight and security-conscious applications.

icon

Total
modularisation

Extension of the clients is as simple as combining function calls or implementing a single data class with just 2 simple methods.

icon

Kotlin-
centric

Every API Client leverages Result types and is exception-safe, so you can finally code like it's Kotlin that you're writing!

icon

Battle-tested
in the wild

Connect API Clients have been used to build high volume applications in Banking, Publishing, eCommerce & Government projects.

icon

First class
testability

Most API Clients come with an in-memory cloud-service fake which can be used for lightning fast test suites or spun up as a server.

All fakes are chaos-enabled, so you can test what happens to your code in failure scenarios.

icon

Total
control

Most API Client libraries hide their HTTP client from you, stopping you from implementing observability or customisation.

Connect allows any http4k client module to be plugged in, so you can leverage the full power of http4k

icon

Ultimate
type safety

API Clients leverage TinyTypes to provide typesafe coding and automatic serialisation.

Stop relying on unsafe, stringly-typed APIs.

icon

Simple Key/value
storage

Ships with a storage abstraction for simple key-value storage, and adapters for popular backends.

Plugin in-memory, S3, JDBC or Redis with a single line of code!

It's simple to use and extend the built-in API Clients...

1. Instantiate your API Client and use, injecting your own HTTP client for observability.

Using a Connect API Client

2. Is your API action not supported? No problem - simply create your own by extension!

Extending a Connect API Client

... or modularise your own API Clients in 4 easy steps ...

1. An API Action is just an interface with methods for marshalling the contents of HTTP messages.

Defining our Actions

2. An API Client is just a class with a single function and handles with the transport for the remote API.

Defining an API action

3. Implement any individual Action for your API with a single class and a extension method. Compose multiple calls together without bloating your API Client!

Defining a custom Operation

4. Instantiate the API Client by passing in the HTTP client and other transport requirements, and call it as normal. Exceptions are trapped in the returned Result.

Defining an API action

Learn from our examples

See how to harness the http4k Connect toolkit in your projects

Check it out

Corporate sponsors

http4k partners with selected organisations to fund and explore continued innovation around our projects. If your company is using http4k and would like to take advantage of this program, please get in touch.

Springer Nature Technology Kotlin Foundation