With the synthetic monitoring REST API, you can make API calls to change or retrieve secure credentials data. This document explains the API requirements and contains API curl command examples.
For general guidelines for setting secure credentials and setting them in the UI, see Secure credentials.
Important
You can now manage your secure credentials with our NerdGraph API.
An account's rate of requests is limited to three requests per second. Requests that exceed this threshold will return a 429 response code.
A key's value cannot be accessed via the API; an unauthorized user would not have access to the secure key values.
API examples
To send a secure credential to your New Relic account, send a POST request to https://synthetics.newrelic.com/synthetics/api/v1/secure-credentials with a JSON payload that describes the secure credential. Here's an example:
Here's an example of doing this with a curl command:
curl -v \
-X POST -H "Api-Key:$API_KEY" \
-H 'Content-Type: application/json' https://synthetics.newrelic.com/synthetics/api/v1/secure-credentials \
-d '{ "key": "MYKEY", "value": "my value", "description": "Description of MYKEY" }'
A successful request will return a 201 Created response, with the URI of the newly-created secure credential specified in the location header. Possible error codes include:
303 See Other: The specified key already exists. The returned location header will contain the URI to the key.
400 Bad Request: Key too long or missing, value too long or missing, non-parsable JSON payload.
To view a list of all the secure credentials in your New Relic account, send a GET request to https://synthetics.newrelic.com/synthetics/api/v1/secure-credentials. For example: