Partnership API account object

Accounts are the basic administrative unit of the New Relic system. As a partner, use the account object with the Partnership API to manage your accounts. To create a sub-account, use the sub-account object.

This information is for version 2 of the Partnership API. Use v2 for all new integrations. Earlier versions have been deprecated. If you have problems with an older integration, upgrade to version 2.

Account object attributes

Here are the Partnership API account object's attributes.

name (REQUIRED to create an account)
Type: String
Default: (none)

The account name attribute is required for new accounts.

This name must be unique in New Relic's database. If the specified name is not unique, it will be auto-incremented with a numeric suffix as follows:

conflicting_name_1
conflicting_name_2
etc.
phone_number
Type: String
Default: (none)

Primary contact phone number for the account.

allow_api_access
Type: Boolean
Default: False

This flag allows API access to application data. This must be set to true for partnerships remotely administering accounts.

testing
Type: Boolean
Default: False

Use this flag to indicate a test account. Test accounts are assumed to contain garbage data and are ignored by internal systems. The data they generate may be deleted at any time.

users (REQUIRED to create an account)
Type: Array
Default: (none)

An array defining a list of users. When you first create the New Relic account, this field is required, and only one user can be defined: the account Owner. To add additional users, use the Partnership API user object.

subscriptions (REQUIRED to create an account)
Type: Array
Default: (none)

An array defining a list of subscriptions. The subscriptions attribute is required for new accounts, but the array may be empty.

If you provide an empty subscriptions array, the Partnership API creates accounts with the default New Relic product tiers for your partnership. To update subscription information, use the Partnership API subscription object.

To specify an empty JSON array, use this format:

subscriptions: [  ]

Do not use subscriptions: [ {} ] to specify an empty array.

The account API does not include an attribute to create a sub-account. Instead, to create sub-accounts, use the master account's Account settings page in the New Relic UI.

Account API calls

Here are the URL patterns for account API functions. If using this URL pattern, send an HTTP header containing the Partner API key along with the JSON request body. For example:

GET .../api/v2/partners/:PARTNER_ID/accounts/:ID
x-api-key: :PARTNER_ACCOUNT_KEY
Content-Type: application/json

{ JSON data }
Call Resource URL pattern
List (index) all accounts of a partner.
GET /api/v2/partners/:PARTNER_ID:/accounts
Show the attributes of an account.
GET /api/v2/partners/:PARTNER_ID:/accounts/:ID
Update the attributes of an account.
PUT /api/v2/partners/:PARTNER_ID:/accounts/:ID
Create an account with the given parameters.
POST /api/v2/partners/:PARTNER_ID:/accounts
Cancel an account.
DELETE /api/v2/partners/:PARTNER_ID:/accounts/:ID

Status definitions

When an account is created or listed with an API call, the account status is included automatically.

Account status Definition
pending Free account created, but primary admin is not yet activated.
paid_pending Account created with a paid subscription, but the primary admin is not yet activated.
new Free account, active primary admin, no application data has been collected.
paid_new Paid subscription, active primary admin, no application data has been collected.
active Free subscription, receiving application data.
paid_active Paid subscription, receiving application data.
upgraded Account's subscription was upgraded.
downgraded Account's subscription was downgraded.
cancelled The New Relic account subscription has been cancelled.
suspended The New Relic account has been suspended because the primary admin has not validated their email address.

JSON example

Here is an example of a JSON request and response using the Partnership API account object.

Account object JSON request
{
  "account": {
    "name": "Sample Account",
    "application_type": "ruby",
    "users": [
      {
        "email": "sample_user@sample.org",
        "password": "XXXXXXXX",
        "owner": true,
        "role": "admin",
        "first_name": "Sample",
        "last_name": "User"
      }
    ],
    "subscriptions": [
      {
        "product_id": 4,
        "quantity": 10
      },
        {
        "product_id": 10,
        "quantity": 0
      }
    ],
    "allow_api_access": true,
    "phone_number": "555-555-5555"
  }
}
JSON response
{
  "id": XXXXXX,
  "name": "Sample Account",
  "status": "pending",
  "license_key": "caf8247360d8db295c142c72138fa8fb28df1403",
  "api_key": "86f818b6d81668b6c034661396b71c25bb323d8b8df1403",
  "data_access_key": "a65a8ba22a269975c794819e2a5b05899eb98b248df1403",
  "browser_monitoring_key": "66617123f5",
  "allow_api_access": true,
  "high_security": false,
  "testing": null,
  "partner_external_identifier": null,
  "subscription": {
    "id": XXXXXX,
    "starts_on": "2016-05-17",
    "expires_on": null,
    "annual_renewal_on": null,
    "products": [
      {
        "product_id": 4,
        "name": "Pro",
        "units": 10,
        "price": 1990.0
      },
      {
        "product_id": 10,
        "name": "Mobile Lite",
        "units": 0,
        "price": 0.0
      },
      {
        "product_id": 20,
        "name": "Browser Lite",
        "units": 0,
        "price": 0.0
      },
      {
        "product_id": 16,
        "name": "Insights None",
        "units": 0,
        "price": 0.0
      },
      {
        "product_id": 23,
        "name": "Synthetics Lite",
        "units": 0,
        "price": 0.0
      }
    ]
  },
  "primary admin": {
    "id": XXXXXX,
    "email": "sample_user@sample.org",
    "first_name": "Sample",
    "last_name": "User",
    "state": "active"
  }
}

