Back to top icon

New Relic Developers

GraphQL API

Ask for what you want. Get what you want.

The New Relic GraphQL API explorer gives you the power to request the exact data you need, without over-fetching or under-fetching. You can query data from any of the New Relic cloud integrations, including AWS, Azure, and Google Cloud Platform.

To get started, head over to the New Relic GraphQL API explorer, an interactive tool that allows you to dynamically execute queries using this new API.

From there, you can execute single actions that apply to many integrations. For example, list all enabled cloud integrations for all your linked accounts, enable multiple integrations across multiple cloud accounts, or modify multiple integration configuration parameters at once (including regions and polling intervals).

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
         }
      }
   }
}

Video

Intro to New Relic GraphQL API explorer

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

The New Relic GraphQL API is 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

 
Get all the data you need in a single request.

Visit the GraphQL API explorer

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.