Inferensys

Prompt

API Deprecation Timeline Enforcement Prompt

A practical prompt playbook for using the API Deprecation Timeline Enforcement Prompt in production API governance workflows.
Operations team reviewing AI workflow automation on laptop, workflow builder visible, casual office setup.
PROMPT PLAYBOOK

When to Use This Prompt

Identify the right trigger conditions, required inputs, and operational boundaries for the API deprecation compliance audit prompt.

API governance teams use this prompt when they need to verify that every deprecated endpoint in their inventory complies with the organization's deprecation policy before a removal deadline. The job-to-be-done is a structured compliance audit that replaces manual checks across dozens of endpoints, multiple gateway configurations, and scattered documentation. The ideal user is a platform engineer, API product manager, or governance lead who owns the deprecation lifecycle and needs evidence that technical signals—Sunset headers, Deprecation headers, migration guide links, and removal dates—are correctly deployed and aligned with policy timelines. The required context includes a written deprecation policy (or a summary of its rules), an endpoint inventory listing deprecated endpoints and their target removal dates, and live HTTP response headers captured from those endpoints. Without all three inputs, the prompt cannot produce a reliable compliance report.

This prompt is designed for scheduled batch audits and CI pipeline integration. In a scheduled audit, a team runs the prompt weekly against a refreshed endpoint inventory and header snapshot to track compliance drift over time. In a CI pipeline, the prompt acts as a gate: when a gateway configuration change is proposed, the pipeline fetches headers from a staging environment, runs the prompt, and blocks the change if new violations appear. The prompt produces a structured report with four categories: compliant endpoints, endpoints missing Sunset headers, endpoints with overdue removal dates, and endpoints lacking migration guides. Each finding includes the endpoint path, the specific policy rule violated, the observed value, the expected value, and a severity flag. Escalation flags are raised for endpoints past their removal date that still respond successfully or that lack any deprecation signaling. The prompt does not assess the quality of migration guides or the legal sufficiency of deprecation communications—those require human review.

Do not use this prompt when the deprecation policy is unwritten or exists only as tribal knowledge. The prompt requires explicit rules to check against; without them, it will hallucinate compliance criteria. Do not use it as a replacement for legal review of customer-facing deprecation notices, sunset communications, or contractual obligations. The prompt validates technical artifacts—headers, dates, documentation links—not the legal adequacy of the messaging. Do not use it on endpoints that have already been removed from the gateway; the prompt needs live response headers to function. For endpoints that are already decommissioned, use a separate inventory reconciliation prompt that cross-references the gateway configuration against the deprecation register. Finally, do not treat the prompt's output as an automated enforcement action. The compliance report should feed into a human-reviewed remediation workflow, especially for escalation flags that may require customer communication or extended migration windows.

PRACTICAL GUARDRAILS

Use Case Fit

Where the API Deprecation Timeline Enforcement Prompt delivers reliable compliance checks and where it introduces risk.

01

Good Fit: Policy-Driven Governance Reviews

Use when: your organization has a documented deprecation policy with explicit timelines (e.g., 90-day Sunset headers, 6-month migration guide availability). The prompt excels at comparing actual endpoint state against codified rules. Guardrail: Feed the policy document as [POLICY_CONTEXT] and require the model to cite specific policy clauses in its compliance report.

02

Good Fit: Pre-Release Gate Checks in CI

Use when: you want to block a release if deprecated endpoints are missing required headers or documentation. The prompt produces structured output that a CI harness can parse for pass/fail decisions. Guardrail: Pair the prompt with a lightweight JSON Schema validator that confirms the output contains required fields (compliance_status, overdue_items, escalation_flags) before the CI gate proceeds.

03

Bad Fit: Real-Time Traffic Enforcement

Avoid when: you need sub-millisecond decisions on whether to accept or reject live API traffic based on deprecation state. This prompt is designed for review-time analysis, not runtime enforcement. Guardrail: Use the prompt's output to configure a fast rules engine or API gateway policy. The prompt defines the policy; the gateway enforces it at request time.

04

Bad Fit: Undocumented or Ad-Hoc Deprecations

Avoid when: your team deprecates endpoints informally without written policy, Sunset headers, or migration guides. The prompt cannot enforce timelines if there is no source of truth to compare against. Guardrail: First run a discovery prompt to inventory current deprecation state across your API surface, then codify a policy before attempting enforcement.

05

Required Inputs: Policy, Spec, and Evidence

What you must provide: a deprecation policy document with timeline rules, an OpenAPI or equivalent spec showing current endpoint deprecation state, and ideally HTTP response header samples or logs confirming actual Sunset header presence. Guardrail: If header samples are unavailable, the prompt should flag endpoints as 'unverified' rather than assuming compliance, preventing false clean reports.

06

Operational Risk: Policy Drift Over Time

What to watch: your deprecation policy changes but the prompt template still references old timeline rules, producing incorrect compliance verdicts. Guardrail: Version-lock the policy document alongside the prompt template in your repository. Add a pre-check that confirms the policy version matches the expected revision before running the compliance report.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt that validates API deprecation compliance against your policy, producing a structured report with overdue items and escalation flags.

The prompt below is designed to be copied directly into your AI harness or orchestration layer. It expects you to supply your organization's deprecation policy, an inventory of endpoints with their current deprecation state, and the required output schema. Every placeholder is enclosed in square brackets—replace each one with concrete data before sending the prompt to the model. Do not leave any placeholder unresolved in production; missing policy data will cause the model to hallucinate compliance rules, and missing endpoint inventory will produce an empty or misleading report.

text
You are an API governance auditor. Your task is to evaluate a set of API endpoints against a defined deprecation policy and produce a compliance report.

## DEPRECATION POLICY
[DEPRECATION_POLICY]

## ENDPOINT INVENTORY
For each endpoint, provide: path, HTTP method, deprecation status (active/deprecated/sunset), deprecation announcement date, sunset date, Sunset header presence (true/false), deprecation notice in response body (true/false), migration guide URL, and current call volume.

[ENDPOINT_INVENTORY]

## OUTPUT SCHEMA
Return a JSON object with the following structure:
{
  "report_generated": "ISO-8601 timestamp",
  "policy_version": "string identifying which policy version was used",
  "summary": {
    "total_endpoints": number,
    "compliant": number,
    "non_compliant": number,
    "overdue_sunset": number,
    "missing_sunset_header": number,
    "missing_deprecation_notice": number,
    "missing_migration_guide": number
  },
  "findings": [
    {
      "endpoint": "GET /v1/example",
      "severity": "critical|high|medium|low",
      "category": "overdue_sunset|missing_sunset_header|missing_deprecation_notice|missing_migration_guide|timeline_violation|incomplete_notice",
      "description": "Specific violation description with policy reference",
      "policy_rule": "Quote the relevant policy clause",
      "current_state": "What was observed",
      "required_state": "What the policy requires",
      "deadline": "ISO-8601 date or null",
      "days_overdue": number or null,
      "recommended_action": "Concrete remediation step"
    }
  ],
  "escalations": [
    {
      "endpoint": "GET /v1/example",
      "reason": "Why this requires immediate attention",
      "days_overdue": number,
      "affected_consumers": "Known client impact description",
      "escalation_level": "team_lead|platform_owner|vp_engineering"
    }
  ]
}

## CONSTRAINTS
- Only flag violations that are explicitly defined in the provided policy.
- If an endpoint has no deprecation status or dates, classify it as active and do not flag it unless the policy requires proactive deprecation planning.
- If the Sunset header is present but the date does not match the policy timeline, flag it as a timeline_violation.
- If a migration guide URL is provided but returns a 404 or is empty, flag it as missing_migration_guide.
- Sort findings by severity (critical first), then by days_overdue descending.
- Escalations should only be generated for critical findings or findings more than [ESCALATION_THRESHOLD_DAYS] days overdue.
- If no violations are found, return an empty findings array and an empty escalations array with compliant summary counts.

## EXAMPLES
[FEW_SHOT_EXAMPLES]

## RISK LEVEL
[RISK_LEVEL]

Evaluate the endpoint inventory against the policy and return only the JSON object specified in the output schema. Do not include explanations, markdown fences, or additional text.

After copying the template, focus on three adaptation steps. First, populate [DEPRECATION_POLICY] with your actual policy text—include specific timelines (e.g., "endpoints must carry a Sunset header 90 days before removal"), required header formats, and notice content rules. Second, populate [ENDPOINT_INVENTORY] with real data from your API gateway, service catalog, or CMDB. This inventory must be refreshed before each run; stale inventory produces false compliance signals. Third, set [ESCALATION_THRESHOLD_DAYS] to your organization's risk tolerance (e.g., 30 days for high-traffic endpoints, 90 days for internal tools). If you have known examples of compliant and non-compliant endpoints, add them to [FEW_SHOT_EXAMPLES] to improve classification accuracy on edge cases like partial deprecation notices or non-standard Sunset header formats.

Before deploying this prompt into an automated pipeline, validate its output against a golden dataset of at least 20 endpoints with known compliance states. Check that the model correctly distinguishes between a missing Sunset header and a Sunset header with an incorrect date, and that it does not flag active endpoints as non-compliant. If the prompt will run in a CI/CD pipeline or governance dashboard, wrap it in a harness that logs every report, diffs findings against previous runs, and routes escalations to the appropriate channel. For high-risk APIs where a missed deprecation could break paying customers, require human review of all critical-severity findings before any automated sunset enforcement action is taken.

IMPLEMENTATION TABLE

Prompt Variables

Inputs the prompt needs to work reliably. Validate each before running the prompt. Missing or malformed inputs cause false negatives in compliance reporting.

PlaceholderPurposeExampleValidation Notes

[API_SPECIFICATION]

Current OpenAPI or AsyncAPI spec document for the API under review

openapi: 3.1.0 info: title: Payments API version: 2.3.1

Must parse as valid OpenAPI 3.x or AsyncAPI 2.x JSON/YAML. Reject if spec fails schema validation or contains unresolved $ref pointers.

[DEPRECATION_POLICY]

Organization's deprecation policy document defining required timelines, Sunset header format, and notice requirements

Minimum 90-day deprecation window. Sunset header required in RFC 7230 format. Migration guide must be published before deprecation announcement.

Must contain explicit timeline requirements (days/months) and required artifacts. Reject if policy is ambiguous about minimum notice period or header format.

[DEPRECATED_ENDPOINTS_LIST]

Inventory of endpoints already marked as deprecated with their deprecation dates and current status

[{"path": "/v1/charges", "method": "POST", "deprecation_date": "2024-11-01", "sunset_date": "2025-02-01"}]

Must include path, method, deprecation_date, and sunset_date per entry. Validate dates are ISO 8601 and deprecation_date precedes sunset_date. Null allowed if no prior deprecations exist.

[MIGRATION_GUIDES_INDEX]

Map of deprecated endpoints to their published migration guide URLs or document references

Each entry must have a resolvable guide_url or document_id. Validate URLs return 200. Flag entries with missing or 404 guides as compliance gaps.

[PRODUCTION_HEADER_SAMPLE]

Sample of actual HTTP response headers from production traffic for deprecated endpoints

Must include Sunset and Deprecation headers if policy requires them. Validate Sunset header date format against RFC 7230. Sample size should cover at least 100 requests per endpoint.

[CLIENT_INVENTORY]

List of known API consumers with their contact info, usage tier, and migration status

[{"client": "Mobile App v3.2", "contact": "mobile-team@example.com", "tier": "internal", "uses_deprecated_endpoints": true}]

Must include client identifier and contact. Validate uses_deprecated_endpoints field is boolean. Reject if tier field uses values outside approved taxonomy (internal, partner, public).

[ESCALATION_CONTACTS]

On-call or team contacts for each API domain, used when overdue deprecations require immediate escalation

