Partnership API sub-account object

Accounts are the basic administrative unit of the New Relic system. As a partner, use the sub-account object with the Partnership API to create sub-accounts. To manage existing master or sub-accounts, use the Partnership API 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.

Sub-account object attributes

Here are the Partnership API sub-account object's attributes.

name (REQUIRED)
Type: String
Default: (none)

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.
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)
Type: Array
Default: (none)

An array defining a list of users. When you create the sub-account, only one user can be defined: the account Owner. To add additional users, use the Partnership API user object.

password (REQUIRED)
Type: String
Default: (none)

If you are creating a sub-account with an existing user as the account Owner, the password must match the user's current password.

Sub-accounts can also be created via the master account's Account settings page in the New Relic UI.

Sub-account API calls

Here is the URL pattern to create sub-accounts. Notice that the Parent Account ID must be specified. If using this URL pattern, send the JSON object along with an HTTP header containing the Partner API key. For example:

POST .../api/v2/partners/:PARTNER_ID/accounts/:PARENT_ACCOUNT_ID/sub_accounts​
x-api-key: :PARTNER_ACCOUNT_KEY
Content-Type: application/json

{ JSON data }
Call Resource URL pattern
Create a sub-account with the given parameters.
POST /api/v2/partners/:PARTNER_ID/accounts/:PARENT_ACCOUNT_ID/sub_accounts


JSON example

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

Sub-account object JSON request
{
  "account": {
    "name": "Sample Sub-Account",
    "users": [
      {
        "email": "sample_user@sample.org",
        "password": "XXXXXXXX",
        "owner": true,
        "role": "admin",
        "first_name": "Sample",
        "last_name": "User"
      }
    ],
    "allow_api_access": true,
    "phone_number": "555-555-5555"
  }
}
JSON response
{
  "id": XXXXXX,
  "name": "Sample Account",
  "status": "pending",
  "license_key": "caf8247360d8db295c142c72138fa8fb28df1403",
  "api_key": "86f818b6d81668b6c034661396b71c25bb323d8b8df1403",
  "browser_monitoring_key": "66617123f5",
  "allow_api_access": true,
  "high_security": false,
  "testing": null,
  "partner_external_identifier": null,
  "parent_account_id":XXXXXX,
  "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"
  }
}

Sub-account object API examples

Here is an example of an API call using the Partnership API sub-account object.

Create

Request:

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

Response (line breaks are for readability):

{
  "id": XXXXXX,
  "name": "Sample Sub-Account",
  "status": "pending",
  "license_key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "api_key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "browser_monitoring_key": "xxxxxxxxxx",
  "allow_api_access": false,
  "high_security": false,
  "testing": null,
  "partner_external_identifier": null,
  "parent_account_id":XXXXXX,
  "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"
  }
}

For more help

If you need more help, check out these support and learning resources: