---
title: "The Experience Edge schema"
slug: "the-experience-edge-schema"
abstract: "Describes entry points, endpoints, and template definitions."
---
# The Experience Edge schema

Sitecore Experience Edge has a read-only GraphQL schema designed to accommodate common front-end use cases for headless Sitecore development. It exposes limited information about Sitecore items. For example, there are no Standard Fields available.

## Sitecore concepts

- *Items* - in Sitecore, everything is an item: a page, a component data source, a media file, and so on. Items live in a content tree and are identified by a globally unique identifier (GUID) or a path.
- *Templates* - every item has a data template that defines the item properties and fields. In GraphQL, you can cast an item to its template type using an inline fragment to access template-specific fields.
- *Layout* - a layout defines which components appear on a page and where. The `rendered` field on a layout query returns this full structure as JSON, ready for a front-end app to render the layout.
- *Sites* - a Sitecore instance can host multiple sites. Most queries need the `site` argument.

## Query entry points

The GraphQL APIs have four top-level queries:

1. `item` - query a content item by GUID or path. Use this for content that isn't tied to a page route, such as navigation data or settings.
2. `layout` - commonly used for page rendering. When given a site, route path, and language, it returns the full layout data for a SitecoreAI page. The `rendered` field is for retrieving all the page layout data, including components, their field values, and the nested placeholder structure that your front-end app renders.
3. `search` - query items by indexed properties using `where` conditions with operators such as `CONTAINS` or `EQ`. Use this for listings, filtered results, or any time you need multiple items at once.
4. `site` - queries about the site itself rather than its content. For example, route lists (useful for static generation), redirect rules, error pages, sitemap, dictionary entries, and robots configuration.

