Postman can convert an API request into a code snippet. You can then use the generated code snippet in your front-end application to make calls to an API. Postman can generate code snippets for a variety of programming languages and client libraries, including C#, JavaScript, and NodeJS.
This guide has information about generating code snippets from API requests. For information about generating server-side boilerplate code from an API specification, seeGenerate server-side code in the Postman API Builder.
Open the request you want to use for a code snippet, then selectCode in the right sidebar.
Select alanguage or framework from the dropdown list.
SelectCopy snippet to copy the code snippet to your clipboard.
For more configuration options, like the indentation type and count, selectCode settings next to the dropdown list. The settings vary based on the chosen language or framework.
Postman supports the following languages and client libraries:
Language | Framework |
---|---|
C# | HttpClient |
C# | RestSharp |
cURL | cURL |
Dart | Dio |
Dart | HTTP |
Go | http package |
HTTP | (Raw HTTP request) |
Java | OkHttp |
Java | Unirest |
JavaScript | Fetch |
JavaScript | jQuery |
JavaScript | XHR |
Kotlin | OkHttp |
C | LibCurl |
NodeJS | Axios |
NodeJS | Native |
NodeJS | Request |
NodeJS | Unirest |
Objective-C | NSURLSession |
OCaml | Cohttp |
PHP | cURL |
PHP | Guzzle |
PHP | Http_Request2 |
PHP | pecl_http |
PowerShell | RestMethod |
Python | http.client (Python 3) |
Python | Requests |
R | httr |
R | RCurl |
Ruby | NET::Http |
Rust | reqwest |
Shell | Httpie |
Shell | wget |
Swift | URLSession |
To add a new language or setting, you can contribute toPostman’s open-source project.
Last modified: 2025/04/04
Explore ready-to-use Collection Templates, build API-first workflows with Postman Flows, and more!