REST File to cURL
Turn a REST client request file — .http, .rest or .ain, with {{variables}} and an environment — into runnable curl commands. Nothing is sent: the file is parsed in your browser and returned as command text.
About this tool
A request file is the plain-text format your editor's REST client uses — a
.http or .rest file in VS Code or IntelliJ, or an .ain template. It holds
one or more HTTP requests with {{variables}} standing in for the host, tokens
and IDs that change between environments. It is great inside the editor, and
useless the moment you need to hand the request to someone who doesn't use that
editor, drop it into a CI script, or paste it into a bug report.
This tool expands the file and prints the equivalent curl commands. Paste the file, paste your variable values, and copy the result. Everything happens in your browser — no file, URL, header or token is uploaded anywhere.
What it understands
.http/.restfiles — a request line likeGET https://api.example.com/users HTTP/1.1(the method is optional and defaults toGET, as does theHTTP/1.1suffix), header lines, a blank line, then the body.- Several requests in one file —
###separates them, and any text after the###becomes the request's name, as does a# @name logincomment. Convert all of them at once, or pick one by name or 1-based index. - Comments — lines starting with
#or//are ignored. - File variables —
@host = https://api.example.comdeclares one,{{host}}uses it, and a variable may reference other variables recursively. - Wrapped query strings — continuation lines starting with
?or&are appended to the URL, so a long query can stay readable in the file. - Form bodies — when the content type is
application/x-www-form-urlencoded, body lines starting with&are joined back into one encoded string. - File bodies —
< ./payload.jsonand<@ ./payload.jsonbecome--data-binary '@./payload.json', so curl reads the file at run time. .aintemplates —[Method],[Host],[Query],[Headers]and[Body]sections, with$VARand${VAR}substitution. Detected automatically, or forced with the format selector.
Supplying variables
The variables box takes whichever shape you already have:
- a flat JSON object:
{"host":"https://api.example.com","token":"abc"} - a JSON document of named environments:
{"dev":{...},"prod":{...}}— the same shape as anhttp-client.env.jsonfile. Put the name you want (dev,prod, …) in the environment field. KEY=VALUElines, like a.envfile. A leadingexport,#comments and surrounding quotes are stripped.
System variables are resolved from your browser's clock: {{$guid}} /
{{$uuid}}, {{$timestamp}} and {{$datetime}} (both accept an offset such as
-1 d or 2 h, and $datetime accepts iso8601, rfc1123 or a strftime
pattern), {{$randomInt 1 100}}, and {{$processEnv NAME}} / {{$dotenv NAME}}
which read from the variables you supplied.
Anything still missing is, by your choice, left in place as a {{placeholder}}
you can fill in by hand, replaced with an empty string, or reported as an error
listing every name it couldn't find.
Shaping the output
Pick the shell the command has to run in and the quoting follows: bash
(single quotes, \ continuations), cmd (double quotes, ^) or powershell
(single quotes with doubled escapes, backtick continuations, and curl.exe so
the command doesn't hit PowerShell's Invoke-WebRequest alias). Choose short
flags (-X, -H, -d) or long ones (--request, --header, --data-raw),
wrap the command across lines or keep it on one, and add -L, --compressed or
-k as needed.
Privacy
Everything runs locally in WebAssembly. Nothing is sent: this tool never performs the request, it only writes the command. Your hosts, bearer tokens and request bodies never leave your device, and there is no sign-up.
FAQ
Which request-file format does this expect?
The .http/.rest format used by the VS Code REST Client extension and the
IntelliJ / JetBrains HTTP Client — they are the same format, so a file written
for one works here. .ain template files are supported too, and are detected
automatically by their [Section] headers. If auto-detection guesses wrong on an
unusual file, force the format with the selector.
How do I use my http-client.env.json environments?
Paste the whole JSON document into the variables box and put the environment's
name — dev, prod, or whatever you called it — in the environment field. If
the document contains more than one environment and you don't name one, the tool
stops and lists the names it found rather than guessing.
Private values from an http-client.private.env.json overlay aren't merged
automatically, because only one document is accepted. Copy the private values
into the pasted JSON (or into the KEY=VALUE box) yourself.
Can it read my real environment variables or a .env file on disk?
No, and that's deliberate: the tool runs sandboxed in your browser, with no
access to your machine. {{$processEnv NAME}} and {{$dotenv NAME}} still work
— they resolve against the variables you paste in, so you can keep the file
unchanged and supply the values here.
What happens to a variable I don't have a value for?
That's the "missing variables" setting. Keep (the default) leaves the
{{placeholder}} untouched in the generated command, which is handy when you
want to hand someone a template to fill in. Empty substitutes an empty
string. Error refuses to generate anything and lists every unresolved name,
which is what you want when a silently blank token would send a request you can't
explain.
Does it send the request or show me a response?
No. This tool only rewrites the file as command text — it never opens a connection. Copy the command and run it yourself when you're ready.
Why is my body shown as --data-binary '@file' instead of its contents?
Because the body was a < ./payload.json file reference, and the file lives on
your disk, not in the pasted text. --data-binary '@./payload.json' tells curl
to read exactly that file when the command runs, which is the faithful
translation — run the command from the same directory as the request file and it
behaves identically.
Which shell should I pick?
Whichever one will run the command. Quoting rules differ enough that a bash
command pasted into cmd.exe frequently breaks on the first quote. Pick
powershell on Windows PowerShell or pwsh — it also emits curl.exe rather
than curl, because curl is an alias for Invoke-WebRequest there and doesn't
accept curl's flags.
Developer & Automation Access
Run it from the terminal
Same engine as this page, headless — via the gizza CLI:
gizza tool rest-file-to-curl '@host = https://api.example.com
### create item
POST {{host}}/v1/items HTTP/1.1
Content-Type: application/json
X-Trace-Id: {{trace_id}}
{"name":"gizza"}'New to the CLI? Get gizza →
Open it by URL
Pre-fill and auto-run this tool with query parameters — the names match the API/CLI:
https://gizza.ai/tools/rest-file-to-curl/?data=%40host%20%3D%20https%3A%2F%2Fapi.example.com%0A%0A%23%23%23%20create%20item%0APOST%20%7B%7Bhost%7D%7D%2Fv1%2Fitems%20HTTP%2F1.1%0AContent-Type%3A%20application%2Fjson%0AX-Trace-Id%3A%20%7B%7Btrace_id%7D%7D%0A%0A%7B%22name%22%3A%22gizza%22%7D&env=%7B%22host%22%3A%22https%3A%2F%2Fapi.example.com%22%2C%22trace_id%22%3A%22abc123%22%7D&environment=prod&request=all&format=auto&shell=bash&flag_style=short&multiline=true&unresolved=keep&follow_redirects=true&compressed=true&insecure=true&include_comments=trueMachine-readable descriptor: tool.json — title + parameters JSON Schema for agents.
