---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Test GraphQL APIs with GraphQL Explorer

# Test GraphQL APIs with GraphQL Explorer {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

Test query your GraphQL APIs using an integrated GraphQL testing tool.

## Before you begin

Create a schema for your GraphQL API. For more information, see [Create a GraphQL schema](https://servicenow-prod.fluidtopics.net/vVM3t_ip4ibLxOWMnsjmqQ#build-graphql-scripted-schema "Create a GraphQL schema to make data available to GraphQL queries.").

Enabling introspective queries allows GraphQL Explorer to show the schemas on the instance in the Documentation Explorer and as auto-complete suggestions, which makes finding queries and mutations easier. For more information, see [Enable introspective queries for GraphQL schemas](https://servicenow-prod.fluidtopics.net/LoFxFHhB5nhLxHuy2AinJw "Discover the queries and mutations supported by schemas on your instance by enabling introspection.").  
Note:  
Don't use introspective queries in a production environment.

Role required: graphql_schema_admin or admin

## About this task

The GraphQL Explorer integrates the GraphiQL IDE into the ServiceNow AI Platform. For additional information about the interface, see the [GraphiQL readme](https://github.com/graphql/graphiql/blob/main/packages/graphiql/README.md) in the GraphiQL GitHub repository.

## Procedure

1. Navigate to AllSystem Web ServicesGraphQLGraphQL Explorer.
2. **Optional:** If you enabled introspection, in the left sidebar, select the Show Documentation Explorer icon (![Show Documentation Explorer icon]()) to view and search for available queries or mutations.
3. In the editor, enter a query to the schema.  
   Include both the application and schema namespaces in the query. For information about directives you can apply, see [Directives and global functions](https://servicenow-prod.fluidtopics.net/2Q1cirFC~oyqNuLWkaEpyQ#scripted-graph-ql__section_zdw_rnc_glb).  
   This example shows using both the application and schema namespaces:
   * Application namespace: `x_graph_scope`
   * Schema namespace: `planet`

   {#test-gql-schema__ul_ihg_pzh_dlb}

       query {
         x_graph_scope {
           planet {
             findAll {
               name
               mass
               distance
             }
           }
         }
       }

   This example shows using the @defer directive to stream results for the openedBy field after the initial incident response.

       query findIncidents {
         now {
           incident {
             findAll {
               description {
                 displayValue
               }
               ...
               @defer(label: "my-label", if: true) {
                 openedBy {
                   firstName
                   lastName
                 }
               }
             }
           }
         }
       }

4. **Optional:** At the bottom of the editor, select Variables and enter any necessary variables.
5. Select the Execute query icon (![Execute query icon]()).  
   Tip:  
   You can also use a keyboard shortcut. To see the list of available keyboard shortcuts, select the Open short keys dialog icon (![Open short keys dialog icon]()).  
   The result of your query returns in the right pane.
6. **Optional:** Select the Add tab icon (![Add tab icon]()) to run additional queries.

## What to do next

If you need to view a list of previous queries, in left sidebar, select the Show History icon (![Show History icon]()).

To access record data in a component, you can create a custom component and query your scripted GraphQL schema from the component. For more information, see [Query a GraphQL schema from a component](https://servicenow-prod.fluidtopics.net/WL1D25TUCaMTN7ZfYR6pjA "Access record data in a component by querying your scripted GraphQL schema.").

*[\>]: and then


