Blog

How API Versioning Causes Conflicting AI Answers About Developer Products

AI assistants can produce different, technically plausible answers about the same API because versioned documentation creates multiple retrieval paths. The problem is usually not one bad page. It is a mismatch between endpoint status, documentation structure, examples, canonical signals, and the assistant’s knowledge—c

A developer asks an AI assistant, “How do I create a customer with the API?” One answer uses a v1 endpoint, another uses v2. One returns a field that no longer exists. A third recommends an endpoint marked deprecated in the changelog. All three answers may sound confident because each one was assembled from a real fragment of the product’s documentation. The conflict comes from how those fragments are exposed and retrieved.

Why API versioning creates conflicting retrieval signals

An API is rarely documented as one clean, current reference. It is more often a collection of reference pages, guides, SDK examples, OpenAPI files, migration notes, release posts, and generated documentation. Several versions can remain publicly accessible for good operational reasons. Existing customers need them, support teams link to them, and old integrations may still depend on them.

An AI assistant does not necessarily understand that these pages form a timeline. It may retrieve a page because it matches the user’s words, not because it is the latest supported source. If the user does not name a version, the assistant has to infer which version applies. That inference becomes unreliable when the site uses vague labels such as “API reference,” “latest,” or “current” without making the relationship between versions explicit.

  • A deprecated endpoint can rank or retrieve well because its page contains the exact phrase in the user’s question.
  • A migration guide can describe old and new behavior in the same passage, making snippets ambiguous.
  • An SDK example can use one version while the nearby prose describes another.
  • A JavaScript application can hide version context until a client-side interaction occurs.
  • An archived page may remain more widely linked or present in older web data than the current reference.
  • An assistant may combine a current authentication rule with an older resource endpoint.

This is why conflicting answers are not necessarily evidence that a model is randomly hallucinating. They can be a predictable result of competing, partially correct documents.

The five kinds of API version evidence assistants may encounter

“Version” is not one signal. A technical documentation site may expose several kinds of evidence, and they do not always agree.

Evidence sourceWhat it tells a readerCommon ambiguity
URL and navigationWhich version a page is intended to describeA /docs/api page may redirect, change content, or silently represent “latest”
Endpoint and schemaWhich route, fields, and response shape are availableGenerated references may omit lifecycle status or inherit stale schemas
Examples and SDK snippetsHow a developer is expected to implement a taskExamples may use old packages, base URLs, headers, or field names
Changelog and migration guideWhat changed and whenHistorical text can be retrieved without the surrounding date or replacement context
Metadata, canonical, and sitemap signalsHow pages relate to one another for discoveryA canonical URL can collapse distinctions that users still need to preserve

The strongest documentation makes these signals agree. A v2 page should identify itself as v2 in the URL, title, heading, metadata, navigation, code samples, schema, and explanatory text. If that is not possible, the page should at least state the version and lifecycle status in visible HTML near the beginning.

Deprecated endpoints are useful—and dangerous—sources

Deprecation documentation has a legitimate job. It explains what existing customers should do, records compatibility constraints, and supports systems that cannot migrate immediately. Deleting every old page is usually the wrong response. The problem is allowing an obsolete endpoint to look like a current recommendation.

A deprecated page can create conflicting AI answers when its title says “Create an order,” while the only indication of deprecation appears in a small badge, a JavaScript component, or a changelog published months later. A retrieval system may extract the endpoint description and example but miss the badge or the migration warning.

For each deprecated endpoint, make the lifecycle state machine-readable where possible and unmistakable to readers. Include:

  • A visible label such as “Deprecated,” “Sunset,” or “Legacy,” near the page title.
  • The date the endpoint was deprecated and, if known, the planned removal date.
  • A direct link to the replacement endpoint or version.
  • A short explanation of behavioral differences, not only a link to a migration guide.
  • An example that is clearly labeled as legacy, or no example if showing it would encourage new usage.
  • The supported authentication, request, and response details needed by existing users.

HTTP headers such as Deprecation and Sunset may help clients that inspect them, but they are not a substitute for visible documentation. Assistants may never request the endpoint, and crawlers may not preserve every response header in their index.

Changelogs can clarify version history or mix it together

Changelogs are often written for humans who already know the product. A line such as “The customers endpoint now accepts external_id” may be clear to a release manager but unclear to an assistant answering whether v1 supports that field. If the changelog does not name the API version, effective date, and affected route, it becomes weak evidence.

Treat changelog entries as historical records, not as the canonical reference. Each entry should link to the relevant versioned reference and migration instructions. Avoid relying on phrases such as “new API” or “updated behavior” without a stable version identifier.

  1. Name the affected API version, endpoint, SDK, or schema.
  2. State whether the change is additive, breaking, deprecated, or documentation-only.
  3. Give the effective date or release identifier.
  4. Link to the current reference page and, when relevant, the previous behavior.
  5. Update the example and schema that a developer is most likely to retrieve.
  6. Use a migration page for cross-version explanation rather than making the changelog carry the full specification.

This separation helps an assistant answer two different questions correctly: “What does v1 do?” and “What changed between v1 and v2?” Those questions need different source pages.

Canonical links do not replace version strategy

Canonical links are useful when multiple URLs contain substantially duplicate content. They can help search systems understand which URL is preferred. But API versions are often intentionally different resources. If v1 and v2 have different fields, authentication behavior, or error formats, making v2 canonical for v1 can erase an important distinction.

A practical canonical strategy usually looks like this:

Page relationshipLikely canonical approachReason
Distinct supported versionsSelf-referencing canonical on each versioned pagePreserves the fact that each version is a separate reference
Tracking or parameter duplicatesCanonical to the clean versioned URLRemoves URL noise without removing version identity
Truly identical introduction pagesCanonical to one authoritative overviewAvoids duplicate copies of the same content
Deprecated page retained for compatibilityUsually retain a deliberate canonical and clear statusA redirect or canonical should not silently erase migration information
Unversioned “latest” aliasLink clearly to the current version and explain the aliasPrevents a moving target from becoming the only version signal

Check that the canonical target is accessible, indexable, and actually describes the same content. A canonical tag pointing from a v1 page to v2 does not guarantee that an AI assistant will use v2, and it may make it harder for systems to discover the historical page as a distinct source.

For more on the wider distinction between access, machine-readable structure, and answer visibility, see the AI visibility guide and the JSON-LD guide.

Code examples often override careful prose

Developers frequently copy the first working request they see. AI assistants also tend to use examples because they are compact and easy to transform into an answer. That makes examples a high-impact source of version confusion.

An otherwise well-labeled v2 page can still produce a wrong answer if its code block uses a v1 base URL, an old SDK package, a removed field, or a legacy authentication header. The opposite can happen too: a current example may appear on a migration page and be attributed to the old version.

  • Put the version in the example’s heading or caption, not only in surrounding tabs.
  • Show the full base URL when it differs by version.
  • Use a package version or installation command that matches the API behavior.
  • Include realistic request and response fields from the same schema.
  • Mark copied legacy examples with a visible “v1 only” label.
  • Test examples in continuous integration where practical.
  • Keep OpenAPI documents, SDK generators, and prose examples synchronized.

Do not assume a tabbed documentation interface solves this problem. If inactive tabs are absent from the initial HTML, difficult to crawl, or rendered with generic headings, a retrieval system may see incomplete context. The guidance on crawlable HTML versus SPAs is especially relevant to interactive API references.

A documentation audit for version-aware AI answers

The goal is not to make every assistant produce one predetermined sentence. The goal is to make the authoritative answer easier to identify and harder to confuse with an obsolete one. A repeatable audit should inspect both technical access and semantic clarity.

  1. Inventory every public version. Record reference URLs, guides, OpenAPI files, SDK pages, changelogs, redirects, and archived pages.
  2. Choose representative questions. Include endpoint discovery, authentication, pagination, error handling, and migration questions.
  3. Run each question with an explicit version and without a version. Compare whether the answer distinguishes the two cases.
  4. Trace every factual claim to a source page. Note whether the source is current, deprecated, historical, or ambiguous.
  5. Inspect the initial HTML. Confirm that version, lifecycle status, endpoint, and replacement links are present without requiring client-side interaction.
  6. Check metadata and links. Review titles, headings, canonical URLs, hreflang if relevant, sitemaps, robots rules, and any llms.txt guidance.
  7. Compare examples against schemas and live behavior. Look for mismatched base URLs, SDK versions, field names, and authentication methods.
  8. Repeat the scan after releases. Version confusion is a maintenance problem, not a one-time SEO task.

Separate three findings that are often incorrectly combined: whether crawlers can access the page, whether the page is present in open-web or training sources, and whether a live assistant cites it in an answer. The Common Crawl and training presence guide explains why those are different states. Likewise, a citation test measures answer behavior at a point in time; it does not prove that a page is universally used.

What to measure when answers disagree

A useful measurement program records the conditions of each test. Model name, date, prompt, location, enabled tools, cited URLs, answer version, and whether the response asked a clarifying question can all affect the result.

CheckUseful resultWhat it cannot prove
Crawler and robots auditWhether relevant documentation is technically reachableThat a model will retrieve or cite it
HTML and metadata scanWhether version and lifecycle signals are exposed clearlyThat the content is factually correct or preferred by every index
Source and citation comparisonWhich URLs appear in sampled answersThat uncited pages are invisible everywhere
Prompt set by API versionHow often answers mix versions under controlled questionsA universal rate across all users and assistants
Competitor or product comparisonRelative visibility for the same technical tasksA guarantee of rankings, citations, traffic, or leads

A simple internal scorecard can track whether an answer used the requested version, named uncertainty, linked the current reference, and avoided deprecated recommendations. These are more actionable than treating a single citation as proof of success. BatSignal’s methodology describes the distinction between access, content readiness, coverage, and sampled answer visibility.

FAQ

Why does an AI assistant give different answers about the same API version?

It may retrieve different documentation pages, rely on older training data, infer from a code example, or fail to distinguish stable, beta, and deprecated endpoints. Version labels that are inconsistent across URLs, titles, schemas, and examples make this more likely.

Does adding an llms.txt file prevent incorrect API answers?

No. An llms.txt file can provide a useful map of important documentation, but it does not force assistants to use those pages or guarantee that they will distinguish versions correctly. It should support, not replace, clear URLs, crawlable HTML, canonical signals, and explicit deprecation guidance.

Should deprecated API documentation be removed?

Not automatically. Removing it can break existing integrations and erase useful migration context. A better approach is to preserve the page when necessary, label its status and retirement date clearly, link to the replacement, and prevent deprecated examples from looking like current recommendations.

Can canonical links make an AI assistant cite the newest API version?

Canonical links can reduce duplicate-page ambiguity for search systems, but they are not an instruction that every assistant must cite a particular version. Version-specific pages should usually have self-referencing canonicals or another deliberate canonical strategy, while the page itself states its supported version and status.