[{"domain": "payments", "team": "Payments Platform", "slack_channel": "#payments-api", "pagerduty_id": "P123ABC"}]

Must include domain, team name, and at least one contact channel. Validate pagerduty_id format if used. Reject if domain field doesn't match domains in API_SPECIFICATION.

[PREVIOUS_COMPLIANCE_REPORT]

Last compliance report for diff comparison, tracking whether overdue items have been resolved or are new

{"report_date": "2024-12-01", "overdue_items": [{"endpoint": "/v1/charges", "days_overdue": 15}]}

Must be valid JSON matching output schema of this prompt. Validate report_date is ISO 8601. Null allowed for first run. Use to detect regressions and track resolution velocity.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the API Deprecation Timeline Enforcement Prompt into a scheduled governance workflow with validation, logging, and escalation.

This prompt is designed to run as a scheduled compliance check, not a one-off review. Wire it into a cron job or CI/CD pipeline that triggers weekly or per-release. The harness must supply the current date, the deprecation policy document, and a structured inventory of all published API endpoints with their deprecation metadata. The model's output is a compliance report, so the harness must validate that the report schema is intact before forwarding findings to an issue tracker or notification system.

Input assembly requires three data sources: (1) a machine-readable API inventory (OpenAPI spec, API gateway export, or service catalog) containing endpoint, deprecation_date, sunset_date, sunset_header_present, deprecation_notice_url, and migration_guide_url fields; (2) the organization's deprecation policy document specifying minimum notice periods, required headers, and documentation standards; and (3) the current date for timeline comparison. The harness should transform the API inventory into a structured JSON array and inject it into the [API_INVENTORY] placeholder. The policy document goes into [DEPRECATION_POLICY], and the current date into [CURRENT_DATE]. If the inventory is large, batch endpoints by service and run the prompt per batch, then merge results.

Output validation is critical because the compliance report drives escalation decisions. After the model responds, validate that the output is valid JSON matching the expected schema: a top-level compliance_report object with overdue_items (array), upcoming_deadlines (array), compliant_endpoints (array), and escalation_flags (array). Each item must contain endpoint, severity, policy_violation, and recommended_action fields. If validation fails, retry once with the validation error injected into the [PREVIOUS_ERRORS] placeholder. If the second attempt also fails, log the raw output and alert the API governance team for manual review. Do not silently accept malformed reports.

Escalation routing should be automated based on the severity field in the output. Overdue items with severity: critical (endpoints past their sunset date with no migration guide) should create P0 tickets in the API team's issue tracker. Items with severity: high (sunset date within 30 days with missing Sunset headers) should create P1 tickets. The harness should deduplicate against open tickets to avoid flooding the team with repeat alerts. For each escalation, include the raw compliance report as evidence and a link to the specific policy clause violated.

Model choice and latency are straightforward for this workflow. Use a model with strong JSON mode and instruction-following, such as GPT-4o or Claude 3.5 Sonnet. This is a batch governance task, not a real-time user-facing feature, so latency under 30 seconds is acceptable. Enable structured output mode if the model provider supports it, and set temperature=0 for deterministic compliance rulings. If the API inventory exceeds the model's context window, pre-filter to only deprecated or sunset-eligible endpoints before invoking the prompt, since compliant active endpoints need minimal review.

Logging and audit trail requirements are high because deprecation compliance failures can cause production incidents. Log every prompt invocation with a unique run_id, the input inventory hash, the policy version, the raw model output, the validation result, and any escalation actions taken. Store these logs in an append-only audit store for at least the duration of the longest deprecation window. This ensures that when a client reports a surprise breaking change, the governance team can trace whether the compliance check ran, what it found, and what action was taken. Never run this prompt without audit logging enabled.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, format, and validation rules for the compliance report. Use this contract to validate the model output before it enters a governance workflow or dashboard.

Field or ElementType or FormatRequiredValidation Rule

report_id

string (UUID v4)

Must match regex ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$

generated_at

string (ISO 8601 UTC)