Account object API examples

Partnerships with more than 1000 accounts return a paginated response. To specify a page, add the following parameter to the query:

?page=

Here are examples of API calls using the Partnership API account object.

List

List request:

curl -X GET \
    -H 'x-api-key:PARTNER_ACCOUNT_KEY' \
    -H 'Content-Type:application/json' \
    https://rpm.newrelic.com/api/v2/partners/:PARTNER_ID/accounts

Response (line breaks are for readability):

{
  "accounts": [
    {
      "id": XXXXXX,
      "name": "Sample Account",
      "status": "pending",
      "license_key": "caf8247360d8db295c142c72138fa8fb28df1403",
      "api_key": "86f818b6d81668b6c034661396b71c25bb323d8b8df1403",
      "data_access_key": "a65a8ba22a269975c794819e2a5b05899eb98b248df1403",
      "browser_monitoring_key": "66617123f5",
      "allow_api_access": true,
      "high_security": false,
      "testing": null,
      "partner_external_identifier": null,
      "subscription": {
        "id": XXXXXX,
        "starts_on": "2016-05-17",
        "expires_on": null,
        "annual_renewal_on": null,
        "products": [
          {
            "product_id": 4,
            "name": "Pro",
            "units": 10,
            "price": 1990.0
          },
          {
            "product_id": 10,
            "name": "Mobile Lite",
            "units": null,
            "price": 0.0
          },
          {
            "product_id": 20,
            "name": "Browser Lite",
            "units": 0,
            "price": 0.0
          },
          {
            "product_id": 16,
            "name": "Insights None",
            "units": 0,
            "price": 0.0
          },
          {
            "product_id": 23,
            "name": "Synthetics Lite",
            "units": 0,
            "price": 0.0
          }
        ]
      },
      "primary admin": {
        "id": XXXXXX,
        "email": "sample_user@sample.org",
        "first_name": "Sample",
        "last_name": "User",
        "state": "active"
      }
    }
  ]
}
Show

Request:

  curl -X GET \
    -H 'x-api-key:PARTNER_ACCOUNT_KEY' \
    -H 'Content-Type:application/json' \
    https://rpm.newrelic.com/api/v2/partners/:PARTNER_ID/accounts/:ACCOUNT_ID

Response (line breaks are for readability):

{
  "id": XXXXXX,
  "name": "Sample Account",
  "status": "pending",
  "license_key": "caf8247360d8db295c142c72138fa8fb28df1403",
  "api_key": "86f818b6d81668b6c034661396b71c25bb323d8b8df1403",
  "data_access_key": "a65a8ba22a269975c794819e2a5b05899eb98b248df1403",
  "browser_monitoring_key": "66617123f5",
  "allow_api_access": true,
  "high_security": false,
  "testing": null,
  "partner_external_identifier": null,
  "subscription": {
    "id": XXXXXX,
    "starts_on": "2016-05-17",
    "expires_on": null,
    "annual_renewal_on": null,
    "products": [
      {
        "product_id": 4,
        "name": "Pro",
        "units": 10,
        "price": 1999.0
      },
      {
        "product_id": 10,
        "name": "Mobile Lite",
        "units": 0,
        "price": 0.0
      },
      {
        "product_id": 20,
        "name": "Browser Lite",
        "units": 0,
        "price": 0.0
      },
      {
        "product_id": 16,
        "name": "Insights None",
        "units": 0,
        "price": 0.0
      },
      {
        "product_id": 23,
        "name": "Synthetics Lite",
        "units": 0,
        "price": 0.0
      }
    ]
  },
  "primary admin": {
    "id": 00000,
    "email": "sample_user@sample.org",
    "first_name": "Sample",
    "last_name": "User",
    "state": "active"
  }
}
Create

