RailwayDocs

Fetching Workspaces or Projects

When users authorize your application with workspace or project scopes, they select exactly which resources to share. Your application can then query these resources through the Public GraphQL API.

Fetching workspaces

Workspace queries return the workspaces a user granted access to when authorizing your application. This requires that the user approved a workspace scope (workspace:viewer, workspace:member, or workspace:admin) and that your authorization request included the email and profile scopes alongside it.

Query:

This query returns the ID and name of each workspace. You can extend it to request additional fields depending on what your application needs. Consult the GraphQL schema for available fields.

Example Request:

Response:

The response includes only the workspaces the user selected during consent.

Fetching projects

Project queries work similarly but use the externalWorkspaces field, which returns workspaces along with the specific projects the user granted access to. This requires a project scope (project:viewer or project:member) in the original authorization request.

Unlike workspace scopes, project scopes let users share individual projects without granting access to the entire workspace.

Query:

Example Request:

Response: