# GraphQL

Sends a GraphQL query or mutation and returns the response `data` and `errors` separately.

## When to Use

- Call a GraphQL API as a step the graph should show.
- Use an existing workspace connection for provider authentication.
- Run advanced Linear queries or mutations absent from the first-class Linear node.

Prefer a first-class provider node when it already exposes the required operation: it provides typed fields and provider-specific validation. Never place credentials in query text or variables; authenticate with a connection.

When queries are part of larger work, such as a loop over pages or several queries whose results are combined, make them in a JavaScript node with `verdalia.api.graphql.query`, which also sends mutations. It sends through the same code, connection authentication, and public-address rules as this node.

## Configuration

- `connection`: optional workspace connection used for authentication. Use the returned connection ID, not its display name.
- `endpoint`: required GraphQL endpoint URL. Supports `{{ input.* }}` interpolation. It must reach a public address, under the same rules as HTTP Request: `localhost` and private, loopback, or link-local addresses are refused, and redirects (up to 10) are checked hop by hop.
- `query`: required GraphQL query or mutation. Supports interpolation.
- `variables`: optional JSON object. Supports interpolation. The `variables` input socket takes precedence when connected.
- `timeout_secs`: request timeout from 1 to 300 seconds. Default: 30.
- `retry`: sends the request again after a failure that passes, with the settings and rules in [HTTP Request's Retries](/docs/nodes/http_get#retries). Default: `off`. GraphQL is sent as `POST`, so a query and a mutation are both treated as writes: sent again only after a connection or DNS failure, or a `425` or `429` response.

## Inputs

- `input`: data used for interpolation.
- `variables`: optional JSON variables object. When connected, it overrides configured variables.

## Outputs

- `data`: the GraphQL response `data` value, or `null` when absent.
- `errors`: the GraphQL response `errors` value, or `null` when absent.

## Advanced Linear example

Select a Linear connection and use `https://api.linear.app/graphql` as the endpoint:

```json
{
  "connection": "<linear_connection_id>",
  "endpoint": {
    "content": "https://api.linear.app/graphql",
    "mode": "raw"
  },
  "query": {
    "content": "query CurrentViewer { viewer { id name email } }",
    "mode": "raw"
  },
  "variables": {
    "content": "{}",
    "mode": "raw"
  }
}
```

Use the first-class Linear node for its supported issue, project, team, user, and comment operations. Use GraphQL, as this node or as `verdalia.api.graphql.query`, when the required Linear API capability is absent there.
