Markdown Editor

API Versioning and Deprecation Policy Template

API lifecycle policy: versioning scheme, compatibility promises, breaking changes, timelines, Deprecation and Sunset headers

आर्किटेक्चर और सिस्टम डिज़ाइनमानकRFC 9745 (Deprecation header), RFC 8594 (Sunset header)apideprecationpolicy
एडिटर में खोलें.md डाउनलोड करें

उपयोग कैसे करें: Use it to publish the promises consumers can plan against before an API goes public. Agree the compatibility guarantees and minimum deprecation periods with product and support first. The main pitfall is deprecating without a migration guide, which is a breaking change in disguise.

प्रीव्यू

API Versioning and Deprecation Policy: [Organisation or API programme]

Policy that tells API consumers what stays stable, what counts as a breaking change, how and when an API version or feature is deprecated and retired, and how they will be told and helped to migrate. Uses the Deprecation HTTP response header (RFC 9745) and the Sunset HTTP response header (RFC 8594). Replace every [bracketed] value and every row marked Example; the example timelines are reasonable defaults, not requirements.

FieldValue
Policy ID[ARCH-POL-API-002]
Version[0.1]
Status[Draft / Approved / Superseded]
Owner[@api-platform-lead]
Applies to[Public, partner and internal HTTP APIs, GraphQL, gRPC and event contracts]
Approved by[@cto], [@head-of-partnerships]
Effective fromYYYY-MM-DD
Next reviewYYYY-MM-DD

1. Purpose and scope

This policy lets consumers build on our APIs with confidence and lets our teams evolve them without surprise breakage. It covers [all documented APIs listed in the developer portal]. It does not cover [undocumented endpoints, APIs marked alpha or beta, and internal APIs used by one team only].

2. Versioning scheme

API styleVersion carrierIncrements whenExample
REST / HTTPMajor version in the URL pathA breaking change is released/v2/orders
GraphQLNo versions; continuous evolution with field deprecationn/a@deprecated(reason: "...")
gRPCMajor version in the package nameA breaking change is releasedpayments.ledger.v2
EventsVersion in the event type or schema subjectA breaking schema changeorder.placed.v2
SDKsSemantic Versioning 2.0.0Major for breaking, minor for features, patch for fixes4.2.1

Non-breaking changes are released continuously without a new major version and are listed in the changelog.

3. Compatibility guarantees

Within one major version we guarantee that we will not:

  • remove or rename an operation, field, parameter or enum value;
  • change the type, format or meaning of an existing field;
  • make an optional request field required or add a required parameter;
  • change authentication methods or reduce granted scopes;
  • change success status codes or documented error types.

Consumers must tolerate, without breaking:

  • new response fields and new optional request fields;
  • new operations, endpoints and event types;
  • new enum values in responses (treat unknown values as a documented default);
  • changes to the order of JSON properties and of unsorted lists;
  • new HTTP headers and new error type URIs within documented status codes.

4. What is a breaking change

ChangeBreaking?Notes
Remove a field or endpointYesRequires deprecation process
Rename a fieldYesAdd new field, deprecate old one
Add a required request fieldYesMake it optional with a default instead
Tighten validation (shorter max length, narrower range)YesUnless fixing a security defect
Change default page size or sort orderYes
Add an optional fieldNo
Add an enum value in a responseNo, if clients were told to tolerate unknown valuesAnnounce in changelog
Change error message textNoClients must use type and status, not text
Lower a rate limitYesTreat as breaking unless needed for abuse protection
Security fix that changes behaviourExceptionSee section 9

5. Deprecation process and timelines

StageWhat happensPublic APIsPartner APIsInternal APIs
1. DecisionDeprecation approved by API owner and product; migration path readyDay 0Day 0Day 0
2. AnnouncementChangelog, docs banner, email to registered consumers, Deprecation header turned onDay 0Day 0Day 0
3. Deprecation periodFeature works unchanged; no new consumers allowed to onboard[12 months] minimum[9 months][3 months]
4. Sunset date fixedSunset header added; reminders at 90, 30 and 7 daysAt least [6 months] before[3 months] before[1 month] before
5. Brownouts (optional)Short planned outages to reveal remaining callersLast [8 weeks]Last [4 weeks]Not used
6. RetirementRequests return 410 Gone with problem details linking the migration guideSunset dateSunset dateSunset date

The diagram shows the lifecycle states of an API version.

6. Deprecation and Sunset headers

  • Deprecation (RFC 9745) carries the date the resource was or will be deprecated, as a structured-field date (a Unix timestamp prefixed with @). It does not change how the resource behaves.
  • Sunset (RFC 8594) carries the HTTP date after which the resource is expected to stop responding.
  • Link headers point to documentation: relation deprecation (RFC 9745) for the deprecation notice and relation sunset (RFC 8594) for the sunset policy.
HTTP/1.1 200 OK
Content-Type: application/json
Deprecation: @1767225599
Sunset: Thu, 31 Dec 2026 23:59:59 GMT
Link: <https://developer.example.com/migrations/orders-v1-to-v2>; rel="deprecation"; type="text/html"
Link: <https://developer.example.com/policies/api-deprecation>; rel="sunset"; type="text/html"

For GraphQL use @deprecated(reason: "...") with the removal date in the reason; for gRPC use option deprecated = true plus the changelog; for events add a deprecated note in the schema registry and the AsyncAPI document.

7. Communication

ChannelWhenAudienceOwner
Changelog and docs bannerAnnouncement dayAllAPI team
Email to registered app ownersAnnouncement, then 90, 30 and 7 days before sunsetConsumers with recorded trafficDeveloper relations
Developer portal dashboardContinuousConsumers using deprecated featuresAPI platform
Partner account managersAnnouncement and monthlyStrategic partnersPartnerships
Status pageBrownouts and retirement dayAllOperations

8. Migration support

For every deprecation we provide:

  • a migration guide with side-by-side request and response examples;
  • a mapping table from old fields or operations to new ones;
  • SDK releases supporting the new version before the announcement;
  • a usage report per consumer (calls to deprecated features in the last 30 days);
  • office hours or a support channel [#api-migrations] during the deprecation period.
DeprecationReplacementGuideConsumers remainingSunset
Example: GET /v1/ordersGET /v2/orders (cursor pagination)[Link]14 of 230YYYY-MM-DD
[Feature][Replacement][Link][N of M]YYYY-MM-DD

9. Exceptions

The timeline can be shortened only for: (a) a security vulnerability that cannot be fixed compatibly; (b) a legal or regulatory requirement; (c) a dependency outside our control (for example a provider shutting down). Shortened timelines need approval from [@cto] and direct contact with every affected consumer. Extensions may be granted to named consumers by [@api-owner] for at most [3 months].

IDAPI / featureExceptionReasonApproved byDate
EXC-01Example: /v1/tokensSunset after 30 daysToken format vulnerable to replay@ctoYYYY-MM-DD
[EXC-NN][Feature][Exception][Reason][@name]YYYY-MM-DD

Standard and licence note

Based on common industry practice for API lifecycle policies. The header mechanics follow RFC 9745 (The Deprecation HTTP Response Header Field, March 2025) and RFC 8594 (The Sunset HTTP Header Field); version numbering for SDKs follows Semantic Versioning 2.0.0. No text from those documents is reproduced; consult them for normative requirements. Template licence: MIT.

संबंधित टेम्पलेट