Skip to main content

Generate an Edge API key

Abstract

Describes how to generate an Edge API key.

You can generate an Edge API key to use the GraphQL Playground for your XM Cloud environment for testing queries. You use the generated API key as an environment variable when deploying your client application to Vercel or when connecting your front-end application to Experience Edge on a machine not using Windows.

You can generate an Edge API key using one of the following methods.

If you have access to the Deploy App, you can generate an Edge API key by generating an access token for the CM instance, then calling the XM Cloud Deploy API.

To generate an Edge API key using the XM Cloud Deploy REST API:

  1. Generate an organization automation client or an automation client for your environment.

  2. Use the client ID and client secret to request a JWT. The access_token value is your access token.

  3. In the XM Cloud Deploy App, on the environment details page of the environment where you want to create an Edge API key, get the ID.

  4. Run the following curl command:

    curl --location "https://xmclouddeploy-api.sitecorecloud.io/api/environments/v1/<your_environment_id>/obtain-edge-token" --header "Accept: text/plain" --header "Authorization: Bearer <your_access_token>"

    The apiKey is your Edge API key.

If you have created a site from the XM Cloud Dashboard, You can generate an Edge API key from the site settings.

To generate an Edge API key using a site created in the XM Cloud Dashboard:

  1. In the Sitecore Cloud Portal or the XM Cloud Deploy App, open the XM Cloud Dashboard of the environment where you want to create an Edge API key.

  2. On the Dashboard, click Sites.

  3. Click the Actions menu actions-menu-horizontal-icon.png of any site, then click Settings.

  4. On the Settings page, on the Developer Settings tab, click Generate API Key.

If you have access to the Deploy App, you can also generate an Edge API key by generating an access token for Experience Edge, then calling the Token API.

To generate an Edge API key using the Token API:

  1. Generate an Edge administration client for an XM Cloud environment.

  2. Use the client ID and client secret to request a JWT for Experience Edge. The access_token value is your access token.

  3. Using the access token for authorization, use the Create endpoint of the Token API to generate an Edge API key.