# postman-sandbox

> Sandbox for Postman Scripts to run in Node.js or browser

Latest version **6.9.0** (published 2026-10-22) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install postman-sandbox
pnpm add postman-sandbox
yarn add postman-sandbox
bun add postman-sandbox
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 6.9.0 |
| Published | 2026-10-22 |
| First published | 2016-11-30 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=18 |
| Dependencies | 4 |
| Unpacked size | 5 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 131 |
| Author | Postman Inc. |
| Maintainers | shamasis, kamalaknn, codenirvana, appurvamurawat, kdevakumaran |
| Keywords | contextify, postman, sandbox, vm |

## Links

- npm: https://www.npmjs.com/package/postman-sandbox
- Repository: https://github.com/postmanlabs/postman-sandbox
- Homepage: https://github.com/postmanlabs/postman-sandbox#readme
- Issues: https://github.com/postmanlabs/postman-sandbox/issues
- npm.io page: https://npm.io/package/postman-sandbox

## Dependencies (4)

- [uvm](https://npm.io/package/uvm.md) 4.0.2
- [lodash](https://npm.io/package/lodash.md) 4.18.1
- [postman-collection](https://npm.io/package/postman-collection.md) 5.3.1
- [teleport-javascript](https://npm.io/package/teleport-javascript.md) 1.0.0

## Recent versions

- 6.9.0 (latest) — 2026-10-22
- 6.6.1-beta.1 (beta) — 2026-02-23
- 6.8.0 — 2026-10-19
- 6.7.4 — 2026-08-10
- 6.7.3 — 2026-07-28
- 6.7.2 — 2026-07-21
- 6.7.1 — 2026-07-21
- 6.7.0 — 2026-05-05
- 6.6.1 — 2026-02-25
- 6.6.0 — 2026-02-17
- 6.5.0 — 2026-02-04
- 6.4.0 — 2026-01-14
- 6.3.0 — 2025-12-01
- 6.2.2 — 2025-10-30
- 6.2.1 — 2025-09-19
- … 146 more at https://npm.io/package/postman-sandbox/versions

## README

# Postman Sandbox [![Build Status](https://github.com/postmanlabs/postman-sandbox/actions/workflows/ci.yml/badge.svg)](https://github.com/postmanlabs/postman-sandbox/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/postmanlabs/postman-sandbox/branch/develop/graph/badge.svg)](https://codecov.io/gh/postmanlabs/postman-sandbox)

Module that unifies execution of third-party JavaScript within Node.js and Browser.

> This module is part of Postman Runtime Core and is not intended for independent use.
>
> If you are looking to execute collections, you should bee using [Newman](https://github.com/postmanlabs/newman)

## Usage
```js
var Sandbox = require('postman-sandbox'),
    context;

Sandbox.createContext(function (err, ctx) {
    if (err) {
        return console.error(err);
    }

    ctx.execute(`// code here`, {}, {}, function (err) {
        if (err) {
            return console.error(err);
        }
        console.log('executed')
    });
});
```

## Sandbox Environment

The following section outlines the API available inside sandbox scripts

### pm

- pm.test
- pm.info
- pm.vault
- pm.globals
- pm.cookies
- pm.execution
- pm.variables
- pm.visualizer
- pm.sendRequest
- pm.environment
- pm.iterationData
- pm.collectionVariables

#### pre-request script specials

- pm.request

#### test script specials

- pm.request
- pm.response

## Events fired from Sandbox
- pong
- error
- console
- execution
- execution.error
- execution.error.*
- execution.request.*
- execution.run_collection_request.*
- execution.result.*
- execution.cookies.*
- execution.skipRequest.*

## Events responded to
- ping
- execute
- execution.abort.*
- execution.response.*
- execution.run_collection_request_response.*
- execution.cookies.*

## Contributing

### Debug in browser

To debug tests in Chrome's DevTools, start tests using `npm run test-browser -- --debug` and click `DEBUG`.

---
_Source: https://npm.io/package/postman-sandbox · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
