How to filter for a Craft CMS site in a GraphQL Query

Oscar de la Hera Gomez
Two flowers that represents Craft CMS and GraphQL side by side with the text "GraphQL Site Filter" beneath it.

A step by step guide on filtering a GraphQL query for a specific Craft CMS site.

The following tutorial walks you through how to filter a GraphQL query for a specific site in a multisite Craft CMS. It assumes that you have setup Craft CMS to work with the GraphQL, and have multiple sites setup.

If you wish to learn how to do the above, please consult the tutorials below.

Step One: Access the GraphiQL

A screenshot of the Craft CMS GraphiQL.

On your browser, access the Craft CMS GraphiQL by replacing YOUR_CRAFT_URL with the URL of your Craft CMS in the url below.

YOUR_CRAFT_URL/admin/graphiql

Step Two: Write the Query

A Craft CMS GraphQL Query including the "site" parameter along with a "*" that filters for all sites.

Please note that we used * in the screenshot above, which filters for all websites.

In the GraphiQL, write the query and add site parameter with the handle of the website that you wish to filter for in that query. For example if your site handle is sample as is in our tutorial on splitting your Craft CMS, then the parameter would be site: ["sample"].

If you press play, you will see that the GraphQL query will be filtered for that site.

Any Questions ?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
delasign logo

Book a Free Consultation.

An icon of an email.

Click here to email us.

Fill in the details below to book a free consultation or to let us know about something else. Whatever it is, we are here to help.

How can we help you ?

Contact Details