Request:

  curl -X POST \
    -H 'x-api-key:PARTNER_ACCOUNT_KEY' \
    -H 'Content-Type:application/json' \
    -d '{"account":{"name":"Sample Account", "users":[{"email":"sample_user@sample.org", "password":"XXXXXX", "first_name":"Sample", "last_name":"User", "role":"admin", "owner":"true"}],"subscriptions":[{"product_id": 4,"quantity": 10},{"product_id": 10,"quantity": 0}]}}' \
    https://rpm.newrelic.com/api/v2/partners/:PARTNER_ID/accounts/

Response (line breaks are for readability):

{
  "id": XXXXXX,
  "name": "Sample Account",
  "status": "pending",
  "license_key": "caf8247360d8db295c142c72138fa8fb28df1403",
  "api_key": "86f818b6d81668b6c034661396b71c25bb323d8b8df1403",
  "data_access_key": "a65a8ba22a269975c794819e2a5b05899eb98b248df1403",
  "browser_monitoring_key": "66617123f5",
  "allow_api_access": true,
  "high_security": false,
  "testing": null,
  "partner_external_identifier": null,
  "subscription": {
    "id": XXXXXX,
    "starts_on": "2016-05-17",
    "expires_on": null,
    "annual_renewal_on": null,
    "products": [
      {
        "product_id": 4,
        "name": "Pro",
        "units": 10,
        "price": 1999.0
      },
      {
        "product_id": 10,
        "name": "Mobile Lite",
        "units": 0,
        "price": 0.0
      },
      {
        "product_id": 20,
        "name": "Browser Lite",
        "units": 0,
        "price": 0.0
      },
      {
        "product_id": 16,
        "name": "Insights None",
        "units": 0,
        "price": 0.0
      },
      {
        "product_id": 23,
        "name": "Synthetics Lite",
        "units": 0,
        "price": 0.0
      }
    ]
  },
  "primary admin": {
    "id": XXXXXX,
    "email": "sample_user@sample.org",
    "first_name": "Sample",
    "last_name": "User",
    "state": "active"
  }
}
Update

You can only use the Partnership API account object to update the name, phone_number, testing and allow_API_access values. To update subscription and users values, you must use the Partnership API subscription object and Partnership API user object.

Request:

  curl -X PUT \
    -H 'x-api-key:PARTNER_ACCOUNT_KEY' \
    -H 'Content-Type:application/json' \
    -d '{"account":{"name":"Account New Name"}}' \
    https://rpm.newrelic.com/api/v2/partners/:PARTNER_ID/accounts/:ACCOUNT_ID

Response (line breaks are for readability):

{
  "id": XXXXXX,
  "name": "Account New Name",
  "status": "pending",
  "license_key": "caf8247360d8db295c142c72138fa8fb28df1403",
  "api_key": "86f818b6d81668b6c034661396b71c25bb323d8b8df1403",
  "data_access_key": "a65a8ba22a269975c794819e2a5b05899eb98b248df1403",
  "browser_monitoring_key": "66617123f5",
  "allow_api_access": true,
  "high_security": false,
  "testing": null,
  "partner_external_identifier": null,
  "subscription": {
    "id": XXXXXX,
    "starts_on": "2016-05-17",
    "expires_on": null,
    "annual_renewal_on": null,
    "products": [
      {
        "product_id": 4,
        "name": "Pro",
        "units": 10,
        "price": 1999.0
      },
      {
        "product_id": 10,
        "name": "Mobile Lite",
        "units": 0,
        "price": 0.0
      },
      {
        "product_id": 20,
        "name": "Browser Lite",
        "units": 0,
        "price": 0.0
      },
      {
        "product_id": 16,
        "name": "Insights None",
        "units": 0,
        "price": 0.0
      },
      {
        "product_id": 23,
        "name": "Synthetics Lite",
        "units": 0,
        "price": 0.0
      }
    ]
  },
  "primary admin": {
    "id": XXXXXX,
    "email": "sample_user@sample.org",
    "first_name": "Sample",
    "last_name": "User",
    "state": "active"
  }
}
Delete

Request:

  curl -X DELETE \
    -H 'x-api-key:PARTNER_ACCOUNT_KEY' \
    -H 'Content-Type:application/json' \
    https://rpm.newrelic.com/api/v2/partners/:PARTNER_ID/accounts/:ACCOUNT_ID

Response: No response body.

For more help

Recommendations for learning more: