GraphQL FAQs

No Result Found

To try out Contentstack's GraphQL Content Delivery API, access the GraphiQL explorer through the following endpoint:

You can apply your own stack details to test the GraphQL API requests over your stack. 

Each entry or asset associated with a content type has its own set of system-defined fields. These fields provide additional information about the entity.

Let’s understand the different system fields generated by Contentstack’s GraphQL Content Delivery API for each entry or asset:

System FieldsDescription
uid (String)Represents the unique ID of an entry or asset
version (Integer)Determines the version number assigned to an entry or asset
content_type_uid (String)Determines the unique ID of the content type to which the entry or asset belongs
locale (String)Determines the language in which the entry has been localized
publish_detailsDetermines the following publishing details for an entry or asset:
  • environment (String): Represents the publishing environment
  • locale (String): Represents the publishing locale
  • time (DateTime): Represents the publishing date and time
  • user (String): Represents the publisher
created_at (DateTime)Determines the date and time at which the entry or asset was created
updated_at (DateTime)Determines the date and time at which the entry or asset was last modified
created_by (String)Represents the user who created the entry or added the asset
updated_by (String)Represents the user who last modified the entry or asset
tags (String)Determines the specific tags assigned to an entry or asset

To avoid the hassles of passing specific entry UIDs while fetching an entry from a singleton content type, you can prefix the content type UID with all_, e.g., all_header. You can query singleton content types in the same way as you query content types with multiple entries.

Consider the following query that attempts to fetch an entry of the Header singleton content type, which stores website header content:

query {
  all_header { # Where the header content type is of type singleton.
   items {

Note: All the filters and ordering functions will be available to the user. They would work the same as how you query a content type with multiple entries.

When an API request hits the Contentstack server, internally the {content_type_uid}Where filter is assigned a JSON scalar value. Since the where filter accepts JSON scalar input types, you can create filters on keys that may not exist on the current content type's schema. Contentstack processes your API requests without any errors.

In Contentstack's GraphQL documents, you assign names to several entities, such as operations, content types, fields, variables, and fragments. All the GraphQL names you define must follow the same grammatical form of /[_A-Za-z][_0-9A-Za-z]*/.

Additional Resource: You can refer to the GraphQL documentation to learn more about the naming specifications.

The aforementioned naming convention means if you have a content type name that starts with a number, it will end up throwing the following error:

  "errors": [
      "message": "Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but \"{content_type_name}\" does not."

Tip: To prevent typename collisions, you can avoid using special characters while naming content types or fields.

Contentstack returns the MAX_DOCUMENT_LIMIT_EXCEEDED error message when a GraphQL API request attempts to fetch more than 7,500 documents (assets, entries, their referenced assets and entries, etc.).

To resolve this error, you can reduce the total number of referenced items being queried or pass the skip or limit parameters while querying referenced items. Learn more about fetching referenced entries or assets.

Contentstack counts each GraphQL query as one irrespective of the number of content types queried in it. Similarly, the rate limit remains the same whether you query one or more than one content types in a single API request.

Was this article helpful?

Thanks for your feedbackSmile-icon