You can use the pm.require method to import packages from your team’s Package Library or external package registries inside scripts in HTTP, gRPC, and GraphQL requests.
The pm.require method accepts the name of a package. Declare the method as a variable if the package has functions or objects you want to call. If the package only has code or instances of the pm object, you don’t need to declare the method as a variable.
Use the following format to import a package from the Package Library:
const variableName = pm.require('@team-domain/package-name');
variableName.functionName()
Use the following format to import an external package from a package registry:
// package imported from npm
const npmVariableName = pm.require('npm:package-name@version-number');
npmVariableName.functionName()
// package imported from jsr
const jsrVariableName = pm.require('jsr:package-name@version-number');
jsrVariableName.functionName()
Postman supports the following JavaScript objects globally in your scripts:
The require method enables you to use the sandbox built-in library modules. To use a library, call the require method, pass the module name as a parameter, and assign the return object from the method to a variable:
require(moduleName:String):function
The supported libraries available for use in the sandbox include:
The following libraries are deprecated and no longer supported:
- atob (use the atob method)
- btoa (use the btoa method)
- crypto-js (use the Web Crypto objects)
- tv4 (use the ajv library)
The following NodeJS modules are also available:
Postman doesn’t support the following in the buffer module: isAscii, isUtf8, resolveObjectURL, transcode, and copyBytesFrom.
Last modified: 2025/11/04