Must parse as valid Date; must be within 5 minutes of system clock at validation time

deprecated_endpoints

array of objects

Must be present; minItems 0; each object must conform to endpoint_item schema

endpoint_item.path

string

Must start with /; must match [INPUT_ENDPOINT_LIST] entry if provided

endpoint_item.sunset_header_present

boolean

Must be true or false; if false, endpoint_item.compliance_status must be non_compliant

endpoint_item.sunset_date

string (ISO 8601 date) or null

If sunset_header_present is true, must parse as valid future date; if false, must be null

endpoint_item.deprecation_notice_url

string (URL) or null

If provided, must pass URL parse check and return HTTP 200 on HEAD request within 10s timeout

endpoint_item.migration_guide_url

string (URL) or null

If provided, must pass URL parse check and return HTTP 200 on HEAD request within 10s timeout

endpoint_item.compliance_status

string (enum)

Must be one of: compliant, at_risk, non_compliant, exempt; if exempt, endpoint_item.exemption_reason is required

endpoint_item.exemption_reason

string or null

Required when compliance_status is exempt; max 500 characters; must not be empty string

endpoint_item.escalation_required

boolean

Must be true if compliance_status is non_compliant and sunset_date is within [ESCALATION_WINDOW_DAYS] of generated_at; otherwise false

overall_compliance_score

number (0.0-100.0)

Must be float with max 1 decimal place; calculated as (compliant_count / total_endpoints) * 100; must match row-level statuses

overdue_action_items

array of strings

Each string must reference a specific endpoint path and missing requirement; max 20 items; must be empty if all endpoints are compliant or exempt

report_signature

string

If present, must be non-empty; used for human reviewer attestation in approval workflow

PRACTICAL GUARDRAILS

Common Failure Modes

API deprecation timeline enforcement fails silently when the prompt trusts incomplete inputs, overlooks missing evidence, or produces compliance verdicts without audit trails. These are the most common failure patterns and how to prevent them.

01

Missing Sunset Header Treated as Compliant

What to watch: The prompt assumes a missing Sunset header means the endpoint is not deprecated, when in fact the header was never added. This produces false-negative compliance reports that let unmarked deprecated endpoints ship without warning. Guardrail: Require the prompt to distinguish 'Sunset header present with valid date' from 'Sunset header absent' as a separate compliance state. Add a pre-check that flags any deprecated endpoint lacking a Sunset header as non-compliant before timeline evaluation begins.

02

Relative Date Parsing Ambiguity

What to watch: Deprecation policies expressed as '90 days from announcement' or '6 months before removal' produce inconsistent compliance verdicts when the prompt must infer announcement dates from changelogs, commit history, or unstructured notices. Different date interpretations cause the same endpoint to pass or fail across runs. Guardrail: Supply explicit reference dates as input fields—[ANNOUNCEMENT_DATE], [DEPRECATION_EFFECTIVE_DATE], [PLANNED_REMOVAL_DATE]—rather than asking the prompt to derive them. Validate that all dates are ISO 8601 before prompt execution.

03

Migration Guide Absence Goes Undetected

What to watch: The prompt checks that a migration guide link exists but does not verify the link resolves, the content is relevant, or the guide actually covers the deprecated endpoint. A 404 page or generic placeholder satisfies the check. Guardrail: Add a tool-call step that fetches the migration guide URL and validates HTTP 200, content length above a minimum threshold, and presence of the deprecated endpoint path in the guide text. Flag any guide that fails these checks as insufficient evidence.

04

Policy Timeline Drift Across Services

What to watch: Different API services operate under different deprecation policies (30-day vs 90-day notice, internal vs external consumers), but the prompt applies a single policy uniformly. This produces false violations for services with shorter internal SLAs and false passes for external endpoints held to stricter standards. Guardrail: Require a [POLICY_CONTEXT] input that maps each endpoint or service group to its applicable policy parameters. Validate that every endpoint in the input has an explicit policy assignment before running compliance checks.

05

Escalation Flag Overload

