Generate code snippets

Once you’ve finalized and saved your request in Postman, you might want to make the same request from your own application. Postman lets you generate snippets of code in various languages and frameworks that will help you do this. Copy the code from Postman, and paste it into your own application.

Click the Code link under the blue Send button to open the GENERATE CODE SNIPPETS modal.

generate code link

Selecting a language

Use the dropdown menu to select a language or framework - some have multiple options to customize your code snippet.

languages dropdown

If you enable New Code Generation Mode under the general settings, you will see an additional settings icon at the top of this modal.

code gen settings

These settings vary by programming language and allow you to customize the way Postman generates these code snippets. Configure these settings to accommodate a project's specific linting requirements, line continuation characters for your operating system, or to suit your personal preferences.

code gen specifics

Don't see your language of choice, or is there a setting missing that you'd find useful? Click Contribute on GitHub within this modal to contribute to the open source project.

Supported languages/frameworks

Postman currently supports the following options:

Language Framework
HTTP None (Raw HTTP request)
C LibCurl
cURL None (Raw cURL command)
C# RestSharp
Go Built-in http package
Java OkHttp
Java Unirest
JavaScript jQuery AJAX
JavaScript Built-in XHR
NodeJS Built-in http module
NodeJS Request
NodeJS Unirest
Objective-C Built-in NSURLSession
OCaml Cohttp
PHP HttpRequest
PHP pecl_http
PHP Built-in curl
Python Built-in http.client (Python 3)
Python Requests
Ruby Built-in NET::Http
Shell wget
Shell HTTPie
Shell cURL
Swift Built-in NSURLSession