cURL to k6 Load Test — Convert a Real Request into a Performance Suite
Turn a single cURL into a full k6 load test: thresholds, checks, ramping VUs, and CI-friendly output. Includes a free cURL → k6 converter.

2026-07-17 · By Avinash K
The fastest path from "I want to load-test this endpoint" to "here is a passing k6 script running in CI" is capture a real cURL, convert to k6, add thresholds. Here is the full workflow.
Step 1 — capture cURL from DevTools
Open the target request in Chrome DevTools → Network → right-click → Copy → Copy as cURL. Paste into the cURL → Code Converter and pick "k6" as the target.
Step 2 — the generated k6 script
import http from 'k6/http';
import { check, sleep } from 'k6';
export const options = {
vus: 20,
duration: '2m',
thresholds: {
http_req_failed: ['rate<0.01'],
http_req_duration: ['p(95)<800'],
},
};
export default function () {
const res = http.post('https://api.example.com/orders',
JSON.stringify({ productId: 42, qty: 2 }),
{ headers: { 'Content-Type': 'application/json',
'Authorization': `Bearer ${__ENV.API_TOKEN}` } });
check(res, { 'status is 201': (r) => r.status === 201 });
sleep(1);
}Step 3 — ramping VUs for realistic traffic
export const options = {
stages: [
{ duration: '30s', target: 10 },
{ duration: '2m', target: 50 },
{ duration: '30s', target: 0 },
],
};Step 4 — export results
k6 run --out json=result.json script.js
k6 run --out influxdb=http://localhost:8086/k6 script.jsStep 5 — gate in CI
k6 exits non-zero when thresholds fail. Add it as a GitHub Actions step and PR checks fail automatically when p95 regresses.