New Relic Developers

NerdGraph — GraphQL API

Ask for what you want. Get what you want.

NerdGraph gives you the power to request the exact New Relic data you need without over-fetching or under-fetching. You can use NRQL (New Relic query language) within NerdGraph queries. 

For an introduction to NerdGraph and the data schema, see our GraphiQL interface, an interactive tool that allows you to dynamically execute queries. 

Video

Intro to NerdGraph

Learn how to use our GraphQL API with software engineer Emery Gerndt Otopalik.

GraphiQL uses an efficient and flexible query language that gives you the power to request exactly the data you need. While typical REST APIs require loading from multiple URLs, GraphQL APIs get all the data your app needs in a single request.

4:42

 

The following GraphQL query will link an AWS account to a New Relic account:

mutation($accountId: Int!, $linkAccounts: CloudLinkAccountsInput!) {
  cloudLinkAccount(
      nrAccountId: <NR_ACCOUNT_ID>,
      accounts: {
        aws: [{
          name: <PROVIDER_ACCOUNT_NAME>,
          arn: <AWS_ROLE_ARN>
        }]
      }
    ) {
      linkedAccounts {
        id
        name
        authLabel
        createdAt
        updatedAt
      }
    }
  }
}

The following GraphQL query will return the response of a NRQL query:

{
   actor {
      account(id: YOUR_ACCOUNT_ID) {
         nrql(query: "SELECT count(*) FROM Transaction SINCE 1 HOUR AGO") {
            results
         }
      }
   }
}
Get all the data you need in a single request.

Explore NerdGraph using GraphiQL

Learn more and start building

Group 7 Created with Sketch.

Documentation

For a list of copyable example queries that you can use with the New Relic GraphiQL, see Cloud integration and New Relic GraphQL API examples.

Group 9 Created with Sketch.

NRU Tutorials

To learn how to make the most of our developer resources, check out New Relic University.

Group 8 Created with Sketch.

Community Forum

Connect with other developers in the New Relic Explorers Hub

GitHub

For examples of integrations and other technologies, see our GitHub repo.