Generate SDKs from collections and API specifications

View as Markdown

You can use the Postman CLI or the Postman app to generate your SDK.

Before you generate an SDK, review permissions required to generate SDKs.

Generate SDKs from the CLI

  1. Get the collection or specification ID. In Postman, open your collection or specification, then click Right Sidebar Hidden icon Show right sidebar on the bottom right to open the right sidebar. Click Info icon Info in the right sidebar and copy the ID to use with the postman sdk generate command.

  2. Run the postman sdk generate command with the pasted ID. For example, to generate an SDK in TypeScript, use the following command with your ID and output directory:

    $postman sdk generate <id or path> --language typescript

    Your SDK downloads into the sdks directory in your current working directory.

    You can use the postman sdk list command and navigate to the files from your terminal.

Regenerate SDKs from the CLI

After you make edits to your collection or specification or add custom code, run the postman sdk generate command again to regenerate the SDK. For more information on how the generator detects custom code changes and merges them, see Generate an SDK with custom code using the Postman CLI.

Generate SDKs from the Postman app

  1. Click Collections or Specs in the sidebar to select the collection or specification for which you want to generate an SDK.

  2. Click Options icon View more actions and select More > Generate SDKs from a collection (or just Generate SDK for API specifications).

  3. Name your SDK build. You can use the default name or enter a custom one.

    Name your SDK build
  4. Select your languages. You can select one or more languages for SDK generation: TypeScript, Python, Java, Kotlin, C#, Go, PHP, Ruby, or Rust. You can also select all to generate SDKs in all supported languages.

    Do this with AI

    Generate SDKs using AI. Open the right sidebar and start a new chat. Ask the agent to generate SDKs for you. For example, you can enter “Generate SDKs in Python and Java for this collection.”

  5. Click Generate SDK.

  6. Select the language for your SDK and click Download to get the generated SDK as a zip file. The zip file contains the complete SDK code, which you can integrate into your projects.

    Download an SDK

You can also check the generated documentation, which appears in the SDK panel when your SDK is generated.

To regenerate your SDKs or generate new ones in other languages, select the languages and click Regenerate SDKs.

You can access your SDKs in the left sidebar. Click SDKs to view all your generated SDKs. You can also click Options icon View more actions on an SDK to view the SDK documentation, download the SDK, or regenerate the SDK.

Copy SDK code snippets

Sometimes you’ll need to copy a request snippet from your SDK and paste it in your IDE. As a developer, you might update a request, test it in Postman, generate an SDK, and want to copy the new snippet.

To copy the snippet, do the following:

  1. Open the request from a collection with a generated SDK, then select Code icon Code in the right sidebar.

  2. From the dropdown list, select an SDK option (for example, TypeScript - SDK).

    Select an SDK snippet
  3. Click Copy icon Copy snippet to copy the code snippet to your clipboard.

View the SDK docs

The SDK documentation is autogenerated after you generate your SDK. The documentation refreshes with each new generation.

The SDK docs provide important information, such as installation and usage instructions, service and model details, and more.

To access the docs, in the left sidebar, open SDKs, and click the collection.