curl Flags Reference

Search every curl option flag with description, short form and usage examples

Interactive curl command-line option reference covering HTTP methods, headers, data and form uploads, authentication, TLS, proxies, redirects and output control — each with short/long forms and an example.

How do I send JSON with curl?

Set the content type and pass the body with -d (--data). For example: curl -X POST -H 'Content-Type: application/json' -d '{"name":"A"}' https://api.example.com/users. Newer curl (7.82+) also offers --json which sets the header, accept and body in one flag.

curl is the universal command-line tool for transferring data over HTTP, HTTPS and many other protocols. Its power lives in its options: dozens of flags control the method, headers, body, authentication, TLS behaviour and output. This reference lets you search the most-used flags with their short forms and examples.

How it works

A curl invocation is curl [flags] URL. Flags either take a value (like -H 'Header: value' or -d 'body') or are simple switches (like -L or -k). Many flags have a long --name form and a single-letter short alias; this reference lists both. curl applies the flags in order to build the request, sends it, and writes the response to stdout (or to a file with -o/-O).

Common recipes

# POST JSON and follow redirects
curl -L -X POST -H 'Content-Type: application/json' \
     -d '{"name":"A"}' https://api.example.com/users

# Download a file keeping its remote name
curl -O https://example.com/archive.zip

# Basic auth, show response headers, verbose
curl -i -u user:pass -v https://example.com/private

Notes and tips

-d implies POST and form encoding; pair it with an explicit -H 'Content-Type: application/json' (or use --json) when sending JSON. Use -F for file uploads (multipart). -s silences the progress meter for scripting, and -w '%{http_code}' prints the status code. Reserve -k/--insecure for local testing only — it disables certificate verification.