Skip to content

feat(api): Use region-specific URLs in API doc curl examples#17779

Open
mwarkentin wants to merge 5 commits into
masterfrom
michaelwarkentin/inc-2335-improve-api-docs-with-region-specific-endpoint-examples
Open

feat(api): Use region-specific URLs in API doc curl examples#17779
mwarkentin wants to merge 5 commits into
masterfrom
michaelwarkentin/inc-2335-improve-api-docs-with-region-specific-endpoint-examples

Conversation

@mwarkentin
Copy link
Copy Markdown
Member

DESCRIBE YOUR PR

API doc pages (e.g. /api/explore/query-explore-events-in-table-format/) currently render curl examples with https://sentry.io/api/0/... as the base URL. This ignores the OpenAPI spec's servers field which defines region-specific URLs (https://{region}.sentry.io).

This PR:

  • Reads the global servers field from the OpenAPI spec instead of hardcoding sentry.io. Per-operation server overrides are still respected first, then the global servers block, then https://sentry.io as a safety fallback.
  • Adds a region picker (US | DE tabs) above the curl code block on every API endpoint page, so users can switch between https://us.sentry.io/api/0/... and https://de.sentry.io/api/0/....
  • Auto-detects the region for logged-in users by reading their project's API_URL from CodeContext, pre-selecting the correct tab.

This steers customers (especially those on the DE region) toward the correct regional endpoint, avoiding cross-Atlantic RPCs.

Refs INC-2335

IS YOUR CHANGE URGENT?

  • Urgent deadline (GA date, etc.)
  • Other deadline
  • None: Not urgent, can wait up to 1 week+

PRE-MERGE CHECKLIST

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

Made with Cursor

Read the global `servers` field from the OpenAPI spec instead of
hardcoding `sentry.io` as the base URL for curl examples. The spec
defines `https://{region}.sentry.io` with region enum (us, de), so
curl examples now render as `https://us.sentry.io/api/0/...` with a
region picker (US | DE tabs) above the code block.

For logged-in users, the region is auto-detected from their
CodeContext project data so the correct regional endpoint is
pre-selected.

Refs INC-2335
Co-Authored-By: Claude <noreply@anthropic.com>

Co-authored-by: Cursor <cursoragent@cursor.com>
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 15, 2026

INC-2335

@vercel
Copy link
Copy Markdown

vercel Bot commented May 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
develop-docs Ready Ready Preview, Comment May 15, 2026 9:14pm
sentry-docs Ready Ready Preview, Comment May 15, 2026 9:14pm

Request Review

Comment thread src/components/apiExamples/apiExamples.tsx Fixed
Satisfy CodeQL js/regex/missing-regexp-anchor by requiring a `/`
after `.sentry.io` so the pattern cannot match lookalike domains.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
mwarkentin and others added 2 commits May 15, 2026 16:20
Fixes react-hooks/exhaustive-deps lint error where the fallback
empty array created a new reference on every render.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b2ecd86. Configure here.

Comment thread src/components/apiExamples/apiExamples.tsx
Read sharedKeywordSelection to resolve the user's currently selected
project instead of always reading PROJECT[0]. This ensures the region
tab matches when users switch between projects in different regions.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants