***

title: Generate code snippets from API requests
approved: 2026-03-13T00:00:00.000Z
max-toc-depth: 2
ux: v12
topictype: multiple
-------------------

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 Postman CLI, C#, JavaScript, and NodeJS.

## Generate code snippets in Postman

1. Open the request you want to use for a code snippet, then click <img alt="Code icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/descriptive-code-stroke.svg#icon" width="20px" /> **Code** in the right sidebar.
2. Select a [language or framework](#supported-languages-and-client-libraries) from the dropdown list.
3. Click <img alt="Copy icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/action-copy-stroke.svg#icon" width="20px" /> **Copy snippet** to copy the code snippet to your clipboard.
4. For more configuration options, like the indentation type and count, click <img alt="Setting icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/descriptive-setting-stroke.svg#icon" width="20px" /> **Code settings** next to the dropdown list. The settings vary based on the chosen language or framework.

## Supported languages and client libraries

Postman supports the following languages and client libraries:

| **Language** | **Framework**                                                                                                                     |
| ------------ | --------------------------------------------------------------------------------------------------------------------------------- |
| C#           | HttpClient                                                                                                                        |
| C#           | [RestSharp](http://restsharp.dev/)                                                                                                |
| cURL         | [cURL](https://curl.se/)                                                                                                          |
| Dart         | [Dio](https://pub.dev/packages/dio)                                                                                               |
| Dart         | HTTP                                                                                                                              |
| Go           | [http package](https://pkg.go.dev/net/http)                                                                                       |
| HTTP         | (Raw HTTP request)                                                                                                                |
| Java         | [OkHttp](https://github.com/square/okhttp)                                                                                        |
| Java         | [Unirest](https://github.com/Kong/unirest-java)                                                                                   |
| JavaScript   | [Fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)                                                               |
| JavaScript   | [jQuery](https://api.jquery.com/jquery.ajax/)                                                                                     |
| JavaScript   | [XHR](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest)                                                            |
| Kotlin       | [OkHttp](https://square.github.io/okhttp/)                                                                                        |
| C            | [LibCurl](https://curl.se/libcurl/c/)                                                                                             |
| NodeJS       | [Axios](https://github.com/axios/axios)                                                                                           |
| NodeJS       | [Native](https://nodejs.org/api/http.html)                                                                                        |
| NodeJS       | [Request](https://github.com/request/request)                                                                                     |
| NodeJS       | [Unirest](https://github.com/Kong/unirest-nodejs)                                                                                 |
| Objective-C  | [NSURLSession](https://developer.apple.com/documentation/foundation/urlsession)                                                   |
| OCaml        | [Cohttp](https://github.com/mirage/ocaml-cohttp)                                                                                  |
| PHP          | [cURL](https://www.php.net/manual/en/ref.curl.php)                                                                                |
| PHP          | [Guzzle](https://docs.guzzlephp.org/en/stable/)                                                                                   |
| PHP          | [Http\_Request2](https://www.php.net/manual/en/reserved.variables.request.php)                                                    |
| PHP          | [pecl\_http](https://mdref.m6w6.name/http)                                                                                        |
| Postman CLI  | [Postman CLI](/docs/postman-cli/postman-cli-requests/#postman-request)                                                            |
| PowerShell   | [RestMethod](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-restmethod?view=powershell-7) |
| Python       | [http.client](https://docs.python.org/3/library/http.client.html) (Python 3)                                                      |
| Python       | [Requests](https://www.w3schools.com/python/module_requests.asp)                                                                  |
| R            | [httr](https://cran.r-project.org/web/packages/httr/index.html)                                                                   |
| R            | [RCurl](https://cran.r-project.org/web/packages/RCurl/index.html)                                                                 |
| Ruby         | [NET::Http](https://docs.ruby-lang.org/en/2.0.0/Net/HTTP.html)                                                                    |
| Rust         | [reqwest](https://docs.rs/reqwest/latest/reqwest/)                                                                                |
| Shell        | [Httpie](https://github.com/httpie/httpie)                                                                                        |
| Shell        | [wget](https://www.gnu.org/software/wget/)                                                                                        |
| Swift        | [URLSession](https://developer.apple.com/documentation/foundation/urlsession)                                                     |

<Info>
  To add a new language or setting, you can contribute to [Postman's open-source project](https://github.com/postmanlabs/postman-code-generators).
</Info>
