# Pass a variable in graphql query

**URL:** <https://community.weweb.io/t/pass-a-variable-in-graphql-query/7358>\
**Category:** How do I?\
**Created:** [March 1, 2024, 6:13am UTC](https://community.weweb.io/t/pass-a-variable-in-graphql-query/7358 "2024-03-01T06:13:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Himanshu](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/himanshu/32/16305_2.png) [@Himanshu](https://community.weweb.io/u/Himanshu)\
**Post date:** [March 1, 2024, 6:13am UTC](https://community.weweb.io/t/pass-a-variable-in-graphql-query/7358/1 "2024-03-01T06:13:30Z")

</div>

How do I pass a variable in a GraphQL query?

This is the static query

 ![Screenshot 2024-02-29 at 8.28.54 PM](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/7/76b6ea9e5602eeb44d7de9fed47bc1bc0841ed76.png)

And this is how I’m trying to pass the variable

 ![Screenshot 2024-02-29 at 8.28.19 PM](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/d/d0e3520d039ca56a1a6d3f58a3fec033904618fb.jpeg)

I also tried to pass it like this

 ![Screenshot 2024-03-01 at 11.42.42 AM](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/9/9037b2aa3ae18fd95bb71087c0cd52849da6b713.png)

What’s the correct way?

---

<div class="post-metadata">

**Author:** ![Alexis](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/alexis/32/13248_2.png) [@Alexis](https://community.weweb.io/u/Alexis)\
**Post date:** [March 1, 2024, 10:37am UTC](https://community.weweb.io/t/pass-a-variable-in-graphql-query/7358/2 "2024-03-01T10:37:09Z")

</div>

I think it’s just you’re trying to perform a mutation inside a collection, but a collection is made to request data with a query, not a mutation  
Probably under the hood we perform a GET request, but a mutation require a POST request. If you need to perform a mutation, please use a global workflow and add the GraphQL request action, it should works
