Skip to content

fix: correct API reference server URL so request examples render#804

Merged
RiskeyL merged 1 commit into
mainfrom
fix/api-render-error
Jun 1, 2026
Merged

fix: correct API reference server URL so request examples render#804
RiskeyL merged 1 commit into
mainfrom
fix/api-render-error

Conversation

@RiskeyL
Copy link
Copy Markdown
Contributor

@RiskeyL RiskeyL commented Jun 1, 2026

Problem

Every API reference page briefly showed "A valid request URL is required to generate request examples" on load, and the Send Chat Message page (the only endpoint with multiple request examples) rendered a blank request example that never recovered.

The cause was the servers[0].url in all OpenAPI specs: a bare {api_base_url} token with no URL scheme. Mintlify can't parse a schemeless template as an absolute URL on first paint, so it failed to build the request example. Interacting with a control forced a re-render that resolved the variable default, which is why selecting from the dropdown cleared the error.

Fix

Prefix the literal https:// scheme onto the templated URL (https://{api_base_url}) and move the host and path into the variable default (api.dify.ai/v1). The template now parses as a valid URL on first paint, eliminating the error and the blank example, while keeping a server variable so the playground retains its editable Server (base URL) field for self-hosted users. The scheme is fixed to https, which is correct for browser-origin "Try it" requests anyway. zh and ja specs are updated in step, with the variable description translated.

Copilot AI review requested due to automatic review settings June 1, 2026 11:39
@mintlify
Copy link
Copy Markdown
Contributor

mintlify Bot commented Jun 1, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
dify-core-product 🟢 Ready View Preview Jun 1, 2026, 11:41 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the OpenAPI servers configuration across the API reference specs so Mintlify can render request examples using a valid base URL on first paint, avoiding the transient “A valid request URL is required…” error and the permanently blank example on the “Send Chat Message” endpoint.

Changes:

  • Replaced templated servers[0].url values (e.g., {api_base_url}, {apiBaseUrl}) with the absolute URL https://api.dify.ai/v1.
  • Removed servers[0].variables blocks that previously carried the real URL via default.
  • Added/updated localized servers[0].description text to instruct self-hosted users to replace the base URL (EN/ZH/JA).

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
zh/api-reference/openapi_workflow.json Set absolute servers[0].url and updated server description (ZH).
zh/api-reference/openapi_knowledge.json Set absolute servers[0].url and updated server description (ZH).
zh/api-reference/openapi_completion.json Set absolute servers[0].url and updated server description (ZH).
zh/api-reference/openapi_chatflow.json Set absolute servers[0].url and updated server description (ZH).
zh/api-reference/openapi_chat.json Set absolute servers[0].url and updated server description (ZH).
ja/api-reference/openapi_workflow.json Set absolute servers[0].url and updated server description (JA).
ja/api-reference/openapi_knowledge.json Set absolute servers[0].url and updated server description (JA).
ja/api-reference/openapi_completion.json Set absolute servers[0].url and updated server description (JA).
ja/api-reference/openapi_chatflow.json Set absolute servers[0].url and updated server description (JA).
ja/api-reference/openapi_chat.json Set absolute servers[0].url and updated server description (JA).
en/api-reference/openapi_workflow.json Set absolute servers[0].url and updated server description (EN).
en/api-reference/openapi_knowledge.json Set absolute servers[0].url and updated server description (EN).
en/api-reference/openapi_completion.json Set absolute servers[0].url and updated server description (EN).
en/api-reference/openapi_chatflow.json Set absolute servers[0].url and updated server description (EN).
en/api-reference/openapi_chat.json Set absolute servers[0].url and updated server description (EN).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@RiskeyL RiskeyL force-pushed the fix/api-render-error branch from 5bd2fa7 to c2ad662 Compare June 1, 2026 11:57
@RiskeyL RiskeyL changed the title fix: use absolute server URL in API reference specs fix: correct API reference server URL so request examples render Jun 1, 2026
@RiskeyL RiskeyL merged commit 6c348a6 into main Jun 1, 2026
2 of 3 checks passed
@RiskeyL RiskeyL deleted the fix/api-render-error branch June 1, 2026 12:05
@RiskeyL
Copy link
Copy Markdown
Contributor Author

RiskeyL commented Jun 1, 2026

💚 All backports created successfully

Status Branch Result
release/1.14.2
release/1.14.1
release/1.14.0

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

RiskeyL added a commit that referenced this pull request Jun 1, 2026
RiskeyL added a commit that referenced this pull request Jun 1, 2026
RiskeyL added a commit that referenced this pull request Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants