- REST v2 for applications, metrics and alerts, at
api.newrelic.com/v2. - NerdGraph, the GraphQL API, for NRQL, accounts, entities, issues and deployment markers, at
api.newrelic.com/graphql.
api.eu.newrelic.com for both, and a key is only valid in its own region. Pass region: 'eu' on any call from an EU account; the default is us.
What to know:
health_statusis a colour, such asgreen,orange,red,grayorunknown. The REST API saysorangewhere the UI shows yellow, andunknownmeans the app has no alert policy attached.reportinggoes false after ten quiet minutes, andlast_reported_atis then an empty string rather than a timestamp, so a missing time is not an error.- A metric window defaults to the last 30 minutes when
fromis omitted.summarize: truecollapses the window into one value per metric, which is what most dashboards want. - REST v2 pages through a
Linkheader, which this plugin cannot read, sopageis an input. A long list needs an explicit page walk. alerts.conditionscovers APM, browser and mobile conditions only. NRQL conditions, which most accounts use, arealerts.nrqlConditionsand its create, update and delete.- Updates replace the whole object.
alerts.updatePolicyneeds bothnameandincident_preference, andalerts.updateNrqlConditionneeds the whole condition: New Relic answers 422, 500 or 400 to a partial body. Read the current values first. - Find GUIDs with
entities.search. It takes an entity filter such astype = 'APPLICATION',domain = 'APM'orname LIKE 'checkout', and pages withnextCursor. issues.listis the current incident model (NerdGraphaiIssues).title,descriptionand a few other fields are lists even when they hold one value.- A deployment marker cannot be deleted.
changeTracking.createDeploymentwrites it on the entity’s charts for good, so it isdestructive: the permission policy decides whether it needs approval (cautious asks, strict refuses, open runs it). - A NRQL query is a NerdGraph call.
accountIdis required, and the answer carries the time window New Relic actually ran over, which can differ from theSINCEclause. - A bad NRQL query answers 200 with an
errorsarray. The plugin turns that into a thrown error rather than returning rows that are silently empty. - Deleting a policy deletes its conditions, and New Relic has no restore call.
incident_preferenceis one ofPER_POLICY,PER_CONDITIONorPER_CONDITION_AND_TARGETand decides whether alerts roll up per policy, per condition, or per condition and signal. It defaults toPER_POLICY.
- 18 typed API operations
Setup
1
Install
2
Add the plugin
corsair.ts
multiTenancy: true, scope calls with corsair.withTenant(id). See Quick start for KEK + Hub keys, and Multi-tenancy for account isolation.3
Choose authentication
- API Key (Recommended)
Store the New Relic API key before the first call: More: API Key
pnpm corsair setup --plugin=newrelic --tenant=acme api_key=<your-key> (leave out --tenant without multiTenancy), or pass it as key in the plugin options. With Hub, each tenant enters their own key on the connect page. See API key auth.4
Connect a tenant
Mint a connect link and send the tenant to it. Hub hosts the page and delivers the result to your app — see Connect / OAuth.
Example API calls
List applications with their healthWhat’s next
API reference
Every
newrelic.api.* operation with input and output types.Connect / OAuth
createLink, Hub delivery, and tenant connect flows.
Use with agents
Expose this plugin’s operations as MCP tools.