The Teamwork Graph API is available through Forge's Preview release phase.
Preview features are available to all users and receive the same level of support as generally available features. Schemas, fields, and behavior may still change before general availability (GA), and breaking changes are subject to a minimum 1-month deprecation notice, announced in the Teamwork Graph changelog.
New apps should use curated queries or
persisted Cypher queries. Raw cypherQuery
is unavailable to new apps; existing apps should follow
Migrate from raw Cypher queries.
To review the current limitations, see Limitations and considerations.
To share feedback or report an issue, visit the Atlassian developer community.
This tutorial shows you how to query data from Teamwork Graph using the GraphQL API in a Forge app. You'll learn how to use Cypher queries to traverse the graph and retrieve connected data.
In this tutorial, you'll learn how to:
To complete this tutorial, you'll need:
You should also be familiar with:
The Teamwork Graph API uses a two-layer query approach:
This pattern allows you to first find the objects you need using Cypher's powerful graph traversal, then use GraphQL to retrieve the specific fields you want from those objects.
If you haven't already, create a new Forge app following the Getting started with Forge guide. Once you have a Forge app set up, you'll need to configure it to access the Teamwork Graph API.
Add a scope to your app's manifest.yml for every object type your query reads, including
intermediate objects in a traversal. The user-to-team query in this tutorial needs both scopes below:
For example:
1 2 3 4 5permissions: scopes: - 'read:graph:user:atlassian' - 'read:graph:team:atlassian'
See Scopes for the full scope reference and migration guidance for the deprecated product-wide scopes.
The organization admin must grant the requested scopes when installing or configuring your app. Missing or disabled scopes do not produce a deployment or API error: queries succeed but omit unreadable data, which can leave the results empty. See Data exists but not returned in results.
Before building complex queries, verify your app can successfully connect to the Teamwork Graph API.
The simplest way to test connectivity is with the built-in echo query.
In your Forge app, you can either use the backend SDK package @forge/api, or frontend SDK package @forge/bridge.
1 2 3 4 5 6 7 8 9 10 11 12 13 14// Option 1) Forge app backend code import api from '@forge/api'; async function testConnection() { const response = await api.asUser().requestTeamworkGraph(` query { echo(myString: "Hello World!") } `); const data = await response.json(); console.log(data); // Should log: { data: { echo: "Hello World!" } } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14// Option 2) Forge app frontend code import { requestTeamworkGraph } from '@forge/bridge'; async function testConnection() { // Frontend API calls will always run as the current user const { data } = await requestTeamworkGraph(` query { echo(myString: "Hello World!") } `); console.log(data); // Should log: { echo: "Hello World!" } }
If this query succeeds, your app is properly configured and authenticated.
You can also test queries interactively using the Atlassian Query Builder. Access it at:
1 2https://teamwork-graph.atlassian.com/query-builder
Make sure to select the correct site in the right navigation pannel.
1 2https://abc.atlassian.net/gateway/api/graphql/twg
To find your cloud ID, you can use the Atlassian Cloud Admin API or extract it from your site's ARI.
The playground provides:
Start with the curated query catalog. If a curated query covers your use case, call its GraphQL field directly. Curated queries don't need Cypher text or a registration step; follow Curated queries for execution examples.
If no curated query fits, write a Cypher query and save it as a persisted Cypher query before calling it from your app. The rest of this tutorial follows that path. If you already have Cypher text, go straight to Save the Cypher query.
Now let's retrieve real data from the Teamwork Graph. For this example, we'll fetch all teams that a user belongs to with the relationship Atlassian user is in Atlassian team.
1 2 3MATCH (user:AtlassianUser {ari: $id})-[:atlassian_user_is_in_atlassian_team]->(team:AtlassianTeam) RETURN collect(distinct team) as teams
Let's break this down:
MATCH - Finds patterns in the graph(user:AtlassianUser {ari: $id}) - Finds a user object with a specific ARI (passed as a parameter)-[:atlassian_user_is_in_atlassian_team]-> - Traverses the "Atlassian user is in Atlassian team" relationship(team:AtlassianTeam) - Finds connected team objectsRETURN collect(distinct team) as teams - Returns all unique teams as a listTo learn more about the atlassian_user_is_in_atlassian_team relationship, see the relationship documentation for Atlassian user is in Atlassian team.
An Atlassian Resource Identifier (ARI) is a globally unique identifier for objects in Teamwork Graph. In this query, we use the user's ARI to find their specific user object.
ARIs for users follow this pattern:
1 2ari:cloud:identity::user/{userId}
For example:
1 2ari:cloud:identity::user/712020:5fb4febcfacfd60076a1c699
For more information about ARIs, see this page: Understanding ARIs
Once you have your Cypher query, register it against the Forge app that will execute it:
id parameter containing the user's ARI.queryKey in your app's configuration. Allow about a minute for the saved
query to propagate before executing it.You can also register the query using the REST endpoint. See Persisted Cypher queries for the submission request and response. Save the query during setup, rather than on every user request.
Call the GraphQL customQuery field with the saved queryKey and parameter values. Your app sends
these values at runtime instead of sending Cypher text. Raw cypherQuery is unavailable to new apps.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27query companyName_userTeams($queryKey: String!, $queryParams: CypherRequestParams) { customQuery(queryKey: $queryKey, queryParams: $queryParams, first: 25) { edges { node { columns { key value { __typename ... on CypherQueryResultListNode { nodes { id data { __typename ... on AtlassianTeam { id displayName } } } } } } } } } }
The GraphQL query selects the team fields to return from the saved Cypher query results.
Key points about the query structure:
CypherQueryResultListNode - Used because the Cypher query returns a list (via collect())CypherQueryResultNode - Would be used if the Cypher query returned a single objectdata { ... on AtlassianTeam } - Populates team objects with specific fields like id and displayNameYou can explore all available fields for teams in the AtlassianTeam object type documentation.
You can also explore other CypherQueryResult types in the GraphQL and Cypher documentation
Pass the saved query key and its parameters as GraphQL variables. Replace YOUR_SAVED_QUERY_KEY
with the key returned in Step 3:
1 2 3 4 5 6 7{ "queryKey": "YOUR_SAVED_QUERY_KEY", "queryParams": { "id": "ari:cloud:identity::user/712020:5fb4febcfacfd60076a1c699" } }
Now let's implement this query in a Forge app.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15// Option 1) Forge app backend code // Makes an API call to TWG export async function executeCypherGraphQL(graphqlQuery, variables, headers) { console.log('executing cypher graphql', graphqlQuery, variables, headers); return api.asUser() .requestTeamworkGraph(graphqlQuery, variables, null, null, headers) .then(async r => { console.log(`response status: ${r.status}`); const json = await r.json(); console.log(`response json: ${JSON.stringify(json)}`); return json; }); }
1 2 3 4 5 6 7 8 9 10 11 12 13// Option 2) Forge app frontend code // Makes an API call to TWG export async function executeCypherGraphQL(graphqlQuery, variables) { console.log('executing cypher graphql', graphqlQuery, variables); const { data, errors } = await requestTeamworkGraph(graphqlQuery, variables); console.log(`response data: ${JSON.stringify(data)}`); if (errors?.length) { console.error('teamwork graph errors', errors); } return { data, errors }; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41// The GraphQL Query export const USER_TEAMS_GRAPHQL = ` query companyName_userTeams($queryKey: String!, $queryParams: CypherRequestParams) { customQuery(queryKey: $queryKey, queryParams: $queryParams, first: 25) { edges { node { columns { key value { __typename ... on CypherQueryResultListNode { nodes { id data { __typename ... on AtlassianTeam { id displayName } } } } } } } } } } `; // Preparing the Variables export function getTeamsByUserRequestParams(userAri, queryKey) { return { queryKey, queryParams: { id: userAri } }; }
Pass the queryKey stored in Step 3 along with the user's ARI.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45// Actual call given a user & context to fetch all the teams export async function fetchTeamsForAUser(userAri, queryKey) { if (!userAri || typeof userAri !== 'string') { throw new Error('fetchTeamsForAUser: userAri is required'); } const variables = getTeamsByUserRequestParams(userAri, queryKey); const json = await executeCypherGraphQL(USER_TEAMS_GRAPHQL, variables); return extractCollections(json, ['teams']); } // Helper method to Extract Teams from the Json Output export function extractCollections(json, keys) { const result = keys.reduce((acc, k) => { acc[k] = []; return acc; }, {}); try { const edges = json?.data?.customQuery?.edges || []; for (const edge of edges) { const columns = edge?.node?.columns || []; for (const col of columns) { const key = col?.key; const value = col?.value; if (!key || !value || !(key in result)) continue; const pushItem = (data) => { if (!data) return; const item = {}; if (data.id) item.id = data.id; if (data.displayName) item.displayName = data.displayName; if (Object.keys(item).length) result[key].push(item); }; if (Array.isArray(value.nodes)) { for (const n of value.nodes) pushItem(n?.data); } else if (value.data) { pushItem(value.data); } } } } catch (e) { } return result; }
You can place all of these functions in a single file (for example, teamwork-graph-client.js) and
import them wherever you need to query Teamwork Graph data in your app.
Use Forge tunnel to see real-time console logs from your app:
1 2forge tunnel
This lets you see the console.log and console.error output from your API calls in real time.
If you know data exists but your query returns empty or partial results, check scopes first. A missing or disabled scope does not produce an error. Objects your app cannot read are omitted from results; a missing scope for an intermediate object can break the traversal and leave the whole result empty.
read:graph:user:atlassian and read:graph:team:atlassian; reading Jira work items needs
read:graph:issue:jira, and reading Confluence pages needs read:graph:page:confluence.
See Scopes for the full reference and
migration guidance.Then check the data and the user's access:
If the issue persists, it may be a data sync problem. Contact Atlassian support for assistance.
Common causes:
Debug steps:
Now that you understand the basics of querying Teamwork Graph, you can explore more complex use cases and patterns.
The example apps below demonstrate real-world implementations that use advanced Cypher queries, multiple relationships, and integration with Forge UI components:

Forge Teamwork Graph Dashboards Widget
Atlassian Home Dashboards widget that track work contributions and project/goal rollups across multiple tools using Teamwork Graph.

Teamwork Graph-powered Onboarding Assistant
A Rovo agent that queries Teamwork Graph to gather team resources and onboard new starters.

Call Teamwork Graph from a Forge Remote
A Jira work item panel and a Node.js backend you host that query the current user's assigned work. Demonstrates Forge invocation token validation and app user OAuth tokens. Confirm endpoint access and scope approval before use; see the example README.
Rate this page: