Supported Languages

Generate ready-to-use code from any API request in 15 languages. One click to export, one click to copy.

CODE EXPORT

Code export panel with language dropdown showing all 15 options

Overview

Generate ready-to-use code from any request in 15 languages. Click the </> button next to Send to open the code export panel.

Variables are resolved in generated output — {{base_url}} becomes the actual value
Auth headers and params are injected automatically into the generated code
Copy to clipboard with one click — paste directly into your project
No need to send the request first — export works from the current request state

Supported Languages (15)

All major languages and tools covered — from shell scripts to compiled languages:

LanguageLibrary / ToolNotes
cURL (Unix)curl CLIBash syntax, single-quotes
cURL (Windows)curl CLIcmd syntax, double-quotes, ^ line continuation
PowerShellInvoke-WebRequestPowerShell cmdlet
JavaScript (Fetch)fetch APIBrowser/Node.js fetch API
JavaScript (Axios)axiosaxios library with async/await
Python (Requests)requestsrequests library
Python (http.client)http.clientstdlib, no dependencies
Gonet/httpstdlib
JavaHttpURLConnectionJava 11+
C#HttpClient.NET
Rubynet/httpstdlib
PHPcURL extension (curl_*)cURL extension
Rustreqwest + tokioreqwest crate with tokio
SwiftURLSessionFoundation framework
grpcurlgrpcurl CLIgRPC CLI tool (only for gRPC requests)

How to Export

Five steps from request to code — no need to send the request first:

1

Build your request

Set the URL, headers, body, and auth as needed

2

Click the </> button

Located in the request builder toolbar, next to the Send button

3

Select language from dropdown

Choose from 15 languages — your selection is remembered

4

Code generated instantly

All variables resolved, auth injected, body serialized for the target language

5

Click 'Copy' to clipboard

Paste directly into your project or terminal

💡 Tip: No need to send the request first — export works from the current request state. Build your request and export immediately.

What's Included in Generated Code

The generated code includes everything needed to reproduce the request:

Resolved URL — variables replaced with actual values from the active environment
HTTP method — GET, POST, PUT, PATCH, DELETE, etc.
All enabled headers — including auth-injected ones (Bearer, Basic, API Key)
Request body — serialized appropriately for the target language
Query parameters — appended to URL or constructed via the language's API
Content-Type header — set based on body type
Comment stripping — inline body comments removed before export
gRPC export: For gRPC requests, the grpcurl output includes -plaintext flag, -proto path, -H metadata headers, and -d message body.

Examples

Given a POST request to https://api.example.com/users with Bearer auth and a JSON body, here's the output in three languages:

cURL (Unix)

curl -X POST 'https://api.example.com/users' \
  -H 'Authorization: Bearer token123' \
  -H 'Content-Type: application/json' \
  -d '{"name":"John"}'

Python (Requests)

import requests

url = "https://api.example.com/users"
headers = {
    "Authorization": "Bearer token123",
    "Content-Type": "application/json"
}
payload = {"name": "John"}

response = requests.post(url, headers=headers, json=payload)
print(response.json())

JavaScript (Fetch)

const response = await fetch("https://api.example.com/users", {
  method: "POST",
  headers: {
    "Authorization": "Bearer token123",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({ name: "John" })
});

const data = await response.json();
console.log(data);
Generated cURL code from a request

Code export panel showing generated cURL from a request with auth and JSON body

CLI Export

Export code from the command line — useful for scripting and CI/CD pipelines:

openpost export curl "Collection" "Request Name" --env production
Outputs generated code to stdout — pipe to a file or clipboard
Variables resolved from the specified environment
Also available via the Management MCP server: export_curl tool

Next

Ko-fi