Skip to main content

Code Snippets

The Code tab in the request builder generates ready-to-use code for the current request in 17 languages.

How to Use

  1. Build your request (URL, method, headers, body, auth)
  2. Click the Code tab
  3. Choose a language from the dropdown
  4. 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

CategoryLanguages
ShellcURL, HTTPie, PowerShell (Invoke-RestMethod)
JavaScriptFetch API, Axios
Node.jsFetch (Node 18+)
Pythonrequests, httpx
PHPcURL
Gonet/http
RubyNet::HTTP
C#HttpClient
JavaHttpClient (Java 11+)
KotlinOkHttp
SwiftURLSession
Darthttp package
Rustreqwest

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).