Architecture Pattern Guide

Authentication, Authorization, Rate Limits, and Versioning

Goal

The previous section separated gateway boundary responsibilities from backend capability ownership. This section focuses on four controls that make API contracts safe over time: authentication, authorization, rate limits, and versioning.

They are often discussed separately, but they belong together architecturally. They decide who can call, what they can do, how much load they can send, and how the contract changes without breaking consumers unexpectedly.

The durable idea is:

API safety depends on who can call, what they can do, how much they can use, and how change is managed.

The Short Version

An API platform should not treat every caller the same.

A mobile app, partner system, internal dashboard, backend service, and automation tool may all call APIs, but they may need different identities, permissions, limits, versions, and support rules.

Use this starting model:

Caller identity
  -> Authentication
  -> Authorization and policy
  -> Rate/usage control
  -> Versioned API contract
  -> Backend capability

This is a logical sequence, not a claim that every product implements controls in exactly this order. The important point is that access and change are part of the API contract.

Authentication and Authorization Are Different

Authentication proves who or what is calling.

For APIs, authentication might involve user tokens, workload identities, partner credentials, certificates, API keys, signed requests, or other trust mechanisms. The provider-specific implementation can vary. The architecture question is stable: can the platform identify the caller well enough for the risk of this API?

Authorization decides what that caller may do.

For example:

  • a mobile user may read their own orders;

  • a partner may read shipment status only for orders assigned to that partner;

  • a support employee may view broader customer information, but only with audit logging;

  • a backend service may create fulfillment work, but not read payment details.

Authentication answers, "Who is this?" Authorization answers, "What is this identity allowed to do?"

A gateway can often enforce coarse access: valid token, required scope, subscription, product access, or operation-level policy. The backend still needs to enforce domain authorization when the decision depends on business data.

Rate Limits, Quotas, and Throttling

Rate limits and quotas protect reliability, fairness, partner agreements, and cost.

A rate limit usually controls traffic over a short time window. A quota usually controls usage over a longer window. Throttling is the behavior that slows or rejects traffic when a limit is crossed.

These controls answer:

  • How much traffic can this consumer send?

  • Which consumers get different limits?

  • How do we protect fragile or expensive backends?

  • What happens when traffic spikes?

  • What response does the caller receive when limits are exceeded?

  • Who reviews exceptions?

Limits are not only punishment for bad consumers. They are capacity and fairness tools. They force the API platform to say what the contract can support.

Versioning and Safe Change

APIs are contracts, so change must be managed.

Some changes are usually safer:

  • adding an optional response field;

  • adding a new operation;

  • allowing a new optional query parameter;

  • improving documentation without changing behavior.

Some changes are risky or breaking:

  • removing a field consumers use;

  • renaming a property;

  • changing required request fields;

  • changing error behavior;

  • changing the meaning of a value;

  • tightening access in a way that breaks approved consumers.

Versioning gives teams a way to expose new behavior while existing consumers migrate. Deprecation gives consumers notice that old behavior will eventually retire. Compatibility choices reduce forced migration pain.

Versioning is partly technical and partly social. Consumers need documentation, migration guidance, timelines, test environments, and communication. A new URL, header, or query parameter is not enough if nobody knows what changed.

Central Policy and Backend Ownership

Some controls are good candidates for central platform policy:

  • baseline authentication requirements;

  • correlation IDs;

  • common headers;

  • rate-limit defaults;

  • subscription or product access;

  • basic request validation;

  • common error shape where possible;

  • logging expectations.

Other controls often belong with backend capability owners:

  • data-level authorization;

  • domain validation;

  • order, payment, customer, or inventory rules;

  • consistency decisions;

  • idempotency semantics;

  • business-specific error meaning.

The platform should make both visible. Central policy without backend ownership is shallow. Backend ownership without shared policy becomes inconsistent.

Example: Partner Order-Status API

A partner fulfillment provider calls an order-status API.

The contract might include:

ControlContract Choice
AuthenticationPartner application identity or credential accepted by the API platform.
AuthorizationPartner may read only fulfillment status for orders assigned to that partner.
Rate limitBurst and sustained limits protect the Order API and database.
Error modelUnauthorized, forbidden, not found, throttled, and server errors are documented.
VersioningBreaking changes require a new version and partner migration notice.
AuditPartner calls are logged with identity, operation, status, and correlation ID.

The gateway can validate the caller and apply partner limits. The Order API backend still checks whether the requested order belongs to that partner.

Common Mistakes

  • Using authentication as if it were authorization.

  • Applying the same limits to every consumer.

  • Shipping breaking API changes without lifecycle policy.

  • Creating policies that nobody monitors or reviews.

  • Treating API keys or subscriptions as a complete security model.

  • Versioning routes but failing to communicate migration expectations.

If Someone Asks You

Why are rate limits and versioning architecture concerns?

A good answer is:

Rate limits define how much demand the contract can safely accept, and versioning defines how the contract can change without surprising consumers. Both affect reliability, fairness, cost, support, and consumer trust. They are not just gateway settings; they are part of the API platform operating model.

What to Remember

APIs need identity, permission, usage, and change controls to remain trustworthy.

Questions to Check Your Understanding

  1. How are authentication and authorization different?

  2. What problems do rate limits solve beyond performance?

  3. Why does versioning matter for architecture ownership?

  4. Which access decisions may need to stay in backend code?