Store secure credentials for scripted browsers and API tests

New Relic Synthetics gives you the option to use secure credentials in your scripted monitor in order to securely store sensitive information like passwords, API keys, and user names. This document explains rules for using this feature, and explains how to create and update secure credential settings.

Access to this feature depends on your subscription level.

What are secure credentials?

New Relic Synthetics gives you option to use secure credentials to store critical information, such as passwords, API keys, user names, etc. This prevents New Relic users of scripted monitors from viewing, updating, or deleting these values unless they have explicit permissions. These credentials are securely stored using AES-GCM 256-bit encryption at rest with keys managed by Amazon KMS.

You can set secure credentials via the UI or via the API.

Requirements and limits

Before using secure credentials, review these requirements and guidelines:

Applicable monitors

The secure credentials feature is available only for Synthetics scripted browsers and API test monitors.


Account administrators can control which users can create, view, or delete secure credentials by managing users' permissions through the Synthetics Permissions page.


You can have a maximum of 1,000 secure credentials.

Add or update secure credentials

You can add or update secure credentials using the UI or the Synthetics REST API.

To add, view, edit, or delete a secure credential for a scripted browser or API test monitor from the Synthetics UI:

  1. Go to > Secure credentials.
  2. Follow the UI instructions to add [plus-circle icon], edit [edit icon], or delete [delete icon] a secure credential, then save any additions or changes you make.
    • Tips for creating the Key: choose a user name or other meaningful key name to identify the secure credential. Use alphanumeric or underscore _ characters.
    • Tips for creating the Value: Use any combination of alphanumeric or special characters. 3000 characters maximum. The value is not accessible via the API.
  3. Associate the secure credential with a scripted browser or API test by editing the script.

For a blog post that walks you through using secure credentials, see Create faster and safer monitors with secure credentials.

After you add the secure credential to the script, the Secure credentials user interface will show how many scripted monitors use that credential. This number is approximate and only updates after a monitor with a secure credential has actually been run.

Synthetics: Secure keys 05.25.17 > Secure credentials: After you add the secure credential via the Synthetics UI, edit the script for your scripted browser to use it.

Update the script

When using the Synthetics UI editor to create scripted browsers or API test monitors, follow these guidelines:

Script Guidelines

Anywhere in the script where you reference the secure credential, it is accessed via the reserved New Relic $secure JavaScript object with dot notation. For example, $secure.MY_SECURE_CREDENTIAL. Properties on $secure are not accessible through bracket notation.

Existing credentials

To view or select from a list of available secure credentials:

  • Type $secure.


  • Select from the dropdown in the editor UI.

Validation To validate the secure credential, follow standard procedures to test the script or write an API test.

Any changes to the secure credential's value will automatically take effect across all monitors that use it. You do not need to also update the script.

Exception: If you update the script and jobs are already processing, the secure credential change will not take effect until the next time the job begins.

Security for secure credentials

To ensure the security of your secure credentials, New Relic scrubs the secure value out of all data that goes to results in New Relic Synthetics, New Relic Insights, and New Relic Alerts. New Relic employees cannot access secure credential values and must be added to the account to be able to view secure credentials.


A secure credential is named PASSWORD and the value is Pass123!. New Relic replaces Pass123! with _SECURECREDENTIAL_

For example, a script includes:

  $browser.get("" + $secure.PASSWORD)

The script results will show that New Relic Synthetics went to, even though it actually went to!. This ensures the value of the secure credential will not appear in the results.

Redacted info

We currently redact the following from the results of your monitor:

  • The exact values of your secure credentials
  • Any percent-encoded values of your secure credentials

For more help

Recommendations for learning more: