Back to top icon

New Relic Developers

Extend. Customize. Automate.

Build on our platform and make New Relic your own.

Ways to build on New Relic

speed-gauge-3-3-1 Created with Sketch.

Do more with your data

Build curated dashboards, advanced visualizations, and custom alerts.

Do more

Group 3 Created with Sketch.

Get data in and out

Add new data, enhance existing data, and access it all via APIs.

Access more

file-video-setting-3-3 Created with Sketch.

Automate your workflows

Embed New Relic management into your DevOps toolchains.

Automate more


The New Relic Query Language (NRQL) is a powerful, SQL-like query syntax in New Relic Insights that lets you access your data, including custom events and attributes you’ve added.

Here are a few example NRQL queries to get you started.

--Discover what web transactions have the most errors across all your applications
SELECT count(*) FROM TransactionError FACET transactionName

--Graph the last day of page views that took over 2 seconds to complete broken down by the client's browser
SELECT count(*) FROM PageView WHERE duration > 2 SINCE 1 day ago FACET userAgentName TIMESERIES AUTO

--Show me the top 100 processes by CPU utilizations across all of my hosts for the last hour
SELECT average(cpuPercent) FROM ProcessSample FACET processDisplayName LIMIT 100 SINCE 60 minutes ago


Extract data and manage your monitoring with RESTful APIs.

Here's an example command to fetch a list of all recent deployments for a given application.

curl -X GET '' \
 -H 'X-Api-Key:YOUR_API_KEY' -i

An example response JSON for deployments.

  "deployments": [
      "id": 106368177,
      "revision": "1.0.24",
      "changelog": "Deployed new error handlers",
      "description": "Improving error handling logic to deliver better user experience",
      "user": "",
      "timestamp": "2018-05-24T21:23:05+00:00",
      "links": {
        "application": 43192210

Insights APIs

Two APIs for New Relic Insights let you add and retrieve custom event data: the Insights Query API and the Insights Insert API.

Here's an example request to issue a NRQL query against the Insights Query API.

 curl -H "Accept: application/json" -H "X-Query-Key: YOUR_QUERY_KEY" ""

Here's an example request to insert events stored in a file named "events.json" into the Insights Insert API.

# events.json: 
# [
#  {
#    "eventType":"ExampleEvent",
#    "numExample":3,
#    "strExample":"StringValue"
#  },
#  ...
# ]
cat events.json | curl -d @- -X POST -H "Content-Type: application/json" -H "X-Insert-Key: YOUR_KEY_HERE"

Agent APIs

New Relic APM, Browser, and Mobile agents include language-specific APIs that can extend functionality and data reporting.

Here's some example code to insert new custom attributes and custom events through the Java APM agent.

// Add a custom attribute to be added to existing APM events in Java
NewRelic.addCustomParameter("region", "us");

// Add a new custom event named "MyCustomEvent" to NRDB in Java
Map<String, Object> eventAttributes = new HashMap<String, Object>();
eventAttributes.put("region", "us");
eventAttributes.put("code", 5);
NewRelic.getAgent().getInsights().recordCustomEvent('MyCustomEvent', eventAttributes);

Infrastructure SDK

Report custom data from your hosts and build with the same Infrastructure SDK we use internally at New Relic.

This is an example main() method from a Go integration adding new metric, event, and inventory data.

func main() {
  // Create Integration
  i, err := integration.New(integrationName, integrationVersion, integration.Args(&args))
  if err != nil {
  entity := i.LocalEntity()
  // Add an event
  if args.All() || args.Events {
    err = entity.AddEvent(event.New("restart", "status"))
    if err != nil {
 // Add Inventory item
 if args.All() || args.Inventory {
   err = entity.SetInventoryItem("customInventory", "version", "3.0.1")
   if err != nil {
 // Add Metric
 if args.All() || args.Metrics {
   m := entity.NewMetricSet("CustomSample")
   err = m.SetMetric("myMetric", 1337, metric.GAUGE)
   if err != nil {
 if err = i.Publish(); err != nil {

NerdGraph (GraphQL API)

NerdGraph gives you easy, efficient access to the data you want to query.

Here's an example GraphQL payload to request the available cloud vendors supported by New Relic Infrastructure integrations.

query cloudProviders {
  actor {
    account(id: YOUR_ACCOUNT_ID) {
      cloud {
        providers {

This is an example GraphQL response payload for requested cloud vendors.

  "data": {
    "actor": {
      "account": {
        "cloud": {
          "providers": [
              "slug": "aws",
              "name": "Amazon Web Services",
              "id": 1
             "slug": "gcp",
             "name": "Google Cloud Platform",
             "id": 5
             "slug": "azure",
             "name": "Microsoft Azure",
             "id": 4

Extend your knowledge.

Find out how to do more with New Relic.

New Relic Developer Learning >

Connect with developers.

Find answers and connect with New Relic customers and staff.

New Relic Explorers Hub >