---
title: New Relic NerdGraph actions
source: https://docs.newrelic.com/docs/workflow-automation/setup-and-configure/actions-catalog/newrelic/query/newrelic-nerdgraph
---

This page provides a reference for New Relic NerdGraph actions available in the workflow automation actions catalog. These actions enable you to execute NerdGraph queries and mutations.

## Prerequisites

Before using New Relic NerdGraph actions in workflow automation, ensure you have:

-   A New Relic account with appropriate permissions.
-   A New Relic license key (if sending data to a different account).
-   The necessary permissions for the specific New Relic services you plan to use.

See [License Key](https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys#license-key) for information on how to create and manage your New Relic Account License Key.

## Run NerdGraph request

The action identifier is `newrelic.nerdgraph.execute`.

Executes a GraphQL command against the New Relic NerdGraph API. The command can be either a query or a mutation.

### Inputs

The following table describes all available input fields for this action.

| Input         | Type           | Description                                                                                                                                                               | Example                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **graphql**   | String         | **Required.** A GraphQL statement. Use [GraphiQL](https://one.newrelic.com/nerdgraph-graphiql?state=c8579e50-f154-fec6-22b8-f9fdcfc1990a) to build and test your command. |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| **variables** | Map[string]any | **Required.** Any key/value pair variables to use with the GraphQL statement.                                                                                             |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| **selectors** | List           | **Optional.** The selectors to get only the specified parameters as output.                                                                                               | ```yaml steps:   - name: findingVar     type: action     action: newrelic.nerdgraph.execute     version: 1     inputs:       graphql: |         query GetEntity($entityGuid: EntityGuid!) {           actor {             entity(guid: $entityGuid) {               alertSeverity             }           }         }       variables:         entityGuid: ${{ .workflowInputs.entityGuid }}   - name: findingInline     type: action     action: newrelic.nerdgraph.execute     version: 1     inputs:       graphql: |         {           actor {             entity(guid: "${{ .workflowInputs.entityGuid }}") {               alertSeverity             }           }         }       selectors:         - name: entities           expression: '.data' ``` |

### Outputs

The following table describes all output fields returned by this action.

| Output           | Type             | Description                                              |
| ---------------- | ---------------- | -------------------------------------------------------- |
| **data**         | `Map[string]any` | Contents of the `data` property of a NerdGraph response. |
| **success**      | Boolean          | Status of the request.                                   |
| **errorMessage** | String           | Failure reason as message.                               |

### Example

The following example runs a NerdGraph query to retrieve the current user ID, then logs the result.

| Workflow example                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ```yaml steps:   - name: currentUserId     type: action     action: newrelic.nerdgraph.execute     version: 1     inputs:       graphql: |         query userId {           currentUser {             id           }         }    - name: logResult     type: action     action: newrelic.ingest.sendLogs     version: 1     inputs:       logs:         - message: "userId: ${{ .steps.currentUserId.outputs.data.currentUser.id }}" ``` |
