Contact Us
A close up view of a typewriter shown from above.

Use NetSuite API Secrets in SuiteScript

Context

API Secrets are one of the safest ways to store API keys and other secure credentials in NetSuite. They can then be used in SuiteScripts to make authenticated calls. See the simple example below.

function fetchAPISecret() {
    return https.createSecureString({
        input: '{custsecret_sensepass_api_key}',
    });
}S
  • Use the “https” module to pull the secret API key from the saved custom object in NetSuite.
  • Be sure to pass your API Secret ID as a string.

Note: You will not be able to log or read the secret key in your script. But you can assume it is there to be used.

See Create an API Secret in NetSuite for instructions on how to generate an API Secret.

Related Articles

Tagged with Training, Security & Permissions, Integration