Postman CLI webhook commands (postman webhook)
Postman CLI webhook commands (postman webhook)
This topic covers webhook commands for the Postman CLI.
You can use the postman webhook commands to create, list, delete, and manage webhooks in a workspace directly from the CLI. You can check the status of a webhook and start or pause it as needed. You can also forward events received on a webhook to your local server to aid development and debugging, as well as list, inspect, and replay the requests a webhook has received. In each of these operations, you have the choice to pass either the Webhook URL, which is available by clicking Webhook URL on your Webhooks tab, or the Webhook ID, which is available by clicking the
Webhook details button on the right sidebar.
For more information about webhooks in Postman, see Webhooks.
You can find the webhook ID using the postman webhook list command or postman webhook status command.
postman webhook create
This command creates a new webhook in the specified workspace. Add the command to your CI/CD script or agent workflow to automate webhook provisioning.
To use this command, sign in to Postman with the postman login command.
Usage
Options
The name for the webhook.
The ID of the workspace in which to create the webhook.
Example
postman webhook list
This command lists all webhooks in the specified workspace, along with their IDs and current status.
To use this command, sign in to Postman with the postman login command.
Usage
Options
The ID of the workspace whose webhooks you want to list.
Example
postman webhook delete
This command permanently deletes a webhook by its ID. This action can’t be undone.
To use this command, sign in to Postman with the postman login command.
Usage
The unique identifier of the webhook to delete.
The unique URL of the webhook to delete.
Options
The ID of the Postman workspace containing the webhook.
Your Postman API key.
Example
postman webhook status
This command shows details for a webhook, including its title, current status (active or inactive), invoke URL, and creation date.
To use this command, sign in to Postman with the postman login command.
Usage
The unique identifier of the webhook.
The unique URL of the webhook.
Options
The ID of the Postman workspace containing the webhook.
Your Postman API key.
Example
postman webhook start
This command starts a paused or inactive webhook, enabling it to begin receiving events.
To use this command, sign in to Postman with the postman login command.
Usage
The unique identifier of the webhook to start.
The unique URL of the webhook to start.
Example
postman webhook pause
This command pauses an active webhook, stopping it from receiving events. You can resume it at any time using postman webhook start.
To use this command, sign in to Postman with the postman login command.
Usage
The unique identifier of the webhook to pause.
The unique URL of the webhook to pause.
Example
postman webhook forward
This command forwards events received on a webhook from external services (such as Stripe or Slack) to a port on your local server. This is useful for developing and debugging webhook handlers without exposing a public endpoint.
The command listens for incoming events on the specified webhook and relays them to your local server at the given port. The forwarding runs until you stop it by pressing Control+C or Ctrl+C.
To use this command, sign in to Postman with the postman login command.
Usage
The unique identifier of the webhook whose events you want to forward.
The local port number to forward events to.
The unique URL of the webhook whose events you want to forward.
The local port number to forward events to.
Example
postman webhook requests
These commands enable you to list, inspect, and replay the requests a webhook has received. In each command, you can pass either the webhook ID or the webhook URL.
To use these commands, sign in to Postman with the postman login command.
postman webhook requests list
This command lists the recent requests a webhook has received, along with each request’s ID, event type, method, path, response status, and the time it was received. Use a request ID from this list with the postman webhook requests describe and postman webhook requests replay commands.
Usage
The unique identifier of the webhook.
The unique URL of the webhook.
Options
The ID of the Postman workspace containing the webhook. If omitted, the CLI uses the workspace from your local Postman configuration.
Cursor value for paginating through results. The command returns up to 20 requests per page. When more are available, it prints a Next cursor value that you can pass to --cursor to fetch the next page.
Your Postman API key.
Example
postman webhook requests describe
This command shows the full details for a single request a webhook received, including its headers, body, and any recorded responses. If the webhook ran scripts on the request, the output also includes a test report in the same format as a collection run’s test report. Use postman webhook requests list to find the request ID.
Usage
The unique identifier of the webhook.
The unique identifier of the request to describe.
The unique URL of the webhook.
The unique identifier of the request to describe.
Options
The ID of the Postman workspace containing the webhook. If omitted, the CLI uses the workspace from your local Postman configuration.
Show the execution logs from any scripts the webhook ran on the request.
Your Postman API key.
Example
postman webhook requests replay
This command replays a request a webhook received. Postman forwards or responds to the request through the routing rule configured for the webhook. Use postman webhook requests list to find the request ID.
Usage
The unique identifier of the webhook.
The unique identifier of the request to replay.
The unique URL of the webhook.
The unique identifier of the request to replay.
Options
The ID of the Postman workspace containing the webhook. If omitted, the CLI uses the workspace from your local Postman configuration.
Your Postman API key.
Example
postman webhook scripts set
This command creates or updates the script a webhook runs. Author the script in a JavaScript or TypeScript file, then use this command to apply it to the webhook. For more information about webhook scripts, see Webhooks.
To use this command, sign in to Postman with the postman login command.
Usage
The unique identifier of the webhook.
The path to the JavaScript or TypeScript file containing the script.
Options
The event that runs the script. Specify onEvent to run the script when the webhook receives a request, or onResponse to run it when the webhook sends a response.
The ID of the Postman workspace containing the webhook. If omitted, the CLI uses the workspace from your local Postman configuration.
Your Postman API key.
Example
postman webhook auth
These commands enable you to view and set the authentication that a webhook requires on incoming requests. In each command, you can pass either the webhook ID or the webhook URL.
To use these commands, sign in to Postman with the postman login command.
postman webhook auth get
This command shows the authentication details for a webhook, including the authentication type, where the webhook reads credentials from, and the header or query parameter name. The output never includes credential values. If the webhook has no authentication, the command reports that none is configured.
Usage
The unique identifier or URL of the webhook.
Options
The ID of the Postman workspace containing the webhook. If omitted, the CLI uses the workspace from .postman/resources.yaml or .postman/config.json.
Your Postman API key.
The request timeout in milliseconds.
Prints the result as JSON.
Example
postman webhook auth set
This command sets Basic or API key authentication for a webhook, or turns authentication off. Credential values can be literal values or variable references, such as '{{webhookApiKey}}'.
Usage
The unique identifier or URL of the webhook.
Options
The authentication type. Use none to turn authentication off. Don’t combine none with any credential option.
The Basic auth username or a variable reference. Use with --type basic, together with --password.
The Basic auth password or a variable reference. Use with --type basic, together with --username.
The API key value or a variable reference. Required with --type api-key. Don’t use it with --type basic.
Where the webhook reads incoming credentials from.
The header or query parameter name that carries the credentials. Defaults to Authorization for Basic auth and x-api-key for API key auth.
The ID of the Postman workspace containing the webhook. If omitted, the CLI uses the workspace from .postman/resources.yaml or .postman/config.json.
Your Postman API key.
The request timeout in milliseconds.
Prints the result as JSON.
Examples
postman webhook environment
These commands enable you to view and set the cloud environment associated with a webhook. In each command, you can pass either the webhook ID or the webhook URL.
To use these commands, sign in to Postman with the postman login command.
postman webhook environment get
This command prints the ID of the cloud environment associated with a webhook.
Usage
The unique identifier or URL of the webhook.
Options
The ID of the Postman workspace containing the webhook. If omitted, the CLI uses the workspace from .postman/resources.yaml or .postman/config.json.
Your Postman API key.
The request timeout in milliseconds.
Prints the result as JSON.
Example
postman webhook environment set
This command associates a cloud environment with a webhook. The environment must be a cloud environment ID. Local files aren’t supported.
Usage
The unique identifier or URL of the webhook.
The UID of the cloud environment to associate with the webhook.
Options
The ID of the Postman workspace containing the webhook. If omitted, the CLI uses the workspace from .postman/resources.yaml or .postman/config.json.
Your Postman API key.
The request timeout in milliseconds.
Prints the result as JSON.