<p>You can query for elements (entries, users, etc.) using Craft's GraphQL API, but not for collections of elements (sections, user groups, etc.).</p>
<p>My suggestion would be to either hard-code these, as I assume they won't change very often, or create a custom API endpoint using a custom module/plugin. See this article for a starting point:
<a href="https://putyourlightson.com/articles/building-a-restful-api-in-craft-cms" rel="nofollow noreferrer">https://putyourlightson.com/articles/building-a-restful-api-in-craft-cms</a></p>

CC BY-SA 4.0
2022-07-27T17:46:30.643Z
2022-07-27T17:46:30.643Z
Ben Croker
<p>The goal is to get a list of entry types for a section, so that a user can filter entires by entry type e.g.</p>
<pre><code>query Entries {
  entries(section: &quot;content&quot;, type: [&quot;news&quot;, &quot;article&quot;, &quot;video&quot;]) {
    id
    title
    .............
  }
}

</code></pre>
<p>I know this can be done template side using <a href="https://docs.craftcms.com/api/v3/craft-models-section.html#public-methods" rel="nofollow noreferrer">getEntryTypes()</a> as per this question - <a href="https://craftcms.stackexchange.com/questions/14759/how-to-list-out-entry-types-in-a-section">How to list out entry types in a section</a></p>
<p>However I'm not sure how to do this with GraphQL, is it possible?</p>

<sections><entry-type><graphql><craft4>
How to get a list of entry types for a section using GraphQL?
# How to get a list of entry types for a section using GraphQL?

(Asked by: username_0 on 2022-07-25)

The goal is to get a list of entry types for a section, so that a user can filter entires by entry type e.g.
query Entries {
  entries(section: "content", type: ["news", "article", "video"]) {
    id
    title
    .............
  }
}


I know this can be done template side using getEntryTypes() as per this question - How to list out entry types in a section
However I'm not sure how to do this with GraphQL, is it possible?

**Tags:** sections, entry-type, graphql, craft4

---

## 1 answers

### Answer by username_1 on 2022-07-27. Score: 1

You can query for elements (entries, users, etc.) using Craft's GraphQL API, but not for collections of elements (sections, user groups, etc.).

My suggestion would be to either hard-code these, as I assume they won't change very often, or create a custom API endpoint using a custom module/plugin. See this article for a starting point:
<https://putyourlightson.com/articles/building-a-restful-api-in-craft-cms>


---

