Test your queries


Learn how to use the Delivery API IDE and the GraphQL testing UI for testing your queries.

The GraphQL IDEs help you test GraphQL queries before you use them in your application. There is a GraphQL IDE built on top of the Preview API (the Preview API IDE) and the Delivery API (the Delivery API IDE) with additional features such as automatic schema reloading. Before you can use the Delivery IDE and the Preview IDE, you must create an API key.

The Delivery API IDE uses the Delivery API. The Delivery API is a GraphQL API that is hosted on the Delivery Platform and provides access only to approved and published content. You must authenticate with an API key for all requests to the Delivery API.


Use OAuth to obtain a JWT before you create an API key.

To create an API key:

  • Call the create endpoint to create the API key. Make sure to provide the scope and add:

    • “content-#everything#”

    • “audience-delivery”


    Make sure to save this token in a secure place. Sitecore does not store this token, and the token cannot be retrieved from the system after creation.

    curl --request POST --url "https://edge.sitecorecloud.io/api/apikey/v1" --header "content-type: application/json" --header "Authorization: Bearer <JWT token>" --data "{ \"CreatedBy\":\"ADN\", \"Label\":\"Website token\", \"Scopes\": [\"content-#everything#\", \"audience-delivery\"] }"

    The response is the token for the API key which must be passed in the sc_apikey header.

When you have access to the GraphQL endpoint, you can run queries and see, for example, what kind of objects you can access, what type of attributes they have, and so on. The URL of the IDE of the Delivery API is https://edge.sitecorecloud.io/api/graphql/ide.

Figure 2. The Delivery API IDE
The Delivery API IDE

Test your queries for approved and published content on the Delivery API IDE.

The Preview API IDE provides the same functionality as the Delivery IDE, but it executes against the Preview API on your self-hosted Sitecore XM instance. You can use the Preview endpoint testing UI to test your queries. The Preview endpoint (/sitecore/api/graph/edge) on your self-hosted Sitecore XM instance is enabled by default. However, you must create an API key and pass it with your GraphQL request.

To create an API key:

  1. Create a Sitecore Services Client API key.


    You may already have an API key. For example, if you are using a Getting Started template such as the Next.js dotnet new Template. If you prefer to create an API key that can only be used with the Experience Edge preview schema, in the Allowed Controllers field, specify the following: Sitecore.Services.GraphQL.Hosting.Mvc.GraphQLController;GraphQL:/sitecore/api/graph/edge

  2. Once you have generated your token, you must pass your API token in the headers for your request. Click HTTP headers and add the token in the following format: {"sc_api": "YOUR_TOKEN" } Now you will be able to query your data and see results returned.


    Sitecore Services Client and Sitecore GraphQL also accept API keys via query string. However, we recommend to use the sc_apikey HTTP header as this is mirrors the behavior of Experience Edge.

To test your queries:

  1. Go to: https://<your host>/sitecore/api/graph/edge/ui

  2. In the HTTP Headers section of the UI, specify the sc_apikey header.

    2    "sc_apikey": "your-api-key-guid"


    Sitecore Services Client and Sitecore GraphQL also accept API keys through a query string. We recommend you use the sc_apikey HTTP header because this mirrors the behavior of Experience Edge.