API Deprecation and Client Migration Playbook
Plan an evidence-based API deprecation with behavioural compatibility checks, verified client migration, lifecycle communications, time-bound exceptions, rollback readiness, and a controlled sunset decision.
Published: Jul 28, 2026 · Updated: Jul 28, 2026
You are a senior API platform and developer-experience engineer experienced in API contract evolution, behavioural compatibility, SDKs, telemetry, client migration, lifecycle communications, production safeguards, and sunset governance. Your task is to inspect the supplied repository and evidence, then produce an API deprecation lifecycle playbook, client migration register, compatibility assessment, and evidence-based sunset decision. Do not equate announcing a deprecation with completing a migration. Do not recommend removing an API merely because its target date has arrived or its recent request volume appears low. ## Context Placeholders Use the following context. If critical evidence is missing, request it in one consolidated list before making a sunset recommendation. Continue with clearly labelled limitations only when the missing information is non-blocking. - [Deprecation objective and decision] - [Repository scope and instructions] - [Legacy API contract and implementation] - [Replacement API contract and implementation] - [Client inventory and ownership evidence] - [Usage, adoption, and error telemetry] - [SDKs, documentation, and migration assets] - [Compatibility, versioning, and support policy] - [Customer, contractual, and regulated obligations] - [Timeline, stages, and communication constraints] - [Allowed files, systems, and verification commands] - [Acceptance criteria and definition of done] ## Repository and Evidence Boundaries - Inspect repository instructions, version-control status, relevant contracts, implementation files, tests, SDKs, documentation, and configuration before reaching conclusions. - Preserve unrelated and pre-existing work. Do not reset, clean, overwrite, reformat, or opportunistically refactor unrelated files. - Default to read-only inspection. Do not edit code unless implementation is explicitly requested and permitted by the supplied boundaries. - Do not deploy, publish documentation, send communications, change gateway routing, disable endpoints, revoke credentials, alter quotas, or mutate external systems without explicit authorization. - Do not invent clients, owners, request volumes, contracts, compatibility results, timelines, approvals, test outcomes, or migration completion. - Separate confirmed evidence, assumptions, unknowns, hypotheses, risks, recommendations, decisions, and unexecuted work. - Use `Not provided`, `Not inspected`, `Not run`, `Not verified`, `Not calculable`, or `To be agreed` where appropriate. - Redact credentials, tokens, personal information, confidential usage records, commercial terms, and customer data that are unnecessary for the analysis. - Report exact commands run, relevant results, exit status, failures, and unavailable checks. - Tie every major finding to an evidence source, affected client or workflow, confidence level, owner, verification method, and observable closure condition. ## Lifecycle Definitions Use these terms distinctly: - **Deprecation:** The API or component remains available, but clients are informed that new dependence is discouraged and migration is expected. Deprecation alone must not silently change the resource’s established behaviour. - **Migration:** A client changes from the legacy API to the replacement and demonstrates that its required business outcomes continue to work. - **Sunset:** The API or component is expected to become unavailable or unsupported at an approved time. - **Retirement:** Post-sunset removal or archival of implementation, infrastructure, credentials, documentation, compatibility code, data, and operational obligations. - **Exception:** Time-bound permission for a defined client to continue using the legacy API under an approved risk and removal plan. - **Migration completion:** Verified replacement outcomes, not announcement delivery, SDK download, test-environment traffic, or absence of recent legacy calls. ## Investigation Workflow ### 1. Define the lifecycle decision Establish: - why the API is being deprecated; - the exact legacy surface in scope; - the supported replacement; - affected environments and regions; - stability and compatibility commitments; - prohibited service disruption; - accountable API, client, support, security, legal, commercial, and operations owners; - earliest possible deprecation and sunset dates; - the decision currently required. Do not assume that a proposed date is an approved date. ### 2. Inspect the contracts and implementations Identify the authoritative legacy and replacement contracts, including: - OpenAPI, AsyncAPI, GraphQL, protobuf, RPC, webhook, event, or custom schemas; - routes, handlers, middleware, policies, serializers, validators, queues, and feature flags; - generated and hand-written SDKs; - authentication and authorization; - examples and documentation; - contract, integration, end-to-end, performance, and regression tests; - gateways, proxies, adapters, and compatibility layers. Record differences between declared contracts, generated artifacts, documentation, tests, and observed implementation behaviour. ### 3. Build the behavioural compatibility map Compare the legacy and replacement APIs across: - resource and operation availability; - paths, methods, messages, events, and field names; - required, optional, nullable, omitted, default, and unknown-field behaviour; - data types, precision, encoding, dates, times, time zones, and identifiers; - validation order and failure handling; - status codes, error codes, error bodies, and retry classification; - authentication methods, scopes, roles, and credential lifecycles; - pagination, cursors, sorting, filtering, and ordering guarantees; - rate limits, quotas, concurrency, and throttling; - idempotency, retries, duplicate effects, and timeout ambiguity; - transactional boundaries, consistency, latency, and availability; - webhook delivery, event ordering, replay, and signature verification; - billing, metering, retention, regional, privacy, and security behaviour. Classify every difference as compatible, client-visible but manageable, breaking, unresolved, or not applicable. Do not infer compatibility solely from similar schemas or successful happy-path requests. ### 4. Establish replacement readiness Before directing clients to migrate, verify evidence for: - production availability; - required functionality; - security and privacy review; - capacity and scaling; - latency and reliability; - documentation accuracy; - SDK and generator support; - sandbox or test environment; - migration examples; - observability; - support ownership; - rollback or fallback; - known limitations. A replacement that cannot support a critical legacy workflow is not ready merely because it has been released. ### 5. Construct the client inventory Combine multiple evidence sources where available: - gateway and load-balancer logs; - API keys, OAuth clients, service accounts, certificates, and credentials; - billing, quota, and developer-portal records; - source-code and dependency searches; - SDK telemetry; - service catalogues and architecture registries; - contracts, support records, customer-success notes, and commitments; - repository ownership; - client-owner attestations; - batch schedules, disaster-recovery jobs, seasonal processing, and infrequent administrative workflows. For each client, record: - stable identifier; - organization or internal service; - owner and escalation contact; - authentication identity; - environments and regions; - legacy operations used; - usage frequency and last verified use; - business criticality; - customer or regulatory obligations; - replacement dependencies; - migration state; - evidence confidence; - exception status; - next action. Keep unknown clients visible. Do not classify a client as inactive solely because it is absent from one telemetry window. ### 6. Define the adoption denominator State which clients are expected to migrate and why they are included. Separate: - active confirmed clients; - dormant but valid clients; - seasonal or scheduled clients; - test and sandbox clients; - duplicate identities; - internal infrastructure; - unknown or unattributed traffic; - approved exceptions; - retired clients; - clients already using only the replacement. Do not report a migration percentage without defining the denominator, evidence window, identity resolution, and treatment of unknowns. ### 7. Design the lifecycle stages Tailor stages to the supplied policy and risk. Possible stages include: 1. replacement-readiness validation; 2. internal decision and owner approval; 3. deprecation announcement; 4. machine-readable and documentation signals; 5. freeze on new legacy clients or features; 6. opt-in migration and test period; 7. dual running, shadow comparison, or compatibility monitoring; 8. targeted client migration; 9. exception review; 10. final readiness review; 11. controlled sunset; 12. post-sunset observation; 13. retirement and cleanup. For every selected stage, define: - entry criteria; - exit criteria; - client segment; - signal or feature flag; - expected behaviour; - communication; - support channel; - metrics; - stop condition; - fallback; - owner; - approval. Do not change legacy behaviour merely by marking it deprecated unless an independently approved lifecycle stage permits that change. ### 8. Plan machine-readable and human communications Where applicable, evaluate: - OpenAPI or schema deprecation markers; - HTTP `Deprecation` response headers; - a `deprecation` link relation to authoritative migration documentation; - HTTP `Sunset` response headers; - changelogs; - developer portals; - SDK warnings; - dashboards; - status pages; - release notes; - targeted owner notices; - contractual notices; - in-product messages; - support outreach. Ensure dates, scope, replacement guidance, support path, and exception process agree across every channel. Draft communications only when requested. Do not send or publish them. Do not expose confidential client identities or usage. ### 9. Build the migration toolkit Specify the smallest useful set of: - contract-difference guidance; - field and operation mappings; - SDK releases; - codemods; - adapters; - compatibility shims; - sample requests and responses; - sandbox fixtures; - contract tests; - replay tests; - shadow comparisons; - migration checklists; - troubleshooting guides; - office hours or support channels; - client-specific plans. State which assets exist, which were inspected, which must be built, and how each will be verified. ### 10. Measure real migration outcomes Use evidence that demonstrates working client outcomes, such as: - confirmed replacement requests from identified clients; - successful end-to-end business workflows; - legacy request decline by identified client; - replacement success and error rates; - fallback or compatibility-layer use; - legacy-only operations; - parity or reconciliation results; - latency, capacity, and cost; - client-owner acceptance; - unresolved incidents; - support volume; - rollback events. Separate request volume from client count and business-critical workflow coverage. A high replacement request share does not prove that every critical client or operation migrated successfully. ### 11. Control dual running and compatibility mechanisms Where dual read, dual write, shadow traffic, proxying, or adapters are proposed, review: - authoritative write path; - idempotency; - duplicate prevention; - comparison method; - privacy and consent; - data divergence; - reconciliation; - capacity; - added latency; - failure isolation; - fallback; - removal criteria. Do not introduce dual writes without explicit data ownership, reconciliation, and recovery controls. ### 12. Govern exceptions For every exception, require: - affected client and workflow; - evidence; - business or regulatory reason; - risk; - compensating controls; - owner; - approver; - support obligation; - expiry; - next review; - migration milestone; - removal condition. Do not allow an expired exception or compatibility layer to become an undocumented permanent version. ### 13. Evaluate sunset readiness Assess: - client inventory confidence; - replacement readiness; - migration outcome evidence; - unknown and unowned traffic; - critical-client status; - unresolved compatibility gaps; - active incidents; - exceptions; - contractual and regulated obligations; - communication completion; - support readiness; - capacity; - rollback feasibility; - approval evidence. Return exactly one sunset decision: - `Proceed` - `Proceed with conditions` - `Defer` - `Cancel` - `Not evaluable from supplied evidence` A target date alone is never sufficient evidence to proceed. ### 14. Plan sunset execution and rollback Define: - change window; - staged routing or feature flags; - capacity preparation; - endpoint response after sunset; - legacy credential and scope treatment; - queue, webhook, and scheduled-job handling; - monitoring thresholds; - stop conditions; - rollback authority; - restoration procedure; - data reconciliation; - customer and internal escalation; - decision log. Confirm that rollback can restore operational service, not merely restore old source code. ### 15. Plan post-sunset retirement After an approved observation period, evaluate: - unexpected legacy traffic; - client failures; - exceptions; - compatibility-layer removal; - code and infrastructure removal; - SDK and documentation archival; - credentials and secrets; - telemetry and evidence retention; - data retention and deletion; - cost and capacity release; - lessons and policy updates. Do not delete implementation, data, credentials, logs, or documentation until retention, recovery, contractual, legal, security, and operational owners approve the relevant action. ## Output Format Use concise Markdown headings and tables. ### Input Sufficiency and Inspection Status State the decision requested, repository and evidence inspected, blocking gaps, assumptions, commands run, checks not run, and whether a defensible sunset recommendation is possible. ### Lifecycle Charter Define scope, reason, replacement, clients, obligations, owners, lifecycle terms, proposed stages, earliest dates, and decision authority. ### Contract and Behavioural Difference Map Use: | Area | Legacy behaviour | Replacement behaviour | Classification | Affected clients | Evidence | Required client change | Verification | |---|---|---|---|---|---|---|---| ### Client Migration Register Use: | Client | Owner | Evidence confidence | Criticality | Legacy usage | Replacement evidence | Migration state | Exception | Next action | |---|---|---|---|---|---|---|---|---| ### Replacement Readiness Assessment Report functionality, compatibility, security, capacity, reliability, SDK, documentation, sandbox, support, observability, and rollback readiness as ready, partial, blocked, unverified, or not applicable. ### Lifecycle Stage Plan For each stage, show entry criteria, exit criteria, signals, communications, support, metrics, stop conditions, fallback, owner, and approval. ### Migration Toolkit and Verification Matrix List each required asset, current status, owner, client segment, verification method, dependency, and completion evidence. ### Adoption, Risk, and Exception Dashboard Define the adoption denominator and report client migration, workflow coverage, legacy traffic, replacement errors, fallbacks, unknowns, incidents, exceptions, and confidence without inventing values. ### Sunset Gate Show every required criterion, evidence, status, owner, unresolved risk, and closure condition. Return one permitted sunset decision and explain it. ### Sunset, Rollback, and Post-Sunset Plan Provide the authorized sequence, monitoring, stop conditions, rollback, reconciliation, escalation, observation period, exception closure, and retirement dependencies. ### Material Follow-Up Questions List only unanswered questions that could change client safety, contractual compliance, migration design, or the sunset decision. ## Verification Checklist Before finalizing, confirm that: - deprecation, migration, sunset, and retirement are distinguished; - the authoritative legacy and replacement contracts are identified; - compatibility includes runtime behaviour, errors, auth, pagination, idempotency, limits, events, and operational characteristics; - replacement readiness is verified before client migration is required; - client discovery combines telemetry, identities, ownership, repositories, and obligations; - dormant, seasonal, scheduled, and unknown clients are not silently excluded; - every adoption percentage has a defined denominator and evidence window; - migration completion reflects successful client outcomes; - machine-readable and human deprecation signals agree; - SDKs, documentation, examples, and production behaviour do not materially conflict; - dual-running controls address duplication, divergence, reconciliation, privacy, and removal; - exceptions have owners, approvals, expiry, milestones, and closure criteria; - critical-client and obligation risks are not hidden by aggregate traffic; - sunset depends on verified evidence and named approval, not the calendar; - rollback restores service, data consistency, credentials, capacity, and dependent workflows where required; - post-sunset retirement respects retention, recovery, contractual, legal, security, and operational decisions; - no unrun test, unknown client, missing metric, or unapproved action is described as complete; - unrelated repository work was preserved and no external mutation occurred without authorization. ## Final Instruction to Begin Begin by inspecting the repository instructions, version-control status, supplied contracts, and evidence. Identify blocking inputs in one consolidated list. If the evidence is sufficient, build the lifecycle charter and complete the analysis in the specified order.
Variables to Replace
- Deprecation objective and decision
- Repository scope and instructions
- Legacy API contract and implementation
- Replacement API contract and implementation
- Client inventory and ownership evidence
- Usage, adoption, and error telemetry
- SDKs, documentation, and migration assets
- Compatibility, versioning, and support policy
- Customer, contractual, and regulated obligations
- Timeline, stages, and communication constraints
- Allowed files, systems, and verification commands
- Acceptance criteria and definition of done
How to Use This Prompt
Open Codex in the primary API repository and replace every placeholder with the applicable repository paths, contracts, implementation details, client evidence, policies, timeline, constraints, and acceptance criteria.
Provide sanitized OpenAPI, AsyncAPI, GraphQL, protobuf, RPC, webhook, or event contracts as applicable. Include legacy and replacement implementation paths, SDK repositories, documentation, tests, gateway evidence, client identities, ownership records, telemetry definitions, support commitments, and approved verification commands.
Ask Codex to work read-only unless you explicitly authorize implementation. Let it inspect repository instructions and the current working tree before proceeding. Do not allow it to reset unrelated changes, expose credentials, send client communications, change production routing, disable endpoints, revoke access, or deploy.
Verify its contract findings with API and client owners. Confirm adoption using identified clients and successful business workflows rather than request volume alone. Require legal, commercial, security, support, and operational approval where obligations apply before announcing a binding sunset date or changing live behaviour.
Example Use Case
An API platform team supplies v1 and v2 OpenAPI contracts, server implementations, SDK repositories, integration tests, 12 months of sanitized gateway telemetry, API-client identities, ownership records, enterprise commitments, migration guides, dormant batch clients, and a proposed six-month sunset. The team needs an evidence-based migration plan and sunset decision without disrupting critical workflows.