ModernCalcs

API Request Builder

Build an HTTP request visually and get the equivalent curl command or fetch() code.

curl -X POST 'https://api.example.com/v1/users?limit=10' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "Jane Doe",
  "email": "jane@example.com"
}'

API Request Builder: Assemble Once, Export Anywhere

Building up a request with several query parameters and headers is easier through a form than typing raw curl flags or a fetch() options object by hand — and error-prone to get the quoting right either way. This tool lets you assemble the request visually, then generates correctly-quoted curl or fetch() code from the same underlying request.

Formula
{ method, url, params, headers, body } → curl -X METHOD 'url?params' -H '...' -d '...' | fetch(url, { method, headers, body })

Query parameters are URL-encoded and appended automatically; curl output uses shell-safe single-quote escaping throughout.

One Request, Two Export Formats

Building the request once and switching between curl and fetch() output means you don't have to re-enter the same URL, headers, and body twice if you need both a terminal-runnable command and a JavaScript snippet — useful when documenting an API call for teammates who might reach for either.

Why Query Params Get Their Own Section

Hand-appending `?limit=10&sort=desc` to a URL is easy to get wrong when values need encoding (spaces, special characters, unicode). Building params as key/value rows and letting the tool URL-encode and join them removes that whole class of mistake.

Practical Examples

Building a Filtered List Request

A GET request with query parameters.

  • 1.Method: GET, URL: https://api.example.com/orders
  • 2.Add params: status=shipped, limit=20
  • 3.Copy the generated curl command

What Gets Built

  • Method and base URL
  • Query parameters (URL-encoded)
  • Headers
  • Request body (for non-GET/HEAD methods)

Good Use Cases

  • Assembling a request without hand-writing curl syntax
  • Generating a fetch() snippet to paste into your code
  • Documenting an API call for a teammate
  • Quickly iterating on headers/params before testing

Frequently Asked Questions

Does this actually send the request?

No — this tool only builds the equivalent curl command or fetch() code for you to copy and run yourself. For a version that actually sends the request from your browser and shows the response, use the companion API Tester tool.

How are query parameters added to the URL?

Each query param row is URL-encoded and appended to your URL with the correct ? or & separator, depending on whether your URL already contains a query string.

How is the curl command quoted?

Every value — the URL, header values, the body — is wrapped in properly-escaped single quotes, so the generated command runs correctly in a terminal even when values contain spaces or special characters.

Why is the body field hidden for GET/HEAD requests?

GET and HEAD requests conventionally don't carry a request body — the field is hidden to match that convention; switch to POST/PUT/PATCH/DELETE to add one.

Is my data sent anywhere?

No, the request is only assembled locally in your browser as code — no network request is made by this tool.