Skip to content

feat(api): Carry x-sentry-project-scope as ApiOperation.projectScope - #132723

Merged
BYK merged 1 commit into
masterfrom
feat/api-project-scope
Nov 27, 2026
Merged

BYK merged 1 commit into
masterfrom
feat/api-project-scope

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

@sentry/api/operations now carries Sentry's x-sentry-project-scope OpenAPI extension, added in #132722, as ApiOperation.projectScope. Clients that limit a caller to some projects can read it instead of keeping their own endpoint table. getsentry/toolkit#2552 consumes it for the Sentry CLI and MCP project scope.

export type ApiProjectScope = "path" | "filter" | "org-metadata" | `response:${string}`;

// on ApiOperation
readonly projectScope?: ApiProjectScope;

The values:

  • path: the path names the project.
  • filter: an organization endpoint that takes the project query parameter (numeric project IDs) and returns or changes only those projects' data.
  • org-metadata: a read-only organization endpoint whose response holds no project's telemetry. GET only.
  • response:<pointer>: a GET that looks something up by ID alone. The numeric ID of its project is at <pointer> in the response body. <pointer> is an RFC 6901 JSON pointer (~0/~1 escapes) in which a * segment matches every array element, such as response:/projects/*/id.

The field is left out when an operation has no extension, which means the operation is not known to respect a project limit. ApiProjectScope is exported from @sentry/api/operations next to ApiOperation. Like the x-sentry-routing check, the build throws on a non-string value, on an unknown value, on a malformed pointer, and on org-metadata or response: on a method other than GET. These are the same rules that #132722's schema build enforces.

The released catalog has no projectScope values until #132722 merges and the schema is rebuilt.

Refs getsentry/toolkit#2237

via @BYK.

--

View Session [Sentry]

Copy Sentry's x-sentry-project-scope OpenAPI extension into the operation catalog as ApiOperation.projectScope, and export ApiProjectScope from @sentry/api/operations. The build throws on any value Sentry's schema build would reject, the same way it does for x-sentry-routing.

Refs getsentry/toolkit#2237

Co-Authored-By: BYK <[email protected]>
@BYK
BYK marked this pull request as ready for review November 27, 2026 11:48
@BYK
BYK requested review from a team as code owners November 27, 2026 11:48
@BYK
BYK merged commit 302aa19 into master Nov 27, 2026
82 checks passed
@BYK
BYK deleted the feat/api-project-scope branch November 27, 2026 11:48

This branch was successfully deployed

1 active deployment
Preview — 02e2ff63 Deployed Nov 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant