Skip to content
CornerTools

cURL Command Generator

Generate ready-to-run cURL commands from HTTP requests with JSON headers and body.

1
1
1
Characters: 0
HTTP method
Body format
Quote style

Builds a ready-to-run cURL command from a URL, headers and a JSON body — for testing APIs, sharing a request with a teammate or pasting into documentation. The command is built in your browser.

How to use it

  1. Enter the request URL and pick the HTTP method: GET, POST, PUT, PATCH or DELETE.
  2. Add headers as a JSON object, such as {"Authorization": "Bearer TOKEN"}.
  3. Add a body — not for GET requests. In JSON format it is any JSON value: an object, an array, a string or a number. In text format it is sent exactly as written, such as form data or XML.
  4. Copy the generated command and run it in a terminal.

The command is written for bash, zsh and other Unix shells — macOS and Linux terminals, Git Bash and WSL on Windows. Windows Command Prompt and PowerShell quote text differently, and in Windows PowerShell 5 curl runs Invoke-WebRequest rather than cURL.

Options

  • Quote style — single quotes, the default, keep $ and backticks literal in bash and zsh; double quotes escape them with backslashes instead.
  • Multiline cURL — splits the command with \ line continuations; off, it is one line.
  • Auto add Content-Type — adds Content-Type: application/json when there is a JSON body and your headers do not set one. For a text body, set the type in the headers; without one, cURL sends application/x-www-form-urlencoded.
  • Include --compressed — asks for a compressed response and decompresses it.
  • Include response headers (-i) — prints the response headers above the body.
  • Trim input — removes spaces around the URL.

A JSON body is sent compacted onto one line, with -d; a text body is sent with --data-raw, which keeps a leading @ as text instead of reading a file. The method is written with -X except for GET, cURL's default.

Examples

A POST with a token and a JSON body

With the default options:

Method
POST
URL
https://api.example.com/v1/users
Headers
{"Authorization": "Bearer TOKEN"}
Body
{"name": "Anna", "role": "admin"}
Command
curl \
  -X POST \
  'https://api.example.com/v1/users' \
  -H 'Authorization: Bearer TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"name":"Anna","role":"admin"}'

See also