Partnership API user object

The Users entity stores customer information. One or more users can be associated with an account. In addition a specific user may be associated with multiple accounts.

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.

User object attributes

This is the list of attributes in the user object. Ensure you assign the owner attribute to one user when creating a New Relic account.

If you create a new user object with an email address unknown to New Relic, you will receive an email at that address requesting you set a password to activate the login account. Pre-existing addresses will not receive an email.

New Relic recommends a maximum of 1,000 accounts per user. Additional accounts may result in limited access to some New Relic features.

email (REQUIRED for new users)
Type: String
Default: (none)

This attribute is required for new users.

The email address of the user. If a user record already exists for this email address, it will be linked to this account. Any settings in the current user object creation process will be ignored.

Email names containing special characters require URL encoding. For example, instead of +, use the URL encoded substitution %2B.

password (REQUIRED for new users)
Type: String
Default: (none)

This attribute is required for new users.

The password for this user is ignored if the email address matches a pre-existing user record. As of Partnership API version 2, passwords passed as part of an account creation call must meet each of the following minimum requirements for complexity:

  • Eight to 50 characters in length
  • Only letters, numbers, or special characters (see list of allowed special characters below). Spaces are not allowed.
  • At least one letter (a-z, A-Z)
  • At least one number or special character (0-9)
    Special characters allowed include ~ ` ! @ # $ % ^ & * ( ) _ - + = { [ } ] : ; " ' < , > . ? / | \

Passwords passed as part of an account provisioning call that do not conform to this format will generate an error and cause the operation to fail.

first_name (REQUIRED for new users)
Type: String
Default: (none)

This attribute is required for new users.

The first name for this user.

last_name (REQUIRED for new users)
Type: String
Default: (none)

This attribute is required for new users.

The last name for this user.

owner
Type: Boolean
Default: False

A flag to indicate whether this user is the owner of the account. When creating a New Relic account, you must assign one user an owner role.

role (REQUIRED for new users)
Type: String
Default: (none)

This attribute is required for new users.

The role for this person:

  • admin
  • user
  • restricted

User calls

Here are the URL patterns for user-related 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 users of an account.
GET /api/v2/partners/:PARTNER_ID:/accounts/:ACCOUNT_ID:/users
Update the role of a person in the account.
PUT /api/v2/partners/:PARTNER_ID:/accounts/:ACCOUNT_ID/users/:ID

Create (add) a user to an account.

Only one user may be created per POST operation.

POST /api/v2/partners/:PARTNER_ID:/accounts/:ACCOUNT_ID:/users

Delete a user from an account.

Deleting a user removes that user from the specified account. Owners cannot be removed from accounts via the Partnership API.

DELETE /api/v2/partners/:PARTNER_ID:/accounts/:ACCOUNT_ID:/users/:ID

User object JSON example

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

User object JSON request
{
  "users": [
    {
      "email": "jsmith@gmail.com",
      "password": "testing123",
      "first_name": "John",
      "last_name": "Smith",
      "owner": true,
      "role": "admin"
    }
  ]
}
JSON response

Here is an example of a JSON response listing users for the account.

{
  "users": [
    {
      "id": 164814,
      "email": "user-name1@company.com",
      "role": "admin",
      "owner": 0
    },
    {
      "id": 208797,
      "email": "user-name2@company.com",
      "role": "admin",
      "owner": 0
    },
    {
      "id": 208804,
      "email": "user-name3@company.com",
      "role": "user",
      "owner": 1
    }
  ]
}

User object API examples

Here are examples of API calls using the Partnership API user 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/12345/users

Response:

  {"users":[{"id":12345,"email":"xx@newrelic.com","role":"admin","owner":1}]}

Accounts with more than 1,000 users will return a paginated response.

To specify a page, add the ?page= parameter to the query.

Create

Only a single new users object can be created per POST command.

Create request:

  curl -X POST \
    -H 'x-api-key:PARTNER_ACCOUNT_KEY' \
    -H 'Content-Type:application/json' \
    -d '{"users":[{"email": "foobar@newrelic.com", "password":"password1", "first_name":"John", "last_name":"Doe", "role":"admin" }]}' \
    https://rpm.newrelic.com/api/v2/partners/:PARTNER_ID/accounts/12345/users

Response (line breaks are for readability):

  {"users":[{"id":12345,"email":"xx@newrelic.com","role":"admin","owner":1},
  {"id":23456,"email":"foobar@newrelic.com","role":"admin","owner":0}]}
Update

Update request:

  curl -X PUT \
    -H 'x-api-key:PARTNER_ACCOUNT_KEY' \
    -H 'Content-Type:application/json' \
    -d '{"users":[{"role": "restricted"}]}' \
    https://rpm.newrelic.com/api/v2/partners/:PARTNER_ID/accounts/12345/users/23456

Response (line breaks are for readability)

  {"users":[{"id":12345,"email":"xx@newrelic.com","role":"admin","owner":1},
  {"id":23456,"email":"foobar@newrelic.com","role":"restricted","owner":0}]}
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/12345/users/23456

Response: No response body.

For more help

Additional documentation resources include:

Recommendations for learning more: