Integration Patterns

API Client Libraries and SDKs

Decide when a generated or hand-rolled client serves you better than raw HTTP calls.

What you'll learn

  • Compare SDKs, generated clients and raw HTTP
  • Weigh convenience against control and dependency cost
  • Evaluate an SDK before adopting it
  • Wrap a client to isolate your code from it
  • Keep a client dependency maintainable over time

6 min

Three ways to call an API

You can talk to an API at three levels of abstraction. Raw HTTP gives total control and no extra dependency, but you write everything — serialisation, error handling, retries — yourself. A generated client is produced from an API specification, giving typed methods that track the spec. A hand-written SDK is a crafted library offering a polished, idiomatic interface.

None is universally best. The right choice depends on how much the convenience is worth to you, how much control you need, and how comfortable you are taking on a dependency. The trade-off is fundamentally between doing the work yourself and trusting someone else's code to do it for you.

Convenience versus control

An SDK can save real effort: authentication, retries, pagination and serialisation handled for you, often with types that catch mistakes early. For a well-maintained library this is a genuine head start.

  • Pros — less boilerplate, fewer bugs in solved problems, faster to working code.
  • Cons — a dependency to track, less control over behaviour, and the SDK's bugs become yours.

Raw HTTP is the opposite: more work, but complete control and nothing to update. The decision often hinges on how standard your needs are. For ordinary usage an SDK usually wins; for unusual requirements or a desire to minimise dependencies, raw HTTP can be the cleaner path.

Evaluating an SDK

Before adopting any client library, weigh it like the long-term dependency it is. A poorly maintained SDK can cost more than the code it saves.

Check that it is actively maintained, with recent releases and responsive handling of issues. Confirm it tracks the API's current version and supports the runtime you use. Look at how it handles the things you care about — does it expose retry and timeout configuration, or hide them? Read enough of its source to gauge quality, since you are inheriting it. An unmaintained library wrapping an evolving API will eventually drift out of date and become your problem to fix or replace.

Wrap what you adopt

Whichever you choose, insulate your application from it behind a thin wrapper of your own. Your code calls your interface; the wrapper translates to the SDK or raw HTTP underneath.

class AccountClient:
    def get(self, id):
        # delegates to SDK or raw HTTP
        return self._impl.fetch(id)

This isolation pays off repeatedly: you can swap the SDK for raw HTTP (or vice versa) without touching the rest of the app, add your own resilience and logging in one place, and keep external types from leaking everywhere. It is a small upfront cost that buys lasting flexibility. Start integration design at the developer portal.

Key takeaways

  • You can use raw HTTP, a generated client, or a hand-written SDK
  • SDKs trade convenience for a dependency and less control
  • Evaluate any SDK as a long-term dependency before adopting it
  • Wrap whatever you choose behind your own thin interface
  • A wrapper lets you swap implementations and centralise resilience

FAQ

Should I use an SDK or raw HTTP?

An SDK usually wins for standard usage by handling auth, retries and serialisation for you. Raw HTTP suits unusual requirements or a desire to avoid dependencies, at the cost of writing more yourself.

What should I check before adopting an SDK?

That it is actively maintained, tracks the current API version, supports your runtime, and exposes the configuration you need such as timeouts and retries. Read its source, since you inherit its quality and bugs.

Why wrap a client library?

A thin wrapper isolates your application from the library, letting you swap implementations, add resilience and logging in one place, and stop external types leaking throughout your code. The small upfront cost buys lasting flexibility.

Integrate with Merion

Ready to build?

Read the API reference, grab the OpenAPI spec, and ship a resilient integration.