SDK vs API: What's the Difference and When You Need Each
An SDK is not an alternative to an API - it is a toolkit wrapped around one. Here is what that means for your integration effort, and how to decide which route to take.
- An API is the interface a system exposes; an SDK is a toolkit that wraps that interface for one language or platform. Almost every SDK talks to an API underneath, so they are not competing options.
- The real decision is whether to integrate directly against the vendor's API or adopt the SDK it ships - a trade of speed and convenience against control, dependency weight and lock-in.
- Evaluate an SDK the way you would evaluate any dependency you are adopting: release cadence, first-party or community, coverage of the API, licence, and whether you can drop to raw HTTP when you need to.
Vendor documentation almost always opens with the same line: we offer a REST API and SDKs for your favourite languages. If you are the person working out how much integration work that implies, the phrasing is unhelpful, because it presents two things as if they were a menu with two options. They are not at the same level. An API is the interface a system exposes. An SDK is a toolkit that wraps that interface for a specific language or platform to make it easier to use. Almost every SDK you will ever install is talking to an API underneath.
So the question is never SDK or API in the abstract. It is: should our team integrate directly against the vendor's API, or adopt the SDK the vendor ships for our language? That is a real decision with consequences for delivery speed, control and long-term maintenance, and this guide walks through how to make it.
What An API Actually Is
An API (application programming interface) is the contract a system publishes so other software can use it. For most web services that means a set of HTTP endpoints: a documented URL for each operation, a defined request shape, a defined response shape, authentication rules, error codes and rate limits. The contract is language neutral. Anything that can make an HTTP request can use it, whether that is a Go service, a scheduled Python job or a curl command in a shell script.
The API is also where the design decisions that shape your integration live - how resources are modelled, how pagination works, how errors are reported. If you are choosing a style for an API you are building yourself rather than consuming someone else's, our guide to REST vs GraphQL covers that ground separately.
What An SDK Actually Is
An SDK (software development kit) is a package you install into your project that wraps an API in the idioms of one language. Instead of assembling an HTTP request, signing it, sending it and parsing the JSON that comes back, you call a method on an object and get a typed result.
Take a payments provider as the everyday example. The REST API is the contract: an endpoint that accepts a charge request with an amount, a currency and a payment method, and returns either a charge object or a structured error. The SDK is the library you install that gives you a client, a create-charge method, request objects with named fields your editor can autocomplete, and sensible defaults for the plumbing you would otherwise hand-roll. Both routes hit the same endpoint. One of them just does more of the work for you.
A maps provider works the same way, with a twist. The underlying service is an API, but the mobile SDK also ships a rendering component, gesture handling and tile caching, because drawing an interactive map on a phone is a great deal more than a request and a response. That is typical: the further you get from plain data access, the more an SDK contains that is not simply a wrapper around calls.
What Is Actually Inside An SDK
Beyond the raw calls, an SDK commonly bundles the things every integration has to solve anyway:
- Authentication and token refresh - often the single largest saving. OAuth flows, request signing schemes and expiring tokens are fiddly to implement and easy to get subtly wrong.
- Retries and backoff - a well-built SDK knows which errors are safe to retry and waits sensibly between attempts instead of hammering a service that is already struggling.
- Pagination helpers - iterating a result set of unknown length becomes a simple loop rather than manual cursor bookkeeping.
- Typed models - request and response objects your compiler and editor understand, which converts a whole class of runtime bugs into build errors.
- Error handling - provider error codes mapped onto language-native exceptions or result types, so failures are handled the way the rest of your code handles failures.
- Idempotency support, where the API offers it, so a retried call does not quietly create a duplicate record.
- Platform plumbing, especially on mobile: background threads, lifecycle handling, permission prompts, and sometimes drop-in UI components such as a payment sheet or a map view.
- Caching or offline behaviour in some SDKs, which is convenient right up to the point where you need to reason about what is stale and why.
None of this is magic. It is code someone else wrote and now maintains on your behalf, which is exactly the trade you are making when you adopt it.
Direct API Integration vs Vendor SDK
| Direct API | Vendor SDK | |
|---|---|---|
| Speed to first working call | Slower - you build auth, parsing and error handling yourself | Usually fastest - install, add a key, call a method |
| Control | Full control of headers, timeouts, retries, connection reuse | Whatever the SDK chooses to expose |
| Dependency and upgrade burden | Minimal - an HTTP client you almost certainly already have | A new dependency plus its transitive tree, to be tracked and upgraded |
| Language and platform support | Any language that speaks HTTP | Only the languages the vendor ships and keeps current |
| Debugging transparency | You can see every request and response on the wire | Behaviour sits behind layers - you rely on the SDK's own logging |
| Bundle and runtime weight | Negligible | Can be significant, particularly in the browser and on mobile |
| Vendor lock-in | Lower - the HTTP contract stays portable | Higher - SDK types and idioms spread through your codebase |
| When the vendor deprecates something | You change your own calls on your own schedule | You wait for a release, then upgrade, sometimes onto a new major version |
When The SDK Is The Right Call
- Your language and platform are mainstream and the SDK is first-party and actively maintained. This is the common case, and the SDK is usually the correct default.
- Authentication is complex. If the provider uses an OAuth flow with refresh tokens or a custom request signing scheme, let their code handle it rather than reimplementing a security-sensitive protocol.
- You are building on a mobile platform. Mobile SDKs typically carry lifecycle, threading and permissions handling that is genuinely tedious to replicate correctly.
- You need a broad slice of the API. The more endpoints you touch, the better the SDK amortises its weight.
- Time to market matters more than fine-grained control, which for a first release it usually does.
When To Go Direct To The API
- Your language or runtime is not supported, or the only option is a thin community package with one contributor.
- You need control at the HTTP layer - custom timeouts, connection pooling, a corporate proxy, mutual TLS, or signing your platform already handles.
- You only need two or three endpoints. Pulling a large dependency into your build to call one endpoint is a poor trade.
- Bundle size is a real constraint, as it often is in a browser application or on a low-end Android device.
- You need behaviour the SDK hides or overrides, such as your own retry policy, your own idempotency keys or your own observability on every outbound call.
- The SDK looks stale. This is the uncomfortable one, and it deserves saying plainly.
An abandoned SDK is a genuine liability, not a minor inconvenience. It pins you to old transitive dependencies, it stops receiving security patches, and when the provider changes something you are the one reverse-engineering the wire format under time pressure. If an SDK has seen no release in a long time while the API it wraps is clearly still moving, treat it as code you would be adopting rather than a service you are buying, and price it accordingly.
How To Evaluate An SDK Before You Adopt It
Run the same checks you would run on any dependency you are taking responsibility for:
- Check the date of the last release and the cadence before it. A steady rhythm matters more than raw recency.
- Confirm whether it is first-party, published by the vendor, or a community package. Community packages can be excellent, but the support expectations are different and worth being explicit about internally.
- Read the open issues rather than counting them. Are bug reports answered? Are there long-standing threads about the exact behaviour you depend on?
- Look for semantic versioning discipline and a changelog. If major versions arrive with unannounced breaking changes, every upgrade becomes a project.
- Check coverage. Does it wrap the whole API or a popular subset? Confirm the specific endpoints you need are supported, not just the headline ones.
- Check the licence and whether it fits your distribution model, especially for anything you ship to customers or embed in a mobile app.
- Look for an escape hatch - a documented way to send a raw request through the SDK's configured client. Being able to reach an endpoint the SDK has not wrapped yet is a strong signal of a well-designed library.
- Skim the source of one method you care about. Ten minutes reading how it handles errors tells you more than any README.
Two of these outweigh the rest: release cadence, because it predicts your future maintenance load, and the escape hatch, because it means an SDK gap never becomes a blocker.
What This Means If You Are Building The Product
If you are on the other side of this - shipping a platform other developers integrate with - the sequence is settled. Ship the API first. The API is the product. Get the contract, the error model, the pagination and the versioning policy right, publish a machine-readable schema so customers can generate their own clients, and write documentation someone can integrate from without a call.
An SDK is a developer-experience investment you make once the API is stable, and it is a maintenance commitment per language rather than a one-off deliverable. Every API change becomes a release in each language you support, forever. Most teams are better served by one excellent API plus one SDK for the language most of their customers actually use, than by five half-maintained SDKs.
One thing that does not move into the SDK: the security model. An SDK runs on someone else's machine and can be bypassed, so authorisation, rate limiting and validation all have to live at the API. Our post on API security best practices covers what that looks like in practice.
Library vs Framework vs API vs SDK
These four terms get used interchangeably in sales material, which is a large part of why the question comes up at all. The practical distinctions:
| Term | What it is | How to tell |
|---|---|---|
| API | A published interface to a system, commonly over HTTP | You call it across a boundary; you do not install it |
| Library | Code you install and call from your own code | Your code stays in charge and decides when to call it |
| Framework | A structure that calls your code at defined points | The framework is in charge; you fill in the gaps |
| SDK | A kit for building on a specific platform or service: usually one or more libraries plus tools, samples and sometimes a CLI or emulator | It is tied to one vendor or platform |
For web services, SDK and client library are used interchangeably in practice and that is fine. The distinction carries more weight on platforms, where an SDK really does include tooling beyond a library.
What To Ask For When You Commission The Work
If you are briefing an agency or an internal team, three questions sharpen any estimate: which integrations are we adopting the vendor SDK for and which are we writing direct, what is the plan when each of those vendors ships a breaking change, and where does the integration code live so it can be replaced without touching business logic.
That last point is the one that saves money later. Wrap every third-party integration behind a thin interface of your own, so swapping an SDK for direct calls, or one vendor for another, stays a contained change instead of a rewrite. We build that boundary in by default on custom software development projects, and it is worth insisting on when you hire developers to extend a system that already exists.
Not Sure Which Route Your Integration Needs?
Send us the vendor docs and your stack. We will tell you where the SDK earns its place, where a direct integration is cleaner, and what each option costs to maintain.
Conclusion
SDK and API are not competing choices. The API is the contract; the SDK is one convenient way to use it, in one language, maintained by someone else. For a mainstream language with a well-kept first-party SDK and non-trivial authentication, take the SDK and get on with the actual product. For an unsupported language, a couple of endpoints, tight bundle budgets or an SDK that has clearly stopped moving, go direct and keep the control. Either way, keep the integration behind your own interface, because the vendor's answer to this question will change before yours does.
The one-line version: an SDK is a convenience layer over an API, so ask not which one, but whether this particular SDK, in this particular language, is worth the dependency.
Frequently asked questions
What is the difference between an SDK and an API?
An API is the interface a system exposes so other software can talk to it, usually a set of documented HTTP endpoints with defined requests, responses and authentication. An SDK is a toolkit you install into your project that wraps that API for one specific language or platform. They are not alternatives: an SDK almost always calls an API underneath.
Do I need an SDK to use an API?
No. Any language that can make an HTTP request can use a typical web API directly. An SDK simply saves you from writing the authentication, retry, pagination and parsing code yourself. If the SDK for your language is well maintained, using it is usually faster; if there is no SDK for your language, integrating directly is entirely normal.
Is an SDK the same as a library?
Not quite, though the terms are used interchangeably for web services. A library is code you install and call. An SDK is a kit for building on a specific platform or service, which typically includes one or more libraries plus tools, samples and sometimes a CLI or emulator. For most REST APIs, what a vendor calls an SDK is effectively a client library.
When should I integrate directly instead of using the vendor's SDK?
Go direct when your language is unsupported, when you only need a couple of endpoints, when bundle size or dependency count is tightly constrained, when you need control over the HTTP layer, or when the SDK looks poorly maintained. An SDK that has stopped receiving releases while its API keeps changing becomes your maintenance problem.
If I am building an API, should I also ship an SDK?
Ship the API first and get the contract, versioning and documentation right. An SDK is a developer-experience investment worth making once the API is stable, but it is an ongoing commitment per language rather than a one-off task, because every API change turns into a release in each language you support. Publishing a machine-readable schema lets customers generate their own clients in the meantime.
