For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Postman
PricingEnterprise
Contact SalesSign InSign Up for Free
HomeDocs
HomeDocs
      • Overview
        • Overview
        • Postman Echo service
        • Postman Collection SDK
        • Postman Runtime library
        • Postman code generator
        • API format conversion
Postman API Platform

Product

  • Postman Overview
  • Enterprise
  • Spec Hub
  • Flows
  • Agent Mode
  • API Catalog
  • Fern
  • Postman CLI
  • Integrations
  • Workspaces
  • Plans and pricing

API Network

  • App Security
  • Artificial Intelligence
  • Communication
  • Data Analytics
  • Database
  • Developer Productivity
  • DevOps
  • Ecommerce
  • eSignature
  • Financial Services
  • Payments
  • Travel

Resources

  • Postman Docs
  • Academy
  • Community
  • Templates
  • Intergalactic
  • Videos
  • MCP Servers

Legal and Security

  • Legal Terms Hub
  • Terms of Service
  • Postman Product Terms
  • Security
  • Website Terms of Use

Company

  • About
  • Careers and culture
  • Contact us
  • Partner program
  • Customer stories
  • Student programs
  • Press and media
Twitter iconLinkedIn iconGithub iconYouTube iconInstagram iconDiscord icon
Download Postman
Privacy Policy

© 2026 Postman, Inc.

On this page
  • Generate code programmatically
  • Supported languages
  • Next steps
ReferenceDeveloper resources

Generate client code for your API collections

||View as Markdown|
Was this page helpful?
Previous

Configure request and collection runs using the Postman Runtime library

Next

Convert API formats into Postman Collections

Built with

You can generate client code for your API collections in Postman. Postman’s Node.js code generator module converts a request into client code for your target language in conjunction with the Collection SDK.

The code generator takes a Collection SDK request object and turns it into code to make the same request in a client app using the specified language and framework.

You can install the code generator library from npm or by cloning it from its GitHub repo. To get started, check out the code generator module README.

You can also generate client code for a request or collection in Postman.

Generate code programmatically

The following simplified code excerpt demonstrates using convert to build a client code snippet from a Request object with the Collection SDK, targeting Node.js:

1var codegen = require('postman-code-generators'),
2 sdk = require('postman-collection'),
3 request = new sdk.Request('https://www.google.com'),
4 language = 'nodejs',
5 variant = 'request',
6 options = {
7 indentCount: 3,
8 indentType: 'Space',
9 trimRequestBody: true,
10 followRedirect: true
11 };
12codegen.convert(language, variant, request, options,
13 function(error, snippet) {
14 if (error) {
15 // handle error
16 }
17 // handle snippet..
18});

You can use the getOptions method to find config options for your target language:

1var codegen = require('postman-code-generators'),
2 language = 'nodejs',
3 variant = 'Request';
4
5codegen.getOptions(language, variant, function (error, options) {
6 if (error) {
7 // handle error
8 }
9 console.log(options);
10});

The getLanguageList method returns available languages your request client code can target:

1var codegen = require('postman-code-generators'),
2 supportedCodegens = codegen.getLanguageList();
3 console.log(supportedCodegens);

Supported languages

The code generator module is an open-source project. If there is a language or framework you’d like to generate client code for, but it isn’t provided, you can add it by contributing to the project. This lets other users access your contribution both in the repo and in Postman itself.

Next steps

If you’re using Postman to work with client applications, you can also capture request data. Learn more about capturing request data.