---
title: Execute GraphQl
description: Execute GraphQL queries or mutations to retrieve or modify structured data in external systems.
category: API Integration
tags: [graphql, api, query, mutation, integration]
---

# Execute GraphQl

## Description

The **GraphQL** activity allows you to interact with external systems using the GraphQL protocol. You can perform **queries** (to retrieve data) or **mutations** (to update data), customize request headers, handle variables, and paginate through results using dynamic keys.

Use this activity to:

- Execute queries to retrieve structured, nested data from APIs
- Send mutations to modify or create records in external systems
- Handle authentication via headers
- Control pagination using `nextPageKey` behavior

> **Use Case**:  
> Use this when integrating with platforms that expose GraphQL APIs (e.g., Shopify, GitHub, Contentful). For example, fetch product listings using GraphQL query, or update customer data using a mutation.

---

## Input

Optional — used only if query variables are dynamically provided from a previous activity.

---

## Output

| Output Type | Format | Description                                     |
| ----------- | ------ | ----------------------------------------------- |
| **Data**    | JSON   | Structured response based on the query and root |

---

## Configuration Fields

| Field Name             | Description                                                                               |
| ---------------------- | ----------------------------------------------------------------------------------------- |
| **Connection**         | Authentication/session info for the GraphQL API.                                          |
| **Base Url**           | URL of the GraphQL API (e.g., `https://api.example.com/graphql`).                         |
| **Request Type**       | HTTP method (`GET` or `POST`) used for the GraphQL call.                                  |
| **Headers**            | Key-value headers like `Authorization`, `Content-Type`.                                   |
| **Url Params**         | Optional query parameters appended to the URL.                                            |
| **Parameters**         | Additional key-value parameters for the request body.                                     |
| **Operation**          | Choose between `query` or `mutation`.                                                     |
| **Query**              | The GraphQL query or mutation string.                                                     |
| **Variables**          | Key-value pairs for GraphQL variables used in the query.                                  |
| **Root Of Response**   | Path inside the response JSON from which to extract output (e.g., `data.products.nodes`). |
| **Next Page Key**      | Key used for pagination (e.g., `pageInfo.endCursor`).                                     |
| **Next Key Behaviour** | How to pass the next page key (`as URL param` or `as GraphQL variable`).                  |
| **Data For**           | Optional time frame for which to fetch data.                                              |
| **Start Date**         | Start date used when `Data For` = Date Range.                                             |
| **End Date**           | End date used when `Data For` = Date Range.                                               |

---

## Sample Input

_Not Applicable_

---

## Sample Configuration

| Field            | Value                                                     |
| ---------------- | --------------------------------------------------------- |
| Connection       | `shopify-products`                                        |
| Base Url         | `https://example.myshopify.com/graphql.json`              |
| Request Type     | `POST`                                                    |
| Operation        | `query`                                                   |
| Query            | `{ products(first: 10) { edges { node { id title } } } }` |
| Root Of Response | `data.products.edges`                                     |

---

## Sample Output

| id          | title          |
| ----------- | -------------- |
| gid://123/1 | Cotton T-Shirt |
| gid://123/2 | Leather Wallet |
| gid://123/3 | Running Shoes  |
