Developer tool
Convert cURL commands into ready-to-run code in your language.
const response = await fetch("https://api.example.com/data", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer sk-abc123",
},
body: JSON.stringify({
"name": "test",
"value": 42
}),
});
const data = await response.json();
console.log(data);interface ApiResponse {
// Define your response type here
[key: string]: unknown;
}
const response = await fetch("https://api.example.com/data", {
method: "POST" as const,
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer sk-abc123",
} as Record<string, string>,
body: JSON.stringify({
"name": "test",
"value": 42
}),
});
const data: ApiResponse = await response.json();
console.log(data);import requests
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer sk-abc123",
}
payload = {
"name": "test",
"value": 42
}
response = requests.post("https://api.example.com/data", headers=headers, json=payload)
print(response.json())import fetch from "node-fetch";
const response = await fetch("https://api.example.com/data", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer sk-abc123",
},
body: JSON.stringify({
"name": "test",
"value": 42
}),
});
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader(`{"name": "test", "value": 42}`)
req, err := http.NewRequest("POST", "https://api.example.com/data", body)
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer sk-abc123")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
resBody, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(resBody))
}
New tutorials, open-source projects, and deep dives on coding agents - delivered weekly.