jump to content

Execute n8n operations

Reference for 1 operation for the the platform n8n Execute resource, including field descriptions and links to the node implementation source

View as Markdown

Execute a GraphQL query or mutation. Select Execute in the the platform node’s Resource field.

Return to the complete n8n resource reference to browse another resource.

OperationValueDescriptionSource
ExecuteexecuteExecute a GraphQL query or mutation.View implementation

Use this resource when the resource reference does not provide the operation, field selection, or relationship you need.

Prefer a dedicated resource operation when possible. Dedicated operations provide fields in the n8n editor, implement pagination and file upload where needed, and are less likely to break when the GraphQL schema changes.

Set Resource to Execute, then configure:

FieldDescription
APIConsole API (/api/console/v1/graphql) or Connect API (/api/connect/v1/graphql)
QueryComplete named operation, including variable declarations and the fields to return
VariablesJSON object whose keys match the operation’s variable names

The node uses the same the platform API credential for either endpoint. Authorization still depends on the token’s scopes and its the platform user’s permissions.

Set API to Console API and enter:

query GetUser($userId: ID!) {
  node(id: $userId) {
    ... on User {
      id
      fullName
      email
    }
  }
}

Enter a JSON object whose key matches $userId:

{
  "userId": "gid://probo/User/example"
}

When the ID comes from an incoming item, switch the Variables field to expression mode and construct the object from $json.userId.

The output is the full GraphQL response envelope. In the next node, the user record is available at:

{{ $json.data.node }}

Keep values in Variables rather than interpolating them into the query:

mutation UpdateOrganization($input: UpdateOrganizationInput!) {
  updateOrganization(input: $input) {
    organization {
      id
      name
    }
  }
}
{
  "input": {
    "id": "gid://probo/Organization/example",
    "name": "Acme Corp"
  }
}
  • Start with query, mutation, or subscription, followed by an operation name. Anonymous shorthand such as { viewer { id } } is rejected.
  • Enter variables as a JSON object. Invalid JSON stops the item before the request is sent.
  • Select at least one output field for each object returned by GraphQL.
  • Use the API endpoint that defines the operation. Most product and organization work belongs to the Console API.

Although the editor accepts a subscription document, the node performs a single HTTP request and does not maintain a streaming GraphQL subscription. Use the platform Trigger for event-driven workflows.

The Execute resource does not paginate a custom query automatically. For a GraphQL connection:

  1. Request pageInfo { hasNextPage endCursor } with the connection’s records.
  2. Pass endCursor as the next request’s after variable.
  3. Keep the filters and ordering unchanged.
  4. Stop when hasNextPage is false.

For standard list operations, use the dedicated resource operation and enable Return All instead.

GraphQL responses with a non-empty errors array fail the n8n item even when the server returns HTTP 200. Check:

  • The operation and field names against the schema for the selected API.
  • Required variables and GraphQL scalar formats.
  • The organization ID, OAuth scopes, and token user’s permissions.
  • Whether a field belongs to the Console API or Connect API.

Enable n8n’s Continue On Fail setting only when the workflow can safely process later items after one GraphQL operation fails.

Ultima actualizare: