- Security: Prevents GraphQL injection attacks
- Reusability: Same query can be used with different values
- Type Safety: Variables are strongly typed
- Readability: Makes queries cleaner and easier to understand
Adding Variables to Your GraphQL Request
- Create a GraphQL Request
- Add variables in the Variables section (bottom of query section)
- Write your query or mutation with variables using the
$prefix to declare variables and reference variables using the$variableNamesyntax.

$usebruno and $userId are variables defined as a string and number respectively, and its value "usebruno" and 1 are passed separately in the Variables section.