• English日本語한국어
  • Log inStart now

Get started with the New Relic CLI

Access the New Relic platform from the comfort of your terminal. You can use the New Relic CLI to manage entity tags, define workloads, record deployment markers, and much more. In short, you can use the CLI to automate common tasks in your DevOps workflow. This guide walks you through the essentials of New Relic CLI, from install and configuration to basic usage.

Before you begin

For this guide you just need:

Step 1 of 10

Install the New Relic CLI

Download the New Relic CLI for your operating system, as described below. You can also download pre-built binaries for all platforms, including .deb and .rpm packages, and our Windows x64 .msi installer.


Using Snapcraft, run:

sudo snap install newrelic-cli


Using Homebrew, run:

brew install newrelic-cli


Using Scoop, run:

scoop bucket add newrelic-cli https://github.com/newrelic/newrelic-cli.git
scoop install newrelic-cli
Step 2 of 10

Create your New Relic CLI profile.

After you install the New Relic CLI, it's time to create your first profile. Profiles contain credentials and settings that you can apply to any CLI command, which is useful when switching between accounts.

Run the profiles add command:

# Create the tutorial account for the US region
newrelic profiles add --profile tutorial --apiKey YOUR_NEW_RELIC_USER_KEY -r YOUR_REGION
# Set the profile as defaults
newrelic profiles default --profile tutorial


You must set the region of your New Relic account. Use -r to set either us or eu.

Step 3 of 10

Get your application details.

Now, add tags to the application you've instrumented with New Relic. Tags are key-value pairs that can help you organize and filter your entities. An entity (for example, an application) can have a maximum of 100 key-value pairs tied to it.

Before searching for your application using the New Relic CLI, write down or copy your Account ID and the name of your application in New Relic - you need both to find applications in the New Relic platform.

Step 4 of 10

Retrieve your application details as a JSON object.

To search for your APM application, use the apm application search command:

newrelic apm application search --accountId YOUR_ACCOUNT_ID --name NAME_OF_YOUR_APP


If you get an error, check that your account ID and application name are correct.

Step 5 of 10

Find the guid value.

If the account ID is valid, and the application name exists in your account, apm application search yields data similar to this example:

"accountId": YOUR_ACCOUNT_ID,
"applicationId": YOUR_APP_ID,
"domain": "APM",
"guid": "A_LONG_GUID",
"name": "NAME_OF_YOUR_APP",
"permalink": "https://one.newrelic.com/redirect/entity/A_LONG_GUID",
"reporting": true,

When you've successfully searched for your application, look for the guid value. It's a unique identifier for your application. You should copy it or write it down.

Step 6 of 10

Add a simple tag to your application.

Now that you have the GUID, you can point the New Relic CLI directly at your application. Adding a tag is the simplest way to try out the CLI capabilities (don't worry, tags can be deleted by using entity tags delete).

Here, you add an environment tag to your application. Add the dev:testing tag⁠ (or any other key-value pair) to your application using the entities tags create command:

newrelic entity tags create --guid YOUR_APP_GUID --tag devkit:testing
Step 7 of 10

Add tag sets.

What if you want to add multiple tags? Tag sets to the rescue! While tags are key-value pairs separated by colons, tag sets are comma separated lists of tags. For example:


To add multiple tags to your application at once, modify and run this snippet:

newrelic entity tags create --guid YOUR_APP_GUID --tag tag1:test,tag2:test


Adding tags is an asynchronous operation: this means it could take a while for the tags to get created.

Step 8 of 10

Retrieve your application's tags.

You've created and added some tags to your application, but to test that they're working, you need to retrieve them.

Run the entity tags get command:

newrelic entity tags get --guid YOUR_APP_GUID

All tags associated with your application are retrieved as a JSON array:

"Key": "tag1",
"Values": ["true"]
"Key": "tag2",
"Values": ["test"]
"Key": "tag3",
"Values": ["testing"]
// ...
Step 9 of 10

Bonus step: create a deployment marker.

Deployments of applications often go wrong. Deployment markers are labels that, when attached to your application data, help you track deployments and troubleshoot what happened.

To create a deployment marker, run the apm deployment create command using the same application ID from your earlier search:

newrelic apm deployment create --applicationId YOUR_APP_ID --revision $(git describe --tags --always)
Step 10 of 10

Check the JSON response for the revision and timestamp of the deployment.

You can build this workflow into a continuous integration or continuous deployment (CI/CD) system to indicate changes in your application's behavior after deployments.

Here's an example:

"id": 37075986,
"links": {
"application": 204261368
"revision": "v1.2.4",
"timestamp": "2020-03-04T15:11:44-08:00",
"user": "Developer Toolkit Test Account"

Next steps

Have a look at all the available commands in the New Relic CLI. For example, you can create a New Relic workflow using workload create

If you'd like to engage with other community members, visit our New Relic Explorers Hub page. We welcome feature requests or bug reports on GitHub.

Copyright © 2023 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.