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:
- If your New Relic account uses an EU data center, go to api.eu.newrelic.com/graphiql.
- Otherwise use api.newrelic.com/graphiql.
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 | |
Dashboards | |
Alerts | |
Applied Intelligence | |
Workloads | |
Manage keys | Create and manage keys (license keys used for data ingest, and user keys) |
Manage data | |
Distributed tracing | |
New Relic One apps | |
Cloud integrations (AWS, Azure, GCP) | |
Partners and resellers | Manage subscriptions (only for partners using original pricing plan) |
Data partitions | |
Date 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:
|
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 |
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 |
Interface | An interface is an abstract type that represents a collection of common fields that other object types can |
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:
- Browse the Explorers Hub to get help from the community and join in discussions.
- Find answers on our sites and learn how to use our support portal.
- Run New Relic Diagnostics, our troubleshooting tool for Linux, Windows, and macOS.
- Review New Relic's and and documentation.