• /
  • Log in

Introduction to New Relic NerdGraph, our GraphQL API

NerdGraph is our GraphQL-format API that lets you query New Relic data and configure some New Relic features.

What is NerdGraph?

New Relic has several APIs. NerdGraph is the API we recommend for querying New Relic data and for performing some specific configurations (learn more about features). NerdGraph provides a single API interface for returning data from New Relic’s various APIs and microservices. Over time, other configuration capabilities will be added to NerdGraph.

Important

NerdGraph isn’t used for data ingest. For that, you'd use our data ingest APIs.

NerdGraph is built using GraphQL, which is an open source API format that allows you to request exactly the data needed, with no over-fetching or under-fetching.

For a lesson in how to use NerdGraph, watch this 7-minute video:

Want to watch more video tutorials? Go to the New Relic University’s Intro to NerdGraph. Or see the online course on New Relic APIs.

Use the GraphiQL explorer

To get started using GraphQL, we recommend playing around with our GraphiQL explorer (GraphiQL is an open source graphical interface for using GraphQL). You can use it to explore our data schema, to read built-in object definitions, and to build and execute queries.

To use GraphQL, you’ll need a user-specific New Relic API key called a user key. You can generate one or find an existing one from the GraphiQL explorer’s API key dropdown.

To find the GraphiQL explorer:

For tips on how to build queries, see Build queries.

Requirements and endpoints

To use NerdGraph, you need a New Relic user key, which can be generated and accessed from the GraphiQL explorer.

The endpoints are:

  • Main endpoint: https://api.newrelic.com/graphql
  • Endpoint for accounts using EU data center: https://api.eu.newrelic.com/graphql

To access the endpoint, use the following cURL command:

curl -X POST https://api.newrelic.com/graphql \
-H 'Content-Type: application/json' \
-H 'API-Key: YOUR_NEW_RELIC_USER_KEY' \
-d '{ "query":  "{ requestContext { userId apiKey } }" } '

What can you do with NerdGraph?

NerdGraph functionality can be broken down into two main categories:

  • Querying New Relic data. You can fetch data for a variety of purposes, including using it in a programmatic workflow, or building a New Relic One app for custom data visualizations.
  • Configuring New Relic features. There are a variety of configurations available and more will be added over time. You can do things like add tags, configure workloads, or customize "golden metrics."

You can use NerdGraph to return a wide range of New Relic data but we’ve created some tutorials for common use cases:

Topic

Tutorials

Your monitored entities

Querying data

Query using NRQL (our query language)

Tags

Add and manage tags

Dashboards

Alerts

See all alert-related tutorials

Applied Intelligence

View and configure topology

Workloads

View and configure workloads

Manage keys

Create and manage keys (license keys used for data ingest, and user keys)

Manage data

Distributed tracing

New Relic One apps

Build a New Relic One app

Cloud integrations (AWS, Azure, GCP)

Configure cloud integrations

Partners and resellers

Manage subscriptions (only for partners using original pricing plan)

Data partitions

Manage data partitions

Date retention

Manage data retention

NerdGraph terminology

The following are terms that originate with GraphQL (the API format NerdGraph uses).

Term

Definition

Queries and mutations

There are two classes of GraphQL operations:

  • Queries are basic requests used only to fetch data. These queries are not static, meaning that you can ask for more data or less data, depending on your needs. For each query, you can specify exactly what data you want to retrieve, as long as it is supported by the schema.
  • Mutations are requests that perform an action, such as creating a resource or changing configuration. Mutations require the keyword mutation, as well as the name of the mutation.

Type

Data in GraphQL is organized into types. Types can be scalars (like strings, numbers, or booleans) or object types.

An object type is a custom type made up of a collection of fields. For example, an object type called User may represent a user in a system.

Field

A field represents a piece of information on an object type that can be queried. Fields can be scalars, lists, or objects. For example, a User object type could have a string field called name.

Interface

An interface is an abstract type that represents a collection of common fields that other object types can implement.

Tips on using the GraphiQL explorer

You can make queries with the NerdGraph GraphiQL explorer. The explorer provides built-in schema definitions and features, including auto-complete and query validation.

For more help

If you need more help, check out these support and learning resources:

Create issueEdit page
Copyright © 2021 New Relic Inc.