# Execute n8n operations

Execute a GraphQL query or mutation. Select **Execute** in the Probo node's **Resource** field.

Return to the [complete n8n resource reference](/docs/developers/api/n8n/resources) to browse another resource.

| Operation | Value     | Description                          | Source                                                                                                                                |
| --------- | --------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
| Execute   | `execute` | Execute a GraphQL query or mutation. | [View implementation](https://github.com/getprobo/probo/blob/main/packages/n8n-node/nodes/Probo/actions/execute/execute.operation.ts) |

Use this resource when the [resource reference](/docs/developers/api/n8n/resources)
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.

## Configuration

Set **Resource** to **Execute**, then configure:

| Field         | Description                                                                                |
| ------------- | ------------------------------------------------------------------------------------------ |
| **API**       | **Console API** (`/api/console/v1/graphql`) or **Connect API** (`/api/connect/v1/graphql`) |
| **Query**     | Complete named operation, including variable declarations and the fields to return         |
| **Variables** | JSON object whose keys match the operation's variable names                                |

The node uses the same [Probo API
credential](/docs/developers/api/n8n/authentication) for either endpoint.
Authorization still depends on the token's scopes and its Probo user's
permissions.

## Query a node by ID

Set **API** to **Console API** and enter:

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

Enter a JSON object whose key matches `$userId`:

```json
{
  "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:

```text
{{ $json.data.node }}
```

## Run a mutation

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

```graphql
mutation UpdateOrganization($input: UpdateOrganizationInput!) {
  updateOrganization(input: $input) {
    organization {
      id
      name
    }
  }
}
```

```json
{
  "input": {
    "id": "gid://probo/Organization/example",
    "name": "Acme Corp"
  }
}
```

:::caution
The GraphQL operation can perform any mutation allowed by both the OAuth token
and its user. Review the query and variables before activating a workflow, and
put destructive mutations behind explicit conditions or approval steps.
:::

## Operation requirements

- 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 [Probo Trigger](/docs/developers/api/n8n/trigger) for event-driven
workflows.

## Pagination

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.

## Errors

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.
