- 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:
- Open Bruno and create a new GraphQL request
- Select the appropriate HTTP method (usually POST)
-
Define Variables:
- Go to the
Variablessection - Add your variables in JSON format
- Each variable should match the type defined in your query
- Go to the

- Write Your Query with Variables:
- Use the
$prefix to declare variables - Reference variables in your query using the
$variableNamesyntax
- Use the

- Execute the Request:
- Bruno will automatically combine your query and variables
- The variables will be properly escaped and sent with the request