This prompt is built for technical writing teams and API platform engineers who need to validate that their published API reference documentation matches the actual implementation. The core job-to-be-done is catching parameter mismatches, incorrect types, missing endpoints, and stale descriptions before they reach developers. The ideal user has access to a source of truth—typically an OpenAPI specification, a runtime behavior log, or a set of live API responses—and needs a structured, machine-readable audit report that can be parsed by downstream CI/CD tooling or a documentation platform.
Prompt
API Reference Accuracy Audit Prompt Template

When to Use This Prompt
Understand the ideal conditions, required inputs, and clear boundaries for deploying the API Reference Accuracy Audit Prompt.
You should use this prompt before a release, during a documentation migration, or as a gating step in a deployment pipeline. It expects structured inputs: a documentation snapshot (the claims) and a source-of-truth artifact (the evidence). The prompt is most effective when the documentation is machine-readable (e.g., scraped HTML, Markdown, or a structured JSON representation) and the source of truth is a valid OpenAPI spec or a log of actual request/response pairs. Do not use this prompt for subjective prose reviews, style guide adherence, or code sample compilability checks—those are separate audit workflows. It also should not be used when the source of truth is incomplete or when the documentation is purely conceptual with no corresponding API surface.
Before running this prompt, ensure you have a clear output schema defined so the audit report can be consumed by your automation. If the audit flags a high-severity mismatch—such as a missing required parameter or a documented endpoint that no longer exists—the workflow should block the release or trigger a human review. For lower-severity findings like stale descriptions, you may route the report for automatic ticket creation. The next step after reading this section is to prepare your input artifacts and define the severity thresholds that matter for your release process.
Use Case Fit
Where the API Reference Accuracy Audit Prompt works, where it breaks, and what you must provide before running it.
Good Fit: Spec-to-Implementation Validation
Use when: you have a live API or a frozen OpenAPI spec and need to verify that every documented parameter, type, and description matches runtime behavior. The prompt excels at structured diffing and flagging mismatches. Guardrail: always provide the spec and a representative set of live responses as [CONTEXT].
Bad Fit: Behavioral or Performance Audits
Avoid when: you need to validate latency SLAs, throughput limits, or complex stateful workflows. The prompt audits static documentation claims, not runtime performance. Guardrail: route performance validation to a dedicated observability harness; use this prompt only for surface-level contract accuracy.
Required Input: Ground-Truth Source
Risk: without a canonical spec or live response corpus, the model cannot detect mismatches and may hallucinate findings. Guardrail: always supply [OPENAPI_SPEC] or [LIVE_RESPONSES] as the ground truth. The prompt must compare two concrete artifacts, not infer correctness from training data.
Required Input: Documentation Snapshot
Risk: pointing the prompt at a live docs site introduces crawling noise, auth walls, and version drift. Guardrail: provide a static [DOCUMENTATION_TEXT] extract or a version-pinned export. This ensures the audit is repeatable and diffable across releases.
Operational Risk: False Positives from Conditional Fields
What to watch: fields that appear only under certain conditions (auth level, feature flags, error states) may be flagged as missing when they are intentionally absent. Guardrail: include [CONDITIONAL_BEHAVIOR_NOTES] in the input context and instruct the prompt to mark uncertain findings as review_required rather than definite_mismatch.
Operational Risk: Stale Spec Drift
What to watch: when the OpenAPI spec itself is outdated, the audit will report documentation errors that are actually spec errors. Guardrail: run a spec-freshness check before the audit. If [SPEC_LAST_UPDATED] is older than the last deployment, flag the audit results as low-confidence and escalate for spec refresh.
Copy-Ready Prompt Template
A reusable prompt template for auditing API reference documentation against live implementations or OpenAPI specifications.
The following prompt template is designed to be copied directly into your AI harness, notebook, or evaluation runner. It uses square-bracket placeholders for all dynamic inputs, allowing you to swap in different API documentation sources, specifications, and runtime behavior logs without rewriting the core instruction. The template is structured to produce a consistent, machine-readable audit report that can be fed into downstream validation tools or human review queues.
textYou are an API documentation auditor. Your task is to compare the provided API reference documentation against the authoritative source of truth and produce a structured accuracy audit report. ## INPUTS - **Documentation to Audit:** [DOCUMENTATION_CONTENT] - **Authoritative Source (choose one or more):** [OPENAPI_SPEC] [RUNTIME_BEHAVIOR_LOG] [SOURCE_CODE_ANNOTATIONS] - **Audit Scope:** [AUDIT_SCOPE] ## OUTPUT SCHEMA Return a JSON object with the following structure: { "audit_metadata": { "audit_id": "string", "timestamp": "ISO8601", "scope": "string" }, "findings": [ { "severity": "critical | high | medium | low", "category": "parameter_mismatch | missing_endpoint | incorrect_type | stale_description | broken_example | missing_error_code | schema_violation | deprecation_gap | security_concern | other", "location": "string (section, paragraph, or line reference)", "documented_claim": "string (exact text from docs)", "actual_behavior": "string (what the source of truth shows)", "impact": "string (what breaks for the consumer)", "suggested_fix": "string (actionable correction)" } ], "summary": { "total_findings": "number", "by_severity": {"critical": 0, "high": 0, "medium": 0, "low": 0}, "by_category": {}, "coverage_gaps": ["string (endpoints or sections missing entirely)"] } } ## CONSTRAINTS - Only report findings where documented claims diverge from the authoritative source. - Do not flag stylistic preferences, word choice, or formatting unless they cause functional confusion. - For each finding, quote the exact documented text and the exact source-of-truth evidence. - If a parameter, endpoint, or error code exists in the source but is absent from the docs, flag it as a coverage gap with severity "high" or "critical." - If the documentation is correct, return an empty findings array and note coverage completeness in the summary. - Do not invent findings. If evidence is ambiguous, note uncertainty and assign severity "low." ## EXAMPLES [FEW_SHOT_EXAMPLES] ## RISK LEVEL [RISK_LEVEL]
To adapt this template, replace each square-bracket placeholder with your actual inputs. For [DOCUMENTATION_CONTENT], paste the full text of the API reference page or section you are auditing. For the authoritative source, provide at least one of [OPENAPI_SPEC], [RUNTIME_BEHAVIOR_LOG], or [SOURCE_CODE_ANNOTATIONS]. The [AUDIT_SCOPE] placeholder should specify which endpoints, parameters, or documentation sections to examine—use "all" for a full audit or a comma-separated list for targeted checks. The [FEW_SHOT_EXAMPLES] placeholder accepts one or two example finding objects to calibrate severity and category assignment. Set [RISK_LEVEL] to "low," "medium," or "high" to adjust the auditor's sensitivity; high-risk mode flags even minor discrepancies, while low-risk mode only reports breaking changes.
Before running this prompt in production, validate that the output JSON conforms to the schema using a JSON Schema validator. For high-stakes audits—such as those covering authentication, billing, or security endpoints—always route findings through human review before publishing corrections. If you are integrating this prompt into a CI/CD pipeline, pair it with a retry mechanism that re-runs the audit when the model returns malformed JSON or an empty response. Store each audit result with the prompt version, model identifier, and input hashes for traceability.
Prompt Variables
Required and optional inputs for the API Reference Accuracy Audit prompt. Each placeholder must be populated before the prompt is sent. Validation notes describe how to confirm the input is well-formed before execution.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[API_REFERENCE_CONTENT] | The full text of the API reference documentation to audit | GET /v1/users - Returns a paginated list of users. Query params: limit (integer, default 20), offset (integer, default 0). Response: { users: User[], total: integer } | Must be non-empty string. Strip HTML/markdown if model expects plain text. Check for minimum 50 characters to ensure substantive content. |
[OPENAPI_SPEC] | The OpenAPI specification (JSON or YAML) representing the source of truth for the API contract | { "openapi": "3.1.0", "paths": { "/v1/users": { "get": { "parameters": [...] } } } } | Must parse as valid OpenAPI 3.x. Validate with openapi-schema-validator before use. Null allowed if auditing without a spec, but accuracy checks will be limited to internal consistency only. |
[RUNTIME_RESPONSE_SAMPLES] | Live API response payloads captured from actual endpoint calls, used to verify documented schemas against real behavior | [{ "endpoint": "GET /v1/users", "status": 200, "body": { "users": [], "total": 0, "page": 1 } }] | Each sample must include endpoint path, HTTP method, status code, and response body. Validate JSON parse on body field. Minimum 1 sample per audited endpoint recommended. Null allowed if no runtime access. |
[AUDIT_SCOPE] | List of specific endpoints, parameter categories, or documentation sections to include or exclude from the audit | ["GET /v1/users", "POST /v1/users", "parameters", "error responses"] | Must be a JSON array of strings. Each string must match an endpoint path, section heading, or category keyword present in the documentation. Empty array means audit everything. |
[STYLE_GUIDE_RULES] | Custom style guide constraints for terminology, formatting, and structural conventions to check against | { "required_sections": ["Authentication", "Parameters", "Response", "Errors"], "terminology": { "preferred": "endpoint", "avoid": ["route", "URL path"] } } | Must be a JSON object with optional keys: required_sections (string array), terminology (object with preferred/avoid maps), formatting_rules (string array). Null allowed if no style guide applies. |
[DEPRECATION_WINDOW_DAYS] | Threshold in days for flagging deprecated features that are past their sunset date or lack migration guidance | 90 | Must be a positive integer. Used to classify deprecation severity: features deprecated longer than this threshold without removal are flagged as high-risk. Default 180 if not specified. |
[OUTPUT_FORMAT] | Desired structure for the audit report output | "structured_json" | Must be one of: "structured_json", "markdown_report", "csv_rows". Controls output schema. Default "structured_json" if omitted. Validate against allowed enum before prompt assembly. |
Implementation Harness Notes
How to wire the API Reference Accuracy Audit Prompt into a reliable documentation validation pipeline.
This prompt is designed to be the reasoning core of an automated documentation audit system, not a one-off chat interaction. The implementation harness must treat the LLM as an intelligent comparator that produces structured findings, while the surrounding application code handles evidence collection, validation, and integration with existing doc platforms. The prompt expects a specific input shape—a documentation snippet paired with a live API reference (OpenAPI spec, runtime response, or SDK signature)—and produces a JSON audit report. The harness is responsible for assembling that input correctly, validating the output schema, and deciding what to do with each finding.
Input Assembly: Before calling the prompt, the harness must gather two data sources: the documentation claim and the ground truth. For endpoint audits, extract the relevant section from your docs (Markdown, HTML, or a CMS API) and pair it with the corresponding OpenAPI operation object or a captured response from the live API. For parameter checks, isolate the parameter table from the docs and the parameter definition from the spec. The harness should normalize both into the [DOCUMENTATION_SNIPPET] and [API_SPEC_OR_RESPONSE] placeholders as structured text. If you're auditing at scale, build a mapping file that links doc page URLs to spec operation IDs so the harness can iterate without manual pairing. Validation Layer: The prompt returns a JSON object with a findings array. The harness must validate this against a strict schema before accepting it. Each finding must have severity, category, location, expected, actual, and recommendation fields. If the model returns malformed JSON, use a repair prompt or a retry with the error message appended. For high-stakes audits (security auth flows, breaking changes), flag any critical severity finding for human review before publishing.
Integration Points: Wire the harness into your CI/CD pipeline so that every docs PR triggers an audit on changed pages. Use a model with strong structured output support (GPT-4o, Claude 3.5 Sonnet, or Gemini 1.5 Pro) and set temperature=0 for consistency. Log every audit result—including the input pair, raw model response, and validated output—to an observability platform for traceability. Failure Modes to Watch: The most common production failure is a mismatch between the documentation snippet's scope and the spec fragment's scope. If you pass an entire endpoint page but only one parameter's spec definition, the model may flag false positives. The harness should chunk documentation into logical units (one endpoint, one parameter group, one auth flow) and pair each chunk with its precise spec counterpart. A second failure mode is spec staleness: if your OpenAPI file is outdated, the audit will flag correct docs as wrong. The harness should verify the spec's info.version or fetch a fresh runtime response before running the audit. Next Step: After implementing the harness, run it against a known-good documentation set to calibrate severity thresholds and identify categories where the model over-flags or under-flags issues. Use those results to tune the [CONSTRAINTS] placeholder with category-specific guidance before scaling to the full doc set.
Expected Output Contract
Define the exact shape of the audit report so downstream systems can parse, display, and act on findings without ambiguity.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
audit_id | string (UUID v4) | Must be a valid UUID v4 generated at report creation time. | |
audit_timestamp | string (ISO 8601) | Must parse as a valid ISO 8601 datetime in UTC. | |
target_endpoint | string (path) | Must start with '/' and match the pattern of a documented API route. | |
findings | array of objects | Must be a non-null array; an empty array indicates no issues found. | |
findings[].severity | enum: 'critical', 'high', 'medium', 'low' | Must be one of the four defined severity strings. | |
findings[].category | enum: 'missing_param', 'type_mismatch', 'stale_description', 'missing_endpoint', 'incorrect_default', 'broken_example' | Must be one of the six defined category strings. | |
findings[].doc_location | string (section or line reference) | Must be a non-empty string identifying where the issue appears in the source documentation. | |
findings[].evidence | object | Must contain 'doc_claim' and 'live_behavior' string fields, both non-empty. |
Common Failure Modes
When auditing API reference accuracy with LLMs, these failures surface first. Each card identifies a specific breakdown and the operational guardrail that prevents it from reaching production.
Hallucinated Parameters
What to watch: The model invents query parameters, body fields, or enum values that don't exist in the live API. This happens most often when the prompt lacks a strict schema reference or when the model tries to 'complete' an incomplete spec. Guardrail: Always supply the authoritative OpenAPI spec or JSON Schema as a tool input. Require the model to cite exact field paths and reject any output that references undocumented fields.
Stale Description Drift
What to watch: The model recites documentation from its training data instead of the provided spec, causing descriptions to match an older API version. This is common when the spec is sparse and the model fills gaps with memorized content. Guardrail: Include a diff step that compares generated descriptions against the provided source material only. Flag any description that cannot be traced to a specific spec field or example.
Type Mismatch Blindness
What to watch: The model reports a field as string when the spec defines it as integer, or misses nullable constraints. This breaks SDK generation and client validation. Guardrail: Run a structured comparison pass that extracts types from both the spec and the audit output, then diff them field-by-field. Use a deterministic validator, not model judgment, for type correctness.
Missing Error Code Coverage
What to watch: The audit fails to flag undocumented error responses because the model focuses only on happy-path parameters. Consumers are left without remediation guidance for 400, 429, or 500-class errors. Guardrail: Explicitly require the model to enumerate every HTTP status code the API can return and check for corresponding documentation entries. Add a dedicated eval that measures error code recall against runtime traffic samples.
Authentication Scope Confusion
What to watch: The model incorrectly maps OAuth scopes or API key permissions to endpoints, claiming an endpoint requires a scope it doesn't or omitting a required scope entirely. Guardrail: Provide a machine-readable scope-to-endpoint mapping. Require the model to output a scope-permission matrix and validate it against the source of truth before accepting the audit.
Example Payload Fabrication
What to watch: The model generates 'example' request or response bodies that look plausible but contain invalid field combinations, impossible enum values, or missing required fields. Developers copy these into integration tests and waste hours debugging. Guardrail: Never accept model-generated examples without validation. Pipe every example payload through a JSON Schema validator configured with the exact spec for that endpoint. Discard any example that fails validation.
Evaluation Rubric
Use this rubric to score the output of the API Reference Accuracy Audit Prompt against live implementation or spec ground truth. Each criterion targets a specific failure mode common in automated documentation audits.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Parameter Completeness | All parameters in the live API response/request body appear in the audit report with correct presence status | Audit report omits a parameter present in the live API call or OpenAPI spec | Diff the set of parameter names in the audit report against the set extracted from the live API response or spec |
Type Accuracy | Every parameter type in the audit report matches the actual JSON type returned by the live API | Audit report claims a parameter is | Field-by-field type assertion using |
Required/Optional Flagging | Required flags in the audit report match the OpenAPI spec | Audit report marks a parameter as | Compare audit report required flags against spec |
Deprecation Status Detection | Deprecated parameters are correctly identified with sunset date and replacement guidance when available | Audit report misses a | Cross-reference audit deprecation flags against OpenAPI spec |
Description Staleness Check | Audit report flags descriptions that are identical to the spec but contradicted by observed behavior | Audit report passes a description as accurate when the parameter behavior has changed (e.g., new enum value not documented) | Spot-check N parameters with known behavioral changes; verify audit report correctly flags the mismatch |
Error Code Coverage | Audit report identifies undocumented error codes observed in live testing that are missing from the docs | Audit report claims full coverage when live testing produces an HTTP status code not listed in the documentation | Run a test suite that triggers known error conditions; compare audit report findings against observed status codes |
Example Payload Validity | Audit report flags documented example payloads that fail to parse or validate against the live API schema | Audit report ignores a documented example that returns a 400 error when submitted to the live endpoint | Extract documented examples, submit to live API, and verify audit report correctly identifies any that fail |
Authentication Scope Accuracy | Audit report correctly identifies the minimum required OAuth scope or API key permission for each endpoint | Audit report claims a scope is sufficient when the live API returns 403 Forbidden for that scope | Test each documented endpoint with incremental scopes; verify audit report matches the minimum scope that returns 200 |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with a single API endpoint and a small OpenAPI spec. Remove structured output requirements and ask for a plain-text audit summary. Focus on catching obvious mismatches in parameter names, types, and descriptions.
Prompt modification
Replace [OUTPUT_SCHEMA] with: Return findings as a bulleted list grouped by severity. Remove [CONSTRAINTS] section and replace with: Flag only clear mismatches. Skip uncertain findings.
Watch for
- Missing schema validation means type errors slip through
- Overly broad instructions produce vague findings like "check everything"
- No diff format makes it hard to compare runs

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us