Join our Newsletter — 33% off our NHI Course
Home› Guides› API Deprecation and Versioning Security: Retiring Old Versions…
Guide Web & API Security

API Deprecation and Versioning Security: Retiring Old Versions Without Leaving Zombies

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 12 min read
On this page

Every new API version is a security upgrade that only protects the clients who move to it, while the old version keeps serving attackers with the weaker controls it shipped with. OWASP lists old API versions running unpatched with weaker security requirements as a leading cause of API9:2023 Improper Inventory Management. Finding those versions is an inventory problem; this guide covers what comes after: designing versioning so security fixes reach every live version, migrating clients from weaker authentication (static keys, implicit grant, password grant) to the current scheme, signalling deprecation with the Deprecation and Sunset headers, and enforcing the retirement at the gateway and identity provider so nothing lingers. It is for API platform owners, API security engineers and architects. Discovery is covered in the OWASP API Top 10 API9 Improper Inventory Management Guide, and the difference between shadow and zombie endpoints in Shadow APIs vs Zombie APIs.

Key takeaways

  • Security parity until the last call. A deprecated version still serves production traffic; it gets the same patching, monitoring and rate limiting as the current one until it is removed.
  • Retire the weak auth first, not last. Old versions often survive because they accept static keys or legacy OAuth grants; plan the authentication migration as its own workstream with credential-level telemetry.
  • Headers are hints, enforcement is yours. RFC 9745 Deprecation and RFC 8594 Sunset tell clients what is coming; the gateway, identity provider and DNS changes make it happen.
  • Version shared data paths, not just URLs. OWASP warns that different API versions are sometimes connected to the same database with real data, so an old version can expose fields and functions the new one removed.
  • Measure retirement by credentials. Traffic per version tells you whether to sunset; traffic per client ID and key tells you whom to call.

Why versioning is a security decision

OWASP API9:2023 describes attackers gaining access "through old API versions or endpoints left running unpatched and using weaker security requirements", and an API has a documentation blind spot if "there is no retirement plan for each API version". Its first example scenario is a rate limit enforced by a separate component in front of the current API but not in front of an older version, which let a researcher brute force password reset tokens. The lesson for versioning: every security control that is implemented outside the code (gateway policies, WAF rules, rate limits, token validation) has to be applied per version, and every control implemented in code has to be back-ported or the version retired.

Versioning schemeHow versions are selectedSecurity implications
URI path (/v1/, /v2/)Path prefixEasy to route, inventory and block per version at the gateway; old paths are easy for attackers to guess, so remove routes rather than hide them
Header or media type (for example a custom version header or Accept parameter)Request headerClean URLs, but WAF and gateway rules must parse the header; a missing header that defaults to the oldest version is a downgrade path
Query parameter (?version=)Query stringEasy to tamper with and often logged; same default-version risk
Channel-based (v1alpha, v1beta, v1)Stability suffix on the major versionGoogle AIP-185 describes channels updated in place, each a superset of the more stable one; preview channels need their own access control so unstable features are not exposed to everyone
Date or release basedRelease identifierMany concurrent versions; needs strict limits on how many stay live

Whatever the scheme, two rules prevent most downgrade problems. First, an unversioned request must resolve to a supported version, never silently to the oldest. Second, the authentication and authorisation layer must be version-aware: if v3 requires a scope that v1 does not check, v1 is the path of least resistance.

Security parity for deprecated versions

Deprecation does not change how a resource behaves (RFC 9745 is explicit that clients can keep using it), so a deprecated version is still an attack surface. Apply these rules from the day a version is announced as deprecated until the day it is removed:

  • Patching: security fixes are back-ported to every live version, or the vulnerable version is retired early with a short notice. Record this commitment in the API's lifecycle policy.
  • Gateway policy parity: rate limits, schema validation, payload size limits, token validation and bot controls are applied to every version's routes. Audit by listing gateway routes per version and diffing the attached policies.
  • Data minimisation: if v2 stopped returning a sensitive property, check whether v1 still does from the same data store. Excessive property exposure on old versions is API3 territory; see the API Security Guide.
  • Monitoring: keep logging, alerting and abuse detection on deprecated versions. Attackers prefer the version that the SOC stopped watching.
  • Freeze features: no new functionality on deprecated versions; Google AIP-185 states deprecated functionality must not graduate to a more stable channel.

