# Pynt for Newman (Postman CLI)

## **What is Newman?**

{% hint style="info" %}
💡 [**Newman**](https://learning.postman.com/docs/collections/using-newman-cli/command-line-integration-with-newman/) is the CLI tool for running Postman collections. It enables you to automate and integrate API tests directly into your CI/CD pipelines.
{% endhint %}

<figure><img src="https://3462681674-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZKwBF6q0tAGXlIih38HL%2Fuploads%2FbqbpQ2aLFYda8GCLvLJF%2FNewman2.png?alt=media&#x26;token=6940c83e-9d3f-4180-98a0-bd5fc91f48d4" alt="" width="133"><figcaption><p>Newman</p></figcaption></figure>

***

## Pynt's Integration with Newman

As part of its [API security testing](https://docs.pynt.io/documentation/api-security-testing) suit, Pynt allows seamless integration with Newman.

Pynt for Newman allows you to integrate advanced API security testing directly into your command-line workflows. By combining the power of Newman with Pynt, you can automate security scans alongside your regular API tests, ensuring that each API run is thoroughly tested for vulnerabilities.

With Pynt’s context-aware security testing capabilities, you can enhance your Postman collections with automated security checks, all executed via Newman. This integration is perfect for teams looking to streamline their security testing within their existing CI/CD processes, providing a seamless way to ensure that your APIs are protected against potential threats.

After each run, Pynt generates detailed reports that highlight any security risks found during testing, giving you the insights needed to address vulnerabilities promptly. By integrating Pynt with Newman, you can maintain the flexibility and efficiency of your command-line testing while significantly boosting your API security.

***

## Setup

1. First, make sure Pynt's [prerequisites](https://docs.pynt.io/documentation/api-security-testing/prerequisites-for-running-pynt-scans) are met.
2. Follow the instructions to install Pynt container [here](https://docs.pynt.io/documentation/api-security-testing/how-to-install-pynt-cli).

***

## Run Pynt CLI Command for Newman

### Basic usage

```bash
pynt newman --collection <path to collection>
```

### Required arguments

```
--collection - Postman collection file name
```

### Optional arguments

{% code overflow="wrap" fullWidth="false" %}

```
--environment - Postman environment file name (support multiple files)
--reporters output results to json
--host-ca - path to the CA file in PEM format to enable SSL certificate verification for pynt when running through a VPN.
--return-error - 'all-findings' (warnings, or errors), 'errors-only', 'never' (default), 
```

{% endcode %}

***

## Example

```bash
wget https://raw.githubusercontent.com/pynt-io/pynt/main/goat_functional_tests/goat.postman_collection.json
pynt newman --collection goat.postman_collection.json
```

***

## mTLS Support (Pynt binary only)

Pynt newman supports testing APIs that require mutual TLS (mTLS), allowing you to validate security for endpoints that enforce client certificate authentication.

To run a security test on an mTLS-protected API using Pynt Newman, use the `--ssl-client-cert`, `--ssl-client-key`, and `--ssl-ca-cert` flags to provide the necessary certificates.

#### Example

```bash
pynt newman --collection collection/goat-mtls.postman_collection.json \
  --tls-client-cert certs/client-bundle.pem \
  --tls-client-key certs/client.key \
  --host-ca certs/root.crt \
```

#### Arguments

* `--tls-client-cert` — Path to the client certificate (PEM format, can include full chain)
* `--tls-client-key`— Path to the client private key
* `--host-ca`— Path to the CA certificate used to validate the server certificate

## Specifying Environment variables (Pynt binary only)

To define environment variables for the collection via the command line in a key=value format, use the `--newman-env-var` flag. You can specify one variable per flag, or include multiple flags wrapped in quotes. For example:

{% code overflow="wrap" fullWidth="false" %}

```bash
pynt newman --collection goat.postman_collection.json \\ 
--newman-env-var="key1=test1,env2=test" --newman-env-var v1=v2
# This will run the collection with the following env vars:
# key1=test1
# env2=test
# v1=v2
```

{% endcode %}

{% hint style="info" %}
💡 **Pynt CLI Troubleshooting**: If you're encountering issues with Pynt's CLI, visit the [**Pynt CLI Troubleshooting Guide**](https://docs.pynt.io/documentation/api-security-testing/pynt-scans-troubleshooting/pynt-cli-troubleshooting) for solutions and troubleshooting tips.
{% endhint %}

{% hint style="info" %}
💡 **Still Need Help?** For any questions or troubleshooting, reach out to the [**Pynt Community Support**](https://www.pynt.io/community).
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pynt.io/documentation/security-testing-integrations/pynt-with-api-testing-clis/pynt-for-newman-postman-cli.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
