Most APIs are designed for the first consumer. The first mobile app, the first internal dashboard, the first partner integration. The team builds the endpoints that consumer needs, the response shapes that consumer expects, the authentication that consumer can implement. It ships. It works.
Then the second consumer arrives. A different mobile platform, a partner whose stack assumes different conventions, an internal reporting tool that needs three queries where the original endpoint only supports one. The team has two options: bend the existing API into a shape that serves both, or fork it. Both options compound. Six months later, the API surface is a patchwork of conventions, the documentation is out of date the moment it's written, and adding the fourth consumer requires a refactor rather than an integration.
This is the failure pattern API and integration architecture exists to prevent — and the one most products discover the hard way. The architecture itself sits inside the Built to Last™ 2.0 framework's P03 — The Right Architecture — pillar, locked alongside the Architecture Session and the Three-Horizon Architecture Test before the first sprint. Its premise is simple: design the API for the third and fourth consumer, not the first. Design the integration layer so swapping a payment provider is a configuration change, not a two-month refactor. Treat extensibility as a structural property of the build, not a feature you'll add later.
What the missing component actually costs
The cost of consumer-coupled APIs is invisible at launch and obvious eighteen months in. Each new integration takes longer than the last because each one reveals a fresh assumption baked into the original design. The mobile API hard-codes the response format the iOS team asked for, so the new Android client either parses it the same way or convinces the backend team to add a parallel endpoint. The payment integration imports the provider's SDK directly into business logic, so swapping providers means rewriting the checkout, refund flow, dispute handling, and reconciliation job — each in a different file, each with its own quirks.
The dollar cost is real but rarely accounted for cleanly. Time refactoring is time not spent on roadmap. Engineers context-switch between feature work and integration plumbing. Estimates grow vague because the team can't tell which feature will touch the tangled bits without diving in. The CFO sees velocity flatten across two quarters and asks why; the engineering lead has no clean answer, because the cost is spread across dozens of small detours rather than concentrated in one visible line item.
The second cost hurts more than the engineering bill: strategic options the team can no longer take. A product locked to one payment provider can't negotiate fees. A backend coupled to one identity provider can't roll out enterprise SSO without rebuilding auth. A reporting layer hard-wired to one analytics vendor can't move to a warehouse-first stack when the data team arrives. Every coupling forecloses a decision the business will want to make later — by which point unwinding costs more than the decision is worth.
What API and integration architecture actually means
API and integration architecture is the set of design choices that determine how your system exposes its own capabilities and consumes external ones. It covers four distinct surfaces, and treating them as a single problem is a common mistake:
External APIs
Internal APIs
Inbound integrations
Outbound integrations
The deliverable isn't a diagram. It's a set of decisions, documented as Architecture Decision Records and reflected in the codebase, that answer: what is the contract style, who owns versioning, how are integrations abstracted, how are secrets managed, how are failures handled, how is the contract tested, and what does deprecation look like.
API-first as a design discipline, not a slogan
"API-first" gets used to mean almost anything. The version that earns its keep is narrow: the contract is designed and reviewed before the first endpoint is implemented; the contract lives in a machine-readable specification (typically OpenAPI for REST, the schema definition language for GraphQL, or a Protobuf file for gRPC); and every consumer — internal or external — codes against the contract, not against a specific implementation. The implementation can be swapped, the database replaced, the backing services re-platformed, and the contract holds.
The discipline matters because it forces the team to think about consumers before implementations. Once endpoints exist, they have a gravity of their own; consumers integrate against them and changing them gets expensive. Designing the contract first — and reviewing it with the consumers who will use it — surfaces the assumptions that would otherwise calcify silently.
The adapter pattern, applied to the integration layer
Every third-party integration is a candidate for an adapter. The pattern is well understood and widely under-applied: business logic talks to an interface defined inside your codebase; an adapter translates that interface into the third-party SDK or API; swapping the provider means writing a new adapter, not rewriting the business logic.
The version that goes wrong skips one step. The team writes an "adapter" that's really a thin pass-through, leaking the provider's data shapes and error semantics straight into the calling code. When the provider needs to swap, the leak surfaces — different shapes, different errors, different retry behaviour, and the "adapter" has to be redesigned anyway. A real adapter normalises inputs and outputs into a stable internal contract; that contract is what the business logic depends on, and the adapter absorbs the differences between providers.
Versioning as a strategy, not a reaction
Most APIs version reactively, when someone asks for a breaking change and the team realises they have no plan. A deliberate versioning strategy decides upfront how breaking changes are introduced, how long old versions live, how consumers are notified of deprecation, and what guarantees the contract makes within a version. URL versioning (/v1/, /v2/), header versioning (Accept-Version), and additive-only evolution are all valid; what isn't valid is having no strategy and discovering, at the moment of need, that you've made promises you don't know how to keep.
Failure handling the consumer can actually use
Awell-designed API tells the caller what went wrong, what's safe to retry, and what response to give the user. Structured error envelopes, idempotency keys for safe retries, rate-limit headers consumers can pace against, and webhook signature verification are the basics. Each is cheap to design in and expensive to retrofit — retrofitting requires every consumer to redeploy.
A concrete example
Picture a marketplace product designed to accept payments from one provider at launch. Two options for the integration layer. The first: the team imports the provider's SDK directly into the checkout service, calls its methods from the order flow, parses its responses inline, and catches its specific exceptions in the error handling. Ship time is fast; everything works.
The second: the team defines an internal PaymentGateway interface — authorise, capture, refund, dispute_evidence — with stable parameter shapes and a stable error taxonomy. They implement one adapter behind the interface for the first provider. The checkout service calls the interface, never the SDK. Ship time is a couple of days slower.
Eighteen months in, the business asks to add a second payment provider for a market the first one doesn't serve well. Option one means finding every call site, rewriting each one for the new SDK, running dual flows during a migration window, and retesting everything. Option two means a second adapter behind the same interface, a configuration flag to route by region, and a fraction of the test surface. Same problem, different cost.
How to make API-first the default
The implementation path is more discipline than tooling. The technology choices — REST with OpenAPI, GraphQL with a schema-first workflow, gRPC with Protobuf — are mature and reasonably interchangeable for most product engineering. The harder problem is wiring contract-first design into the team's cadence rather than treating it as a one-time good intention.
Write the contract before the implementation, every time, for every endpoint that will have more than one consumer. The contract is a .yaml, .proto, or .graphql file checked into the repository, reviewed in the same pull request workflow as code. CI fails the build if implementation and contract drift. Tooling to enforce this is mature — Spectral for OpenAPI linting, contract testing with Pact or Schemathesis, schema validation in CI — but the rule that matters more than the tool is that the contract is the source of truth.
For each external integration, draw the adapter boundary before writing any code that touches the provider. Define the internal interface in terms of your business operations, not the provider's API. The first integration takes slightly longer; the second takes a fraction of the time.
Maintain an integration register — a simple document listing every third party, its SLA, rate limits, fallback behaviour, and rotation owner. The register lives next to the Architecture Decision Records and is reviewed quarterly. The provider you chose eighteen months ago may not be the right one today, and the register makes that conversation routine.
Pick a versioning strategy at design time. URL versioning or header versioning, the supported deprecation window (twelve months is a sensible default for public APIs; internal APIs can move faster), how breaking changes are announced, and what counts as additive versus breaking. Write this into a one-page API design guide every engineer references — it saves an argument-per-week the team would otherwise have for the next three years.
Bake security in at the contract level. Authentication scheme per route. Rate limits documented and enforced. Input validation generated from the schema. Webhook signatures verified, not assumed. Secrets in a dedicated manager, never in plaintext environment variables. TheOWASP API Security Top 10 is the checklist; align to it before launch and the API portion of the Production Readiness Review™ becomes verification rather than rewrite.
Wire contract testing into the CI/CD pipeline. Every change to the contract triggers tests against the published spec; every implementation change is checked against the contract. Mock servers generated from the spec let frontend, mobile, and partner teams develop in parallel against a stable contract before the backend is finished — removing one of the larger sources of integration delay. Our DevOps and infrastructure approach treats contract validation as a CI gate rather than a manual review.
What to avoid: endpoints without contracts and specs reverse-engineered afterwards; "adapters" that pass through the provider's data shape unchanged; versioning policies invented at the moment of need; secrets in environment variables; webhooks accepted without signature verification; and a public API designed for the first consumer without consulting the second.
Implementation depends on a small number of other Built to Last components. The Architecture Session agrees the contract style and adapter boundaries. The Three-Horizon Architecture Test asks whether the API design holds at ten times current consumers. The Production Readiness Review uses the integration register and the contract specification as required inputs. The same pattern shows up in our project delivery framework — contracts and integration boundaries are locked in early sprints, not negotiated mid-build.
A tale of two payment integrations
A Sydney-based fintech we worked with launched its first product with one payment provider, integrated directly into the checkout service. The decision was sensible at the time — the provider supported the markets that mattered, the timeline was tight, and the team was small. The SDK got imported into the order flow, the provider's data shapes flowed through reporting and into the accounting system, and the launch landed on schedule.
Eighteen months later, the business needed a second provider — partly for better fees, partly to support a region the first couldn't serve. The team came back with an estimate north of two months: every call site to find, every error path to rewrite, every reconciliation job to update, and a dual-running period to manage. The work shipped, but the cost in engineering time and displaced roadmap was more than the savings from the new provider in the first year.
Contrast that with a comparable build that ran with the adapter pattern from sprint one. An internal PaymentGateway interface defined in the Architecture Session, one adapter for the first provider, business logic that never touched the SDK directly. When the second provider was needed, the team wrote a new adapter, added a routing rule by currency and region, and shipped inside a sprint. Same problem, configuration change rather than refactor. Our work with Nuvei / Till Payments and with Rello Pay — both built around payment flows where the integration boundary needs to absorb provider change rather than propagate it — gave us the conviction that adapter-first is worth the slightly slower first sprint.
When this matters most, and when it can wait
This matters most when any of three conditions hold. The product will have more than one consumer of its own API — multiple frontends, partner integrations, a future public API, or a mobile platform that will eventually need a different shape than the web. The integration surface includes capabilities you might want to change — payment providers, identity providers, analytics platforms, anything where vendor lock-in has commercial implications. Or the system handles regulated data or revenue flows, where contract-level mistakes cost compliance exposure or lost transactions. Custom software builds and mobile apps sit squarely inside these conditions; our custom software service treats API-first as a build standard rather than an upsell, and our mobile delivery approach does the same on the client side.
When can it wait? Pure internal tooling with one user, throwaway scripts, prototypes built to rewrite afterwards, and products where the integration surface is genuinely permanent — a regulated API consumed by one government partner with no realistic alternative. Even there, writing the contract before the implementation is cheap insurance.
The honest answer is that most teams defer API-first longer than they should and pay the deferral cost in months of refactor over the following two years. The slightly slower first sprint is the cheapest sprint you will ever buy.
What to do next
If you are mid-build and the API surface is still small, pick one external integration — your payment provider, your identity provider, or your analytics vendor are the usual candidates — and put an adapter behind it this sprint. Define the interface in your code, normalise the inputs and outputs, route every call through it. The pattern, once embedded, spreads. For the broader architecture discipline this sits inside, our custom software delivery approach covers how API contracts and integration boundaries get locked at the Architecture Session, and the mobile app developer Sydney view shows the same discipline applied to client-side integration.
Frequently Asked Questions
How do we design APIs?
How do we add new integrations cheaply?
What's an API-first architecture?
How do we version APIs?
How do we handle third-party API failures?
When is GraphQL the right choice over REST?
Should the API and the integrations be designed together?
Discover app development insights and AI trends with Akash Shakya, COO of EB Pearls. Learn how we build successful digital products.
Read more Articles by this Author