Execute GraphQL request
This Flow Companion action allows you to execute GraphQL queries and mutations against the Shopify Admin API (version 2026-01) directly from your workflows.
Explore available queries and mutations in the GraphQL Admin API reference.
Configuration
When configuring this action in your workflow, you'll work with two main components:
Action Configuration
- Click the Configure button to open the GraphQL editor
- Write your GraphQL query or mutation with full autocomplete support
- The editor suggests available fields as you type
- Syntax validation helps catch errors before saving
Action Fields
- Variables: Enter JSON variables for your GraphQL query in this field. You can use workflow data and variables from previous steps.
JSON format example:
{
"orderId": "{{ order.id }}",
"tags": ["urgent", "vip-customer"],
"updateNote": "Updated by Flow Companion"
}API permissions management
If your GraphQL request requires API permissions that haven't been granted to the Flow Companion app, you'll receive an Access denied error.
To manage permissions:
- Click the grant additional permissions link above the GraphQL editor
- A modal will open showing all available Shopify API scopes
- Already granted permissions are marked with a
Grantedbadge - Select the permissions you need by checking the boxes
- Click Request selected scopes to initiate the permission request
- Follow Shopify's prompts to approve the permissions
Once permissions are granted, you can execute your GraphQL request successfully.
Mutation requirements
Mutations can optionally include the userErrors { field message } selection. Adding these fields lets the action
detect GraphQL errors and fail the workflow when userErrors is not empty. If you omit them, the action cannot read the
errors from the response and the workflow will continue even if the mutation returned issues.
Example:
mutation returnClose($id: ID!) {
returnClose(id: $id) {
return {
# Return fields
}
userErrors {
field
message
}
}
}Data transformation
You can enable Transform response data with JavaScript to reshape the response before it is returned to the workflow. This is useful when the raw response is too large for Shopify Flow's 50 KB payload limit (you may see a "Response too large" error). Trim it down to the fields you actually need so the response fits within the limit.
When enabled, you can write a JavaScript function like this:
export default function ({ data, variables }) {
// transformation code
return {
/* your transformed data */
};
}The function may return either a string or any JSON-serialisable value. The input parameter is an object with the following properties:
- data: The
datafield of the GraphQL response. - variables: The variables that were sent with the GraphQL request.
For mutations, the userErrors check (see above) runs before the transform — if the mutation reports errors, the
workflow fails and the transform is not invoked.
Output
The action returns the response payload as a JSON string in the data property. When the transform is enabled, this is
the value returned by the transform function; otherwise it is the raw data field of the GraphQL response. You can
parse this string using the Run code action. The parsed values can then be referenced in subsequent workflow steps
using standard variable syntax.