What to watch: The prompt flags every minor timeline deviation as an escalation, producing a compliance report where all items are critical. Teams learn to ignore the flags, and genuinely overdue endpoints that risk production breakage get lost in the noise. Guardrail: Define a severity tiering schema in the prompt—[ESCALATION_RULES]—that separates informational (within grace period), warning (approaching deadline), and critical (deadline passed, no migration guide) levels. Test that the prompt correctly tiers a known set of borderline cases.

06

Deprecation Notice Content Quality Not Assessed

What to watch: The prompt checks for the existence of a deprecation notice but does not evaluate whether the notice includes required elements: the replacement endpoint, migration timeline, breaking change description, and contact path. A one-line notice passes compliance. Guardrail: Define a [NOTICE_REQUIREMENTS] schema with required fields (replacement_path, breaking_changes, migration_deadline, contact) and instruct the prompt to extract and validate each field. Flag notices with missing required elements as non-compliant regardless of timeline adherence.

IMPLEMENTATION TABLE

Evaluation Rubric

Run these checks against a golden dataset of known-compliant and known-violating endpoints to validate the prompt before production deployment.

CriterionPass StandardFailure SignalTest Method

Sunset Header Detection

Correctly identifies presence/absence of Sunset header on all deprecated endpoints in golden set

Missing Sunset header on a deprecated endpoint is not flagged in the compliance report

Run against 10 deprecated endpoints with known header states; compare flagged vs missed

Deprecation Notice Accuracy

Deprecation notice field matches the known notice text from the golden dataset within 90% token overlap

Notice field is empty, hallucinates a notice not present in the API metadata, or misattributes the notice source

Semantic similarity check between extracted notice and golden notice; flag if cosine similarity < 0.85

Migration Guide Link Validation

Migration guide URL in output matches the known URL from the golden dataset exactly

URL is missing, truncated, or points to a different resource than the documented migration guide

String equality check on extracted URL vs golden URL; fail on any mismatch

Timeline Compliance Classification

Correctly classifies endpoints as compliant, warning, or overdue based on configured policy thresholds

An endpoint 30 days past its deprecation deadline is classified as compliant or warning instead of overdue

Parameterized test with deprecation dates offset from current date by -60, -30, -1, 0, +30 days; check classification label

Escalation Flag Triggering

Escalation flag is true for all overdue endpoints and false for all compliant endpoints in the golden set

Escalation flag is false for an overdue endpoint or true for a compliant endpoint

Binary assertion on escalation_flag field against golden expected value per endpoint

Action Item Completeness

Every overdue endpoint has at least one action item with a non-empty description and an owner field

Action items array is empty for an overdue endpoint, or contains items with null description or owner

Schema validation on action_items array: require length > 0 for overdue endpoints, require non-null description and owner

False Positive Rate on Active Endpoints

Zero compliance violations reported for endpoints that are not deprecated in the golden dataset

An active, non-deprecated endpoint appears in the compliance report with any violation or action item

Run against 5 active endpoints; assert output report excludes them or marks them as not_applicable

Output Schema Conformance

Output JSON matches the defined [OUTPUT_SCHEMA] exactly: all required fields present, no extra fields, correct types

Output is missing required fields, contains undefined fields, or has type mismatches (e.g., string where array expected)

JSON Schema validation against [OUTPUT_SCHEMA] using a validator; fail on any schema violation

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base prompt and a single API spec. Remove the escalation matrix and compliance score weighting. Focus on detecting missing Sunset headers and overdue deprecation dates. Use a flat checklist output instead of a structured compliance report.

code
Check [API_SPEC] for deprecated endpoints. For each, verify:
- Sunset header present? (yes/no)
- Deprecation date in [POLICY_WINDOW]? (yes/no)
- Migration guide linked? (yes/no)

Watch for

  • False positives on experimental/preview endpoints that aren't governed by the same policy
  • Missing detection of indirect deprecation signals (changelog mentions without header changes)
  • Overly broad instructions that flag every versioned endpoint as deprecated
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.