> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt. For full content including API reference and SDK examples, see https://learning.postman.com/llms-full.txt.

# SDK CLI commands

The Postman CLI provides commands for generating client SDKs from Postman Collections and API specifications, and for managing server-side GitHub connections that automatically open or update pull requests on every successful build. To use the commands, [install](/docs/postman-cli/postman-cli-installation/) the command-line companion for Postman. You can use it from your command line or Postman terminal.

## postman sdk init

The `postman sdk init` command creates or updates the `.postman/config.json` file with your SDK configuration. For more information, see [Create and manage the Postman SDK config file](/docs/sdk-generator/configure/overview/#create-and-manage-the-postman-sdk-config-file).

### Usage

```bash
postman sdk init [options]
```

### Options

Skip prompts and overwrite the existing Postman SDK config file.

Display help for the command.

## postman sdk generate

The `postman sdk generate` command generates a client SDK from a Postman Collection or API specification. The source can be a Postman entity ID (runs a server-side build), a local file path, or a URL (one-off builds). If you encounter errors, see [Generate commands errors and warnings](/docs/sdk-generator/troubleshoot/#generate-command-errors-and-warnings).

When an entity ID is used and a GitHub connection exists (see [`postman sdk connect`](#postman-sdk-connect-github)), the server automatically opens or updates a pull request after every successful build.

The `postman sdk generate` command can also be used to regenerate an SDK. When you generate an SDK, the file hashes are written to a manifest file as change tracking is on by default. You can edit the generated files per your requirements. Add, delete, or make changes to existing files, and then run the `postman sdk generate` command again. The CLI compares file hashes against the manifest to detect the changes and merges them to the regenerated SDK.

To use this command, sign in to Postman with [the `postman login` command](/docs/postman-cli/postman-cli-auth#postman-login). Learn more about [common authentication and authorization errors](/docs/sdk-generator/troubleshoot#common-authentication-and-authorization-errors).

### Usage

```bash
postman sdk generate <id or path> [options]
```

### Arguments

Provide one of the following arguments:

Postman Collection ID or Specification ID (UUID format).

File path to a collection (`.json`) or specification (`.json`, `.yaml`, `.yml`) file.

URL to a publicly accessible collection or specification file.

When using an ID, the SDK generation updates the version in Postman Cloud. The command automatically detects whether the ID is a collection or specification. Only UUIDs are supported (for example, `12345-abcde-67890` or `12345678-1234-1234-1234-123456789012`). To get the collection or specification ID, in Postman, click <img alt="Info icon" src="https://assets.postman.com/postman-docs/aether-icons/state-info-stroke-small.svg#icon" width="12px" /> **Info** in the right sidebar and copy the ID.

When using a file path or URL, the command creates a one-off build that doesn't update the Postman Cloud version.

### Options

Target output(s) for SDK and CLI generation. Specify one or more outputs: `typescript`, `python`, `java`, `kotlin`, `csharp`, `go`, `php`, `ruby`, `rust`, or `cli`.

Generate SDKs in all supported languages.

Select the directory to save the downloaded SDKs.

Select the name for the generated SDK package.

Select the version number for the generated SDK.

Path to the SDK generation configuration file (JSON).

Skip prompts and overwrite the existing Postman SDK configuration file.

Overwrite existing files without confirmation.

Show detailed generation progress and logs.

Set the build log detail level. `warn` shows warnings and errors inline. `info` expands all log entries.

Turn off change tracking. By default, file hashes are written into `.manifest.json` to enable edit detection on the next regeneration.

Skip custom code merge even if edits are detected, and force a clean regeneration of the SDK that overwrites all files.

Control how the generator handles merge conflicts when you and the generator change the same lines in a file with one of these choices: `mark` adds conflict markers to the file, `ours` keeps your changes and discards the generator's changes, and `theirs` keeps the generator's changes and discards yours.

Skip downloading and saving the generated SDK files to the output directory. This is useful in CI when the build only needs to trigger server-side pull requests.

Display help for the command.

### Examples

#### Generate a TypeScript SDK from a collection ID

```bash
postman sdk generate 12345-abcde-67890 -l typescript --output-dir ./my-sdk
```

#### Generate a Python SDK from a specification ID

```bash
postman sdk generate 67890-fghij-12345 -l python --output-dir ./my-sdk
```

#### Generate a one-off SDK build from a collection file

```bash
postman sdk generate ./my-collection.json -l typescript -o ./my-sdk
```

#### Generate a one-off SDK build from a specification file

```bash
postman sdk generate ./openapi.yaml -l typescript -o ./my-sdk
```

#### Generate a one-off SDK build from a publicly accessible URL

```bash
postman sdk generate https://petstore.swagger.io/v2/swagger.json -l typescript -o ./my-sdk
```

#### Generate SDKs in TypeScript and Python

```bash
postman sdk generate 12345-abcde-67890 -l typescript python -o ./sdks
```

#### Generate SDKs in all supported languages

```bash
postman sdk generate 12345-abcde-67890 --all -o ./sdks
```

#### Generate and auto-overwrite the existing SDKs

```bash
postman sdk generate 12345-abcde-67890 -l typescript --yes -o ./sdks
```

#### Verbose generation

```bash
postman sdk generate 12345-abcde-67890 -l java --verbose
```

#### Show detailed generation progress and logs

```bash
postman sdk generate 12345-abcde-67890 -l java --verbose
```

#### Trigger a server-side build and PR without downloading artifacts

```bash
postman sdk generate 12345-abcde-67890 -l typescript --no-emit --yes
```

You must [connect your GitHub repo](#postman-sdk-connect-github) to trigger server-side builds that automatically open or update pull requests.

#### Generate a CLI from a collection ID

```bash
postman sdk generate 12345-abcde-67890 -l cli --output-dir ./my-cli
```

#### Generate a CLI from a specification ID

```bash
postman sdk generate 67890-fghij-12345 --language cli --output-dir ./my-cli
```

#### Regenerate an SDK with change tracking turned off

```bash
postman sdk generate <id> -l typescript --no-track-changes
```

#### Regenerate an SDK with merge skipped

```bash
postman sdk generate <id> -l typescript --no-merge
```

#### Regenerate an SDK with a specific conflict strategy

```bash
postman sdk generate <id> -l typescript --conflict-strategy mark
```

## postman sdk track

The `postman sdk track` command initializes change tracking for an SDK generated before this feature was available. It computes file hashes and writes them into the existing manifest file. After you run this command, the next time you regenerate an SDK, the CLI detects any changes you made in the generated files and merges them to the regenerated SDK. You must run this command before you make any edits or your changes are lost.

To use this command, sign in to Postman with [the `postman login` command](/docs/postman-cli/postman-cli-auth#postman-login). Learn more about [common authentication and authorization errors](/docs/sdk-generator/troubleshoot#common-authentication-and-authorization-errors).

### Usage

```bash
postman sdk track <languages> [options]
```

### Options

Target output(s) for SDK and CLI generation. Specify one or more outputs: `typescript`, `python`, `java`, `kotlin`, `csharp`, `go`, `php`, `ruby`, or `cli`.

Select the directory to save the downloaded SDKs.

Display help for the command.

### Examples

#### Turn on tracking for a TypeScript SDK

```bash
postman sdk track -l typescript
```

#### Turn on tracking for SDKs in multiple languages

```bash
postman sdk track -l typescript python
```

#### Turn on tracking for a custom output directory

```bash
postman sdk track -l typescript -o ./my-sdks
```

## postman sdk list

The `postman sdk list` command lists builds for a specific collection. If you encounter errors, see [List commands errors](/docs/sdk-generator/troubleshoot/#list-command-errors).

To use this command, sign in to Postman with [the `postman login` command](/docs/postman-cli/postman-cli-auth#postman-login). Learn more about [common authentication and authorization errors](/docs/sdk-generator/troubleshoot#common-authentication-and-authorization-errors).

### Usage

```bash
postman sdk list|ls <collectionId> [options]
```

Postman Collection ID in the `12345-abcde-67890` format.

### Options

Filter builds by status with one of these choices: `IN_PROGRESS`, `SUCCESS`, or `FAILURE`.

Select the output format with one of these choices: `json` or `table`.

Display help for the command.

### Examples

#### List all builds for a collection

```bash
postman sdk list 12345-abcde-67890
```

#### List only successful builds

```bash
postman sdk list 12345-abcde-67890 --status SUCCESS
```

#### List in-progress builds

```bash
postman sdk list 12345-abcde-67890 --status in-progress
```

#### List failed builds

```bash
postman sdk list 12345-abcde-67890 --status failure
```

#### Output as JSON

```bash
postman sdk list --output json
```

## postman sdk fetch

The `postman sdk fetch` command lets you download previously generated SDKs from a build by its ID, so that you can retrieve and use them locally. If you encounter errors, see [Get/Fetch commands errors](/docs/sdk-generator/troubleshoot/#getfetch-command-errors).

To use this command, sign in to Postman with [the `postman login` command](/docs/postman-cli/postman-cli-auth#postman-login). Learn more about [common authentication and authorization errors](/docs/sdk-generator/troubleshoot#common-authentication-and-authorization-errors).

### Usage

```bash
postman sdk fetch|get|download <buildId> [options]
```

### Options

Select the directory to save the downloaded SDKs.

Target language(s) for SDK generation. Specify one or more languages for SDK generation: `typescript`, `python`, `java`, `kotlin`, `csharp`, `go`, `php`, `ruby`, or `rust`.

Overwrite existing files without confirmation.

Show detailed generation progress and logs.

Display help for the command.

### Examples

#### Download SDKs from a build

```bash
postman sdk get 12345
```

#### Download SDKs to a specific directory

```bash
postman sdk fetch 12345 --output-dir ./my-sdks
```

#### Overwrite the existing files

```bash
postman sdk download 12345 --overwrite
```

#### Download SDKs in a specific language

```bash
postman sdk fetch 12345 --language typescript
```

#### Download SDKs in several languages

```bash
postman sdk fetch 12345 --l java typescript
```

## postman sdk connect github

The `postman sdk connect github` command connects a Postman Collection or API specification to a GitHub repository. Once a connection exists, every successful [`postman sdk generate`](#postman-sdk-generate) build (by ID) automatically opens or updates a pull request in the target repository.

By default, the server pushes through the installed Postman GitHub App (`--auth-provider githubapp`). If the server returns an auth error, install the GitHub App from your Postman workspace settings.

If you encounter errors, see [Connect commands errors](/docs/sdk-generator/troubleshoot/#connect-command-errors).

Learn how to [generate an SDK in a specific language and sync it with your GitHub project](/docs/sdk-generator/generate/).

To use this command, sign in to Postman with [the `postman login` command](/docs/postman-cli/postman-cli-auth#postman-login). Learn more about [common authentication and authorization errors](/docs/sdk-generator/troubleshoot#common-authentication-and-authorization-errors).

### Usage

```bash
postman sdk connect <provider> <id> [options]
```

Postman Collection ID in the `12345-abcde-67890` format.

### Arguments

OAuth provider (only `github`).

Postman Collection ID or specification ID (UUID).

### Options

SDK language.

GitHub repository in `<owner>/<name>` form (alternative to `--repo-owner` + `--repo-name`).

GitHub repository owner (user or org).

GitHub repository name.

Target branch for SDK pull requests.

Push SDK updates directly to the base branch instead of opening a pull request.

Inject a GitHub Actions workflow that publishes to npm on merge (TypeScript only).

OAuth provider used by the server when pushing.

Show extra logging.

Display help for the command.

### Examples

#### Connect a collection to a GitHub repo for TypeScript SDK PRs

```bash
postman sdk connect github 12345-abcde-67890 --language typescript --repo my-org/my-sdk
```

#### Connect a specification using a non-default branch

```bash
postman sdk connect github 67890-fghij-12345 -l python --repo my-org/python-sdk --branch develop
```

#### Push SDK updates to base instead of opening a PR

```bash
postman sdk connect github 12345-abcde-67890 -l java --repo my-org/java-sdk --push-to-base
```

## postman sdk connections list

Use the singular [`postman sdk connect github`](#postman-sdk-connect-github) command to create a GitHub connection. Use the plural `postman sdk connections` command group to list or [delete](#postman-sdk-connections-delete) existing connections.

The `postman sdk connections list` command lists all GitHub connections for a given collection or specification. Shows language, target repo, branch, and latest PR status for each connection.

To use this command, sign in to Postman with [the `postman login` command](/docs/postman-cli/postman-cli-auth#postman-login). Learn more about [common authentication and authorization errors](/docs/sdk-generator/troubleshoot#common-authentication-and-authorization-errors).

### Usage

```bash
postman sdk connections list <id> [options]
```

### Arguments

Collection ID or Specification ID (UUID).

### Options

Refresh PR statuses from GitHub before listing.

Output raw JSON instead of formatted text.

Show extra logging.

Display help for the command.

### Examples

#### List connections for a collection

```bash
postman sdk connections list 12345-abcde-67890
```

#### Refresh PR statuses from GitHub before listing

```bash
postman sdk connections list 12345-abcde-67890 --refresh
```

#### Output raw JSON for scripting

```bash
postman sdk connections list 12345-abcde-67890 --json
```

## postman sdk connections delete

The `postman sdk connections delete` command deletes a GitHub connection by its numeric connection ID.

To use this command, sign in to Postman with [the `postman login` command](/docs/postman-cli/postman-cli-auth#postman-login). Learn more about [common authentication and authorization errors](/docs/sdk-generator/troubleshoot#common-authentication-and-authorization-errors).

### Usage

```bash
postman sdk connections delete <id> <connectionId> [options]
```

### Arguments

Collection ID or Specification ID (UUID).

Numeric connection ID to delete (shown in `connections list` output).

### Options

Skip the confirmation prompt.

Show extra logging.

Display help for the command.

### Examples

#### Delete connection 42 with a confirmation prompt

```bash
postman sdk connections delete 12345-abcde-67890 42
```

#### Delete connection 42 without a confirmation prompt

```bash
postman sdk connections delete 12345-abcde-67890 42 --yes
```