Code Snippets
The Code tab in the request builder generates ready-to-use code for the current request in 17 languages.
How to Use
- Build your request (URL, method, headers, body, auth)
- Click the Code tab
- Choose a language from the dropdown
- Click Copy to copy the snippet to your clipboard
The generated code includes all the request's current settings: headers, params, body, and authentication.
Supported Languages
| Category | Languages |
|---|---|
| Shell | cURL, HTTPie, PowerShell (Invoke-RestMethod) |
| JavaScript | Fetch API, Axios |
| Node.js | Fetch (Node 18+) |
| Python | requests, httpx |
| PHP | cURL |
| Go | net/http |
| Ruby | Net::HTTP |
| C# | HttpClient |
| Java | HttpClient (Java 11+) |
| Kotlin | OkHttp |
| Swift | URLSession |
| Dart | http package |
| Rust | reqwest |
Example — Python requests
For a POST /users with a JSON body and Bearer token:
import requests
url = "https://api.example.com/users"
headers = {
"Authorization": "Bearer mytoken",
"Content-Type": "application/json"
}
payload = {
"name": "Alice",
"email": "alice@example.com"
}
response = requests.post(url, json=payload, headers=headers)
print(response.status_code)
print(response.json())
Variables
If your request uses {{variables}}, the generated snippet shows the resolved values at the time of generation (based on your current active environment).