step

graphql

Execute GraphQL queries and mutations.

Overview

Supports:
- query: Read data from GraphQL API
- mutation: Modify data via GraphQL API
- Variable substitution
- Custom headers and API key authentication

Setup:
1. Identify the GraphQL API endpoint you want to connect to
2. Check the API documentation for authentication requirements
3. If API key authentication is required, obtain an API key from the service
4. Store credentials securely (e.g., as an environment variable)

Authentication: Varies by API. API key optional - check your GraphQL API documentation.

Examples

Query users list

Fetch list of users from a GraphQL API

type: graphql
url: https://api.example.com/graphql
operation: query
query: |
  query {
    users {
      id
      name
      email
    }
  }
output_to: users_data

Query with variables

Fetch specific user by ID using query variables

type: graphql
url: https://api.example.com/graphql
api_key: ${env:GRAPHQL_API_KEY}
operation: query
query: |
  query GetUser($userId: ID!) {
    user(id: $userId) {
      id
      name
      email
      posts {
        title
      }
    }
  }
variables:
  userId: "123"
output_to: user_data

Create mutation

Create a new user with a GraphQL mutation

type: graphql
url: https://api.example.com/graphql
api_key: ${env:GRAPHQL_API_KEY}
api_key_header: X-API-Key
api_key_prefix: ""
operation: mutation
query: |
  mutation CreateUser($name: String!, $email: String!) {
    createUser(input: {name: $name, email: $email}) {
      id
      name
      email
      createdAt
    }
  }
variables:
  name: John Doe
  email: john@example.com
output_to: created_user

Query with custom headers

Execute query with additional custom headers

type: graphql
url: https://api.example.com/graphql
api_key: ${env:API_TOKEN}
operation: query
query: |
  query {
    currentUser {
      id
      profile {
        displayName
      }
    }
  }
headers:
  X-Request-ID: req-12345
  X-Client-Version: "1.0"
timeout: 60
output_to: current_user

Configuration

Parameter Type Required Description
type string No Step type identifier
Default: "graphql"
url string Yes GraphQL endpoint URL
api_key string No API key for authentication (optional, sent in header specified by api_key_header)
api_key_header string No HTTP header name where the API key will be sent
Default: "Authorization"
api_key_prefix string No Prefix to add before the API key value (e.g., 'Bearer' for 'Bearer <token>'). Use empty string for no prefix
Default: "Bearer"
operation string Yes Type of GraphQL operation to execute: 'query' for reading data or 'mutation' for modifying data
Options: query, mutation
query string Yes GraphQL query or mutation string
variables string No Variables to pass to the GraphQL query/mutation (supports template substitution)
operation_name string No Name of the operation to execute (required if query contains multiple operations)
headers string No Additional custom HTTP headers to include in the request
timeout integer No Request timeout in seconds
Default: 30
output_to string No Key name where the GraphQL response data will be stored in the event
Default: "graphql"

Base Configuration

These configuration options are available on all steps:

Parameter Type Default Description
name null Optional name for this step (for documentation and debugging)
description null Optional description of what this step does
retries integer 0 Number of retry attempts (0-10)
backoff_seconds number 0 Backoff (seconds) applied between retry attempts
retry_propagate boolean false If True, raise last exception after exhausting retries; otherwise swallow.