> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/integrations/catalog/new-relic.md).

# New Relic

Query New Relic data and alert policies, and submit logs, custom events, and dimensional metrics.

### Connectors

Choose the connector that matches your authentication method. The options below use the names shown in StackAI.

| Connector | Authentication   |
| --------- | ---------------- |
| New Relic | API key or token |

#### New Relic

Connect to New Relic with a user key for NerdGraph queries and a License key for logs, events, and metrics.

**Set up in New Relic**

1. Prepare the New Relic account or service that the workflow will access. Grant access to the required resources and operations.
2. **User Key:** Create a user key in New Relic. It is used only for NerdGraph queries.

**Set up in StackAI**

1. Open **Settings → Connections**, add a connection, and select **New Relic**.
2. Enter the credentials and connection details in the fields below.
3. Save the connection and check its connection status. Select this saved connection when configuring an action or feature that uses it.

**Connection fields**

| StackAI field      | Required                 | What to enter                                                                                                                                                       |
| ------------------ | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| User Key           | Yes                      | Create a user key in New Relic. It is used only for NerdGraph queries. [Provider instructions](https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys/). |
| License Key        | Yes                      | Use a License key belonging to the Default Account ID. [Provider instructions](https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys/).                 |
| Default Account ID | Yes                      | The numeric account used for queries and Event API routing. Connection health verifies that the User Key can access this account.                                   |
| Region             | Optional / as applicable | Choose the New Relic region that hosts this account.                                                                                                                |

#### Verify the connection

Check that the connection is healthy. Then run a read operation against a resource the connected account can access. A successful connection check confirms authentication; it does not guarantee permission for every action.

If access is denied, check the credential or OAuth permissions, the selected account or environment, and access to the specific resource. Update expired credentials or reconnect after permissions change.

### Use an action

1. Add the required **New Relic** action to the workflow.
2. Select a connection when the action requests one.
3. Complete the required fields. Use the reference picker when a value comes from another workflow step.
4. Run the workflow and inspect the action’s output. Check the result before using it in a later step.

### Actions

#### Run NRQL Query

Use the New Relic connector to run an NRQL query and return the matching rows.

**Inputs**

| Field      | Type             | Required | Description                                                                                                           |
| ---------- | ---------------- | -------- | --------------------------------------------------------------------------------------------------------------------- |
| Account    | select (integer) | No       | The New Relic account to query. Leave blank to use the connection default. Options load from the selected connection. |
| NRQL query | textarea         | Yes      | The NRQL statement to run.                                                                                            |

**Outputs**

| Field     | Type          | Description                             |
| --------- | ------------- | --------------------------------------- |
| Results   | object\_array | The typed result rows returned by NRQL. |
| Row count | integer       | The number of rows returned.            |

#### List Alert Policies

List alert policies in a New Relic account, with optional name or ID filters.

**Inputs**

| Field            | Type             | Required | Description                                                                                               |
| ---------------- | ---------------- | -------- | --------------------------------------------------------------------------------------------------------- |
| Account          | select (integer) | No       | The New Relic account whose policies should be listed. Options load from the selected connection.         |
| Policy name      | string           | No       | Optionally filter policies by name.                                                                       |
| Name match       | select (string)  | No       | Whether the policy name filter is exact or partial. Available values: Contains, Exact. Default: contains. |
| Policy IDs       | string           | No       | Optionally restrict results to a comma-separated set of policy IDs.                                       |
| Starting cursor  | string           | No       | Continue a previous policy listing from its next cursor.                                                  |
| Maximum policies | integer          | No       | The maximum number of policies to return. Minimum: 1. Default: 100.                                       |

**Outputs**

| Field       | Type          | Description                                            |
| ----------- | ------------- | ------------------------------------------------------ |
| Policies    | object\_array | The matching alert policies.                           |
| Total count | integer       | The total matching policy count reported by New Relic. |
| Next cursor | string        | A continuation token when more policies remain.        |

#### Send Log

Submit one structured log record to New Relic.

**Inputs**

| Field                 | Type            | Required | Description                                                                       |
| --------------------- | --------------- | -------- | --------------------------------------------------------------------------------- |
| Message               | textarea        | Yes      | The log message to record.                                                        |
| Timestamp             | datetime        | No       | When the log occurred. Leave blank to use the current time.                       |
| Severity              | select (string) | No       | The log severity level. Available values: Trace, Debug, Info, Warn, Error, Fatal. |
| Log type              | string          | No       | A category used to group similar logs.                                            |
| Service name          | string          | No       | The service that produced the log.                                                |
| Environment           | string          | No       | The deployment environment that produced the log.                                 |
| Additional attributes | textarea        | No       | Optional JSON attributes to attach to the log.                                    |

**Outputs**

| Field    | Type    | Description                                        |
| -------- | ------- | -------------------------------------------------- |
| Accepted | boolean | Whether New Relic accepted the log for processing. |

#### Ingest Event

Ingest an event by submitting one custom event to New Relic for later NRQL analysis.

**Inputs**

| Field            | Type     | Required | Description                                              |
| ---------------- | -------- | -------- | -------------------------------------------------------- |
| Event type       | string   | Yes      | The custom event category used in NRQL.                  |
| Timestamp        | datetime | No       | When the event occurred. Leave blank to use ingest time. |
| Event attributes | textarea | No       | Optional scalar fields to store with the event.          |

**Outputs**

| Field        | Type    | Description                                    |
| ------------ | ------- | ---------------------------------------------- |
| Accepted     | boolean | Whether New Relic accepted the event request.  |
| Request UUID | string  | New Relic's identifier for the ingest request. |

#### Ingest Metric

Ingest a metric by submitting one dimensional metric data point to New Relic.

**Inputs**

| Field                    | Type            | Required | Description                                                                                               |
| ------------------------ | --------------- | -------- | --------------------------------------------------------------------------------------------------------- |
| Metric name              | string          | Yes      | The stable name used to query this metric.                                                                |
| Metric type              | select (string) | No       | How New Relic should interpret the metric value. Available values: Gauge, Count, Summary. Default: gauge. |
| Timestamp                | datetime        | Yes      | When the metric data point was measured.                                                                  |
| Value                    | number          | No       | The gauge value or accumulated count.                                                                     |
| Interval in milliseconds | integer         | No       | The measurement interval for count and summary metrics. Minimum: 1.                                       |
| Summary count            | integer         | No       | The number of measurements represented by a summary. Minimum: 1.                                          |
| Summary sum              | number          | No       | The sum of measurements represented by a summary.                                                         |
| Summary minimum          | number          | No       | The smallest measurement represented by a summary.                                                        |
| Summary maximum          | number          | No       | The largest measurement represented by a summary.                                                         |
| Metric attributes        | textarea        | No       | Optional dimensions to attach to the metric.                                                              |

**Outputs**

| Field      | Type    | Description                                           |
| ---------- | ------- | ----------------------------------------------------- |
| Accepted   | boolean | Whether New Relic accepted the metric for processing. |
| Request ID | string  | New Relic's identifier for the metric submission.     |

### Important behavior

Actions that create, update, send, or delete data can change the connected service. Review their inputs before running them. A retry can repeat an operation; consider this when configuring retries for actions that change data.

The catalog lists the fields and capabilities available in the supplied provider definition. Availability can also depend on your deployment and organization’s Feature Access settings.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/integrations/catalog/new-relic.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