Retiring weaker authentication with the version

The most common reason an old version cannot be turned off is that some clients authenticate in a way the new version no longer accepts. Treat the authentication migration as the critical path.

Legacy pattern on the old versionWhy it is weakerTarget on the new versionMigration approach
Static API key in a headerLong-lived, not tied to a client identity or scope, easy to leakOAuth 2.0 client credentials with scoped, short-lived tokens; or keys bound to an owner, scope and expiryIssue client credentials to each key holder; accept both for a period; log key use per client; revoke keys at sunset. See API Keys vs OAuth Tokens and the Machine-to-Machine OAuth Guide.
API key or token in the query stringLogged by proxies and servers; RFC 9700 says clients MUST NOT pass access tokens in a URI query parameterAuthorization header onlyReject query-string credentials on the new version; on the old one, alert and rotate any credential seen in a query string
OAuth implicit grant (response_type token)Tokens exposed in the browser; RFC 9700 says clients SHOULD NOT use itAuthorisation code with PKCERegister new client configuration; disable implicit for the client once traffic moves. See Client Secret vs PKCE.
Resource owner password credentials grantExposes user credentials to the client; RFC 9700 says it MUST NOT be usedAuthorisation code with PKCE, or device flow for limited-input clientsDisable the grant per client after migration; it should not exist on any new version
Bearer tokens without sender constraintReplayable if stolen; RFC 9700 says servers SHOULD sender-constrain access tokensmTLS-bound tokens (RFC 8705) or DPoP (RFC 9449)Pilot with high-risk clients first. See the DPoP Guide.
Old JWT signing keys still trustedCompromised or weak keys stay validCurrent keys only in the JWKSRemove retired keys from trust stores when the version is removed. See JWKS Signing Key Rotation.

Clients that cannot move (embedded devices, partner systems with long release cycles) need an explicit, time-limited exception: a dedicated route with tighter rate limits, IP allow-listing, credentials scoped to the minimum, and a named business owner who signs the risk acceptance. Do not keep a whole version alive for them.

Signalling deprecation: headers, specs and notices

  • Deprecation header (RFC 9745): Standards Track, published March 2025. The value is a structured field date in the form Deprecation: @1688169599 (Unix time), which can be past or future. A Link header with rel="deprecation" points to human-readable migration documentation.
  • Sunset header (RFC 8594): Informational, May 2019. An HTTP-date such as Sunset: Sat, 31 Dec 2018 23:59:59 GMT giving when the resource is expected to become unresponsive, with an optional rel="sunset" link to the retirement policy. RFC 9745 says the Sunset time must not be earlier than the Deprecation date.
  • Treat both as hints: both RFCs say clients should treat the values as hints, and RFC 8594 notes that after the sunset clients may see 4xx or 3xx responses or no response. Serve the linked documentation over HTTPS; RFC 9745 warns that links not served over HTTPS may not be integrity protected, and RFC 8594 asks clients to verify linked information so it cannot be used to hijack resources.
  • Machine-readable specs: mark deprecated operations with deprecated: true in the OpenAPI document so SDK generators and API catalogues warn developers.
  • Direct notice: headers reach code, not people. Email the registered owner of every client ID and key that called the version in the measurement window, and repeat at fixed intervals before the sunset.
  • Information leakage: RFC 8594 notes sunset data can reveal information such as when a resource was created; avoid putting internal project details in deprecation links.

Implementation: the retirement workflow

  1. Set a lifecycle policy: maximum number of concurrent major versions (two is common), minimum deprecation period by API audience (internal, partner, public), and the security parity commitment above. AIP-185 recommends 180 days for removing beta functionality as one reference point.
  2. Measure by credential: for 30 to 90 days, report calls to the old version grouped by client ID, API key, source network and endpoint. Unknown credentials go to the inventory owner; see the API Inventory Template.
  3. Announce: publish the deprecation page, add the Deprecation header and the deprecation link, mark the OpenAPI operations deprecated, and email credential owners.
  4. Migrate authentication: issue new credentials for the current version, run both in parallel, and track the percentage of traffic still using legacy authentication.
  5. Add the Sunset header: once the date is fixed, add Sunset with a date no earlier than the deprecation date.
  6. Brown-outs: schedule short, announced windows where the old version returns an error, to surface forgotten clients while rollback is instant.
  7. Disable, then delete: at sunset, return a clear error (for example 410 Gone with a link to the migration page) from the gateway, then remove backend deployments, DNS records and code paths. Revoke API keys, disable OAuth clients and remove signing keys that only the old version used.
  8. Verify from outside: scan external DNS and IP ranges and confirm the old paths and hosts no longer answer, including on alternative hostnames and staging environments.
  9. Rollback: keep the gateway route definition and deployment artefact for a fixed period so the version can be restored for a named client under an emergency exception; never restore by re-enabling the revoked credentials of every client.

Decision guidance

  • Sunset early vs extend: if the old version has an unpatched vulnerability or accepts credentials that RFC 9700 says must not be used, shorten the timeline and accept client disruption. If it only lacks new features, the normal deprecation period applies.
  • Back-port vs retire: back-port fixes when the version has many active clients and the fix is small; retire when the fix requires the new version's architecture.
  • Public vs internal APIs: public APIs need longer notice and headers plus email; internal APIs can be retired faster, driven by a service owner list, but internal callers are often the worst documented.
  • Small teams: keep at most two major versions and path-based versioning so the gateway can enforce everything. Large API programmes need a lifecycle registry that links versions, owners, credentials and sunset dates.

Detection and measurement

Log version, client ID or key ID, authentication method and response code for every request, and alert on traffic to versions or hosts past their sunset date, on new client IDs appearing on deprecated versions, and on legacy authentication methods appearing on the current version.

  • Live major versions per API: against the policy maximum.
  • Legacy authentication share: percentage of requests using static keys, implicit or password grants, trending to zero before sunset.
  • Policy parity: deprecated version routes missing a gateway policy present on the current version (target zero).
  • Post-sunset traffic: requests to retired versions after their sunset date, by source.
  • Orphaned credentials: keys and OAuth clients still enabled for retired versions (target zero).
  • Retirement lead time: days from deprecation announcement to removal, against the published policy.

Framework mapping

ActivityOWASPNIST CSF 2.0NIST SP 800-53 r5
Version inventory and retirement planAPI9:2023ID.AM-02, ID.AM-08CM-8
Removing unsupported versionsAPI9:2023PR.PS-02SA-22
Authentication migrationAPI2:2023PR.AA-01IA-2, IA-5
Security parity and patchingAPI8:2023PR.PS-02SI-2
Monitoring old and new versionsAPI9:2023DE.CM-09SI-4

ATT&CK techniques that old versions commonly enable include T1190 Exploit Public-Facing Application and T1078 Valid Accounts where leaked legacy keys still work.

Common failure patterns

  • Gateway rules on the new version only: rate limiting or token validation added to v2 routes while v1 routes go straight to the backend, the pattern in the OWASP API9 example.
  • Default to oldest: unversioned requests routed to v1, giving attackers a free downgrade.
  • Keys that outlive the version: the v1 route is deleted but its API keys remain valid on a shared gateway or another API.
  • Headers without enforcement: Sunset dates pass and the version keeps running because nobody owns the removal step.
  • Removed from the gateway, alive on the host: the backend still answers on a direct hostname or a staging domain.
  • Shared data, uneven filtering: the old version reads the same tables and returns properties the new version deliberately dropped.

Practitioner checklist

  • Publish an API lifecycle policy with a maximum number of live versions, deprecation periods and a security parity commitment.
  • Route unversioned requests to a supported version, never the oldest.
  • Diff gateway policies between current and deprecated version routes every release.
  • Report old-version traffic by client ID and key and contact every owner.
  • Plan the authentication migration as its own workstream and track legacy auth share.
  • Send Deprecation and Sunset headers with HTTPS migration links, and mark operations deprecated in OpenAPI.
  • Run announced brown-outs before the sunset date.
  • At sunset, revoke keys, disable OAuth clients and remove signing keys used only by the old version.
  • Verify removal with an external scan of hostnames and paths.

Standards and references

Related NHI Mgmt Group resources: OWASP API Top 10 API9 Improper Inventory Management Guide · Shadow APIs vs Zombie APIs · API Gateway Security Guide · API Key Management Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.