These entry points are also listed on the [GraphQL IDE](https://doc.sitecore.com/sai/en/developers/sitecoreai/experience-edge/experience-edge-apis/set-up-the-graphql-ides.html "Set up the GraphQL IDEs") **DOCS** tab, where you can navigate and explore the GraphQL reference documentation.

## Template projection

The types available in the Experience Edge schema reflect the template definitions of the Sitecore instance that published to it. You can enable strongly-typed template fields by using inline fragments that select fields from specific types.

In the Sitecore back end, you can give the same name to templates and fields. However, in GraphQL, the names of types and fields must be unique. When a naming collision occurs, the item or field item with the newest creation date has `_{guid}` appended to the name. The creation date is used because the ordering must be stable, and a graph type name must never change after it has been referenced.

GraphQL types are generated for templates under the following paths:

- `<foundation>/sitecore/templates/Foundation</foundation>`
- `<feature>/sitecore/templates/Feature</feature>`
- `<project>/sitecore/templates/Project</project>`
- `<userdefined>/sitecore/templates/User Defined</userdefined>`

## Pagination

Use pagination to retrieve large result sets in small, predictable chunks.

Paginated queries and fields in the Experience Edge schema, such as the search query, use a cursor-based system to request result pages.

Note the following about paginated queries:

- Query arguments include `first` (number of results to return per request) and `after` (the beginning cursor). `first` has a default value of `10` and a maximum value of `1000`.
- Query results include `pageInfo` with `hasNext` (whether there are more results) and `endCursor` (used in the after argument to obtain the next page).
- Query results also include `total` (provides the total number of available results).

    To retrieve more than 1000 total results, make multiple requests. Use the `endCursor` value from `pageInfo` in each response as the `after` argument in the next request, and repeat until `hasNext` is `false`. There is no limit on the total number of results you can retrieve across multiple paginated requests.

    > [!note]
    > The first argument has a special meaning to query the complexity calculation used by the underlying GraphQL library of the `Preview` schema. In particular, using the nested `children` field on the Item graph type can cause errors, such as *Query is too complex to execute*. The following section includes recommendations for handling query complexity.

## Query complexity

Experience Edge enforces query complexity limits to protect performance and availability.

Query complexity refers to a numerical score assigned to a GraphQL query based on how resource-intensive it is to execute. This score helps prevent overly complex queries from degrading performance or risking denial-of-service. Experience Edge queries have a complexity limit. There is currently no way to retrieve the calculated complexity score of a query. You will only know that a query has exceeded the limit when Experience Edge rejects it. If your query is too complex, try the following:

- Break the query into multiple smaller queries. For example, use one query to retrieve a dataset, and apply subsequent queries to that dataset. Large queries of multiple objects increase query complexity substantially.
- Remove unnecessary fields from the query.

> [!note]
> The cost of Experience Edge (delivery) queries can't be configured.

Because of an inherent difference in data structure, complexity is calculated differently between the Preview endpoint and Delivery endpoint. We have introduced default settings so that complexity calculations will match as closely as possible; however, it's impossible to match them completely.

Raising the complexity limit on the Preview endpoint is not a reliable way to estimate whether a query will succeed on the Delivery endpoint. The two endpoints calculate complexity differently, and a query that passes on Preview may still be rejected on the Delivery endpoint.

Some configuration options for the preview endpoint are available in the `sitecore.config` file, in the `complexityConfiguration` object:

```xml
<!--
  COMPLEXITY CONFIGURATION
  It is possible to conduct denial of service attacks by constructing extremely expensive to run GraphQL queries.
  The complexity configuration defeats that by limiting how complex of a query will be run.

  maxDepth: the maximum nesting depth in a query. maxDepth values lower than 15 will prevent /ui from running.
  fieldImpact: the average impact of adding a list field to a query (e.g. how many average items it would return).
  maxComplexity: the maximum field impact a query can have before it's rejected. With a fieldImpact at 2, values of maxComplexity less than 250 will prevent /ui from running.
-->
<complexityConfiguration type="GraphQL.Validation.Complexity.ComplexityConfiguration, GraphQL" patch:source="Mvp.Environment.GraphQL.config">
  <maxDepth>15</maxDepth>
  <maxComplexity>10000</maxComplexity>
  <fieldImpact>2</fieldImpact>
</complexityConfiguration>
```

In non-production environments, you can raise the complexity limitation of the Preview endpoint to reduce rejections while developing queries. However, because complexity is calculated differently on the Delivery endpoint, a query that succeeds on the Preview endpoint may still be rejected on the Delivery endpoint. Iteratively simplifying the query, as described above, is the recommended approach.

## Available fields for content search

In Experience Edge, you can use the GraphQL `search` query on the special fields listed in the following table. When querying templates, you can only query user-defined fields and the following special fields. For example, you can query the user-defined `title` field of the sample item template, but not `_Sortorder`.

| Field            | Description                                                                                                                                                                                                                                |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `_templates`     | Contains all template GUIDs, including base templates. Can be used to find all the items that use the template in the hierarchy.                                                                                                           |
| `_path`          | Contains parent items, and can be used to retrieve descendants of an item by its GUID. For example, if you use a `contains` clause and the ID of the `/home` path, the results include `/home` and its children, such as `/home/about_us`. |
| `_parent`        | The ID of the item’s immediate parent.                                                                                                                                                                                                     |
| `_name`          | The item name.                                                                                                                                                                                                                             |
| `_language`      | The item language.                                                                                                                                                                                                                         |
| `_hasLayout`     | Shows whether the item has presentation details/layout data.                                                                                                                                                                               |
| `_latestversion` | Boolean that determines whether only the latest version of the item is shown.                                                                                                                                                              |

> [!note]
> The `_latestversion` field is processed differently in the Preview and Delivery schemas. If you set `_latestversion` to `true` in a query to the Delivery API, it returns the latest publishable version of the item. The value of `_latestversion` can only be set to `true` in calls to the Delivery API. If it is set to `false`, it returns an error. If you set `_latestversion` to `true` in a query to the Preview API, it returns the latest available version. If it is set to `false`, it returns all versions of the item.

### Search operator behavior

Search operator behavior differs depending on whether you are querying the Preview endpoint (which uses a [tokenized search index](https://doc.sitecore.com/sai/en/developers/sitecoreai/experience-edge/experience-edge-apis/preview-graphql-api.html "Preview GraphQL API")), or the Delivery endpoint.

> [!note]
> The GraphQL search field is designed for filtering content, not for implementing full-text or site search functionality. For more advanced search capabilities, consider using a dedicated search service.

The `search` query supports the following operators:

- `CONTAINS` - performs a substring match within a field. Use this operator for partial text matches and filtering content based on words or phrases within a field.
    - *Preview* - the `CONTAINS` operator can return multiple results based on tokenized field values. This is because the Preview endpoint uses a tokenized search index.
    - *Delivery* - the value is matched as-is without tokenization or ranking.

        For example, searching for *ipsum* with the `CONTAINS` operator matches any field where the value appears anywhere within the text, such as *lorem ipsum dolor sit amet*.

- `NCONTAINS` (Does not contain) - matches items where the field value does not contain the specified substring. This is the inverse of `CONTAINS`.
- `EQ` (Equals) - matches only user-defined fields whose value is an exact match. Use this operator when you need precise, whole-field matching, but be aware of tokenization behavior on the Preview endpoint.
    - *Preview* - works as the `CONTAINS` operator for text fields because all text fields in the Solr search index are tokenized by default. This means it may return multiple results, even when an exact match is expected.

        For example, searching for *ipsum* with the `EQ` operator might return results for fields containing *lorem ipsum dolor sit amet*.

        To ensure exact matching with `EQ` on the Preview endpoint, use the SearchQueryFieldMapping feature to map tokenized fields to non-tokenized computed fields. See also the related support article [KB1003665](https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB1003665).

    - *Delivery* - this operator matches only user defined fields whose value is an exact match. The entire field must match the search value exactly, and partial matches are not returned.

        For example, searching for *ipsum* with the `EQ` operator will not match a field containing *lorem ipsum dolor sit amet*, but it will match a field whose value is exactly *ipsum*.

- `NEQ` (Not equal) - matches items where the field value does not match the specified value. This is the inverse of `EQ`.

See also the [search and filtering query examples](https://doc.sitecore.com/sai/en/developers/sitecoreai/experience-edge/experience-edge-apis/query-examples-for-the-delivery-graphql-api.html "Query examples for the Delivery GraphQL API").

The following operators compare numeric or date field values and can be used to query a range:

- `GT` (Greater than) - matches items where the field value is greater than the specified value.
- `GTE` (Greater than or equals) - matches items where the field value is greater than or equal to the specified value.
- `LT` (Less than) - matches items where the field value is less than the specified value.
- `LTE` (Less than or equals) - matches items where the field value is less than or equal to the specified value.

See also the [range operator query examples](https://doc.sitecore.com/sai/en/developers/sitecoreai/experience-edge/experience-edge-apis/query-examples-for-the-delivery-graphql-api.html "Query examples for the Delivery GraphQL API").

## Working with media

You can resize and transform an image directly in Experience Edge. The following options are supported for image manipulation:

| Query parameter | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `w`             | The image width.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `h`             | The image height.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `mw`            | The maximum width of the image.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `mh`            | The maximum height of the image.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `f`             | The image file format. The following values are supported:<ul><li>`avif` - generates images in an `avif` format, if possible, and if not, falls back to `webp`.</li><li>`webp` - generates images in a Google webp format.</li><li>`jpeg` - generates images in interlaced progressive JPEG format, in which data is compressed in multiple passes of progressively higher detail.</li><li>`baseline-jpeg` - generates images in a baseline sequential JPEG format. Use in cases when target devices don't support progressive JPEG or other modern file formats.</li><li>`json` - instead of generating an image, outputs information about the image in JSON format. The JSON object contains data such as image size (before and after resizing), the source image MIME type, and file size.</ul> |