{"id":8350,"library":"newrelic-api","title":"New Relic API Python Client","description":"The `newrelic-api` library provides a Python interface to interact with the New Relic API v2. It allows users to fetch application data, monitor metrics, and manage various New Relic entities programmatically. Currently at version 1.0.6, it is a community-maintained client that sees infrequent releases, primarily for maintenance and minor enhancements.","status":"maintenance","version":"1.0.6","language":"python","source_language":"en","source_url":"https://github.com/ambitioninc/newrelic-api","tags":["newrelic","monitoring","api","client","devops","observability"],"install":[{"cmd":"pip install newrelic-api","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"wrong":"from newrelic_api import NewRelicApi","symbol":"AlertConditions","correct":"from newrelic_api import AlertConditions"},{"wrong":"from newrelic_api import NewRelicApi","symbol":"Applications","correct":"from newrelic_api import Applications"},{"wrong":"from newrelic_api import NewRelicApi","symbol":"Dashboards","correct":"from newrelic_api import Dashboards"}],"quickstart":{"code":"import os\nfrom newrelic_api import NewRelicApi\n\n# Get your New Relic REST API Key (v2) from environment variable\n# Ensure it's not a License Key or Insights Key\nNEW_RELIC_API_KEY = os.environ.get('NEW_RELIC_API_KEY', '')\n\nif not NEW_RELIC_API_KEY:\n    print(\"Error: NEW_RELIC_API_KEY environment variable not set.\")\n    exit(1)\n\napi = NewRelicApi(api_key=NEW_RELIC_API_KEY)\n\ntry:\n    # Fetch all applications associated with the API key\n    applications = api.get_applications()\n    print(f\"Found {len(applications)} applications:\")\n    for app in applications:\n        print(f\"  ID: {app.get('id')}, Name: {app.get('name')}\")\n\n    # Example: Get a specific application by ID (replace with a real ID)\n    if applications:\n        first_app_id = applications[0]['id']\n        specific_app = api.get_application(first_app_id)\n        print(f\"\\nDetails for first application ({first_app_id}): {specific_app.get('name')}\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n","lang":"python","description":"This quickstart initializes the New Relic API client using an API key from an environment variable and fetches a list of applications. It demonstrates basic API interaction and error handling."},"warnings":[{"fix":"Generate or locate the correct 'New Relic REST API Key (v2)' in your New Relic account settings. Do not confuse it with other key types.","message":"The `newrelic-api` package specifically requires a 'New Relic REST API Key (v2)'. Using other New Relic keys, such as a License Key or an Insights Insert/Query Key, will result in authentication failures.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Implement client-side rate limiting, exponential backoff, or introduce delays between API calls, especially when processing large datasets or making frequent requests.","message":"New Relic's APIs are subject to rate limiting. Making too many requests in a short period will result in `429 Too Many Requests` errors. The library does not implement automatic retry or backoff mechanisms.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always use `from newrelic_api import NewRelicApi` for imports, regardless of how you installed it via `pip install newrelic-api`.","message":"The Python package name for import is `newrelic_api` (with an underscore), while the PyPI installation name is `newrelic-api` (with a hyphen). This is a common source of `ImportError`.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'1.0.6':42 'allow':24 'api':3,9,21,62 'applic':28 'client':5,49,63 'communiti':47 'community-maintain':46 'current':39 'data':29 'devop':64 'enhanc':59 'entiti':37 'fetch':27 'infrequ':52 'interact':16 'interfac':14 'librari':10 'maintain':48 'mainten':56 'manag':33 'metric':31 'minor':58 'monitor':30,61 'new':1,19,35 'newrel':8,60 'newrelic-api':7 'observ':65 'primarili':54 'programmat':38 'provid':11 'python':4,13 'releas':53 'relic':2,20,36 'see':51 'user':25 'v2':22 'various':34 'version':41","created_at":"2026-04-16T17:01:43.816248+00:00","updated_at":"2026-04-16T17:01:43.816248+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.0.6","cli_name":"","cli_version":null,"type":"library","homepage":"https://newrelic.com","github":"https://github.com/ambitioninc/newrelic-api","docs":null,"changelog":null,"pypi":"https://pypi.org/project/newrelic-api/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["observability","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-06-30","next_check":"2026-07-30","install_tag":null}}