Postman provides JavaScript APIs with the pm object, enabling you to test and access request and response data in your test scripts run in the Postman Sandbox. You can use the pm object to access request and response details, write assertions, and access and use variables. You can also use the pm object to send HTTP requests and other meta information in the Postman Sandbox.
Use the pm.cookies methods in scripts to access and manipulate cookies. To learn more, see Access cookies in Postman scripts.
Reference requests and responses with the pm.request and pm.response objects in scripts. Streaming protocols also return a pm.message object. The pm.info object contains meta info related to the request and script Use the pm.sendRequest method in your scripts to send requests in Postman. To learn more, see Reference Postman requests in scripts, Use scripts to send requests in Postman, Reference request metadata in scripts and Reference message data in scripts.
The pm.execution object provides information and context about requests and their responses during a collection run, such as sending requests or which request is running, its position in a collection, and run-related metadata. To learn more, see Use scripts in collection runs.
Access and manipulate different variable types and scopes in your scripts. To learn more, see Reference variables in Postman scripts.
The pm.visualizer object enables you to visually represent your API’s request responses with the Postman Visualizer. To learn more, see Script Postman visualizations.
Access and manipulate vault secrets in your scripts with the pm.vault methods. To learn more, see Reference vault secrets in Postman scripts.
Use the pm.test and pm.expect methods in your scripts to add test specifications and assertions. To learn more, see Writing tests and assertions in scripts.
The pm.require method enables you to import packages from your team’s Package Library or external package registries inside scripts in HTTP, gRPC, and GraphQL requests. To learn more, see Import packages into your scripts.
Last modified: 2025/11/04