cURL → Code (2026)
Convert any curl command into JavaScript fetch, Node fetch, Axios, Python requests, or Go net/http. Paste, pick a language, copy. Pure browser, no upload.
const res = await fetch('https://api.specway.com/v1/specs', {
method: 'POST',
headers: {
"Authorization": "Bearer sk_test_123",
"Content-Type": "application/json"
},
body: "{\"name\":\"Pet Store\",\"openapiUrl\":\"https://example.com/openapi.yaml\"}",
});
const data = await res.json();When you reach for this
A teammate sends you a curl in Slack: "hit this endpoint and you'll see the bug." You need that same call in your test suite, your script, your documentation. Paste, pick the language, copy.
Or: API docs only have curl examples and you want something more idiomatic for your codebase. Same workflow.
What gets converted
- URL — the first non-flag positional argument.
- Method — from
-X/--request, defaults to GET (or POST if a body is present). - Headers — every
-H/--headerbecomes a key/value entry. - Body —
-d,--data,--data-raw, and--data-binaryall work. JSON is preserved as-is. - Basic auth —
-u user:passconverts to a base64 Authorization header.
Edge cases the converter punts on
- --form / multipart: language idioms differ (FormData vs files= vs multipart.NewWriter) — convert manually.
- --cookie / cookie jars: state management differs across libraries.
- --cert / --insecure: TLS handling belongs to your HTTP client config, not the request itself.
- --output / file streaming: response streaming is library-specific.
For full code samples in 30+ languages
Specway's docs platform auto-generates code samples in JavaScript, TypeScript, Python, Ruby, PHP, Go, Rust, Java, Kotlin, Swift, C#, and more — for every operation in your OpenAPI spec, kept in sync with every API change. This tool is the quick one-off; Specway is the system.