PerfLoad / curl to k6
curl to k6: Run an Existing curl Request as a k6 Load Test
Converting a curl command to k6 by hand means opening a new file, importing modules, translating headers and a body into JavaScript, and defining options. PerfLoad does that translation for you: it takes the curl request, generates the k6 script, runs it on a k6-backed runner, and hands back the results.
Turn curl Into a Load Test →The runner is a Docker image with k6 already bundled — there is nothing to install besides Docker.
How it works
- Existing curl request
- PerfLoad
- k6 runner
- Performance results
When you start a run, the runner writes a k6 script for your request into that run's directory, starts
k6 run against it, and collects k6's summary when the test ends. PerfLoad links out to k6's own
live dashboard while the test is in progress, so you see request rate, duration, and VUs from k6 itself.
Because each run keeps its generated script alongside its summary, you can see exactly what was executed.
What the translation looks like
Take this request:
curl -X POST 'https://api.example.com/orders' \
-H 'Content-Type: application/json' \
-d '{"productId": "101", "qty": 1}'
Written by hand as a k6 script, a minimal equivalent looks like this. It is illustrative — not a verbatim copy of what PerfLoad generates — but it shows the scaffolding you would otherwise write and maintain yourself:
import http from 'k6/http';
import { check, sleep } from 'k6';
export const options = { vus: 10, duration: '30s' };
export default function () {
const res = http.post(
'https://api.example.com/orders',
JSON.stringify({ productId: '101', qty: 1 }),
{ headers: { 'Content-Type': 'application/json' } }
);
check(res, { 'status is 2xx': (r) => r.status >= 200 && r.status < 300 });
sleep(1);
}
That is not much code for one request. The cost shows up around it: getting the quoting right when you copy headers from a terminal, adding variable data, exporting results somewhere you can read them, and repeating all of it for the next endpoint.
What PerfLoad handles for you
| In a hand-written k6 test | In PerfLoad |
|---|---|
Import modules, define options | Virtual users and duration (or iterations) are fields on the form. |
| Translate URL, headers, and body into JS | Taken from the pasted curl command. |
| Template values yourself | ${variable} placeholders: built-ins plus constant, sequential, and random. |
| Write checks for status and content | A 2xx check is included, and you can add a JSON path, XPath, or text validation. |
| Export and read the summary | Summary, p95/p99, throughput, and error rate shown in the UI and served as JSON. |
| Keep track of runs | Runs are saved to history; open one, compare several, or export a PDF report. |
What this does and doesn't replace
PerfLoad covers the common case — a request, a load profile, and a readable result. It is not a replacement for everything k6 offers. Custom scenarios, multi-step flows with your own logic, extensions, and threshold-based pass/fail rules written in a script are all things you'd write in k6 directly. Treat PerfLoad as the fast path for getting a load test running from a request you already have, and see the k6 comparison for where each approach fits.
Run Single first, then Run Test
A useful habit when you're converting a request: send it once with Run Single, which shows the full response body, and only then start Run Test. Variables behave differently between the two — Run Single resolves them once using the first value, while Run Test resolves them per virtual user and per iteration — so a request that looks right in the single run can still surprise you once the values start rotating. A short first load run catches that cheaply.
FAQ
Do I need k6 installed?
Not if you use the Docker image, which bundles k6. You only need k6 on your PATH if you run the runner from source.
Is this really k6, or a look-alike?
It's k6. The runner spawns a k6 process for every run, and the results come from k6's own summary output.
Can I take the generated script and edit it?
Each run's generated script is stored with the run on the runner. PerfLoad's interface is form-based rather than a script editor, so if you outgrow the form, treat the script as a starting point for your own k6 project.
Related guides
Skip the scaffolding
Keep the curl command you already have and let PerfLoad generate and run the k6 test.
Turn curl Into a Load Test →