---
title: "cURL & HAR to JMeter JMX Converter"
description: "Convert cURL commands and HAR files into valid Apache JMeter JMX test plans. Supports GET, POST, PUT, DELETE, PATCH, and RFC 9838 QUERY."
url: https://docs.jmeter.ai/tools/curl-to-jmx/
source: docs.jmeter.ai
---

# cURL & HAR to JMeter JMX Converter

[All Tools Hub](/tools/)/cURL & HAR to JMeter JMX Converter

# cURL & HAR to JMeter JMX Converter

Convert cURL commands and HAR files into valid Apache JMeter JMX test plans. Supports GET, POST, PUT, DELETE, PATCH, and RFC 9838 QUERY.

JMX ConverterJMeter 5.6.3 Validated

## How the Converter Works

Creating JMeter test plans manually for dozens of API endpoints is slow and error-prone. This converter takes raw **cURL commands** (from Swagger, Postman, browser DevTools, or terminal history) and **HAR 1.2 network captures**, automatically structuring them into a production-grade Apache JMeter 5.6.3 `.jmx` test plan.

### What Gets Automatically Generated?

1. **HTTP Request Defaults (`ConfigTestElement`)**: Detects the dominant target domain across your requests and parameterizes it into `${BASE_URL}`, making environment switching (Dev $\to$ Staging $\to$ Prod) effortless.
2. **HTTP Header Manager (`HeaderManager`)**: Preserves required custom headers (`Content-Type`, `Accept`, `X-Api-Key`), while stripping transport-level noise (`Content-Length`) that JMeter calculates dynamically.
3. **HTTP Cookie Manager (`CookieManager`)**: Auto-injected to manage session cookies and cross-request state across iterations.
4. **Auth Parameterization**: Automatically detects `Authorization: Bearer <token>` and parameterizes it as `${AUTH_TOKEN}` in User Defined Variables.
5. **Robust Timeouts**: Connect timeout is preset to `5000ms` and response timeout to `15000ms` on every sampler to prevent thread pool lockup during load spikes.
6. **Response Code Assertions**: Generates baseline `ResponseAssertion` elements validating HTTP 200, 201, and 204 status codes.

---

## Full HTTP Method Support (Including `QUERY` RFC 9838)

The converter supports all standard and modern HTTP methods:

| Method | JMeter Implementation | Use Case |
| --- | --- | --- |
| `GET` | `HTTPSamplerProxy` (Query Params in Arguments or Path) | Fetching resources and reading data |
| `POST` | `HTTPSamplerProxy` (`postBodyRaw="true"` or Form fields) | Creating resources / authentication |
| `QUERY` | `HTTPSamplerProxy` (`postBodyRaw="true"`, Method=`QUERY`) | Safe, idempotent complex queries with JSON payload bodies (Elasticsearch, GraphQL, modern REST) |
| `PUT` | `HTTPSamplerProxy` (`postBodyRaw="true"`) | Full resource replacement |
| `PATCH` | `HTTPSamplerProxy` (`postBodyRaw="true"`) | Partial resource modification |
| `DELETE` | `HTTPSamplerProxy` | Removing resources |
| `HEAD` / `OPTIONS` | `HTTPSamplerProxy` | Health checks and CORS preflight |

### Example: HTTP `QUERY` Method in cURL

```bash
curl -X QUERY "https://api.example.com/v1/catalog/search" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sample-jwt-token-xyz" \
  -d '{
    "filter": { "status": "in_stock", "price": { "lte": 150 } },
    "sort": "price:asc"
  }'
```

The converter translates this into a valid JMeter HTTP Sampler with the `QUERY` method and raw payload body configured without requiring custom plugins.

---

## Running the Generated JMX in CLI Mode

Once you download the `.jmx` file, run it in non-GUI mode from your terminal:

```bash
jmeter -n -t test-plan.jmx -l results.jtl -e -o ./report
```

You can override virtual users dynamically at runtime:

```bash
jmeter -n -t test-plan.jmx -Jthreads=100 -l results.jtl -e -o ./report
```

To run for a fixed duration, set **Duration** to a value greater than zero before downloading the plan. This enables JMeter’s scheduler and generates the required infinite-loop behavior; adding `-Jduration` to a plan converted with Duration `0` does not enable the scheduler.

---

## Use via AI Agent (MCP Tool)

You can call this converter directly inside **Claude Code, Cursor, Windsurf, Qwen Code, and Copilot** via our free Model Context Protocol server:

```bash
claude mcp add jmeter-docs https://docs.jmeter.ai/api/mcp --transport http --scope user
```

Prompt your AI agent:

> *“Convert this cURL command into a JMeter test plan with 50 threads and 10s rampup: `curl -X QUERY https://api.example.com/v1/search -H 'Content-Type: application/json' -d '{\"query\":\"loadtest\"}'`”*

Your agent calls `convert_curl_or_har_to_jmx` and outputs schema-valid XML ready for execution.
